aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog2849
-rw-r--r--bfd/ChangeLog-020314
-rw-r--r--bfd/ChangeLog-20046
-rw-r--r--bfd/ChangeLog-20058
-rw-r--r--bfd/ChangeLog-20063601
-rw-r--r--bfd/Makefile.am208
-rw-r--r--bfd/Makefile.in275
-rw-r--r--bfd/acinclude.m420
-rw-r--r--bfd/aclocal.m439
-rw-r--r--bfd/aix386-core.c20
-rw-r--r--bfd/aix5ppc-core.c29
-rw-r--r--bfd/aout-adobe.c13
-rw-r--r--bfd/aout-arm.c23
-rw-r--r--bfd/aout-ns32k.c27
-rw-r--r--bfd/aout-target.h6
-rw-r--r--bfd/aout-tic30.c24
-rw-r--r--bfd/aoutf1.h26
-rw-r--r--bfd/aoutx.h50
-rw-r--r--bfd/archive.c66
-rw-r--r--bfd/archive64.c34
-rw-r--r--bfd/archures.c58
-rw-r--r--bfd/bfd-in.h86
-rw-r--r--bfd/bfd-in2.h354
-rw-r--r--bfd/bfd.c320
-rw-r--r--bfd/bfdio.c19
-rw-r--r--bfd/binary.c16
-rw-r--r--bfd/bout.c24
-rw-r--r--bfd/cache.c4
-rw-r--r--bfd/cf-i386lynx.c4
-rw-r--r--bfd/cisco-core.c18
-rw-r--r--bfd/coff-alpha.c22
-rw-r--r--bfd/coff-apollo.c6
-rw-r--r--bfd/coff-arm.c109
-rw-r--r--bfd/coff-aux.c4
-rw-r--r--bfd/coff-h8300.c10
-rw-r--r--bfd/coff-h8500.c6
-rw-r--r--bfd/coff-i386.c19
-rw-r--r--bfd/coff-i860.c19
-rw-r--r--bfd/coff-i960.c19
-rw-r--r--bfd/coff-ia64.c4
-rw-r--r--bfd/coff-m68k.c29
-rw-r--r--bfd/coff-m88k.c5
-rw-r--r--bfd/coff-maxq.c95
-rw-r--r--bfd/coff-mcore.c23
-rw-r--r--bfd/coff-mips.c21
-rw-r--r--bfd/coff-or32.c8
-rw-r--r--bfd/coff-pmac.c4
-rw-r--r--bfd/coff-ppc.c25
-rw-r--r--bfd/coff-rs6000.c65
-rw-r--r--bfd/coff-sh.c24
-rw-r--r--bfd/coff-sparc.c22
-rw-r--r--bfd/coff-stgo32.c4
-rw-r--r--bfd/coff-tic30.c23
-rw-r--r--bfd/coff-tic4x.c21
-rw-r--r--bfd/coff-tic54x.c21
-rw-r--r--bfd/coff-tic80.c4
-rw-r--r--bfd/coff-w65.c8
-rw-r--r--bfd/coff-we32k.c4
-rw-r--r--bfd/coff-x86_64.c783
-rw-r--r--bfd/coff-z80.c25
-rw-r--r--bfd/coff-z8k.c29
-rw-r--r--bfd/coff64-rs6000.c32
-rw-r--r--bfd/coffcode.h120
-rw-r--r--bfd/coffgen.c19
-rw-r--r--bfd/cofflink.c27
-rwxr-xr-xbfd/config.bfd198
-rw-r--r--bfd/config.in119
-rwxr-xr-xbfd/configure13041
-rw-r--r--bfd/configure.in108
-rw-r--r--bfd/corefile.c6
-rw-r--r--bfd/cpu-alpha.c4
-rw-r--r--bfd/cpu-arc.c5
-rw-r--r--bfd/cpu-arm.c44
-rw-r--r--bfd/cpu-avr.c9
-rw-r--r--bfd/cpu-bfin.c4
-rw-r--r--bfd/cpu-cr16.c40
-rw-r--r--bfd/cpu-cr16c.c4
-rw-r--r--bfd/cpu-cris.c5
-rw-r--r--bfd/cpu-crx.c4
-rw-r--r--bfd/cpu-d10v.c5
-rw-r--r--bfd/cpu-d30v.c4
-rw-r--r--bfd/cpu-dlx.c4
-rw-r--r--bfd/cpu-fr30.c4
-rw-r--r--bfd/cpu-frv.c4
-rw-r--r--bfd/cpu-h8300.c4
-rw-r--r--bfd/cpu-h8500.c4
-rw-r--r--bfd/cpu-hppa.c4
-rw-r--r--bfd/cpu-i370.c4
-rw-r--r--bfd/cpu-i386.c4
-rw-r--r--bfd/cpu-i860.c5
-rw-r--r--bfd/cpu-i960.c32
-rw-r--r--bfd/cpu-ia64.c4
-rw-r--r--bfd/cpu-ip2k.c4
-rw-r--r--bfd/cpu-iq2000.c4
-rw-r--r--bfd/cpu-m10200.c4
-rw-r--r--bfd/cpu-m10300.c4
-rw-r--r--bfd/cpu-m32c.c4
-rw-r--r--bfd/cpu-m32r.c5
-rw-r--r--bfd/cpu-m68hc11.c4
-rw-r--r--bfd/cpu-m68hc12.c4
-rw-r--r--bfd/cpu-m68k.c101
-rw-r--r--bfd/cpu-m88k.c5
-rw-r--r--bfd/cpu-maxq.c4
-rw-r--r--bfd/cpu-mcore.c4
-rw-r--r--bfd/cpu-mep.c28
-rw-r--r--bfd/cpu-mips.c4
-rw-r--r--bfd/cpu-mmix.c4
-rw-r--r--bfd/cpu-msp430.c4
-rw-r--r--bfd/cpu-mt.c4
-rw-r--r--bfd/cpu-ns32k.c4
-rw-r--r--bfd/cpu-openrisc.c4
-rw-r--r--bfd/cpu-or32.c4
-rw-r--r--bfd/cpu-pdp11.c4
-rw-r--r--bfd/cpu-pj.c4
-rw-r--r--bfd/cpu-powerpc.c4
-rw-r--r--bfd/cpu-rs6000.c10
-rw-r--r--bfd/cpu-s390.c4
-rw-r--r--bfd/cpu-score.c51
-rw-r--r--bfd/cpu-sh.c6
-rw-r--r--bfd/cpu-sparc.c4
-rw-r--r--bfd/cpu-spu.c54
-rw-r--r--bfd/cpu-tic30.c4
-rw-r--r--bfd/cpu-tic4x.c4
-rw-r--r--bfd/cpu-tic54x.c4
-rw-r--r--bfd/cpu-tic80.c4
-rw-r--r--bfd/cpu-v850.c4
-rw-r--r--bfd/cpu-vax.c5
-rw-r--r--bfd/cpu-w65.c5
-rw-r--r--bfd/cpu-we32k.c4
-rw-r--r--bfd/cpu-xc16x.c4
-rw-r--r--bfd/cpu-xstormy16.c4
-rw-r--r--bfd/cpu-xtensa.c4
-rw-r--r--bfd/cpu-z80.c4
-rw-r--r--bfd/cpu-z8k.c4
-rw-r--r--bfd/doc/ChangeLog49
-rw-r--r--bfd/doc/Makefile.am26
-rw-r--r--bfd/doc/Makefile.in120
-rw-r--r--bfd/doc/aoutx.texi213
-rw-r--r--bfd/doc/archive.texi99
-rw-r--r--bfd/doc/archures.texi585
-rw-r--r--bfd/doc/bfd.info10305
-rw-r--r--bfd/doc/bfd.texinfo52
-rw-r--r--bfd/doc/bfdint.texi52
-rw-r--r--bfd/doc/bfdio.texi72
-rw-r--r--bfd/doc/bfdt.texi721
-rw-r--r--bfd/doc/bfdwin.texi2
-rw-r--r--bfd/doc/cache.texi65
-rw-r--r--bfd/doc/coffcode.texi608
-rw-r--r--bfd/doc/core.texi60
-rw-r--r--bfd/doc/elf.texi22
-rw-r--r--bfd/doc/elfcode.texi0
-rw-r--r--bfd/doc/format.texi112
-rw-r--r--bfd/doc/hash.texi247
-rw-r--r--bfd/doc/init.texi16
-rw-r--r--bfd/doc/libbfd.texi179
-rw-r--r--bfd/doc/linker.texi380
-rw-r--r--bfd/doc/mmo.texi365
-rw-r--r--bfd/doc/opncls.texi365
-rw-r--r--bfd/doc/reloc.texi2494
-rw-r--r--bfd/doc/section.texi989
-rw-r--r--bfd/doc/syms.texi461
-rw-r--r--bfd/doc/targets.texi551
-rw-r--r--bfd/dwarf1.c4
-rw-r--r--bfd/dwarf2.c502
-rw-r--r--bfd/ecoff.c24
-rw-r--r--bfd/ecofflink.c7
-rw-r--r--bfd/efi-app-ia32.c4
-rw-r--r--bfd/efi-app-ia64.c4
-rw-r--r--bfd/efi-app-x86_64.c34
-rw-r--r--bfd/elf-attrs.c628
-rw-r--r--bfd/elf-bfd.h299
-rw-r--r--bfd/elf-eh-frame.c557
-rw-r--r--bfd/elf-hppa.h988
-rw-r--r--bfd/elf-m10200.c38
-rw-r--r--bfd/elf-m10300.c258
-rw-r--r--bfd/elf-strtab.c5
-rw-r--r--bfd/elf-vxworks.c46
-rw-r--r--bfd/elf.c2791
-rw-r--r--bfd/elf32-am33lin.c4
-rw-r--r--bfd/elf32-arc.c20
-rw-r--r--bfd/elf32-arm.c4057
-rw-r--r--bfd/elf32-avr.c1313
-rw-r--r--bfd/elf32-avr.h38
-rw-r--r--bfd/elf32-bfin.c306
-rw-r--r--bfd/elf32-cr16.c1433
-rw-r--r--bfd/elf32-cr16c.c110
-rw-r--r--bfd/elf32-cris.c158
-rw-r--r--bfd/elf32-crx.c83
-rw-r--r--bfd/elf32-d10v.c126
-rw-r--r--bfd/elf32-d30v.c20
-rw-r--r--bfd/elf32-dlx.c37
-rw-r--r--bfd/elf32-fr30.c101
-rw-r--r--bfd/elf32-frv.c444
-rw-r--r--bfd/elf32-gen.c5
-rw-r--r--bfd/elf32-h8300.c94
-rw-r--r--bfd/elf32-hppa.c689
-rw-r--r--bfd/elf32-i370.c123
-rw-r--r--bfd/elf32-i386.c264
-rw-r--r--bfd/elf32-i860.c39
-rw-r--r--bfd/elf32-i960.c21
-rw-r--r--bfd/elf32-ip2k.c87
-rw-r--r--bfd/elf32-iq2000.c111
-rw-r--r--bfd/elf32-m32c.c161
-rw-r--r--bfd/elf32-m32r.c372
-rw-r--r--bfd/elf32-m68hc11.c33
-rw-r--r--bfd/elf32-m68hc12.c34
-rw-r--r--bfd/elf32-m68hc1x.c214
-rw-r--r--bfd/elf32-m68hc1x.h10
-rw-r--r--bfd/elf32-m68k.c641
-rw-r--r--bfd/elf32-m88k.c5
-rw-r--r--bfd/elf32-mcore.c90
-rw-r--r--bfd/elf32-mep.c959
-rw-r--r--bfd/elf32-mips.c119
-rw-r--r--bfd/elf32-msp430.c100
-rw-r--r--bfd/elf32-mt.c92
-rw-r--r--bfd/elf32-openrisc.c95
-rw-r--r--bfd/elf32-or32.c20
-rw-r--r--bfd/elf32-pj.c31
-rw-r--r--bfd/elf32-ppc.c479
-rw-r--r--bfd/elf32-ppc.h12
-rw-r--r--bfd/elf32-s390.c223
-rw-r--r--bfd/elf32-score.c3883
-rw-r--r--bfd/elf32-sh-relocs.h1716
-rw-r--r--bfd/elf32-sh-symbian.c62
-rw-r--r--bfd/elf32-sh.c2684
-rw-r--r--bfd/elf32-sh64-com.c5
-rw-r--r--bfd/elf32-sh64.c30
-rw-r--r--bfd/elf32-sparc.c8
-rw-r--r--bfd/elf32-spu.c3154
-rw-r--r--bfd/elf32-spu.h57
-rw-r--r--bfd/elf32-v850.c141
-rw-r--r--bfd/elf32-vax.c132
-rw-r--r--bfd/elf32-xc16x.c48
-rw-r--r--bfd/elf32-xstormy16.c107
-rw-r--r--bfd/elf32-xtensa.c1745
-rw-r--r--bfd/elf64-alpha.c193
-rw-r--r--bfd/elf64-gen.c5
-rw-r--r--bfd/elf64-hppa.c74
-rw-r--r--bfd/elf64-mips.c134
-rw-r--r--bfd/elf64-mmix.c181
-rw-r--r--bfd/elf64-ppc.c721
-rw-r--r--bfd/elf64-s390.c166
-rw-r--r--bfd/elf64-sh64.c178
-rw-r--r--bfd/elf64-sparc.c25
-rw-r--r--bfd/elf64-x86-64.c213
-rw-r--r--bfd/elfcode.h145
-rw-r--r--bfd/elflink.c2108
-rw-r--r--bfd/elfn32-mips.c109
-rw-r--r--bfd/elfxx-ia64.c247
-rw-r--r--bfd/elfxx-mips.c949
-rw-r--r--bfd/elfxx-mips.h10
-rw-r--r--bfd/elfxx-sparc.c339
-rw-r--r--bfd/elfxx-sparc.h5
-rw-r--r--bfd/elfxx-target.h77
-rw-r--r--bfd/format.c4
-rw-r--r--bfd/freebsd.h4
-rw-r--r--bfd/gen-aout.c4
-rw-r--r--bfd/hash.c102
-rw-r--r--bfd/host-aout.c4
-rw-r--r--bfd/hp300bsd.c5
-rw-r--r--bfd/hppabsd-core.c9
-rw-r--r--bfd/hpux-core.c11
-rw-r--r--bfd/i386aout.c6
-rw-r--r--bfd/i386bsd.c4
-rw-r--r--bfd/i386linux.c16
-rw-r--r--bfd/i386lynx.c4
-rw-r--r--bfd/i386mach3.c4
-rw-r--r--bfd/i386msdos.c31
-rw-r--r--bfd/i386os9k.c92
-rw-r--r--bfd/ieee.c32
-rw-r--r--bfd/ihex.c21
-rw-r--r--bfd/init.c4
-rw-r--r--bfd/irix-core.c7
-rw-r--r--bfd/libaout.h7
-rw-r--r--bfd/libbfd-in.h28
-rw-r--r--bfd/libbfd.c21
-rw-r--r--bfd/libbfd.h142
-rw-r--r--bfd/libcoff-in.h2
-rw-r--r--bfd/libcoff.h2
-rw-r--r--bfd/libecoff.h4
-rw-r--r--bfd/libpei.h62
-rw-r--r--bfd/linker.c82
-rw-r--r--bfd/lynx-core.c7
-rw-r--r--bfd/m68klinux.c16
-rw-r--r--bfd/m88kmach3.c4
-rw-r--r--bfd/mach-o-target.c4
-rw-r--r--bfd/mach-o.c40
-rwxr-xr-xbfd/mep-relocs.pl274
-rw-r--r--bfd/merge.c6
-rw-r--r--bfd/mipsbsd.c31
-rw-r--r--bfd/mmo.c72
-rw-r--r--bfd/netbsd-core.c12
-rw-r--r--bfd/netbsd.h6
-rw-r--r--bfd/newsos3.c4
-rw-r--r--bfd/nlm-target.h3
-rw-r--r--bfd/nlm.c4
-rw-r--r--bfd/nlm32-alpha.c4
-rw-r--r--bfd/nlm32-i386.c4
-rw-r--r--bfd/nlm32-ppc.c4
-rw-r--r--bfd/nlm32-sparc.c24
-rw-r--r--bfd/nlmcode.h31
-rw-r--r--bfd/oasys.c18
-rw-r--r--bfd/opncls.c67
-rw-r--r--bfd/osf-core.c11
-rw-r--r--bfd/pc532-mach.c4
-rw-r--r--bfd/pdp11.c58
-rw-r--r--bfd/pe-arm-wince.c37
-rw-r--r--bfd/pe-arm.c45
-rw-r--r--bfd/pe-i386.c11
-rw-r--r--bfd/pe-mcore.c4
-rw-r--r--bfd/pe-mips.c21
-rw-r--r--bfd/pe-ppc.c4
-rw-r--r--bfd/pe-sh.c4
-rw-r--r--bfd/pe-x86_64.c53
-rw-r--r--bfd/peXXigen.c313
-rw-r--r--bfd/pef.c20
-rw-r--r--bfd/pei-arm-wince.c30
-rw-r--r--bfd/pei-arm.c22
-rw-r--r--bfd/pei-i386.c11
-rw-r--r--bfd/pei-mcore.c4
-rw-r--r--bfd/pei-mips.c4
-rw-r--r--bfd/pei-ppc.c4
-rw-r--r--bfd/pei-sh.c4
-rw-r--r--bfd/pei-x86_64.c54
-rw-r--r--bfd/peicode.h118
-rw-r--r--bfd/po/BLD-POTFILES.in1
-rw-r--r--bfd/po/Make-in3
-rw-r--r--bfd/po/SRC-POTFILES.in15
-rw-r--r--bfd/po/bfd.pot1837
-rw-r--r--bfd/po/da.gmobin60556 -> 0 bytes
-rw-r--r--bfd/po/es.gmobin87772 -> 0 bytes
-rw-r--r--bfd/po/fr.gmobin71749 -> 0 bytes
-rw-r--r--bfd/po/ja.gmobin38616 -> 0 bytes
-rw-r--r--bfd/po/ro.gmobin69038 -> 0 bytes
-rw-r--r--bfd/po/rw.gmobin429 -> 0 bytes
-rw-r--r--bfd/po/sv.gmobin67266 -> 0 bytes
-rw-r--r--bfd/po/tr.gmobin69529 -> 0 bytes
-rw-r--r--bfd/po/vi.gmobin39617 -> 0 bytes
-rw-r--r--bfd/po/zh_CN.gmobin28132 -> 0 bytes
-rw-r--r--bfd/ppcboot.c25
-rw-r--r--bfd/ptrace-core.c21
-rw-r--r--bfd/reloc.c380
-rw-r--r--bfd/reloc16.c4
-rw-r--r--bfd/riscix.c21
-rw-r--r--bfd/rs6000-core.c14
-rw-r--r--bfd/sco5-core.c7
-rw-r--r--bfd/section.c115
-rw-r--r--bfd/simple.c5
-rw-r--r--bfd/som.c51
-rw-r--r--bfd/sparclinux.c46
-rw-r--r--bfd/sparclynx.c4
-rw-r--r--bfd/srec.c18
-rw-r--r--bfd/stabs.c27
-rw-r--r--bfd/sunos.c41
-rw-r--r--bfd/syms.c12
-rw-r--r--bfd/sysdep.h6
-rw-r--r--bfd/targets.c92
-rw-r--r--bfd/tekhex.c25
-rw-r--r--bfd/trad-core.c35
-rw-r--r--bfd/vaxbsd.c4
-rw-r--r--bfd/versados.c9
-rw-r--r--bfd/version.h5
-rw-r--r--bfd/vms-gsd.c6
-rw-r--r--bfd/vms-hdr.c14
-rw-r--r--bfd/vms-misc.c6
-rw-r--r--bfd/vms-tir.c4
-rw-r--r--bfd/vms.c24
-rw-r--r--bfd/warning.m44
-rw-r--r--bfd/xcoff-target.h4
-rw-r--r--bfd/xcofflink.c41
-rw-r--r--bfd/xsym.c22
-rw-r--r--bfd/xsym.h6
-rw-r--r--bfd/xtensa-isa.c4
373 files changed, 50735 insertions, 36802 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 5bb5bb2a6009..e006595f969e 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,1359 +1,1788 @@
-2006-12-11 Eric Botcazou <ebotcazou@adacore.com>
+2007-07-02 Joseph Myers <joseph@codesourcery.com>
- * elflink.c (bfd_elf_gc_sections): Also search for corresponding
- sections with .gnu.linkonce.t. prefix.
+ * elfxx-mips.c (mips_elf_calculate_relocation): Handle
+ R_MIPS_TLS_DTPREL32 and R_MIPS_TLS_DTPREL64.
+ * elf64-mips.c (mips_elf64_howto_table_rela): Support
+ R_MIPS_TLS_DTPREL64.
-2006-08-08 Nick Clifton <nickc@redhat.com>
+2007-07-02 Alan Modra <amodra@bigpond.net.au>
- PR binutils/2724
- * coffcode.h (coff_new_section_hook): Only modify the section
- symbol of sections which were created by the user.
+ * Makefile.am: Run "make dep-am".
+ * Makefile.in: Regenerate.
+ * aclocal.m4: Regenerate.
+ * config.in: Regenerate.
+ * po/SRC-POTFILES.in: Regenerate.
+ * po/bfd.pot: Regenerate.
+
+2007-07-02 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Tidy
+ symsec != NULL tests.
+
+2007-07-02 Alan Modra <amodra@bigpond.net.au>
+
+ PR 4712
+ * elf.c (assign_file_positions_for_load_sections): Adjust lma
+ by p_vaddr_offset.
+
+2007-06-30 H.J. Lu <hongjiu.lu@intel.com>
+
+ * aclocal.m4: Regenerated.
+ * Makefile.in: Likewise.
+
+2007-06-29 Joseph Myers <joseph@codesourcery.com>
+
+ * elf32-ppc.c (ppc_elf_merge_obj_attributes): New.
+ (ppc_elf_merge_private_bfd_data): Call it.
+
+2007-06-29 Joseph Myers <joseph@codesourcery.com>
+
+ * elfxx-mips.c (mips_elf_merge_obj_attributes): New.
+ (_bfd_mips_elf_merge_private_bfd_data): Call it.
+
+2007-06-29 Joseph Myers <joseph@codesourcery.com>
+
+ * elf-attrs.c: New.
+ * Makefile.am (BFD32_BACKENDS): Add elf-attrs.lo.
+ (BFD32_BACKENDS_CFILES): Add elf-attrs.c.
+ (elf-attrs.lo): Generate dependencies.
+ * Makefile.in: Regenerate.
+ * configure.in (elf): Add elf-attrs.lo.
+ * configure: Regenerate.
+ * elf-bfd.h (struct elf_backend_data): Add entries for object
+ attributes.
+ (NUM_KNOWN_OBJ_ATTRIBUTES, obj_attribute, obj_attribute_list,
+ OBJ_ATTR_PROC, OBJ_ATTR_GNU, OBJ_ATTR_FIRST, OBJ_ATTR_LAST,
+ Tag_NULL, Tag_File, Tag_Section, Tag_Symbol, Tag_compatibility):
+ New.
+ (struct elf_obj_tdata): Add entries for object attributes.
+ (elf_known_obj_attributes, elf_other_obj_attributes,
+ elf_known_obj_attributes_proc, elf_other_obj_attributes_proc):
+ New.
+ (bfd_elf_obj_attr_size, bfd_elf_set_obj_attr_contents,
+ bfd_elf_get_obj_attr_int, bfd_elf_add_obj_attr_int,
+ bfd_elf_add_proc_attr_int, bfd_elf_add_obj_attr_string,
+ bfd_elf_add_proc_attr_string, bfd_elf_add_obj_attr_compat,
+ bfd_elf_add_proc_attr_compat, _bfd_elf_attr_strdup,
+ _bfd_elf_copy_obj_attributes, _bfd_elf_obj_attrs_arg_type,
+ _bfd_elf_parse_attributes, _bfd_elf_merge_object_attributes): New.
+ * elf.c (_bfd_elf_copy_private_bfd_data): Copy object attributes.
+ (bfd_section_from_shdr): Handle attributes sections.
+ * elflink.c (bfd_elf_final_link): Handle attributes sections.
+ * elfxx-target.h (elf_backend_obj_attrs_vendor,
+ elf_backend_obj_attrs_section, elf_backend_obj_attrs_arg_type,
+ elf_backend_obj_attrs_section_type): New.
+ (elfNN_bed): Update.
+ * elf32-arm.c (NUM_KNOWN_ATTRIBUTES, aeabi_attribute,
+ aeabi_attribute_list): Remove.
+ (struct elf32_arm_obj_tdata): Remove object attributes fields.
+ (check_use_blx, bfd_elf32_arm_set_vfp11_fix, using_thumb2,
+ elf32_arm_copy_private_bfd_data, elf32_arm_merge_eabi_attributes):
+ Update for new object attributes interfaces.
+ (uleb128_size, is_default_attr, eabi_attr_size,
+ elf32_arm_eabi_attr_size, write_uleb128, write_eabi_attribute,
+ elf32_arm_set_eabi_attr_contents, elf32_arm_bfd_final_link,
+ elf32_arm_new_eabi_attr, elf32_arm_get_eabi_attr_int,
+ elf32_arm_add_eabi_attr_int, attr_strdup,
+ elf32_arm_add_eabi_attr_string, elf32_arm_add_eabi_attr_compat,
+ copy_eabi_attributes, elf32_arm_parse_attributes): Remove. Moved
+ to generic code in elf-attrs.c.
+ (elf32_arm_obj_attrs_arg_type): New.
+ (elf32_arm_fake_sections): Do not handle .ARM.attributes.
+ (elf32_arm_section_from_shdr): Do not handle SHT_ARM_ATTRIBUTES.
+ (bfd_elf32_bfd_final_link): Remove.
+ (elf_backend_obj_attrs_vendor, elf_backend_obj_attrs_section,
+ elf_backend_obj_attrs_arg_type,
+ elf_backend_obj_attrs_section_type): New.
+ * elf32-bfin.c (bfin_elf_copy_private_bfd_data): Copy object
+ attributes.
+ * elf32-frv.c (frv_elf_copy_private_bfd_data): Likewise.
+ * elf32-iq2000.c (iq2000_elf_copy_private_bfd_data): Likewise.
+ * elf32-mep.c (mep_elf_copy_private_bfd_data): Likewise.
+ * elf32-mt.c (mt_elf_copy_private_bfd_data): Likewise.
+ * elf32-sh.c (sh_elf_copy_private_data): Likewise.
+ * elf64-sh64.c (sh_elf64_copy_private_data_internal): Likewise.
+
+2007-06-29 Paul Brook <paul@codesourcery.com>
+
+ * elf32-arm.c (bfd_elf32_arm_process_before_allocation): Suppress
+ call veneers for call relocations against undefined symbols.
+ (elf32_arm_final_link_relocate): Turn call to undefined symbol
+ into a jump to the next instruction.
+
+2007-06-29 Michael Snyder <msnyder@svkmacdonelllnx>
+
+ * bfd.c (bfd_demangle): Plug memory leak (Coverity).
+
+2007-06-29 M R Swami Reddy <MR.Swami.Reddy@nsc.com>
+
+ * Makefile.am: Add cr16 related entry
+ * Makefile.in: Regenerate
+ * archures.c: Add bfd_cr16_arch
+ * bfd-in2.h: Regenerate
+ * config.bfd: Add cr16-elf
+ * configure.in: Add bfd_elf32_cr16_vec
+ * configure: Regenerate.
+ * targets.c: Added cr16 related information
+ * cpu-cr16.c: New file.
+ * elf32-cr16.c: New file.
+ * reloc.c: Added cr16 relocs.
+
+2007-06-29 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.c (_bfd_elf_link_assign_sym_version): Improve error
+ message for undefined version nodes.
+ (elf_gc_sweep): Don't warn when zero size sections are
+ removed.
+
+2007-06-29 Nathan Froyd <froydnj@codesourcery.com>
+
+ * elf32-ppc.c (ppc_elf_info_to_howto): Check for invalid relocation
+ types.
+
+2007-06-29 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-spu.c (spu_elf_fake_sections): New function.
+ (elf_backend_fake_sections): Define.
+
+2007-06-29 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (assign_file_positions_for_load_sections): Use elf
+ section header sh_size rather than bfd section size, simplifying
+ .tbss handling.
+
+2007-06-29 Alan Modra <amodra@bigpond.net.au>
+
+ PR ld/4701
+ * elf.c (assign_file_positions_for_load_sections): Ensure bss
+ segments meet gABI alignment requirements. Don't allocate
+ file space for bss sections in a segment also containing file
+ or program headers.
-2006-07-19 Alan Modra <amodra@bigpond.net.au>
+2007-06-27 Alan Modra <amodra@bigpond.net.au>
- * bfd-in.h (enum notice_asneeded_action): Define.
+ * bfd.c (struct bfd): Rename "next" to "archive_next".
+ * archive.c: Rename uses throughout file.
+ * archive64.c: Likewise.
+ * coff-rs6000.c: Likewise.
+ * ecoff.c: Likewise.
+ * som.c: Likewise.
* bfd-in2.h: Regenerate.
- * elflink.c (elf_link_add_object_symbols): Call linker "notice"
- function with NULL name for as-needed handling.
-2006-07-12 Matthew R. Dempsky <mrd@alkemio.org>
+ * elf32-ppc.c (ppc_elf_select_plt_layout): Properly iterate over
+ input bfds.
+ * elf32-spu.c (spu_elf_create_sections): Likewise.
+
+2007-06-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ * dwarf2.c (find_line): New. Contains the duplicated code from:
+ (_bfd_dwarf2_find_nearest_line): Use it.
+ (_bfd_dwarf2_find_line): Use it.
+
+2007-06-26 Joseph Myers <joseph@codesourcery.com>
+
+ * elf32-arm.c (copy_eabi_attributes): Copy type of attributes.
+
+2007-06-25 Richard Sandiford <richard@codesourcery.com>
+
+ * elfxx-mips.c (mips_elf_calculate_relocation): Allow local stubs
+ to be used for calls from MIPS16 code.
+
+2007-06-23 Andreas Schwab <schwab@suse.de>
+
+ * configure.in (--with-separate-debug-dir): New option.
+ * configure: Regenerate.
+ * Makefile.am (dwarf2.lo): Add rule to pass DEBUGDIR.
+ * Makefile.in: Regenerate.
+ * dwarf2.c (_bfd_dwarf2_find_nearest_line): Pass DEBUGDIR to
+ bfd_follow_gnu_debuglink.
+ (_bfd_dwarf2_find_line): Likewise.
+
+2007-06-22 Nick Clifton <nickc@redhat.com>
+
+ * dwarf2.c: Add support for reading in debug information via a
+ .gnu_debuglink section:
+ (struct dwarf2_debug): Add bfd field to record the bfd containing
+ the debug info.
+ (parse_comp_unit): Remove ABFD parameter. Instead use the bfd
+ field in the dwarf2_debug structure.
+ (_bfd_dwarf2_find_nearest_line): If a debug info section could not
+ be found in the current bfd call bfd_follow_gnu_debuglink to see
+ if another file contains the debug information. If it does, open
+ it and continue.
+ (_bfd_dwarf2_find_line): Likewise.
+
+2007-06-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/4590
+ * elfxx-ia64.c (sort_dyn_sym_info): Keep the valid got_offset
+ when removing duplicated entries.
+ (get_dyn_sym_info): Initialize the got_offset field to -1.
+ Update call to sort_dyn_sym_info.
+ (elfNN_ia64_relocate_section): Call sort_dyn_sym_info to sort
+ array of addend and remove duplicates.
+
+2007-06-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ * libpei.h (_bfd_XXi_final_link_postscript): Remove
+ duplication.
+ (bfd_target_pei_p): New.
+ (bfd_target_pei_arch): New
+ (bfd_target_efi_p): Likewise.
+ (bfd_target_efi_arch): New
+ (bfd_pe_executable_p): Use bfd_target_pei_p and
+ bfd_target_efi_p.
+
+ * peicode.h (arch_type): New enum.
+ (pe_arch): New function.
+ (pe_bfd_object_p): Don't match PE/EFI target with EFI/PE file
+ if there is an EFI/PE target.
+
+2007-06-14 H.J. Lu <hongjiu.lu@intel.com>
- * cpu-m68k.c (bfd_m68k_compatible): Handle CPU32.
+ * Makefile.am (ACLOCAL_AMFLAGS): Add -I . -I ../config.
-2006-06-23 Daniel Jacobowitz <dan@codesourcery.com>
+ * acinclude.m4: Don't include m4 files. Remove libtool
+ kludge.
- * Makefile.am: Clear RELEASE.
* Makefile.in: Regenerated.
+ * aclocal.m4: Likewise.
+ * configure: Likewise.
-2006-06-23 Daniel Jacobowitz <dan@codesourcery.com>
+2007-06-11 Sterling Augustine <sterling@tensilica.com>
+ Bob Wilson <bob.wilson@acm.org>
- * configure.in: Update version to 2.17.
- * Makefile.am: Set RELEASE.
- * configure, Makefile.in: Regenerated.
+ * elf32-xtensa.c (extend_ebb_bounds_forward): Use renamed
+ XTENSA_PROP_NO_TRANSFORM flag instead of XTENSA_PROP_INSN_NO_TRANSFORM.
+ (extend_ebb_bounds_backward, compute_text_actions): Likewise.
+ (compute_ebb_proposed_actions, coalesce_shared_literal): Likewise.
+ (xtensa_get_property_predef_flags): Likewise.
+ (compute_removed_literals): Pass new arguments to is_removable_literal.
+ (is_removable_literal): Add sec, prop_table and ptblsize arguments.
+ Do not remove literal if the NO_TRANSFORM property flag is set.
-2006-06-12 Daniel Jacobowitz <dan@codesourcery.com>
+2007-05-31 Richard Sandiford <rsandifo@nildram.co.uk>
- * configure.in: Update version to 2.16.94.
- * configure: Regenerated.
+ * elfxx-mips.c (mips_elf_initialize_tls_index): When processing a
+ type (3) single-GOT entry, read tls_type from the hash table entry
+ rather than the GOT entry.
-2006-06-11 Richard Sandiford <richard@codesourcery.com>
- Thiemo Seufer <ths@mips.com>
-
- * elfxx-mips.c (mips_elf_link_hash_table): Add function_stub_size.
- (STUB_ORI): New macro.
- (STUB_LI16U): Fix formatting.
- (MIPS_FUNCTION_STUB_SIZE): Delete.
- (MIPS_FUNCTION_STUB_MAX_SIZE): Likewise.
- (MIPS_FUNCTION_STUB_NORMAL_SIZE): New macro.
- (MIPS_FUNCTION_STUB_BIG_SIZE): Likewise.
- (_bfd_mips_elf_adjust_dynamic_symbol): Use htab->function_stub_size
- instead of MIPS_FUNCTION_STUB_SIZE.
- (count_section_dynsyms): New function, split out from
- _bfd_mips_elf_final_link.
- (_bfd_mips_elf_always_size_sections): Get a worst-case estimate
- of the number of dynamic symbols needed and use it to set up
- function_stub_size. Use function_stub_size rather than
- MIPS_FUNCTION_STUB_SIZE to determine the size of the stub section.
- Use 16-byte stubs for 0x10000 dynamic symbols.
- (_bfd_mips_elf_size_dynamic_sections): Use htab->function_stub_size
- instead of MIPS_FUNCTION_STUB_SIZE. Fix formatting.
- (_bfd_mips_elf_finish_dynamic_symbol): Likewise. Change the
- size of the stub buffer from MIPS_FUNCTION_STUB_MAX_SIZE to
- MIPS_FUNCTION_STUB_BIG_SIZE. Tweak the check for unhandled dynindxes.
- Use MIPS_FUNCTION_STUB_BIG_SIZE rather than a hard-coded 20.
- Use STUB_ORI rather than STUB_LI16U for big stubs.
- (_bfd_mips_elf_link_hash_table_create): Initialize function_stub_size.
- (_bfd_mips_elf_final_link): Use count_section_dynsyms.
-
-2006-06-08 David Daney <ddaney@avtrex.com>
-
- * elfxx-mips.c (STUB_LI16): Removed.
- (STUB_LUI): New macro.
- (STUB_LI16U): Ditto.
- (STUB_LI16S): Ditto.
- (MIPS_FUNCTION_STUB_SIZE): Rewrote to take info parameter.
- (_bfd_mips_elf_adjust_dynamic_symbol): Pass info parameter to
- MIPS_FUNCTION_STUB_SIZE.
- (_bfd_mips_elf_always_size_sections): Ditto.
- (_bfd_mips_elf_size_dynamic_sections): Ditto.
- (_bfd_mips_elf_finish_dynamic_sections): Ditto.
- (_bfd_mips_elf_finish_dynamic_symbol): Rewrote stub generation
- to allow larger symbol table indexes.
-
-2006-06-07 Joseph S. Myers <joseph@codesourcery.com>
-
- * po/Make-in (pdf, ps): New dummy targets.
-
-2006-06-01 Daniel Jacobowitz <dan@codesourcery.com>
-
- Backport:
- 2006-05-23 H.J. Lu <hongjiu.lu@intel.com>
- PR ld/2655
- PR ld/2657
- * elf-eh-frame.c (_bfd_elf_write_section_eh_frame): Properly
- update CIE/FDE length. Don't pad to the section alignment.
-
-2006-05-30 Nick Clifton <nickc@redhat.com>
-
- * po/es.po: Updated Spanish translation.
-
-2006-05-23 Alan Modra <amodra@bigpond.net.au>
-
- * elf64-ppc.c (compare_symbols): Prefer strong dynamic global
- function syms over other syms.
-
-2006-05-22 Daniel Jacobowitz <dan@codesourcery.com>
-
- * elflink.c (_bfd_elf_add_dynamic_entry): Remove DT_TEXTREL
- check.
- (bfd_elf_final_link): Add a late DT_TEXTREL check.
- * elfxx-mips.c (MIPS_ELF_READONLY_SECTION): Define.
- (mips_elf_create_dynamic_relocation): Set DF_TEXTREL.
- (_bfd_mips_elf_check_relocs): Delete MIPS_READONLY_SECTION.
- Use MIPS_ELF_READONLY_SECTION.
- (_bfd_mips_elf_size_dynamic_sections): Clear DF_TEXTREL after
- creating DT_TEXTREL.
- (_bfd_mips_elf_finish_dynamic_sections): Clear textrel markers
- if no text relocations were generated.
-
-2006-05-17 Daniel Jacobowitz <dan@codesourcery.com>
-
- * configure.in: Update version to 2.16.93.
- * configure: Regenerated.
+2007-06-01 Alan Modra <amodra@bigpond.net.au>
-2006-05-17 Alan Modra <amodra@bigpond.net.au>
+ * simple.c (bfd_simple_get_relocated_section_contents): Init
+ input_bfds_tail.
- * elflink.c (elf_gc_sweep): Don't specially keep non-alloc,
- non-load sections if they have relocs.
+2007-05-30 Alan Modra <amodra@bigpond.net.au>
-2006-05-16 Andreas Schwab <schwab@suse.de>
+ * elf.c (elf_fake_sections): Adjust test for SHT_NOBITS sections
+ created by objcopy --only-keep-debug.
+ (_bfd_elf_init_private_section_data): Only change elf_section_type
+ if it is SHT_NULL.
- * aoutf1.h (struct external_sparc_core): Declare c_regs as struct
- regs instead of an array of int.
- (struct external_solaris_bcp_core): Likewise.
- (swapcore_sun3): Use offsetof instead of computing the offset
- manually.
- (swapcore_sparc): Likewise. Simplify reference to c_regs.
- (swapcore_solaris_bcp): Likewise.
+ * elf.c (assign_file_positions_for_load_sections): Correct sh_type
+ to SHT_NOBITS earlier. Base actions in rest of function on sh_type
+ and sh_flags instead of bfd section flags. Delete voff and code
+ keeping nobits segments aligned.
-2006-05-15 Alan Modra <amodra@bigpond.net.au>
+2007-05-25 Eric Christopher <echristo@apple.com>
- PR 2658
- * elf32-ppc.c (ppc_elf_relax_section): Don't segfault on non-pic
- -shared link.
+ * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame):
+ Check that sym_sec isn't NULL before accessing.
-2006-05-11 Michael Matz <matz@suse.de>
+2007-05-24 Steve Ellcey <sje@cup.hp.com>
- * elflink.c (match_group_member): Correctly iterate group
- members.
+ * Makefile.in: Regnerate.
+ * configure: Regenerate.
+ * aclocal.m4: Regenerate.
+ * doc/Makefile.in: Regenerate.
-2006-05-11 Nick Clifton <nickc@redhat.com>
+2007-05-22 Paul Brook <paul@codesourcery.com>
- PR ld/2607
- * elfcode.h (valid_section_index_p): New function: Checks for a
- valid section index. Allows indicies in the range SHN_LOPROC to
- SHN_HIOS.
- (elf_object_p): Use valid_section_index_p.
+ * elf32-arm.c (output_arch_syminfo): Replace plt_shndx and plt_offset
+ with sec and sec_shndx.
+ (elf32_arm_ouput_plt_map_sym): Use them.
+ (elf32_arm_output_arch_local_syms): Output mapping symbols for
+ interworking glue.
-2006-05-11 Nick Clifton <nickc@redhat.com>
+2007-05-18 Paul Brook <paul@codesourcery.com>
- PR ld/2257
- * elfcode.h (elf_object_p): Allow files with corrupt e_shstrndx
- fields to still be handled as ELF files.
+ * elf32-arm.c (ARM2THUMB_V5_STATIC_GLUE_SIZE): Define.
+ (a2t1v5_ldr_insn, a2t1v5_ldr_insn): New.
+ (record_arm_to_thumb_glue): Add v5t non-pic glue.
+ (elf32_arm_create_thumb_stub): Ditto.
-2006-05-10 Alan Modra <amodra@bigpond.net.au>
+2007-05-16 H.J. Lu <hongjiu.lu@intel.com>
+ Alan Modra <amodra@bigpond.net.au>
- PR 2342
- * elflink.c (_bfd_elf_default_action_discarded): Revert 2006-02-16.
+ * elflink.c (_bfd_elf_adjust_dynamic_copy): Align dynamic bss
+ section to the minimum alignment.
-2006-05-10 Alan Modra <amodra@bigpond.net.au>
+2007-05-15 H.J. Lu <hongjiu.lu@intel.com>
+ Alan Modra <amodra@bigpond.net.au>
- * elf64-ppc.c (ppc64_elf_tls_optimize): Only optimize
- R_PPC64_TPREL64 and R_PPC64_DTPMOD64 relocs when they are in
- the .toc and referenced by a TLS code sequence.
- (ppc64_elf_edit_toc): Cater for the unlikely situation that
- .toc is the first section in a file.
+ PR ld/4504
+ * elf-bfd.h (_bfd_elf_adjust_dynamic_copy): New.
+ * elflink.c (_bfd_elf_adjust_dynamic_copy): New.
+
+ * elf-m10300.c (_bfd_mn10300_elf_adjust_dynamic_symbol): Call
+ _bfd_elf_adjust_dynamic_copy to adjust for the copy in dynamic
+ bss section.
+ * elf32-arm.c (elf32_arm_adjust_dynamic_symbol): Likewise.
+ * elf32-cris.c (elf_cris_adjust_dynamic_symbol): Likewise.
+ * elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol): Likewise.
+ * elf32-i370.c (i370_elf_adjust_dynamic_symbol): Likewise.
+ * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Likewise.
+ * elf32-m32r.c (m32r_elf_adjust_dynamic_symbol): Likewise.
+ * elf32-m68k.c (elf_m68k_adjust_dynamic_symbol): Likewise.
+ * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Likewise.
+ * elf32-s390.c (elf_s390_adjust_dynamic_symbol): Likewise.
+ * elf32-sh.c (sh_elf_adjust_dynamic_symbol): Likewise.
+ * elf32-vax.c (elf_vax_adjust_dynamic_symbol): Likewise.
+ * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise.
+ * elf64-s390.c (elf_s390_adjust_dynamic_symbol): Likewise.
+ * elf64-sh64.c (sh64_elf64_adjust_dynamic_symbol): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_adjust_dynamic_symbol): Likewise.
+ * elfxx-mips.c (_bfd_mips_vxworks_adjust_dynamic_symbol): Likewise.
+ * elfxx-sparc.c (_bfd_sparc_elf_adjust_dynamic_symbol): Likewise.
+
+2007-05-15 Richard Sandiford <richard@codesourcery.com>
+
+ * elfxx-mips.c (mips_elf_create_local_got_entry): Remove
+ input_section argument. Create .rela.dyn relocations against
+ symbol 0 rather than the section symbol.
+ (mips_elf_local_got_index): Remove input_section argument.
+ Update call to mips_elf_create_local_got_entry.
+ (mips_elf_got_page, mips_elf_got16_entry): Likewise.
+ (mips_elf_calculate_relocation): Update calls to
+ mips_elf_local_got_index, mips_elf_got16_entry and mips_elf_got_page.
+
+2007-05-15 Mark Shinwell <shinwell@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_final_link_relocate): Correctly
+ handle the Thumb-2 JUMP19 relocation.
+
+2007-05-15 Alan Modra <amodra@bigpond.net.au>
+
+ PR 4479
+ * elf.c (elf_fake_sections): Don't allow backend to change
+ SHT_NOBITS if called for strip/objcopy --only-keep-debug.
+ * elfxx-mips.c (_bfd_mips_elf_fake_sections): Remove similar
+ fix from here.
+
+2007-05-14 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (bfd_elf_string_from_elf_section): Return NULL on
+ invalid shstrndx.
+ (bfd_elf_get_str_section): Likewise.
+
+2007-05-12 Alan Modra <amodra@bigpond.net.au>
+
+ PR 4497
+ * elf-eh-frame.c (struct cie): Add "local_personality". Make
+ "personality" a union.
+ (cie_eq): Compare local_personality too. Adjust personality
+ comparison.
+ (_bfd_elf_discard_section_eh_frame): Check binding on personality
+ reloc sym to allow for bad symtab. Use stashed local syms rather
+ than reading personality local sym. Handle discarded sections.
+
+2007-05-12 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-spu.c (elf_howto_table): Add howto for R_SPU_ADDR16X.
+
+2007-05-11 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.h (ppc_elf_select_plt_layout): Update prototype.
+ (enum ppc_elf_plt_type): Move from..
+ * elf32-ppc.c: ..here.
+ (struct ppc_elf_obj_tdata): Add makes_plt_call and has_rel16.
+ (struct ppc_elf_link_hash_table): Reorder. Add old_bfd. Delete
+ can_use_new_plt. Make is_vxworks a bitfield.
+ (ppc_elf_link_hash_table_create): Don't clear is_vxworks (again).
+ (ppc_elf_check_relocs): Update setting of reloc flags. Set old_bfd.
+ (ppc_elf_select_plt_layout): Modify parameters. Use bfd reloc
+ flags to better detect object files needing old bss-style plt.
+ Allow secure plt to be used without rel16 relocs being detected.
+ Warn if secure plt request cannot be allowed.
+
+2007-05-11 Alan Modra <amodra@bigpond.net.au>
+
+ * reloc.c (BFD_RELOC_SPU_PPU32, BFD_RELOC_SPU_PPU64): Define.
+ * elf-bfd.h (struct elf_backend_data): Change return type of
+ elf_backend_relocate_section to int.
+ * elf32-spu.c (elf_howto_table): Add howtos for R_SPU_PPU32 and
+ R_SPU_PPU64.
+ (spu_elf_bfd_to_reloc_type): Convert new relocs.
+ (spu_elf_count_relocs): New function.
+ (elf_backend_count_relocs): Define.
+ (spu_elf_relocate_section): Arrange to emit R_SPU_PPU32 and
+ R_SPU_PPU64 relocs.
+ * elflink.c (elf_link_input_bfd): Emit relocs if relocate_section
+ returns 2.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
-2006-05-03 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+2007-05-10 Richard Sandiford <richard@codesourcery.com>
- PR binutils/2584
- * tekhex.c (getvalue): Change return type to bfd_boolean and
- add the new parameter. Return false if the unexpected character
- is found.
- (getsym): Likewise.
- (first_phase): Change return type to bfd_boolean and return
- false if the unexpected character is found. Replace abort
- with returning false.
- (pass_over): Change return type to bfd_boolean and the type of
- the second argument to bfd_boolean (*) (bfd *, int, char *).
- Return false if FUNC returns false.
- (tekhex_object_p): Return NULL if pass_over fails.
+ * elf32-arm.c (elf32_arm_check_relocs): Don't create PLT entries
+ for R_ARM_ABS12 relocs.
+ (elf32_arm_finish_dynamic_symbol): Fix the loop that creates
+ non-shared VxWorks PLT entries.
-2006-05-02 Paul Brook <paul@codesourcery.com>
+2007-05-11 Alan Modra <amodra@bigpond.net.au>
- * elf32-arm.c (elf32_arm_final_link_relocate): Set thumb funciton bit
- for R_ARM_REL32.
+ PR 4454
+ * elf-eh-frame.c (struct cie): Make "personality" a bfd_vma.
+ (_bfd_elf_discard_section_eh_frame): Handle local syms on
+ personality relocation.
-2006-04-27 Alan Modra <amodra@bigpond.net.au>
+2007-05-10 Richard Sandiford <richard@codesourcery.com>
- * coff-rs6000.c (xcoff_write_archive_contents_old): Warning fix.
+ * elf.c (assign_file_positions_for_load_sections): Use p_memsz
+ rather than p_filesz to calculate the LMA of the end of a segment.
-2006-04-16 Daniel Jacobowitz <dan@codesourcery.com>
+2007-05-10 Jakub Jelinek <jakub@redhat.com>
- * configure.in: Update version to 2.16.92.
- * configure: Regenerated.
+ * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Don't do copyreloc
+ processing if symbol is defined in the executable.
+
+2007-05-10 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf32-frv.c (_frvfdpic_check_discarded_relocs): New.
+ (frvfdpic_elf_discard_info): New.
+ (elf_backend_discard_info): Define for FDPIC.
+
+2007-05-09 Mark Shinwell <shinwell@codesourcery.com>
+
+ * elf32-arm.c (bfd_elf32_arm_vfp11_erratum_scan): Don't
+ attempt to scan if the bfd doesn't correspond to an ELF image.
+ (bfd_elf32_arm_vfp11_fix_veneer_locations): Likewise.
+
+2007-05-08 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf32-frv.c (elf32_frv_relocate_section): Discard dynamic relocs
+ for which _bfd_elf_section_offset returns -1.
+
+2007-05-08 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-spu.c (spu_elf_size_stubs): Use "void *" for psyms.
+ (mark_functions_via_relocs): Likewise.
+
+2007-05-07 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.c (bfd_elf_final_link): Correct reloc handling for
+ elf_backend_count_relocs.
+ (bfd_elf_discard_info): Print an error if we can't read syms.
+
+2007-05-07 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-spu.c (spu_elf_reloc_type_lookup): Return NULL on
+ invalid reloc code.
+ (spu_elf_gc_mark_hook, spu_elf_section_processing): Delete functions.
+ (elf_backend_gc_mark_hook, elf_backend_section_processing): Don't
+ define.
+
+2007-05-07 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (assign_file_positions_for_load_sections): Don't check
+ core segment.
+
+2007-05-04 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elflink.c (elf_link_sort_relocs): Return if both .rela.dyn
+ and .rel.dyn aren't present.
+
+2007-05-04 Nick Clifton <nickc@redhat.com>
+
+ * elflink.c (elf_link_sort_relocs): If both .rela.dyn and .rel.dyn
+ sections are present examine the indirect sections in an attempt
+ to compute the correct relocation size. If there is any
+ ambiguity, produce an error and refuse to sort.
+
+2007-05-03 Sandra Loosemore <sandra@codesourcery.com>
+
+ * elf32-arm.c (allocate_dynrelocs): Fix typo in comment.
+
+2007-05-03 Vincent Riviere <vincent.riviere@freesbee.fr>
+ Nick Clifton <nickc@redhat.com>
+
+ PR gas/3041
+ * aoutx.h (swap_std_reloc_out): Treat relocs against weak symbols
+ in the same way as relocs against external symbols.
+
+2007-05-02 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (assign_file_positions_for_load_sections): Set sh_offset
+ here. Set sh_type to SHT_NOBITS if we won't be allocating
+ file space. Don't bump p_memsz for non-alloc sections. Adjust
+ section-in-segment check.
+ (assign_file_positions_for_non_load_sections): Don't set sh_offset
+ here for sections that have already been handled above.
-2006-04-16 Daniel Jacobowitz <dan@codesourcery.com>
+2007-04-30 Alan Modra <amodra@bigpond.net.au>
- * po/SRC-POTFILES.in: Regenerated.
+ * elf32-spu.c (struct spu_link_hash_table): Add stack_analysis
+ and emit_stack_syms bitfields.
+ (get_sym_h): Read all symbols if stack analysis will be done.
+ (spu_elf_create_sections): Add stack_analysis and emit_stack_syms
+ params, and stash in hash table.
+ (is_hint): Split off from..
+ (is_branch): ..here. Adjust callers.
+ (spu_elf_size_stubs): Add stack_analysis param. Arrange to read
+ and keep all syms.
+ (write_one_stub): Fix mem leak.
+ (find_function_stack_adjust): New function.
+ (sort_syms_syms, sort_syms_psecs): New vars.
+ (sort_syms): New function.
+ (struct call_info, struct function_info): New.
+ (struct spu_elf_stack_info): New.
+ (alloc_stack_info, maybe_insert_function, func_name): New functions.
+ (is_nop, insns_at_end, check_function_ranges): Likewise.
+ (find_function, insert_callee, mark_functions_via_relocs): Likewise.
+ (pasted_function, interesting_section, discover_functions): Likewise.
+ (mark_non_root, call_graph_traverse, build_call_tree): Likewise.
+ (sum_stack, spu_elf_stack_analysis, spu_elf_final_link): Likewise.
+ (bfd_elf32_bfd_final_link): Define.
+ * elf32-spu.h (struct _spu_elf_section_data): Add stack_info field.
+ (spu_elf_create_sections, spu_elf_size_stubs): Update prototypes.
-2006-04-14 David Heine <dlheine@tensilica.com>
+2007-04-28 Sergey Rogozhkin <rogozhkin@niisi.msk.ru>
- * elf32-xtensa.c (build_reloc_opcodes): New.
- (compute_text_actions): Use it to decode opcodes outside inner loop.
- (check_section_ebb_pcrels_fit): Add "reloc_opcodes" argument, and if
- it is set, use it to get the opcodes for relocations.
- (move_shared_literal): Adjust call to check_section_ebb_pcrels_fit.
+ * elfxx-mips.c (mips_elf_create_dynamic_relocation): Don't access
+ memory which we might not own.
-2006-04-08 H.J. Lu <hongjiu.lu@intel.com>
+2007-04-27 Bob Wilson <bob.wilson@acm.org>
- PR ld/2513
- * elf32-i386.c (GOT_TLS_MASK): New macro for tls_type.
- (GOT_TLS_IE_IE): Likewise.
- (GOT_TLS_IE_GD): Likewise.
- (GOT_TLS_IE_MASK): Likewise.
- (elf_i386_check_relocs): For global symbols, set GOT_TLS_IE_GD
- and GOT_TLS_IE_IE for R_386_TLS_GD and R_386_TLS_IE
- respectively.
- (allocate_dynrelocs): If both GOT_TLS_IE_IE and GOT_TLS_IE_GD
- are set, treat tls_type as GOT_TLS_IE_BOTH.
- (elf_i386_relocate_section): Likewise.
+ * elf32-xtensa.c (elf_xtensa_make_sym_local): Restore deleted function.
+ (elf_xtensa_hide_symbol, elf_backend_hide_symbol): Likewise.
+ (elf_xtensa_allocate_dynrelocs): Use elf_xtensa_make_sym_local.
-2006-04-07 Randolph Chung <tausq@debian.org>
+2007-04-27 Bob Wilson <bob.wilson@acm.org>
- * elf64-hppa.c (elf64_hppa_grok_prstatus): New function.
- (elf64_hppa_grok_psinfo): Likewise.
- (elf_backend_grok_pstatus, elf_backend_grok_psinfo): Define.
+ * elf32-xtensa.c (xtensa_read_table_entries): Step through table
+ contents and relocs in parallel.
-2006-04-06 DJ Delorie <dj@redhat.com>
+2007-04-27 Bob Wilson <bob.wilson@acm.org>
- * elf32-m32c.c (m32c_elf_relocate_section): Generate a symbol for
- each plt entry we create.
+ * elf32-xtensa.c (relax_property_section): Remove extra irel increment.
-2006-04-06 Carlos O'Donell <carlos@codesourcery.com>
+2007-04-27 Alan Modra <amodra@bigpond.net.au>
- * po/Make-in: Add install-html target.
- * Makefile.am: Rename docdir to bfddocdir. Add datarootdir, docdir
- htmldir. Add install-html and install-html-recursive targets.
+ * cpu-rs6000.c: Write Mimi's name in ASCII.
+ * coff-rs6000.c: Likewise.
+ * rs6000-core.c: Likewise.
+
+2007-04-27 Alan Modra <amodra@bigpond.net.au>
+
+ * sysdep.h: Include config.h first.
+ Many files: Include sysdep.h before bfd.h.
+ * Makefile.am: Run "make dep-am".
* Makefile.in: Regenerate.
- * configure.in: AC_SUBST for datarootdir, docdir and htmldir.
- * configure: Regenerate.
-2006-04-06 H.J. Lu <hongjiu.lu@intel.com>
+2007-04-25 Alan Modra <amodra@bigpond.net.au>
- * elfxx-ia64.c (elfNN_ia64_relax_section): Skip unneeded passes
- with the skip_relax_pass_0 and skip_relax_pass_1 bits in the
- section structure.
+ * sysdep.h: Revert last change.
-2006-04-05 Bernd Schmidt <bernd.schmidt@analog.com>
+2007-04-24 Nick Clifton <nickc@redhat.com>
- * elf32-bfin.c (bfinfdpic_relocs_info_hash): Sprinkle casts to
- eliminate warnings.
+ * coffcode.h (coff_slurp_reloc_table): Initialise dst.r_offset.
+ * coff-m68k.c (m68kcoff_rtype_to_howto): Initialize relent.howto.
-2006-04-05 H.J. Lu <hongjiu.lu@intel.com>
- James E Wilson <wilson@specifixinc.com>
+2007-04-24 Alan Modra <amodra@bigpond.net.au>
- PR ld/2442
- * elfxx-ia64.c (elfNN_ia64_dyn_sym_info): Remove next.
- (elfNN_ia64_local_hash_entry): Add count, sorted_count and
- size.
- (elfNN_ia64_link_hash_entry): Likewise.
- (elfNN_ia64_new_elf_hash_entry): Initialize count, sorted_count
- and size.
- (elfNN_ia64_hash_copy_indirect): Updated elfNN_ia64_dyn_sym_info
- processing.
- (elfNN_ia64_hash_hide_symbol): Likewise.
- (elfNN_ia64_global_dyn_sym_thunk): Likewise.
- (elfNN_ia64_local_dyn_sym_thunk): Likewise.
- (elfNN_ia64_global_dyn_info_free): New function.
- (elfNN_ia64_local_dyn_info_free): Likewise.
- (elfNN_ia64_hash_table_free): Free local and global
- elfNN_ia64_dyn_sym_info.
- (addend_compare): New function.
- (sort_dyn_sym_info): Likewise.
- (get_dyn_sym_info): Updated to use binary search for addend.
- (elfNN_ia64_check_relocs): Scan relocations to create dynamic
- relocation arrays first.
-
-2006-04-05 Bernd Schmidt <bernd.schmidt@analog.com>
-
- * elf32-bfin.c (_bfin_create_got_section): Don't generate a _gp
- symbol.
-
-2006-04-05 H.J. Lu <hongjiu.lu@intel.com>
-
- PR ld/2411
- * elflink.c (check_dynsym): New.
- (elf_link_output_extsym): Use it.
- (bfd_elf_final_link): Likewise.
-
-2006-04-05 H.J. Lu <hongjiu.lu@intel.com>
-
- PR ld/2404
- * elflink.c (_bfd_elf_merge_symbol): Skip the default indirect
- symbol from the dynamic definition with the default version if
- its type and the type of existing regular definition mismatch.
-
-2006-04-05 Richard Sandiford <richard@codesourcery.com>
- Daniel Jacobowitz <dan@codesourcery.com>
-
- * config.bfd (sparc-*-vxworks*): New stanza.
- * configure.in (bfd_elf32_sparc_vxworks_vec): New stanza.
- (bfd_elf32_sparc_vec, bfd_elf64_sparc_vec): Add elf-vxworks.lo.
+ * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Warn if
+ eh_frame_hdr table won't be created.
+
+2007-04-24 Alan Modra <amodra@bigpond.net.au>
+
+ * acinclude.m4: Include config/stdint.m4.
+ * configure.in: Invoke GCC_HEADER_STDINT.
+ * sysdep.h: Don't include ansidecl.h here.
* configure: Regenerate.
- * elf32-sparc.c: Include elf-vxworks.h.
- (elf32_sparc_vxworks_link_hash_table_create: New.
- (elf32_sparc_vxworks_final_write_processing): New.
- (TARGET_BIG_SYM): Override for VxWorks.
- (TARGET_BIG_NAME, ELF_MINPAGESIZE): Likewise.
- (bfd_elf32_bfd_link_hash_table_create): Likewise.
- (elf_backend_want_got_plt, elf_backend_plt_readonly): Likewise.
- (elf_backend_got_header_size, elf_backend_add_symbol_hook): Likewise.
- (elf_backend_link_output_symbol_hook): Likewise.
- (elf_backend_emit_relocs): Likewise.
- (elf_backend_final_write_processing, elf32_bed): Likewise.
- * elfxx-sparc.c: Include libiberty.h and elf-vxworks.h.
- (sparc_vxworks_exec_plt0_entry, sparc_vxworks_exec_plt_entry): New.
- (sparc_vxworks_shared_plt0_entry, sparc_vxworks_shared_plt_entry): New.
- (_bfd_sparc_elf_link_hash_table_create): Don't initialize
- build_plt_entry here.
- (create_got_section): Initialize sgotplt for VxWorks.
- (_bfd_sparc_elf_create_dynamic_sections): Initialize build_plt_entry,
- plt_header_size and plt_entry_size, with new VxWorks-specific settings.
- Call elf_vxworks_create_dynamic_sections for VxWorks.
- (allocate_dynrelocs): Use plt_header_size and plt_entry_size.
- Allocate room for .got.plt and .rela.plt.unloaded entries on VxWorks.
- (_bfd_sparc_elf_size_dynamic_sections): Don't allocate a nop in .plt
- for VxWorks. Check for the .got.plt section.
- (sparc_vxworks_build_plt_entry): New function.
- (_bfd_sparc_elf_finish_dynamic_symbol): Add handling of VxWorks PLTs.
- Don't make _GLOBAL_OFFSET_TABLE_ and _PROCEDURE_LINKAGE_TABLE_
- absolute on VxWorks.
- (sparc32_finish_dyn): Add special handling for DT_RELASZ
- and DT_PLTGOT on VxWorks.
- (sparc_vxworks_finish_exec_plt): New.
- (sparc_vxworks_finish_shared_plt): New.
- (_bfd_sparc_elf_finish_dynamic_sections): Call them.
- Use plt_header_size and plt_entry_size.
- * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Add is_vxworks,
- srelplt2, sgotplt, plt_header_size and plt_entry_size fields.
- * Makefile.am (elfxx-sparc.lo): Depend on elf-vxworks.h.
- (elf32-sparc.lo): Likewise.
+ * config.in: Regenerate.
* Makefile.in: Regenerate.
- * targets.c (bfd_elf32_sparc_vxworks_vec): Declare.
- (_bfd_target_vector): Add a pointer to it.
-
-2006-03-30 Ben Elliston <bje@au.ibm.com>
-
- PR ld/2267
- * elflink.c (elf_fixup_link_order): Ensure `elfsec' is not a
- special section number that exceeds the number of ELF sections
- (eg. SHN_MIPS_SCOMMON).
-
-2006-03-27 Richard Sandiford <richard@codesourcery.com>
-
- * elfxx-mips.c (mips_got_entry): Add more commentary.
- (mips_elf_local_got_index): Use the hash table entry to record
- the GOT index of forced-local symbols.
- (mips_elf_initialize_tls_index): Rearrange code. Store the index
- in either the hash table entry or the mips_got_entry, not both.
- Add more commentary.
- (mips_elf_multi_got): Make sure the g->next is nonnull when calling
- mips_elf_initialize_tls_index.
-
-2006-03-25 Bernd Schmidt <bernd.schmidt@analog.com>
-
- * elf32-bfin.c (bfd_const_reloc, bfd_oper_reloc, bfin_push_reloc,
- RELOC_STACK_SIZE, reloc_stack, reloc_stack_tos, is_reloc_stack_empty,
- reloc_stack_push, reloc_stack_pop, reloc_stack_operate,
- bfin_areloc_howto_table): Delete. All
- uses deleted as well.
- (bfin_reloc_map): Delete all stack relocs.
- (bfin_info_to_howto, bfin_bfd_reloc_type_lookup,
- bfin_reloc_type_lookup): Don't support them.
- (bfin_relocate_section): Don't try to handle them.
-
- * config.bfd (bfin-*-*): Add bfd_elf32_bfinfdpic_vec.
- * configure.in: Likewise.
- * configure: Regenerate.
- * elf32-bfin.c: Include "elf/dwarf2.h" and "hashtab.h".
- (BFIN_RELOC_MAX): Now 0x21.
- (bfin_howto_table, bfin_reloc_map): Add FD-PIC relocs.
- (bfd_elf32_bfinfdpic_vec): Declare.
- (IS_FDPIC): New macro.
- (struct bfinfdpic_elf_link_hash_table): New struct.
- (bfinfdpic_hash_table, bfinfdpic_got_section,
- bfinfdpic_gotrel_section, bfinfdpic_gotfixup_section,
- bfinfdpic_plt_setion, bfinfdpic_pltrel_section,
- bfinfdpic_relocs_info, bfinfdpic_got_initial_offset,
- bfinfdpic_plt_initial_offset): Accessor macros for it.
- (BFINFDPIC_SYM_LOCAL, BFINFDPIC_FUNCDESC_LOCAL): New macros.
- (struct bfinfdpic_relocs_info): New struct.
- (LZPLT_RESOLVER_EXTRA, LZPLT_NORMAL_SIZE, LZPLT_ENTRIES,
- BFINFDPIC_LZPLT_BLOCK_SIZE, BFINFDPIC_LZPLT_RESOLV_LOC,
- DEFAULT_STACK_SIZE): New macros.
- (bfinfdpic_elf_link_hash_table_create, bfinfdpic_relocs_info_hash,
- bfinfdpic_relocs_info_eq, bfinfdpics_relocs_info_find,
- bfinfdpic_relocs_info_for_global, bfinfdpic_relocs_info_for_local,
- bfinfdpic_pic_merge_early_relocs_info, _bfinfdpic_add_dyn_reloc,
- _bfinfdpic_add_rofixup, _bfinfdpic_osec_to_segment,
- _bfinfdpic_osec_readonly_p, bfinfdpic_relocate_section,
- bfinfdpic_check_relocs, bfinfdpic_gc_sweep_hook,
- _bfinfdpic_link_omit_section_dynsym, _bfin_create_got_section,
- elf32_bfinfdpic_create_dynamic_sections, _bfinfdpic_get_fd_entry,
- _bfinfdpic_compute_got_alloc_data, _bfinfdpic_get_got_entry,
- _bfinfdpic_assign_got_entries, _bfinfdpic_assign_plt_entries,
- _bfinfdpic_resolve_final_relocs_info,
- elf32_bfinfdpic_size_dynamic_sections,
- elf32_bfinfdpic_always_size_sections,
- elf32_bfinfdpic_modify_segment_map,
- _bfinfdpic_count_got_plt_entries,
- elf32_bfinfdpic_finish_dynamic_sections,
- elf32_bfinfdpic_adjust_dynamic_symbol,
- elf32_bfinfdpic_finish_dynamic_symbol,
- elf32_bfinfdpic_elf_use_relative_eh_frame,
- elf32_bfinfdpic_elf_encode_eh_address,
- elf32_bfin_object_p, bfin_elf_copy_private_bfd_data,
- elf32_bfinfdpic_copy_private_bfd_data,
- (struct _bfinfdpic_dynamic_got_info,
- struct _bfinfdpic_dynamic_got_plt_info): New structs.
- (elf32_bfin_print_private_bfd_data): Print PIC flags.
- (elf32_bfin_merge_private_bfd_data): Extend to support FD-PIC.
- (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME, elf32_bed,
- elf_backend_got_header_size, bfd_elf32_bfd_link_hash_table_create,
- elf_backend_always_size_sectinos, elf_backend_modify_segment_map,
- bfd_elf32_bfd_copy_private_bfd_data,
- elf_backend_create_dynamic_sections, elf_backend_adjust_dynamic_symbol,
- elf_backend_size_dynamic_sections, elf_backend_finish_dynamic_symbol,
- elf_backend_finish_dynamic_sections, elf_backend_relocate_section,
- elf_backend_can_make_relative_eh_frame, elf_backend_check_relocs,
- elf_backend_can_make_ldsa_relative_eh_frame, elf_backend_may_use_rel_p,
- elf_backend_may_use_rela_p, elf_backend_default_use_rela_p,
- elf_backend_omit_section_dynsym): Redefine these macros and include
- "elf32-target.h" again to create the elf32-bfinfdpic target.
- * reloc.c (BFD_RELOC_BFIN_GOT17M4, BFD_RELOC_BFIN_GOTHI,
- BFD_RELOC_BFIN_GOTLO, BFD_RELOC_BFIN_FUNCDESC,
- BFD_RELOC_BFIN_FUNCDESC_GOT17M4, BFD_RELOC_BFIN_FUNCDESC_GOTHI,
- BFD_RELOC_BFIN_FUNCDESC_GOTLO, BFD_RELOC_BFIN_FUNCDESC_VALUE,
- BFD_RELOC_BFIN_FUNCDESC_GOTOFF17M4, BFD_RELOC_BFIN_FUNCDESC_GOTOFFHI,
- BFD_RELOC_BFIN_FUNCDESC_GOTOFFLO, BFD_RELOC_BFIN_GOTOFFHI,
- BFD_RELOC_BFIN_GOTOFFLO): New.
- * targets.c (bfd_elf32_bfinfdpic_vec): New bfd_target.
- (_bfd_target_vector): Add it.
- * bfd-in2.h: Regenerate.
- * libbfd.h: Regenerate.
-2006-03-25 Richard Sandiford <richard@codesourcery.com>
+2007-04-23 Nathan Sidwell <nathan@codesourcery.com>
- * cpu-m68k.c (bfd_m68k_compatible): Treat ISA A+ and ISA B code as
- incompatible. Likewise MAC and EMAC code.
- * elf32-m68k.c (elf32_m68k_merge_private_bfd_data): Use
- bfd_get_compatible to set the new bfd architecture. Rely on it
- to detect incompatibilities.
+ * archures.c (bfd_mach_mcf_isa_c, bfd_mach_mcf_isa_c_mac,
+ bfd_mach_mcf_isa_c_emac): New.
+ * elf32-m68k.c (ISAC_PLT_ENTRY_SIZE, elf_isac_plt0_entry,
+ elf_isac_plt_entry, elf_isac_plt_info): New.
+ (elf32_m68k_object_p): Add ISA_C.
+ (elf32_m68k_print_private_bfd_data): Print ISA_C.
+ (elf32_m68k_get_plt_info): Detect ISA_C.
+ * cpu-m68k.c (arch_info): Add ISAC.
+ (m68k_arch_features): Likewise,
+ (bfd_m68k_compatible): ISAs B & C are not compatible.
-2006-03-22 Bob Wilson <bob.wilson@acm.org>
+2007-04-21 Nick Clifton <nickc@redhat.com>
- * elf32-xtensa.c (xtensa_read_table_entries): Remove assertion that
- rel->r_addend is zero.
+ * ecoff.c (_bfd_ecoff_write_armap): Initialise rehash.
+ (ecoff_link_add_archive_symbols): Likewise.
+ * coff-m68k.c (m68kcoff_common_addend_rtype_to_howto): Initialise
+ relent.howto.
+ * ieee.c (parse_int): Initialise x.
+ (must_parse_int): Initialise result.
+ (ieee_slurp_external_symbols): Initialise value.
-2006-03-22 Richard Sandiford <richard@codesourcery.com>
+2007-04-21 Alan Modra <amodra@bigpond.net.au>
- * elfxx-mips.c (_bfd_mips_vxworks_finish_dynamic_symbol): Fix type
- of "loc".
+ * config.bfd (spu-*-elf): Delete targ_selvecs.
-2006-03-22 Richard Sandiford <richard@codesourcery.com>
- Daniel Jacobowitz <dan@codesourcery.com>
- Phil Edwards <phil@codesourcery.com>
- Zack Weinberg <zack@codesourcery.com>
- Mark Mitchell <mark@codesourcery.com>
- Nathan Sidwell <nathan@codesourcery.com>
+2007-04-19 Nick Clifton <nickc@redhat.com>
+
+ * coffcode.h (coff_rtype_to_howto): Initialise genrel.howto.
+
+2007-04-19 Alan Modra <amodra@bigpond.net.au>
+ * bfd.c (bfd_demangle): New function.
+ * Makefile.am: Run "make dep-am".
+ * Makefile.in: Regenerate.
* bfd-in2.h: Regenerate.
- * config.bfd (mips*-*-vxworks*, mips*el-*-vxworks*): New stanzas.
- * configure.in (bfd_elf32_bigmips_vxworks_vec): New stanza.
- (bfd_elf32_littlemips_vxworks_vec): Likewise.
- (bfd_elf32_bigmips_vec): Add elf-vxworks.lo.
- (bfd_elf32_littlemips_vec): Likewise.
- (bfd_elf32_nbigmips_vec): Likewise.
- (bfd_elf32_nlittlemips_vec): Likewise.
- (bfd_elf32_ntradbigmips_vec): Likewise.
- (bfd_elf32_ntradlittlemips_vec): Likewise.
- (bfd_elf32_tradbigmips_vec): Likewise.
- (bfd_elf32_tradlittlemips_vec): Likewise.
- (bfd_elf64_bigmips_vec): Likewise.
- (bfd_elf64_littlemips_vec): Likewise.
- (bfd_elf64_tradbigmips_vec): Likewise.
- (bfd_elf64_tradlittlemips_vec): Likewise.
- * elf32-mips.c: Include elf-vxworks.h.
- (mips_info_to_howto_rel): Use elf_backend_mips_rtype_to_howto
- instead of calling mips_elf32_rtype_to_howto directly.
- (mips_vxworks_copy_howto_rela): New reloc howto.
- (mips_vxworks_jump_slot_howto_rela): Likewise.
- (mips_vxworks_bfd_reloc_type_lookup): New function.
- (mips_vxworks_rtype_to_howto): Likewise.
- (mips_vxworks_final_write_processing): Likewise.
- (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME): Override for VxWorks.
- (TARGET_BIG_SYM, TARGET_BIG_NAME, elf_bed, ELF_MAXPAGESIZE): Likewise.
- (elf_backend_want_got_plt): Likewise.
- (elf_backend_want_plt_sym): Likewise.
- (elf_backend_got_symbol_offset): Likewise.
- (elf_backend_want_dynbss): Likewise.
- (elf_backend_may_use_rel_p): Likewise.
- (elf_backend_may_use_rela_p): Likewise.
- (elf_backend_default_use_rela_p): Likewise.
- (elf_backend_got_header_size: Likewise.
- (elf_backend_plt_readonly): Likewise.
- (bfd_elf32_bfd_reloc_type_lookup): Likewise.
- (elf_backend_mips_rtype_to_howto): Likewise.
- (elf_backend_adjust_dynamic_symbol): Likewise.
- (elf_backend_finish_dynamic_symbol): Likewise.
- (bfd_elf32_bfd_link_hash_table_create): Likewise.
- (elf_backend_add_symbol_hook): Likewise.
- (elf_backend_link_output_symbol_hook): Likewise.
- (elf_backend_emit_relocs): Likewise.
- (elf_backend_final_write_processing: Likewise.
- (elf_backend_additional_program_headers): Likewise.
- (elf_backend_modify_segment_map): Likewise.
- (elf_backend_symbol_processing): Likewise.
- * elfxx-mips.c: Include elf-vxworks.h.
- (mips_elf_link_hash_entry): Add is_relocation_target and
- is_branch_target fields.
- (mips_elf_link_hash_table): Add is_vxworks, srelbss, sdynbss, srelplt,
- srelplt2, sgotplt, splt, plt_header_size and plt_entry_size fields.
- (MIPS_ELF_RELA_SIZE, MIPS_ELF_REL_DYN_NAME): New macros.
- (MIPS_RESERVED_GOTNO): Take a mips_elf_link_hash_table argument.
- Return 3 for VxWorks.
- (ELF_MIPS_GP_OFFSET): Change the argument from a bfd to a
- mips_elf_link_hash_table. Return 0 for VxWorks.
- (MIPS_ELF_GOT_MAX_SIZE): Change the argument from a bfd to a
- mips_elf_link_hash_table. Update the call to ELF_MIPS_GP_OFFSET.
- (mips_vxworks_exec_plt0_entry): New variable.
- (mips_vxworks_exec_plt_entry): Likewise.
- (mips_vxworks_shared_plt0_entry): Likewise.
- (mips_vxworks_shared_plt_entry): Likewise.
- (mips_elf_link_hash_newfunc): Initialize the new hash_entry fields.
- (mips_elf_rel_dyn_section): Change the bfd argument to a
- mips_elf_link_hash_table. Use MIPS_ELF_REL_DYN_NAME to get
- the name of the section.
- (mips_elf_initialize_tls_slots): Update the call to
- mips_elf_rel_dyn_section.
- (mips_elf_gotplt_index): New function.
- (mips_elf_local_got_index): Add an input_section argument.
- Update the call to mips_elf_create_local_got_entry.
- (mips_elf_got_page): Likewise.
- (mips_elf_got16_entry): Likewise.
- (mips_elf_create_local_got_entry): Add bfd_link_info and input_section
- arguments. Create dynamic relocations for each entry on VxWorks.
- (mips_elf_merge_gots): Update the use of MIPS_ELF_GOT_MAX_SIZE.
- (mips_elf_multi_got): Update the uses of MIPS_ELF_GOT_MAX_SIZE
- and MIPS_RESERVED_GOTNO.
- (mips_elf_create_got_section): Update the uses of
- MIPS_ELF_GOT_MAX_SIZE. Create .got.plt on VxWorks.
- (is_gott_symbol): New function.
- (mips_elf_calculate_relocation): Use a dynobj local variable.
- Update the calls to mips_elf_local_got_index, mips_elf_got16_entry and
- mips_elf_got_page_entry. Set G to the .got.plt entry when calculating
- VxWorks R_MIPS_CALL* relocations. Calculate and use G for all GOT
- relocations on VxWorks. Add dynamic relocations for references
- to the VxWorks __GOTT_BASE__ and __GOTT_INDEX__ symbols. Don't
- create dynamic relocations for R_MIPS_32, R_MIPS_REL32 or R_MIPS_64
- in VxWorks executables.
- (mips_elf_allocate_dynamic_relocations): Add a bfd_link_info argument.
- Use MIPS_ELF_RELA_SIZE to calculate the size of a VxWorks entry.
- Don't allocate a null entry on VxWorks.
- (mips_elf_create_dynamic_relocation): Update the call to
- mips_elf_rel_dyn_section. Use absolute rather than relative
- relocations for VxWorks, and make them RELA rather than REL.
- (_bfd_mips_elf_create_dynamic_sections): Don't make .dynamic
- read-only on VxWorks. Update the call to mips_elf_rel_dyn_section.
- Create the .plt, .rela.plt, .dynbss and .rela.bss sections on
- VxWorks. Likewise create the _PROCEDURE_LINKAGE_TABLE symbol.
- Call elf_vxworks_create_dynamic_sections for VxWorks and
- initialize the plt_header_size and plt_entry_size fields.
- (_bfd_mips_elf_check_relocs): Don't allow GOT relocations to be
- used in VxWorks executables. Don't allocate dynamic relocations
- for R_MIPS_32, R_MIPS_REL32 or R_MIPS_64 in VxWorks executables.
- Set is_relocation_target for each symbol referenced by a relocation.
- Allocate .rela.dyn entries for relocations against the special
- VxWorks __GOTT_BASE__ and __GOTT_INDEX__ symbols. Create GOT
- entries for all VxWorks R_MIPS_GOT16 relocations. Don't allocate
- a global GOT entry for symbols mentioned in VxWorks R_MIPS_CALL*,
- R_MIPS_32, R_MIPS_REL32 or R_MIPS_64 relocations. Update the calls
- to mips_elf_rel_dyn_section and mips_elf_allocate_dynamic_relocations.
- Set is_branch_target for symbols mentioned in R_MIPS_PC16 or R_MIPS_26
- relocations. Don't set no_fn_stub on VxWorks.
- (_bfd_mips_elf_adjust_dynamic_symbol): Update the call to
- mips_elf_allocate_dynamic_relocations.
- (_bfd_mips_vxworks_adjust_dynamic_symbol): New function.
- (_bfd_mips_elf_always_size_sections): Do not allocate GOT page
- entries for VxWorks, and do not create multiple GOTs.
- (_bfd_mips_elf_size_dynamic_sections): Use MIPS_ELF_REL_DYN_NAME.
- Handle .got specially for VxWorks. Update the uses of
- MIPS_RESERVED_GOTNO and mips_elf_allocate_dynamic_relocations.
- Check for sgotplt and splt. Allocate the .rel(a).dyn contents last,
- once its final size is known. Set DF_TEXTREL for VxWorks. Add
- DT_RELA, DT_RELASZ, DT_RELAENT, DT_PLTREL, DT_PLTRELSZ and DT_JMPREL
- tags on VxWorks. Do not add the MIPS-specific tags for VxWorks.
- (_bfd_mips_vxworks_finish_dynamic_symbol): New function.
- (mips_vxworks_finish_exec_plt): Likewise.
- (mips_vxworks_finish_shared_plt): Likewise.
- (_bfd_mips_elf_finish_dynamic_sections): Remove an unncessary call
- to mips_elf_rel_dyn_section. Use a VxWorks-specific value of
- DT_PLTGOT. Handle DT_RELA, DT_RELASZ, DT_RELAENT, DT_PLTREL,
- DT_PLTRELSZ and DT_JMPREL. Update the uses of MIPS_RESERVED_GOTNO
- and mips_elf_rel_dyn_section. Use a different GOT header for
- VxWorks. Don't sort .rela.dyn on VxWorks. Finish the PLT on VxWorks.
- (_bfd_mips_elf_link_hash_table_create): Initialize the new
- mips_elf_link_hash_table fields.
- (_bfd_mips_vxworks_link_hash_table_create): New function.
- (_bfd_mips_elf_final_link): Set the GP value to _GLOBAL_OFFSET_TABLE_
- on VxWorks. Update the call to ELF_MIPS_GP_OFFSET.
- * elfxx-mips.h (_bfd_mips_vxworks_adjust_dynamic_symbol): Declare.
- (_bfd_mips_vxworks_finish_dynamic_symbol): Likewise.
- (_bfd_mips_vxworks_link_hash_table_create): Likewise.
- * libbfd.h: Regenerate.
- * Makefile.am (elfxx-mips.lo): Depend on elf-vxworks.h.
- (elf32-mips.lo): Likewise.
+
+2007-04-18 Matthias Klose <doko@ubuntu.com>
+
+ * Makefile.am (libbfd_la_LDFLAGS): Use bfd soversion.
+ (bfdver.h): Use the date in non-release builds for the soversion.
* Makefile.in: Regenerate.
- * reloc.c (BFD_RELOC_MIPS_COPY, BFD_RELOC_MIPS_JUMP_SLOT): Declare.
- * targets.c (bfd_elf32_bigmips_vxworks_vec): Declare.
- (bfd_elf32_littlemips_vxworks_vec): Likewise.
- (_bfd_target_vector): Add entries for them.
-2006-03-19 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+2007-04-17 Paul Brook <paul@codesourcery.com>
- * elf64-hppa.c (elf64_hppa_special_sections): Change flags for .tbss
- section from SHF_PARISC_WEAKORDER to SHF_HP_TLS.
- (elf_backend_special_sections): Remove #undef.
+ * elf.c (_bfd_elf_is_function_type): New function.
+ * elflink.c (_bfd_elf_merge_symbol): Use bed->is_function_type.
+ (_bfd_elf_dynamic_symbol_p, _bfd_elf_symbol_refs_local_p,
+ is_global_data_symbol_definition, elf_link_add_object_symbols): Ditto.
+ * elf-bfd.h (elf_backend_data): Add is_function_type.
+ (_bfd_elf_is_function_type): Add prototype.
+ * elfxx-target.h (elf_backend_is_function_type): Add default
+ definition.
+ (elfNN_bed): Add elf_backend_is_function_type.
+ * elf32-arm.c (elf32_arm_is_function_type): New function.
+ (elf_backend_is_function_type): Define.
-2006-03-18 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+2007-04-17 Daniel Jacobowitz <dan@codesourcery.com>
- * elf64-hppa.c (allocate_global_data_opd): Don't create an OPD entry
- for undefined weak symbols.
+ * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Put
+ DT_MIPS_RLD_MAP before DT_DEBUG again.
-2006-03-17 Daniel Jacobowitz <dan@codesourcery.com>
+2007-04-14 Steve Ellcey <sje@cup.hp.com>
- PR ld/2462
- * elflink.c (bfd_elf_final_link): Remove
- bed->elf_backend_emit_relocs from emit_relocs.
+ * Makefile.am: Add ACLOCAL_AMFLAGS.
+ * configure.in: Change macro call order.
+ * Makefile.in: Regnerate.
+ * doc/Makefile.in: Regenerate.
+ * configure: Regenerate.
-2006-03-17 Alexandre Oliva <aoliva@redhat.com>
+2007-04-14 Jakub Jelinek <jakub@redhat.com>
- * elf32-ppc.c (ppc_elf_relocate_section): Copy addend from
- first relocation to the second when relaxing TLS GD to LE;
- zero it out when relaxing to IE.
+ * elflink.c (bfd_elf_final_link): Don't free symbuf for
+ non-elf input bfds.
+ (bfd_elf_size_dynamic_sections): Don't access elf_section_data
+ for non-elf input bfds.
-2006-03-17 Alan Modra <amodra@bigpond.net.au>
+2007-04-12 Richard Sandiford <richard@codesourcery.com>
- PR 2434
- * elflink.c (elf_link_add_object_symbols): Save and restore
- warning sym's linked sym.
+ * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Don't add
+ DT_MIPS_RTLD_MAP for PIEs.
-2006-03-16 Alan Modra <amodra@bigpond.net.au>
+2007-04-12 Richard Sandiford <richard@codesourcery.com>
- PR 2434
- * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete.
- (elf_link_add_object_symbols): Delete unnecessary locals. Rename
- hash_table -> htab. Formatting. Save entire symbol table
- before loading as-needed syms, and restore afterwards if lib not
- needed. Use bfd_hash_allocate rather than bfd_alloc for sym
- name. Free some buffers earlier.
- * bfd-in.h (struct bfd_hash_table): Add entsize.
- (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype.
- * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise
- * hash.c (bfd_hash_table_init_n): Add entsize param, save to
- hash table.
- (bfd_hash_table_init): Add param, adjust calls.
- * aoutx.h: Adjust all hash_table_init functions and calls.
- * bfd.c: Likewise.
- * coff-arm.c: Likewise.
- * coff-h8300.c: Likewise.
- * coff-ppc.c: Likewise.
- * cofflink.c: Likewise.
- * ecoff.c: Likewise.
- * ecofflink.c: Likewise.
- * elf-m10300.c: Likewise.
- * elf-strtab.c: Likewise.
- * elf.c: Likewise.
- * elf32-arm.c: Likewise.
- * elf32-bfin.c: Likewise.
- * elf32-cris.c: Likewise.
- * elf32-frv.c: Likewise.
- * elf32-hppa.c: Likewise.
- * elf32-i386.c: Likewise.
- * elf32-m32r.c: Likewise.
- * elf32-m68hc1x.c: Likewise.
- * elf32-m68k.c: Likewise.
- * elf32-ppc.c: Likewise.
- * elf32-s390.c: Likewise.
- * elf32-sh.c: Likewise.
- * elf32-vax.c: Likewise.
- * elf64-alpha.c: Likewise.
- * elf64-hppa.c: Likewise.
- * elf64-ppc.c: Likewise.
- * elf64-s390.c: Likewise.
- * elf64-sh64.c: Likewise.
- * elf64-x86-64.c: Likewise.
- * elfxx-ia64.c: Likewise.
- * elfxx-mips.c: Likewise.
- * elfxx-sparc.c: Likewise.
- * i386linux.c: Likewise.
- * libaout.h: Likewise.
- * libbfd-in.h: Likewise.
- * libcoff-in.h: Likewise.
- * linker.c: Likewise.
- * m68klinux.c: Likewise.
- * merge.c: Likewise.
- * opncls.c: Likewise.
- * pdp11.c: Likewise.
- * sparclinux.c: Likewise.
- * stabs.c: Likewise.
- * sunos.c: Likewise.
- * vms.c: Likewise.
- * xcofflink.c: Likewise.
- * section.c (struct section_hash_entry): Move to..
- * libbfd-in.h: ..here.
- * Makefile.am: Run "make dep-am"
- * Makefile.in: Regenerate.
- * bfd-in2.h: Regenerate.
- * libbfd.h: Regenerate.
- * libcoff.h: Regenerate.
+ * elfxx-mips.c (mips_elf_calculate_relocation): Set DT_TEXTREL
+ when creating a __GOTT_BASE__ or __GOTT_INDEX__ relocation
+ in a read-only section.
+ (_bfd_mips_elf_check_relocs): Likewise.
+
+2007-04-12 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (xtensa_is_insntable_section): New.
+ (xtensa_is_proptable_section): New.
+ (elf_xtensa_discard_info_for_section): Handle "full" .xt.prop property
+ tables with 12-byte entries, as well as tables with 8-byte entries.
+ Sort the relocations before examining them.
+ (relax_property_section): Use xtensa_is_proptable_section and
+ xtensa_is_littable_section. Rewrite code for combining table entries
+ to be more robust in case of unexpected relocations. Do not set offset
+ of unused relocations to less than zero.
+ (xtensa_is_property_section): Use other functions instead of
+ duplicating section name comparisons.
+ (xtensa_is_littable_section): Use CONST_STRNEQ for ".gnu.linkonce.p.".
+ (xtensa_get_property_predef_flags): Use xtensa_is_insntable_section.
+
+2007-04-12 Bob Wilson <bob.wilson@acm.org>
-2006-03-16 Alan Modra <amodra@bigpond.net.au>
+ * elf32-xtensa.c (elf_xtensa_gc_mark_hook): Don't follow references
+ from Xtensa property sections.
- * elf32-ppc.c (ppc_elf_check_relocs): REL24 and REL14 relocs
- against __GLOBAL_OFFSET_TABLE__ need never be dynamic. Tweak
- last change to REL32 relocs so that they are counted as
- possibly dynamic as per REL24 and REL14.
+2007-04-12 Alan Modra <amodra@bigpond.net.au>
-2006-03-16 Alan Modra <amodra@bigpond.net.au>
+ * elf32-spu.c (needs_ovl_stub): Test that spu_elf_section_data
+ is non-NULL before dereferencing.
- * elf32-ppc.c (ppc_elf_check_relocs): Don't fall into REL24
- checks from REL32.
+2007-04-11 Nathan Sidwell <nathan@codesourcery.com>
-2006-03-15 Ben Elliston <bje@au.ibm.com>
+ * elf-vxworks.c (elf_vxworks_emit_relocs): Remap weakdef PLT slot
+ relocs too.
- * elf32-arm.c (elf32_arm_merge_eabi_attributes): Iterate over all
- in_list elements, not just the first.
-
-2006-03-14 Richard Sandiford <richard@codesourcery.com>
+2007-04-10 Richard Henderson <rth@redhat.com>
- * elf32-mips.c (mips_elf_adjust_addend): New function, mostly split
- out from...
- (_bfd_mips_elf_relocate_section): ...here. Use it to adjust r_addend
- for final links too.
+ * elf64-alpha.c (struct alpha_elf_link_hash_table): Add relax_trip.
+ (elf64_alpha_size_got_sections): Remove unused something_changed local.
+ (elf64_alpha_size_plt_section): Return void.
+ (elf64_alpha_size_rela_got_section): Likewise.
+ (elf64_alpha_relax_section): Only regenerate got+plt if the
+ relax_trip counter has changed.
-2006-03-13 Richard Sandiford <richard@codesourcery.com>
+2007-04-09 Daniel Jacobowitz <dan@codesourcery.com>
- * elfxx-mips.c (mips_elf_create_got_section): Initialize hgot.
+ * Makefile.am (bfdver.h): Do not generate doc/bfdver.texi.
+ * doc/Makefile.am (DOCFILES): Add bfdver.texi.
+ (bfdver.texi): New rule.
+ * Makefile.in, doc/Makefile.in: Regenerated.
-2006-03-11 H.J. Lu <hongjiu.lu@intel.com>
+2007-04-03 Matt Thomas <matt@netbsd.org>
- PR ld/2443
- * dwarf2.c (concat_filename): Don't issue an error if file is
- 0.
+ * elf32-vax.c (elf_vax_relocate_section): Do not emit a PCREL reloc
+ in a shared object if it is not in a CODE section or if it is against
+ a section symbol. This allows DWARF2 to use pcrel format.
-2006-03-10 Paul Brook <paul@codesourcery.com>
+2007-04-05 H.J. Lu <hongjiu.lu@intel.com>
- * elf32-arm.c (INTERWORK_FLAG): Handle EABIv5.
- (elf32_arm_print_private_bfd_data): Ditto.
+ PR ld/4304
+ * elflink.c (bfd_elf_final_link): Call einfo callback in
+ bfd_link_info instead of _bfd_error_handler for DT_TEXTREL
+ warning.
-2006-03-09 Paul Brook <paul@codesourcery.com>
+2007-04-05 Alan Modra <amodra@bigpond.net.au>
- * cpu-arm.c (bfd_is_arm_mapping_symbol_name): Recognise additional
- mapping symbols.
+ * elf32-spu.c (spu_elf_output_symbol_hook): New function.
+ (elf_backend_link_output_symbol_hook): Define.
-2006-03-09 Khem Raj <khem@mvista.com>
+2007-04-02 Nick Clifton <nickc@redhat.com>
- * elf32-arm.c(elf32_arm_finish_dynamic_sections): Use unsigned
- char type.
+ PR binutils/4292
+ * bfd.c (bfd_fprintf_vma): Do not print addresses of 32-bit
+ targets as 64-bit values, even if running on a 64-bit host.
+ * coffgen.c (coff_print_symbol): Likewise.
-2006-03-08 H.J. Lu <hongjiu.lu@intel.com>
+2007-03-29 Nick Clifton <nickc@redhat.com>
- * elfxx-ia64.c (elfNN_ia64_choose_gp): Properly choose gp.
+ PR binutils/4110
+ * elf.c (IS_VALID_GROUP_SECTION_HEADER): New macro.
+ (setup_group): Use it. Report corrupt group section headers.
+ (bfd_section_from_shdr): Use new macro. Replace constant 4 with
+ GRP_ENTRY_SIZE. Cope with NULLs in the group section table.
+ (elf_fake_section): Replace constant 4 with GRP_ENTRY_SIZE.
-2006-03-07 Richard Sandiford <richard@codesourcery.com>
- Daniel Jacobowitz <dan@codesourcery.com>
- Zack Weinberg <zack@codesourcery.com>
- Nathan Sidwell <nathan@codesourcery.com>
- Paul Brook <paul@codesourcery.com>
- Ricardo Anguiano <anguiano@codesourcery.com>
+2007-03-29 Alan Modra <amodra@bigpond.net.au>
+
+ PR ld/4267
+ * elflink.c (evaluate_complex_relocation_symbols): Use bfd_vma
+ for rel->r_info values.
+ (bfd_elf_perform_complex_relocation): Likewise.
+ * elf32-ppc.c (allocate_dynrelocs): Set plt.offset to -1 for
+ unused entries. Don't clear plt.plist in loop.
+
+2007-03-28 Richard Sandiford <richard@codesourcery.com>
+
+ * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Remove append_rela.
+ * elfxx-sparc.c (sparc_elf_append_rela_64, sparc_elf_append_rela_32):
+ Merge into...
+ (sparc_elf_append_rela): ...this new function.
+ (SPARC_ELF_APPEND_RELA): Delete.
+ (_bfd_sparc_elf_link_hash_table_create): Don't initialize
+ the deleted append_rela field.
+ (_bfd_sparc_elf_relocate_section): Use sparc_elf_append_rela
+ instead of SPARC_ELF_APPEND_RELA.
+ (_bfd_sparc_elf_finish_dynamic_symbol): Likewise. Use the
+ elf_size_info structure to find the size of a RELA entry and
+ the associated swap-out function.
+ (sparc64_finish_dyn, sparc64_finish_dyn): Merge into...
+ (sparc_finish_dyn): ...this new function.
+ (_bfd_sparc_elf_finish_dynamic_sections): Update calls accordingly.
+
+2007-03-28 Richard Sandiford <richard@codesourcery.com>
Phil Edwards <phil@codesourcery.com>
- * configure.in (bfd_elf32_bigarm_vec): Include elf-vxworks.lo.
- (bfd_elf32_bigarm_symbian_vec): Likewise.
- (bfd_elf32_bigarm_vxworks_vec): Likewise.
- (bfd_elf32_littlearm_vec): Likewise.
- (bfd_elf32_littlearm_symbian_vec): Likewise.
- (bfd_elf32_littlearm_vxworks_vec): Likewise.
- * configure: Regenerate.
- * elf32-arm.c: Include libiberty.h and elf-vxworks.h.
- (RELOC_SECTION, RELOC_SIZE, SWAP_RELOC_IN, SWAP_RELOC_OUT): New macros.
- (elf32_arm_vxworks_bed): Add forward declaration.
- (elf32_arm_howto_table_1): Fix the masks for R_ASM_ABS12.
- (elf32_arm_vxworks_exec_plt0_entry): New table.
- (elf32_arm_vxworks_exec_plt_entry): Likewise.
- (elf32_arm_vxworks_shared_plt_entry): Likewise.
- (elf32_arm_link_hash_table): Add vxworks_p and srelplt2 fields.
- (reloc_section_p): New function.
- (create_got_section): Use RELOC_SECTION.
- (elf32_arm_create_dynamic_sections): Likewise. Call
- elf_vxworks_create_dynamic_sections for VxWorks targets.
- Choose between the two possible values of plt_header_size
- and plt_entry_size.
- (elf32_arm_link_hash_table_create): Initialize vxworks_p and srelplt2.
- (elf32_arm_abs12_reloc): New function.
- (elf32_arm_final_link_relocate): Call it. Allow the creation of
- dynamic R_ARM_ABS12 relocs on VxWorks. Use reloc_section_p,
- RELOC_SIZE, SWAP_RELOC_OUT and RELOC_SECTION. Initialize the
- r_addend fields of relocs. On rela targets, skip any code that
- adjusts in-place addends. When using _bfd_link_final_relocate
- to perform a final relocation, pass rel->r_addend as the addend
- argument.
- (elf32_arm_merge_private_bfd_data): If one of the bfds is a VxWorks
- object, ignore flags that are not standard on VxWorks.
- (elf32_arm_check_relocs): Allow the creation of dynamic R_ARM_ABS12
- relocs on VxWorks. Use reloc_section_p.
- (elf32_arm_adjust_dynamic_symbol): Use RELOC_SECTION and RELOC_SIZE.
- (allocate_dynrelocs): Use RELOC_SIZE. Account for the size of
- .rela.plt.unloaded relocs on VxWorks targets.
- (elf32_arm_size_dynamic_sections): Use RELOC_SIZE. Check for
- .rela.plt.unloaded as well as .rel(a).plt. Add DT_RELA* tags
- instead of DT_REL* tags on RELA targets.
- (elf32_arm_finish_dynamic_symbol): Use RELOC_SECTION, RELOC_SIZE
- and SWAP_RELOC_OUT. Initialize r_addend fields. Handle VxWorks
- PLT entries. Do not make _GLOBAL_OFFSET_TABLE_ absolute on VxWorks.
- (elf32_arm_finish_dynamic_sections): Use RELOC_SECTION, RELOC_SIZE
- and SWAP_RELOC_OUT. Initialize r_addend fields. Handle DT_RELASZ
- like DT_RELSZ. Handle the VxWorks form of initial PLT entry.
- Correct the .rela.plt.unreloaded symbol indexes.
- (elf32_arm_output_symbol_hook): Call the VxWorks version of this
- hook on VxWorks targets.
- (elf32_arm_vxworks_link_hash_table_create): Set vxworks_p to true.
- Minor formatting tweak.
- (elf32_arm_vxworks_final_write_processing): New function.
- (elf_backend_add_symbol_hook): Override for VxWorks and reset
- for Symbian.
- (elf_backend_final_write_processing): Likewise.
- (elf_backend_emit_relocs): Likewise.
- (elf_backend_want_plt_sym): Likewise.
- (ELF_MAXPAGESIZE): Likewise.
- (elf_backend_may_use_rel_p): Minor formatting tweak.
- (elf_backend_may_use_rela_p): Likewise.
- (elf_backend_default_use_rela_p): Likewise.
- (elf_backend_rela_normal): Likewise.
- * Makefile.in (elf32-arm.lo): Depend on elf-vxworks.h.
-
-2006-03-06 Nathan Sidwell <nathan@codesourcery.com>
-
- * archures.c (bfd_mach_mcf_isa_a_nodiv, bfd_mach_mcf_isa_b_nousp):
- New. Adjust other variants.
- (bfd_default_scan): Update.
- * bfd-in2.h: Rebuilt.
- * cpu-m68k.c: Adjust.
- (bfd_m68k_compatible): New. Use it for architectures.
- * elf32-m68k.c (elf32_m68k_object_p): Adjust.
- (elf32_m68k_merge_private_bfd_data): Adjust. Correct isa-a/b
- mismatch.
- (elf32_m68k_print_private_bfd_data): Adjust.
- * ieee.c (ieee_write_processor): Adjust.
-
-2006-03-06 Alan Modra <amodra@bigpond.net.au>
-
- * dwarf2.c: Formatting.
- (add_line_info): Remove outer loop.
-
-2006-03-05 H.J. Lu <hongjiu.lu@intel.com>
- Alan Modra <amodra@bigpond.net.au>
+ * doc/bfd.texinfo: Put the contents after the title page rather
+ than at the end of the document.
- PR binutils/2338
- * dwarf2.c (loadable_section): New struct.
- (dwarf2_debug): Add loadable_section_count and
- loadable_sections.
- (new_line_sorts_after): New.
- (add_line_info): Use new_line_sorts_after to compare line
- addresses.
- (check_function_name): Removed.
- (unset_sections): New.
- (place_sections): New.
- (_bfd_dwarf2_find_nearest_line): Updated. Call place_sections
- and unset_sections on relocatable files.
- (_bfd_dwarf2_find_line): Likewise.
+2007-03-27 Andreas Schwab <schwab@suse.de>
-2006-03-03 Nick Clifton <nickc@redhat.com>
+ * elfxx-ia64.c (elf_backend_default_execstack): Define to 0.
- * cpu-avr.c: Update to ISO-C90 formatting.
- * elf32-avr.c: Likewise.
+2007-03-26 H.J. Lu <hongjiu.lu@intel.com>
-2006-03-03 Bjoern Haase <bjoern.m.haase@web.de>
+ * configure: Regenerated.
- * elf32-avr.c (avr_reloc_map): Insert BFD_RELOC_AVR_MS8_LDI
- and R_AVR_MS8_LDI
- (bfd_elf_avr_final_write_processing): Set
- EF_AVR_LINKRELAX_PREPARED in e_flags field.
- (elf32_avr_relax_section): New function.
- (elf32_avr_relax_delete_bytes): New function.
- (elf32_avr_get_relocated_section_contents): New function.
- (avr_pc_wrap_around): New function.
- (avr_relative_distance_considering_wrap_around): New function.
- (avr_final_link_relocate): Handle negative int8t_t immediate for R_AVR_LDI.
- * reloc.c: Add BFD_RELOC_AVR_MS8_LDI and BFD_RELOC_AVR_LDI_NEG
+2007-03-26 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-spu.c (struct stubarr): Add stub_hash_table and err fields.
+ (allocate_spuear_stubs): New function.
+ (spu_elf_size_stubs): Call allocate_spuear_stubs.
+
+2007-03-26 Alan Modra <amodra@bigpond.net.au>
+
+ * aout-adobe.c (aout_32_bfd_reloc_name_lookup): Define.
+ * aout-arm.c (MY_bfd_reloc_name_lookup): Define.
+ (MY (bfd_reloc_name_lookup)): New function.
+ * aout-ns32k.c (MY (bfd_reloc_name_lookup)): New function.
+ * aout-target.h (NAME (aout, reloc_name_lookup)): Declare.
+ (MY_bfd_reloc_name_lookup): Define.
+ * aout-tic30.c (tic30_aout_reloc_name_lookup): New function.
+ (MY_bfd_reloc_name_lookup): Define.
+ * aoutx.h (NAME (aout, reloc_type_lookup)): Don't declare.
+ (NAME (aout, reloc_name_lookup)): New function.
+ * bout.c (b_out_bfd_reloc_name_lookup): New function.
+ * coff-alpha.c (alpha_bfd_reloc_name_lookup): New function.
+ (_bfd_ecoff_bfd_reloc_name_lookup): Define.
+ * coff-arm.c (coff_arm_reloc_name_lookup): New function.
+ (coff_bfd_reloc_name_lookup): Define.
+ * coff-i386.c (coff_bfd_reloc_name_lookup): Define.
+ (coff_i386_reloc_name_lookup): New function.
+ * coff-i860.c (coff_i860_reloc_name_lookup): New function.
+ (coff_bfd_reloc_name_lookup): Define.
+ * coff-i960.c (coff_i960_reloc_name_lookup): New function.
+ (coff_bfd_reloc_name_lookup): Define.
+ * coff-m68k.c (m68k_reloc_name_lookup): New function.
+ (coff_bfd_reloc_name_lookup): Define.
+ * coff-maxq.c (maxq_reloc_name_lookup): New function.
+ (coff_bfd_reloc_name_lookup): Define.
+ * coff-mcore.c (mcore_coff_reloc_name_lookup): New function.
+ (coff_bfd_reloc_name_lookup): Define.
+ * coff-mips.c (mips_bfd_reloc_name_lookup): New function.
+ (_bfd_ecoff_bfd_reloc_name_lookup): Define.
+ * coff-ppc.c (ppc_coff_reloc_name_lookup): New function.
+ (coff_bfd_reloc_name_lookup): Define.
+ * coff-rs6000.c (coff_bfd_reloc_name_lookup): Define.
+ (_bfd_xcoff_reloc_name_lookup): New function.
+ (rs6000coff_vec, pmac_xcoff_vec): Init new field.
+ * coff-sh.c (coff_bfd_reloc_name_lookup): Define.
+ (sh_coff_reloc_name_lookup): New function.
+ * coff-sparc.c (coff_sparc_reloc_name_lookup): New function.
+ (coff_bfd_reloc_name_lookup): Define.
+ * coff-tic30.c (coff_bfd_reloc_name_lookup): Define.
+ (tic30_coff_reloc_name_lookup): New function.
+ * coff-tic4x.c (coff_bfd_reloc_name_lookup): Define.
+ (tic4x_coff_reloc_name_lookup): New function.
+ * coff-tic54x.c (coff_bfd_reloc_name_lookup): Define.
+ (tic54x_coff_reloc_name_lookup): New function.
+ * coff-x86_64.c (coff_bfd_reloc_name_lookup): Define.
+ (coff_amd64_reloc_name_lookup): New function.
+ * coff-z80.c (coff_z80_reloc_name_lookup): New function.
+ (coff_bfd_reloc_name_lookup): Define.
+ * coff-z8k.c (coff_z8k_reloc_name_lookup): New function.
+ (coff_bfd_reloc_name_lookup): Define.
+ * coff64-rs6000.c (coff_bfd_reloc_name_lookup): Define.
+ (xcoff64_reloc_name_lookup): New function.
+ (rs6000coff64_vec, aix5coff64_vec): Init new field.
+ * coffcode.h (coff_bfd_reloc_name_lookup): Define.
+ * elf-hppa.h (elf_hppa_reloc_name_lookup): New function.
+ * elf-m10200.c (bfd_elf32_bfd_reloc_name_lookup): New function.
+ * elf-m10300.c (bfd_elf32_bfd_reloc_name_lookup): New function.
+ * elf32-arc.c (bfd_elf32_bfd_reloc_name_lookup): New function.
+ * elf32-arm.c (elf32_arm_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-avr.c (bfd_elf32_bfd_reloc_name_lookup): New function.
+ * elf32-bfin.c (bfin_bfd_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-cr16c.c (elf_cr16c_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-cris.c (cris_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-crx.c (elf_crx_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-d10v.c (bfd_elf32_bfd_reloc_name_lookup): New function.
+ * elf32-d30v.c (bfd_elf32_bfd_reloc_name_lookup): New function.
+ * elf32-dlx.c (elf32_dlx_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-fr30.c (fr30_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-frv.c (frv_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-gen.c (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-h8300.c (elf32_h8_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-hppa.c (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-i370.c (i370_elf_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-i386.c (elf_i386_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-i860.c (elf32_i860_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-i960.c (elf32_i960_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-ip2k.c (ip2k_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-iq2000.c (iq2000_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-m32c.c (m32c_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-m32r.c (bfd_elf32_bfd_reloc_name_lookup): New function.
+ * elf32-m68hc11.c (bfd_elf32_bfd_reloc_name_lookup): New function.
+ * elf32-m68hc12.c (bfd_elf32_bfd_reloc_name_lookup): New function.
+ * elf32-m68k.c (reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-m88k.c (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-mcore.c (mcore_elf_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-mep.c (mep_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-mips.c (bfd_elf32_bfd_reloc_name_lookup): New function.
+ (mips_vxworks_bfd_reloc_name_lookup): Likewise.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-msp430.c (bfd_elf32_bfd_reloc_name_lookup): New function.
+ * elf32-mt.c (mt_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-openrisc.c (openrisc_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-or32.c (bfd_elf32_bfd_reloc_name_lookup): New function.
+ * elf32-pj.c (pj_elf_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-ppc.c (ppc_elf_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-s390.c (elf_s390_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-score.c (elf32_score_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-sh.c (sh_elf_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-sparc.c (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-spu.c (spu_elf_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-v850.c (v850_elf_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-vax.c (reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-xc16x.c (xc16x_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-xstormy16.c (xstormy16_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf32-xtensa.c (elf_xtensa_reloc_name_lookup): New function.
+ (bfd_elf32_bfd_reloc_name_lookup): Define.
+ * elf64-alpha.c (elf64_alpha_bfd_reloc_name_lookup): New function.
+ (bfd_elf64_bfd_reloc_name_lookup): Define.
+ * elf64-gen.c (bfd_elf64_bfd_reloc_name_lookup): Define.
+ * elf64-hppa.c (bfd_elf64_bfd_reloc_name_lookup): Define.
+ * elf64-mips.c (bfd_elf64_bfd_reloc_name_lookup): New function.
+ * elf64-mmix.c (bfd_elf64_bfd_reloc_name_lookup): New function.
+ * elf64-ppc.c (ppc64_elf_reloc_name_lookup): New function.
+ (bfd_elf64_bfd_reloc_name_lookup): Define.
+ * elf64-s390.c (elf_s390_reloc_name_lookup): New function.
+ (bfd_elf64_bfd_reloc_name_lookup): Define.
+ * elf64-sh64.c (sh_elf64_reloc_name_lookup): New function.
+ (bfd_elf64_bfd_reloc_name_lookup): Define.
+ * elf64-sparc.c (bfd_elf64_bfd_reloc_name_lookup): Define.
+ * elf64-x86-64.c (elf64_x86_64_reloc_name_lookup): New function.
+ (bfd_elf64_bfd_reloc_name_lookup): Define.
+ * elfn32-mips.c (bfd_elf32_bfd_reloc_name_lookup): New function.
+ * elfxx-ia64.c (elfNN_ia64_reloc_name_lookup): New function.
+ (bfd_elfNN_bfd_reloc_name_lookup): Define.
+ * elfxx-sparc.c (_bfd_sparc_elf_reloc_name_lookup): New function.
+ * elfxx-sparc.h (_bfd_sparc_elf_reloc_name_lookup): Declare.
+ * i386msdos.c (msdos_bfd_reloc_name_lookup): Define.
+ * i386os9k.c (aout_32_bfd_reloc_name_lookup): Define.
+ * ieee.c (ieee_bfd_reloc_name_lookup): Define.
+ * libaout.h (NAME (aout, reloc_name_lookup)): Declare.
+ * libbfd-in.h (_bfd_norelocs_bfd_reloc_name_lookup): Declare.
+ * mipsbsd.c (MY_bfd_reloc_name_lookup): Define.
+ (MY(reloc_type_lookup)): Rename from MY(reloc_howto_type_lookup).
+ (MY(reloc_name_lookup)): New function.
+ * nlm-target.h (nlm_bfd_reloc_name_lookup): Define.
+ * oasys.c (oasys_bfd_reloc_name_lookup): Define.
+ * pdp11.c (NAME (aout, reloc_name_lookup)): New function.
+ * pe-mips.c (coff_mips_reloc_name_lookup): New function.
+ (coff_bfd_reloc_name_lookup): Define.
+ * reloc.c (bfd_reloc_name_lookup): New function.
+ * riscix.c (riscix_reloc_name_lookup): New function.
+ (MY_bfd_reloc_name_lookup): Define.
+ * som.c (som_bfd_reloc_name_lookup): New function.
+ * targets.c (struct bfd_target): Add reloc_name_lookup.
+ (BFD_JUMP_TABLE_RELOCS): Add NAME##_bfd_reloc_name_lookup.
+ * versados.c (versados_bfd_reloc_name_lookup): Define.
+ * vms.c (vms_bfd_reloc_name_lookup): New function.
+ * bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
+
+2007-03-26 Thiemo Seufer <ths@mips.com>
+
+ PR ld/4208
+ * elfxx-mips.c (mips_elf_next_relocation): Don't signal an error if no
+ matching relocation is found.
+ (_bfd_mips_elf_relocate_section): Only warn about missing relocations.
+
+2007-03-23 H.J. Lu <hongjiu.lu@intel.com>
+
+ * configure: Regenerated.
+
+2007-03-23 Joseph Myers <joseph@codesourcery.com>
+
+ * configure.in: Use ACX_PKGVERSION and ACX_BUGURL.
+ * configure: Regenerate.
+
+2007-03-23 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-spu.c (spu_stub_name): Don't put input section in stub name.
+ Remove input_sec param. Adjust all calls.
+ (write_one_stub): Adjust stub symbol.
+ (needs_ovl_stub): New function, extracted from..
+ (spu_elf_size_stubs): ..here.
+ (spu_elf_relocate_section): Use needs_ovl_stub.
+
+2007-03-22 Joseph Myers <joseph@codesourcery.com>
+
+ * Makefile.am (bfdver.h): Only set VERSION_PACKAGE in bfdver.texi
+ if nonempty.
+ * configure.in (REPORT_BUGS_TO): Do not use "URL:" prefix.
+ * Makefile.in, configure, doc/Makefile.in: Regenerate.
+
+2007-03-22 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/4210
+ * peXXigen.c (_bfd_XXi_swap_aouthdr_out): Use the virtual
+ address and virtual size of the last section for the image
+ size.
+
+2007-03-22 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/4007
+ * elf.c (assign_file_positions_for_load_sections): Check if
+ all sections are in the segment.
+
+2007-03-20 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/4208
+ * elfxx-mips.c (_bfd_mips_elf_relocate_section): Report missing
+ matching LO16 relocation for HI16 relocation.
+
+2007-03-20 Paul Brook <paul@codesourcery.com>
+
+ * bfd-in.h (bfd_elf32_arm_set_target_relocs): Update prototype.
* bfd-in2.h: Regenerate.
+ * elf32-arm.c (elf32_arm_link_hash_table): Add pic_veneer.
+ (record_arm_to_thumb_glue): Use globals->pic_veneer.
+ (elf32_arm_create_thumb_stub): Ditto.
+ (bfd_elf32_arm_set_target_relocs): Set globals->pic_veneer.
-2006-03-02 DJ Delorie <dj@redhat.com>
-
- * elf32-m32c.c (m32c_offset_for_reloc): Fix local symbol
- calculations.
-
-2006-03-02 Richard Sandiford <richard@codesourcery.com>
-
- * elf32-ppc.c (is_ppc_elf_target): Return true if the target is
- bfd_elf32_powerpc_vxworks_vec.
-
-2006-03-02 Nick Clifton <nickc@redhat.com>
-
- * elf32-m32c.c (m32c_elf_relax_section): Initialise 'gap'.
-
-2006-03-02 Richard Sandiford <richard@codesourcery.com>
-
- * elf32-i386.c (elf_i386_create_dynamic_sections): Use
- elf_vxworks_create_dynamic_sections.
- (elf_i386_size_dynamic_sections): Remove VxWorks GOT and PLT
- symbol handling.
- * elf32-ppc.c (ppc_elf_create_dynamic_sections): Use
- elf_vxworks_create_dynamic_sections.
- (ppc_elf_size_dynamic_sections): Remove VxWorks GOT and PLT
- symbol handling.
- * elf-vxworks.c (elf_vxworks_create_dynamic_sections): New function.
- * elf-vxworks.h (elf_vxworks_create_dynamic_sections): Declare.
-
-2006-03-02 Richard Sandiford <richard@codesourcery.com>
-
- * elf32-i386.c (elf_i386_vxworks_link_output_symbol_hook): Delete.
- (elf_backend_link_output_symbol_hook): Use
- elf_vxworks_link_output_symbol_hook instead.
- * elf32-ppc.c (elf_i386_vxworks_link_output_symbol_hook): Delete.
- (elf_backend_link_output_symbol_hook): Use
- elf_vxworks_link_output_symbol_hook instead.
- * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Provide the
- same interface as elf_backend_link_output_symbol_hook.
- * elf-vxworks.h (elf_vxworks_link_output_symbol_hook): Update
- prototype accordingly.
-
-2006-03-02 Richard Sandiford <richard@codesourcery.com>
-
- * elf32-ppc.c (ppc_elf_plt_type): New enumeration.
- (ppc_elf_link_hash_table): Replace old_got and new_got with
- plt_type and can_use_new_plt.
- (ppc_elf_create_dynamic_sections): Add SEC_HAS_CONTENTS,
- SEC_LOAD and SEC_READONLY to the VxWorks .plt flags.
- (ppc_elf_check_relocs): Set can_use_new_plt instead of new_plt.
- Move from plt_type == PLT_UNSET to PLT_OLD instead of setting old_plt.
- (ppc_elf_select_plt_layout): Move from plt_type == PLT_UNSET to
- either plt_type == PLT_OLD or plt_type == PLT_NEW. Assert that
- this function should not be called for VxWorks targets.
- (ppc_elf_tls_setup): Use plt_type instead of old_got.
- (allocate_got): Likewise. Rearrange so that max_before_header
- is only used for PLT_OLD and PLT_NEW.
- (allocate_dynrelocs): Use plt_type instead of old_got and is_vxworks.
- (ppc_elf_size_dynamic_sections): Likewise.
- (ppc_elf_relax_section): Likewise.
- (ppc_elf_relocate_section): Likewise.
- (ppc_elf_finish_dynamic_symbol): Likewise.
- (ppc_elf_vxworks_link_hash_table_create): Initialize plt_type.
-
-2006-02-28 Richard Sandiford <richard@codesourcery.com>
-
- * elf32-i386.c (elf_i386_link_hash_table): Add next_tls_desc_index.
- (elf_i386_link_hash_table_create): Initialize it.
- (elf_i386_compute_jump_table_size): Use it instead of
- srelplt->reloc_count.
- (allocate_dynrelocs): Likewise.
- (elf_i386_size_dynamic_sections): Likewise.
- (elf_i386_relocate_section): Likewise.
-
-2006-02-27 Jakub Jelinek <jakub@redhat.com>
-
- * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Handle S flag.
- (_bfd_elf_write_section_eh_frame): Likewise.
-
-2006-02-27 Carlos O'Donell <carlos@codesourcery.com>
-
- * po/Make-in: Add html target.
-
-2006-02-27 Richard Sandiford <richard@codesourcery.com>
-
- * elf-m10300.c (_bfd_mn10300_elf_finish_dynamic_symbol): Use the
- cached hgot entry to check for _GLOBAL_OFFSET_TABLE_.
- * elf32-arm.c (elf32_arm_finish_dynamic_symbol): Likewise.
- * elf32-bfin.c (bfin_finish_dynamic_symbol): Likewise.
- * elf32-cris.c (elf_cris_finish_dynamic_symbol): Likewise.
- * elf32-hppa.c (elf32_hppa_finish_dynamic_symbol): Likewise.
- * elf32-i386.c (elf_i386_finish_dynamic_symbol): Likewise.
- * elf32-m32r.c (m32r_elf_finish_dynamic_symbol): Likewise.
- * elf32-m68k.c (elf_m68k_finish_dynamic_symbol): Likewise.
- * elf32-sh.c (sh_elf_finish_dynamic_symbol): Likewise.
- * elf32-vax.c (elf_vax_finish_dynamic_symbol): Likewise.
- * elf32-xtensa.c (elf_xtensa_finish_dynamic_symbol): Likewise.
- * elf64-sh64.c (sh64_elf64_finish_dynamic_symbol): Likewise.
- * elf64-x86-64.c (elf64_x86_64_finish_dynamic_symbol): Likewise.
- * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_symbol): Likewise.
- * elf32-s390.c (elf_s390_finish_dynamic_symbol): Likewise. Also use
- the cached hplt entry to check for _PROCEDURE_LINKAGE_TABLE_.
- * elf64-alpha.c (elf64_alpha_finish_dynamic_symbol): Likewise.
- * elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
- * elfxx-ia64.c (elfNN_ia64_finish_dynamic_symbol): Likewise.
- * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Likewise.
-
-2006-02-25 Richard Sandiford <richard@codesourcery.com>
-
- * elf-bfd.h (elf_link_hash_table): Add hplt field.
- * elflink.c (_bfd_elf_create_dynamic_sections): Initialize it.
- * elf-m10300.c (_bfd_mn10300_elf_create_got_section): Likewise.
- * elf32-frv.c (_frv_create_got_section): Likewise.
- * elf32-m32r.c (m32r_elf_create_dynamic_sections): Likewise.
- * elf32-sh.c (sh_elf_create_dynamic_sections): Likewise.
- * elf64-alpha.c (elf64_alpha_create_dynamic_sections): Likewise.
- * elf64-sh64.c (sh64_elf64_create_dynamic_sections): Likewise.
- * elf32-i386.c (elf_i386_link_hash_table): Remove hgot and hplt.
- (elf_i386_link_hash_table_create): Don't initialize them.
- (elf_i386_size_dynamic_sections): Use the generic ELF hplt and
- hgot fields.
- (elf_i386_finish_dynamic_symbol): Likewise.
- * elf32-ppc.c (ppc_elf_link_hash_table): Remove hplt.
- (ppc_elf_size_dynamic_sections): Use the generic ELF hplt fields.
- (ppc_elf_finish_dynamic_symbol): Likewise.
-
-2006-02-24 DJ Delorie <dj@redhat.com>
-
- * elf32-m32c.c (m32c_elf_howto_table): Add relaxation relocs.
- (m32c_elf_relocate_section): Don't relocate them.
- (compare_reloc): New.
- (relax_reloc): Remove.
- (m32c_offset_for_reloc): New.
- (m16c_addr_encodings): New.
- (m16c_jmpaddr_encodings): New.
- (m32c_addr_encodings): New.
- (m32c_elf_relax_section): Relax jumps and address displacements.
- (m32c_elf_relax_delete_bytes): Adjust for internal syms. Fix up
- short jumps.
-
- * reloc.c: Add m32c relax relocs.
- * libbfd.h: Regenerate.
+2007-03-18 Mark Shinwell <shinwell@codesourcery.com>
+
+ * bfd-in.h (bfd_elf32_arm_set_target_relocs): Add "bfd *"
+ argument and extra last argument.
* bfd-in2.h: Regenerate.
-
-2006-02-24 H.J. Lu <hongjiu.lu@intel.com>
+ * elf32-arm.c (elf32_arm_obj_tdata): Add no_enum_size_warning
+ member.
+ (bfd_elf32_arm_set_target_relocs): Add "bfd *" argument and
+ extra last argument. Set no_enum_size_warning appropriately.
+ (elf32_arm_merge_eabi_attributes): Improve enum sizes
+ diagnostic, suppressing it when no_enum_size_warning dictates.
- PR ld/2218
- * elf-bfd.h (elf_backend_data): Add elf_backend_fixup_symbol.
- (_bfd_elf_link_hash_fixup_symbol): New.
+2007-03-20 Nick Clifton <nickc@redhat.com>
- * elflink.c (_bfd_elf_link_hash_fixup_symbol): New.
- (_bfd_elf_fix_symbol_flags): Call elf_backend_fixup_symbol if
- it isn't NULL.
+ PR binutils/3535
+ * elf.c (copy_private_bfd_data): Widen the scope of Solaris
+ specific conditions that need the program headers to be
+ rewritten.
- * elfxx-ia64.c (elf_backend_fixup_symbol): Defined.
+2007-03-19 H.J. Lu <hongjiu.lu@intel.com>
- * elfxx-target.h (elf_backend_fixup_symbol): New.
- (elfNN_bed): Initialize elf_backend_fixup_symbol.
+ * peXXigen.c (_bfd_XXi_swap_aouthdr_in): Store Magic,
+ MajorLinkerVersion, MinorLinkerVersion, SizeOfCode,
+ SizeOfInitializedData, SizeOfUninitializedData,
+ AddressOfEntryPoint, BaseOfCode and BaseOfData in internal
+ extra PE a.out header.
+ (IMAGE_NT_OPTIONAL_HDR_MAGIC): Defined as 0x10b if not defined.
+ (IMAGE_NT_OPTIONAL_HDR64_MAGIC): Defined as 0x20b if not
+ defined.
+ (IMAGE_NT_OPTIONAL_HDRROM_MAGIC): Defined as 0x107 if not
+ defined.
+ (_bfd_XX_print_private_bfd_data_common): Also print Magic,
+ MajorLinkerVersion, MinorLinkerVersion, SizeOfCode,
+ SizeOfInitializedData, SizeOfUninitializedData,
+ AddressOfEntryPoint, BaseOfCode and BaseOfData from internal
+ extra PE a.out header.
-2006-02-23 H.J. Lu <hongjiu.lu@intel.com>
+2007-03-18 H.J. Lu <hongjiu.lu@intel.com>
- * cpu-ia64-opc.c (ins_immu5b): New.
- (ext_immu5b): Likewise.
- (elf64_ia64_operands): Add IMMU5b.
+ * targets.c (_bfd_target_vector): Add bfd_efi_app_x86_64_vec
+ only if BFD64 is defined.
-2006-02-21 Alan Modra <amodra@bigpond.net.au>
+2007-03-17 Alan Modra <amodra@bigpond.net.au>
- PR ld/2218
- * elf32-arm.c (allocate_dynrelocs): Ensure undef weak sym in pie
- is dynamic.
- * elf32-hppa.c (allocate_dynrelocs): Likewise.
- * elf32-i386.c (allocate_dynrelocs): Likewise.
- * elf32-s390.c (allocate_dynrelocs): Likewise.
- * elf32-sh.c (allocate_dynrelocs): Likewise.
- * elf64-s390.c (allocate_dynrelocs): Likewise.
- * elf64-x86-64.c (allocate_dynrelocs): Likewise.
- * elf32-m32r.c (allocate_dynrelocs): Likewise. Discard relocs
- on undef weak with non-default visibility too.
- * elfxx-sparc.c (allocate_dynrelocs): Ditto.
+ * elf32-spu.c (spu_elf_size_stubs): Always use an overlay stub
+ on setjmp calls.
-2006-02-21 Alan Modra <amodra@bigpond.net.au>
+2007-03-15 H.J. Lu <hongjiu.lu@intel.com>
- * bfd.c: (_bfd_default_error_handler): Don't call abort on
- error, instead call _exit.
- (_bfd_abort): Call _exit not xexit.
+ * doc/Makefile.in: Regenerated.
-2006-02-17 Kevin Buettner <kevinb@redhat.com>
+2007-03-15 H.J. Lu <hongjiu.lu@intel.com>
- * elf32-frv.c (elf32_frv_grok_prstatus, elf32_frv_grok_psinfo):
- New functions.
- * elf_backend_grok_prstatus, elf_backend_grok_psinfo): Define.
+ * Makefile.am (bfdver.h): Substitute report_bugs_to. Also
+ create doc/bfdver.texi.
+ * Makefile.in: Regenerated.
-2006-02-17 Shrirang Khisti <shrirangk@kpitcummins.com>
- Anil Paranjape <anilp1@kpitcummins.com>
- Shilin Shakti <shilins@kpitcummins.com>
+ * configure.in (--with-bugurl): New option.
+ * configure: Regenerated.
- * Makefile.am: Add xc16x related entry
- * Makefile.in: Regenerate
- * archures.c: Add bfd_xc16x_arch
- * bfd-in2.h: Regenerate
- * config.bfd: Add xc16x-*-elf
- * configure.in: Add bfd_elf32_xc16x_vec
+ * version.h (REPORT_BUGS_TO): New.
+
+2007-03-13 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/3826
+ * elf-bfd.h (elf_backend_data): Add elf_osabi.
+ (_bfd_elf_set_osabi): New.
+
+ * elf.c (_bfd_elf_set_osabi): New.
+
+ * elf32-hppa.c (elf32_hppa_post_process_headers): Removed.
+ (elf_backend_post_process_headers): Defined with
+ _bfd_elf_set_osabi.
+ (ELF_OSABI): Properly defined for each target.
+
+ * elf32-i370.c (i370_elf_post_process_headers): Removed.
+ (ELF_OSABI): Defined.
+ (elf_backend_post_process_headers): Defined with
+ _bfd_elf_set_osabi.
+
+ * elf32-i386.c (ELF_OSABI): Defined to ELFOSABI_FREEBSD for
+ freebsd.
+ (elf_i386_post_process_headers): Set EI_OSABI with elf_osabi.
+
+ * elf32-msp430.c (elf32_msp430_post_process_headers): Removed.
+ (ELF_OSABI): Defined.
+ (elf_backend_post_process_headers): Defined with
+ _bfd_elf_set_osabi.
+
+ * elf64-alpha.c (ELF_OSABI): Defined to ELFOSABI_FREEBSD for
+ freebsd.
+ (elf64_alpha_fbsd_post_process_headers): Set EI_OSABI with
+ elf_osabi.
+
+ * elf64-hppa.c (elf64_hppa_post_process_headers): Set EI_OSABI
+ with elf_osabi.
+ (ELF_OSABI): Properly defined for each target.
+ (elf_backend_post_process_headers): Defined with
+ _bfd_elf_set_osabi for Linux.
+
+ * elf64-sparc.c (elf64_sparc_fbsd_post_process_headers): Removed.
+ (ELF_OSABI): Defined to ELFOSABI_FREEBSD for freebsd.
+ (elf_backend_post_process_headers): Defined with
+ _bfd_elf_set_osabi.
+
+ * elf64-x86-64.c (elf64_x86_64_fbsd_post_process_headers): Removed.
+ (ELF_OSABI): Defined to ELFOSABI_FREEBSD for freebsd.
+ (elf_backend_post_process_headers): Defined with
+ _bfd_elf_set_osabi.
+
+ * elfcode.h (elf_object_p): Match the ELFOSABI_NONE ELF target
+ with any ELF target of the compatible machine for which we do not
+ have a specific backend.
+
+ * elfxx-ia64.c (elfNN_hpux_post_process_headers): Set EI_OSABI
+ with elf_osabi.
+
+ * elfxx-target.h (ELF_OSABI): Default to ELFOSABI_NONE.
+ (elfNN_bed): Initialize elf_osabi with ELF_OSABI.
+
+2007-03-08 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-v850.c (v850_elf_link_output_symbol_hook): Clean out
+ V850_OTHER_* bits.
+
+2007-03-08 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am (BFD64_BACKENDS): Add efi-app-x86_64.lo.
+ (BFD64_BACKENDS_CFILES): Add efi-app-x86_64.c.
+ Run "make dep-am".
+ * Makefile.in: Regenerate.
+ * po/SRC-POTFILES.in: Regenerate.
+
+2007-03-07 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config.bfd (x86_64-*-freebsd*): Add bfd_efi_app_x86_64_vec.
+ (x86_64-*-kfreebsd*-gnu): Likewise.
+ (x86_64-*-netbsd*): Likewise.
+ (x86_64-*-openbsd*): Likewise.
+ (x86_64-*-linux-*): Likewise.
+
+ * configure.in: Support bfd_efi_app_x86_64_vec.
+ * configure: Regenerated.
+
+ * efi-app-x86_64.c: New file.
+
+ * targets.c (bfd_efi_app_x86_64_vec): New.
+ (_bfd_target_vector): Add bfd_efi_app_x86_64_vec.
+
+2007-03-07 Kai Tietz <kai.tietz@onevision.com>
+
+ * reloc.c (bfd_generic_get_relocated_section_contents): Remove
+ const for type reloc_howto_type.
+
+2007-03-07 Alan Modra <amodra@bigpond.net.au>
+
+ PR 3958
+ * elf-bfd.h (RELOC_FOR_GLOBAL_SYMBOL): No error on relocatable link.
+ (elf_discarded_section): Move..
+ * bfd-in.h: ..to here.
+ * bfd-in2.h: Regenerate.
+ * elflink.c (elf_link_input_bfd): Don't zap relocs against symbols
+ from discarded sections before relocate_section has done its job.
+ * reloc.c (bfd_generic_get_relocated_section_contents): Handle
+ relocs against symbols from discarded sections.
+ * elf-hppa.h (elf_hppa_howto_table): Set size. Set dst_mask on
+ SECREL32.
+ (elf_hppa_relocate_section): Handle relocatable link after setting
+ sec, sym, h etc. for final link. Squash error messages for
+ relocatable link. Clear section contents for relocs against
+ symbols in discarded sections, and zero reloc. Remove existing
+ zero r_symndx code.
+ * elf-m10200.c (mn10200_elf_relocate_section): Likewise.
+ * elf-m10300.c (mn10300_elf_relocate_section): Likewise.
+ * elf32-arm.c (elf32_arm_relocate_section): Likewise.
+ * elf32-avr.c (elf32_avr_relocate_section): Likewise.
+ * elf32-bfin.c (bfinfdpic_relocate_section): Likewise.
+ (bfin_relocate_section): Likewise.
+ * elf32-cr16c.c (elf32_cr16c_relocate_section): Likewise.
+ * elf32-cris.c (cris_elf_relocate_section): Likewise.
+ * elf32-crx.c (elf32_crx_relocate_section): Likewise.
+ * elf32-d10v.c (elf32_d10v_relocate_section): Likewise.
+ * elf32-fr30.c (fr30_elf_relocate_section): Likewise.
+ * elf32-frv.c (elf32_frv_relocate_section): Likewise.
+ * elf32-h8300.c (elf32_h8_relocate_section): Likewise.
+ * elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
+ * elf32-i370.c (i370_elf_relocate_section): Likewise.
+ * elf32-i386.c (elf_i386_relocate_section): Likewise.
+ * elf32-i860.c (elf32_i860_relocate_section): Likewise.
+ * elf32-ip2k.c (ip2k_elf_relocate_section): Likewise.
+ * elf32-iq2000.c (iq2000_elf_relocate_section): Likewise.
+ * elf32-m32c.c (m32c_elf_relocate_section): Likewise.
+ * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
+ * elf32-m68hc1x.c (elf32_m68hc11_check_relocs): Likewise.
+ * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
+ * elf32-mcore.c (mcore_elf_relocate_section): Likewise.
+ * elf32-mep.c (mep_elf_relocate_section): Likewise.
+ * elf32-msp430.c (elf32_msp430_relocate_section): Likewise.
+ * elf32-mt.c (mt_elf_relocate_section): Likewise.
+ * elf32-openrisc.c (openrisc_elf_relocate_section): Likewise.
+ * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
+ * elf32-s390.c (elf_s390_relocate_section): Likewise.
+ * elf32-score.c (_bfd_score_elf_relocate_section): Likewise.
+ * elf32-sh.c (sh_elf_relocate_section): Likewise.
+ * elf32-spu.c (spu_elf_relocate_section): Likewise.
+ * elf32-v850.c (v850_elf_relocate_section): Likewise.
+ * elf32-vax.c (elf_vax_relocate_section): Likewise.
+ * elf32-xc16x.c (elf32_xc16x_relocate_section): Likewise.
+ * elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise.
+ * elf32-xtensa.c (elf_xtensa_relocate_section): Likewise.
+ * elf64-alpha.c (elf64_alpha_relocate_section_r): Likewise.
+ (elf64_alpha_relocate_section): Likewise.
+ * elf64-mmix.c (mmix_elf_relocate_section): Likewise.
+ * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
+ * elf64-s390.c (elf_s390_relocate_section): Likewise.
+ * elf64-sh64.c (sh_elf64_relocate_section): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise.
+ * elfxx-mips.c (_bfd_mips_elf_relocate_section): Likewise.
+ * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise.
+
+ * elf32-arm.c (elf32_arm_relocate_section): Always adjust section
+ symbols for relocatable link. Don't use always-zero st_value.
+ (elf_backend_rela_normal): Don't define.
+ * elf32-bfin.c (bfinfdpic_relocate_section): Use
+ RELOC_FOR_GLOBAL_SYMBOL.
+ * elf32-frv.c (elf32_frv_relocate_section): Likewise.
+ * elf32-d10v.c (elf32_d10v_relocate_section): Combine SEC_MERGE
+ section symbol adjustments with same for relocatable link.
+ * elf32-i386.c (elf_i386_relocate_section): Likewise.
+ * elf32-m68hc1x.c (m68hc11_get_relocation_value): Move..
+ (elf32_m68hc11_check_relocs): ..to here.
+ * elf32-score.c (score_elf_final_link_relocate): Remove zero
+ r_symndx code.
+ * elfxx-mips.c (mips_elf_calculate_relocation): Likewise.
+
+2007-03-07 Alan Modra <amodra@bigpond.net.au>
+
+ PR 4144
+ * elf.c (assign_file_positions_for_load_sections): Don't
+ adjust p_memsz for !SEC_LOAD section vma modulo page size.
+ Instead, use the same lma based adjustment for SEC_LOAD
+ sections.
+
+2007-03-01 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (analyze_relocations): Zero src_count if not relaxing.
+ (find_relaxable_sections): Do not increment src_count for unknown
+ opcodes. Decode only once instead of calling is_l32r_relocation.
+ (compute_text_actions): Remove unused no_insn_move flag. Assert that
+ src_next matches src_count in relax_info.
+
+2007-03-01 Joseph Myers <joseph@codesourcery.com>
+
+ * Makefile.am (bfdver.h): Use "." not " " between version number
+ and date.
+ * Makefile.in: Regenerate.
+ * configure.in (PKGVERSION): Default to "(GNU Binutils) ".
* configure: Regenerate.
- * targets.c: Added xc16x related information
- * cpu-xc16x.c: New file
- * reloc.c: Add new relocations specific to xc16x:
- BFD_RELOC_XC16X_PAG, BFD_RELOC_XC16X_POF, BFD_RELOC_XC16X_SEG,
- BFD_RELOC_XC16X_SOF
- * elf32-xc16x.c: New file.
-
-2006-02-17 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-ppc.c (allocate_dynrelocs): Tweak undef weak handling.
- * elf64-ppc.c (allocate_dynrelocs): Likewise.
-
-2006-02-17 Alan Modra <amodra@bigpond.net.au>
- PR ld/2218
- * elf64-ppc.c (allocate_dynrelocs): Ensure undef weak sym is
- dynamic.
- (ppc64_elf_relocate_section): Check output reloc section size.
- * elf32-ppc.c (allocate_dynrelocs): Simplify undef weak test.
+2007-02-28 Nathan Sidwell <nathan@codesourcery.com>
+
+ * config.bfd (sh-*-uclinux, sh[12]-*-uclinux): New stanza.
+
+2007-02-27 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-spu.h (struct _ovl_stream): Make "start" and "end" const.
+ * elf32-spu.c (ovl_mgr_pread): Add const to casts.
+
+2007-02-23 Carlos O'Donell <carlos@codesourcery.com>
+
+ * dwarf2.c (_bfd_dwarf2_find_nearest_line): Assume 32-bit
+ DWARF even with 64-bit addresses.
+ (_bfd_dwarf2_find_nearest_line): Likewise.
+
+2007-02-23 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/3535
+ * elf.c (copy_private_bfd_data): Always rewrite the program
+ headers when a Solaris interpreter segment is involved.
+
+2007-02-22 Paul Brook <paul@codesourcery.com>
+
+ * elflink.c (gc_mark_hook_fn): Remove.
+ (_bfd_elf_gc_mark): Rename gc_mark_hook_fn to elf_gc_mark_hook_fn.
+ (bfd_elf_gc_sections): Ditto. Call gc_mark_extra_sections.
+ * elf-bfd.h (elf_gc_mark_hook_fn): Define.
+ (elf_backend_data): Add gc_mark_extra_sections.
+ * elfxx-target.h (elf_backend_gc_mark_extra_sections): Provide default
+ definition.
+ (elfNN_bed): Add elf_backend_gc_mark_extra_sections.
+ * elf32-arm.c (elf32_arm_gc_mark_extra_sections): New function.
+ (elf_backend_gc_mark_extra_sections): Define.
+
+2007-02-21 Nick Clifton <nickc@redhat.com>
+
+ * elf.c (_bfd_elf_map_sections_to_segments): If the
+ override_segment_assignment callback is defined then call it.
+
+2007-02-21 Alan Modra <amodra@bigpond.net.au>
-2006-02-16 H.J. Lu <hongjiu.lu@intel.com>
+ * elf32-spu.c (spu_elf_size_stubs): Correct order of warning args.
- PR ld/2322
- * elf.c (get_segment_type): New function.
- (_bfd_elf_print_private_bfd_data): Use it.
- (print_segment_map): New function.
- (assign_file_positions_for_segments): Call print_segment_map
- when there are not enough room for program headers.
+2007-02-19 Thiemo Seufer <ths@mips.com>
-2006-02-16 Nick Hudson <nick.hudson@dsl.pipex.com>
+ * elfxx-mips.c (_bfd_mips_elf_print_private_bfd_data): Remove
+ translation marker from untranslatable strings.
- * config.bfd (mips*el-*-netbsd*, mips*-*-netbsd*): Use
- traditional MIPS ELF targets.
-
-2006-02-15 H.J. Lu <hongjiu.lu@intel.com>
-
- PR binutils/2338
- * dwarf2.c (check_function_name): New function.
- (_bfd_dwarf2_find_nearest_line): Use check_function_name to
- check if function is correct.
-
-2006-02-16 Alan Modra <amodra@bigpond.net.au>
-
- * elflink.c (_bfd_elf_default_action_discarded): Return 0 for
- debug sections.
- (elf_link_input_bfd): Adjust comments.
-
-2006-02-10 H.J. Lu <hongjiu.lu@intel.com>
-
- * elf.c (copy_private_bfd_data): Minor update.
-
-2006-02-10 H.J. Lu <hongjiu.lu@intel.com>
-
- PR binutils/2258
- * elf.c (copy_private_bfd_data): Renamed to ...
- (rewrite_elf_program_header): This.
- (copy_elf_program_header): New function.
- (copy_private_bfd_data): Likewise.
-
-2006-02-07 Nathan Sidwell <nathan@codesourcery.com>
-
- * archures.c (bfd_mach_mcf5200, bfd_mach_mcf5206e,
- bfd_mach_mcf5307, bfd_mach_mcf5407, bfd_mach_mcf528x,
- bfd_mach_mcfv4e, bfd_mach_mcf521x, bfd_mach_mcf5249,
- bfd_mach_mcf547x, bfd_mach_mcf548x): Remove.
- (bfd_mach_mcf_isa_a, bfd_mach_mcf_isa_a_div,
- bfd_mach_mcf_isa_a_div_mac, bfd_mach_mcf_isa_a_div_emac,
- bfd_mach_mcf_isa_aplus, bfd_mach_mcf_isa_aplus_mac,
- bfd_mach_mcf_isa_aplus_emac, bfd_mach_mcf_isa_aplus_usp,
- bfd_mach_mcf_isa_aplus_usp_mac, bfd_mach_mcf_isa_aplus_usp_emac,
- bfd_mach_mcf_isa_b, bfd_mach_mcf_isa_b_mac, bfd_mach_mcf_isa_b_emac,
- bfd_mach_mcf_isa_b_usp_float, bfd_mach_mcf_isa_b_usp_float_mac,
- bfd_mach_mcf_isa_b_usp_float_emac): New.
- (bfd_default_scan): Update coldfire mapping.
- * bfd-in.h (bfd_m68k_mach_to_features,
- bfd_m68k_features_to_mach): Declare.
- * bfd-in2.h: Rebuilt.
- * cpu-m68k.c (arch_info_struct): Add new coldfire machines,
- adjust legacy names.
- (m68k_arch_features): New.
- (bfd_m68k_mach_to_features,
- bfd_m68k_features_to_mach): Define.
- * elf32-m68k.c (elf32_m68k_object_p): New.
- (elf32_m68k_merge_private_bfd_data): Merge the CF EF flags.
- (elf32_m68k_print_private_bfd_data): Print the CF EF flags.
- (elf_backend_object_p): Define.
- * ieee.c (ieee_write_processor): Update coldfire machines.
- * libbfd.h: Rebuilt.
-
-2006-02-06 Steve Ellcey <sje@cup.hp.com>
-
- * elfxx-ia64.c (elfNN_ia64_fake_sections): Set SHF_IA_64_HP_TLS
- if SHF_TLS is set.
-
-2006-02-05 Arnold Metselaar <arnold.metselaar@planet.nl>
-
- * coff-z80.c (r_imm24): New howto.
- (rtype2howto): New case R_IMM24.
- (coff_z80_reloc_type_lookup): New case BFD_RELOC_24.
- (extra_case): Use bfd_get_8 for R_IMM8, new case R_IMM24.
-
-2006-02-04 Richard Sandiford <richard@codesourcery.com>
-
- * elfxx-mips.c (mips_elf_initialize_tls_index): If a TLS symbol
- has already been assigned a GOT index, copy that index to the
- current hash table entry.
-
-2006-02-01 Eric Botcazou <ebotcazou@libertysurf.fr>
-
- * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Reinstate bypass
- for call-to-undefweak reloc overflow.
-
-2006-01-31 Eric Botcazou <ebotcazou@libertysurf.fr>
-
- * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Reinstate bypass
- for 32-bit relocs overflow.
-
-2006-01-27 Paul Brook <paul@codesourcery.com>
-
- * elf32-arm.c (elf32_arm_get_symbol_type): Allow STT_TLS thumb
- objects.
-
-2006-01-18 Alexandre Oliva <aoliva@redhat.com>
-
- Introduce TLS descriptors for i386 and x86_64.
- * reloc.c (BFD_RELOC_386_TLS_GOTDESC, BFD_RELOC_386_TLS_DESC,
- BFD_RELOC_386_TLS_DESC_CALL, BFD_RELOC_X86_64_GOTPC32_TLSDESC,
- BFD_RELOC_X86_64_TLSDESC, BFD_RELOC_X86_64_TLSDESC_CALL): New.
- * libbfd.h, bfd-in2.h: Rebuilt.
- * elf32-i386.c (elf_howto_table): New relocations.
- (R_386_tls): Adjust.
- (elf_i386_reloc_type_lookup): Map new relocations.
- (GOT_TLS_GDESC, GOT_TLS_GD_BOTH_P): New macros.
- (GOT_TLS_GD_P, GOT_TLS_GDESC_P, GOT_TLS_GD_ANY_P): New macros.
- (struct elf_i386_link_hash_entry): Add tlsdesc_got field.
- (struct elf_i386_obj_tdata): Add local_tlsdesc_gotent field.
- (elf_i386_local_tlsdesc_gotent): New macro.
- (struct elf_i386_link_hash_table): Add sgotplt_jump_table_size.
- (elf_i386_compute_jump_table_size): New macro.
- (link_hash_newfunc): Initialize tlsdesc_got.
- (elf_i386_link_hash_table_create): Set sgotplt_jump_table_size.
- (elf_i386_tls_transition): Handle R_386_TLS_GOTDESC and
- R_386_TLS_DESC_CALL.
- (elf_i386_check_relocs): Likewise. Allocate space for
- local_tlsdesc_gotent.
- (elf_i386_gc_sweep_hook): Handle R_386_TLS_GOTDESC and
- R_386_TLS_DESC_CALL.
- (allocate_dynrelocs): Count function PLT relocations. Reserve
- space for TLS descriptors and relocations.
- (elf_i386_size_dynamic_sections): Reserve space for TLS
- descriptors and relocations. Set up sgotplt_jump_table_size.
- Don't zero reloc_count in srelplt.
- (elf_i386_always_size_sections): New. Set up _TLS_MODULE_BASE_.
- (elf_i386_relocate_section): Handle R_386_TLS_GOTDESC and
- R_386_TLS_DESC_CALL.
- (elf_i386_finish_dynamic_symbol): Use GOT_TLS_GD_ANY_P.
- (elf_backend_always_size_sections): Define.
- * elf64-x86-64.c (x86_64_elf_howto): Add R_X86_64_GOTPC32_TLSDESC,
- R_X86_64_TLSDESC, R_X86_64_TLSDESC_CALL.
- (R_X86_64_standard): Adjust.
- (x86_64_reloc_map): Map new relocs.
- (elf64_x86_64_rtype_to_howto): New, split out of...
- (elf64_x86_64_info_to_howto): ... this function, and...
- (elf64_x86_64_reloc_type_lookup): ... use it to map elf_reloc_val.
- (GOT_TLS_GDESC, GOT_TLS_GD_BOTH_P): New macros.
- (GOT_TLS_GD_P, GOT_TLS_GDESC_P, GOT_TLS_GD_ANY_P): New macros.
- (struct elf64_x86_64_link_hash_entry): Add tlsdesc_got field.
- (struct elf64_x86_64_obj_tdata): Add local_tlsdesc_gotent field.
- (elf64_x86_64_local_tlsdesc_gotent): New macro.
- (struct elf64_x86_64_link_hash_table): Add tlsdesc_plt,
- tlsdesc_got and sgotplt_jump_table_size fields.
- (elf64_x86_64_compute_jump_table_size): New macro.
- (link_hash_newfunc): Initialize tlsdesc_got.
- (elf64_x86_64_link_hash_table_create): Initialize new fields.
- (elf64_x86_64_tls_transition): Handle R_X86_64_GOTPC32_TLSDESC and
- R_X86_64_TLSDESC_CALL.
- (elf64_x86_64_check_relocs): Likewise. Allocate space for
- local_tlsdesc_gotent.
- (elf64_x86_64_gc_sweep_hook): Handle R_X86_64_GOTPC32_TLSDESC and
- R_X86_64_TLSDESC_CALL.
- (allocate_dynrelocs): Count function PLT relocations. Reserve
- space for TLS descriptors and relocations.
- (elf64_x86_64_size_dynamic_sections): Reserve space for TLS
- descriptors and relocations. Set up sgotplt_jump_table_size,
- tlsdesc_plt and tlsdesc_got. Make room for them. Don't zero
- reloc_count in srelplt. Add dynamic entries for DT_TLSDESC_PLT
- and DT_TLSDESC_GOT.
- (elf64_x86_64_always_size_sections): New. Set up
- _TLS_MODULE_BASE_.
- (elf64_x86_64_relocate_section): Handle R_386_TLS_GOTDESC and
- R_386_TLS_DESC_CALL.
- (elf64_x86_64_finish_dynamic_symbol): Use GOT_TLS_GD_ANY_P.
- (elf64_x86_64_finish_dynamic_sections): Set DT_TLSDESC_PLT and
- DT_TLSDESC_GOT. Set up TLS descriptor lazy resolver PLT entry.
- (elf_backend_always_size_sections): Define.
-
-2006-01-17 H.J. Lu <hongjiu.lu@intel.com>
-
- PR binutils/2096
- * dwarf2.c (comp_unit_contains_address): Update comment.
- (_bfd_dwarf2_find_nearest_line): Use section's vma, instead of
- lma. Return TRUE only if both comp_unit_contains_address and
- comp_unit_find_nearest_line return TRUE.
- (_bfd_dwarf2_find_line): Use section's vma, instead of lma.
-
-2006-01-18 Alan Modra <amodra@bigpond.net.au>
-
- * elf-bfd.h (struct elf_backend_data): Add gc_mark_dynamic_ref.
- (bfd_elf_gc_mark_dynamic_ref_symbol): Declare.
- * elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Rename from
- elf_gc_mark_dynamic_ref_symbol. Make global.
- (bfd_elf_gc_sections): Call bed->gc_mark_dynamic_ref.
- * elfxx-target.h (elf_backend_gc_mark_dynamic_ref): Define.
+2007-02-19 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct elf_backend_data): Add default_execstack.
+ * elflink.c (bfd_elf_size_dynamic_sections): Heed default_execstack.
+ * elfxx-target.h (elf_backend_default_execstack): Define to 1.
(elfNN_bed): Init new field.
- * elf64-ppc.c (elf_backend_gc_mark_dynamic_ref): Define.
- (ppc64_elf_gc_mark_dynamic_ref): New function.
+ * elf64-ppc.c (elf_backend_default_execstack): Define to 0.
+
+2007-02-17 Mark Mitchell <mark@codesourcery.com>
+ Nathan Sidwell <nathan@codesourcery.com>
+ Vladimir Prus <vladimir@codesourcery.com
+ Joseph Myers <joseph@codesourcery.com>
+
+ * configure.in (--with-pkgversion): New option.
+ * configure: Regenerate.
+ * Makefile.am (bfdver.h): Substitute for @bfd_version_package@.
+ * Makefile.in: Regenerate.
+ * version.h (BFD_VERSION_STRING): Define using
+ @bfd_version_package@.
+
+2007-02-16 Carlos O'Donell <carlos@codesourcery.com>
+
+ * elfxx-mips.c (_bfd_mips_elf_print_private_bfd_data):
+ Print EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_XGOT
+ and EF_MIPS_UCODE.
+
+2007-02-15 Alan Modra <amodra@bigpond.net.au>
+
+ * libbfd-in.h (_bfd_norelocs_get_reloc_upper_bound): Don't define,
+ declare.
+ (_bfd_norelocs_canonicalize_reloc): Likewise.
+ * libbfd.h: Regenerate.
+ * libbfd.c (_bfd_norelocs_get_reloc_upper_bound): New function.
+ (_bfd_norelocs_canonicalize_reloc): Likewise.
+ * binary.c (binary_bfd_reloc_type_lookup): Don't define.
+ (binary_get_reloc_upper_bound, binary_canonicalize_reloc): Likewise.
+ (binary_vec): Use _bfd_norelocs in BFD_JUMP_TABLE_RELOCS.
+ * ihex.c: Similarly.
+ * mach-o-target.c: Similarly.
+ * mach-o.c: Similarly.
+ * mmo.c: Similarly.
+ * pef.c: Similarly.
+ * ppcboot.c: Similarly.
+ * srec.c: Similarly.
+ * xsym.c: Similarly.
+
+2007-02-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/3953
+ * elflink.c (_bfd_elf_add_default_symbol): Check warning symbol
+ when adding default symbol.
+
+2007-02-13 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (create_linkage_sections): Use section ".branch_lt"
+ for branch lookup table.
+
+2007-02-12 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (create_linkage_sections): Don't create
+ .rela.rodata.brlt for --emit-relocs.
+ (ppc_build_one_stub): Create relocs for brlt --emit-relocs here.
+ (ppc_size_one_stub): Count them. Simplify test of stub type
+ when counting stub relocs. Set SEC_RELOC too.
+ (ppc64_elf_size_stubs): Clear reloc_count and SEC_RELOC.
+ (ppc64_elf_finish_dynamic_sections): Output brlt relocs.
+
+2007-02-12 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.c (evaluate_complex_relocation_symbols): Ignore relocs
+ with a zero symbol index.
+
+2007-02-12 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.c (bfd_elf_discard_info): Tidy setting of "eh".
+
+2007-02-05 Dave Brolley <brolley@redhat.com>
+ Stan Cox <scox@redhat.com>
+
+ PR ld/3972
+ * elflink.c (elf_link_input_bfd): Always setup finfo->internal_syms.
+
+2007-02-05 Dave Brolley <brolley@redhat.com>
+ Richard Sandiford <rsandifo@redhat.com>
+ Stan Cox <scox@redhat.com>
+ Nick Clifton <nickc@redhat.com>
+ DJ Delorie <dj@redhat.com>
+ Frank Ch. Eigler <fche@redhat.com>
+ Ben Elliston <bje@redhat.com>
+ Richard Henderson <rth@redhat.com>
+
+ * Makefile.am (ALL_MACHINES): Add cpu-mep.lo.
+ (ALL_MACHINES_CFILES): Add CPU_MEP.c.
+ (BFD32_BACKENDS): Add elf32-mep.lo.
+ (BFD32_BACKENDS_CFILES): Add elf32-mep.c.
+ (cpu-mep.lo,elf32-mep.lo): New targets.
+ * archures.c (bfd_arch_mep): New enumerator.
+ (bfd_mach_mep, bfd_mach_mep_h1): New macros.
+ (bfd_mep_arch): New external variable.
+ (bfd_archures_list): Add bfd_mep_arch.
+ * config.bfd: Support mep-*-elf.
+ * configure.in: Support bfd_elf32_mep_vec and bfd_elf32_mep_little_vec.
+ * reloc.c (BFD_RELOC_MEP_*): New relocation numbers.
+ * targets.c (bfd_elf32_mep_vec,bfd_elf32_mep_little_vec): New extern
+ declarations.
+ (_bfd_target_vector): Add bfd_elf32_mep_vec and
+ bfd_elf32_mep_little_vec.
+ * mep-relocs.pl: New file.
+ * cpu-mep.c: New file.
+ * elf32-mep.c: New file.
+ * bfd-in2.h: Regenerate.
+ * po/POTFILES.in: Regenerate.
+ * libbfd.h: Regenerate.
+ * Makefile.in: Regenerate.
+ * configure: Regenerate.
-2006-01-17 Alan Modra <amodra@bigpond.net.au>
+2007-02-05 Dave Brolley <brolley@redhat.com>
+
+ * elflink.c (evaluate_complex_relocation_symbols): Check for
+ STT_SRELC for global symbols.
+ (perform_complex_relocations): Renamed to
+ perform_complex_relocation and now examines only one relocation.
+ (elf_link_input_bfd): Don't call perform_complex_relocations.
+ * elf-bfd.h (bfd_elf_perform_complex_relocation_: New prototype.
+ * elf32-mep.c (mep_elf_howto_table): Add R_RELC.
+ (OD,OS,OU): #undefs corrected to N, S and U repectively.
+ (mep_reloc_type_lookup): Handle BFD_RELOC_RELC.
+ (complex_reloc_installation_howto): Removed.
+ (mep_info_to_howto_rela): Remove special case for r_type==0xff.
+ (mep_elf_relocate_section): Call bfd_elf_perform_complex_relocation.
+
+2007-02-05 Dave Brolley <brolley@redhat.com>
+ Richard Sandiford <rsandifo@redhat.com>
+ DJ Delorie <dj@redhat.com>
+ Graydon Hoare <graydon@redhat.com>
+ Nick Clifton <nickc@cambridge.redhat.com>
+ Jeff Holcomb <jeffh@redhat.com>
+ Frank Ch. Eigler <fche@redhat.com>
+
+ * elf-bfd.h (bfd_elf_perform_complex_relocations): New prototype.
+ * elf.c (swap_out_syms): Handle BSF_RELC and BSF_SRELC.
+ * elfcode.h (elf_slurp_symbol_table): Handle STT_RELC and STT_SRELC.
+ * elflink.c (set_symbolValue): New static function.
+ (resolve_symbol): Likewise.
+ (resolve_section): Likewise.
+ (undefined_reference): Likewise.
+ (eval_symbol): Likewise.
+ (evaluate_complex_relocation_symbols): Likewise.
+ (put_value): Likewise.
+ (get_value): Likewise.
+ (decode_complex_addend):
+ (bfd_elf_perform_complex_relocation): New function.
+ (elf_link_input_bfd): Call evaluate_complex_relocation_symbols.
+ * reloc.c (BFD_RELOC_RELC): New relocation number.
+ * syms.c (BSF_RELC,BSF_SRELC): New macros.
+
+2007-02-05 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (elf_xtensa_make_sym_local): Delete.
+ (elf_xtensa_hide_symbol, elf_backend_hide_symbol): Delete.
+ (elf_xtensa_fix_refcounts, elf_xtensa_allocate_plt_size)
+ (elf_xtensa_allocate_got_size): Replace these with...
+ (elf_xtensa_allocate_dynrelocs): ...this new function.
+ (elf_xtensa_size_dynamic_sections): Use it.
+
+2007-02-05 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (elf_howto_table) <R_XTENSA_GLOB_DAT>
+ <R_XTENSA_JMP_SLOT, R_XTENSA_RELATIVE, R_XTENSA_PLT, R_XTENSA_DIFF32>:
+ Set src_mask to zero.
+ <R_XTENSA_DIFF8, R_XTENSA_DIFF16>: Likewise. Also fix dst_mask.
+ <R_XTENSA_ASM_EXPAND>: Set pcrel_offset to TRUE.
+
+2007-02-02 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (xtensa_elf_dynamic_symbol_p): Renamed to...
+ (elf_xtensa_dynamic_symbol_p): ...this.
+
+2007-02-02 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (plt_reloc_count): Move into link hash table.
+ (struct elf_xtensa_link_hash_table): New.
+ (elf_xtensa_hash_table): New.
+ (elf_xtensa_link_hash_table_create): New.
+ (elf_xtensa_check_relocs): Update plt_reloc_count references.
+ Update arguments to add_extra_plt_sections.
+ (elf_xtensa_create_dynamic_sections): Record new sections in the hash
+ table. Update for plt_reloc_count and add_extra_plt_sections.
+ (add_extra_plt_sections, elf_xtensa_create_plt_entry): Replace dynobj
+ argument with link info. Update calls to elf_xtensa_get_plt_section
+ and elf_xtensa_get_gotplt_section.
+ (elf_xtensa_allocate_local_got_size, elf_xtensa_size_dynamic_sections)
+ (elf_xtensa_relocate_section, elf_xtensa_finish_dynamic_sections)
+ (elf_xtensa_discard_info_for_section, shrink_dynamic_reloc_sections)
+ (relax_property_section): Get sections from the hash table and update
+ function calls.
+ (elf_xtensa_get_plt_section, elf_xtensa_get_gotplt_section): Replace
+ dynobj argument with link info. Get sections for first plt chunk from
+ the hash table.
+ (bfd_elf32_bfd_link_hash_table_create): Define.
+
+2007-02-02 Jakub Jelinek <jakub@redhat.com>
+
+ * elf-bfd.h (struct elf_obj_tdata): Change symbuf type to void *.
+ * elf.c (struct elf_symbuf_symbol, struct elf_symbuf_head): New types.
+ (struct elf_symbol): Change first member into union.
+ (elf_sort_elf_symbol): Compare pointers to internal syms rather than
+ internal syms. Only compare st_shndx fields.
+ (elf_create_symbuf): New function.
+ (bfd_elf_match_symbols_in_sections): Use it. If symbufs are available
+ for bfds, use a binary search, otherwise don't qsort symbols
+ unnecessarily only to select which symbols are for the particular
+ shndx.
+
+2007-02-01 Nick Clifton <nickc@redhat.com>
+
+ PR ld/3852
+ * elf.c (_bfd_elf_link_hash_table_init): Initialize all the fields
+ in the elf_link_hash_table structure.
+
+2007-02-01 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct elf_backend_data): Add elf_backend_write_core_note.
+ * elfxx-target.h (elf_backend_write_core_note): Define and use.
+ * elf.c (elfcore_write_prpsinfo): Call the above. Add support for
+ 32-bit core note on 64-bit target.
+ (elfcore_write_prstatus): Likewise.
+ (elfcore_write_lwpstatus): Make note_name const.
+ (elfcore_write_prfpreg): Likewise.
+ (elfcore_write_pstatus): Add support for 32-bit core note on 64-bit
+ target.
+ * elf32-ppc.c (ppc_elf_write_core_note): New function.
+ (elf_backend_write_core_note): Define.
+ * elf64-ppc.c (ppc64_elf_write_core_note): New function.
+ (elf_backend_write_core_note): Define.
+
+2007-01-31 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf32-cris.c (INCLUDED_TARGET_FILE): Removed.
+ (elf32_bed): Defined for elf32-us-cris.
+
+ * elf64-sh64.c (elf64_bed): Defined for Linux.
+ (INCLUDED_TARGET_FILE): Removed.
+
+ * elfxx-target.h (elfNN_bed): Always define. Don't check
+ INCLUDED_TARGET_FILE.
+
+2007-01-31 DJ Delorie <dj@redhat.com>
+
+ * elf-m10300.c (mn10300_elf_relocate_section): Clarify the warning
+ message for dangerous relocs, special case the common user error.
+
+2007-01-30 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf.c (copy_elf_program_header): Start from the first section
+ in a segment and stop when all sections in a segment are
+ accounted for.
+
+2007-01-29 Julian Brown <julian@codesourcery.com>
- * elf64-ppc.c (ppc64_elf_gc_mark_hook): Don't hang forever in loop.
+ * bfd-in2.h: Regenerate.
+ * bfd-in.h (bfd_arm_vfp11_fix): New enum. Specify how VFP11
+ instruction scanning should be done.
+ (bfd_elf32_arm_init_maps, bfd_elf32_arm_vfp11_erratum_scan)
+ (bfd_elf32_arm_vfp11_fix_veneer_locations): Add prototypes.
+ (bfd_elf32_arm_set_target_relocs): Add vfp11 fix type argument to
+ prototype.
+ * elf-bfd.h (elf_backend_write_section): Add struct bfd_link_info
+ argument.
+ * elf32-arm.c (VFP11_ERRATUM_VENEER_SECTION_NAME)
+ (VFP11_ERRATUM_VENEER_ENTRY_NAME): Define macros.
+ (elf32_vfp11_erratum_type): New enum.
+ (elf32_vfp11_erratum_list): New struct. List of veneers or jumps to
+ veneers.
+ (_arm_elf_section_data): Add mapsize, erratumcount, erratumlist.
+ (elf32_arm_link_hash_table): Add vfp11_erratum_glue_size,
+ vfp11_fix and num_vfp11_fixes fields.
+ (elf32_arm_link_hash_table_create): Initialise vfp11_fix,
+ vfp11_erratum_glue_size, num_vfp11_fixes fields.
+ (VFP11_ERRATUM_VENEER_SIZE): Define. Size of an (ARM) veneer.
+ (bfd_elf32_arm_allocate_interworking_sections): Initialise erratum
+ glue section.
+ (elf32_arm_section_map_add): Add an code/data mapping symbol entry
+ to a section's map.
+ (record_vfp11_erratum_veneer): Create a single veneer, and its
+ associated symbols.
+ (bfd_elf32_arm_add_glue_sections_to_bfd): Add vfp11 erratum glue.
+ (bfd_elf32_arm_init_maps): Initialise mapping symbol table for input
+ BFDs.
+ (bfd_elf32_arm_set_vfp11_fix): Set the type of erratum workaround
+ required.
+ (bfd_arm_vfp11_pipe): Define VFP11 instruction pipes.
+ (bfd_arm_vfp11_regno): Recode a register number from a VFP11 insn.
+ (bfd_arm_vfp11_write_mask): Update write mask according to coded
+ register number.
+ (bfd_arm_vfp11_antidependency): New function.
+ (bfd_arm_vfp11_insn_decode): Decode a VFP11 insn.
+ (elf32_arm_compare_mapping): Declare.
+ (bfd_elf32_arm_vfp11_erratum_scan): Scan the sections of an input
+ BFD for potential erratum-triggering insns. Record results.
+ (bfd_elf32_arm_vfp11_fix_veneer_locations): Find out where veneers
+ and branches to veneers have been placed in virtual memory after
+ layout.
+ (bfd_elf32_arm_set_target_relocs): Set vfp11_fix field in global
+ hash table.
+ (elf32_arm_output_symbol_hook): Remove.
+ (elf32_arm_write_section): Output veneers, and branches to veneers.
+ Use maps from input sections, not output sections, for code
+ byte-swapping.
+ * elf32-ppc.c (ppc_elf_write_section): Add dummy link_info argument.
+ * elf32-score.c (_bfd_score_elf_write_section): Likewise.
+ * elfxx-mips.c (_bfd_mips_elf_write_section): Likewise.
+ * elfxx-mips.h (_bfd_mips_elf_write_section): Likewise.
+
+2007-01-27 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf64-hppa.c (elf64_bed): Defined for HPUX and Linux.
+ (INCLUDED_TARGET_FILE): Removed.
+
+2007-01-27 Mike Frysinger <vapier@gentoo.org>
+
+ * elf32-hppa.c (elf32_bed): Define for hpux, linux and netbsd.
+ (INCLUDED_TARGET_FILE): Remove.
+
+2007-01-25 DJ Delorie <dj@redhat.com>
+
+ * elf32-m32c.c (m32c_elf_howto_table): Don't complain about
+ R_M32C_16 or R_M32C_24 relocs.
+
+2007-01-25 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/3874
+ * elf32-avr.c (avr_link_hash_table): Check to make sure that the
+ hash table was created by elf32_avr_link_hash_table_create before
+ using it.
+ (elf32_avr_link_hash_newfunc): New function. Just pass the call
+ through to _bfd_elf_link_hash_newfunc.
+ (elf32_avr_link_hash_table_create): Use
+ elf32_avr_link_hash_newfunc instead of
+ _bfd_elf_link_hash_newfunc.
+ (elf32_avr_relocate_section): Check for the hash table pointer
+ being NULL.
+ (elf32_avr_relax_section, avr_build_one_stub,
+ elf32_avr_setup_params, get_local_syms, elf32_avr_size_stubs,
+ elf32_avr_build_stubs): Likewise.
+
+2007-01-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/3831
+ * elf-bfd.h (bfd_elf_link_mark_dynamic_symbol): Add an
+ argument, Elf_Internal_Sym *.
+
+ * elflink.c (bfd_elf_link_mark_dynamic_symbol): Mark a data
+ symbol dynamic if info->dynamic_data is TRUE.
+ (bfd_elf_record_link_assignment): Updated call to
+ bfd_elf_record_link_assignment.
+ (_bfd_elf_merge_symbol): Likewise. Always call
+ bfd_elf_link_mark_dynamic_symbol.
+
+2007-01-12 H.J. Lu <hongjiu.lu@intel.com>
+
+ * Makefile.am (BFD_LIBS): Removed.
+ * Makefile.in: Regenerated.
+
+2007-01-11 H.J. Lu <hongjiu.lu@intel.com>
-2006-01-17 Nick Clifton <nickc@redhat.com>
+ PR binutils/3631
+ * Makefile.am (OFILES): Add @bfd64_libs@.
+ (libbfd_la_SOURCES): Remove $(BFD64_LIBS_CFILES).
+ * Makefile.in: Regenerated.
- PR binutils/2159
- * elf.c (elfcore_write_pstatus): Add ATTRIBUTE_UNUSED to unused
- parameters.
+ * configure.in (bfd_libs): Replaced by ...
+ (bfd64_libs): This.
+ * configure: Regenerated.
+
+2007-01-11 Nathan Sidwell <nathan@codesourcery.com>
+
+ * elf.c (assign_file_positions_for_load_sections): We can
+ require fewer phdrs than expected.
+
+2007-01-08 Kazu Hirata <kazu@codesourcery.com>
+
+ * archures.c (bfd_mach_cpu32_fido): Rename to bfd_mach_fido.
+ * bfd-in2.h: Regenerate.
+ * cpu-m68k.c (arch_info_struct): Use bfd_mach_fido instead of
+ bfd_mach_cpu32_fido.
+ (m68k_arch_features): Use fido_a instead of cpu32.
+ (bfd_m68k_compatible): Reject the combination of Fido and
+ ColdFire. Accept the combination of CPU32 and Fido with a
+ warning.
+ * elf32-m68k.c (elf32_m68k_object_p,
+ elf32_m68k_merge_private_bfd_data,
+ elf32_m68k_print_private_bfd_data): Treat Fido as an
+ architecture by itself.
-2006-01-11 Nick Clifton <nickc@redhat.com>
+2007-01-08 Kai Tietz <kai.tietz@onevision.com>
- * elf32-arm.c (elf32_arm_output_symbol_hook): Install new entry
- into the newly (re)allocated map array.
+ * config.bfd: Renamed target x86_64-*-mingw64 to x86_64-*-mingw*.
-2006-01-09 Alexis Wilke <alexis_wilke@yahoo.com>
+2007-01-05 Jakub Jelinek <jakub@redhat.com>
- * peXXigen.c (tbl): Add comma after "HIGH3ADJ".
+ * texhex.c (first_phase): Don't fall through into the default
+ case.
+ (pass_over): Replace abort () calls with return FALSE. Fix
+ buffer overflow.
-2006-01-01 Jakub Jelinek <jakub@redhat.com>
+2007-01-04 Jie Zhang <jie.zhang@analog.com>
- * elf64-ppc.c (ppc64_elf_action_discarded): Return 0
- for .toc1 section.
+ * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Don't set
+ SEC_EXCLUDE on zero size .eh_frame.
-For older changes see ChangeLog-2005
+For older changes see ChangeLog-2006
Local Variables:
mode: change-log
diff --git a/bfd/ChangeLog-0203 b/bfd/ChangeLog-0203
index f99029a87ae2..1b1abb149da3 100644
--- a/bfd/ChangeLog-0203
+++ b/bfd/ChangeLog-0203
@@ -858,7 +858,7 @@
Bernardo Innocenti <bernie@develer.com>
* archures.c: Add MCF528x (MCFv4) support.
- * bfd/cpu-m68k.c (arch_info_struct): Likewise.
+ * cpu-m68k.c (arch_info_struct): Likewise.
* bfd-in2.h: Regenerate.
2003-10-20 Andrew Cagney <cagney@redhat.com>
@@ -1953,10 +1953,10 @@
2003-07-12 Jeff Baker <jbaker@qnx.com>
- * bfd/config.bfd (__QNXTARGET__): Define for Neutrino architectures.
- * bfd/elf32-arm.h (ELF_MAXPAGESIZE): Set to 4k for Neutrino.
- * bfd/elf32-sh.c (ELF_MAXPAGESIZE): Set to 4k for Neutrino.
- * bfd/elf32-ppc.c (ELF_MAXPAGESIZE): Set to 4k for Neutrino.
+ * config.bfd (__QNXTARGET__): Define for Neutrino architectures.
+ * elf32-arm.h (ELF_MAXPAGESIZE): Set to 4k for Neutrino.
+ * elf32-sh.c (ELF_MAXPAGESIZE): Set to 4k for Neutrino.
+ * elf32-ppc.c (ELF_MAXPAGESIZE): Set to 4k for Neutrino.
2003-07-12 Jeff Muizelaar <muizelaar@rogers.com>
@@ -2196,13 +2196,13 @@
2003-07-09 Richard Sandiford <rsandifo@redhat.com>
- * bfd/elfxx-mips.c (mips_elf_create_dynamic_relocation): Treat
+ * elfxx-mips.c (mips_elf_create_dynamic_relocation): Treat
forced-local symbols like other locals. Don't create relocations
against STN_UNDEF in irix objects.
2003-07-09 Richard Sandiford <rsandifo@redhat.com>
- * bfd/elfxx-mips.c (mips_elf_create_dynamic_relocation): In SGI-
+ * elfxx-mips.c (mips_elf_create_dynamic_relocation): In SGI-
compatible objects, add the values of defined external symbols
to the addend.
diff --git a/bfd/ChangeLog-2004 b/bfd/ChangeLog-2004
index fa2f1adf3164..0c4709616463 100644
--- a/bfd/ChangeLog-2004
+++ b/bfd/ChangeLog-2004
@@ -283,7 +283,7 @@
2004-11-13 Paul Brook <paul@codesourcery.com>
- * bfd/elf32-arm.c (elf32_arm_final_link_relocate): Resolve
+ * elf32-arm.c (elf32_arm_final_link_relocate): Resolve
R_ARM_PREL31 relocations to PLT entries.
(elf32_arm_relocate_section, elf32_arm_gc_sweep_hook): Ditto.
(elf32_arm_check_relocs): Ditto.
@@ -1248,7 +1248,7 @@
* bfd-in.h (bfd_elf32_arm_set_target_relocs): Add prototype.
(bfd_elf32_arm_process_before_allocation): Update prototype.
* bfd-in2.h: Regenerate.
- * bfd/elf32-arm.h (elf32_arm_link_hash_table): Add target2_reloc.
+ * elf32-arm.h (elf32_arm_link_hash_table): Add target2_reloc.
(elf32_arm_link_hash_table_create): Set it.
(bfd_elf32_arm_process_before_allocation): Remove target1_is_rel.
(bfd_elf32_arm_set_target_relocs): New function.
@@ -3017,7 +3017,7 @@
2004-06-07 Daniel Jacobowitz <dan@debian.org>
From: Albert Chin-A-Young <china@thewrittenword.com>
- * bfd/elf-bfd.h (struct eh_cie_fde): Convert unsigned char bitfields
+ * elf-bfd.h (struct eh_cie_fde): Convert unsigned char bitfields
to unsigned int.
2004-05-29 H.J. Lu <hongjiu.lu@intel.com>
diff --git a/bfd/ChangeLog-2005 b/bfd/ChangeLog-2005
index f23727863556..95746fc1c2df 100644
--- a/bfd/ChangeLog-2005
+++ b/bfd/ChangeLog-2005
@@ -1899,7 +1899,7 @@
2005-06-27 Carlos O'Donell <carlos@systemhalted.org>
- * bfd/elf32-hppa.c (struct elf32_hppa_stub_hash_entry):
+ * elf32-hppa.c (struct elf32_hppa_stub_hash_entry):
Use bh_root, and hh.
(struct elf32_hppa_link_hash_entry): Use eh, and hsh_cache.
(struct elf32_hppa_dyn_reloc_entry): Use hdh_next.
@@ -1936,7 +1936,7 @@
2005-06-21 Carlos O'Donell <carlos@systemhalted.org>
- * bfd/elf32-hppa.c (hppa_elf_hash_entry): Define.
+ * elf32-hppa.c (hppa_elf_hash_entry): Define.
(hppa_stub_hash_entry): Define.
(stub_hash_newfunc): Rename variables.
(hppa_link_hash_newfunc): Likewise.
@@ -2504,7 +2504,7 @@
2005-05-20 Daniel Jacobowitz <dan@codesourcery.com>
- * bfd/elf32-ppc.c (struct ppc_elf_link_hash_entry): Add new field
+ * elf32-ppc.c (struct ppc_elf_link_hash_entry): Add new field
has_sda_refs.
(ppc_elf_copy_indirect_symbol): Copy has_sda_refs.
(ppc_elf_check_relocs): Set has_sda_refs.
@@ -5202,7 +5202,7 @@
2005-01-07 Jakub Jelinek <jakub@redhat.com>
- * bfd/elf.c (INCLUDE_SECTION_IN_SEGMENT): Don't put empty sections into
+ * elf.c (INCLUDE_SECTION_IN_SEGMENT): Don't put empty sections into
PT_DYNAMIC segment, unless .dynamic.
2005-01-06 Paul Brook <paul@codesourcery.com>
diff --git a/bfd/ChangeLog-2006 b/bfd/ChangeLog-2006
new file mode 100644
index 000000000000..82216d69382b
--- /dev/null
+++ b/bfd/ChangeLog-2006
@@ -0,0 +1,3601 @@
+2006-12-31 H.J. Lu <hongjiu.lu@intel.com>
+
+ * bfd.c (bfd_record_phdr): Call bfd_zalloc instead of bfd_alloc
+ to allocate elf_segment_map.
+
+2006-12-29 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elflink.c (elf_link_add_object_symbols): Remember the symbol
+ size only if it is defined.
+
+2006-12-25 Kazu Hirata <kazu@codesourcery.com>
+
+ * archures.c (bfd_mach_cpu32_fido): New.
+ (bfd_mach_mcf_isa_a_nodiv, bfd_mach_mcf_isa_a,
+ bfd_mach_mcf_isa_a_mac, bfd_mach_mcf_isa_a_emac,
+ bfd_mach_mcf_isa_aplus, bfd_mach_mcf_isa_aplus_mac,
+ bfd_mach_mcf_isa_aplus_emac, bfd_mach_mcf_isa_b_nousp,
+ bfd_mach_mcf_isa_b_nousp_mac, bfd_mach_mcf_isa_b_nousp_emac,
+ bfd_mach_mcf_isa_b, bfd_mach_mcf_isa_b_mac,
+ bfd_mach_mcf_isa_b_emac, bfd_mach_mcf_isa_b_float,
+ bfd_mach_mcf_isa_b_float_mac, bfd_mach_mcf_isa_b_float_emac):
+ Increment the defined values.
+ * bfd-in2.h: Regenerate.
+ * cpu-m68k.c (arch_info_struct): Add en entry for
+ bfd_mach_cpu32_fido.
+ * elf32-m68k.c (elf32_m68k_object_p): Handle
+ EF_M68K_CPU32_FIDO_A.
+ (elf32_m68k_merge_private_bfd_data): Use EF_M68K_CPU32_MASK.
+ (elf32_m68k_print_private_bfd_data): Handle
+ EF_M68K_CPU32_FIDO_A.
+
+2006-12-25 Mei Ligang <ligang@sunnorth.com.cn>
+
+ * elf32-score.c (score_elf_got_lo16_reloc): Change some variables
+ type from unsigned to signed.
+ (score_elf_final_link_relocate): Fix bugs of handling relocation
+ type R_SCORE_GOT15, R_SCORE_GOT_LO16, and R_SCORE_REL32.
+ (_bfd_score_elf_relocate_section): Handle R_SCORE_GOT_LO16
+ specially.
+
+2006-12-23 Jakub Jelinek <jakub@redhat.com>
+
+ * elf-bfd.h (struct elf_backend_data): Add as_needed_cleanup hook.
+ * elfxx-target.h (elf_backend_as_needed_cleanup): Define.
+ (elfNN_bed): Add as_needed_cleanup hook.
+ * elflink.c (elf_link_add_object_symbols): Call it when reverting
+ hash table changes for unneeded --as-needed input.
+ * elf64-ppc64.c (elf_backend_as_needed_cleanup): Define.
+ (ppc64_elf_as_needed_cleanup): New function.
+
+2006-12-19 Kazu Hirata <kazu@codesourcery.com>
+
+ * elf32-m68k.c (elf32_m68k_object_p,
+ elf32_m68k_print_private_bfd_data): Use EF_M68K_ARCH_MASK to
+ extract architecture mask.
+
+2006-12-19 Nathan Sidwell <nathan@codesourcery.com>
+
+ * elf.c (assign_file_positions_for_load_sections): Adjust p_vaddr
+ by p_vaddr_offset. Copy alignment & use if it is valid.
+ (rewrite_elf_program_headers): Cope with leading padding in a
+ segment that does not contain file or program headers.
+ (copy_elf_program_header): Likewise.
+
+2006-12-15 Mark Kettenis <kettenis@gnu.org>
+
+ * config.bfd: (sh*-*-openbsd*): Add target.
+ * configure.in (sh*-*-openbsd*): Set COREFILE to netbsd-core.lo.
+ * configure: Regenerate.
+
+2006-12-15 Alan Modra <amodra@bigpond.net.au>
+
+ * opncls.c (bfd_openr_iovec): Add "stat" parameter.
+ (struct opncls): Add "stat" field.
+ (opncls_bstat): Call vec->stat.
+ * bfd-in2.h: Regenerate.
+ * elf32-spu.c (spu_elf_open_builtin_lib): Adjust.
+
+2006-12-14 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct bfd_elf_section_data): Clarify sec_group
+ and next_in_group usage.
+
+2006-12-14 Alan Modra <amodra@bigpond.net.au>
+
+ PR 3704
+ * bfdio.c (bfd_bread): Don't read past end of archive elements.
+
+2006-12-12 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * doc/Makefile.am (bfd_TEXINFOS): Set.
+ (bfd.info bfd.dvi bfd.html): Delete rule.
+ * doc/Makefile.in: Regenerated.
+
+2006-12-11 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * configure.in: Define GENINSRC_NEVER.
+ * doc/Makefile.am (bfd.info): Remove srcdir prefix.
+ (MAINTAINERCLEANFILES): Add info file.
+ (DISTCLEANFILES): Pretend to add info file.
+ * po/Make-in (.po.gmo): Put gmo files in objdir.
+ * configure, Makefile.in, doc/Makefile.in: Regenerated.
+
+2006-12-11 Eric Botcazou <ebotcazou@adacore.com>
+
+ * elflink.c (bfd_elf_gc_sections): Also search for corresponding
+ sections with .gnu.linkonce.t. prefix.
+
+2006-12-07 Kazu Hirata <kazu@codesourcery.com>
+
+ * elf32-m68k.c: Update uses of EF_M68K_*.
+
+2006-12-07 H.J. Lu <hjl@gnu.org>
+
+ PR ld/3666
+ * elflink.c (elf_link_add_object_symbols): Keep symbol
+ visibility for symbols from discarded section.
+
+2006-12-06 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-alpha.c (elf64_alpha_merge_symbol_attribute): New function.
+ (elf_backend_merge_symbol_attribute): Define.
+
+2006-12-04 Jan Beulich <jbeulich@novell.com>
+
+ * elflink.c (_bfd_elf_link_create_dynamic_sections): Don't create
+ .eh_frame_hdr section from here anymore.
+ (bfd_elf_size_dynamic_sections): Call _bfd_elf_maybe_strip_eh_frame_hdr
+ a little earlier.
+
+2006-12-01 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/3609
+ * elf.c (rewrite_elf_program_header): Preserve segment physical
+ address in the output segment if the first section in the
+ corresponding input segment is null.
+
+2006-12-01 Nick Clifton <nickc@redhat.com>
+
+ PR 3609
+ * elf.c (rewrite_elf_program_header): Do not use the first_section
+ pointer if it is null.
+
+2006-11-29 Paul Brook <paul@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_to_thumb_export_stub): Assert that output
+ section is present.
+ (allocate_dynrelocs): Only add export stub for symbols defined in
+ this object.
+
+2006-11-29 Paul Brook <paul@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_to_thumb_export_stub): Assert that output
+ section is present.
+ (allocate_dynrelocs): Only add export stub for symbols defined in
+ this object.
+
+2006-11-29 Paul Brook <paul@codesourcery.com>
+ Julian Brown <julian@codesourcery.com>
+
+ * elf32-arm.c (copy_eabi_attributes): Correct starting offset.
+ (elf32_arm_merge_eabi_attributes): Mark output as initialized.
+ Only set Tag_CPU_name and Tag_ABI_PCS_R9_use if input attribute
+ is present.
+
+2006-11-27 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (elf_xtensa_special_sections): Add .xtensa.info.
+
+2006-11-24 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf.c (IS_SECTION_IN_INPUT_SEGMENT): New.
+ (INCLUDE_SECTION_IN_SEGMENT): Use IS_SECTION_IN_INPUT_SEGMENT.
+ (rewrite_elf_program_header): Don't preserve segment physical
+ address in the output segment if the first section in the
+ corresponding input segment is removed.
+
+2006-11-22 Alan Modra <amodra@bigpond.net.au>
+
+ * pef.c (bfd_pef_make_empty_symbol): Delete function. Define instead.
+ * xsym.c (bfd_sym_make_empty_symbol): Likewise.
+ * xsym.h (bfd_sym_make_empty_symbol): Delete.
+
+2006-11-21 Greg McGary <greg@mcgary.org>
+
+ * elf32-ppc.c (ppc_elf_relocate_section): Fixup D field
+ at proper offset in little-endian mode.
+ * elf64-ppc.c (ppc_elf_relocate_section): Likewise.
+
+2006-11-21 Jakub Jelinek <jakub@redhat.com>
+
+ * elf-eh-frame.c (struct cie): New type.
+ (cie_compare): Removed.
+ (cie_eq, cie_hash, cie_compute_hash): New functions.
+ (_bfd_elf_discard_section_eh_frame): Rewrite not to rely on FDEs
+ pointing only to last CIE and allow merging of any duplicate CIEs,
+ not just duplicate consecutive CIEs.
+ (_bfd_elf_discard_section_eh_frame_hdr): Delete cies hash table.
+ * elf-bfd.h (struct cie_header, struct cie): Removed.
+ (struct eh_frame_sec_info): Remove alloced field.
+ (struct eh_frame_hdr_info): Remove last_cie, last_cie_sec
+ and last_cie_inf fields. Add cies field.
+
+2006-11-20 Alan Modra <amodra@bigpond.net.au>
+
+ * bfd-in.h (struct stat): Don't typedef.
+ * bfdio.c (bfd_get_size): Return a file_ptr.
+ * cisco-core.c (cisco_core_file_validate): Use bfd_size_type for nread.
+ * mmo.c (mmo_scan): Use file_ptr for curpos.
+ * trad-core.c (trad_unix_core): Don't cast statbuf.st_size to
+ unsigned long.
+ * bfd-in2.h: Regenerate.
+
+2006-11-20 Alan Modra <amodra@bigpond.net.au>
+
+ PR 3532
+ * bfd-in.h (struct bfd_hash_table): Reorganize. Add "frozen".
+ * hash.c (bfd_hash_table_init_n): Init frozen.
+ (bfd_hash_lookup): Don't grow if frozen.
+ (bfd_hash_traverse): Freeze hash table during traversal.
+ * bfd-in2.h: Regenerate.
+
+2006-11-18 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.c (_bfd_elf_check_kept_section): Test for kept group
+ section. Save result of checks in kept_section.
+ (_bfd_elf_section_already_linked): Tidy. Correct comments.
+ Ignore all group member sections. Handle special matching of
+ single-member groups against linkonce sections via their group
+ section. When such a match is found, set kept_section to the
+ group member section rather than to the group.
+
+2006-11-14 Phil Lello <phil.lello@homecall.co.uk>
+
+ * peXXigen.c: Updates for PE/COFF V8.0, and clarification
+ (dir_names): Added CLR Runtime Header to dir_names[].
+ (_bfd_XX_print_private_bfd_data_common): Added EFI_ROM and XBOX
+ subsystem names
+ (_bfd_XXi_swap_aouthdr_in, _bfd_XXi_swap_aouthdr_out)
+ (pe_print_idata, pe_print_edata)
+ (_bfd_XX_bfd_copy_private_bfd_data_common)
+ (_bfd_XXi_final_link_postscript): Use #DEFINEs for index into
+ DataDirectory.
+
+2006-11-13 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * bfd-in.h (bfd_elf32_arm_process_before_allocation): Update
+ prototype.
+ (bfd_elf32_arm_set_byteswap_code): New prototype.
+ * bfd-in2.h: Regenerate.
+ * elf32-arm.c (bfd_elf32_arm_process_before_allocation): Don't take
+ byteswap_code as an argument. Revert 2006-11-01 change.
+ (bfd_elf32_arm_set_byteswap_code): New.
+ (elf32_arm_size_dynamic_sections): Call
+ bfd_elf32_arm_process_before_allocation.
+
+2006-11-10 Thiemo Seufer <ths@mips.com>
+
+ * config.bfd (mips*el-sde-elf*, mips*-sde-elf*): Drop ECOFF support
+ for SDE configs.
+
+2006-11-10 Nick Clifton <nickc@redhat.com>
+
+ * config.bfd: Move previously obsoleted targets to the REMOVED
+ list.
+ Add maxq-*-coff to the obsolete list.
+
+2006-11-10 Pedro Alves <pedro_alves@portugalmail.pt>
+
+ * pe-arm-wince.c (LOCAL_LABEL_PREFIX): Define as ".".
+ * pei-arm-wince.c (LOCAL_LABEL_PREFIX): Likewise.
+ * coff-arm.c (LOCAL_LABEL_PREFIX): Only define if not defined before.
+
+2006-11-07 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * elf32-arm.c (find_thumb_glue): Add ERROR_MESSAGE argument; set it
+ on error.
+ (find_arm_glue): Likewise.
+ (elf32_thumb_to_arm_stub, elf32_arm_create_thumb_stub)
+ (elf32_arm_to_thumb_stub, elf32_arm_final_link_relocate): Add
+ ERROR_MESSAGE argument and pass it through.
+ (elf32_arm_to_thumb_export_stub): Update.
+ (elf32_arm_relocate_section): Use ERROR_MESSAGE and reloc_dangerous.
+
+2006-11-07 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (enum _ppc64_sec_type): New.
+ (struct _ppc64_elf_section_data): Move "t_symndx" into opd union,
+ and rename fields. Add sec_type and has_14bit_branch.
+ (struct ppc_link_hash_table): Remove has_14bit_branch.
+ (get_opd_info, get_tls_mask, ppc64_elf_edit_opd): Adjust.
+ (ppc64_elf_relocate_section): Likewise.
+ (ppc64_elf_check_relocs): Likewise. Set per-section has_14bit_branch.
+ (ppc64_elf_size_stubs): Don't set default group size here.
+ (group_sections): Instead do so here, and group sections using
+ their individual requirements.
+
+2006-11-07 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (struct ppc64_elf_obj_tdata): Remove "has_dotsym"
+ and union.
+ (struct ppc_link_hash_entry): Add "next_dot_sym".
+ (struct ppc_link_hash_table): Add "dot_syms".
+ (link_hash_newfunc): Make list of syms starting with a dot.
+ (ppc_get_stub_entry, adjust_opd_syms): Adjust.
+ (ppc64_elf_add_symbol_hook): Don't set has_dotsym.
+ (struct add_symbol_adjust_data): Delete.
+ (add_symbol_adjust): Simplify params and return.
+ (ppc64_elf_check_directives): Just process the "dot_syms" lists,
+ not all syms.
+
+2006-11-02 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * libbfd-in.h (_bfd_clear_contents): New prototype.
+ * reloc.c (_bfd_clear_contents): New.
+ * libbfd.h: Regenerated.
+
+ * elf32-arm.c (elf32_arm_final_link_relocate): Use
+ _bfd_clear_contents.
+ * elf32-d10v.c (elf32_d10v_relocate_section): Likewise.
+ * elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
+ * elf32-i386.c (elf_i386_relocate_section): Likewise.
+ * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
+ * elf32-s390.c (elf_s390_relocate_section): Likewise.
+ * elf32-sh.c (sh_elf_relocate_section): Likewise.
+ * elf32-xtensa.c (elf_xtensa_relocate_section): Likewise.
+ * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
+ * elf64-s390.c (elf_s390_relocate_section): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
+ * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise.
+
+ * elfxx-ia64.c (elfNN_ia64_relocate_section): Set value to
+ zero for discarded symbols.
+ * elfxx-mips.c (mips_elf_calculate_relocation): Likewise.
+
+2006-11-01 Thiemo Seufer <ths@mips.com>
+ David Ung <davidu@mips.com>
+
+ * elf-bfd.h (local_call_stubs): New member.
+ * elfxx-mips.c (FN_STUB_P, CALL_STUB_P, CALL_FP_STUB_P): New macros.
+ (mips_elf_calculate_relocation): Handle local mips16 call stubs.
+ (mips16_stub_section_p): Rename from mips_elf_stub_section_p, use
+ the new stub macros.
+ (_bfd_mips_elf_check_relocs): Handle call stubs for code which
+ mixes mips16 and mips32 functions. Use mips16_stub_section_p. Mark
+ used stubs with SEC_KEEP. Use the new stub macros.
+
+2006-11-01 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-arm.c (bfd_elf32_arm_process_before_allocation): Correct
+ check for PLT usage.
+
+2006-11-01 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * elfxx-mips.c (mips_elf_merge_gots): Always use maxcnt.
+
+2006-10-31 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (elfcore_write_note): Pad note descriptor to 4-byte
+ boundary. Tidy. Comment.
+
+2006-10-30 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/3111
+ * elf-bfd.h (elf_obj_tdata): Add symbuf.
+ (_bfd_elf_section_already_linked): Add struct bfd_link_info *.
+ (_bfd_elf_check_kept_section): Likewise.
+ (bfd_elf_match_symbols_in_sections): Likewise.
+
+ * elf.c (assign_section_numbers): Updated to add
+ struct bfd_link_info *.
+ (bfd_elf_match_symbols_in_sections): Updated. Cache symbol
+ buffer if info->reduce_memory_overheads is false.
+
+ * elflink.c (match_group_member): Updated to add
+ struct bfd_link_info *.
+ (_bfd_elf_check_kept_section): Likewise.
+ (elf_link_input_bfd): Likewise.
+ (_bfd_elf_section_already_linked): Likewise.
+ (bfd_elf_final_link): Free symbol buffer if
+ info->reduce_memory_overheads is false.
+
+ * libbfd-in.h (_bfd_nolink_section_already_linked): Add
+ struct bfd_link_info *.
+ (_bfd_generic_section_already_linked): Likewise.
+ * libbfd.h: Regenerated.
+
+ * linker.c (bfd_section_already_linked): Add
+ struct bfd_link_info *.
+ (_bfd_generic_section_already_linked): Likewise.
+ * targets.c (bfd_target): Add struct bfd_link_info * to
+ _section_already_linked.
+ * bfd-in2.h: Regenerated.
+
+2006-10-30 Alan Modra <amodra@bigpond.net.au>
+
+ * bfd.c (bfd_error_type): Add bfd_error_on_input.
+ (input_bfd, input_error): New static vars.
+ (bfd_set_error): Handle bfd_error_on_input.
+ (bfd_errmsg): Likewise.
+ (bfd_perror): Simplify.
+ * archive.c (_bfd_write_archive_contents): Report errors on input.
+ * bfd-in2.h: Regenerate.
+
+2006-10-30 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (elfcore_write_note): Pad to 4-byte boundary.
+
+2006-10-28 Richard Sandiford <richard@codesourcery.com>
+
+ * elf32-mips.c (elf_mips_howto_table_rel): Add R_MIPS_GLOB_DAT.
+ * elfn32-mips.c (elf_mips_howto_table_rel): Likewise.
+ (elf_mips_howto_table_rela): Likewise.
+ * elf64-mips.c (mips_elf64_howto_table_rel): Likewise.
+ (mips_elf64_howto_table_rela): Likewise.
+
+2006-10-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf.c (_bfd_elf_init_private_section_data): Assert output
+ section ELF type instead of check if it is SHT_NULL. Copy
+ OS/PROC specific flags from input section to output section.
+
+2006-10-27 Alan Modra <amodra@bigpond.net.au>
+
+ * section.c (SEC_KEEP): Update comment.
+ * bfd-in2.h: Regenerate.
+ * elflink.c (bfd_elf_gc_sections): Ignore SEC_EXCLUDE sections.
+ * merge.c (_bfd_merge_sections): Set SEC_KEEP on excluded sections.
+ * stabs.c (_bfd_discard_section_stabs): Likewise.
+ (_bfd_link_section_stabs): Likewise. Simplify abs_section check.
+
+2006-10-26 Ben Elliston <bje@au.ibm.com>
+
+ * reloc.c (_bfd_relocate_contents): Remove explicit case 0.
+
+ * elf.c (bfd_section_from_shdr): Remove extraneous breaks.
+ * targets.c (find_target): Remove extraneous break.
+
+2006-10-26 Ben Elliston <bje@au.ibm.com>
+
+ * coff-maxq.c (coff_maxq20_reloc): Remove unused variable `howto'.
+ (struct maxq_reloc_map): Unused; remove.
+ (maxq_reloc_map): Likewise.
+ (maxq_reloc_type_lookup): Remove loop over maxq_reloc_map.
+
+2006-10-26 Ben Elliston <bje@au.ibm.com>
+
+ * elf.c (bfd_elf_set_dyn_lib_class): Change second argument type
+ from int to enum dynamic_lib_link_class lib_class.
+ * bfd-in.h (bfd_elf_set_dyn_lib_class): Likewise.
+ * bfd-in2.h: Regenerate.
+
+2006-10-25 Alan Modra <amodra@bigpond.net.au>
+ Trevor Smigiel <Trevor_Smigiel@playstation.sony.com>
+ Yukishige Shibata <shibata@rd.scei.sony.co.jp>
+ Nobuhisa Fujinami <fnami@rd.scei.sony.co.jp>
+ Takeaki Fukuoka <fukuoka@rd.scei.sony.co.jp>
+
+ * cpu-spu.c: New file.
+ * elf32-spu.c: New file.
+ * elf32-spu.h: New file.
+ * archures.c: Add SPU support.
+ * config.bfd: Likewise.
+ * configure.in: Likewise.
+ * reloc.c: Likewise.
+ * targets.c: Likewise.
+ * Makefile.am: Likewise. Run "make dep-am".
+ * libbfd.h: Regenerate.
+ * bfd-in2.h: Regenerate.
+ * Makefile.in: Regenerate.
+ * configure: Regenerate.
+ * po/SRC-POTFILES.in: Regenerate.
+
+2006-10-23 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_edit_opd): Clarify comment.
+
+2006-10-23 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-score.c: Formatting.
+ (elf_backend_omit_section_dynsym): Define.
+ (score_elf_create_dynamic_relocation): Remove code copied from mips.
+ Don't use section syms in dynamic relocs. Remove unused param.
+ (score_elf_final_link_relocate): Remove unused param.
+
+2006-10-23 Alan Modra <amodra@bigpond.net.au>
+
+ * linker.c (fix_syms): Choose best of previous and next
+ section based on section flags and vma.
+
+2006-10-21 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * elf32-sh64.c (sh64_elf_merge_symbol_attribute): Do merging
+ only when the non visibility part of st_other is non-zero.
+ * elf64-sh64.c (sh64_elf64_merge_symbol_attribute): Likewise.
+
+2006-10-20 Richard Sandiford <richard@codesourcery.com>
+
+ * elfxx-mips.c (_bfd_mips_elf_modify_segment_map): Don't extend
+ PT_DYNAMIC on GNU/Linux targets.
+
+2006-10-20 Richard Sandiford <richard@codesourcery.com>
+
+ * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_sections): Make the
+ size of .rel.dyn reflect the value of DT_RELSZ.
+
+2006-10-20 Richard Sandiford <richard@codesourcery.com>
+
+ * elfxx-mips.c (_bfd_mips_elf_additional_program_headers): Allocate
+ a PT_NULL header for dynamic objects.
+ (_bfd_mips_elf_modify_segment_map): Add it.
+
+2006-10-19 Mei Ligang <ligang@sunnorth.com.cn>
+
+ * elf32-score.c (score_elf_rel_dyn_section): Replace
+ bfd_make_section with bfd_make_section_with_flags.
+ (_bfd_score_elf_create_dynamic_sections): Ditto.
+ (score_elf_create_got_section): Ditto.
+ (score_elf_final_link_relocate): Delete referrence to
+ EF_SCORE_HASENTRY.
+
+2006-10-19 Richard Sandiford <richard@codesourcery.com>
+
+ * elfxx-mips.c (sort_dynamic_relocs): Sort relocations against the
+ same symbol by increasing r_offset.
+ (sort_dynamic_relocs_64): Likewise. Fix comparisons between very
+ large and very small symbol indexes.
+
+2006-10-19 Richard Sandiford <richard@codesourcery.com>
+
+ * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Add DT_DEBUG
+ and DT_MIPS_RLD_MAP tags for position-independent executables.
+ Do not add DT_DEBUG to shared libraries for any MIPS target.
+
+2006-10-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/3290
+ * elflink.c (elf_link_add_object_symbols): Hide definitions in
+ debug sections.
+
+2006-10-19 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-arm.c (bfd_elf32_arm_allocate_interworking_sect): Check,
+ don't set, glue section size.
+ (record_arm_to_thumb_glue): Set glue section size here.
+ (record_thumb_to_arm_glue): Likewise.
+ (bfd_elf32_arm_add_glue_sections_to_bfd): Formatting.
+ (bfd_elf32_arm_process_before_allocation): Ignore exluded sections.
+
+2006-10-18 Roy Marples <uberlord@gentoo.org>
+
+ * elf64-sparc.c: Add FreeBSD support.
+ (elf64_sparc_fbsd_post_process_headers): New function.
+ * targets.c (_bfd_target_vector): Add bfd_elf64_sparc_freebsd_vec.
+ * config.bfd (sparc64-*-freebsd*): Set targ_defvec to bfd_elf64_sparc_freebsd_vec.
+ * configure.in: Add entry for bfd_elf64_sparc_freebsd_vec.
+ * configure: Regenerate.
+
+2006-10-17 Mark Shinwell <shinwell@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_final_link_relocate): Add support for
+ R_ARM_MOVW_BREL_NC, R_ARM_MOVW_BREL, R_ARM_MOVT_BREL,
+ R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVW_BREL and
+ R_ARM_THM_MOVT_BREL relocations.
+
+2006-10-17 Mark Shinwell <shinwell@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_howto_table_1): Change offset for
+ R_THM_CALL to 25 and remove FIXME comment.
+ (using_thumb2): New function.
+ (elf32_arm_final_link_relocate): Cope with Thumb-2 BL encoding.
+
+2006-10-17 Mark Shinwell <shinwell@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_final_link_relocate): Add cases
+ for R_ARM_ABS32_NOI and R_ARM_REL32_NOI.
+ (elf32_arm_gc_sweep_hook): Likewise.
+ (elf32_arm_check_relocs): Likewise.
+ (allocate_dynrelocs): Likewise.
+
+2006-10-17 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct elf_link_hash_table): Reorder. Add
+ text_index_section and data_index_section.
+ (struct elf_backend_data): Add elf_backend_init_index_section.
+ (_bfd_elf_init_1_index_section): Declare.
+ (_bfd_elf_init_2_index_sections): Declare.
+ * elfxx-target.h (elf_backend_init_index_section): Define.
+ (elfNN_bed): Init new field.
+ * elflink.c (_bfd_elf_link_omit_section_dynsym): Keep first tls
+ section and text_index_section plus data_index_section.
+ (_bfd_elf_link_renumber_dynsyms): Clear dynindx on omitted sections.
+ (_bfd_elf_init_1_index_section): New function.
+ (_bfd_elf_init_2_index_sections): New function.
+ (bfd_elf_size_dynsym_hash_dynstr): Call elf_backend_init_index_section.
+ (elf_link_input_bfd): When emitting relocs, use text_index_section
+ and data_index_section for removed sections.
+ * elf-m10300.c (elf_backend_omit_section_dynsym): Define.
+ * elf32-i386.c: Likewise.
+ * elf32-m32r.c: Likewise.
+ * elf32-sh.c: Likewise.
+ * elf32-xstormy16.c: Likewise.
+ * elf32-xtensa.c: Likewise.
+ * elf64-alpha.c: Likewise.
+ * elf64-hppa.c: Likewise.
+ * elf64-mmix.c: Likewise.
+ * elf64-sh64.c: Likewise.
+ * elfxx-ia64.c: Likewise.
+ * elf32-arm.c (elf32_arm_final_link_relocate): Use text_index_section
+ and data_index_section sym for relocs against sections with no dynamic
+ section sym.
+ (elf_backend_init_index_section): Define.
+ * elf32-cris.c: Similarly.
+ * elf32-hppa.c: Similarly.
+ * elf32-i370.c: Similarly.
+ * elf32-m68k.c: Similarly.
+ * elf32-mips.c: Similarly.
+ * elf32-ppc.c: Similarly.
+ * elf32-s390.c: Similarly.
+ * elf32-sparc.c: Similarly.
+ * elf32-vax.c: Similarly.
+ * elf64-mips.c: Similarly.
+ * elf64-ppc.c: Similarly.
+ * elf64-s390.c: Similarly.
+ * elf64-sparc.c: Similarly.
+ * elf64-x86-64.c: Similarly.
+ * elfn32-mips.c: Similarly.
+ * elfxx-mips.c: Similarly.
+ * elfxx-sparc.c: Similarly.
+ * linker.c (fix_syms): Base symbols in removed sections on
+ previous section in preference to using absolute section.
+
+2006-10-16 Andreas Schwab <schwab@suse.de>
+
+ * elfxx-ia64.c (addend_compare): Properly compute return value.
+
+2006-10-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/3314
+ * elf.c (assign_file_positions_for_non_load_sections): Don't
+ page align empty SHF_ALLOC sections.
+
+2006-10-13 Jakub Jelinek <jakub@redhat.com>
+
+ * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_sections): Set
+ .plt sh_entsize to 0 if plt header size isn't multiple of
+ plt entry size or for 32-bit which adds a nop insn at the
+ end of the .plt section.
+
+2006-10-12 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (elf_xtensa_action_discarded): New.
+ (elf_backend_action_discarded): Define.
+
+2006-10-11 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (elf_xtensa_relocate_section): Return after
+ unresolvable relocation error.
+ (elf_xtensa_finish_dynamic_symbol): Set value of undefined, weak
+ symbols to zero.
+
+2006-10-10 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (elf_xtensa_size_dynamic_sections): Add DT_DEBUG
+ for PIE executables.
+
+2006-10-03 Jakub Jelinek <jakub@redhat.com>
+
+ * elf-bfd.h (struct eh_cie_fde): Add set_loc pointer.
+ * elf-eh-frame.c (skip_cfa_op): Fix handling of DW_CFA_advance_loc.
+ Handle DW_CFA_{remember,restore}_state, DW_CFA_GNU_window_save,
+ DW_CFA_val_{offset{,_sf},expression}.
+ (skip_non_nops): Record number of DW_CFA_set_loc ops.
+ (_bfd_elf_discard_section_eh_frame): Require skip_non_nops recognizes
+ all ops. If there are any DW_CFA_set_loc ops and they are pcrel
+ or going to be pcrel, compute set_loc array.
+ (_bfd_elf_eh_frame_section_offset): If make_relative, kill relocations
+ against DW_CFA_set_loc operands.
+ (_bfd_elf_write_section_eh_frame): Handle DW_CFA_set_loc adjusting.
+
+2006-10-02 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * elflink.c (_bfd_elf_merge_symbol): Discard references to TLS
+ symbols from the --just-syms file.
+
+2006-10-01 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_build_stubs): Test glink size for
+ existence of PLT.
+
+2006-09-29 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/3283
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Don't ignore
+ relocation overflow on branches to undefweaks.
+
+2006-09-29 Alan Modra <amodra@bigpond.net.au>
+
+ * po/BLD-POTFILES.in: Regenerate.
+ * po/SRC-POTFILES.in: Regenerate.
+
+2006-09-29 Danny Smith <dannysmith@users.sourceforge.net>
+
+ PR 3276
+ * pei-i386.c (COFF_SECTION_ALIGNMENT_ENTRIES): Enable 16 byte
+ alignment for .data$, .rdata$ and .text$ sections so that sse
+ and sse2 code will work for linkonce sections too.
+ * pe-i386.c (COFF_SECTION_ALIGNMENT_ENTRIES): Likewise.
+
+2006-09-28 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.c (_bfd_elf_gc_mark_hook): New function.
+ * elf-bfd.h (_bfd_elf_gc_mark_hook): Declare.
+ * elfxx-target.h (elf_backend_gc_mark_hook): Default to above.
+ * elf-m10300.c (mn10300_elf_gc_mark_hook): Use _bfd_elf_gc_mark_hook.
+ * elf32-arm.c (elf32_arm_gc_mark_hook): Likewise.
+ * elf32-cris.c (cris_elf_gc_mark_hook): Likewise.
+ * elf32-hppa.c (elf32_hppa_gc_mark_hook): Likewise.
+ * elf32-i386.c (elf_i386_gc_mark_hook): Likewise.
+ * elf32-m32r.c (m32r_elf_gc_mark_hook): Likewise.
+ * elf32-m68k.c (elf_m68k_gc_mark_hook): Likewise.
+ * elf32-mcore.c (mcore_elf_gc_mark_hook): Likewise.
+ * elf32-ppc.c (ppc_elf_gc_mark_hook): Likewise.
+ * elf32-s390.c (elf_s390_gc_mark_hook): Likewise.
+ * elf32-score.c (_bfd_score_elf_gc_mark_hook): Likewise.
+ * elf32-sh.c (sh_elf_gc_mark_hook): Likewise.
+ * elf32-vax.c (elf_vax_gc_mark_hook): Likewise.
+ * elf32-xtensa.c (elf_xtensa_gc_mark_hook): Likewise.
+ * elf64-mmix.c (mmix_elf_gc_mark_hook): Likewise.
+ * elf64-s390.c (elf_s390_gc_mark_hook): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_gc_mark_hook): Likewise.
+ * elfxx-mips.c (_bfd_mips_elf_gc_mark_hook): Likewise.
+ * elfxx-sparc.c (_bfd_sparc_elf_gc_mark_hook): Likewise.
+ * elf32-bfin.c (bfin_gc_mark_hook): Likewise.
+ (bfinfdpic_gc_sweep_hook): Delete.
+ (elf_backend_gc_sweep_hook): Don't define for elf32-bfinfdpic.
+ * elf32-d10v.c (elf32_d10v_gc_mark_hook): Use _bfd_elf_gc_mark_hook.
+ (elf32_d10v_gc_sweep_hook): Delete.
+ (elf_backend_gc_sweep_hook): Don't define.
+ * elf32-fr30.c (fr30_elf_gc_mark_hook): Use _bfd_elf_gc_mark_hook.
+ (fr30_elf_gc_sweep_hook): Delete.
+ (elf_backend_gc_sweep_hook): Don't define.
+ * elf32-frv.c (elf32_frv_gc_mark_hook): Use _bfd_elf_gc_mark_hook.
+ (elf32_frv_gc_sweep_hook): Delete.
+ (elf_backend_gc_sweep_hook): Don't define.
+ * elf32-iq2000.c (iq2000_elf_gc_mark_hook): Use _bfd_elf_gc_mark_hook.
+ (iq2000_elf_gc_sweep_hook): Delete.
+ (elf_backend_gc_sweep_hook): Don't define.
+ * elf32-openrisc.c (openrisc_elf_gc_mark_hook): Use
+ _bfd_elf_gc_mark_hook.
+ (openrisc_elf_gc_sweep_hook): Delete.
+ (elf_backend_gc_sweep_hook): Don't define.
+ * elf32-v850.c (v850_elf_gc_mark_hook): Use _bfd_elf_gc_mark_hook.
+ (v850_elf_gc_sweep_hook): Delete.
+ (elf_backend_gc_sweep_hook): Don't define.
+ * elf32-xstormy16.c (xstormy16_elf_gc_mark_hook): Use
+ _bfd_elf_gc_mark_hook.
+ (xstormy16_elf_gc_sweep_hook): Delete.
+ (elf_backend_gc_sweep_hook): Don't define.
+ * elf64-sh64.c (sh_elf64_gc_mark_hook): Use _bfd_elf_gc_mark_hook.
+ (sh_elf64_gc_sweep_hook): Delete.
+ (elf_backend_gc_sweep_hook): Don't define.
+ * elf32-avr.c (elf32_avr_gc_mark_hook): Delete.
+ (elf32_avr_gc_sweep_hook): Delete.
+ (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define.
+ * elf32-cr16c.c (elf32_cr16c_gc_mark_hook): Delete.
+ (elf32_cr16c_gc_sweep_hook): Delete.
+ (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define.
+ * elf32-crx.c (elf32_crx_gc_mark_hook): Delete.
+ (elf32_crx_gc_sweep_hook): Delete.
+ (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define.
+ * elf32-h8300.c (elf32_h8_gc_mark_hook): Delete.
+ (elf32_h8_gc_sweep_hook): Delete.
+ (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define.
+ * elf32-ip2k.c (ip2k_elf_gc_mark_hook): Delete.
+ (ip2k_elf_gc_sweep_hook): Delete.
+ (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define.
+ * elf32-m32c.c (m32c_elf_gc_mark_hook, m32c_elf_gc_sweep_hook): Delete.
+ (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define.
+ * elf32-m68hc11.c (elf_backend_gc_mark_hook): Don't define.
+ (elf_backend_gc_sweep_hook): Don't define.
+ * elf32-m68hc12.c (elf_backend_gc_mark_hook): Don't define.
+ (elf_backend_gc_sweep_hook): Don't define.
+ * elf32-m68hc1x.c (elf32_m68hc11_gc_mark_hook): Delete.
+ (elf32_m68hc11_gc_sweep_hook): Delete.
+ * elf32-m68hc1x.h (elf32_m68hc11_gc_mark_hook): Delete.
+ (elf32_m68hc11_gc_sweep_hook): Delete.
+ * elf32-msp430.c (elf32_msp430_gc_mark_hook): Delete.
+ (elf32_msp430_gc_sweep_hook): Delete.
+ (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define.
+ * elf32-mt.c (mt_elf_gc_mark_hook, mt_elf_gc_sweep_hook): Delete.
+ (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define.
+
+2006-09-25 Pedro Alves <pedro_alves@portugalmail.pt>
+
+ * bfd-in.h (CONST_STRNCPY) : Delete.
+ (LITSTRCPY) : New.
+ (LITMEMCPY) : New.
+ * bfd-in2.h : Regenerate.
+ * elflink.c (bfd_elf_gc_sections) : Use LITMEMCPY. Don't manually
+ calculate string lengths.
+ * nlmcode.h (nlm_swap_auxiliary_headers_in) : Use LITMEMCPY.
+
+2006-09-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/3223
+ PR ld/3267
+ * elf.c (assign_file_positions_for_non_load_sections): Don't
+ warn zero size allocated sections.
+
+2006-09-27 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-score.c (_bfd_score_elf_relocate_section): Move assignment
+ to "name" so that compiler realizes it is never uninitialized.
+ Use bfd_elf_sym_name.
+
+2006-09-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/3262
+ * elf.c (rewrite_elf_program_header): Use bfd_zalloc instead of
+ bfd_alloc to allocate segment map.
+ (copy_elf_program_header): Likewise.
+
+2006-09-26 Mark Shinwell <shinwell@codesourcery.com>
+ Joseph Myers <joseph@codesourcery.com>
+ Ian Lance Taylor <ian@wasabisystems.com>
+ Ben Elliston <bje@wasabisystems.com>
+
+ * archures.c: Add definition for bfd_mach_arm_iWMMXt2.
+ * cpu-arm.c (processors): Add bfd_mach_arm_iWMMXt2.
+ (arch_info_struct, bfd_arm_update_notes): Likewise.
+ (architectures): Likewise.
+ (bfd_arm_merge_machines): Check for iWMMXt2.
+ * bfd-in2.h: Rebuild.
+
+2006-09-24 H.J. Lu <hongjiu.lu@intel.com>
+
+ * configure: Regenerated.
+
+2006-09-22 Alan Modra <amodra@bigpond.net.au>
+
+ * elfcode.h (elf_swap_symbol_in): Return bfd_boolean. Don't abort
+ on error.
+ * elf-bfd.h (elf_size_info <swap_symbol_in>): Adjust decl.
+ (bfd_elf32_swap_symbol_in, bfd_elf64_swap_symbol_in): Likewise.
+ * elf.c (bfd_elf_get_elf_syms): Test return of swap_symbol_in,
+ and report error.
+ * elf32-arm.c (elf32_arm_swap_symbol_in): Return bfd_boolean.
+
+2006-09-20 Martin Schwidefsky <schwidefsky@de.ibm.com>
+
+ * elf32-s390.c (elf_s390_relocate_section): Remove check for code
+ section in LD to LE linker relaxation for R_390_TLS_LDO32.
+ * elf64-s390.c (elf_s390_relocate_section): Likewise for
+ R_390_TLS_LDO64.
+
+2006-09-20 Kai Tietz <Kai.Tietz@onevision.com>
+
+ * configure.in: Added new target-vectors x86_64coff_vec,
+ x86_64pe_vec, and x86_64pei_vec.
+ * configure: Regenerate.
+ * config.bfd: Adjusted x86_64 target architecture detection.
+ * bfd.c: Add for new target "coff-x86-64"
+ (bfd_get_sign_extend): Add target vector idents for pe-x86-64. and pei-x86-64.
+ * coff-x86_64.c: Add new file for x86_64 (AMD64) coff support.
+ * libpei.h: Adjustments for COFF_WITH_pex64.
+ * coffcode.h: Add for new target machine, architecture, signature, and internal
+ signature handler.
+ * Makefile.am: Add new files to target-all and define make-rule for pex64igen.c
+ * Makefile.in: Regenerate.
+ * pe-x86_64.c: Add for new target "pe-x86-64".
+ * pei-x86_64.c: Add for new target "pei-x86-64".
+ * peicode.h: Adjusts for new targets.
+ (coff_swap_filehdr_out): Set for this target to
+ _bfd_pex64_only_swap_filehdr_out.
+ (SIZEOF_IDATA4): Define it as 8 byte size for this target.
+ (SIZEOF_IDATA5): Define it as 8 byte size for this target.
+ (jump_table jtab): Add for AMD64MAGIC.
+ (pe_ILF_build_a_bfd): Adjusts for new size of SIZEOF_IDATA4 and SIZE_IDATA5.
+ (pe_ILF_object_p): Add coff image-file signature to internal
+ signature translation.
+ * peXXigen.c: Adjust proper include of target coff-header and
+ introduced target specific code
+ (COFF_WITH_pex64): New macro for this target.
+ (pe_print_idata): New dumping method for import section of PE+ files.
+ * targets.c: Add new target vectors declarations for x86_64 coff targets.
+ * coffcode.h: Support code to support the x86_64 PE magic number.
+ * coff-x86_64.c: New file.
+
+2006-09-17 Hans-Peter Nilsson <hp@axis.com>
+
+ * elf.c (special_sections_s): Revert last STRING_COMMA_LEN change
+ for .stabstr entry, explain why.
+
+2006-09-17 Anton Blanchard <anton@samba.org>
+ Alan Modra <amodra@bigpond.net.au>
+
+ * dwarf2.c (concat_filename): Apply DW_AT_comp_dir if dir table
+ entry isn't absolute.
+
+2006-09-17 Mei Ligang <ligang@sunnorth.com.cn>
+
+ * cpu-score.c: New file.
+ * elf32-score.c: New file.
+ * config.bfd: Add Score target.
+ * Makefile.am: Add Score files.
+ * Makefile.in: Regenerate.
+ * archures.c: Add Score architecture.
+ * reloc.c: Add Score relocs.
+ * targets.c: Add Score target vectors.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+ * configure.in: Add Score target.
+ * configure: Regenerate.
+
+2006-09-16 Nick Clifton <nickc@redhat.com>
+ Pedro Alves <pedro_alves@portugalmail.pt>
+
+ * bfd-in.h (STRING_COMMA_LEN): New macro. Takes one constant
+ string as its argument and emits the string followed by a comma
+ and then the length of the string.
+ (CONST_STRNEQ): New macro. Checks to see if a variable string
+ has a constant string as its initial characters.
+ (CONST_STRNCPY): New macro. Copies a constant string to the start
+ of a variable string.
+ * bfd-in2.h: Regenerate.
+ * archive.c: Make use of the new macros.
+ * archive64.c: Likewise.
+ * bfd.c: Likewise.
+ * coff-ppc.c: Likewise.
+ * coff-stgo32.c: Likewise.
+ * coffcode.h: Likewise.
+ * cofflink.c: Likewise.
+ * cpu-i960.c: Likewise.
+ * dwarf2.c: Likewise.
+ * ecoff.c: Likewise.
+ * elf-m10300.c: Likewise.
+ * elf.c: Likewise.
+ * elf32-arm.c: Likewise.
+ * elf32-bfin.c: Likewise.
+ * elf32-cris.c: Likewise.
+ * elf32-hppa.c: Likewise.
+ * elf32-i370.c: Likewise.
+ * elf32-i386.c: Likewise.
+ * elf32-iq2000.c: Likewise.
+ * elf32-m32r.c: Likewise.
+ * elf32-m68hc11.c: Likewise.
+ * elf32-m68hc12.c: Likewise.
+ * elf32-m68k.c: Likewise.
+ * elf32-mcore.c: Likewise.
+ * elf32-ppc.c: Likewise.
+ * elf32-s390.c: Likewise.
+ * elf32-sh-symbian.c: Likewise.
+ * elf32-sh.c: Likewise.
+ * elf32-sh64.c: Likewise.
+ * elf32-v850.c: Likewise.
+ * elf32-vax.c: Likewise.
+ * elf32-xtensa.c: Likewise.
+ * elf64-alpha.c: Likewise.
+ * elf64-hppa.c: Likewise.
+ * elf64-mmix.c: Likewise.
+ * elf64-ppc.c: Likewise.
+ * elf64-s390.c: Likewise.
+ * elf64-sh64.c: Likewise.
+ * elf64-x86-64.c: Likewise.
+ * elflink.c: Likewise.
+ * elfxx-ia64.c: Likewise.
+ * elfxx-mips.c: Likewise.
+ * elfxx-sparc.c: Likewise.
+ * hpux-core.c: Likewise.
+ * i386linux.c: Likewise.
+ * ieee.c: Likewise.
+ * libpei.h: Likewise.
+ * linker.c: Likewise.
+ * m68klinux.c: Likewise.
+ * mmo.c: Likewise.
+ * nlmcode.h: Likewise.
+ * osf-core.c: Likewise.
+ * pef.c: Likewise.
+ * som.c: Likewise.
+ * sparclinux.c: Likewise.
+ * vms-hdr.c: Likewise.
+
+2006-09-14 Alan Modra <amodra@bigpond.net.au>
+
+ PR 3181
+ * elf.c (_bfd_elf_copy_private_header_data): Fix group members
+ that have had their SHT_GROUP section removed.
+
+2006-09-12 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/3197
+ * elflink.c (elf_link_output_extsym): Compute bucket only if
+ needed.
+
+2006-09-10 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/3186
+ * elf.c (_bfd_elf_make_section_from_shdr): Correct length of
+ "gnu.linkonce.wi.".
+
+2006-09-08 Vladimir Prus <vladimir@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_swap_symbol_out): Remove
+ unconditional setting of low bit for Thumb symbol
+ mistakenly left behind after check for external
+ symbols was added. Fix comment typo.
+
+2006-09-07 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf-bfd.h (elf_link_hash_entry): Add a dynamic field.
+ (bfd_elf_link_mark_dynamic_symbol): New.
+ (SYMBOLIC_BIND): New.
+
+ * elf32-i386.c (elf_i386_check_relocs): Replace info->symbolic
+ with SYMBOLIC_BIND (info, h).
+ (elf_i386_relocate_section): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_check_relocs): Likewise.
+ (elf64_x86_64_relocate_section): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_check_relocs): Likewise.
+
+ * elflink.c (bfd_elf_link_mark_dynamic_symbol): New.
+ (bfd_elf_record_link_assignment): Call
+ bfd_elf_link_mark_dynamic_symbol on new entry.
+ (_bfd_elf_merge_symbol): Likewise.
+ (_bfd_elf_export_symbol): Return if the symbol isn't exported.
+ (_bfd_elf_fix_symbol_flags): Replace info->symbolic with
+ SYMBOLIC_BIND (info, h).
+ (_bfd_elf_dynamic_symbol_p): Likewise.
+ (_bfd_elf_symbol_refs_local_p): Likewise.
+ (bfd_elf_size_dynamic_sections): Updated.
+
+2006-09-05 Bibo Mao <bibo.mao@intel.com>
+
+ PR binutils/3171
+ * coffcode.h (coff_write_object_contents): Set the optional
+ header magic number to PE32PMAGIC instead of ZMAGIC for ia64.
+
+2006-09-04 Mark Shinwell <shinwell@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_howto_table_1): Adjust entries for
+ R_ARM_THM_ALU_PREL_11_0 and R_ARM_THM_PC12 relocations.
+ (elf32_arm_final_link_relocate): Handle R_ARM_THM_ALU_PREL_11_0
+ and R_ARM_THM_PC12 relocations.
+
+2006-08-24 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (xtensa_get_property_section_name): Delete.
+ (xtensa_get_property_section): New.
+ (xtensa_read_table_entries): Use xtensa_get_property_section.
+ (relax_property_section, xtensa_get_property_predef_flags): Handle
+ group name suffixes in property section names.
+ (match_section_group): New.
+
+2006-08-23 Frediano Ziglio <Frediano.Ziglio@vodafone.com>
+
+ * archive.c (hpux_uid_gid_encode): Fix thinko decrementing "cnt"
+ variable.
+
+2006-08-22 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_copy_indirect_symbol): Only copy
+ plt_thumb_refcount from indirect symbols.
+
+2006-08-22 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.c (ppc_elf_relocate_section): Correct GOT and PLT HA
+ reloc handling.
+ * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
+
+2006-08-21 Mark Shinwell <shinwell@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_link_hash_table): Correct typo in
+ comment for target1_is_rel.
+
+2006-08-21 Pedro Alves <pedro_alves@portugalmail.pt>
+
+ * Makefile.am: Add rules to build pe-arm-wince.lo
+ and pei-arm-wince.lo objects.
+ * Makefile.in: Regenerate.
+ * pe-arm-wince.c: New file.
+ * pei-arm-wince.c: New file.
+ * pei-arm.c: Remove ARM_WINCE block.
+ * pe-arm.c: Remove ARM_WINCE block. Rename
+ bfd_arm_pe_allocate_interworking_sections,
+ bfd_arm_pe_get_bfd_for_interworking, and
+ bfd_arm_pe_process_before_allocation to
+ bfd_armpe_allocate_interworking_sections,
+ bfd_armpe_get_bfd_for_interworking, and
+ bfd_armpe_process_before_allocation. Move them before
+ including bfd.h.
+ * bfd.c: ARM wince bfd format names were renamed. Adjust.
+ * coff-arm.c [ARM_WINCE]: Adjust so Windows CE doesn't end up
+ with unexpected/conflicting relocs.
+ * targets.c: The arm-wince-pe target got its own new vector.
+ Adjust.
+ * config.bfd: Likewise.
+ * configure.in: Likewise.
+ * configure: Regenerate.
+
+2006-08-18 Paul Brook <paul@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_link_hash_entry): Add export_glue.
+ (elf32_arm_link_hash_newfunc): Initialize export_glue.
+ (record_arm_to_thumb_glue): Return stub symbol.
+ (elf32_arm_create_thumb_stub): New function.
+ (elf32_arm_to_thumb_stub): Use it.
+ (elf32_arm_to_thumb_export_stub): New function.
+ (elf32_arm_begin_write_processing): New function.
+ (allocate_dynrelocs): Allocate Arm stubs.
+ (elf_backend_begin_write_processing): Define.
+ (elf32_arm_symbian_begin_write_processing): Remove ATTRIBUTE_UNUSED.
+ Call elf32_arm_begin_write_processing.
+
+2006-08-17 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (create_linkage_sections): Align .glink to 8 bytes.
+ (ppc64_elf_build_stubs): Use new lazy linking stub.
+
+2006-08-17 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_size_stubs): Ignore non-code sections.
+
+2006-08-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/3015
+ * elf.c (get_program_header_size): Add a PT_GNU_RELRO segment
+ only if there is a PT_DYNAMIC segment.
+ (_bfd_elf_map_sections_to_segments): Likewise.
+ (assign_file_positions_for_load_sections): Set PT_GNU_RELRO
+ segment alignment to 1.
+
+2006-08-15 Thiemo Seufer <ths@mips.com>
+ Nigel Stephens <nigel@mips.com>
+
+ * elf32-mips.c, elf64-mips.c, elfn32-mips.c
+ (elf_backend_merge_symbol_attribute): Define.
+ * elflink.c (elf_link_add_object_symbols): Merge only the ELF
+ visibility flags.
+ * elfxx-mips.c (_bfd_mips_elf_merge_symbol_attribute): New function.
+
+2006-08-15 Thiemo Seufer <ths@mips.com>
+ Nigel Stephens <nigel@mips.com>
+ David Ung <davidu@mips.com>
+
+ * config.bfd: Add configurations for mips*el-sde-elf* and
+ mips*-sde-elf*.
+
+2006-08-14 DJ Delorie <dj@redhat.com>
+
+ * elf-m10300.c (elf32_mn10300_link_hash_entry): Add value.
+ (elf32_mn10300_count_hash_table_entries): New.
+ (elf32_mn10300_list_hash_table_entries): New.
+ (sort_by_value): New.
+ (mn10300_elf_relax_section): Don't skip data sections; restrict
+ code-specific tests to code-specific areas so that potential
+ indirect calls can be detected. Check for multiple local symbols
+ at the same address and merge their flags.
+ (elf32_mn10300_link_hash_newfunc): Initialize value.
+
+2006-08-14 Thiemo Seufer <ths@mips.com>
+
+ * elfxx-mips.c (_bfd_mips_elf_symbol_processing,
+ _bfd_mips_elf_add_symbol_hook): Don't try to place small common TLS
+ symbols in .scommon.
+
+2006-08-11 Thiemo Seufer <ths@mips.com>
+
+ * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_sections): Set
+ sh_entsize only when sgot was already initialized.
+
+2006-08-08 DJ Delorie <dj@redhat.com>
+
+ * elf32-sh.c (sh_elf_relax_section): Allow for branches across
+ non-moving .align directives. Preserve any DIR32 offset when
+ converting bsr's to jsr's.
+
+2006-08-08 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_build_stubs): Clear relbrlt reloc_count
+ after stubs have been built.
+
+2006-08-07 Nick Clifton <nickc@redhat.com>
+
+ * elf32-sh.c (vxworks_object_p): Only check for vxworks target
+ vectors if they are going to be created.
+
+2006-08-07 Nick Clifton <nickc@redhat.com>
+
+ * configure.in (bfd_elf32_shnbsd_vec): Fix typo.
+ * configure: Regenerate.
+
+2006-08-07 Nick Clifton <nickc@redhat.com>
+
+ * coff-arm.c (coff_arm_rtype_to_howto): Only check for ARM_SECREL
+ relocation types if the target is ARM_WINCE.
+
+2006-08-05 Pedro Alves <pedro_alves@portugalmail.pt>
+
+ * bfd.c (bfd_get_sign_extend_vma): Add cases for pe-arm-little
+ and pei-arm-little.
+ * coff-arm.c (coff_arm_rtype_to_howto) [COFF_WITH_PE]: Handle
+ ARM_SECREL.
+ (coff_arm_reloc_type_lookup): Map BFD_RELOC_32_SECREL to
+ ARM_SECREL.
+ * pe-arm.c [COFF_SECTION_ALIGNMENT_ENTRIES]: Define.
+ * pei-arm.c [TARGET_UNDERSCORE]: Define for ARM_WINCE like in
+ pe-arm.c.
+ [COFF_SECTION_ALIGNMENT_ENTRIES]: Define.
+
+2006-08-04 Marcelo Tosatti <marcelo@kvack.org>
+
+ * elflink.c (elf_gc_sweep): If info.print_gc_sections is true,
+ list removed sections to stderr.
+
+2006-08-04 Richard Sandiford <richard@codesourcery.com>
+ Kazu Hirata <kazu@codesourcery.com>
+ Phil Edwards <phil@codesourcery.com>
+ Nathan Sidwell <nathan@codesourcery.com>
+
+ * config.bfd (sh-*-vxworks): Use bfd_elf32_shvxworks_vec and
+ bfd_elf32_shlvxworks_vec.
+ * configure.in (bfd_elf32_sh64_vec): Add elf-vxworks.lo.
+ (bfd_elf32_sh64l_vec, bfd_elf32_sh64lin_vec): Likewise.
+ (bfd_elf32_sh64blin_vec, bfd_elf32_sh64lnbsd_vec): Likewise.
+ (bfd_elf32_sh64nbsd_vec, bfd_elf32_sh_vec): Likewise.
+ (bfd_elf32_shblin_vec, bfd_elf32_shl_vec): Likewise.
+ (bfd_elf32_shl_symbian_vec, bfd_elf32_shlin_vec): Likewise.
+ (bfd_elf32_shlnbsd_vec, bfd_elf32_shnbsd_vec): Likewise.
+ (bfd_elf32_shlvxworks_vec, bfd_elf32_shvxworks_vec): New stanzas.
+ * configure: Regenerate.
+ * Makefile.am: Regenerate dependencies.
+ * Makefile.in: Regenerate.
+ * elf-vxworks.c (elf_vxworks_gott_symbol_p): New function.
+ (elf_vxworks_add_symbol_hook): Use it.
+ (elf_vxworks_link_output_symbol_hook): Likewise. Use the hash
+ table entry to check for weak undefined symbols and to obtain
+ the original bfd.
+ (elf_vxworks_emit_relocs): Use target_index instead of this_idx.
+ * elf32-sh-relocs.h: New file, split from elf32-sh.c.
+ (R_SH_DIR32): Use SH_PARTIAL32 for the partial_inplace field,
+ SH_SRC_MASK32 for the src_mask field, and SH_ELF_RELOC for the
+ special_function field.
+ (R_SH_REL32): Use SH_PARTIAL32 and SH_SRC_MASK32 here too.
+ (R_SH_REL32, R_SH_TLS_GD_32, R_SH_TLS_LD_32): Likewise.
+ (R_SH_TLS_LDO_32, R_SH_TLS_IE_32, R_SH_TLS_LE_32): Likewise.
+ (R_SH_TLS_DTPMOD32, R_SH_TLS_DTPOFF32, R_SH_TLS_TPOFF32): Likewise.
+ (R_SH_GOT32, R_SH_PLT32, R_SH_COPY, R_SH_GLOB_DAT): Likewise.
+ (R_SH_JMP_SLOT, R_SH_RELATIVE, R_SH_GOTOFF, R_SH_GOTPC): Likewise.
+ (SH_PARTIAL32, SH_SRC_MASK32, SH_ELF_RELOC): Undefine at end of file.
+ * elf32-sh.c: Include elf32-vxworks.h.
+ (MINUS_ONE): Define.
+ (sh_elf_howto_table): Include elf32-sh-relocs.h with SH_PARTIAL32
+ set to TRUE, SH_SRC_MASK32 set to 0xffffffff, and SH_ELF_RELOC set
+ to sh_elf_reloc.
+ (sh_vxworks_howto_table): New variable. Include elf32-sh-relocs.h
+ with SH_PARTIAL32 set to FALSE, SH_SRC_MASK32 set to 0, and
+ SH_ELF_RELOC set to bfd_elf_generic_reloc.
+ (vxworks_object_p, get_howto_table): New functions.
+ (sh_elf_reloc_type_lookup): Fix typo. Use get_howto_table.
+ (sh_elf_info_to_howto): Use get_howto_table.
+ (sh_elf_relax_section): Honor the partial_inplace field of the
+ R_SH_DIR32 howto.
+ (sh_elf_relax_delete_bytes): Likewise.
+ (elf_sh_plt_info): New structure.
+ (PLT_ENTRY_SIZE): Replace both definitions with...
+ (ELF_PLT_ENTRY_SIZE): ...this new macro, with separate definitions for
+ INCLUDE_SHMEDIA and !INCLUDE_SHMEDIA.
+ (elf_sh_plt0_entry_be): Update sizes of both definitions accordingly.
+ (elf_sh_plt0_entry_le): Likewise.
+ (elf_sh_plt_entry_be, elf_sh_plt_entry_le): Likewise.
+ (elf_sh_pic_plt_entry_be, elf_sh_pic_plt_entry_le): Likewise.
+ (elf_sh_plts): New structure, with separate definitions for
+ INCLUDE_SHMEDIA and !INCLUDE_SHMEDIA.
+ (elf_sh_plt0_entry): Delete both definitions.
+ (elf_sh_plt_entry, elf_sh_pic_plt_entry): Likewise.
+ (elf_sh_sizeof_plt, elf_sh_plt_plt0_offset): Likewise.
+ (elf_sh_plt_temp_offset, elf_sh_plt_symbol_offset): Likewise.
+ (elf_sh_plt_reloc_offset): Likewise.
+ (movi_shori_putval): Delete in favor of...
+ (install_plt_field): ...this new function, with separate definitions
+ for INCLUDE_SHMEDIA and !INCLUDE_SHMEDIA.
+ (get_plt_info): New function, with separate definitions
+ for INCLUDE_SHMEDIA and !INCLUDE_SHMEDIA.
+ (elf_sh_plt0_linker_offset, elf_sh_plt0_gotid_offset): Delete.
+ (VXWORKS_PLT_HEADER_SIZE, VXWORKS_PLT_ENTRY_SIZE): New macros.
+ (vxworks_sh_plt0_entry_be, vxworks_sh_plt0_entry_le): New constants.
+ (vxworks_sh_plt_entry_be, vxworks_sh_plt_entry_le): Likewise.
+ (vxworks_sh_pic_plt_entry_be, vxworks_sh_pic_plt_entry_le): Likewise.
+ (get_plt_index, get_plt_offset): New functions.
+ (elf_sh_link_hash_table): Add srelplt2, plt_info and vxworks_p fields.
+ (sh_elf_link_hash_table_create): Initialize them.
+ (sh_elf_create_dynamic_sections): Call
+ elf_vxworks_create_dynamic_sections for VxWorks.
+ (allocate_dynrelocs): Use htab->plt_info to get the size of PLT
+ entries. Allocate relocation entries in .rela.plt.unloaded if
+ generating a VxWorks executable.
+ (sh_elf_always_size_sections): New function.
+ (sh_elf_size_dynamic_sections): Extend .rela.plt handling to
+ .rela.plt.unloaded.
+ (sh_elf_relocate_section): Use get_howto_table. Honor
+ partial_inplace when calculating the addend for dynamic
+ relocations. Use get_plt_index.
+ (sh_elf_finish_dynamic_symbol): Use get_plt_index, install_plt_field
+ and htab->plt_info. Fill in the bra .plt offset for VxWorks
+ executables. Populate .rela.plt.unloaded. Do not make
+ _GLOBAL_OFFSET_TABLE_ absolute on VxWorks.
+ (sh_elf_finish_dynamic_sections): Use install_plt_field and
+ htab->plt_info. Handle cases where there is no special PLT header.
+ Populate the first relocation in .rela.plt.unloaded and fix up
+ the remaining entries.
+ (sh_elf_plt_sym_val): Use get_plt_info.
+ (elf_backend_always_size_sections): Define.
+ (TARGET_BIG_SYM, TARGET_BIG_NAME): Override for VxWorks.
+ (TARGET_LITTLE_SYM, TARGET_BIG_SYM): Likewise.
+ (elf32_bed, elf_backend_want_plt_sym): Likewise.
+ (elf_symbol_leading_char, elf_backend_want_got_underscore): Likewise.
+ (elf_backend_grok_prstatus, elf_backend_grok_psinfo): Likewise.
+ (elf_backend_add_symbol_hook): Likewise.
+ (elf_backend_link_output_symbol_hook): Likewise.
+ (elf_backend_emit_relocs): Likewise.
+ (elf_backend_final_write_processing): Likewise.
+ (ELF_MAXPAGESIZE, ELF_COMMONPAGESIZE): Likewise.
+ * targets.c (bfd_elf32_shlvxworks_vec): Declare.
+ (bfd_elf32_shvxworks_vec): Likewise.
+ (_bfd_target_vector): Include bfd_elf32_shlvxworks_vec and
+ bfd_elf32_shvxworks_vec.
+
+2006-08-02 Mark Kettenis <kettenis@gnu.org>
+
+ * configure.in (arm-*-openbsd*): Set COREFILE to netbsd-core.lo.
+ * configure: Regenerate.
+
+2006-08-02 Petr Salinger <Petr.Salinger@seznam.cz>
+
+ PR binutils/2983
+ * elf64-x86-64.c: Add FreeBSD support.
+ (elf64_x86_64_fbsd_post_process_headers): New function.
+ * targets.c (_bfd_target_vector): Add bfd_elf64_x86_64_freebsd_vec.
+ * config.bfd (x64_64-*-freebsd*): Add bfd_elf64_x86_64_freebsd_vec
+ to the targ_selvecs.
+ * configure.in: Add entry for bfd_elf64_x86_64_freebsd_vec.
+ * configure: Regenerate.
+
+2006-07-26 Andreas Schwab <schwab@suse.de>
+
+ * elfxx-ia64.c (elfNN_ia64_choose_gp): Use rawsize if set.
+
+2006-07-26 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (elf_modify_segment_map): Delete empty PT_LOAD segments.
+ * elf32-xtensa.c (elf_xtensa_modify_segment_map): Delete.
+ (define elf_backend_modify_segment_map): Don't define.
+
+2006-07-25 Thiemo Seufer <ths@networkno.de>
+
+ * elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Allow
+ linking of objects for compatible machine types.
+
+2006-07-25 Thiemo Seufer <ths@networkno.de>
+
+ * elfxx-mips.c (mips_elf_next_relocation): Tighten check to test
+ also for same symbol.
+
+2006-07-25 Thiemo Seufer <ths@mips.com>
+
+ * elfxx-mips.c (mips_elf_calculate_relocation): Remove magic constant.
+
+2006-07-24 Michael Wetherell <mike.wetherell@ntlworld.com>
+
+ * elf.c (bfd_section_from_shdr): Reject unrecognised OS-specific
+ sections only if the SHF_OS_NONCONFORMING flag is present.
+
+2006-07-24 Nick Clifton <nickc@redhat.com>
+
+ PR ld/2729
+ * peXXigen.c (_bfd_XXi_final_link_postscript): Check for the
+ existance of output sections before putting their entries into the
+ DataDictionary.
+
+2006-07-20 Thiemo Seufer <ths@mips.com>
+
+ * elf32-mips.c (mips16_jump_reloc): Remove function.
+ (elf_mips16_howto_table_rel): Use _bfd_mips_elf_generic_reloc
+ instead of mips16_jump_reloc.
+ * elf64_mips.c, wlfn32-mips.c (mips16_jump_reloc): Remove function.
+ (elf_mips16_howto_table_rel, elf_mips16_howto_table_rela): Use
+ _bfd_mips_elf_generic_reloc instead of mips16_jump_reloc.
+
+2006-07-19 Alan Modra <amodra@bigpond.net.au>
+
+ * bfd-in.h (enum notice_asneeded_action): Define.
+ * bfd-in2.h: Regenerate.
+ * elflink.c (elf_link_add_object_symbols): Call linker "notice"
+ function with NULL name for as-needed handling.
+
+2006-07-18 Paul Brook <paul@codesourcery.com>
+
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+ * reloc.c: Add BFD_RELOC_ARM_T32_ADD_IMM.
+
+2006-07-18 Nick Clifton <nickc@redhat.com>
+
+ * elfxx-mips.c (_bfd_mips_elf_common_definition): New function.
+ Consider SHN_MIPS_ACOMMON and SHN_MIPS_SCOMMON as being common
+ sections.
+ * elfxx-mips.h (_bfd_mips_elf_common_definition): Prototype.
+
+2006-07-14 Jakub Jelinek <jakub@redhat.com>
+
+ * elflink.c (bfd_elf_size_dynsym_hash_dynstr): Fix cinfo.shift2 value.
+
+2006-07-14 Mark Kettenis <kettenis@gnu.org>
+
+ * elflink.c (bfd_elf_size_dynsym_hash_dynstr): Move declarations
+ to the start of a block.
+
+2006-07-13 Nick Clifton <nickc@redhat.com>
+
+ * coff-sh.c (_bfd_sh_align_load_span): Catch sh_insn_info()
+ returning a NULL value.
+
+2006-07-12 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/2884
+ * elflink.c (_bfd_elf_merge_symbol): Copy the symbol info from
+ the old versioned dynamic definition to the new one with
+ non-default visibility. Hide the symbol if it is hidden or
+ internal.
+
+2006-07-12 Matthew R. Dempsky <mrd@alkemio.org>
+
+ * cpu-m68k.c (bfd_m68k_compatible): Handle CPU32.
+
+2006-07-10 Jakub Jelinek <jakub@redhat.com>
+
+ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH.
+ (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers):
+ Handle SHT_GNU_HASH.
+ (special_sections_g): Include .gnu.hash section.
+ (bfd_elf_gnu_hash): New function.
+ * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes.
+ (struct elf_backend_data): Add elf_hash_symbol method.
+ * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash
+ only if info->emit_hash, create .gnu.hash section if
+ info->emit_gnu_hash.
+ (struct collect_gnu_hash_codes): New type.
+ (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms,
+ _bfd_elf_hash_symbol): New functions.
+ (compute_bucket_count): Don't compute HASHCODES array, instead add
+ that and NSYMS as arguments. Use bed->s->sizeof_hash_entry
+ instead of bed->s->arch_size / 8. Fix .hash size estimation.
+ When not optimizing, use the number of hashed symbols rather than
+ dynsymcount.
+ (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash,
+ and ADD DT_GNU_HASH if info->emit_gnu_hash.
+ (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash,
+ adjust compute_bucket_count caller. Create and populate .gnu.hash
+ section if info->emit_gnu_hash.
+ (elf_link_output_extsym): Only populate .hash section if
+ finfo->hash_sec != NULL.
+ (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH.
+ * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined.
+ (elfNN_bed): Add elf_backend_hash_symbol.
+ * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function.
+ (elf_backend_hash_symbol): Define.
+ * elf32-i386.c (elf_i386_hash_symbol): New function.
+ (elf_backend_hash_symbol): Define.
+
+2006-07-05 Nick Clifton <nickc@redhat.com>
+
+ PR ld/2659
+ * cofflink.c (_bfd_coff_link_input_bfd): Fix selection of aux
+ entry when multiple definitions of a symbol are encountered.
+
+2006-06-30 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf32-i386.c (elf_i386_relocate_section): Use xchg %ax,%ax
+ instead of 2 nops.
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
+ (elf64_x86_64_plt0_entry): Use nopl 0(%rax) instead of 4 nops.
+
+2006-06-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR ld/2513
+ * elf32-i386.c (GOT_TLS_MASK, GOT_TLS_IE_IE, GOT_TLS_IE_GD,
+ GOT_TLS_IE_MASK, elf_i386_check_relocs, allocate_dynrelocs): Revert
+ 2006-04-08 changes.
+ (elf_i386_relocate_section): Likewise. For GD->IE transition
+ change subl into addl whenever tls_type is GOT_TLS_IE_POS.
+
+2006-06-23 Alan Modra <amodra@bigpond.net.au>
+
+ PR ld/2754
+ * elf.c (bfd_elf_mkobject): Don't alloc if already done. Set
+ program_header_size to -1.
+ (_bfd_elf_map_sections_to_segments): Adjust program_header_size check.
+ (assign_file_positions_for_load_sections ): Likewise.
+ (_bfd_elf_sizeof_headers): Use saved program_header_size if
+ available.
+ * elf32-arm.c (elf32_arm_mkobject): Call bfd_elf_mkobject, don't
+ alloc if already done.
+ * elf32-i386.c (elf_i386_mkobject): Likewise.
+ * elf32-ppc.c (ppc_elf_mkobject): Likewise.
+ * elf32-s390.c (elf_s390_mkobject): Likewise.
+ * elf32-sh.c (sh_elf_mkobject): Likewise.
+ * elf64-alpha.c (elf64_alpha_mkobject): Likewise.
+ * elf64-ppc.c (ppc64_elf_mkobject): Likewise.
+ * elf64-s390.c (elf_s390_mkobject): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_mkobject): Likewise.
+ * elfxx-sparc.c (_bfd_sparc_elf_mkobject): Likewise.
+
+2006-06-20 Jakub Jelinek <jakub@redhat.com>
+
+ * elflink.c (elf_link_add_object_symbols): Don't create .tcommon
+ section for relocatable link.
+
+2006-06-21 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct elf_backend_data): Add
+ elf_backend_modify_program_headers.
+ * elfxx-target.h (elf_backend_modify_program_headers): Define.
+ (elfNN_bed): Init new field.
+ * elf.c (elf_modify_segment_map): Remove comment.
+ (assign_file_positions_for_load_sections): Only call
+ elf_modify_segment_map for objcopy/strip.
+ (assign_file_positions_except_relocs): Call
+ elf_backend_modify_program_headers.
+ * elf32-frv.c (elf32_frvfdpic_always_size_sections): Don't make
+ .stack section.
+ (elf32_frvfdpic_modify_segment_map): Delete.
+ (elf32_frvfdpic_modify_program_headers): New.
+ (elf_backend_modify_segment_map): Don't define.
+ (elf_backend_modify_program_headers): Define.
+ * elf32-bfin.c (elf32_bfinfdpic_always_size_sections): Don't make
+ .stack section.
+ (elf32_bfinfdpic_modify_segment_map): Delete.
+ (elf32_bfinfdpic_modify_program_headers): New.
+ (elf_backend_modify_segment_map): Don't define.
+ (elf_backend_modify_program_headers): Define.
+ * elfxx-ia64.c (elfNN_ia64_modify_program_headers): New function.
+ Split out from..
+ (elfNN_ia64_modify_segment_map): ..here.
+ (elf_backend_modify_program_headers): Define.
+
+2006-06-20 Jakub Jelinek <jakub@redhat.com>
+
+ * bfd.c (bfd_record_phdr): Clear p_align and p_align_valid fields.
+ * elf.c (_bfd_elf_link_hash_table_init): Clear hplt field.
+
+2006-06-20 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h: Formatting.
+ (_bfd_elf_map_sections_to_segments): Declare.
+ * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame_hdr): Don't
+ clear program_header_size.
+ * elf.c (get_program_header_size): Move. Don't use or set saved
+ program_header_size here.
+ (elf_modify_segment_map): New function. Split out from..
+ (assign_file_positions_for_load_sections): ..here. Assert
+ header size is correct. Remove dead code.
+ (_bfd_elf_map_sections_to_segments): Rename from
+ map_sections_to_segments. Make global. Use get_program_header_size
+ when we need estimate of header size. Call elf_modify_segment_map.
+ Set program_header_size.
+ (print_segment_map): Delete.
+ (_bfd_elf_sizeof_headers): If segment_map available, get the
+ actual size.
+ * elf32-arm.c (elf32_arm_symbian_modify_segment_map): Make safe
+ for calling more than once.
+ * elf32-bfin.c (elf32_bfinfdpic_modify_segment_map): Likewise.
+ * elf32-frv.c (elf32_frvfdpic_modify_segment_map): Likewise.
+ * elfxx-mips.c (_bfd_mips_elf_modify_segment_map): Likewise.
+ * elf32-i370.c (elf_backend_add_symbol_hook): Delete.
+ (elf_backend_additional_program_headers): Delete.
+ (elf_backend_modify_segment_map): Delete.
+ * elf64-hppa.c (elf64_hppa_modify_segment_map): Convert to ISO C.
+ * elfxx-ia64.c (elfNN_ia64_modify_segment_map): Likewise.
+ * doc/bfdint.texi: Delete SIZEOF_HEADERS difficulties.
+
+2006-06-19 Vladimir Prus <vladimir@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_swap_symbol_out): Don't set low
+ bit for undefined symbols.
+
+2006-06-19 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct elf_backend_data): Add bfd_link_info pointer
+ parameter.
+ (_bfd_elf_sizeof_headers): Replace bfd_boolean param with
+ bfd_link_info pointer.
+ * targets.c (struct bfd_target <_bfd_sizeof_headers>): Likewise.
+ * bfd.c (bfd_sizeof_headers): Tweak param name.
+ * aout-adobe.c (aout_adobe_sizeof_headers): Adjust.
+ * aoutx.h (NAME (aout, sizeof_headers)): Adjust.
+ * binary.c (binary_sizeof_headers): Adjust.
+ * bout.c (b_out_sizeof_headers): Adjust.
+ * coff-rs6000.c (_bfd_xcoff_sizeof_headers): Adjust.
+ * coff64-rs6000.c (xcoff64_sizeof_headers): Adjust.
+ * coffgen.c (coff_sizeof_headers): Adjust.
+ * ecoff.c (_bfd_ecoff_sizeof_headers): Adjust.
+ (ecoff_compute_section_file_positions): Adjust.
+ (_bfd_ecoff_write_object_contents): Adjust.
+ * elf.c (get_program_header_size, _bfd_elf_sizeof_headers): Adjust.
+ * elf32-arm.c (elf32_arm_additional_program_headers): Adjust.
+ * elf32-i370.c (elf_backend_additional_program_headers): Adjust.
+ * elf32-ppc.c (ppc_elf_additional_program_headers): Adjust.
+ * elf64-hppa.c (elf64_hppa_additional_program_headers): Adjust.
+ * elf64-x86-64.c (elf64_x86_64_additional_program_headers): Adjust.
+ * elfxx-ia64.c (elfNN_ia64_additional_program_headers): Adjust.
+ * elfxx-mips.c (_bfd_mips_elf_additional_program_headers): Adjust.
+ * elfxx-mips.h (_bfd_mips_elf_additional_program_headers): Adjust.
+ * i386msdos.c: Convert to ISO C.
+ (msdos_sizeof_headers): Adjust.
+ * i386os9k.c: Convert to ISO C.
+ (os9k_sizeof_headers): Adjust.
+ * ieee.c (ieee_sizeof_headers): Adjust.
+ * ihex.c (ihex_sizeof_headers): Adjust.
+ * libaout.h (NAME (aout, sizeof_headers)): Adjust.
+ * libbfd-in.h (_bfd_nolink_sizeof_headers): Adjust.
+ * libcoff-in.h (coff_sizeof_headers): Adjust.
+ * libecoff.h (_bfd_ecoff_sizeof_headers): Adjust.
+ * mach-o.c (bfd_mach_o_sizeof_headers): Adjust.
+ * mmo.c (mmo_sizeof_headers): Adjust.
+ * oasys.c (oasys_sizeof_headers): Adjust.
+ * pdp11.c (NAME (aout, sizeof_headers)): Adjust.
+ * pef.c (bfd_pef_sizeof_headers): Adjust.
+ * ppcboot.c (ppcboot_sizeof_headers): Adjust.
+ * som.c (som_sizeof_headers): Adjust.
+ * srec.c (srec_sizeof_headers): Adjust.
+ * tekhex.c (tekhex_sizeof_headers): Adjust.
+ * versados.c (versados_sizeof_headers): Adjust.
+ * vms.c (vms_sizeof_headers): Adjust.
+ * xcoff-target.h (_bfd_xcoff_sizeof_headers): Adjust.
+ * xsym.c (bfd_sym_sizeof_headers): Adjust.
+ * xsym.h (bfd_sym_sizeof_headers): Adjust.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+ * libcoff.h: Regenerate.
+
+2006-06-15 Mark Shinwell <shinwell@codesourcery.com>
+
+ * bfd-in2.h: Regenerate.
+ * elf32-arm.c (R_ARM_ALU_PC_G0_NC, R_ARM_ALU_PC_G0,
+ R_ARM_ALU_PC_G1_NC, R_ARM_ALU_PC_G1, R_ARM_ALU_PC_G2,
+ R_ARM_LDR_PC_G1, R_ARM_LDR_PC_G2, R_ARM_LDRS_PC_G0,
+ R_ARM_LDRS_PC_G1, R_ARM_LDRS_PC_G2, R_ARM_LDC_PC_G0,
+ R_ARM_LDC_PC_G1, R_ARM_LDC_PC_G2, R_ARM_ALU_SB_G0_NC,
+ R_ARM_ALU_SB_G0, R_ARM_ALU_SB_G1_NC, R_ARM_ALU_SB_G1,
+ R_ARM_ALU_SB_G2, R_ARM_LDR_SB_G0, R_ARM_LDR_SB_G1,
+ R_ARM_LDR_SB_G2, R_ARM_LDRS_SB_G0, R_ARM_LDRS_SB_G1,
+ R_ARM_LDRS_SB_G2, R_ARM_LDC_SB_G0, R_ARM_LDC_SB_G1,
+ R_ARM_LDC_SB_G2): New relocation types.
+ (R_ARM_PC13): Rename to AAELF name R_ARM_LDR_PC_G0 and
+ adjust HOWTO entry to be consistent with R_ARM_LDR_PC_G1
+ and friends.
+ (elf32_arm_howto_table_3): Delete; contents merged into
+ elf32_arm_howto_table_2.
+ (elf32_arm_howto_from_type): Adjust correspondingly.
+ (elf32_arm_reloc_map): Extend with the above relocations.
+ (calculate_group_reloc_mask): New function.
+ (identify_add_or_sub): New function.
+ (elf32_arm_final_link_relocate): Support for the above
+ relocations.
+ * reloc.c: Add enumeration entries for BFD_RELOC_ARM_...
+ codes to correspond to the above relocations.
+
+2006-06-14 Richard Sandiford <richard@codesourcery.com>
+
+ * elf32-m68k.c (elf_m68k_plt_info): New structure.
+ (elf_m68k_plt0_entry): Add R_68K_PC32-style in-place addends.
+ (elf_m68k_plt_entry): Likewise.
+ (elf_m68k_plt_info): New table.
+ (CFV4E_PLT_ENTRY_SIZE): Rename to...
+ (ISAB_PLT_ENTRY_SIZE): ...this.
+ (CFV4E_FLAG): Delete.
+ (elf_cfv4e_plt0_entry): Rename to...
+ (elf_isab_plt0_entry): ...this. Adjust comments. Use (-6,%pc,%d0)
+ for the second instruction too.
+ (elf_cfv4e_plt_entry): Rename to...
+ (elf_isab_plt_entry): ...this. Adjust comments and use (-6,%pc,%d0).
+ (elf_isab_plt_info): New table.
+ (CPU32_FLAG): Delete.
+ (PLT_CPU32_ENTRY_SIZE): Rename to...
+ (CPU32_PLT_ENTRY_SIZE): ...this.
+ (elf_cpu32_plt0_entry): Update bounds accordingly. Add R_68K_PC32-
+ style in-place addends.
+ (elf_cpu32_plt_entry): Likewise.
+ (elf_cpu32_plt_info): New table.
+ (elf_m68k_link_hash_table): Add a plt_info field.
+ (elf_m68k_link_hash_table_create): Initialize it.
+ (elf_m68k_get_plt_info): New function.
+ (elf_m68k_always_size_sections): Likewise.
+ (elf_m68k_adjust_dynamic_symbol): Use the plt_info hash table field.
+ (elf_m68k_install_pc32): New function.
+ (elf_m68k_finish_dynamic_symbol): Factor code using plt_info and
+ elf_m68k_install_pc32.
+ (elf_m68k_finish_dynamic_sections): Likewise.
+ (elf_m68k_plt_sym_val): Use elf_m68k_get_plt_info.
+ (elf_backend_always_size_sections): Define.
+
+2006-06-14 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.c (elf_link_add_object_symbols): Save and restore
+ struct bfd_hash_table table, size and count fields for
+ as-needed libs.
+
+2006-06-12 Thiemo Seufer <ths@mips.com>
+
+ * elf32-mips.c: Expand comment about ABI-mandated pagesize values.
+ (ELF_MAXPAGESIZE, ELF_COMMONPAGESIZE): define in a more obvious way.
+ * elf64-mips.c, elfn32-mips.c (ELF_MAXPAGESIZE): Fix value for IRIX6.
+ Delete old comments.
+ (ELF_COMMONPAGESIZE): Define in a more obvious way.
+
+2006-06-12 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/2735
+ * elflink.c (elf_link_add_object_symbols): Fix the warning message
+ about mismatched alignments to allow for the case where the common
+ alignment has been deduced from the section alignment.
+ * bfd.c (_bfd_default_error_handler): Update comment to explain
+ why bfd and asection varargs are out of order. Explicitly catch
+ and abort on NULL bfd and asection arguments.
+
+2006-06-11 Richard Sandiford <richard@codesourcery.com>
+ Thiemo Seufer <ths@mips.com>
+
+ * elfxx-mips.c (mips_elf_link_hash_table): Add function_stub_size.
+ (STUB_ORI): New macro.
+ (STUB_LI16U): Fix formatting.
+ (MIPS_FUNCTION_STUB_SIZE): Delete.
+ (MIPS_FUNCTION_STUB_MAX_SIZE): Likewise.
+ (MIPS_FUNCTION_STUB_NORMAL_SIZE): New macro.
+ (MIPS_FUNCTION_STUB_BIG_SIZE): Likewise.
+ (_bfd_mips_elf_adjust_dynamic_symbol): Use htab->function_stub_size
+ instead of MIPS_FUNCTION_STUB_SIZE.
+ (count_section_dynsyms): New function, split out from
+ _bfd_mips_elf_final_link.
+ (_bfd_mips_elf_always_size_sections): Get a worst-case estimate
+ of the number of dynamic symbols needed and use it to set up
+ function_stub_size. Use function_stub_size rather than
+ MIPS_FUNCTION_STUB_SIZE to determine the size of the stub section.
+ Use 16-byte stubs for 0x10000 dynamic symbols.
+ (_bfd_mips_elf_size_dynamic_sections): Use htab->function_stub_size
+ instead of MIPS_FUNCTION_STUB_SIZE. Fix formatting.
+ (_bfd_mips_elf_finish_dynamic_symbol): Likewise. Change the
+ size of the stub buffer from MIPS_FUNCTION_STUB_MAX_SIZE to
+ MIPS_FUNCTION_STUB_BIG_SIZE. Tweak the check for unhandled dynindxes.
+ Use MIPS_FUNCTION_STUB_BIG_SIZE rather than a hard-coded 20.
+ Use STUB_ORI rather than STUB_LI16U for big stubs.
+ (_bfd_mips_elf_link_hash_table_create): Initialize function_stub_size.
+ (_bfd_mips_elf_final_link): Use count_section_dynsyms.
+
+2006-06-09 David Ung <davidu@mips.com>
+
+ * bfd/elfxx-mips.c (mips_elf_calculate_relocation): Fix mode for stub
+ calling relocations.
+
+2006-06-08 David Daney <ddaney@avtrex.com>
+
+ * elfxx-mips.c (STUB_LI16): Removed.
+ (STUB_LUI): New macro.
+ (STUB_LI16U): Ditto.
+ (STUB_LI16S): Ditto.
+ (MIPS_FUNCTION_STUB_SIZE): Rewrote to take info parameter.
+ (_bfd_mips_elf_adjust_dynamic_symbol): Pass info parameter to
+ MIPS_FUNCTION_STUB_SIZE.
+ (_bfd_mips_elf_always_size_sections): Ditto.
+ (_bfd_mips_elf_size_dynamic_sections): Ditto.
+ (_bfd_mips_elf_finish_dynamic_sections): Ditto.
+ (_bfd_mips_elf_finish_dynamic_symbol): Rewrote stub generation
+ to allow larger symbol table indexes.
+
+2006-06-07 Joseph S. Myers <joseph@codesourcery.com>
+
+ * po/Make-in (pdf, ps): New dummy targets.
+
+2006-06-06 Alan Modra <amodra@bigpond.net.au>
+
+ * hash.c (bfd_hash_lookup): Correct stray line.
+
+ * elf.c (_bfd_elf_init_private_section_data): Comment typo.
+ (elfcore_grok_nto_status): Use long instead of pid_t.
+ (elfcore_grok_nto_regs, elfcore_grok_nto_note): Likewise.
+
+2006-06-05 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * po/Make-in (top_builddir): Define.
+
+2006-06-05 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am: Run "make dep-am".
+ * Makefile.in: Regenerate.
+ * config.in: Regenerate.
+
+2006-06-02 Alan Modra <amodra@bigpond.net.au>
+ H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/2723
+ * elflink.c (bfd_elf_final_link): Don't output section symbols
+ for special ELF sections.
+
+2006-06-01 Alan Modra <amodra@bigpond.net.au>
+
+ * stabs.c (_bfd_link_section_stabs): Use bfd_make_section*_with_flags
+ instead of bfd_make_section*.
+ * aix386-core.c: Likewise.
+ * aix5ppc-core.c: Likewise.
+ * aout-adobe.c: Likewise.
+ * aoutf1.h: Likewise.
+ * binary.c: Likewise.
+ * cisco-core.c: Likewise.
+ * coff-arm.c: Likewise.
+ * coff-h8300.c: Likewise.
+ * elf.c: Likewise.
+ * elf32-bfin.c: Likewise.
+ * elf32-m32c.c: Likewise.
+ * hppabsd-core.c: Likewise.
+ * hpux-core.c: Likewise.
+ * i386linux.c: Likewise.
+ * ieee.c: Likewise.
+ * ihex.c: Likewise.
+ * irix-core.c: Likewise.
+ * lynx-core.c: Likewise.
+ * m68klinux.c: Likewise.
+ * mach-o.c: Likewise.
+ * netbsd-core.c: Likewise.
+ * nlmcode.h: Likewise.
+ * opncls.c: Likewise.
+ * osf-core.c: Likewise.
+ * peXXigen.c: Likewise.
+ * ppcboot.c: Likewise.
+ * ptrace-core.c: Likewise.
+ * rs6000-core.c: Likewise.
+ * sco5-core.c: Likewise.
+ * sparclinux.c: Likewise.
+ * srec.c: Likewise.
+ * sunos.c: Likewise.
+ * trad-core.c: Likewise.
+ * xcofflink.c: Likewise.
+ * xsym.c: Likewise.
+
+2006-05-31 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * Makefile.am (INCLUDES): Use @INCINTL@.
+ * acinclude.m4: Include new gettext macros.
+ * configure.in: Use ZW_GNU_GETTEXT_SISTER_DIR and AM_PO_SUBDIRS.
+ Manually substitute POFILES and GMOFILES.
+ * Makefile.in, aclocal.m4, configure, doc/Makefile.in: Regenerated.
+
+2006-05-30 H.J. Lu <hongjiu.lu@intel.com>
+
+ * bfd.c (bfd_emul_get_maxpagesize): New.
+ (bfd_elf_set_pagesize): Likewise.
+ (bfd_emul_set_maxpagesize): Likewise.
+ (bfd_emul_get_commonpagesize): Likewise.
+ (bfd_emul_set_commonpagesize): Likewise.
+ * bfd-in2.h: Regenerated.
+
+ * elf-bfd.h (elf_backend_data): Add commonpagesize.
+ (xvec_get_elf_backend_data): New.
+ (get_elf_backend_data): Use xvec_get_elf_backend_data.
+
+ * elf32-arm.c (elf32_arm_vxworks_bed): Remove const.
+ * elfxx-target.h (elfNN_bed): Likewise.
+
+ * elf32-arm.c (ELF_COMMONPAGESIZE): Defined.
+ * elf32-mips.c (ELF_COMMONPAGESIZE): Likewise.
+ * elf32-ppc.c (ELF_COMMONPAGESIZE): Likewise.
+ * elf32-sh.c (ELF_COMMONPAGESIZE): Likewise.
+ * elf32-sh64.c (ELF_COMMONPAGESIZE): Likewise.
+ * elf32-sparc.c (ELF_COMMONPAGESIZE): Likewise.
+ * elf64-alpha.c (ELF_COMMONPAGESIZE): Likewise.
+ * elf64-ppc.c (ELF_COMMONPAGESIZE): Likewise.
+ * elf64-sparc.c (ELF_COMMONPAGESIZE): Likewise.
+ * elf64-x86-64.c (ELF_COMMONPAGESIZE): Likewise.
+ * elfn32-mips.c (ELF_COMMONPAGESIZE): Likewise.
+ * elfxx-ia64.c (ELF_COMMONPAGESIZE): Likewise.
+
+ * elfxx-target.h (ELF_COMMONPAGESIZE): Define if not defined.
+ (elfNN_bed): Initialize commonpagesize with ELF_COMMONPAGESIZE.
+
+ * targets.c (bfd_find_target): Support NULL abfd.
+
+2006-05-30 Nick Clifton <nickc@redhat.com>
+
+ * po/es.po: Updated Spanish translation.
+
+2006-05-27 Alan Modra <amodra@bigpond.net.au>
+ H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf.c (assign_file_positions_for_load_sections): Retrieve
+ maxpagesize from m->p_align if it is valid. Set p_vaddr,
+ p_paddr and p_align earlier. Revert 2006-05-19 change to p_align.
+ (copy_elf_program_header): Copy p_align. Set p_align_valid.
+
+2006-05-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf64-x86-64.c (ELF_MINPAGESIZE): Changed to 0x1000.
+
+2006-05-25 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf64-x86-64.c (ELF_MINPAGESIZE): Set to 0x100000.
+
+2006-05-25 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf64-x86-64.c (ELF_MAXPAGESIZE): Updated to 0x200000.
+
+2006-05-26 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (sym_is_global): Return a bfd_boolean.
+ (ignore_section_sym): New function.
+ (elf_map_symbols): Use ignore_section_sym to discard some syms.
+ (_bfd_elf_symbol_from_bfd_symbol): Ensure section belongs to
+ bfd before using elf_section_syms.
+
+2006-05-25 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config.bfd: (sh-*-linux*): Treat as 64bit target.
+ (sh*l*-*-netbsdelf*): Likewise.
+ (sh-*-netbsdelf*): Likewise.
+ (shl*-*-elf*): Likewise.
+ (sh[1234]l*-*-elf*): Likewise.
+ (sh3el*-*-elf*): Likewise.
+ (shl*-*-kaos*): Likewise.
+ (sh-*-elf*): Likewise.
+ (sh[1234]*-elf*): Likewise.
+ (sh-*-rtems*): Likewise.
+ (sh-*-kaos*): Likewise.
+
+2006-05-24 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/1485
+ * config.bfd: Set want64 to true if 64bit bfd is used.
+ (sh-*-linux*): Use targ64_selvecs for 64bit targets.
+ (sh*l*-*-netbsdelf*): Likewise.
+ (sh-*-netbsdelf*): Likewise.
+ (shl*-*-elf*): Likewise.
+ (sh[1234]l*-*-elf*): Likewise.
+ (sh3el*-*-elf*): Likewise.
+ (shl*-*-kaos*): Likewise.
+ (sh-*-elf*): Likewise.
+ (sh[1234]*-elf*): Likewise.
+ (sh-*-rtems*): Likewise.
+ (sh-*-kaos*): Likewise.
+
+2006-05-24 Paul Brook <paul@codesourcery.com>
+
+ * elf-bfd.h (elf_backend_data): Add elf_backend_output_arch_local_syms
+ * elf32-arm.c (output_arch_syminfo): Define.
+ (elf32_arm_ouput_plt_map_sym, elf32_arm_output_plt_map,
+ elf32_arm_output_arch_local_syms): New functions.
+ (elf_backend_output_arch_local_syms): Define.
+ * elflink.c (bfd_elf_final_link): Call
+ elf_backend_output_arch_local_syms.
+ * elfxx-target.h (elf_backend_output_arch_local_syms): Provide default
+ definition.
+ (elfNN_bed): Add elf_backend_output_arch_local_syms.
+
+2006-05-24 Paul Brook <paul@codesourcery.com>
+
+ * elf32-arm.c (put_arm_insn, put_thumb_insn): New functions.
+ (elf32_thumb_to_arm_stub, elf32_arm_to_thumb_stub,
+ elf32_arm_finish_dynamic_symbol): Use them.
+
+2006-05-24 Carlos O'Donell <carlos@systemhalted.org>
+ Randolph Chung <tausq@debian.org>
+
+ * elf-hppa.h (reloc_hppa_howto_table): Check bitfield for
+ TPREL21L/TPREL14R relocations. Handle LTOFF_TP14R relocations.
+ Add handling for TLS relocations.
+ (elf_hpp_reloc_final_type): Handle TLS relocs.
+ * elf32-hppa.c: Add authors for cleanup and TLS support.
+ (hppa_elf_local_got_tls_type, hh_name, eh_name): Define.
+ (elf32_hppa_link_hash_entry): Add tls_type.
+ (elf32_hppa_link_hash_table): Add tld_ldm_got.
+ (hppa_link_has_newfunc): Set tls_type.
+ (elf32_hppa_link_hash_table_create): Set tls_ldm_got refcount.
+ (hppa_stub_name): Use hh_name macro.
+ (elf32_hppa_copy_indirect_symbol): Copy TLS information.
+ (elf32_hppa_check_relocs): Call elf32_hppa_optimized_tls_reloc.
+ Handle TLS relocs.
+ (elf32_hppa_gc_sweep_hook): Likewise.
+ (allocate_dynrelocs): Handle TLS relocs.
+ (elf32_hppa_size_dynamic_sections): Count space required by TLS
+ relocs. Use hh_name macro.
+ (dtpoff_base): New function.
+ (tpoff): Likewise.
+ (elf32_hppa_optimized_tls_reloc): Likewise.
+ (final_link_relocate): Handle TLS relocs.
+ (elf32_hppa_relocate_section): Handle TLS relocs. Use eh_name
+ and hh_name macros.
+ (elf32_hppa_finish_dynamic_symbol): Setup TLS got entries. Use
+ hh_name and eh_name macros.
+ (elf32_hppa_reloc_type_clas): Handle TLS relocs.
+
+2006-05-24 Bjoern Haase <bjoern.m.haase@web.de>
+
+ * archures.c: Add bfd_mach_avr6.
+ * cpu-avr.c: Likewise.
+ * reloc.c (BFD_RELOC_AVR_LO8_LDI_GS, BFD_RELOC_AVR_HI8_LDI_GS):
+ New relocations.
+ * libbfd.h: Regenerate.
+ * bfd-in2.h:Regenerate.
+ * elf32-avr.h: New file. Protoypes for functions accessed from ld.
+ * elf32-avr.c: Add elf32-avr.h to include list.
+ (elf32_avr_stub_hash_entry): New function.
+ (elf32_avr_link_hash_table): New struct.
+ (avr_link_hash_table): Likewise.
+ (avr_stub_hash_entry): Likewise.
+ (avr_stub_hash_lookup): New function.
+ (stub_hash_newfunc): New function.
+ (elf32_avr_link_hash_table_create): New function.
+ (elf32_avr_link_hash_table_free): New function.
+ (avr_get_stub_addr): New function.
+ (debug_relax, debug_stubs): Add new global variables controlling
+ debugging printout to stdout.
+ (avr_pc_wrap_around): Change the type to bfd_vma.
+ (avr_replace_call_ret_sequences): Add a new variable controling
+ linkrelax optimizations.
+ (avr_stub_is_required_for_16_bit_reloc): New function.
+ (avr_final_link_relocate):
+ Add linker hash table to parameter list. Use stub addr. if necessary.
+ (elf32_avr_relocate_section):
+ Add linker hashtable to parameter list of avr_final_link_relocate.
+ (bfd_elf_avr_final_write_processing): Add support for bfd_mach_avr6.
+ (elf32_avr_object_p): Add support for E_AVR_MACH_AVR6.
+ (elf32_avr_relax_delete_bytes):
+ Iterate over all sections of a bfd when adjusting relocs addends.
+ (elf32_avr_relax_section):
+ Evaluate avr_replace_call_ret_sequences and recalculate the size of
+ stub section.
+ (avr_stub_name): New function.
+ (avr_get_stub_entry): New function.
+ (avr_add_stub): New function.
+ (avr_build_one_stub): New function.
+ (avr_size_one_stub): New function.
+ (elf32_avr_setup_params): New function.
+ (elf32_avr_setup_section_lists): New function.
+ (get_local_syms): New function.
+ (elf32_avr_size_stubs): New function.
+ (bfd_elf32_bfd_link_hash_table_create): New function.
+ (bfd_elf32_bfd_link_hash_table_free): New function.
+
+2006-05-23 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/2655
+ PR ld/2657
+ * elf-eh-frame.c (_bfd_elf_write_section_eh_frame): Properly
+ update CIE/FDE length. Don't pad to the section alignment.
+
+2006-05-23 Jie Zhang <jie.zhang@analog.com>
+
+ * elf32-bfin.c (bfinfdpic_relocate_section): Clear reloc for
+ deteted entries in .eh_frame section.
+
+2006-05-23 Jie Zhang <jie.zhang@analog.com>
+
+ * elf32-bfin.c (bfin_check_relocs): Use __GLOBAL_OFFSET_TABLE_
+ instead of _GLOBAL_OFFSET_TABLE_.
+ (bfin_relocate_section): Ditto.
+ (_bfin_create_got_section): Ditto.
+ (elf32_bfinfdpic_create_dynamic_sections): Use
+ __PROCEDURE_LINKAGE_TABLE_ instead of _PROCEDURE_LINKAGE_TABLE_.
+ (bfin_finish_dynamic_symbol): Use __DYNAMIC instead of _DYNAMIC.
+
+2006-05-23 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (compare_symbols): Prefer strong dynamic global
+ function syms over other syms.
+
+2006-05-22 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * elflink.c (_bfd_elf_add_dynamic_entry): Remove DT_TEXTREL
+ check.
+ (bfd_elf_final_link): Add a late DT_TEXTREL check.
+ * elfxx-mips.c (MIPS_ELF_READONLY_SECTION): Define.
+ (mips_elf_create_dynamic_relocation): Set DF_TEXTREL.
+ (_bfd_mips_elf_check_relocs): Delete MIPS_READONLY_SECTION.
+ Use MIPS_ELF_READONLY_SECTION.
+ (_bfd_mips_elf_size_dynamic_sections): Clear DF_TEXTREL after
+ creating DT_TEXTREL.
+ (_bfd_mips_elf_finish_dynamic_sections): Clear textrel markers
+ if no text relocations were generated.
+
+2006-05-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elfxx-ia64.c (ELF_MAXPAGESIZE): Fix a typo in comment.
+
+2006-05-19 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (elf_fake_sections): Formatting.
+ (assign_file_positions_for_load_sections): Only add SEC_ALLOC
+ sections to p_memsz. Remove hack for PT_NOTE sections. Allow
+ section alignment to increase p_align for PT_LOAD.
+ (assign_file_positions_for_non_load_sections): Remove ARM BPABI
+ hack for PT_DYNAMIC. Instead, set p_filesz for all segments
+ other than PT_LOAD, and PT_NOTE in core.
+
+2006-05-17 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (assign_file_positions_for_segments): Split into..
+ (assign_file_positions_for_load_sections): ..this, and..
+ (assign_file_positions_for_non_load_sections): ..this new function,..
+ (assign_file_positions_except_relocs): ..writing program headers here.
+
+2006-05-17 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.c (elf_gc_sweep): Don't specially keep non-alloc,
+ non-load sections if they have relocs.
+
+2006-05-15 Paul Brook <paul@codesourcery.com>
+
+ * cpu-arm.c (bfd_is_arm_mapping_symbol_name): Rename ...
+ (bfd_is_arm_special_symbol_name): ... to this. Add type argument.
+ Check symbol name is of specified type.
+ * elf32-arm.c (elf32_arm_is_target_special_symbol,
+ arm_elf_find_function, elf32_arm_output_symbol_hook): Use
+ bfd_is_arm_special_symbol_name.
+ * bfd-in.h (BFD_ARM_SPECIAL_SYM_TYPE_MAP,
+ BFD_ARM_SPECIAL_SYM_TYPE_TAG, BFD_ARM_SPECIAL_SYM_TYPE_OTHER,
+ BFD_ARM_SPECIAL_SYM_TYPE_ANY): Define.
+ (bfd_is_arm_mapping_symbol_name): Remove prototype.
+ (bfd_is_arm_special_symbol_name): Add prototype.
+ * bfd-in2.h: Regenerate.
+
+2006-05-15 David Heine <dlheine@tensilica.com>
+ Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (check_loop_aligned): Fix reversed check for
+ undefined opcode. Clean up assertions.
+ (narrow_instruction, widen_instruction): Remove "do_it" parameters.
+ Factor most of the code into separate functions....
+ (can_narrow_instruction, can_widen_instruction): New.
+ (prev_instr_is_a_loop): New.
+ (compute_ebb_proposed_actions): Combine error handling code for
+ decode errors. Replace call to insn_decode_len with inline code.
+ Use can_narrow_instruction and can_widen_instruction. Handle errors
+ from call to xtensa_opcode_is_loop.
+ (relax_section): Adjust calls to narrow_instruction and
+ widen_instruction.
+
+2006-05-15 Alan Modra <amodra@bigpond.net.au>
+
+ PR 2658
+ * elf32-ppc.c (ppc_elf_relax_section): Don't segfault on non-pic
+ -shared link.
+
+2006-05-11 Michael Matz <matz@suse.de>
+
+ * elflink.c (match_group_member): Correctly iterate group
+ members.
+
+2006-05-11 Paul Brook <paul@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_reloc_map): Add MOVW and MOVT relocs.
+ (elf32_arm_final_link_relocate): Handle MOVW and MOVT relocs.
+ (elf32_arm_gc_sweep_hook, elf32_arm_check_relocs): Ditto.
+ * reloc.c: Ditto.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+ * libcoff.h: Regenerate.
+
+2006-05-11 Mike Bland <mbland@google.com>
+
+ * elf.c (_bfd_elf_init_private_section_data): Don't change
+ section type if already set.
+
+2006-05-10 Nick Clifton <nickc@redhat.com>
+
+ PR ld/2607
+ * elfcode.h (valid_section_index_p): New function: Checks for a
+ valid section index. Allows indicies in the range SHN_LOPROC to
+ SHN_HIOS.
+ (elf_object_p): Use valid_section_index_p.
+
+2006-05-11 Pedro Alves <pedro_alves@portugalmail.pt>
+
+ * coff-arm.c (ARM_26D, ARM_32, ARM_RVA_32, ARM_SECTION,
+ ARM_SECREL): Mark WinCE versions of these relocs as partial
+ inplace.
+ (coff_arm_relocate_section): Adjust addend for WinCE.
+
+2006-05-10 Alan Modra <amodra@bigpond.net.au>
+
+ PR 2342
+ * elflink.c (_bfd_elf_default_action_discarded): Revert 2006-02-16.
+
+2006-05-09 Nick Clifton <nickc@redhat.com>
+
+ * coffcode.h (coff_write_relocs): Produce an error message if a an
+ out-of-range symbol index is detected in a reloc.
+
+2006-05-09 Ben Elliston <bje@au.ibm.com>
+
+ * elf64-ppc.c (ppc64_elf_finish_dynamic_symbol): Remove unused
+ local variable `dynobj'.
+
+2006-05-05 Bjoern Haase <bjoern.m.haase@web.de>
+
+ * elf32-avr.c (elf32_avr_relax_delete_bytes): Iterate over all
+ of the bfd's sections for the reloc-addend adjustments.
+
+2006-05-05 Martin Schwidefsky <schwidefsky@de.ibm.com>
+
+ * elf32-s390.c (invalid_tls_insn): Call bfd_set_error.
+ (elf_s390_relocate_section): Add code to do the GD->LE and
+ LD->LE TLS linker optimizations if a brasl instruction is used
+ for the __tls_get_offset function call.
+ * elf64-s390.c (invalid_tls_insn): Call bfd_set_error.
+
+2006-05-05 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_tls_optimize): Only optimize
+ R_PPC64_TPREL64 and R_PPC64_DTPMOD64 relocs when they are in
+ the .toc and referenced by a TLS code sequence.
+ (ppc64_elf_edit_toc): Cater for the unlikely situation that
+ .toc is the first section in a file.
+
+2006-05-04 Andreas Schwab <schwab@suse.de>
+
+ * aoutf1.h (struct external_sparc_core): Declare c_regs as struct
+ regs instead of an array of int.
+ (struct external_solaris_bcp_core): Likewise.
+ (swapcore_sun3): Use offsetof instead of computing the offset
+ manually.
+ (swapcore_sparc): Likewise. Simplify reference to c_regs.
+ (swapcore_solaris_bcp): Likewise.
+
+2006-05-04 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * elfxx-mips.c (_bfd_mips_elf_hide_symbol): Adjust handling
+ for missing GOTs.
+
+2006-05-04 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * cpu-arm.c (bfd_is_arm_mapping_symbol_name): Accept more
+ mapping symbols.
+
+2006-05-04 Ben Elliston <bje@au.ibm.com>
+
+ * coff-or32.c (bfd_section_from_shdr): Remove unused local
+ variable `ptr'.
+ * cofflink.c (process_embedded_commands): Remove unused local
+ variables `had_read' and `had_shared'.
+ * ecofflink.c (bfd_ecoff_debug_accumulate): Remove unused local
+ variable `fdr_adr'.
+ * ihex.c (ihex_read_section): Remove unused local variable `addr'.
+
+2006-05-03 Alan Modra <amodra@bigpond.net.au>
+
+ * libbfd-in.h (_bfd_generic_new_section_hook): Declare.
+ * section.c (bfd_abs_symbol, bfd_com_symbol): Delete.
+ (bfd_und_symbol, bfd_ind_symbol): Delete.
+ (BFD_FAKE_SECTION): Remove SYM_PTR param, set symbol_ptr_ptr to
+ &SEC.symbol.
+ (STD_SECTION): Adjust.
+ (_bfd_generic_new_section_hook): New function, extracted from..
+ (bfd_section_init): ..here.
+ (bfd_make_section_old_way): Call new_section_hook for abs, com,
+ und and ind sections.
+ * elf.c (_bfd_elf_large_com_section): Adjust.
+ * aoutx.h (new_section_hook): Call _bfd_generic_new_section_hook.
+ * pdp11.c (new_section_hook): Likewise.
+ * coffcode.h (coff_new_section_hook): Likewise.
+ * ecoff.c (_bfd_ecoff_new_section_hook): Likewise.
+ * elf.c (_bfd_elf_new_section_hook): Likewise.
+ * vms.c (vms_new_section_hook): Likwise.
+ * elf32-arm.c (elf32_arm_new_section_hook): Check used_by_bfd isn't
+ already set.
+ * elf32-sh64.c (sh64_elf_new_section_hook): Likewise.
+ * elf32-xtensa.c (elf_xtensa_new_section_hook): Likewise.
+ * elf64-mmix.c (mmix_elf_new_section_hook): Likewise.
+ * elf64-ppc.c (ppc64_elf_new_section_hook): Likewise.
+ * elfxx-mips.c (_bfd_mips_elf_new_section_hook): Likewise.
+ * elfxx-sparc.c (_bfd_sparc_elf_new_section_hook): Likewise.
+ * ieee.c (ieee_new_section_hook): Likewise. Call
+ _bfd_generic_new_section_hook too.
+ * mmo.c (mmo_new_section_hook): Likewise.
+ * oasys.c (oasys_new_section_hook): Likewise.
+ * som.c (som_new_section_hook): Likewise.
+ * coff-w65.c (reloc_processing): Don't use bfd_abs_symbol.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+
+2006-05-03 Alan Modra <amodra@bigpond.net.au>
+
+ * hash.c (DEFAULT_SIZE): Revert last change.
+ (higher_prime_number): Correct test for no larger prime. Don't
+ abort on error, instead return 0. Depopulate primes[].
+ (bfd_hash_lookup): If we overflow size, refuse to grow table.
+
+2006-05-02 Paul Brook <paul@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_final_link_relocate): Set thumb funciton bit
+ for R_ARM_REL32.
+
+2006-05-02 Ben Elliston <bje@au.ibm.com>
+
+ * archive.c (bfd_generic_archive_p): Remove unused local variable
+ `fail'.
+ * dwarf2.c (decode_line_info): Remove unused local variable
+ `basic_block'.
+ * elfcode.h (elf_slurp_reloc_table_from_section): Remove unused
+ local variable `s'.
+ * tekhex.c (tekhex_write_object_contents): Remove unused local
+ variable `bytes_written'.
+ * aout-ns32k.c (MY_swap_std_reloc_out): Remove unused local
+ variable `r_addend'.
+ * elf32-dlx.c (dlx_rtype_to_howto): Remove breaks after returns.
+ * elfxx-mips.c (_bfd_elf_mips_mach): Remove breaks after returns.
+ (_bfd_ns32k_relocate_contents): Remove break after return.
+ * elf.c (bfd_section_from_shdr): Remove breaks after returns.
+
+2006-05-02 Nick Clifton <nickc@redhat.com>
+
+ * elf32-sh-symbian.c: Rename local define DEBUG to SYMBIAN_DEBUG
+ in order to avoid conflicts with the global DEBUG define.
+
+2006-05-02 Alan Modra <amodra@bigpond.net.au>
+
+ * dwarf2.c: Formatting.
+ * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Simplify
+ output section check.
+ * elf32-i370.c: Warning fixes inside #ifdef DEBUG.
+ * elf32-m32c.c: Similarly.
+ * elf32-ppc.c: Similarly.
+ * elf32-v850.c: Similarly.
+ * nlm32-sparc.c: Similarly.
+ * elfcode.h: Similarly.
+ (elf_symbol_flags): Delete.
+ * elflink.c (elf_link_input_bfd): Comment typo.
+
+2006-05-01 DJ Delorie <dj@redhat.com>
+
+ * bfd-in.h (bfd_hash_table): Add count field.
+ * bfd-in2.h: Regenerate.
+ * hash.c (higher_prime_number): New.
+ (bfd_hash_table_inint_n): Init count field.
+ (bfd_hash_lookup): Grow table as needed.
+
+2006-04-27 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ PR binutils/2584
+ * tekhex.c (getvalue): Change return type to bfd_boolean and
+ add the new parameter. Return false if the unexpected character
+ is found.
+ (getsym): Likewise.
+ (first_phase): Change return type to bfd_boolean and return
+ false if the unexpected character is found. Replace abort
+ with returning false.
+ (pass_over): Change return type to bfd_boolean and the type of
+ the second argument to bfd_boolean (*) (bfd *, int, char *).
+ Return false if FUNC returns false.
+ (tekhex_object_p): Return NULL if pass_over fails.
+
+2006-04-27 Alan Modra <amodra@bigpond.net.au>
+
+ * coff-rs6000.c (xcoff_write_archive_contents_old): Warning fix.
+
+2006-04-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/2593
+ * elf.c (_bfd_elf_new_section_hook): Don't set section ELF type
+ and flags if its BFD flags have been set.
+ (_bfd_elf_init_private_section_data): Don't copy the output ELF
+ section type from input if it has been set to something
+ different.
+
+2006-04-25 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/2467
+ * elf.c (_bfd_elf_close_and_cleanup): Check elf_tdata (abfd)
+ is NULL first.
+
+ * elf32-arm.c (elf32_arm_close_and_cleanup): Check if
+ abfd->sections is NULL.
+ (elf32_arm_bfd_free_cached_info): New.
+ (bfd_elf32_bfd_free_cached_info): Defined.
+
+ * elfxx-target.h (bfd_elfNN_bfd_free_cached_info): Default it
+ to _bfd_free_cached_info.
+
+ * libbfd-in.h (_bfd_free_cached_info): New.
+ * libbfd: Regenerated.
+
+ * opncls.c (_bfd_delete_bfd): Check if abfd->memory is NULL.
+ (_bfd_free_cached_info): New.
+
+2006-04-21 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (assign_file_positions_except_relocs): Move code setting
+ file position of non-loaded sections..
+ (assign_file_positions_for_segments): ..to here.
+
+2006-04-20 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/2537
+ * elf.c (bfd_section_from_shdr): Allow sections reserved for
+ applications. Issue an error on sections we don't know how
+ to handle.
+
+2006-04-19 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am: Run "make dep-am".
+ * Makefile.in: Regenerate.
+
+2006-04-19 Alan Modra <amodra@bigpond.net.au>
+
+ * warning.m4 (--enable-werror): Format help message.
+ (--enable-build-warnings): Likewise.
+ * configure: Regenerate.
+
+2006-04-18 Nick Clifton <nickc@redhat.com>
+
+ PR 2257
+ * elfcode.h (elf_object_p): Allow files with corrupt e_shstrndx
+ fields to still be handled as ELF files.
+
+2006-04-16 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * po/SRC-POTFILES.in: Regenerated.
+
+2006-04-16 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * configure.in: Update version to 2.17.50.
+ * configure: Regenerated.
+
+2006-04-14 David Heine <dlheine@tensilica.com>
+
+ * elf32-xtensa.c (build_reloc_opcodes): New.
+ (compute_text_actions): Use it to decode opcodes outside inner loop.
+ (check_section_ebb_pcrels_fit): Add "reloc_opcodes" argument, and if
+ it is set, use it to get the opcodes for relocations.
+ (move_shared_literal): Adjust call to check_section_ebb_pcrels_fit.
+
+2006-04-08 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/2513
+ * elf32-i386.c (GOT_TLS_MASK): New macro for tls_type.
+ (GOT_TLS_IE_IE): Likewise.
+ (GOT_TLS_IE_GD): Likewise.
+ (GOT_TLS_IE_MASK): Likewise.
+ (elf_i386_check_relocs): For global symbols, set GOT_TLS_IE_GD
+ and GOT_TLS_IE_IE for R_386_TLS_GD and R_386_TLS_IE
+ respectively.
+ (allocate_dynrelocs): If both GOT_TLS_IE_IE and GOT_TLS_IE_GD
+ are set, treat tls_type as GOT_TLS_IE_BOTH.
+ (elf_i386_relocate_section): Likewise.
+
+2006-04-07 Randolph Chung <tausq@debian.org>
+
+ * elf64-hppa.c (elf64_hppa_grok_prstatus): New function.
+ (elf64_hppa_grok_psinfo): Likewise.
+ (elf_backend_grok_pstatus, elf_backend_grok_psinfo): Define.
+
+2006-04-06 DJ Delorie <dj@redhat.com>
+
+ * elf32-m32c.c (m32c_elf_relocate_section): Generate a symbol for
+ each plt entry we create.
+
+2006-04-06 Carlos O'Donell <carlos@codesourcery.com>
+
+ * po/Make-in: Add install-html target.
+ * Makefile.am: Rename docdir to bfddocdir. Add datarootdir, docdir
+ htmldir. Add install-html and install-html-recursive targets.
+ * Makefile.in: Regenerate.
+ * configure.in: AC_SUBST for datarootdir, docdir and htmldir.
+ * configure: Regenerate.
+
+2006-04-06 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elfxx-ia64.c (elfNN_ia64_relax_section): Skip unneeded passes
+ with the skip_relax_pass_0 and skip_relax_pass_1 bits in the
+ section structure.
+
+2006-04-05 Bernd Schmidt <bernd.schmidt@analog.com>
+
+ * elf32-bfin.c (bfinfdpic_relocs_info_hash): Sprinkle casts to
+ eliminate warnings.
+
+2006-04-05 H.J. Lu <hongjiu.lu@intel.com>
+ James E Wilson <wilson@specifixinc.com>
+
+ PR ld/2442
+ * elfxx-ia64.c (elfNN_ia64_dyn_sym_info): Remove next.
+ (elfNN_ia64_local_hash_entry): Add count, sorted_count and
+ size.
+ (elfNN_ia64_link_hash_entry): Likewise.
+ (elfNN_ia64_new_elf_hash_entry): Initialize count, sorted_count
+ and size.
+ (elfNN_ia64_hash_copy_indirect): Updated elfNN_ia64_dyn_sym_info
+ processing.
+ (elfNN_ia64_hash_hide_symbol): Likewise.
+ (elfNN_ia64_global_dyn_sym_thunk): Likewise.
+ (elfNN_ia64_local_dyn_sym_thunk): Likewise.
+ (elfNN_ia64_global_dyn_info_free): New function.
+ (elfNN_ia64_local_dyn_info_free): Likewise.
+ (elfNN_ia64_hash_table_free): Free local and global
+ elfNN_ia64_dyn_sym_info.
+ (addend_compare): New function.
+ (sort_dyn_sym_info): Likewise.
+ (get_dyn_sym_info): Updated to use binary search for addend.
+ (elfNN_ia64_check_relocs): Scan relocations to create dynamic
+ relocation arrays first.
+
+2006-04-05 Bernd Schmidt <bernd.schmidt@analog.com>
+
+ * elf32-bfin.c (_bfin_create_got_section): Don't generate a _gp
+ symbol.
+
+2006-04-05 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/2411
+ * elflink.c (check_dynsym): New.
+ (elf_link_output_extsym): Use it.
+ (bfd_elf_final_link): Likewise.
+
+2006-04-05 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/2404
+ * elflink.c (_bfd_elf_merge_symbol): Skip the default indirect
+ symbol from the dynamic definition with the default version if
+ its type and the type of existing regular definition mismatch.
+
+2006-04-05 Richard Sandiford <richard@codesourcery.com>
+ Daniel Jacobowitz <dan@codesourcery.com>
+
+ * config.bfd (sparc-*-vxworks*): New stanza.
+ * configure.in (bfd_elf32_sparc_vxworks_vec): New stanza.
+ (bfd_elf32_sparc_vec, bfd_elf64_sparc_vec): Add elf-vxworks.lo.
+ * configure: Regenerate.
+ * elf32-sparc.c: Include elf-vxworks.h.
+ (elf32_sparc_vxworks_link_hash_table_create: New.
+ (elf32_sparc_vxworks_final_write_processing): New.
+ (TARGET_BIG_SYM): Override for VxWorks.
+ (TARGET_BIG_NAME, ELF_MINPAGESIZE): Likewise.
+ (bfd_elf32_bfd_link_hash_table_create): Likewise.
+ (elf_backend_want_got_plt, elf_backend_plt_readonly): Likewise.
+ (elf_backend_got_header_size, elf_backend_add_symbol_hook): Likewise.
+ (elf_backend_link_output_symbol_hook): Likewise.
+ (elf_backend_emit_relocs): Likewise.
+ (elf_backend_final_write_processing, elf32_bed): Likewise.
+ * elfxx-sparc.c: Include libiberty.h and elf-vxworks.h.
+ (sparc_vxworks_exec_plt0_entry, sparc_vxworks_exec_plt_entry): New.
+ (sparc_vxworks_shared_plt0_entry, sparc_vxworks_shared_plt_entry): New.
+ (_bfd_sparc_elf_link_hash_table_create): Don't initialize
+ build_plt_entry here.
+ (create_got_section): Initialize sgotplt for VxWorks.
+ (_bfd_sparc_elf_create_dynamic_sections): Initialize build_plt_entry,
+ plt_header_size and plt_entry_size, with new VxWorks-specific settings.
+ Call elf_vxworks_create_dynamic_sections for VxWorks.
+ (allocate_dynrelocs): Use plt_header_size and plt_entry_size.
+ Allocate room for .got.plt and .rela.plt.unloaded entries on VxWorks.
+ (_bfd_sparc_elf_size_dynamic_sections): Don't allocate a nop in .plt
+ for VxWorks. Check for the .got.plt section.
+ (sparc_vxworks_build_plt_entry): New function.
+ (_bfd_sparc_elf_finish_dynamic_symbol): Add handling of VxWorks PLTs.
+ Don't make _GLOBAL_OFFSET_TABLE_ and _PROCEDURE_LINKAGE_TABLE_
+ absolute on VxWorks.
+ (sparc32_finish_dyn): Add special handling for DT_RELASZ
+ and DT_PLTGOT on VxWorks.
+ (sparc_vxworks_finish_exec_plt): New.
+ (sparc_vxworks_finish_shared_plt): New.
+ (_bfd_sparc_elf_finish_dynamic_sections): Call them.
+ Use plt_header_size and plt_entry_size.
+ * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Add is_vxworks,
+ srelplt2, sgotplt, plt_header_size and plt_entry_size fields.
+ * Makefile.am (elfxx-sparc.lo): Depend on elf-vxworks.h.
+ (elf32-sparc.lo): Likewise.
+ * Makefile.in: Regenerate.
+ * targets.c (bfd_elf32_sparc_vxworks_vec): Declare.
+ (_bfd_target_vector): Add a pointer to it.
+
+2006-03-30 Ben Elliston <bje@au.ibm.com>
+
+ PR ld/2267
+ * elflink.c (elf_fixup_link_order): Ensure `elfsec' is not a
+ special section number that exceeds the number of ELF sections
+ (eg. SHN_MIPS_SCOMMON).
+
+2006-03-27 Richard Sandiford <richard@codesourcery.com>
+
+ * elfxx-mips.c (mips_got_entry): Add more commentary.
+ (mips_elf_local_got_index): Use the hash table entry to record
+ the GOT index of forced-local symbols.
+ (mips_elf_initialize_tls_index): Rearrange code. Store the index
+ in either the hash table entry or the mips_got_entry, not both.
+ Add more commentary.
+ (mips_elf_multi_got): Make sure the g->next is nonnull when calling
+ mips_elf_initialize_tls_index.
+
+2006-03-25 Bernd Schmidt <bernd.schmidt@analog.com>
+
+ * elf32-bfin.c (bfd_const_reloc, bfd_oper_reloc, bfin_push_reloc,
+ RELOC_STACK_SIZE, reloc_stack, reloc_stack_tos, is_reloc_stack_empty,
+ reloc_stack_push, reloc_stack_pop, reloc_stack_operate,
+ bfin_areloc_howto_table): Delete. All
+ uses deleted as well.
+ (bfin_reloc_map): Delete all stack relocs.
+ (bfin_info_to_howto, bfin_bfd_reloc_type_lookup,
+ bfin_reloc_type_lookup): Don't support them.
+ (bfin_relocate_section): Don't try to handle them.
+
+ * config.bfd (bfin-*-*): Add bfd_elf32_bfinfdpic_vec.
+ * configure.in: Likewise.
+ * configure: Regenerate.
+ * elf32-bfin.c: Include "elf/dwarf2.h" and "hashtab.h".
+ (BFIN_RELOC_MAX): Now 0x21.
+ (bfin_howto_table, bfin_reloc_map): Add FD-PIC relocs.
+ (bfd_elf32_bfinfdpic_vec): Declare.
+ (IS_FDPIC): New macro.
+ (struct bfinfdpic_elf_link_hash_table): New struct.
+ (bfinfdpic_hash_table, bfinfdpic_got_section,
+ bfinfdpic_gotrel_section, bfinfdpic_gotfixup_section,
+ bfinfdpic_plt_setion, bfinfdpic_pltrel_section,
+ bfinfdpic_relocs_info, bfinfdpic_got_initial_offset,
+ bfinfdpic_plt_initial_offset): Accessor macros for it.
+ (BFINFDPIC_SYM_LOCAL, BFINFDPIC_FUNCDESC_LOCAL): New macros.
+ (struct bfinfdpic_relocs_info): New struct.
+ (LZPLT_RESOLVER_EXTRA, LZPLT_NORMAL_SIZE, LZPLT_ENTRIES,
+ BFINFDPIC_LZPLT_BLOCK_SIZE, BFINFDPIC_LZPLT_RESOLV_LOC,
+ DEFAULT_STACK_SIZE): New macros.
+ (bfinfdpic_elf_link_hash_table_create, bfinfdpic_relocs_info_hash,
+ bfinfdpic_relocs_info_eq, bfinfdpics_relocs_info_find,
+ bfinfdpic_relocs_info_for_global, bfinfdpic_relocs_info_for_local,
+ bfinfdpic_pic_merge_early_relocs_info, _bfinfdpic_add_dyn_reloc,
+ _bfinfdpic_add_rofixup, _bfinfdpic_osec_to_segment,
+ _bfinfdpic_osec_readonly_p, bfinfdpic_relocate_section,
+ bfinfdpic_check_relocs, bfinfdpic_gc_sweep_hook,
+ _bfinfdpic_link_omit_section_dynsym, _bfin_create_got_section,
+ elf32_bfinfdpic_create_dynamic_sections, _bfinfdpic_get_fd_entry,
+ _bfinfdpic_compute_got_alloc_data, _bfinfdpic_get_got_entry,
+ _bfinfdpic_assign_got_entries, _bfinfdpic_assign_plt_entries,
+ _bfinfdpic_resolve_final_relocs_info,
+ elf32_bfinfdpic_size_dynamic_sections,
+ elf32_bfinfdpic_always_size_sections,
+ elf32_bfinfdpic_modify_segment_map,
+ _bfinfdpic_count_got_plt_entries,
+ elf32_bfinfdpic_finish_dynamic_sections,
+ elf32_bfinfdpic_adjust_dynamic_symbol,
+ elf32_bfinfdpic_finish_dynamic_symbol,
+ elf32_bfinfdpic_elf_use_relative_eh_frame,
+ elf32_bfinfdpic_elf_encode_eh_address,
+ elf32_bfin_object_p, bfin_elf_copy_private_bfd_data,
+ elf32_bfinfdpic_copy_private_bfd_data,
+ (struct _bfinfdpic_dynamic_got_info,
+ struct _bfinfdpic_dynamic_got_plt_info): New structs.
+ (elf32_bfin_print_private_bfd_data): Print PIC flags.
+ (elf32_bfin_merge_private_bfd_data): Extend to support FD-PIC.
+ (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME, elf32_bed,
+ elf_backend_got_header_size, bfd_elf32_bfd_link_hash_table_create,
+ elf_backend_always_size_sectinos, elf_backend_modify_segment_map,
+ bfd_elf32_bfd_copy_private_bfd_data,
+ elf_backend_create_dynamic_sections, elf_backend_adjust_dynamic_symbol,
+ elf_backend_size_dynamic_sections, elf_backend_finish_dynamic_symbol,
+ elf_backend_finish_dynamic_sections, elf_backend_relocate_section,
+ elf_backend_can_make_relative_eh_frame, elf_backend_check_relocs,
+ elf_backend_can_make_ldsa_relative_eh_frame, elf_backend_may_use_rel_p,
+ elf_backend_may_use_rela_p, elf_backend_default_use_rela_p,
+ elf_backend_omit_section_dynsym): Redefine these macros and include
+ "elf32-target.h" again to create the elf32-bfinfdpic target.
+ * reloc.c (BFD_RELOC_BFIN_GOT17M4, BFD_RELOC_BFIN_GOTHI,
+ BFD_RELOC_BFIN_GOTLO, BFD_RELOC_BFIN_FUNCDESC,
+ BFD_RELOC_BFIN_FUNCDESC_GOT17M4, BFD_RELOC_BFIN_FUNCDESC_GOTHI,
+ BFD_RELOC_BFIN_FUNCDESC_GOTLO, BFD_RELOC_BFIN_FUNCDESC_VALUE,
+ BFD_RELOC_BFIN_FUNCDESC_GOTOFF17M4, BFD_RELOC_BFIN_FUNCDESC_GOTOFFHI,
+ BFD_RELOC_BFIN_FUNCDESC_GOTOFFLO, BFD_RELOC_BFIN_GOTOFFHI,
+ BFD_RELOC_BFIN_GOTOFFLO): New.
+ * targets.c (bfd_elf32_bfinfdpic_vec): New bfd_target.
+ (_bfd_target_vector): Add it.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+
+2006-03-25 Richard Sandiford <richard@codesourcery.com>
+
+ * cpu-m68k.c (bfd_m68k_compatible): Treat ISA A+ and ISA B code as
+ incompatible. Likewise MAC and EMAC code.
+ * elf32-m68k.c (elf32_m68k_merge_private_bfd_data): Use
+ bfd_get_compatible to set the new bfd architecture. Rely on it
+ to detect incompatibilities.
+
+2006-03-23 Michael Matz <matz@suse.de>
+
+ * reloc.c: Add BFD_RELOC_X86_64_GOT64, BFD_RELOC_X86_64_GOTPCREL64,
+ BFD_RELOC_X86_64_GOTPC64, BFD_RELOC_X86_64_GOTPLT64,
+ BFD_RELOC_X86_64_PLTOFF64.
+ * bfd-in2.h: Regenerated.
+ * libbfd.h: Regenerated.
+ * elf64-x86-64.c (x86_64_elf_howto_table): Correct comment.
+ Add howtos for above relocs.
+ (x86_64_reloc_map): Add mappings for new relocs.
+ (elf64_x86_64_check_relocs): R_X86_64_GOT64, R_X86_64_GOTPCREL64,
+ R_X86_64_GOTPLT64 need a got entry. R_X86_64_GOTPLT64 also a PLT
+ entry. R_X86_64_GOTPC64 needs a .got section. R_X86_64_PLTOFF64
+ needs a PLT entry.
+ (elf64_x86_64_gc_sweep_hook): Reflect changes from
+ elf64_x86_64_check_relocs for the new relocs.
+ (elf64_x86_64_relocate_section): Handle new relocs.
+
+2006-03-22 Bob Wilson <bob.wilson@acm.org>
+
+ * elf32-xtensa.c (xtensa_read_table_entries): Remove assertion that
+ rel->r_addend is zero.
+
+2006-03-22 Richard Sandiford <richard@codesourcery.com>
+
+ * elfxx-mips.c (_bfd_mips_vxworks_finish_dynamic_symbol): Fix type
+ of "loc".
+
+2006-03-22 Richard Sandiford <richard@codesourcery.com>
+ Daniel Jacobowitz <dan@codesourcery.com>
+ Phil Edwards <phil@codesourcery.com>
+ Zack Weinberg <zack@codesourcery.com>
+ Mark Mitchell <mark@codesourcery.com>
+ Nathan Sidwell <nathan@codesourcery.com>
+
+ * bfd-in2.h: Regenerate.
+ * config.bfd (mips*-*-vxworks*, mips*el-*-vxworks*): New stanzas.
+ * configure.in (bfd_elf32_bigmips_vxworks_vec): New stanza.
+ (bfd_elf32_littlemips_vxworks_vec): Likewise.
+ (bfd_elf32_bigmips_vec): Add elf-vxworks.lo.
+ (bfd_elf32_littlemips_vec): Likewise.
+ (bfd_elf32_nbigmips_vec): Likewise.
+ (bfd_elf32_nlittlemips_vec): Likewise.
+ (bfd_elf32_ntradbigmips_vec): Likewise.
+ (bfd_elf32_ntradlittlemips_vec): Likewise.
+ (bfd_elf32_tradbigmips_vec): Likewise.
+ (bfd_elf32_tradlittlemips_vec): Likewise.
+ (bfd_elf64_bigmips_vec): Likewise.
+ (bfd_elf64_littlemips_vec): Likewise.
+ (bfd_elf64_tradbigmips_vec): Likewise.
+ (bfd_elf64_tradlittlemips_vec): Likewise.
+ * elf32-mips.c: Include elf-vxworks.h.
+ (mips_info_to_howto_rel): Use elf_backend_mips_rtype_to_howto
+ instead of calling mips_elf32_rtype_to_howto directly.
+ (mips_vxworks_copy_howto_rela): New reloc howto.
+ (mips_vxworks_jump_slot_howto_rela): Likewise.
+ (mips_vxworks_bfd_reloc_type_lookup): New function.
+ (mips_vxworks_rtype_to_howto): Likewise.
+ (mips_vxworks_final_write_processing): Likewise.
+ (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME): Override for VxWorks.
+ (TARGET_BIG_SYM, TARGET_BIG_NAME, elf_bed, ELF_MAXPAGESIZE): Likewise.
+ (elf_backend_want_got_plt): Likewise.
+ (elf_backend_want_plt_sym): Likewise.
+ (elf_backend_got_symbol_offset): Likewise.
+ (elf_backend_want_dynbss): Likewise.
+ (elf_backend_may_use_rel_p): Likewise.
+ (elf_backend_may_use_rela_p): Likewise.
+ (elf_backend_default_use_rela_p): Likewise.
+ (elf_backend_got_header_size: Likewise.
+ (elf_backend_plt_readonly): Likewise.
+ (bfd_elf32_bfd_reloc_type_lookup): Likewise.
+ (elf_backend_mips_rtype_to_howto): Likewise.
+ (elf_backend_adjust_dynamic_symbol): Likewise.
+ (elf_backend_finish_dynamic_symbol): Likewise.
+ (bfd_elf32_bfd_link_hash_table_create): Likewise.
+ (elf_backend_add_symbol_hook): Likewise.
+ (elf_backend_link_output_symbol_hook): Likewise.
+ (elf_backend_emit_relocs): Likewise.
+ (elf_backend_final_write_processing: Likewise.
+ (elf_backend_additional_program_headers): Likewise.
+ (elf_backend_modify_segment_map): Likewise.
+ (elf_backend_symbol_processing): Likewise.
+ * elfxx-mips.c: Include elf-vxworks.h.
+ (mips_elf_link_hash_entry): Add is_relocation_target and
+ is_branch_target fields.
+ (mips_elf_link_hash_table): Add is_vxworks, srelbss, sdynbss, srelplt,
+ srelplt2, sgotplt, splt, plt_header_size and plt_entry_size fields.
+ (MIPS_ELF_RELA_SIZE, MIPS_ELF_REL_DYN_NAME): New macros.
+ (MIPS_RESERVED_GOTNO): Take a mips_elf_link_hash_table argument.
+ Return 3 for VxWorks.
+ (ELF_MIPS_GP_OFFSET): Change the argument from a bfd to a
+ mips_elf_link_hash_table. Return 0 for VxWorks.
+ (MIPS_ELF_GOT_MAX_SIZE): Change the argument from a bfd to a
+ mips_elf_link_hash_table. Update the call to ELF_MIPS_GP_OFFSET.
+ (mips_vxworks_exec_plt0_entry): New variable.
+ (mips_vxworks_exec_plt_entry): Likewise.
+ (mips_vxworks_shared_plt0_entry): Likewise.
+ (mips_vxworks_shared_plt_entry): Likewise.
+ (mips_elf_link_hash_newfunc): Initialize the new hash_entry fields.
+ (mips_elf_rel_dyn_section): Change the bfd argument to a
+ mips_elf_link_hash_table. Use MIPS_ELF_REL_DYN_NAME to get
+ the name of the section.
+ (mips_elf_initialize_tls_slots): Update the call to
+ mips_elf_rel_dyn_section.
+ (mips_elf_gotplt_index): New function.
+ (mips_elf_local_got_index): Add an input_section argument.
+ Update the call to mips_elf_create_local_got_entry.
+ (mips_elf_got_page): Likewise.
+ (mips_elf_got16_entry): Likewise.
+ (mips_elf_create_local_got_entry): Add bfd_link_info and input_section
+ arguments. Create dynamic relocations for each entry on VxWorks.
+ (mips_elf_merge_gots): Update the use of MIPS_ELF_GOT_MAX_SIZE.
+ (mips_elf_multi_got): Update the uses of MIPS_ELF_GOT_MAX_SIZE
+ and MIPS_RESERVED_GOTNO.
+ (mips_elf_create_got_section): Update the uses of
+ MIPS_ELF_GOT_MAX_SIZE. Create .got.plt on VxWorks.
+ (is_gott_symbol): New function.
+ (mips_elf_calculate_relocation): Use a dynobj local variable.
+ Update the calls to mips_elf_local_got_index, mips_elf_got16_entry and
+ mips_elf_got_page_entry. Set G to the .got.plt entry when calculating
+ VxWorks R_MIPS_CALL* relocations. Calculate and use G for all GOT
+ relocations on VxWorks. Add dynamic relocations for references
+ to the VxWorks __GOTT_BASE__ and __GOTT_INDEX__ symbols. Don't
+ create dynamic relocations for R_MIPS_32, R_MIPS_REL32 or R_MIPS_64
+ in VxWorks executables.
+ (mips_elf_allocate_dynamic_relocations): Add a bfd_link_info argument.
+ Use MIPS_ELF_RELA_SIZE to calculate the size of a VxWorks entry.
+ Don't allocate a null entry on VxWorks.
+ (mips_elf_create_dynamic_relocation): Update the call to
+ mips_elf_rel_dyn_section. Use absolute rather than relative
+ relocations for VxWorks, and make them RELA rather than REL.
+ (_bfd_mips_elf_create_dynamic_sections): Don't make .dynamic
+ read-only on VxWorks. Update the call to mips_elf_rel_dyn_section.
+ Create the .plt, .rela.plt, .dynbss and .rela.bss sections on
+ VxWorks. Likewise create the _PROCEDURE_LINKAGE_TABLE symbol.
+ Call elf_vxworks_create_dynamic_sections for VxWorks and
+ initialize the plt_header_size and plt_entry_size fields.
+ (_bfd_mips_elf_check_relocs): Don't allow GOT relocations to be
+ used in VxWorks executables. Don't allocate dynamic relocations
+ for R_MIPS_32, R_MIPS_REL32 or R_MIPS_64 in VxWorks executables.
+ Set is_relocation_target for each symbol referenced by a relocation.
+ Allocate .rela.dyn entries for relocations against the special
+ VxWorks __GOTT_BASE__ and __GOTT_INDEX__ symbols. Create GOT
+ entries for all VxWorks R_MIPS_GOT16 relocations. Don't allocate
+ a global GOT entry for symbols mentioned in VxWorks R_MIPS_CALL*,
+ R_MIPS_32, R_MIPS_REL32 or R_MIPS_64 relocations. Update the calls
+ to mips_elf_rel_dyn_section and mips_elf_allocate_dynamic_relocations.
+ Set is_branch_target for symbols mentioned in R_MIPS_PC16 or R_MIPS_26
+ relocations. Don't set no_fn_stub on VxWorks.
+ (_bfd_mips_elf_adjust_dynamic_symbol): Update the call to
+ mips_elf_allocate_dynamic_relocations.
+ (_bfd_mips_vxworks_adjust_dynamic_symbol): New function.
+ (_bfd_mips_elf_always_size_sections): Do not allocate GOT page
+ entries for VxWorks, and do not create multiple GOTs.
+ (_bfd_mips_elf_size_dynamic_sections): Use MIPS_ELF_REL_DYN_NAME.
+ Handle .got specially for VxWorks. Update the uses of
+ MIPS_RESERVED_GOTNO and mips_elf_allocate_dynamic_relocations.
+ Check for sgotplt and splt. Allocate the .rel(a).dyn contents last,
+ once its final size is known. Set DF_TEXTREL for VxWorks. Add
+ DT_RELA, DT_RELASZ, DT_RELAENT, DT_PLTREL, DT_PLTRELSZ and DT_JMPREL
+ tags on VxWorks. Do not add the MIPS-specific tags for VxWorks.
+ (_bfd_mips_vxworks_finish_dynamic_symbol): New function.
+ (mips_vxworks_finish_exec_plt): Likewise.
+ (mips_vxworks_finish_shared_plt): Likewise.
+ (_bfd_mips_elf_finish_dynamic_sections): Remove an unncessary call
+ to mips_elf_rel_dyn_section. Use a VxWorks-specific value of
+ DT_PLTGOT. Handle DT_RELA, DT_RELASZ, DT_RELAENT, DT_PLTREL,
+ DT_PLTRELSZ and DT_JMPREL. Update the uses of MIPS_RESERVED_GOTNO
+ and mips_elf_rel_dyn_section. Use a different GOT header for
+ VxWorks. Don't sort .rela.dyn on VxWorks. Finish the PLT on VxWorks.
+ (_bfd_mips_elf_link_hash_table_create): Initialize the new
+ mips_elf_link_hash_table fields.
+ (_bfd_mips_vxworks_link_hash_table_create): New function.
+ (_bfd_mips_elf_final_link): Set the GP value to _GLOBAL_OFFSET_TABLE_
+ on VxWorks. Update the call to ELF_MIPS_GP_OFFSET.
+ * elfxx-mips.h (_bfd_mips_vxworks_adjust_dynamic_symbol): Declare.
+ (_bfd_mips_vxworks_finish_dynamic_symbol): Likewise.
+ (_bfd_mips_vxworks_link_hash_table_create): Likewise.
+ * libbfd.h: Regenerate.
+ * Makefile.am (elfxx-mips.lo): Depend on elf-vxworks.h.
+ (elf32-mips.lo): Likewise.
+ * Makefile.in: Regenerate.
+ * reloc.c (BFD_RELOC_MIPS_COPY, BFD_RELOC_MIPS_JUMP_SLOT): Declare.
+ * targets.c (bfd_elf32_bigmips_vxworks_vec): Declare.
+ (bfd_elf32_littlemips_vxworks_vec): Likewise.
+ (_bfd_target_vector): Add entries for them.
+
+2006-03-19 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ * elf64-hppa.c (elf64_hppa_special_sections): Change flags for .tbss
+ section from SHF_PARISC_WEAKORDER to SHF_HP_TLS.
+ (elf_backend_special_sections): Remove #undef.
+
+2006-03-18 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ * elf64-hppa.c (allocate_global_data_opd): Don't create an OPD entry
+ for undefined weak symbols.
+
+2006-03-17 Daniel Jacobowitz <dan@codesourcery.com>
+
+ PR ld/2462
+ * elflink.c (bfd_elf_final_link): Remove
+ bed->elf_backend_emit_relocs from emit_relocs.
+
+2006-03-17 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf32-ppc.c (ppc_elf_relocate_section): Copy addend from
+ first relocation to the second when relaxing TLS GD to LE;
+ zero it out when relaxing to IE.
+
+2006-03-17 Alan Modra <amodra@bigpond.net.au>
+
+ PR 2434
+ * elflink.c (elf_link_add_object_symbols): Save and restore
+ warning sym's linked sym.
+
+2006-03-16 Alan Modra <amodra@bigpond.net.au>
+
+ PR 2434
+ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete.
+ (elf_link_add_object_symbols): Delete unnecessary locals. Rename
+ hash_table -> htab. Formatting. Save entire symbol table
+ before loading as-needed syms, and restore afterwards if lib not
+ needed. Use bfd_hash_allocate rather than bfd_alloc for sym
+ name. Free some buffers earlier.
+ * bfd-in.h (struct bfd_hash_table): Add entsize.
+ (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype.
+ * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise
+ * hash.c (bfd_hash_table_init_n): Add entsize param, save to
+ hash table.
+ (bfd_hash_table_init): Add param, adjust calls.
+ * aoutx.h: Adjust all hash_table_init functions and calls.
+ * bfd.c: Likewise.
+ * coff-arm.c: Likewise.
+ * coff-h8300.c: Likewise.
+ * coff-ppc.c: Likewise.
+ * cofflink.c: Likewise.
+ * ecoff.c: Likewise.
+ * ecofflink.c: Likewise.
+ * elf-m10300.c: Likewise.
+ * elf-strtab.c: Likewise.
+ * elf.c: Likewise.
+ * elf32-arm.c: Likewise.
+ * elf32-bfin.c: Likewise.
+ * elf32-cris.c: Likewise.
+ * elf32-frv.c: Likewise.
+ * elf32-hppa.c: Likewise.
+ * elf32-i386.c: Likewise.
+ * elf32-m32r.c: Likewise.
+ * elf32-m68hc1x.c: Likewise.
+ * elf32-m68k.c: Likewise.
+ * elf32-ppc.c: Likewise.
+ * elf32-s390.c: Likewise.
+ * elf32-sh.c: Likewise.
+ * elf32-vax.c: Likewise.
+ * elf64-alpha.c: Likewise.
+ * elf64-hppa.c: Likewise.
+ * elf64-ppc.c: Likewise.
+ * elf64-s390.c: Likewise.
+ * elf64-sh64.c: Likewise.
+ * elf64-x86-64.c: Likewise.
+ * elfxx-ia64.c: Likewise.
+ * elfxx-mips.c: Likewise.
+ * elfxx-sparc.c: Likewise.
+ * i386linux.c: Likewise.
+ * libaout.h: Likewise.
+ * libbfd-in.h: Likewise.
+ * libcoff-in.h: Likewise.
+ * linker.c: Likewise.
+ * m68klinux.c: Likewise.
+ * merge.c: Likewise.
+ * opncls.c: Likewise.
+ * pdp11.c: Likewise.
+ * sparclinux.c: Likewise.
+ * stabs.c: Likewise.
+ * sunos.c: Likewise.
+ * vms.c: Likewise.
+ * xcofflink.c: Likewise.
+ * section.c (struct section_hash_entry): Move to..
+ * libbfd-in.h: ..here.
+ * Makefile.am: Run "make dep-am"
+ * Makefile.in: Regenerate.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+ * libcoff.h: Regenerate.
+
+2006-03-16 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.c (ppc_elf_check_relocs): REL24 and REL14 relocs
+ against __GLOBAL_OFFSET_TABLE__ need never be dynamic. Tweak
+ last change to REL32 relocs so that they are counted as
+ possibly dynamic as per REL24 and REL14.
+
+2006-03-16 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.c (ppc_elf_check_relocs): Don't fall into REL24
+ checks from REL32.
+
+2006-03-15 Ben Elliston <bje@au.ibm.com>
+
+ * elf32-arm.c (elf32_arm_merge_eabi_attributes): Iterate over all
+ in_list elements, not just the first.
+
+2006-03-14 Richard Sandiford <richard@codesourcery.com>
+
+ * elf32-mips.c (mips_elf_adjust_addend): New function, mostly split
+ out from...
+ (_bfd_mips_elf_relocate_section): ...here. Use it to adjust r_addend
+ for final links too.
+
+2006-03-13 Richard Sandiford <richard@codesourcery.com>
+
+ * elfxx-mips.c (mips_elf_create_got_section): Initialize hgot.
+
+2006-03-11 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/2443
+ * dwarf2.c (concat_filename): Don't issue an error if file is 0.
+
+2006-03-10 Paul Brook <paul@codesourcery.com>
+
+ * elf32-arm.c (INTERWORK_FLAG): Handle EABIv5.
+ (elf32_arm_print_private_bfd_data): Ditto.
+
+2006-03-09 Paul Brook <paul@codesourcery.com>
+
+ * cpu-arm.c (bfd_is_arm_mapping_symbol_name): Recognise additional
+ mapping symbols.
+
+2006-03-09 Khem Raj <khem@mvista.com>
+
+ * elf32-arm.c(elf32_arm_finish_dynamic_sections): Use unsigned
+ char type.
+
+2006-03-08 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elfxx-ia64.c (elfNN_ia64_choose_gp): Properly choose gp.
+
+2006-03-07 Richard Sandiford <richard@codesourcery.com>
+ Daniel Jacobowitz <dan@codesourcery.com>
+ Zack Weinberg <zack@codesourcery.com>
+ Nathan Sidwell <nathan@codesourcery.com>
+ Paul Brook <paul@codesourcery.com>
+ Ricardo Anguiano <anguiano@codesourcery.com>
+ Phil Edwards <phil@codesourcery.com>
+
+ * configure.in (bfd_elf32_bigarm_vec): Include elf-vxworks.lo.
+ (bfd_elf32_bigarm_symbian_vec): Likewise.
+ (bfd_elf32_bigarm_vxworks_vec): Likewise.
+ (bfd_elf32_littlearm_vec): Likewise.
+ (bfd_elf32_littlearm_symbian_vec): Likewise.
+ (bfd_elf32_littlearm_vxworks_vec): Likewise.
+ * configure: Regenerate.
+ * elf32-arm.c: Include libiberty.h and elf-vxworks.h.
+ (RELOC_SECTION, RELOC_SIZE, SWAP_RELOC_IN, SWAP_RELOC_OUT): New macros.
+ (elf32_arm_vxworks_bed): Add forward declaration.
+ (elf32_arm_howto_table_1): Fix the masks for R_ASM_ABS12.
+ (elf32_arm_vxworks_exec_plt0_entry): New table.
+ (elf32_arm_vxworks_exec_plt_entry): Likewise.
+ (elf32_arm_vxworks_shared_plt_entry): Likewise.
+ (elf32_arm_link_hash_table): Add vxworks_p and srelplt2 fields.
+ (reloc_section_p): New function.
+ (create_got_section): Use RELOC_SECTION.
+ (elf32_arm_create_dynamic_sections): Likewise. Call
+ elf_vxworks_create_dynamic_sections for VxWorks targets.
+ Choose between the two possible values of plt_header_size
+ and plt_entry_size.
+ (elf32_arm_link_hash_table_create): Initialize vxworks_p and srelplt2.
+ (elf32_arm_abs12_reloc): New function.
+ (elf32_arm_final_link_relocate): Call it. Allow the creation of
+ dynamic R_ARM_ABS12 relocs on VxWorks. Use reloc_section_p,
+ RELOC_SIZE, SWAP_RELOC_OUT and RELOC_SECTION. Initialize the
+ r_addend fields of relocs. On rela targets, skip any code that
+ adjusts in-place addends. When using _bfd_link_final_relocate
+ to perform a final relocation, pass rel->r_addend as the addend
+ argument.
+ (elf32_arm_merge_private_bfd_data): If one of the bfds is a VxWorks
+ object, ignore flags that are not standard on VxWorks.
+ (elf32_arm_check_relocs): Allow the creation of dynamic R_ARM_ABS12
+ relocs on VxWorks. Use reloc_section_p.
+ (elf32_arm_adjust_dynamic_symbol): Use RELOC_SECTION and RELOC_SIZE.
+ (allocate_dynrelocs): Use RELOC_SIZE. Account for the size of
+ .rela.plt.unloaded relocs on VxWorks targets.
+ (elf32_arm_size_dynamic_sections): Use RELOC_SIZE. Check for
+ .rela.plt.unloaded as well as .rel(a).plt. Add DT_RELA* tags
+ instead of DT_REL* tags on RELA targets.
+ (elf32_arm_finish_dynamic_symbol): Use RELOC_SECTION, RELOC_SIZE
+ and SWAP_RELOC_OUT. Initialize r_addend fields. Handle VxWorks
+ PLT entries. Do not make _GLOBAL_OFFSET_TABLE_ absolute on VxWorks.
+ (elf32_arm_finish_dynamic_sections): Use RELOC_SECTION, RELOC_SIZE
+ and SWAP_RELOC_OUT. Initialize r_addend fields. Handle DT_RELASZ
+ like DT_RELSZ. Handle the VxWorks form of initial PLT entry.
+ Correct the .rela.plt.unreloaded symbol indexes.
+ (elf32_arm_output_symbol_hook): Call the VxWorks version of this
+ hook on VxWorks targets.
+ (elf32_arm_vxworks_link_hash_table_create): Set vxworks_p to true.
+ Minor formatting tweak.
+ (elf32_arm_vxworks_final_write_processing): New function.
+ (elf_backend_add_symbol_hook): Override for VxWorks and reset
+ for Symbian.
+ (elf_backend_final_write_processing): Likewise.
+ (elf_backend_emit_relocs): Likewise.
+ (elf_backend_want_plt_sym): Likewise.
+ (ELF_MAXPAGESIZE): Likewise.
+ (elf_backend_may_use_rel_p): Minor formatting tweak.
+ (elf_backend_may_use_rela_p): Likewise.
+ (elf_backend_default_use_rela_p): Likewise.
+ (elf_backend_rela_normal): Likewise.
+ * Makefile.in (elf32-arm.lo): Depend on elf-vxworks.h.
+
+2006-03-06 Nathan Sidwell <nathan@codesourcery.com>
+
+ * archures.c (bfd_mach_mcf_isa_a_nodiv, bfd_mach_mcf_isa_b_nousp):
+ New. Adjust other variants.
+ (bfd_default_scan): Update.
+ * bfd-in2.h: Rebuilt.
+ * cpu-m68k.c: Adjust.
+ (bfd_m68k_compatible): New. Use it for architectures.
+ * elf32-m68k.c (elf32_m68k_object_p): Adjust.
+ (elf32_m68k_merge_private_bfd_data): Adjust. Correct isa-a/b
+ mismatch.
+ (elf32_m68k_print_private_bfd_data): Adjust.
+ * ieee.c (ieee_write_processor): Adjust.
+
+2006-03-06 Alan Modra <amodra@bigpond.net.au>
+
+ * dwarf2.c: Formatting.
+ (add_line_info): Remove outer loop.
+
+2006-03-05 H.J. Lu <hongjiu.lu@intel.com>
+ Alan Modra <amodra@bigpond.net.au>
+
+ PR binutils/2338
+ * dwarf2.c (loadable_section): New struct.
+ (dwarf2_debug): Add loadable_section_count and
+ loadable_sections.
+ (new_line_sorts_after): New.
+ (add_line_info): Use new_line_sorts_after to compare line
+ addresses.
+ (check_function_name): Removed.
+ (unset_sections): New.
+ (place_sections): New.
+ (_bfd_dwarf2_find_nearest_line): Updated. Call place_sections
+ and unset_sections on relocatable files.
+ (_bfd_dwarf2_find_line): Likewise.
+
+2006-03-03 Nick Clifton <nickc@redhat.com>
+
+ * cpu-avr.c: Update to ISO-C90 formatting.
+ * elf32-avr.c: Likewise.
+
+2006-03-03 Bjoern Haase <bjoern.m.haase@web.de>
+
+ * elf32-avr.c (avr_reloc_map): Insert BFD_RELOC_AVR_MS8_LDI
+ and R_AVR_MS8_LDI
+ (bfd_elf_avr_final_write_processing): Set
+ EF_AVR_LINKRELAX_PREPARED in e_flags field.
+ (elf32_avr_relax_section): New function.
+ (elf32_avr_relax_delete_bytes): New function.
+ (elf32_avr_get_relocated_section_contents): New function.
+ (avr_pc_wrap_around): New function.
+ (avr_relative_distance_considering_wrap_around): New function.
+ (avr_final_link_relocate): Handle negative int8t_t immediate for R_AVR_LDI.
+ * reloc.c: Add BFD_RELOC_AVR_MS8_LDI and BFD_RELOC_AVR_LDI_NEG
+ * libbfd.h: Regenerate.
+ * bfd-in2.h: Regenerate.
+
+2006-03-02 DJ Delorie <dj@redhat.com>
+
+ * elf32-m32c.c (m32c_offset_for_reloc): Fix local symbol
+ calculations.
+
+2006-03-02 Richard Sandiford <richard@codesourcery.com>
+
+ * elf32-ppc.c (is_ppc_elf_target): Return true if the target is
+ bfd_elf32_powerpc_vxworks_vec.
+
+2006-03-02 Nick Clifton <nickc@redhat.com>
+
+ * elf32-m32c.c (m32c_elf_relax_section): Initialise 'gap'.
+
+2006-03-02 Richard Sandiford <richard@codesourcery.com>
+
+ * elf32-i386.c (elf_i386_create_dynamic_sections): Use
+ elf_vxworks_create_dynamic_sections.
+ (elf_i386_size_dynamic_sections): Remove VxWorks GOT and PLT
+ symbol handling.
+ * elf32-ppc.c (ppc_elf_create_dynamic_sections): Use
+ elf_vxworks_create_dynamic_sections.
+ (ppc_elf_size_dynamic_sections): Remove VxWorks GOT and PLT
+ symbol handling.
+ * elf-vxworks.c (elf_vxworks_create_dynamic_sections): New function.
+ * elf-vxworks.h (elf_vxworks_create_dynamic_sections): Declare.
+
+2006-03-02 Richard Sandiford <richard@codesourcery.com>
+
+ * elf32-i386.c (elf_i386_vxworks_link_output_symbol_hook): Delete.
+ (elf_backend_link_output_symbol_hook): Use
+ elf_vxworks_link_output_symbol_hook instead.
+ * elf32-ppc.c (elf_i386_vxworks_link_output_symbol_hook): Delete.
+ (elf_backend_link_output_symbol_hook): Use
+ elf_vxworks_link_output_symbol_hook instead.
+ * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Provide the
+ same interface as elf_backend_link_output_symbol_hook.
+ * elf-vxworks.h (elf_vxworks_link_output_symbol_hook): Update
+ prototype accordingly.
+
+2006-03-02 Richard Sandiford <richard@codesourcery.com>
+
+ * elf32-ppc.c (ppc_elf_plt_type): New enumeration.
+ (ppc_elf_link_hash_table): Replace old_got and new_got with
+ plt_type and can_use_new_plt.
+ (ppc_elf_create_dynamic_sections): Add SEC_HAS_CONTENTS,
+ SEC_LOAD and SEC_READONLY to the VxWorks .plt flags.
+ (ppc_elf_check_relocs): Set can_use_new_plt instead of new_plt.
+ Move from plt_type == PLT_UNSET to PLT_OLD instead of setting old_plt.
+ (ppc_elf_select_plt_layout): Move from plt_type == PLT_UNSET to
+ either plt_type == PLT_OLD or plt_type == PLT_NEW. Assert that
+ this function should not be called for VxWorks targets.
+ (ppc_elf_tls_setup): Use plt_type instead of old_got.
+ (allocate_got): Likewise. Rearrange so that max_before_header
+ is only used for PLT_OLD and PLT_NEW.
+ (allocate_dynrelocs): Use plt_type instead of old_got and is_vxworks.
+ (ppc_elf_size_dynamic_sections): Likewise.
+ (ppc_elf_relax_section): Likewise.
+ (ppc_elf_relocate_section): Likewise.
+ (ppc_elf_finish_dynamic_symbol): Likewise.
+ (ppc_elf_vxworks_link_hash_table_create): Initialize plt_type.
+
+2006-02-28 Richard Sandiford <richard@codesourcery.com>
+
+ * elf32-i386.c (elf_i386_link_hash_table): Add next_tls_desc_index.
+ (elf_i386_link_hash_table_create): Initialize it.
+ (elf_i386_compute_jump_table_size): Use it instead of
+ srelplt->reloc_count.
+ (allocate_dynrelocs): Likewise.
+ (elf_i386_size_dynamic_sections): Likewise.
+ (elf_i386_relocate_section): Likewise.
+
+2006-02-27 Jakub Jelinek <jakub@redhat.com>
+
+ * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Handle S flag.
+ (_bfd_elf_write_section_eh_frame): Likewise.
+
+2006-02-27 Carlos O'Donell <carlos@codesourcery.com>
+
+ * po/Make-in: Add html target.
+
+2006-02-27 Richard Sandiford <richard@codesourcery.com>
+
+ * elf-m10300.c (_bfd_mn10300_elf_finish_dynamic_symbol): Use the
+ cached hgot entry to check for _GLOBAL_OFFSET_TABLE_.
+ * elf32-arm.c (elf32_arm_finish_dynamic_symbol): Likewise.
+ * elf32-bfin.c (bfin_finish_dynamic_symbol): Likewise.
+ * elf32-cris.c (elf_cris_finish_dynamic_symbol): Likewise.
+ * elf32-hppa.c (elf32_hppa_finish_dynamic_symbol): Likewise.
+ * elf32-i386.c (elf_i386_finish_dynamic_symbol): Likewise.
+ * elf32-m32r.c (m32r_elf_finish_dynamic_symbol): Likewise.
+ * elf32-m68k.c (elf_m68k_finish_dynamic_symbol): Likewise.
+ * elf32-sh.c (sh_elf_finish_dynamic_symbol): Likewise.
+ * elf32-vax.c (elf_vax_finish_dynamic_symbol): Likewise.
+ * elf32-xtensa.c (elf_xtensa_finish_dynamic_symbol): Likewise.
+ * elf64-sh64.c (sh64_elf64_finish_dynamic_symbol): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_finish_dynamic_symbol): Likewise.
+ * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_symbol): Likewise.
+ * elf32-s390.c (elf_s390_finish_dynamic_symbol): Likewise. Also use
+ the cached hplt entry to check for _PROCEDURE_LINKAGE_TABLE_.
+ * elf64-alpha.c (elf64_alpha_finish_dynamic_symbol): Likewise.
+ * elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_finish_dynamic_symbol): Likewise.
+ * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Likewise.
+
+2006-02-25 Richard Sandiford <richard@codesourcery.com>
+
+ * elf-bfd.h (elf_link_hash_table): Add hplt field.
+ * elflink.c (_bfd_elf_create_dynamic_sections): Initialize it.
+ * elf-m10300.c (_bfd_mn10300_elf_create_got_section): Likewise.
+ * elf32-frv.c (_frv_create_got_section): Likewise.
+ * elf32-m32r.c (m32r_elf_create_dynamic_sections): Likewise.
+ * elf32-sh.c (sh_elf_create_dynamic_sections): Likewise.
+ * elf64-alpha.c (elf64_alpha_create_dynamic_sections): Likewise.
+ * elf64-sh64.c (sh64_elf64_create_dynamic_sections): Likewise.
+ * elf32-i386.c (elf_i386_link_hash_table): Remove hgot and hplt.
+ (elf_i386_link_hash_table_create): Don't initialize them.
+ (elf_i386_size_dynamic_sections): Use the generic ELF hplt and
+ hgot fields.
+ (elf_i386_finish_dynamic_symbol): Likewise.
+ * elf32-ppc.c (ppc_elf_link_hash_table): Remove hplt.
+ (ppc_elf_size_dynamic_sections): Use the generic ELF hplt fields.
+ (ppc_elf_finish_dynamic_symbol): Likewise.
+
+2006-02-24 DJ Delorie <dj@redhat.com>
+
+ * elf32-m32c.c (m32c_elf_howto_table): Add relaxation relocs.
+ (m32c_elf_relocate_section): Don't relocate them.
+ (compare_reloc): New.
+ (relax_reloc): Remove.
+ (m32c_offset_for_reloc): New.
+ (m16c_addr_encodings): New.
+ (m16c_jmpaddr_encodings): New.
+ (m32c_addr_encodings): New.
+ (m32c_elf_relax_section): Relax jumps and address displacements.
+ (m32c_elf_relax_delete_bytes): Adjust for internal syms. Fix up
+ short jumps.
+
+ * reloc.c: Add m32c relax relocs.
+ * libbfd.h: Regenerate.
+ * bfd-in2.h: Regenerate.
+
+2006-02-24 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/2218
+ * elf-bfd.h (elf_backend_data): Add elf_backend_fixup_symbol.
+ (_bfd_elf_link_hash_fixup_symbol): New.
+
+ * elflink.c (_bfd_elf_link_hash_fixup_symbol): New.
+ (_bfd_elf_fix_symbol_flags): Call elf_backend_fixup_symbol if
+ it isn't NULL.
+
+ * elfxx-ia64.c (elf_backend_fixup_symbol): Defined.
+
+ * elfxx-target.h (elf_backend_fixup_symbol): New.
+ (elfNN_bed): Initialize elf_backend_fixup_symbol.
+
+2006-02-23 H.J. Lu <hongjiu.lu@intel.com>
+
+ * cpu-ia64-opc.c (ins_immu5b): New.
+ (ext_immu5b): Likewise.
+ (elf64_ia64_operands): Add IMMU5b.
+
+2006-02-21 Alan Modra <amodra@bigpond.net.au>
+
+ PR ld/2218
+ * elf32-arm.c (allocate_dynrelocs): Ensure undef weak sym in pie
+ is dynamic.
+ * elf32-hppa.c (allocate_dynrelocs): Likewise.
+ * elf32-i386.c (allocate_dynrelocs): Likewise.
+ * elf32-s390.c (allocate_dynrelocs): Likewise.
+ * elf32-sh.c (allocate_dynrelocs): Likewise.
+ * elf64-s390.c (allocate_dynrelocs): Likewise.
+ * elf64-x86-64.c (allocate_dynrelocs): Likewise.
+ * elf32-m32r.c (allocate_dynrelocs): Likewise. Discard relocs
+ on undef weak with non-default visibility too.
+ * elfxx-sparc.c (allocate_dynrelocs): Ditto.
+
+2006-02-21 Alan Modra <amodra@bigpond.net.au>
+
+ * bfd.c: (_bfd_default_error_handler): Don't call abort on
+ error, instead call _exit.
+ (_bfd_abort): Call _exit not xexit.
+
+2006-02-17 Kevin Buettner <kevinb@redhat.com>
+
+ * elf32-frv.c (elf32_frv_grok_prstatus, elf32_frv_grok_psinfo):
+ New functions.
+ * elf_backend_grok_prstatus, elf_backend_grok_psinfo): Define.
+
+2006-02-17 Shrirang Khisti <shrirangk@kpitcummins.com>
+ Anil Paranjape <anilp1@kpitcummins.com>
+ Shilin Shakti <shilins@kpitcummins.com>
+
+ * Makefile.am: Add xc16x related entry
+ * Makefile.in: Regenerate
+ * archures.c: Add bfd_xc16x_arch
+ * bfd-in2.h: Regenerate
+ * config.bfd: Add xc16x-*-elf
+ * configure.in: Add bfd_elf32_xc16x_vec
+ * configure: Regenerate.
+ * targets.c: Added xc16x related information
+ * cpu-xc16x.c: New file
+ * reloc.c: Add new relocations specific to xc16x:
+ BFD_RELOC_XC16X_PAG, BFD_RELOC_XC16X_POF, BFD_RELOC_XC16X_SEG,
+ BFD_RELOC_XC16X_SOF
+ * elf32-xc16x.c: New file.
+
+2006-02-17 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.c (allocate_dynrelocs): Tweak undef weak handling.
+ * elf64-ppc.c (allocate_dynrelocs): Likewise.
+
+2006-02-17 Alan Modra <amodra@bigpond.net.au>
+
+ PR ld/2218
+ * elf64-ppc.c (allocate_dynrelocs): Ensure undef weak sym is
+ dynamic.
+ (ppc64_elf_relocate_section): Check output reloc section size.
+ * elf32-ppc.c (allocate_dynrelocs): Simplify undef weak test.
+
+2006-02-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/2322
+ * elf.c (get_segment_type): New function.
+ (_bfd_elf_print_private_bfd_data): Use it.
+ (print_segment_map): New function.
+ (assign_file_positions_for_segments): Call print_segment_map
+ when there are not enough room for program headers.
+
+2006-02-16 Nick Hudson <nick.hudson@dsl.pipex.com>
+
+ * config.bfd (mips*el-*-netbsd*, mips*-*-netbsd*): Use
+ traditional MIPS ELF targets.
+
+2006-02-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/2338
+ * dwarf2.c (check_function_name): New function.
+ (_bfd_dwarf2_find_nearest_line): Use check_function_name to
+ check if function is correct.
+
+2006-02-16 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.c (_bfd_elf_default_action_discarded): Return 0 for
+ debug sections.
+ (elf_link_input_bfd): Adjust comments.
+
+2006-02-10 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf.c (copy_private_bfd_data): Minor update.
+
+2006-02-10 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/2258
+ * elf.c (copy_private_bfd_data): Renamed to ...
+ (rewrite_elf_program_header): This.
+ (copy_elf_program_header): New function.
+ (copy_private_bfd_data): Likewise.
+
+2006-02-07 Nathan Sidwell <nathan@codesourcery.com>
+
+ * archures.c (bfd_mach_mcf5200, bfd_mach_mcf5206e,
+ bfd_mach_mcf5307, bfd_mach_mcf5407, bfd_mach_mcf528x,
+ bfd_mach_mcfv4e, bfd_mach_mcf521x, bfd_mach_mcf5249,
+ bfd_mach_mcf547x, bfd_mach_mcf548x): Remove.
+ (bfd_mach_mcf_isa_a, bfd_mach_mcf_isa_a_div,
+ bfd_mach_mcf_isa_a_div_mac, bfd_mach_mcf_isa_a_div_emac,
+ bfd_mach_mcf_isa_aplus, bfd_mach_mcf_isa_aplus_mac,
+ bfd_mach_mcf_isa_aplus_emac, bfd_mach_mcf_isa_aplus_usp,
+ bfd_mach_mcf_isa_aplus_usp_mac, bfd_mach_mcf_isa_aplus_usp_emac,
+ bfd_mach_mcf_isa_b, bfd_mach_mcf_isa_b_mac, bfd_mach_mcf_isa_b_emac,
+ bfd_mach_mcf_isa_b_usp_float, bfd_mach_mcf_isa_b_usp_float_mac,
+ bfd_mach_mcf_isa_b_usp_float_emac): New.
+ (bfd_default_scan): Update coldfire mapping.
+ * bfd-in.h (bfd_m68k_mach_to_features,
+ bfd_m68k_features_to_mach): Declare.
+ * bfd-in2.h: Rebuilt.
+ * cpu-m68k.c (arch_info_struct): Add new coldfire machines,
+ adjust legacy names.
+ (m68k_arch_features): New.
+ (bfd_m68k_mach_to_features,
+ bfd_m68k_features_to_mach): Define.
+ * elf32-m68k.c (elf32_m68k_object_p): New.
+ (elf32_m68k_merge_private_bfd_data): Merge the CF EF flags.
+ (elf32_m68k_print_private_bfd_data): Print the CF EF flags.
+ (elf_backend_object_p): Define.
+ * ieee.c (ieee_write_processor): Update coldfire machines.
+ * libbfd.h: Rebuilt.
+
+2006-02-06 Steve Ellcey <sje@cup.hp.com>
+
+ * elfxx-ia64.c (elfNN_ia64_fake_sections): Set SHF_IA_64_HP_TLS
+ if SHF_TLS is set.
+
+2006-02-05 Arnold Metselaar <arnold.metselaar@planet.nl>
+
+ * coff-z80.c (r_imm24): New howto.
+ (rtype2howto): New case R_IMM24.
+ (coff_z80_reloc_type_lookup): New case BFD_RELOC_24.
+ (extra_case): Use bfd_get_8 for R_IMM8, new case R_IMM24.
+
+2006-02-04 Richard Sandiford <richard@codesourcery.com>
+
+ * elfxx-mips.c (mips_elf_initialize_tls_index): If a TLS symbol
+ has already been assigned a GOT index, copy that index to the
+ current hash table entry.
+
+2006-02-01 Eric Botcazou <ebotcazou@libertysurf.fr>
+
+ * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Reinstate bypass
+ for call-to-undefweak reloc overflow.
+
+2006-01-31 Eric Botcazou <ebotcazou@libertysurf.fr>
+
+ * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Reinstate bypass
+ for 32-bit relocs overflow.
+
+2006-01-27 Paul Brook <paul@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_get_symbol_type): Allow STT_TLS thumb
+ objects.
+
+2006-01-18 Alexandre Oliva <aoliva@redhat.com>
+
+ Introduce TLS descriptors for i386 and x86_64.
+ * reloc.c (BFD_RELOC_386_TLS_GOTDESC, BFD_RELOC_386_TLS_DESC,
+ BFD_RELOC_386_TLS_DESC_CALL, BFD_RELOC_X86_64_GOTPC32_TLSDESC,
+ BFD_RELOC_X86_64_TLSDESC, BFD_RELOC_X86_64_TLSDESC_CALL): New.
+ * libbfd.h, bfd-in2.h: Rebuilt.
+ * elf32-i386.c (elf_howto_table): New relocations.
+ (R_386_tls): Adjust.
+ (elf_i386_reloc_type_lookup): Map new relocations.
+ (GOT_TLS_GDESC, GOT_TLS_GD_BOTH_P): New macros.
+ (GOT_TLS_GD_P, GOT_TLS_GDESC_P, GOT_TLS_GD_ANY_P): New macros.
+ (struct elf_i386_link_hash_entry): Add tlsdesc_got field.
+ (struct elf_i386_obj_tdata): Add local_tlsdesc_gotent field.
+ (elf_i386_local_tlsdesc_gotent): New macro.
+ (struct elf_i386_link_hash_table): Add sgotplt_jump_table_size.
+ (elf_i386_compute_jump_table_size): New macro.
+ (link_hash_newfunc): Initialize tlsdesc_got.
+ (elf_i386_link_hash_table_create): Set sgotplt_jump_table_size.
+ (elf_i386_tls_transition): Handle R_386_TLS_GOTDESC and
+ R_386_TLS_DESC_CALL.
+ (elf_i386_check_relocs): Likewise. Allocate space for
+ local_tlsdesc_gotent.
+ (elf_i386_gc_sweep_hook): Handle R_386_TLS_GOTDESC and
+ R_386_TLS_DESC_CALL.
+ (allocate_dynrelocs): Count function PLT relocations. Reserve
+ space for TLS descriptors and relocations.
+ (elf_i386_size_dynamic_sections): Reserve space for TLS
+ descriptors and relocations. Set up sgotplt_jump_table_size.
+ Don't zero reloc_count in srelplt.
+ (elf_i386_always_size_sections): New. Set up _TLS_MODULE_BASE_.
+ (elf_i386_relocate_section): Handle R_386_TLS_GOTDESC and
+ R_386_TLS_DESC_CALL.
+ (elf_i386_finish_dynamic_symbol): Use GOT_TLS_GD_ANY_P.
+ (elf_backend_always_size_sections): Define.
+ * elf64-x86-64.c (x86_64_elf_howto): Add R_X86_64_GOTPC32_TLSDESC,
+ R_X86_64_TLSDESC, R_X86_64_TLSDESC_CALL.
+ (R_X86_64_standard): Adjust.
+ (x86_64_reloc_map): Map new relocs.
+ (elf64_x86_64_rtype_to_howto): New, split out of...
+ (elf64_x86_64_info_to_howto): ... this function, and...
+ (elf64_x86_64_reloc_type_lookup): ... use it to map elf_reloc_val.
+ (GOT_TLS_GDESC, GOT_TLS_GD_BOTH_P): New macros.
+ (GOT_TLS_GD_P, GOT_TLS_GDESC_P, GOT_TLS_GD_ANY_P): New macros.
+ (struct elf64_x86_64_link_hash_entry): Add tlsdesc_got field.
+ (struct elf64_x86_64_obj_tdata): Add local_tlsdesc_gotent field.
+ (elf64_x86_64_local_tlsdesc_gotent): New macro.
+ (struct elf64_x86_64_link_hash_table): Add tlsdesc_plt,
+ tlsdesc_got and sgotplt_jump_table_size fields.
+ (elf64_x86_64_compute_jump_table_size): New macro.
+ (link_hash_newfunc): Initialize tlsdesc_got.
+ (elf64_x86_64_link_hash_table_create): Initialize new fields.
+ (elf64_x86_64_tls_transition): Handle R_X86_64_GOTPC32_TLSDESC and
+ R_X86_64_TLSDESC_CALL.
+ (elf64_x86_64_check_relocs): Likewise. Allocate space for
+ local_tlsdesc_gotent.
+ (elf64_x86_64_gc_sweep_hook): Handle R_X86_64_GOTPC32_TLSDESC and
+ R_X86_64_TLSDESC_CALL.
+ (allocate_dynrelocs): Count function PLT relocations. Reserve
+ space for TLS descriptors and relocations.
+ (elf64_x86_64_size_dynamic_sections): Reserve space for TLS
+ descriptors and relocations. Set up sgotplt_jump_table_size,
+ tlsdesc_plt and tlsdesc_got. Make room for them. Don't zero
+ reloc_count in srelplt. Add dynamic entries for DT_TLSDESC_PLT
+ and DT_TLSDESC_GOT.
+ (elf64_x86_64_always_size_sections): New. Set up
+ _TLS_MODULE_BASE_.
+ (elf64_x86_64_relocate_section): Handle R_386_TLS_GOTDESC and
+ R_386_TLS_DESC_CALL.
+ (elf64_x86_64_finish_dynamic_symbol): Use GOT_TLS_GD_ANY_P.
+ (elf64_x86_64_finish_dynamic_sections): Set DT_TLSDESC_PLT and
+ DT_TLSDESC_GOT. Set up TLS descriptor lazy resolver PLT entry.
+ (elf_backend_always_size_sections): Define.
+
+2006-01-17 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/2096
+ * dwarf2.c (comp_unit_contains_address): Update comment.
+ (_bfd_dwarf2_find_nearest_line): Use section's vma, instead of
+ lma. Return TRUE only if both comp_unit_contains_address and
+ comp_unit_find_nearest_line return TRUE.
+ (_bfd_dwarf2_find_line): Use section's vma, instead of lma.
+
+2006-01-18 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct elf_backend_data): Add gc_mark_dynamic_ref.
+ (bfd_elf_gc_mark_dynamic_ref_symbol): Declare.
+ * elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Rename from
+ elf_gc_mark_dynamic_ref_symbol. Make global.
+ (bfd_elf_gc_sections): Call bed->gc_mark_dynamic_ref.
+ * elfxx-target.h (elf_backend_gc_mark_dynamic_ref): Define.
+ (elfNN_bed): Init new field.
+ * elf64-ppc.c (elf_backend_gc_mark_dynamic_ref): Define.
+ (ppc64_elf_gc_mark_dynamic_ref): New function.
+
+2006-01-17 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_gc_mark_hook): Don't hang forever in loop.
+
+2006-01-17 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/2159
+ * elf.c (elfcore_write_pstatus): Add ATTRIBUTE_UNUSED to unused
+ parameters.
+
+2006-01-11 Nick Clifton <nickc@redhat.com>
+
+ * elf32-arm.c (elf32_arm_output_symbol_hook): Install new entry
+ into the newly (re)allocated map array.
+
+2006-01-09 Alexis Wilke <alexis_wilke@yahoo.com>
+
+ * peXXigen.c (tbl): Add comma after "HIGH3ADJ".
+
+2006-01-01 Jakub Jelinek <jakub@redhat.com>
+
+ * elf64-ppc.c (ppc64_elf_action_discarded): Return 0
+ for .toc1 section.
+
+For older changes see ChangeLog-2005
+
+Local Variables:
+mode: change-log
+left-margin: 8
+fill-column: 74
+version-control: never
+End:
diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index 77278a832a16..48919af759b6 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -1,6 +1,7 @@
## Process this file with automake to generate Makefile.in
AUTOMAKE_OPTIONS = 1.9 cygnus
+ACLOCAL_AMFLAGS = -I . -I .. -I ../config
# Uncomment the following line when doing a release.
# RELEASE=y
@@ -63,6 +64,7 @@ ALL_MACHINES = \
cpu-arm.lo \
cpu-avr.lo \
cpu-bfin.lo \
+ cpu-cr16.lo \
cpu-cr16c.lo \
cpu-cris.lo \
cpu-crx.lo \
@@ -91,6 +93,7 @@ ALL_MACHINES = \
cpu-m10300.lo \
cpu-maxq.lo \
cpu-mcore.lo \
+ cpu-mep.lo \
cpu-mips.lo \
cpu-mmix.lo \
cpu-mt.lo \
@@ -103,8 +106,10 @@ ALL_MACHINES = \
cpu-powerpc.lo \
cpu-rs6000.lo \
cpu-s390.lo \
+ cpu-score.lo \
cpu-sh.lo \
cpu-sparc.lo \
+ cpu-spu.lo \
cpu-tic30.lo \
cpu-tic4x.lo \
cpu-tic54x.lo \
@@ -125,6 +130,7 @@ ALL_MACHINES_CFILES = \
cpu-arm.c \
cpu-avr.c \
cpu-bfin.c \
+ cpu-cr16.c \
cpu-cris.c \
cpu-cr16c.c \
cpu-crx.c \
@@ -153,6 +159,7 @@ ALL_MACHINES_CFILES = \
cpu-m10300.c \
cpu-maxq.c \
cpu-mcore.c \
+ cpu-mep.c \
cpu-mips.c \
cpu-mmix.c \
cpu-mt.c \
@@ -165,8 +172,10 @@ ALL_MACHINES_CFILES = \
cpu-powerpc.c \
cpu-rs6000.c \
cpu-s390.c \
+ cpu-score.c \
cpu-sh.c \
cpu-sparc.c \
+ cpu-spu.c \
cpu-tic30.c \
cpu-tic4x.c \
cpu-tic54x.c \
@@ -235,6 +244,7 @@ BFD32_BACKENDS = \
elf32-arm.lo \
elf32-avr.lo \
elf32-bfin.lo \
+ elf32-cr16.lo \
elf32-cr16c.lo \
elf32-cris.lo \
elf32-crx.lo \
@@ -262,6 +272,7 @@ BFD32_BACKENDS = \
elf-m10200.lo \
elf-m10300.lo \
elf32-mcore.lo \
+ elf32-mep.lo \
elfxx-mips.lo \
elf32-mips.lo \
elf32-mt.lo \
@@ -271,12 +282,14 @@ BFD32_BACKENDS = \
elf32-pj.lo \
elf32-ppc.lo \
elf32-s390.lo \
+ elf32-score.lo \
elf32-sh.lo \
elf32-sh-symbian.lo \
elf32-sh64.lo \
elf32-sh64-com.lo \
elfxx-sparc.lo \
elf32-sparc.lo \
+ elf32-spu.lo \
elf32-v850.lo \
elf32-vax.lo \
elf32-xstormy16.lo \
@@ -284,6 +297,7 @@ BFD32_BACKENDS = \
elf32-xc16x.lo \
elf32.lo \
elflink.lo \
+ elf-attrs.lo \
elf-strtab.lo \
elf-eh-frame.lo \
elf-vxworks.lo \
@@ -323,6 +337,8 @@ BFD32_BACKENDS = \
pef.lo \
pe-arm.lo \
pei-arm.lo \
+ pe-arm-wince.lo \
+ pei-arm-wince.lo \
pe-i386.lo \
pei-i386.lo \
pe-mcore.lo \
@@ -407,6 +423,7 @@ BFD32_BACKENDS_CFILES = \
elf32-arm.c \
elf32-avr.c \
elf32-bfin.c \
+ elf32-cr16.c \
elf32-cr16c.c \
elf32-cris.c \
elf32-crx.c \
@@ -434,6 +451,7 @@ BFD32_BACKENDS_CFILES = \
elf-m10200.c \
elf-m10300.c \
elf32-mcore.c \
+ elf32-mep.c \
elfxx-mips.c \
elf32-mips.c \
elf32-mt.c \
@@ -445,10 +463,12 @@ BFD32_BACKENDS_CFILES = \
elf32-sh64.c \
elf32-sh64-com.c \
elf32-s390.c \
+ elf32-score.c \
elf32-sh.c \
elf32-sh-symbian.c \
elfxx-sparc.c \
elf32-sparc.c \
+ elf32-spu.c \
elf32-v850.c \
elf32-vax.c \
elf32-xstormy16.c \
@@ -456,6 +476,7 @@ BFD32_BACKENDS_CFILES = \
elf32-xc16x.c \
elf32.c \
elflink.c \
+ elf-attrs.c \
elf-strtab.c \
elf-eh-frame.c \
elf-vxworks.c \
@@ -495,6 +516,8 @@ BFD32_BACKENDS_CFILES = \
pef.c \
pe-arm.c \
pei-arm.c \
+ pe-arm-wince.c \
+ pei-arm-wince.c \
pe-i386.c \
pei-i386.c \
pe-mcore.c \
@@ -538,6 +561,7 @@ BFD64_BACKENDS = \
coff64-rs6000.lo \
demo64.lo \
efi-app-ia64.lo \
+ efi-app-x86_64.lo \
elf64-x86-64.lo \
elf64-alpha.lo \
elf64-hppa.lo \
@@ -555,7 +579,11 @@ BFD64_BACKENDS = \
mmo.lo \
nlm32-alpha.lo \
nlm64.lo \
- pepigen.lo
+ coff-x86_64.lo \
+ pe-x86_64.lo \
+ pei-x86_64.lo \
+ pepigen.lo \
+ pex64igen.lo
BFD64_BACKENDS_CFILES = \
aix5ppc-core.c \
@@ -564,6 +592,7 @@ BFD64_BACKENDS_CFILES = \
coff64-rs6000.c \
demo64.c \
efi-app-ia64.c \
+ efi-app-x86_64.c \
elf64-x86-64.c \
elf64-alpha.c \
elf64-hppa.c \
@@ -578,7 +607,10 @@ BFD64_BACKENDS_CFILES = \
elf64.c \
mmo.c \
nlm32-alpha.c \
- nlm64.c
+ nlm64.c \
+ coff-x86_64.c \
+ pe-x86_64.c \
+ pei-x86_64.c
OPTIONAL_BACKENDS = \
aix386-core.lo \
@@ -612,11 +644,10 @@ CONFIG_STATUS_DEPENDENCIES = \
WORDSIZE = @wordsize@
ALL_BACKENDS = @all_backends@
BFD_BACKENDS = @bfd_backends@
-BFD_LIBS = @bfd_libs@
BFD_MACHINES = @bfd_machines@
TDEFAULTS = @tdefaults@
-INCLUDES = @HDEFINES@ @COREFLAG@ @TDEFINES@ $(CSEARCH) $(CSWITCHES) -I$(srcdir)/../intl -I../intl
+INCLUDES = @HDEFINES@ @COREFLAG@ @TDEFINES@ $(CSEARCH) $(CSWITCHES) @INCINTL@
# C source files that correspond to .o's.
SOURCE_CFILES = \
@@ -628,7 +659,7 @@ SOURCE_CFILES = \
$(OPTIONAL_BACKENDS_CFILES)
BUILD_CFILES = \
- elf32-ia64.c elf64-ia64.c peigen.c pepigen.c
+ elf32-ia64.c elf64-ia64.c peigen.c pepigen.c pex64igen.c
CFILES = $(SOURCE_CFILES) $(BUILD_CFILES)
@@ -698,7 +729,8 @@ install-html-recursive:
# BFD_BACKENDS Routines the configured targets need.
# BFD_MACHINES Architecture-specific routines the configured targets need.
# COREFILE Core file routines for a native configuration
-OFILES = $(BFD_BACKENDS) $(BFD_MACHINES) @COREFILE@
+# bfd64_libs Routines for 64bit support
+OFILES = $(BFD_BACKENDS) $(BFD_MACHINES) @COREFILE@ @bfd64_libs@
stamp-ofiles: Makefile
rm -f tofiles
@@ -715,10 +747,12 @@ stamp-ofiles: Makefile
ofiles: stamp-ofiles ; @true
-libbfd_la_SOURCES = $(BFD32_LIBS_CFILES) $(BFD64_LIBS_CFILES)
+# Since BFD64_LIBS is optional and we can't have substitution in
+# libbfd_la_SOURCES, we put BFD64_LIBS in OFILES instead.
+libbfd_la_SOURCES = $(BFD32_LIBS_CFILES)
libbfd_la_DEPENDENCIES = $(OFILES) ofiles
libbfd_la_LIBADD = `cat ofiles` @WIN32LIBADD@
-libbfd_la_LDFLAGS = -release $(VERSION) @WIN32LDFLAGS@
+libbfd_la_LDFLAGS = -release `cat libtool-soversion` @WIN32LDFLAGS@
# libtool will build .libs/libbfd.a. We create libbfd.a in the build
# directory so that we don't have to convert all the programs that use
@@ -756,6 +790,9 @@ targets.lo: targets.c Makefile
archures.lo: archures.c Makefile
$(LIBTOOL) --mode=compile $(COMPILE) -c $(TDEFAULTS) $(srcdir)/archures.c
+dwarf2.lo: dwarf2.c Makefile
+ $(LIBTOOL) --mode=compile $(COMPILE) -c -DDEBUGDIR=\"$(DEBUGDIR)\" $(srcdir)/dwarf2.c
+
elf32-target.h : elfxx-target.h
rm -f elf32-target.h
sed -e s/NN/32/g < $(srcdir)/elfxx-target.h > elf32-target.new
@@ -786,6 +823,11 @@ pepigen.c : peXXigen.c
sed -e s/XX/pep/g < $(srcdir)/peXXigen.c > pepigen.new
mv -f pepigen.new pepigen.c
+pex64igen.c: peXXigen.c
+ rm -f pex64igen.c
+ sed -e s/XX/pex64/g < $(srcdir)/peXXigen.c > pex64igen.new
+ mv -f pex64igen.new pex64igen.c
+
BFD_H_DEPS= $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h
LOCAL_H_DEPS= libbfd.h sysdep.h config.h
$(BFD32_LIBS) \
@@ -929,17 +971,26 @@ MOSTLYCLEANFILES = ofiles stamp-ofiles
CLEANFILES = bfd.h dep.sed stmp-bfd-h DEP DEPA DEP1 DEP2 libbfd.a stamp-lib \
stmp-bin2-h stmp-lbfd-h stmp-lcoff-h
-DISTCLEANFILES = $(BUILD_CFILES) $(BUILD_HFILES)
+DISTCLEANFILES = $(BUILD_CFILES) $(BUILD_HFILES) libtool-soversion
bfdver.h: $(srcdir)/version.h $(srcdir)/Makefile.in
@echo "creating $@"
@bfd_version=`echo "$(VERSION)" | sed -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\
bfd_version_string="\"$(VERSION)\"" ;\
+ bfd_soversion="$(VERSION)" ;\
+ bfd_version_package="\"$(PKGVERSION)\"" ;\
+ report_bugs_to="\"$(REPORT_BUGS_TO)\"" ;\
if test "x$(RELEASE)" = x ; then \
bfd_version_date=`sed -n -e 's/.*DATE //p' < $(srcdir)/version.h` ;\
- bfd_version_string="\"$(VERSION) $${bfd_version_date}\"" ;\
+ bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\
+ bfd_soversion="$(VERSION).$${bfd_version_date}" ;\
fi ;\
- sed -e "s/@bfd_version@/$$bfd_version/" -e "s/@bfd_version_string@/$$bfd_version_string/" < $(srcdir)/version.h > $@
+ sed -e "s,@bfd_version@,$$bfd_version," \
+ -e "s,@bfd_version_string@,$$bfd_version_string," \
+ -e "s,@bfd_version_package@,$$bfd_version_package," \
+ -e "s,@report_bugs_to@,$$report_bugs_to," \
+ < $(srcdir)/version.h > $@; \
+ echo "$${bfd_soversion}" > libtool-soversion
# What appears below is generated by a hacked mkdep using gcc -MM.
@@ -950,11 +1001,12 @@ archive.lo: archive.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
$(INCDIR)/safe-ctype.h
archures.lo: archures.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
$(INCDIR)/safe-ctype.h
-bfd.lo: bfd.c bfdver.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
- $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h libcoff.h \
- libecoff.h $(INCDIR)/coff/ecoff.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h
+bfd.lo: bfd.c $(INCDIR)/filenames.h bfdver.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/demangle.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/sym.h libcoff.h libecoff.h $(INCDIR)/coff/ecoff.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h
bfdio.lo: bfdio.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
bfdwin.lo: bfdwin.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cache.lo: cache.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
@@ -1008,6 +1060,7 @@ cpu-arm.lo: cpu-arm.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
$(INCDIR)/libiberty.h
cpu-avr.lo: cpu-avr.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cpu-bfin.lo: cpu-bfin.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-cr16.lo: cpu-cr16.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cpu-cris.lo: cpu-cris.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cpu-cr16c.lo: cpu-cr16c.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cpu-crx.lo: cpu-crx.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
@@ -1040,6 +1093,7 @@ cpu-m10200.lo: cpu-m10200.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cpu-m10300.lo: cpu-m10300.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cpu-maxq.lo: cpu-maxq.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cpu-mcore.lo: cpu-mcore.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-mep.lo: cpu-mep.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cpu-mips.lo: cpu-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cpu-mmix.lo: cpu-mmix.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cpu-mt.lo: cpu-mt.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
@@ -1055,9 +1109,11 @@ cpu-powerpc.lo: cpu-powerpc.c $(INCDIR)/filenames.h \
$(INCDIR)/hashtab.h
cpu-rs6000.lo: cpu-rs6000.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cpu-s390.lo: cpu-s390.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-score.lo: cpu-score.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cpu-sh.lo: cpu-sh.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
$(srcdir)/../opcodes/sh-opc.h
cpu-sparc.lo: cpu-sparc.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-spu.lo: cpu-spu.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cpu-tic30.lo: cpu-tic30.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cpu-tic4x.lo: cpu-tic4x.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cpu-tic54x.lo: cpu-tic54x.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
@@ -1127,7 +1183,8 @@ coff-arm.lo: coff-arm.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
coff-aux.lo: coff-aux.c $(INCDIR)/filenames.h $(INCDIR)/coff/aux-coff.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h \
- coff-m68k.c $(INCDIR)/hashtab.h libcoff.h $(INCDIR)/bfdlink.h \
+ coff-m68k.c $(INCDIR)/hashtab.h $(INCDIR)/coff/m68k.h \
+ $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
coffcode.h coffswap.h
coff-h8300.lo: coff-h8300.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
$(INCDIR)/bfdlink.h genlink.h $(INCDIR)/coff/h8300.h \
@@ -1197,7 +1254,7 @@ coff-tic54x.lo: coff-tic54x.c $(INCDIR)/filenames.h \
$(INCDIR)/hashtab.h $(INCDIR)/bfdlink.h $(INCDIR)/coff/tic54x.h \
$(INCDIR)/coff/ti.h $(INCDIR)/coff/internal.h libcoff.h \
coffcode.h coffswap.h
-coff-tic80.lo: coff-tic80.c $(INCDIR)/bfdlink.h $(INCDIR)/filenames.h \
+coff-tic80.lo: coff-tic80.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/hashtab.h $(INCDIR)/coff/tic80.h $(INCDIR)/coff/external.h \
$(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
coff-u68k.lo: coff-u68k.c coff-m68k.c $(INCDIR)/filenames.h \
@@ -1260,11 +1317,16 @@ elf32-arm.lo: elf32-arm.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
elf32-avr.lo: elf32-avr.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/avr.h \
- $(INCDIR)/elf/reloc-macros.h elf32-target.h
+ $(INCDIR)/elf/reloc-macros.h elf32-avr.h elf32-target.h
elf32-bfin.lo: elf32-bfin.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/bfin.h \
- $(INCDIR)/elf/reloc-macros.h elf32-target.h
+ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/elf/dwarf2.h \
+ elf32-target.h
+elf32-cr16.lo: elf32-cr16.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h elf-bfd.h \
+ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+ $(INCDIR)/elf/cr16.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
elf32-cr16c.lo: elf32-cr16c.c $(INCDIR)/filenames.h \
$(INCDIR)/hashtab.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/cr16c.h \
$(INCDIR)/elf/reloc-macros.h elf-bfd.h $(INCDIR)/elf/common.h \
@@ -1378,19 +1440,24 @@ elf32-mcore.lo: elf32-mcore.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/mcore.h \
$(INCDIR)/elf/reloc-macros.h elf32-target.h
+elf32-mep.lo: elf32-mep.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/mep.h \
+ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
+ elf32-target.h
elfxx-mips.lo: elfxx-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
$(INCDIR)/libiberty.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
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 elf-vxworks.h
+ elf-vxworks.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
+ $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h
elf32-mips.lo: elf32-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
$(INCDIR)/bfdlink.h genlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfxx-mips.h \
- $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \
- $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h elf-vxworks.h \
+ $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \
$(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h \
- ecoffswap.h elf32-target.h elf-vxworks.h
+ ecoffswap.h elf32-target.h
elf32-mt.lo: elf32-mt.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/mt.h \
@@ -1422,9 +1489,9 @@ elf32-ppc.lo: elf32-ppc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \
- elf32-sh64.h elf32-sh.c $(INCDIR)/hashtab.h $(INCDIR)/elf/sh.h \
- $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
- $(srcdir)/../opcodes/sh-opc.h elf32-target.h
+ elf32-sh64.h elf32-sh.c $(INCDIR)/hashtab.h elf-vxworks.h \
+ $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
+ $(srcdir)/../opcodes/sh-opc.h elf32-sh-relocs.h elf32-target.h
elf32-sh64-com.lo: elf32-sh64-com.c $(INCDIR)/filenames.h \
$(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
@@ -1434,27 +1501,36 @@ elf32-s390.lo: elf32-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h \
$(INCDIR)/elf/reloc-macros.h elf32-target.h
+elf32-score.lo: elf32-score.c $(INCDIR)/filenames.h \
+ $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h elf-bfd.h \
+ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/elf/score.h $(INCDIR)/elf/reloc-macros.h \
+ elf32-target.h
elf32-sh.lo: elf32-sh.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \
- $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
- $(srcdir)/../opcodes/sh-opc.h elf32-target.h
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf-vxworks.h \
+ $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
+ $(srcdir)/../opcodes/sh-opc.h elf32-sh-relocs.h elf32-target.h
elf32-sh-symbian.lo: elf32-sh-symbian.c elf32-sh.c \
$(INCDIR)/filenames.h $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
- $(INCDIR)/libiberty.h $(srcdir)/../opcodes/sh-opc.h \
- elf32-target.h
+ $(INCDIR)/elf/external.h elf-vxworks.h $(INCDIR)/elf/sh.h \
+ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
+ $(srcdir)/../opcodes/sh-opc.h elf32-sh-relocs.h elf32-target.h
elfxx-sparc.lo: elfxx-sparc.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \
- $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/sparc.h \
- elfxx-sparc.h elf-vxworks.h
+ $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h $(INCDIR)/elf/reloc-macros.h \
+ $(INCDIR)/opcode/sparc.h elfxx-sparc.h elf-vxworks.h
elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \
$(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/sparc.h \
- elfxx-sparc.h elf32-target.h elf-vxworks.h
+ elfxx-sparc.h elf-vxworks.h elf32-target.h
+elf32-spu.lo: elf32-spu.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/spu.h \
+ $(INCDIR)/elf/reloc-macros.h elf32-spu.h elf32-target.h
elf32-v850.lo: elf32-v850.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/v850.h \
@@ -1486,6 +1562,9 @@ elflink.lo: elflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/safe-ctype.h \
$(INCDIR)/libiberty.h $(INCDIR)/objalloc.h
+elf-attrs.lo: elf-attrs.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h
elf-strtab.lo: elf-strtab.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h
@@ -1570,7 +1649,7 @@ m88kopenbsd.lo: m88kopenbsd.c netbsd.h $(INCDIR)/filenames.h \
$(INCDIR)/hashtab.h libaout.h $(INCDIR)/bfdlink.h aout-target.h \
$(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
$(INCDIR)/aout/ar.h
-mach-o.lo: mach-o.c mach-o.h $(INCDIR)/filenames.h \
+mach-o.lo: mach-o.c $(INCDIR)/filenames.h mach-o.h \
$(INCDIR)/hashtab.h $(INCDIR)/libiberty.h mach-o-target.c
mipsbsd.lo: mipsbsd.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
@@ -1610,8 +1689,8 @@ pdp11.lo: pdp11.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
$(INCDIR)/safe-ctype.h
-pef.lo: pef.c $(INCDIR)/safe-ctype.h pef.h pef-traceback.h \
- $(INCDIR)/filenames.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h
+pef.lo: pef.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
+ pef.h pef-traceback.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h
pe-arm.lo: pe-arm.c $(INCDIR)/filenames.h coff-arm.c \
$(INCDIR)/hashtab.h $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
@@ -1620,6 +1699,16 @@ pei-arm.lo: pei-arm.c $(INCDIR)/filenames.h coff-arm.c \
$(INCDIR)/hashtab.h $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
$(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
+pe-arm-wince.lo: pe-arm-wince.c pe-arm.c $(INCDIR)/filenames.h \
+ coff-arm.c $(INCDIR)/hashtab.h $(INCDIR)/coff/arm.h \
+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
+ peicode.h libpei.h
+pei-arm-wince.lo: pei-arm-wince.c pei-arm.c $(INCDIR)/filenames.h \
+ coff-arm.c $(INCDIR)/hashtab.h $(INCDIR)/coff/arm.h \
+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
+ peicode.h libpei.h
pe-i386.lo: pe-i386.c $(INCDIR)/filenames.h coff-i386.c \
$(INCDIR)/hashtab.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
@@ -1662,7 +1751,7 @@ pei-mips.lo: pei-mips.c $(INCDIR)/filenames.h pe-mips.c \
$(INCDIR)/hashtab.h $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/external.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
$(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
-ppcboot.lo: ppcboot.c $(INCDIR)/safe-ctype.h $(INCDIR)/filenames.h \
+ppcboot.lo: ppcboot.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
$(INCDIR)/hashtab.h
reloc16.lo: reloc16.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
$(INCDIR)/bfdlink.h genlink.h $(INCDIR)/coff/internal.h \
@@ -1703,7 +1792,7 @@ vms.lo: vms.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/hashtab.h vms.h
vms-gsd.lo: vms-gsd.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/hashtab.h vms.h
-vms-hdr.lo: vms-hdr.c bfdver.h $(INCDIR)/filenames.h \
+vms-hdr.lo: vms-hdr.c $(INCDIR)/filenames.h bfdver.h \
$(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h $(INCDIR)/hashtab.h \
vms.h
vms-misc.lo: vms-misc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
@@ -1713,12 +1802,12 @@ vms-tir.lo: vms-tir.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
xcofflink.lo: xcofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/hashtab.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h \
libcoff.h libxcoff.h
-xsym.lo: xsym.c xsym.h $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+xsym.lo: xsym.c $(INCDIR)/filenames.h xsym.h $(INCDIR)/hashtab.h
xtensa-isa.lo: xtensa-isa.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
$(INCDIR)/xtensa-isa.h $(INCDIR)/xtensa-isa-internal.h
xtensa-modules.lo: xtensa-modules.c $(INCDIR)/xtensa-isa.h \
$(INCDIR)/xtensa-isa-internal.h
-aix5ppc-core.lo: aix5ppc-core.c
+aix5ppc-core.lo: aix5ppc-core.c $(INCDIR)/filenames.h
aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
$(INCDIR)/bfdlink.h libaout.h $(INCDIR)/hashtab.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
@@ -1740,6 +1829,11 @@ efi-app-ia64.lo: efi-app-ia64.c $(INCDIR)/filenames.h \
$(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
$(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
peicode.h libpei.h
+efi-app-x86_64.lo: efi-app-x86_64.c $(INCDIR)/filenames.h \
+ coff-x86_64.c $(INCDIR)/hashtab.h $(INCDIR)/coff/x86_64.h \
+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h \
+ coffcode.h peicode.h libpei.h
elf64-x86-64.lo: elf64-x86-64.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/x86-64.h \
@@ -1808,6 +1902,21 @@ nlm32-alpha.lo: nlm32-alpha.c $(INCDIR)/filenames.h \
nlm64.lo: nlm64.c nlmcode.h $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \
$(INCDIR)/nlm/external.h
+coff-x86_64.lo: coff-x86_64.c $(INCDIR)/filenames.h \
+ $(INCDIR)/hashtab.h $(INCDIR)/coff/x86_64.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h coffcode.h \
+ coffswap.h
+pe-x86_64.lo: pe-x86_64.c $(INCDIR)/filenames.h coff-x86_64.c \
+ $(INCDIR)/hashtab.h $(INCDIR)/coff/x86_64.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h coffcode.h \
+ peicode.h libpei.h
+pei-x86_64.lo: pei-x86_64.c $(INCDIR)/filenames.h coff-x86_64.c \
+ $(INCDIR)/hashtab.h $(INCDIR)/coff/x86_64.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h coffcode.h \
+ peicode.h libpei.h
aix386-core.lo: aix386-core.c $(INCDIR)/filenames.h \
$(INCDIR)/hashtab.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \
$(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h
@@ -1824,16 +1933,19 @@ elf32-ia64.lo: elf32-ia64.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h \
$(INCDIR)/elf/ia64.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/objalloc.h \
- elf32-target.h
+ $(INCDIR)/hashtab.h elf32-target.h
elf64-ia64.lo: elf64-ia64.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h \
$(INCDIR)/elf/ia64.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/objalloc.h \
- elf64-target.h
+ $(INCDIR)/hashtab.h elf64-target.h
peigen.lo: peigen.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \
$(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h libpei.h
pepigen.lo: pepigen.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/ia64.h $(INCDIR)/coff/external.h \
$(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h libpei.h
+pex64igen.lo: pex64igen.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/x86_64.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h libpei.h
# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index 8ed905635617..8f4580e1821c 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -15,8 +15,6 @@
@SET_MAKE@
-SOURCES = $(libbfd_a_SOURCES) $(libbfd_la_SOURCES)
-
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
@@ -49,10 +47,17 @@ DIST_COMMON = $(srcdir)/../config.guess $(srcdir)/../config.sub README \
$(srcdir)/../config.sub
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/../config/acx.m4 $(top_srcdir)/../bfd/bfd.m4 \
- $(top_srcdir)/../bfd/warning.m4 $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../gettext.m4 $(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
+ $(top_srcdir)/../config/depstand.m4 \
+ $(top_srcdir)/../config/gettext-sister.m4 \
+ $(top_srcdir)/../config/lead-dot.m4 \
+ $(top_srcdir)/../config/nls.m4 $(top_srcdir)/../config/po.m4 \
+ $(top_srcdir)/../config/progtest.m4 \
+ $(top_srcdir)/../config/stdint.m4 $(top_srcdir)/../libtool.m4 \
+ $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
+ $(top_srcdir)/../ltversion.m4 $(top_srcdir)/bfd.m4 \
+ $(top_srcdir)/warning.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
@@ -80,19 +85,18 @@ am__objects_1 = archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo \
opncls.lo reloc.lo section.lo syms.lo targets.lo hash.lo \
linker.lo srec.lo binary.lo tekhex.lo ihex.lo stabs.lo \
stab-syms.lo merge.lo dwarf2.lo simple.lo
-am__objects_2 = archive64.lo
-am_libbfd_la_OBJECTS = $(am__objects_1) $(am__objects_2)
+am_libbfd_la_OBJECTS = $(am__objects_1)
libbfd_la_OBJECTS = $(am_libbfd_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
depcomp =
am__depfiles_maybe =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
-LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libbfd_a_SOURCES) $(libbfd_la_SOURCES)
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
@@ -105,7 +109,6 @@ ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
ACLOCAL = @ACLOCAL@
-ALLOCA = @ALLOCA@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
@@ -131,20 +134,24 @@ CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DATADIRNAME = @DATADIRNAME@
+DEBUGDIR = @DEBUGDIR@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
-GMOFILES = @GMOFILES@
+FGREP = @FGREP@
+GENCAT = @GENCAT@
+GENINSRC_NEVER_FALSE = @GENINSRC_NEVER_FALSE@
+GENINSRC_NEVER_TRUE = @GENINSRC_NEVER_TRUE@
GMSGFMT = @GMSGFMT@
-GT_NO = @GT_NO@
-GT_YES = @GT_YES@
+GREP = @GREP@
HDEFINES = @HDEFINES@
-INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
+INCINTL = @INCINTL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_LIBBFD_FALSE = @INSTALL_LIBBFD_FALSE@
INSTALL_LIBBFD_TRUE = @INSTALL_LIBBFD_TRUE@
@@ -152,10 +159,10 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTOBJEXT = @INSTOBJEXT@
-INTLDEPS = @INTLDEPS@
-INTLLIBS = @INTLLIBS@
-INTLOBJS = @INTLOBJS@
+LD = @LD@
LDFLAGS = @LDFLAGS@
+LIBINTL = @LIBINTL@
+LIBINTL_DEP = @LIBINTL_DEP@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
@@ -167,6 +174,8 @@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
+MSGMERGE = @MSGMERGE@
+NM = @NM@
NO_WERROR = @NO_WERROR@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
@@ -176,14 +185,16 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
-POFILES = @POFILES@
+PKGVERSION = @PKGVERSION@
POSUB = @POSUB@
RANLIB = @RANLIB@
+REPORT_BUGS_TEXI = @REPORT_BUGS_TEXI@
+REPORT_BUGS_TO = @REPORT_BUGS_TO@
+SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
TDEFINES = @TDEFINES@
-USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
WARN_CFLAGS = @WARN_CFLAGS@
@@ -192,6 +203,7 @@ WIN32LIBADD = @WIN32LIBADD@
XGETTEXT = @XGETTEXT@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
all_backends = @all_backends@
@@ -202,10 +214,10 @@ am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
+bfd64_libs = @bfd64_libs@
bfd_backends = @bfd_backends@
bfd_default_target_size = @bfd_default_target_size@
bfd_file_ptr = @bfd_file_ptr@
-bfd_libs = @bfd_libs@
bfd_machines = @bfd_machines@
bfd_ufile_ptr = @bfd_ufile_ptr@
bfdincludedir = @bfdincludedir@
@@ -230,10 +242,10 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
-l = @l@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@@ -251,6 +263,7 @@ target_vendor = @target_vendor@
tdefaults = @tdefaults@
wordsize = @wordsize@
AUTOMAKE_OPTIONS = 1.9 cygnus
+ACLOCAL_AMFLAGS = -I . -I .. -I ../config
# Uncomment the following line when doing a release.
# RELEASE=y
@@ -299,6 +312,7 @@ ALL_MACHINES = \
cpu-arm.lo \
cpu-avr.lo \
cpu-bfin.lo \
+ cpu-cr16.lo \
cpu-cr16c.lo \
cpu-cris.lo \
cpu-crx.lo \
@@ -327,6 +341,7 @@ ALL_MACHINES = \
cpu-m10300.lo \
cpu-maxq.lo \
cpu-mcore.lo \
+ cpu-mep.lo \
cpu-mips.lo \
cpu-mmix.lo \
cpu-mt.lo \
@@ -339,8 +354,10 @@ ALL_MACHINES = \
cpu-powerpc.lo \
cpu-rs6000.lo \
cpu-s390.lo \
+ cpu-score.lo \
cpu-sh.lo \
cpu-sparc.lo \
+ cpu-spu.lo \
cpu-tic30.lo \
cpu-tic4x.lo \
cpu-tic54x.lo \
@@ -361,6 +378,7 @@ ALL_MACHINES_CFILES = \
cpu-arm.c \
cpu-avr.c \
cpu-bfin.c \
+ cpu-cr16.c \
cpu-cris.c \
cpu-cr16c.c \
cpu-crx.c \
@@ -389,6 +407,7 @@ ALL_MACHINES_CFILES = \
cpu-m10300.c \
cpu-maxq.c \
cpu-mcore.c \
+ cpu-mep.c \
cpu-mips.c \
cpu-mmix.c \
cpu-mt.c \
@@ -401,8 +420,10 @@ ALL_MACHINES_CFILES = \
cpu-powerpc.c \
cpu-rs6000.c \
cpu-s390.c \
+ cpu-score.c \
cpu-sh.c \
cpu-sparc.c \
+ cpu-spu.c \
cpu-tic30.c \
cpu-tic4x.c \
cpu-tic54x.c \
@@ -472,6 +493,7 @@ BFD32_BACKENDS = \
elf32-arm.lo \
elf32-avr.lo \
elf32-bfin.lo \
+ elf32-cr16.lo \
elf32-cr16c.lo \
elf32-cris.lo \
elf32-crx.lo \
@@ -499,6 +521,7 @@ BFD32_BACKENDS = \
elf-m10200.lo \
elf-m10300.lo \
elf32-mcore.lo \
+ elf32-mep.lo \
elfxx-mips.lo \
elf32-mips.lo \
elf32-mt.lo \
@@ -508,12 +531,14 @@ BFD32_BACKENDS = \
elf32-pj.lo \
elf32-ppc.lo \
elf32-s390.lo \
+ elf32-score.lo \
elf32-sh.lo \
elf32-sh-symbian.lo \
elf32-sh64.lo \
elf32-sh64-com.lo \
elfxx-sparc.lo \
elf32-sparc.lo \
+ elf32-spu.lo \
elf32-v850.lo \
elf32-vax.lo \
elf32-xstormy16.lo \
@@ -521,6 +546,7 @@ BFD32_BACKENDS = \
elf32-xc16x.lo \
elf32.lo \
elflink.lo \
+ elf-attrs.lo \
elf-strtab.lo \
elf-eh-frame.lo \
elf-vxworks.lo \
@@ -560,6 +586,8 @@ BFD32_BACKENDS = \
pef.lo \
pe-arm.lo \
pei-arm.lo \
+ pe-arm-wince.lo \
+ pei-arm-wince.lo \
pe-i386.lo \
pei-i386.lo \
pe-mcore.lo \
@@ -644,6 +672,7 @@ BFD32_BACKENDS_CFILES = \
elf32-arm.c \
elf32-avr.c \
elf32-bfin.c \
+ elf32-cr16.c \
elf32-cr16c.c \
elf32-cris.c \
elf32-crx.c \
@@ -671,6 +700,7 @@ BFD32_BACKENDS_CFILES = \
elf-m10200.c \
elf-m10300.c \
elf32-mcore.c \
+ elf32-mep.c \
elfxx-mips.c \
elf32-mips.c \
elf32-mt.c \
@@ -682,10 +712,12 @@ BFD32_BACKENDS_CFILES = \
elf32-sh64.c \
elf32-sh64-com.c \
elf32-s390.c \
+ elf32-score.c \
elf32-sh.c \
elf32-sh-symbian.c \
elfxx-sparc.c \
elf32-sparc.c \
+ elf32-spu.c \
elf32-v850.c \
elf32-vax.c \
elf32-xstormy16.c \
@@ -693,6 +725,7 @@ BFD32_BACKENDS_CFILES = \
elf32-xc16x.c \
elf32.c \
elflink.c \
+ elf-attrs.c \
elf-strtab.c \
elf-eh-frame.c \
elf-vxworks.c \
@@ -732,6 +765,8 @@ BFD32_BACKENDS_CFILES = \
pef.c \
pe-arm.c \
pei-arm.c \
+ pe-arm-wince.c \
+ pei-arm-wince.c \
pe-i386.c \
pei-i386.c \
pe-mcore.c \
@@ -776,6 +811,7 @@ BFD64_BACKENDS = \
coff64-rs6000.lo \
demo64.lo \
efi-app-ia64.lo \
+ efi-app-x86_64.lo \
elf64-x86-64.lo \
elf64-alpha.lo \
elf64-hppa.lo \
@@ -793,7 +829,11 @@ BFD64_BACKENDS = \
mmo.lo \
nlm32-alpha.lo \
nlm64.lo \
- pepigen.lo
+ coff-x86_64.lo \
+ pe-x86_64.lo \
+ pei-x86_64.lo \
+ pepigen.lo \
+ pex64igen.lo
BFD64_BACKENDS_CFILES = \
aix5ppc-core.c \
@@ -802,6 +842,7 @@ BFD64_BACKENDS_CFILES = \
coff64-rs6000.c \
demo64.c \
efi-app-ia64.c \
+ efi-app-x86_64.c \
elf64-x86-64.c \
elf64-alpha.c \
elf64-hppa.c \
@@ -816,7 +857,10 @@ BFD64_BACKENDS_CFILES = \
elf64.c \
mmo.c \
nlm32-alpha.c \
- nlm64.c
+ nlm64.c \
+ coff-x86_64.c \
+ pe-x86_64.c \
+ pei-x86_64.c
OPTIONAL_BACKENDS = \
aix386-core.lo \
@@ -852,10 +896,9 @@ CONFIG_STATUS_DEPENDENCIES = \
WORDSIZE = @wordsize@
ALL_BACKENDS = @all_backends@
BFD_BACKENDS = @bfd_backends@
-BFD_LIBS = @bfd_libs@
BFD_MACHINES = @bfd_machines@
TDEFAULTS = @tdefaults@
-INCLUDES = @HDEFINES@ @COREFLAG@ @TDEFINES@ $(CSEARCH) $(CSWITCHES) -I$(srcdir)/../intl -I../intl
+INCLUDES = @HDEFINES@ @COREFLAG@ @TDEFINES@ $(CSEARCH) $(CSWITCHES) @INCINTL@
# C source files that correspond to .o's.
SOURCE_CFILES = \
@@ -867,7 +910,7 @@ SOURCE_CFILES = \
$(OPTIONAL_BACKENDS_CFILES)
BUILD_CFILES = \
- elf32-ia64.c elf64-ia64.c peigen.c pepigen.c
+ elf32-ia64.c elf64-ia64.c peigen.c pepigen.c pex64igen.c
CFILES = $(SOURCE_CFILES) $(BUILD_CFILES)
SOURCE_HFILES = \
@@ -892,11 +935,15 @@ BLD_POTFILES = $(BUILD_CFILES) $(BUILD_HFILES)
# BFD_BACKENDS Routines the configured targets need.
# BFD_MACHINES Architecture-specific routines the configured targets need.
# COREFILE Core file routines for a native configuration
-OFILES = $(BFD_BACKENDS) $(BFD_MACHINES) @COREFILE@
-libbfd_la_SOURCES = $(BFD32_LIBS_CFILES) $(BFD64_LIBS_CFILES)
+# bfd64_libs Routines for 64bit support
+OFILES = $(BFD_BACKENDS) $(BFD_MACHINES) @COREFILE@ @bfd64_libs@
+
+# Since BFD64_LIBS is optional and we can't have substitution in
+# libbfd_la_SOURCES, we put BFD64_LIBS in OFILES instead.
+libbfd_la_SOURCES = $(BFD32_LIBS_CFILES)
libbfd_la_DEPENDENCIES = $(OFILES) ofiles
libbfd_la_LIBADD = `cat ofiles` @WIN32LIBADD@
-libbfd_la_LDFLAGS = -release $(VERSION) @WIN32LDFLAGS@
+libbfd_la_LDFLAGS = -release `cat libtool-soversion` @WIN32LDFLAGS@
# libtool will build .libs/libbfd.a. We create libbfd.a in the build
# directory so that we don't have to convert all the programs that use
@@ -919,7 +966,7 @@ MOSTLYCLEANFILES = ofiles stamp-ofiles
CLEANFILES = bfd.h dep.sed stmp-bfd-h DEP DEPA DEP1 DEP2 libbfd.a stamp-lib \
stmp-bin2-h stmp-lbfd-h stmp-lcoff-h
-DISTCLEANFILES = $(BUILD_CFILES) $(BUILD_HFILES)
+DISTCLEANFILES = $(BUILD_CFILES) $(BUILD_HFILES) libtool-soversion
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
@@ -931,15 +978,15 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
- cd $(srcdir) && $(AUTOMAKE) --foreign \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --cygnus '; \
+ cd $(srcdir) && $(AUTOMAKE) --cygnus \
&& exit 0; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile'; \
cd $(top_srcdir) && \
- $(AUTOMAKE) --foreign Makefile
+ $(AUTOMAKE) --cygnus Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -1340,6 +1387,9 @@ targets.lo: targets.c Makefile
archures.lo: archures.c Makefile
$(LIBTOOL) --mode=compile $(COMPILE) -c $(TDEFAULTS) $(srcdir)/archures.c
+dwarf2.lo: dwarf2.c Makefile
+ $(LIBTOOL) --mode=compile $(COMPILE) -c -DDEBUGDIR=\"$(DEBUGDIR)\" $(srcdir)/dwarf2.c
+
elf32-target.h : elfxx-target.h
rm -f elf32-target.h
sed -e s/NN/32/g < $(srcdir)/elfxx-target.h > elf32-target.new
@@ -1369,6 +1419,11 @@ pepigen.c : peXXigen.c
rm -f pepigen.c
sed -e s/XX/pep/g < $(srcdir)/peXXigen.c > pepigen.new
mv -f pepigen.new pepigen.c
+
+pex64igen.c: peXXigen.c
+ rm -f pex64igen.c
+ sed -e s/XX/pex64/g < $(srcdir)/peXXigen.c > pex64igen.new
+ mv -f pex64igen.new pex64igen.c
$(BFD32_LIBS) \
$(BFD64_LIBS) \
$(ALL_MACHINES) \
@@ -1501,11 +1556,20 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/Makefile.in
@echo "creating $@"
@bfd_version=`echo "$(VERSION)" | sed -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\
bfd_version_string="\"$(VERSION)\"" ;\
+ bfd_soversion="$(VERSION)" ;\
+ bfd_version_package="\"$(PKGVERSION)\"" ;\
+ report_bugs_to="\"$(REPORT_BUGS_TO)\"" ;\
if test "x$(RELEASE)" = x ; then \
bfd_version_date=`sed -n -e 's/.*DATE //p' < $(srcdir)/version.h` ;\
- bfd_version_string="\"$(VERSION) $${bfd_version_date}\"" ;\
+ bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\
+ bfd_soversion="$(VERSION).$${bfd_version_date}" ;\
fi ;\
- sed -e "s/@bfd_version@/$$bfd_version/" -e "s/@bfd_version_string@/$$bfd_version_string/" < $(srcdir)/version.h > $@
+ sed -e "s,@bfd_version@,$$bfd_version," \
+ -e "s,@bfd_version_string@,$$bfd_version_string," \
+ -e "s,@bfd_version_package@,$$bfd_version_package," \
+ -e "s,@report_bugs_to@,$$report_bugs_to," \
+ < $(srcdir)/version.h > $@; \
+ echo "$${bfd_soversion}" > libtool-soversion
# What appears below is generated by a hacked mkdep using gcc -MM.
@@ -1516,11 +1580,12 @@ archive.lo: archive.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
$(INCDIR)/safe-ctype.h
archures.lo: archures.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
$(INCDIR)/safe-ctype.h
-bfd.lo: bfd.c bfdver.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
- $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h libcoff.h \
- libecoff.h $(INCDIR)/coff/ecoff.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h
+bfd.lo: bfd.c $(INCDIR)/filenames.h bfdver.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/demangle.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/sym.h libcoff.h libecoff.h $(INCDIR)/coff/ecoff.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h
bfdio.lo: bfdio.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
bfdwin.lo: bfdwin.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cache.lo: cache.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
@@ -1574,6 +1639,7 @@ cpu-arm.lo: cpu-arm.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
$(INCDIR)/libiberty.h
cpu-avr.lo: cpu-avr.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cpu-bfin.lo: cpu-bfin.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-cr16.lo: cpu-cr16.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cpu-cris.lo: cpu-cris.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cpu-cr16c.lo: cpu-cr16c.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cpu-crx.lo: cpu-crx.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
@@ -1606,6 +1672,7 @@ cpu-m10200.lo: cpu-m10200.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cpu-m10300.lo: cpu-m10300.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cpu-maxq.lo: cpu-maxq.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cpu-mcore.lo: cpu-mcore.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-mep.lo: cpu-mep.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cpu-mips.lo: cpu-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cpu-mmix.lo: cpu-mmix.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cpu-mt.lo: cpu-mt.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
@@ -1621,9 +1688,11 @@ cpu-powerpc.lo: cpu-powerpc.c $(INCDIR)/filenames.h \
$(INCDIR)/hashtab.h
cpu-rs6000.lo: cpu-rs6000.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cpu-s390.lo: cpu-s390.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-score.lo: cpu-score.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cpu-sh.lo: cpu-sh.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
$(srcdir)/../opcodes/sh-opc.h
cpu-sparc.lo: cpu-sparc.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+cpu-spu.lo: cpu-spu.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cpu-tic30.lo: cpu-tic30.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cpu-tic4x.lo: cpu-tic4x.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
cpu-tic54x.lo: cpu-tic54x.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
@@ -1693,7 +1762,8 @@ coff-arm.lo: coff-arm.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
coff-aux.lo: coff-aux.c $(INCDIR)/filenames.h $(INCDIR)/coff/aux-coff.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h \
- coff-m68k.c $(INCDIR)/hashtab.h libcoff.h $(INCDIR)/bfdlink.h \
+ coff-m68k.c $(INCDIR)/hashtab.h $(INCDIR)/coff/m68k.h \
+ $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
coffcode.h coffswap.h
coff-h8300.lo: coff-h8300.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
$(INCDIR)/bfdlink.h genlink.h $(INCDIR)/coff/h8300.h \
@@ -1763,7 +1833,7 @@ coff-tic54x.lo: coff-tic54x.c $(INCDIR)/filenames.h \
$(INCDIR)/hashtab.h $(INCDIR)/bfdlink.h $(INCDIR)/coff/tic54x.h \
$(INCDIR)/coff/ti.h $(INCDIR)/coff/internal.h libcoff.h \
coffcode.h coffswap.h
-coff-tic80.lo: coff-tic80.c $(INCDIR)/bfdlink.h $(INCDIR)/filenames.h \
+coff-tic80.lo: coff-tic80.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/hashtab.h $(INCDIR)/coff/tic80.h $(INCDIR)/coff/external.h \
$(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
coff-u68k.lo: coff-u68k.c coff-m68k.c $(INCDIR)/filenames.h \
@@ -1826,11 +1896,16 @@ elf32-arm.lo: elf32-arm.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
elf32-avr.lo: elf32-avr.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/avr.h \
- $(INCDIR)/elf/reloc-macros.h elf32-target.h
+ $(INCDIR)/elf/reloc-macros.h elf32-avr.h elf32-target.h
elf32-bfin.lo: elf32-bfin.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/bfin.h \
- $(INCDIR)/elf/reloc-macros.h elf32-target.h
+ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/elf/dwarf2.h \
+ elf32-target.h
+elf32-cr16.lo: elf32-cr16.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h elf-bfd.h \
+ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+ $(INCDIR)/elf/cr16.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
elf32-cr16c.lo: elf32-cr16c.c $(INCDIR)/filenames.h \
$(INCDIR)/hashtab.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/cr16c.h \
$(INCDIR)/elf/reloc-macros.h elf-bfd.h $(INCDIR)/elf/common.h \
@@ -1944,19 +2019,24 @@ elf32-mcore.lo: elf32-mcore.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/mcore.h \
$(INCDIR)/elf/reloc-macros.h elf32-target.h
+elf32-mep.lo: elf32-mep.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/mep.h \
+ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
+ elf32-target.h
elfxx-mips.lo: elfxx-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
$(INCDIR)/libiberty.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
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 elf-vxworks.h
+ elf-vxworks.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
+ $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h
elf32-mips.lo: elf32-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
$(INCDIR)/bfdlink.h genlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfxx-mips.h \
- $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \
- $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h elf-vxworks.h \
+ $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \
$(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h \
- ecoffswap.h elf32-target.h elf-vxworks.h
+ ecoffswap.h elf32-target.h
elf32-mt.lo: elf32-mt.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/mt.h \
@@ -1988,9 +2068,9 @@ elf32-ppc.lo: elf32-ppc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \
- elf32-sh64.h elf32-sh.c $(INCDIR)/hashtab.h $(INCDIR)/elf/sh.h \
- $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
- $(srcdir)/../opcodes/sh-opc.h elf32-target.h
+ elf32-sh64.h elf32-sh.c $(INCDIR)/hashtab.h elf-vxworks.h \
+ $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
+ $(srcdir)/../opcodes/sh-opc.h elf32-sh-relocs.h elf32-target.h
elf32-sh64-com.lo: elf32-sh64-com.c $(INCDIR)/filenames.h \
$(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
@@ -2000,27 +2080,36 @@ elf32-s390.lo: elf32-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h \
$(INCDIR)/elf/reloc-macros.h elf32-target.h
+elf32-score.lo: elf32-score.c $(INCDIR)/filenames.h \
+ $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h elf-bfd.h \
+ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/elf/score.h $(INCDIR)/elf/reloc-macros.h \
+ elf32-target.h
elf32-sh.lo: elf32-sh.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \
- $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
- $(srcdir)/../opcodes/sh-opc.h elf32-target.h
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf-vxworks.h \
+ $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
+ $(srcdir)/../opcodes/sh-opc.h elf32-sh-relocs.h elf32-target.h
elf32-sh-symbian.lo: elf32-sh-symbian.c elf32-sh.c \
$(INCDIR)/filenames.h $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
- $(INCDIR)/libiberty.h $(srcdir)/../opcodes/sh-opc.h \
- elf32-target.h
+ $(INCDIR)/elf/external.h elf-vxworks.h $(INCDIR)/elf/sh.h \
+ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
+ $(srcdir)/../opcodes/sh-opc.h elf32-sh-relocs.h elf32-target.h
elfxx-sparc.lo: elfxx-sparc.c $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
- $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \
- $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/sparc.h \
- elfxx-sparc.h elf-vxworks.h
+ $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h $(INCDIR)/elf/reloc-macros.h \
+ $(INCDIR)/opcode/sparc.h elfxx-sparc.h elf-vxworks.h
elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \
$(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/sparc.h \
- elfxx-sparc.h elf32-target.h elf-vxworks.h
+ elfxx-sparc.h elf-vxworks.h elf32-target.h
+elf32-spu.lo: elf32-spu.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/spu.h \
+ $(INCDIR)/elf/reloc-macros.h elf32-spu.h elf32-target.h
elf32-v850.lo: elf32-v850.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/v850.h \
@@ -2052,6 +2141,9 @@ elflink.lo: elflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/safe-ctype.h \
$(INCDIR)/libiberty.h $(INCDIR)/objalloc.h
+elf-attrs.lo: elf-attrs.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h
elf-strtab.lo: elf-strtab.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h
@@ -2136,7 +2228,7 @@ m88kopenbsd.lo: m88kopenbsd.c netbsd.h $(INCDIR)/filenames.h \
$(INCDIR)/hashtab.h libaout.h $(INCDIR)/bfdlink.h aout-target.h \
$(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
$(INCDIR)/aout/ar.h
-mach-o.lo: mach-o.c mach-o.h $(INCDIR)/filenames.h \
+mach-o.lo: mach-o.c $(INCDIR)/filenames.h mach-o.h \
$(INCDIR)/hashtab.h $(INCDIR)/libiberty.h mach-o-target.c
mipsbsd.lo: mipsbsd.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
@@ -2176,8 +2268,8 @@ pdp11.lo: pdp11.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
$(INCDIR)/safe-ctype.h
-pef.lo: pef.c $(INCDIR)/safe-ctype.h pef.h pef-traceback.h \
- $(INCDIR)/filenames.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h
+pef.lo: pef.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
+ pef.h pef-traceback.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h
pe-arm.lo: pe-arm.c $(INCDIR)/filenames.h coff-arm.c \
$(INCDIR)/hashtab.h $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
@@ -2186,6 +2278,16 @@ pei-arm.lo: pei-arm.c $(INCDIR)/filenames.h coff-arm.c \
$(INCDIR)/hashtab.h $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
$(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
+pe-arm-wince.lo: pe-arm-wince.c pe-arm.c $(INCDIR)/filenames.h \
+ coff-arm.c $(INCDIR)/hashtab.h $(INCDIR)/coff/arm.h \
+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
+ peicode.h libpei.h
+pei-arm-wince.lo: pei-arm-wince.c pei-arm.c $(INCDIR)/filenames.h \
+ coff-arm.c $(INCDIR)/hashtab.h $(INCDIR)/coff/arm.h \
+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
+ peicode.h libpei.h
pe-i386.lo: pe-i386.c $(INCDIR)/filenames.h coff-i386.c \
$(INCDIR)/hashtab.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
@@ -2228,7 +2330,7 @@ pei-mips.lo: pei-mips.c $(INCDIR)/filenames.h pe-mips.c \
$(INCDIR)/hashtab.h $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/external.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
$(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
-ppcboot.lo: ppcboot.c $(INCDIR)/safe-ctype.h $(INCDIR)/filenames.h \
+ppcboot.lo: ppcboot.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
$(INCDIR)/hashtab.h
reloc16.lo: reloc16.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
$(INCDIR)/bfdlink.h genlink.h $(INCDIR)/coff/internal.h \
@@ -2269,7 +2371,7 @@ vms.lo: vms.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/hashtab.h vms.h
vms-gsd.lo: vms-gsd.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/hashtab.h vms.h
-vms-hdr.lo: vms-hdr.c bfdver.h $(INCDIR)/filenames.h \
+vms-hdr.lo: vms-hdr.c $(INCDIR)/filenames.h bfdver.h \
$(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h $(INCDIR)/hashtab.h \
vms.h
vms-misc.lo: vms-misc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
@@ -2279,12 +2381,12 @@ vms-tir.lo: vms-tir.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
xcofflink.lo: xcofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/hashtab.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h \
libcoff.h libxcoff.h
-xsym.lo: xsym.c xsym.h $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+xsym.lo: xsym.c $(INCDIR)/filenames.h xsym.h $(INCDIR)/hashtab.h
xtensa-isa.lo: xtensa-isa.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
$(INCDIR)/xtensa-isa.h $(INCDIR)/xtensa-isa-internal.h
xtensa-modules.lo: xtensa-modules.c $(INCDIR)/xtensa-isa.h \
$(INCDIR)/xtensa-isa-internal.h
-aix5ppc-core.lo: aix5ppc-core.c
+aix5ppc-core.lo: aix5ppc-core.c $(INCDIR)/filenames.h
aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
$(INCDIR)/bfdlink.h libaout.h $(INCDIR)/hashtab.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
@@ -2306,6 +2408,11 @@ efi-app-ia64.lo: efi-app-ia64.c $(INCDIR)/filenames.h \
$(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
$(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
peicode.h libpei.h
+efi-app-x86_64.lo: efi-app-x86_64.c $(INCDIR)/filenames.h \
+ coff-x86_64.c $(INCDIR)/hashtab.h $(INCDIR)/coff/x86_64.h \
+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h \
+ coffcode.h peicode.h libpei.h
elf64-x86-64.lo: elf64-x86-64.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/x86-64.h \
@@ -2374,6 +2481,21 @@ nlm32-alpha.lo: nlm32-alpha.c $(INCDIR)/filenames.h \
nlm64.lo: nlm64.c nlmcode.h $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \
$(INCDIR)/nlm/external.h
+coff-x86_64.lo: coff-x86_64.c $(INCDIR)/filenames.h \
+ $(INCDIR)/hashtab.h $(INCDIR)/coff/x86_64.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h coffcode.h \
+ coffswap.h
+pe-x86_64.lo: pe-x86_64.c $(INCDIR)/filenames.h coff-x86_64.c \
+ $(INCDIR)/hashtab.h $(INCDIR)/coff/x86_64.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h coffcode.h \
+ peicode.h libpei.h
+pei-x86_64.lo: pei-x86_64.c $(INCDIR)/filenames.h coff-x86_64.c \
+ $(INCDIR)/hashtab.h $(INCDIR)/coff/x86_64.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h coffcode.h \
+ peicode.h libpei.h
aix386-core.lo: aix386-core.c $(INCDIR)/filenames.h \
$(INCDIR)/hashtab.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \
$(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h
@@ -2390,18 +2512,21 @@ elf32-ia64.lo: elf32-ia64.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h \
$(INCDIR)/elf/ia64.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/objalloc.h \
- elf32-target.h
+ $(INCDIR)/hashtab.h elf32-target.h
elf64-ia64.lo: elf64-ia64.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h \
$(INCDIR)/elf/ia64.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/objalloc.h \
- elf64-target.h
+ $(INCDIR)/hashtab.h elf64-target.h
peigen.lo: peigen.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \
$(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h libpei.h
pepigen.lo: pepigen.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/ia64.h $(INCDIR)/coff/external.h \
$(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h libpei.h
+pex64igen.lo: pex64igen.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/x86_64.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h libpei.h
# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/bfd/acinclude.m4 b/bfd/acinclude.m4
index 95e3d4a702d3..cd4fd55be6c2 100644
--- a/bfd/acinclude.m4
+++ b/bfd/acinclude.m4
@@ -1,7 +1,3 @@
-sinclude(../config/acx.m4)
-sinclude(../bfd/bfd.m4)
-sinclude(../bfd/warning.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_TARGET])
@@ -45,22 +41,6 @@ else
fi
AC_SUBST(EXEEXT_FOR_BUILD)])dnl
-sinclude(../libtool.m4)
-dnl The lines below arrange for aclocal not to bring libtool.m4
-dnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake
-dnl to add a definition of LIBTOOL to Makefile.in.
-ifelse(yes,no,[
-AC_DEFUN([AM_PROG_LIBTOOL],)
-AC_DEFUN([AM_DISABLE_SHARED],)
-AC_SUBST(LIBTOOL)
-])
-
-sinclude(../gettext.m4)
-ifelse(yes,no,[
-AC_DEFUN([CY_WITH_NLS],)
-AC_SUBST(INTLLIBS)
-])
-
AC_DEFUN([AM_INSTALL_LIBBFD],
[AC_MSG_CHECKING([whether to install libbfd])
AC_ARG_ENABLE(install-libbfd,
diff --git a/bfd/aclocal.m4 b/bfd/aclocal.m4
index d5f315805a9c..9dfea067fbf9 100644
--- a/bfd/aclocal.m4
+++ b/bfd/aclocal.m4
@@ -1,4 +1,4 @@
-# generated automatically by aclocal 1.9.5 -*- Autoconf -*-
+# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005 Free Software Foundation, Inc.
@@ -28,7 +28,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
# Call AM_AUTOMAKE_VERSION so it can be traced.
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
- [AM_AUTOMAKE_VERSION([1.9.5])])
+ [AM_AUTOMAKE_VERSION([1.9.6])])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
@@ -480,27 +480,6 @@ AC_DEFUN([AM_PROG_INSTALL_SH],
install_sh=${install_sh-"$am_aux_dir/install-sh"}
AC_SUBST(install_sh)])
-# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 2
-
-# Check whether the underlying file-system supports filenames
-# with a leading dot. For instance MS-DOS doesn't.
-AC_DEFUN([AM_SET_LEADING_DOT],
-[rm -rf .tst 2>/dev/null
-mkdir .tst 2>/dev/null
-if test -d .tst; then
- am__leading_dot=.
-else
- am__leading_dot=_
-fi
-rmdir .tst 2>/dev/null
-AC_SUBST([am__leading_dot])])
-
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
# From Jim Meyering
@@ -889,4 +868,18 @@ AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
+m4_include([../config/acx.m4])
+m4_include([../config/depstand.m4])
+m4_include([../config/gettext-sister.m4])
+m4_include([../config/lead-dot.m4])
+m4_include([../config/nls.m4])
+m4_include([../config/po.m4])
+m4_include([../config/progtest.m4])
+m4_include([../config/stdint.m4])
+m4_include([../libtool.m4])
+m4_include([../ltoptions.m4])
+m4_include([../ltsugar.m4])
+m4_include([../ltversion.m4])
+m4_include([bfd.m4])
+m4_include([warning.m4])
m4_include([acinclude.m4])
diff --git a/bfd/aix386-core.c b/bfd/aix386-core.c
index 17a0290e3544..7730011a64fa 100644
--- a/bfd/aix386-core.c
+++ b/bfd/aix386-core.c
@@ -2,7 +2,7 @@
This was based on trad-core.c, which was written by John Gilmore of
Cygnus Support.
Copyright 1988, 1989, 1991, 1992, 1993, 1994, 1996, 1998, 1999, 2000,
- 2001, 2002, 2004
+ 2001, 2002, 2004, 2006, 2007
Free Software Foundation, Inc.
Written by Minh Tran-Le <TRANLE@INTELLICORP.COM>.
Converted to back end form by Ian Lance Taylor <ian@cygnus.com>.
@@ -23,8 +23,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "coff/i386.h"
#include "coff/internal.h"
@@ -80,6 +80,7 @@ aix386_core_file_p (abfd)
struct trad_core_struct coredata;
struct corehdr internal_core;
} *mergem;
+ flagword flags;
amt = sizeof (longbuf);
if (bfd_bread ((PTR) longbuf, amt, abfd) != amt)
@@ -117,11 +118,12 @@ aix386_core_file_p (abfd)
core_hdr (abfd) = core;
/* Create the sections. */
- core_regsec (abfd) = bfd_make_section_anyway (abfd, ".reg");
+ flags = SEC_HAS_CONTENTS;
+ core_regsec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".reg",
+ flags);
if (core_regsec (abfd) == NULL)
goto loser;
- core_regsec (abfd)->flags = SEC_HAS_CONTENTS;
core_regsec (abfd)->size = sizeof (core->cd_regs);
core_regsec (abfd)->vma = (bfd_vma) -1;
@@ -129,12 +131,13 @@ aix386_core_file_p (abfd)
core_regsec (abfd)->filepos =
(file_ptr) offsetof (struct corehdr, cd_regs[0]);
- core_reg2sec (abfd) = bfd_make_section_anyway (abfd, ".reg2");
+ flags = SEC_HAS_CONTENTS;
+ core_reg2sec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".reg2",
+ flags);
if (core_reg2sec (abfd) == NULL)
/* bfd_release frees everything allocated after it's arg. */
goto loser;
- core_reg2sec (abfd)->flags = SEC_HAS_CONTENTS;
core_reg2sec (abfd)->size = sizeof (core->cd_fpregs);
core_reg2sec (abfd)->vma = (bfd_vma) -1;
core_reg2sec (abfd)->filepos =
@@ -175,11 +178,12 @@ aix386_core_file_p (abfd)
flags = SEC_ALLOC + SEC_HAS_CONTENTS;
break;
}
- core_section (abfd, n) = bfd_make_section_anyway (abfd, sname);
+ core_section (abfd, n) = bfd_make_section_anyway_with_flags (abfd,
+ sname,
+ flags);
if (core_section (abfd, n) == NULL)
goto loser;
- core_section (abfd, n)->flags = flags;
core_section (abfd, n)->size = core->cd_segs[i].cs_len;
core_section (abfd, n)->vma = core->cd_segs[i].cs_address;
core_section (abfd, n)->filepos = core->cd_segs[i].cs_offset;
diff --git a/bfd/aix5ppc-core.c b/bfd/aix5ppc-core.c
index ee2a223d9e52..ef1447b946fe 100644
--- a/bfd/aix5ppc-core.c
+++ b/bfd/aix5ppc-core.c
@@ -1,5 +1,5 @@
/* IBM RS/6000 "XCOFF" back-end for BFD.
- Copyright 2001, 2002, 2003, 2004, 2005
+ Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Tom Rix
Contributed by Red Hat Inc.
@@ -21,6 +21,7 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
+#include "sysdep.h"
#include "bfd.h"
const bfd_target *xcoff64_core_p (bfd *);
@@ -30,7 +31,6 @@ int xcoff64_core_file_failing_signal (bfd *);
#ifdef AIX_5_CORE
-#include "sysdep.h"
#include "libbfd.h"
/* Aix 5.1 system include file. */
@@ -56,6 +56,7 @@ xcoff64_core_p (bfd *abfd)
bfd_size_type i;
struct vm_infox vminfo;
const bfd_target *return_value = NULL;
+ flagword flags;
/* Get the header. */
if (bfd_seek (abfd, 0, SEEK_SET) != 0)
@@ -117,21 +118,21 @@ xcoff64_core_p (bfd *abfd)
abfd->tdata.any = new_core_hdr;
/* .stack section. */
- sec = bfd_make_section_anyway (abfd, ".stack");
+ flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
+ sec = bfd_make_section_anyway_with_flags (abfd, ".stack", flags);
if (NULL == sec)
return return_value;
- sec->flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
sec->size = core.c_size;
sec->vma = core.c_stackorg;
sec->filepos = core.c_stack;
/* .reg section for all registers. */
- sec = bfd_make_section_anyway (abfd, ".reg");
+ flags = SEC_HAS_CONTENTS | SEC_IN_MEMORY;
+ sec = bfd_make_section_anyway_with_flags (abfd, ".reg", flags);
if (NULL == sec)
return return_value;
- sec->flags = SEC_HAS_CONTENTS | SEC_IN_MEMORY;
sec->size = sizeof (struct __context64);
sec->vma = 0;
sec->filepos = 0;
@@ -141,11 +142,11 @@ xcoff64_core_p (bfd *abfd)
To actually find out how long this section is in this particular
core dump would require going down the whole list of struct
ld_info's. See if we can just fake it. */
- sec = bfd_make_section_anyway (abfd, ".ldinfo");
+ flags = SEC_HAS_CONTENTS;
+ sec = bfd_make_section_anyway_with_flags (abfd, ".ldinfo", flags);
if (NULL == sec)
return return_value;
- sec->flags = SEC_HAS_CONTENTS;
sec->size = core.c_lsize;
sec->vma = 0;
sec->filepos = core.c_loader;
@@ -155,11 +156,11 @@ xcoff64_core_p (bfd *abfd)
regions. */
/* .data section from executable. */
- sec = bfd_make_section_anyway (abfd, ".data");
+ flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
+ sec = bfd_make_section_anyway_with_flags (abfd, ".data", flags);
if (NULL == sec)
return return_value;
- sec->flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
sec->size = core.c_datasize;
sec->vma = core.c_dataorg;
sec->filepos = core.c_data;
@@ -178,11 +179,11 @@ xcoff64_core_p (bfd *abfd)
if (ldinfo.ldinfo_core)
{
- sec = bfd_make_section_anyway (abfd, ".data");
+ flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
+ sec = bfd_make_section_anyway_with_flags (abfd, ".data", flags);
if (NULL == sec)
return return_value;
- sec->flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
sec->size = ldinfo.ldinfo_datasize;
sec->vma = ldinfo.ldinfo_dataorg;
sec->filepos = ldinfo.ldinfo_core;
@@ -206,11 +207,11 @@ xcoff64_core_p (bfd *abfd)
if (vminfo.vminfo_offset)
{
- sec = bfd_make_section_anyway (abfd, ".vmdata");
+ flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
+ sec = bfd_make_section_anyway_with_flags (abfd, ".vmdata", flags);
if (NULL == sec)
return return_value;
- sec->flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
sec->size = vminfo.vminfo_size;
sec->vma = vminfo.vminfo_addr;
sec->filepos = vminfo.vminfo_offset;
diff --git a/bfd/aout-adobe.c b/bfd/aout-adobe.c
index 93182f7ad858..203738ebb409 100644
--- a/bfd/aout-adobe.c
+++ b/bfd/aout-adobe.c
@@ -1,6 +1,6 @@
/* BFD back-end for a.out.adobe binaries.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005
+ 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Cygnus Support. Based on bout.c.
@@ -20,8 +20,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "aout/adobe.h"
#include "aout/stab_gnu.h"
@@ -132,7 +132,7 @@ aout_adobe_callback (bfd *abfd)
/* First one is called ".text" or whatever; subsequent ones are
".text1", ".text2", ... */
bfd_set_error (bfd_error_no_error);
- sect = bfd_make_section (abfd, section_name);
+ sect = bfd_make_section_with_flags (abfd, section_name, flags);
trynum = 0;
while (!sect)
@@ -141,7 +141,7 @@ aout_adobe_callback (bfd *abfd)
/* Some other error -- slide into the sunset. */
return NULL;
sprintf (try_again, "%s%d", section_name, ++trynum);
- sect = bfd_make_section (abfd, try_again);
+ sect = bfd_make_section_with_flags (abfd, try_again, flags);
}
/* Fix the name, if it is a sprintf'd name. */
@@ -155,8 +155,6 @@ aout_adobe_callback (bfd *abfd)
sect->name = newname;
}
- /* Now set the section's attributes. */
- bfd_set_section_flags (abfd, sect, flags);
/* Assumed big-endian. */
sect->size = ((ext->e_size[0] << 8)
| ext->e_size[1] << 8
@@ -443,7 +441,7 @@ aout_adobe_set_arch_mach (bfd *abfd,
static int
aout_adobe_sizeof_headers (bfd *ignore_abfd ATTRIBUTE_UNUSED,
- bfd_boolean ignore ATTRIBUTE_UNUSED)
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
return sizeof (struct internal_exec);
}
@@ -452,6 +450,7 @@ aout_adobe_sizeof_headers (bfd *ignore_abfd ATTRIBUTE_UNUSED,
#define aout_32_bfd_make_debug_symbol ((asymbol *(*) (bfd *, void *, unsigned long)) bfd_nullvoidptr)
#define aout_32_bfd_reloc_type_lookup ((reloc_howto_type *(*) (bfd *, bfd_reloc_code_real_type)) bfd_nullvoidptr)
+#define aout_32_bfd_reloc_name_lookup ((reloc_howto_type *(*) (bfd *, const char *)) bfd_nullvoidptr)
#define aout_32_close_and_cleanup aout_32_bfd_free_cached_info
#define aout_32_set_arch_mach aout_adobe_set_arch_mach
#define aout_32_set_section_contents aout_adobe_set_section_contents
diff --git a/bfd/aout-arm.c b/bfd/aout-arm.c
index d8834a4f331d..4b0d42c1acad 100644
--- a/bfd/aout-arm.c
+++ b/bfd/aout-arm.c
@@ -1,6 +1,6 @@
/* BFD back-end for raw ARM a.out binaries.
- Copyright 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005
- Free Software Foundation, Inc.
+ Copyright 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005,
+ 2007 Free Software Foundation, Inc.
Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
This file is part of BFD, the Binary File Descriptor library.
@@ -19,8 +19,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
/* Avoid multiple definitions from aoutx if supporting standard a.out
as well as our own. */
@@ -50,6 +50,7 @@
#define N_MAGIC(x) ((x).a_info & ~07200)
#define MY_bfd_reloc_type_lookup aoutarm_bfd_reloc_type_lookup
+#define MY_bfd_reloc_name_lookup aoutarm_bfd_reloc_name_lookup
#include "libaout.h"
#include "aout/aout64.h"
@@ -317,6 +318,22 @@ MY (bfd_reloc_type_lookup) (bfd *abfd,
}
}
+static reloc_howto_type *
+MY (bfd_reloc_name_lookup) (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (MY (howto_table)) / sizeof (MY (howto_table)[0]);
+ i++)
+ if (MY (howto_table)[i].name != NULL
+ && strcasecmp (MY (howto_table)[i].name, r_name) == 0)
+ return &MY (howto_table)[i];
+
+ return NULL;
+}
+
#define MY_swap_std_reloc_in MY (swap_std_reloc_in)
#define MY_swap_std_reloc_out MY (swap_std_reloc_out)
#define MY_get_section_contents _bfd_generic_get_section_contents
diff --git a/bfd/aout-ns32k.c b/bfd/aout-ns32k.c
index cc9f06d8dabd..46eac5c1ccd7 100644
--- a/bfd/aout-ns32k.c
+++ b/bfd/aout-ns32k.c
@@ -1,6 +1,6 @@
/* BFD back-end for ns32k a.out-ish binaries.
Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
- 2002, 2003, 2005 Free Software Foundation, Inc.
+ 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
Contributed by Ian Dall (idall@eleceng.adelaide.edu.au).
This file is part of BFD, the Binary File Descriptor library.
@@ -28,8 +28,9 @@
the tokens. */
#define MYNS(OP) CONCAT2 (ns32kaout_,OP)
-reloc_howto_type * MYNS (bfd_reloc_type_lookup) (bfd * abfd, bfd_reloc_code_real_type);
-bfd_boolean MYNS (write_object_contents) (bfd *abfd);
+reloc_howto_type * MYNS (bfd_reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
+reloc_howto_type * MYNS (bfd_reloc_name_lookup) (bfd *, const char *);
+bfd_boolean MYNS (write_object_contents) (bfd *);
/* Avoid multiple definitions from aoutx if supporting
standard a.out format(s) as well as this one. */
@@ -246,6 +247,22 @@ MY (bfd_reloc_type_lookup) (bfd *abfd, bfd_reloc_code_real_type code)
#undef ENTRY
}
+reloc_howto_type *
+MY (bfd_reloc_name_lookup) (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (MY (howto_table)) / sizeof (MY (howto_table)[0]);
+ i++)
+ if (MY (howto_table)[i].name != NULL
+ && strcasecmp (MY (howto_table)[i].name, r_name) == 0)
+ return &MY (howto_table)[i];
+
+ return NULL;
+}
+
static void
MY_swap_std_reloc_in (bfd *abfd,
struct reloc_std_external *bytes,
@@ -274,11 +291,8 @@ MY_swap_std_reloc_out (bfd *abfd,
int r_index;
asymbol *sym = *(g->sym_ptr_ptr);
int r_extern;
- unsigned int r_addend;
asection *output_section = sym->section->output_section;
- r_addend = g->addend + (*(g->sym_ptr_ptr))->section->output_section->vma;
-
/* Name was clobbered by aout_write_syms to be symbol index. */
/* If this relocation is relative to a symbol then set the
@@ -341,7 +355,6 @@ _bfd_ns32k_relocate_contents (reloc_howto_type *howto,
case 2:
return _bfd_relocate_contents (howto, input_bfd, relocation,
location);
- break;
default:
return bfd_reloc_notsupported;
}
diff --git a/bfd/aout-target.h b/bfd/aout-target.h
index 5a30eda74142..3e5fa910170e 100644
--- a/bfd/aout-target.h
+++ b/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, 2003, 2004, 2005
+ 2000, 2001, 2002, 2003, 2004, 2005, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -29,6 +29,7 @@
#endif
extern reloc_howto_type * NAME (aout, reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
+extern reloc_howto_type * NAME (aout, reloc_name_lookup) (bfd *, const char *);
/* Set parameters about this a.out file that are machine-dependent.
This routine is called from some_aout_object_p just before it returns. */
@@ -494,6 +495,9 @@ MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
#ifndef MY_bfd_reloc_type_lookup
#define MY_bfd_reloc_type_lookup NAME (aout, reloc_type_lookup)
#endif
+#ifndef MY_bfd_reloc_name_lookup
+#define MY_bfd_reloc_name_lookup NAME (aout, reloc_name_lookup)
+#endif
#ifndef MY_bfd_make_debug_symbol
#define MY_bfd_make_debug_symbol 0
#endif
diff --git a/bfd/aout-tic30.c b/bfd/aout-tic30.c
index 0feb99decb16..6e8be1ee9a0d 100644
--- a/bfd/aout-tic30.c
+++ b/bfd/aout-tic30.c
@@ -1,5 +1,5 @@
/* BFD back-end for TMS320C30 a.out binaries.
- Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007
Free Software Foundation, Inc.
Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au)
@@ -35,8 +35,8 @@
#define TARGETNAME "a.out-tic30"
#define NAME(x,y) CONCAT3 (tic30_aout,_32_,y)
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libaout.h"
#include "aout/aout64.h"
#include "aout/stab_gnu.h"
@@ -271,6 +271,23 @@ tic30_aout_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
}
static reloc_howto_type *
+tic30_aout_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (tic30_aout_howto_table)
+ / sizeof (tic30_aout_howto_table[0]));
+ i++)
+ if (tic30_aout_howto_table[i].name != NULL
+ && strcasecmp (tic30_aout_howto_table[i].name, r_name) == 0)
+ return &tic30_aout_howto_table[i];
+
+ return NULL;
+}
+
+static reloc_howto_type *
tic30_aout_reloc_howto (bfd *abfd,
struct reloc_std_external *relocs,
int *r_index,
@@ -936,6 +953,9 @@ tic30_aout_set_arch_mach (bfd *abfd,
#ifndef MY_bfd_reloc_type_lookup
#define MY_bfd_reloc_type_lookup tic30_aout_reloc_type_lookup
#endif
+#ifndef MY_bfd_reloc_name_lookup
+#define MY_bfd_reloc_name_lookup tic30_aout_reloc_name_lookup
+#endif
#ifndef MY_bfd_make_debug_symbol
#define MY_bfd_make_debug_symbol 0
#endif
diff --git a/bfd/aoutf1.h b/bfd/aoutf1.h
index cba4fbbeff99..0353bfdc3f28 100644
--- a/bfd/aoutf1.h
+++ b/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, 2003, 2004, 2005, 2006
+ 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -20,8 +20,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "aout/sun4.h"
@@ -566,6 +566,7 @@ sunos4_core_file_p (bfd *abfd)
struct internal_sunos_core internal_sunos_core;
char external_core[1];
} *mergem;
+ flagword flags;
if (bfd_bread ((void *) longbuf, (bfd_size_type) sizeof (longbuf), abfd)
!= sizeof (longbuf))
@@ -627,28 +628,31 @@ sunos4_core_file_p (bfd *abfd)
abfd->tdata.sun_core_data->hdr = core;
/* Create the sections. */
- core_stacksec (abfd) = bfd_make_section_anyway (abfd, ".stack");
+ flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
+ core_stacksec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".stack",
+ flags);
if (core_stacksec (abfd) == NULL)
/* bfd_release frees everything allocated after it's arg. */
goto loser;
- core_datasec (abfd) = bfd_make_section_anyway (abfd, ".data");
+ flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
+ core_datasec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".data",
+ flags);
if (core_datasec (abfd) == NULL)
goto loser;
- core_regsec (abfd) = bfd_make_section_anyway (abfd, ".reg");
+ flags = SEC_HAS_CONTENTS;
+ core_regsec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".reg",
+ flags);
if (core_regsec (abfd) == NULL)
goto loser;
- core_reg2sec (abfd) = bfd_make_section_anyway (abfd, ".reg2");
+ flags = SEC_HAS_CONTENTS;
+ core_reg2sec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".reg2",
+ flags);
if (core_reg2sec (abfd) == NULL)
goto loser;
- core_stacksec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
- core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
- core_regsec (abfd)->flags = SEC_HAS_CONTENTS;
- core_reg2sec (abfd)->flags = SEC_HAS_CONTENTS;
-
core_stacksec (abfd)->size = core->c_ssize;
core_datasec (abfd)->size = core->c_dsize;
core_regsec (abfd)->size = core->c_regs_size;
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index 7dce07240ff6..09331aa0ca24 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -1,6 +1,6 @@
/* BFD semi-generic back-end for a.out binaries.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -118,8 +118,8 @@ DESCRIPTION
#define KEEPIT udata.i
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "safe-ctype.h"
#include "bfdlink.h"
@@ -129,8 +129,6 @@ DESCRIPTION
#include "aout/stab_gnu.h"
#include "aout/ar.h"
-reloc_howto_type * NAME (aout, reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
-
/*
SUBSECTION
Relocations
@@ -319,6 +317,31 @@ NAME (aout, reloc_type_lookup) (bfd *abfd, bfd_reloc_code_real_type code)
}
}
+reloc_howto_type *
+NAME (aout, reloc_name_lookup) (bfd *abfd, const char *r_name)
+{
+ unsigned int i, size;
+ reloc_howto_type *howto_table;
+
+ if (obj_reloc_entry_size (abfd) == RELOC_EXT_SIZE)
+ {
+ howto_table = howto_table_ext;
+ size = sizeof (howto_table_ext) / sizeof (howto_table_ext[0]);
+ }
+ else
+ {
+ howto_table = howto_table_std;
+ size = sizeof (howto_table_std) / sizeof (howto_table_std[0]);
+ }
+
+ for (i = 0; i < size; i++)
+ if (howto_table[i].name != NULL
+ && strcasecmp (howto_table[i].name, r_name) == 0)
+ return &howto_table[i];
+
+ return NULL;
+}
+
/*
SUBSECTION
Internal entry points
@@ -1193,26 +1216,21 @@ NAME (aout, new_section_hook) (bfd *abfd, asection *newsect)
{
obj_textsec (abfd)= newsect;
newsect->target_index = N_TEXT;
- return TRUE;
}
-
- if (obj_datasec (abfd) == NULL && !strcmp (newsect->name, ".data"))
+ else if (obj_datasec (abfd) == NULL && !strcmp (newsect->name, ".data"))
{
obj_datasec (abfd) = newsect;
newsect->target_index = N_DATA;
- return TRUE;
}
-
- if (obj_bsssec (abfd) == NULL && !strcmp (newsect->name, ".bss"))
+ else if (obj_bsssec (abfd) == NULL && !strcmp (newsect->name, ".bss"))
{
obj_bsssec (abfd) = newsect;
newsect->target_index = N_BSS;
- return TRUE;
}
}
/* We allow more than three sections internally. */
- return TRUE;
+ return _bfd_generic_new_section_hook (abfd, newsect);
}
bfd_boolean
@@ -1934,7 +1952,10 @@ NAME (aout, swap_std_reloc_out) (bfd *abfd,
if (bfd_is_com_section (output_section)
|| bfd_is_abs_section (output_section)
- || bfd_is_und_section (output_section))
+ || bfd_is_und_section (output_section)
+ /* PR gas/3041 a.out relocs against weak symbols
+ must be treated as if they were against externs. */
+ || (sym->flags & BSF_WEAK))
{
if (bfd_abs_section_ptr->symbol == sym)
{
@@ -2785,7 +2806,8 @@ NAME (aout, find_nearest_line) (bfd *abfd,
}
int
-NAME (aout, sizeof_headers) (bfd *abfd, bfd_boolean execable ATTRIBUTE_UNUSED)
+NAME (aout, sizeof_headers) (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
return adata (abfd).exec_bytes_size;
}
diff --git a/bfd/archive.c b/bfd/archive.c
index 5a12f01f7cc5..053ad47dfddf 100644
--- a/bfd/archive.c
+++ b/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, 2003, 2004, 2005
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Cygnus Support. Mostly Gumby Henkel-Wallace's fault.
@@ -129,8 +129,8 @@ SUBSECTION
" 18 " - Long name 18 characters long, extended pseudo-BSD.
*/
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libiberty.h"
#include "libbfd.h"
#include "aout/ar.h"
@@ -666,10 +666,7 @@ bfd_generic_archive_p (bfd *abfd)
first = bfd_openr_next_archived_file (abfd, NULL);
if (first != NULL)
{
- bfd_boolean fail;
-
first->target_defaulted = FALSE;
- fail = FALSE;
if (bfd_check_format (first, bfd_object)
&& first->xvec != abfd->xvec)
{
@@ -915,12 +912,12 @@ bfd_slurp_armap (bfd *abfd)
if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
return FALSE;
- if (!strncmp (nextname, "__.SYMDEF ", 16)
- || !strncmp (nextname, "__.SYMDEF/ ", 16)) /* old Linux archives */
+ if (CONST_STRNEQ (nextname, "__.SYMDEF ")
+ || CONST_STRNEQ (nextname, "__.SYMDEF/ ")) /* Old Linux archives. */
return do_slurp_bsd_armap (abfd);
- else if (!strncmp (nextname, "/ ", 16))
+ else if (CONST_STRNEQ (nextname, "/ "))
return do_slurp_coff_armap (abfd);
- else if (!strncmp (nextname, "/SYM64/ ", 16))
+ else if (CONST_STRNEQ (nextname, "/SYM64/ "))
{
/* 64bit ELF (Irix 6) archive. */
#ifdef BFD64
@@ -966,11 +963,11 @@ bfd_slurp_bsd_armap_f2 (bfd *abfd)
if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
return FALSE;
- if (!strncmp (nextname, "__.SYMDEF ", 16)
- || !strncmp (nextname, "__.SYMDEF/ ", 16)) /* Old Linux archives. */
+ if (CONST_STRNEQ (nextname, "__.SYMDEF ")
+ || CONST_STRNEQ (nextname, "__.SYMDEF/ ")) /* Old Linux archives. */
return do_slurp_bsd_armap (abfd);
- if (strncmp (nextname, "/ ", 16))
+ if (! CONST_STRNEQ (nextname, "/ "))
{
bfd_has_map (abfd) = FALSE;
return TRUE;
@@ -1066,8 +1063,8 @@ _bfd_slurp_extended_name_table (bfd *abfd)
if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
return FALSE;
- if (strncmp (nextname, "ARFILENAMES/ ", 16) != 0 &&
- strncmp (nextname, "// ", 16) != 0)
+ if (! CONST_STRNEQ (nextname, "ARFILENAMES/ ")
+ && ! CONST_STRNEQ (nextname, "// "))
{
bfd_ardata (abfd)->extended_names = NULL;
bfd_ardata (abfd)->extended_names_size = 0;
@@ -1237,7 +1234,9 @@ _bfd_construct_extended_name_table (bfd *abfd,
*tablen = 0;
/* Figure out how long the table should be. */
- for (current = abfd->archive_head; current != NULL; current = current->next)
+ for (current = abfd->archive_head;
+ current != NULL;
+ current = current->archive_next)
{
const char *normal;
unsigned int thislen;
@@ -1289,8 +1288,9 @@ _bfd_construct_extended_name_table (bfd *abfd,
*tablen = total_namelen;
strptr = *tabloc;
- for (current = abfd->archive_head; current != NULL; current =
- current->next)
+ for (current = abfd->archive_head;
+ current != NULL;
+ current = current->archive_next)
{
const char *normal;
unsigned int thislen;
@@ -1339,7 +1339,7 @@ hpux_uid_gid_encode (char str[6], long int id)
str[5] = '@' + (id & 3);
id >>= 2;
- for (cnt = 4; cnt >= 0; ++cnt, id >>= 6)
+ for (cnt = 4; cnt >= 0; --cnt, id >>= 6)
str[cnt] = ' ' + (id & 0x3f);
}
#endif /* HPUX_LARGE_AR_IDS */
@@ -1640,7 +1640,9 @@ _bfd_write_archive_contents (bfd *arch)
/* Verify the viability of all entries; if any of them live in the
filesystem (as opposed to living in an archive open for input)
then construct a fresh ar_hdr for them. */
- for (current = arch->archive_head; current; current = current->next)
+ for (current = arch->archive_head;
+ current != NULL;
+ current = current->archive_next)
{
/* This check is checking the bfds for the objects we're reading
from (which are usually either an object file or archive on
@@ -1650,14 +1652,14 @@ _bfd_write_archive_contents (bfd *arch)
if (bfd_write_p (current))
{
bfd_set_error (bfd_error_invalid_operation);
- return FALSE;
+ goto input_err;
}
if (!current->arelt_data)
{
current->arelt_data =
bfd_ar_hdr_from_filesystem (arch, current->filename, current);
if (!current->arelt_data)
- return FALSE;
+ goto input_err;
/* Put in the file name. */
BFD_SEND (arch, _bfd_truncate_arname,
@@ -1708,7 +1710,9 @@ _bfd_write_archive_contents (bfd *arch)
}
}
- for (current = arch->archive_head; current; current = current->next)
+ for (current = arch->archive_head;
+ current != NULL;
+ current = current->archive_next)
{
char buffer[DEFAULT_BUFFERSIZE];
unsigned int remaining = arelt_size (current);
@@ -1719,7 +1723,7 @@ _bfd_write_archive_contents (bfd *arch)
!= sizeof (*hdr))
return FALSE;
if (bfd_seek (current, (file_ptr) 0, SEEK_SET) != 0)
- return FALSE;
+ goto input_err;
while (remaining)
{
unsigned int amt = DEFAULT_BUFFERSIZE;
@@ -1729,8 +1733,8 @@ _bfd_write_archive_contents (bfd *arch)
if (bfd_bread (buffer, amt, current) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_malformed_archive);
- return FALSE;
+ bfd_set_error (bfd_error_file_truncated);
+ goto input_err;
}
if (bfd_bwrite (buffer, amt, arch) != amt)
return FALSE;
@@ -1763,6 +1767,10 @@ _bfd_write_archive_contents (bfd *arch)
}
return TRUE;
+
+ input_err:
+ bfd_set_error (bfd_error_on_input, current, bfd_get_error ());
+ return FALSE;
}
/* Note that the namidx for the first symbol is 0. */
@@ -1801,12 +1809,12 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
/* Drop all the files called __.SYMDEF, we're going to make our own. */
while (arch->archive_head &&
strcmp (arch->archive_head->filename, "__.SYMDEF") == 0)
- arch->archive_head = arch->archive_head->next;
+ arch->archive_head = arch->archive_head->archive_next;
/* Map over each element. */
for (current = arch->archive_head;
current != NULL;
- current = current->next, elt_no++)
+ current = current->archive_next, elt_no++)
{
if (bfd_check_format (current, bfd_object)
&& (bfd_get_file_flags (current) & HAS_SYMS) != 0)
@@ -1963,7 +1971,7 @@ bsd_write_armap (bfd *arch,
{
firstreal += arelt_size (current) + sizeof (struct ar_hdr);
firstreal += firstreal % 2;
- current = current->next;
+ current = current->archive_next;
}
while (current != map[count].u.abfd);
}
@@ -2133,7 +2141,7 @@ coff_write_armap (bfd *arch,
archive_member_file_ptr += arelt_size (current) + sizeof (struct ar_hdr);
/* Remember aboout the even alignment. */
archive_member_file_ptr += archive_member_file_ptr % 2;
- current = current->next;
+ current = current->archive_next;
}
/* Now write the strings themselves. */
diff --git a/bfd/archive64.c b/bfd/archive64.c
index 3b28f853c216..5e2bf1198c20 100644
--- a/bfd/archive64.c
+++ b/bfd/archive64.c
@@ -1,30 +1,30 @@
/* MIPS-specific support for 64-bit ELF
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2006, 2007
Free Software Foundation, Inc.
Ian Lance Taylor, Cygnus Support
Linker support added by Mark Mitchell, CodeSourcery, LLC.
<mark@codesourcery.com>
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* This file supports the 64-bit (MIPS) ELF archives. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "aout/ar.h"
@@ -65,10 +65,10 @@ bfd_elf64_archive_slurp_armap (bfd *abfd)
return FALSE;
/* Archives with traditional armaps are still permitted. */
- if (strncmp (nextname, "/ ", 16) == 0)
+ if (CONST_STRNEQ (nextname, "/ "))
return bfd_slurp_armap (abfd);
- if (strncmp (nextname, "/SYM64/ ", 16) != 0)
+ if (! CONST_STRNEQ (nextname, "/SYM64/ "))
{
bfd_has_map (abfd) = FALSE;
return TRUE;
@@ -215,7 +215,7 @@ bfd_elf64_archive_write_armap (bfd *arch,
+ sizeof (struct ar_hdr));
/* remember about the even alignment */
archive_member_file_ptr += archive_member_file_ptr % 2;
- current = current->next;
+ current = current->archive_next;
}
/* now write the strings themselves */
diff --git a/bfd/archures.c b/bfd/archures.c
index f4080a63a46e..df4e788b79e8 100644
--- a/bfd/archures.c
+++ b/bfd/archures.c
@@ -1,6 +1,6 @@
/* BFD library support routines for architectures.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Hacked by John Gilmore and Steve Chamberlain of Cygnus Support.
@@ -20,8 +20,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "safe-ctype.h"
@@ -80,22 +80,26 @@ DESCRIPTION
.#define bfd_mach_m68040 6
.#define bfd_mach_m68060 7
.#define bfd_mach_cpu32 8
-.#define bfd_mach_mcf_isa_a_nodiv 9
-.#define bfd_mach_mcf_isa_a 10
-.#define bfd_mach_mcf_isa_a_mac 11
-.#define bfd_mach_mcf_isa_a_emac 12
-.#define bfd_mach_mcf_isa_aplus 13
-.#define bfd_mach_mcf_isa_aplus_mac 14
-.#define bfd_mach_mcf_isa_aplus_emac 15
-.#define bfd_mach_mcf_isa_b_nousp 16
-.#define bfd_mach_mcf_isa_b_nousp_mac 17
-.#define bfd_mach_mcf_isa_b_nousp_emac 18
-.#define bfd_mach_mcf_isa_b 19
-.#define bfd_mach_mcf_isa_b_mac 20
-.#define bfd_mach_mcf_isa_b_emac 21
-.#define bfd_mach_mcf_isa_b_float 22
-.#define bfd_mach_mcf_isa_b_float_mac 23
-.#define bfd_mach_mcf_isa_b_float_emac 24
+.#define bfd_mach_fido 9
+.#define bfd_mach_mcf_isa_a_nodiv 10
+.#define bfd_mach_mcf_isa_a 11
+.#define bfd_mach_mcf_isa_a_mac 12
+.#define bfd_mach_mcf_isa_a_emac 13
+.#define bfd_mach_mcf_isa_aplus 14
+.#define bfd_mach_mcf_isa_aplus_mac 15
+.#define bfd_mach_mcf_isa_aplus_emac 16
+.#define bfd_mach_mcf_isa_b_nousp 17
+.#define bfd_mach_mcf_isa_b_nousp_mac 18
+.#define bfd_mach_mcf_isa_b_nousp_emac 19
+.#define bfd_mach_mcf_isa_b 20
+.#define bfd_mach_mcf_isa_b_mac 21
+.#define bfd_mach_mcf_isa_b_emac 22
+.#define bfd_mach_mcf_isa_b_float 23
+.#define bfd_mach_mcf_isa_b_float_mac 24
+.#define bfd_mach_mcf_isa_b_float_emac 25
+.#define bfd_mach_mcf_isa_c 26
+.#define bfd_mach_mcf_isa_c_mac 27
+.#define bfd_mach_mcf_isa_c_emac 28
. bfd_arch_vax, {* DEC Vax *}
. bfd_arch_i960, {* Intel 960 *}
. {* The order of the following is important.
@@ -136,6 +140,8 @@ DESCRIPTION
.{* Nonzero if MACH is a 64 bit sparc architecture. *}
.#define bfd_mach_sparc_64bit_p(mach) \
. ((mach) >= bfd_mach_sparc_v9 && (mach) != bfd_mach_sparc_v8plusb)
+. bfd_arch_spu, {* PowerPC SPU *}
+.#define bfd_mach_spu 256
. bfd_arch_mips, {* MIPS Rxxxx *}
.#define bfd_mach_mips3000 3000
.#define bfd_mach_mips3900 3900
@@ -273,6 +279,7 @@ DESCRIPTION
.#define bfd_mach_arm_XScale 10
.#define bfd_mach_arm_ep9312 11
.#define bfd_mach_arm_iWMMXt 12
+.#define bfd_mach_arm_iWMMXt2 13
. bfd_arch_ns32k, {* National Semiconductors ns32000 *}
. bfd_arch_w65, {* WDC 65816 *}
. bfd_arch_tic30, {* Texas Instruments TMS320C30 *}
@@ -314,6 +321,9 @@ DESCRIPTION
.#define bfd_mach_fr500 500
.#define bfd_mach_fr550 550
. bfd_arch_mcore,
+. bfd_arch_mep,
+.#define bfd_mach_mep 1
+.#define bfd_mach_mep_h1 0x6831
. bfd_arch_ia64, {* HP/Intel ia64 *}
.#define bfd_mach_ia64_elf64 64
.#define bfd_mach_ia64_elf32 32
@@ -334,8 +344,11 @@ DESCRIPTION
.#define bfd_mach_avr3 3
.#define bfd_mach_avr4 4
.#define bfd_mach_avr5 5
+.#define bfd_mach_avr6 6
. bfd_arch_bfin, {* ADI Blackfin *}
.#define bfd_mach_bfin 1
+. bfd_arch_cr16, {* National Semiconductor CompactRISC (ie CR16). *}
+.#define bfd_mach_cr16 1
. bfd_arch_cr16c, {* National Semiconductor CompactRISC. *}
.#define bfd_mach_cr16c 1
. bfd_arch_crx, {* National Semiconductor CRX. *}
@@ -347,6 +360,7 @@ DESCRIPTION
. bfd_arch_s390, {* IBM s390 *}
.#define bfd_mach_s390_31 31
.#define bfd_mach_s390_64 64
+. bfd_arch_score, {* Sunplus score *}
. bfd_arch_openrisc, {* OpenRISC *}
. bfd_arch_mmix, {* Donald Knuth's educational processor. *}
. bfd_arch_xstormy16,
@@ -424,6 +438,7 @@ extern const bfd_arch_info_type bfd_arc_arch;
extern const bfd_arch_info_type bfd_arm_arch;
extern const bfd_arch_info_type bfd_avr_arch;
extern const bfd_arch_info_type bfd_bfin_arch;
+extern const bfd_arch_info_type bfd_cr16_arch;
extern const bfd_arch_info_type bfd_cr16c_arch;
extern const bfd_arch_info_type bfd_cris_arch;
extern const bfd_arch_info_type bfd_crx_arch;
@@ -450,6 +465,7 @@ extern const bfd_arch_info_type bfd_m68k_arch;
extern const bfd_arch_info_type bfd_m88k_arch;
extern const bfd_arch_info_type bfd_maxq_arch;
extern const bfd_arch_info_type bfd_mcore_arch;
+extern const bfd_arch_info_type bfd_mep_arch;
extern const bfd_arch_info_type bfd_mips_arch;
extern const bfd_arch_info_type bfd_mmix_arch;
extern const bfd_arch_info_type bfd_mn10200_arch;
@@ -465,8 +481,10 @@ extern const bfd_arch_info_type bfd_powerpc_archs[];
#define bfd_powerpc_arch bfd_powerpc_archs[0]
extern const bfd_arch_info_type bfd_rs6000_arch;
extern const bfd_arch_info_type bfd_s390_arch;
+extern const bfd_arch_info_type bfd_score_arch;
extern const bfd_arch_info_type bfd_sh_arch;
extern const bfd_arch_info_type bfd_sparc_arch;
+extern const bfd_arch_info_type bfd_spu_arch;
extern const bfd_arch_info_type bfd_tic30_arch;
extern const bfd_arch_info_type bfd_tic4x_arch;
extern const bfd_arch_info_type bfd_tic54x_arch;
@@ -491,6 +509,7 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
&bfd_arm_arch,
&bfd_avr_arch,
&bfd_bfin_arch,
+ &bfd_cr16_arch,
&bfd_cr16c_arch,
&bfd_cris_arch,
&bfd_crx_arch,
@@ -517,6 +536,7 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
&bfd_m88k_arch,
&bfd_maxq_arch,
&bfd_mcore_arch,
+ &bfd_mep_arch,
&bfd_mips_arch,
&bfd_mmix_arch,
&bfd_mn10200_arch,
@@ -530,8 +550,10 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
&bfd_powerpc_arch,
&bfd_rs6000_arch,
&bfd_s390_arch,
+ &bfd_score_arch,
&bfd_sh_arch,
&bfd_sparc_arch,
+ &bfd_spu_arch,
&bfd_tic30_arch,
&bfd_tic4x_arch,
&bfd_tic54x_arch,
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index 33b649d05855..617aa07ec550 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -1,7 +1,7 @@
/* Main header file for the bfd library -- portable access to object files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Contributed by Cygnus Support.
@@ -43,6 +43,30 @@ extern "C" {
#endif
#endif
+/* This is a utility macro to handle the situation where the code
+ wants to place a constant string into the code, followed by a
+ comma and then the length of the string. Doing this by hand
+ is error prone, so using this macro is safer. The macro will
+ also safely handle the case where a NULL is passed as the arg. */
+#define STRING_COMMA_LEN(STR) (STR), ((STR) ? sizeof (STR) - 1 : 0)
+/* Unfortunately it is not possible to use the STRING_COMMA_LEN macro
+ to create the arguments to another macro, since the preprocessor
+ will mis-count the number of arguments to the outer macro (by not
+ evaluating STRING_COMMA_LEN and so missing the comma). This is a
+ problem for example when trying to use STRING_COMMA_LEN to build
+ the arguments to the strncmp() macro. Hence this alternative
+ definition of strncmp is provided here.
+
+ Note - these macros do NOT work if STR2 is not a constant string. */
+#define CONST_STRNEQ(STR1,STR2) (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0)
+ /* strcpy() can have a similar problem, but since we know we are
+ copying a constant string, we can use memcpy which will be faster
+ since there is no need to check for a NUL byte inside STR. We
+ can also save time if we do not need to copy the terminating NUL. */
+#define LITMEMCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2) - 1)
+#define LITSTRCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2))
+
+
/* The word size used by BFD on the host. This may be 64 with a 32
bit target if the host is 64 bit, or if other 64 bit targets have
been selected with --enable-targets, or if --enable-64-bit-bfd. */
@@ -326,7 +350,15 @@ typedef struct bfd_section *sec_ptr;
(((sec)->rawsize ? (sec)->rawsize : (sec)->size) \
/ bfd_octets_per_byte (bfd))
-typedef struct stat stat_type;
+/* Return TRUE if section has been discarded. */
+#define elf_discarded_section(sec) \
+ (!bfd_is_abs_section (sec) \
+ && bfd_is_abs_section ((sec)->output_section) \
+ && (sec)->sec_info_type != ELF_INFO_TYPE_MERGE \
+ && (sec)->sec_info_type != ELF_INFO_TYPE_JUST_SYMS)
+
+/* Forward define. */
+struct stat;
typedef enum bfd_print_symbol
{
@@ -374,10 +406,6 @@ struct bfd_hash_table
{
/* The hash array. */
struct bfd_hash_entry **table;
- /* The number of slots in the hash table. */
- unsigned int size;
- /* The size of elements. */
- unsigned int entsize;
/* A function used to create new elements in the hash table. The
first entry is itself a pointer to an element. When this
function is first invoked, this pointer will be NULL. However,
@@ -390,6 +418,14 @@ struct bfd_hash_table
/* An objalloc for this hash table. This is a struct objalloc *,
but we use void * to avoid requiring the inclusion of objalloc.h. */
void *memory;
+ /* The number of slots in the hash table. */
+ unsigned int size;
+ /* The number of entries in the hash table. */
+ unsigned int count;
+ /* The size of elements. */
+ unsigned int entsize;
+ /* If non-zero, don't grow the hash table. */
+ unsigned int frozen:1;
};
/* Initialize a hash table. */
@@ -660,7 +696,7 @@ extern void bfd_elf_set_dt_needed_name
extern const char *bfd_elf_get_dt_soname
(bfd *);
extern void bfd_elf_set_dyn_lib_class
- (bfd *, int);
+ (bfd *, enum dynamic_lib_link_class);
extern int bfd_elf_get_dyn_lib_class
(bfd *);
extern struct bfd_link_needed_list *bfd_elf_get_runpath_list
@@ -817,6 +853,27 @@ extern bfd_boolean bfd_coff_set_symbol_class
extern bfd_boolean bfd_m68k_coff_create_embedded_relocs
(bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **);
+/* ARM VFP11 erratum workaround support. */
+typedef enum
+{
+ BFD_ARM_VFP11_FIX_DEFAULT,
+ BFD_ARM_VFP11_FIX_NONE,
+ BFD_ARM_VFP11_FIX_SCALAR,
+ BFD_ARM_VFP11_FIX_VECTOR
+} bfd_arm_vfp11_fix;
+
+extern void bfd_elf32_arm_init_maps
+ (bfd *);
+
+extern void bfd_elf32_arm_set_vfp11_fix
+ (bfd *, struct bfd_link_info *);
+
+extern bfd_boolean bfd_elf32_arm_vfp11_erratum_scan
+ (bfd *, struct bfd_link_info *);
+
+extern void bfd_elf32_arm_vfp11_fix_veneer_locations
+ (bfd *, struct bfd_link_info *);
+
/* ARM Interworking support. Called from linker. */
extern bfd_boolean bfd_arm_allocate_interworking_sections
(struct bfd_link_info *);
@@ -842,10 +899,11 @@ extern bfd_boolean bfd_elf32_arm_allocate_interworking_sections
(struct bfd_link_info *);
extern bfd_boolean bfd_elf32_arm_process_before_allocation
- (bfd *, struct bfd_link_info *, int);
+ (bfd *, struct bfd_link_info *);
void bfd_elf32_arm_set_target_relocs
- (struct bfd_link_info *, int, char *, int, int);
+ (bfd *, struct bfd_link_info *, int, char *, int, int, bfd_arm_vfp11_fix,
+ int, int);
extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking
(bfd *, struct bfd_link_info *);
@@ -854,8 +912,14 @@ extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd
(bfd *, struct bfd_link_info *);
/* ELF ARM mapping symbol support */
-extern bfd_boolean bfd_is_arm_mapping_symbol_name
- (const char * name);
+#define BFD_ARM_SPECIAL_SYM_TYPE_MAP (1 << 0)
+#define BFD_ARM_SPECIAL_SYM_TYPE_TAG (1 << 1)
+#define BFD_ARM_SPECIAL_SYM_TYPE_OTHER (1 << 2)
+#define BFD_ARM_SPECIAL_SYM_TYPE_ANY (~0)
+extern bfd_boolean bfd_is_arm_special_symbol_name
+ (const char * name, int type);
+
+extern void bfd_elf32_arm_set_byteswap_code (struct bfd_link_info *, int);
/* ARM Note section processing. */
extern bfd_boolean bfd_arm_merge_machines
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index ddcda2377df6..8ea1cdd3b188 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -8,7 +8,7 @@
/* Main header file for the bfd library -- portable access to object files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Contributed by Cygnus Support.
@@ -50,6 +50,30 @@ extern "C" {
#endif
#endif
+/* This is a utility macro to handle the situation where the code
+ wants to place a constant string into the code, followed by a
+ comma and then the length of the string. Doing this by hand
+ is error prone, so using this macro is safer. The macro will
+ also safely handle the case where a NULL is passed as the arg. */
+#define STRING_COMMA_LEN(STR) (STR), ((STR) ? sizeof (STR) - 1 : 0)
+/* Unfortunately it is not possible to use the STRING_COMMA_LEN macro
+ to create the arguments to another macro, since the preprocessor
+ will mis-count the number of arguments to the outer macro (by not
+ evaluating STRING_COMMA_LEN and so missing the comma). This is a
+ problem for example when trying to use STRING_COMMA_LEN to build
+ the arguments to the strncmp() macro. Hence this alternative
+ definition of strncmp is provided here.
+
+ Note - these macros do NOT work if STR2 is not a constant string. */
+#define CONST_STRNEQ(STR1,STR2) (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0)
+ /* strcpy() can have a similar problem, but since we know we are
+ copying a constant string, we can use memcpy which will be faster
+ since there is no need to check for a NUL byte inside STR. We
+ can also save time if we do not need to copy the terminating NUL. */
+#define LITMEMCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2) - 1)
+#define LITSTRCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2))
+
+
/* The word size used by BFD on the host. This may be 64 with a 32
bit target if the host is 64 bit, or if other 64 bit targets have
been selected with --enable-targets, or if --enable-64-bit-bfd. */
@@ -333,7 +357,15 @@ typedef struct bfd_section *sec_ptr;
(((sec)->rawsize ? (sec)->rawsize : (sec)->size) \
/ bfd_octets_per_byte (bfd))
-typedef struct stat stat_type;
+/* Return TRUE if section has been discarded. */
+#define elf_discarded_section(sec) \
+ (!bfd_is_abs_section (sec) \
+ && bfd_is_abs_section ((sec)->output_section) \
+ && (sec)->sec_info_type != ELF_INFO_TYPE_MERGE \
+ && (sec)->sec_info_type != ELF_INFO_TYPE_JUST_SYMS)
+
+/* Forward define. */
+struct stat;
typedef enum bfd_print_symbol
{
@@ -381,10 +413,6 @@ struct bfd_hash_table
{
/* The hash array. */
struct bfd_hash_entry **table;
- /* The number of slots in the hash table. */
- unsigned int size;
- /* The size of elements. */
- unsigned int entsize;
/* A function used to create new elements in the hash table. The
first entry is itself a pointer to an element. When this
function is first invoked, this pointer will be NULL. However,
@@ -397,6 +425,14 @@ struct bfd_hash_table
/* An objalloc for this hash table. This is a struct objalloc *,
but we use void * to avoid requiring the inclusion of objalloc.h. */
void *memory;
+ /* The number of slots in the hash table. */
+ unsigned int size;
+ /* The number of entries in the hash table. */
+ unsigned int count;
+ /* The size of elements. */
+ unsigned int entsize;
+ /* If non-zero, don't grow the hash table. */
+ unsigned int frozen:1;
};
/* Initialize a hash table. */
@@ -667,7 +703,7 @@ extern void bfd_elf_set_dt_needed_name
extern const char *bfd_elf_get_dt_soname
(bfd *);
extern void bfd_elf_set_dyn_lib_class
- (bfd *, int);
+ (bfd *, enum dynamic_lib_link_class);
extern int bfd_elf_get_dyn_lib_class
(bfd *);
extern struct bfd_link_needed_list *bfd_elf_get_runpath_list
@@ -824,6 +860,27 @@ extern bfd_boolean bfd_coff_set_symbol_class
extern bfd_boolean bfd_m68k_coff_create_embedded_relocs
(bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **);
+/* ARM VFP11 erratum workaround support. */
+typedef enum
+{
+ BFD_ARM_VFP11_FIX_DEFAULT,
+ BFD_ARM_VFP11_FIX_NONE,
+ BFD_ARM_VFP11_FIX_SCALAR,
+ BFD_ARM_VFP11_FIX_VECTOR
+} bfd_arm_vfp11_fix;
+
+extern void bfd_elf32_arm_init_maps
+ (bfd *);
+
+extern void bfd_elf32_arm_set_vfp11_fix
+ (bfd *, struct bfd_link_info *);
+
+extern bfd_boolean bfd_elf32_arm_vfp11_erratum_scan
+ (bfd *, struct bfd_link_info *);
+
+extern void bfd_elf32_arm_vfp11_fix_veneer_locations
+ (bfd *, struct bfd_link_info *);
+
/* ARM Interworking support. Called from linker. */
extern bfd_boolean bfd_arm_allocate_interworking_sections
(struct bfd_link_info *);
@@ -849,10 +906,11 @@ extern bfd_boolean bfd_elf32_arm_allocate_interworking_sections
(struct bfd_link_info *);
extern bfd_boolean bfd_elf32_arm_process_before_allocation
- (bfd *, struct bfd_link_info *, int);
+ (bfd *, struct bfd_link_info *);
void bfd_elf32_arm_set_target_relocs
- (struct bfd_link_info *, int, char *, int, int);
+ (bfd *, struct bfd_link_info *, int, char *, int, int, bfd_arm_vfp11_fix,
+ int, int);
extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking
(bfd *, struct bfd_link_info *);
@@ -861,8 +919,14 @@ extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd
(bfd *, struct bfd_link_info *);
/* ELF ARM mapping symbol support */
-extern bfd_boolean bfd_is_arm_mapping_symbol_name
- (const char * name);
+#define BFD_ARM_SPECIAL_SYM_TYPE_MAP (1 << 0)
+#define BFD_ARM_SPECIAL_SYM_TYPE_TAG (1 << 1)
+#define BFD_ARM_SPECIAL_SYM_TYPE_OTHER (1 << 2)
+#define BFD_ARM_SPECIAL_SYM_TYPE_ANY (~0)
+extern bfd_boolean bfd_is_arm_special_symbol_name
+ (const char * name, int type);
+
+extern void bfd_elf32_arm_set_byteswap_code (struct bfd_link_info *, int);
/* ARM Note section processing. */
extern bfd_boolean bfd_arm_merge_machines
@@ -935,7 +999,10 @@ bfd *bfd_openr_iovec (const char *filename, const char *target,
file_ptr nbytes,
file_ptr offset),
int (*close) (struct bfd *nbfd,
- void *stream));
+ void *stream),
+ int (*stat) (struct bfd *abfd,
+ void *stream,
+ struct stat *sb));
bfd *bfd_openw (const char *filename, const char *target);
@@ -1076,7 +1143,7 @@ bfd_boolean bfd_fill_in_gnu_debuglink_section
/* Extracted from bfdio.c. */
long bfd_get_mtime (bfd *abfd);
-long bfd_get_size (bfd *abfd);
+file_ptr bfd_get_size (bfd *abfd);
/* Extracted from bfdwin.c. */
/* Extracted from section.c. */
@@ -1225,7 +1292,9 @@ typedef struct bfd_section
else up the line will take care of it later. */
#define SEC_LINKER_CREATED 0x200000
- /* This section should not be subject to garbage collection. */
+ /* This section should not be subject to garbage collection.
+ Also set to inform the linker that this section should not be
+ listed in the link map as discarded. */
#define SEC_KEEP 0x400000
/* This section contains "short" data, and should be placed
@@ -1471,11 +1540,6 @@ extern asection bfd_ind_section;
|| ((SEC) == bfd_com_section_ptr) \
|| ((SEC) == bfd_ind_section_ptr))
-extern const struct bfd_symbol * const bfd_abs_symbol;
-extern const struct bfd_symbol * const bfd_com_symbol;
-extern const struct bfd_symbol * const bfd_und_symbol;
-extern const struct bfd_symbol * const bfd_ind_symbol;
-
/* Macros to handle insertion and deletion of a bfd's sections. These
only handle the list pointers, ie. do not adjust section_count,
target_index etc. */
@@ -1566,7 +1630,7 @@ extern const struct bfd_symbol * const bfd_ind_symbol;
#define bfd_section_removed_from_list(ABFD, S) \
((S)->next == NULL ? (ABFD)->section_last != (S) : (S)->next->prev != (S))
-#define BFD_FAKE_SECTION(SEC, FLAGS, SYM, SYM_PTR, NAME, IDX) \
+#define BFD_FAKE_SECTION(SEC, FLAGS, SYM, NAME, IDX) \
/* name, id, index, next, prev, flags, user_set_vma, */ \
{ NAME, IDX, 0, NULL, NULL, FLAGS, 0, \
\
@@ -1597,11 +1661,8 @@ extern const struct bfd_symbol * const bfd_ind_symbol;
/* target_index, used_by_bfd, constructor_chain, owner, */ \
0, NULL, NULL, NULL, \
\
- /* symbol, */ \
- (struct bfd_symbol *) SYM, \
- \
- /* symbol_ptr_ptr, */ \
- (struct bfd_symbol **) SYM_PTR, \
+ /* symbol, symbol_ptr_ptr, */ \
+ (struct bfd_symbol *) SYM, &SEC.symbol, \
\
/* map_head, map_tail */ \
{ NULL }, { NULL } \
@@ -1683,22 +1744,26 @@ enum bfd_architecture
#define bfd_mach_m68040 6
#define bfd_mach_m68060 7
#define bfd_mach_cpu32 8
-#define bfd_mach_mcf_isa_a_nodiv 9
-#define bfd_mach_mcf_isa_a 10
-#define bfd_mach_mcf_isa_a_mac 11
-#define bfd_mach_mcf_isa_a_emac 12
-#define bfd_mach_mcf_isa_aplus 13
-#define bfd_mach_mcf_isa_aplus_mac 14
-#define bfd_mach_mcf_isa_aplus_emac 15
-#define bfd_mach_mcf_isa_b_nousp 16
-#define bfd_mach_mcf_isa_b_nousp_mac 17
-#define bfd_mach_mcf_isa_b_nousp_emac 18
-#define bfd_mach_mcf_isa_b 19
-#define bfd_mach_mcf_isa_b_mac 20
-#define bfd_mach_mcf_isa_b_emac 21
-#define bfd_mach_mcf_isa_b_float 22
-#define bfd_mach_mcf_isa_b_float_mac 23
-#define bfd_mach_mcf_isa_b_float_emac 24
+#define bfd_mach_fido 9
+#define bfd_mach_mcf_isa_a_nodiv 10
+#define bfd_mach_mcf_isa_a 11
+#define bfd_mach_mcf_isa_a_mac 12
+#define bfd_mach_mcf_isa_a_emac 13
+#define bfd_mach_mcf_isa_aplus 14
+#define bfd_mach_mcf_isa_aplus_mac 15
+#define bfd_mach_mcf_isa_aplus_emac 16
+#define bfd_mach_mcf_isa_b_nousp 17
+#define bfd_mach_mcf_isa_b_nousp_mac 18
+#define bfd_mach_mcf_isa_b_nousp_emac 19
+#define bfd_mach_mcf_isa_b 20
+#define bfd_mach_mcf_isa_b_mac 21
+#define bfd_mach_mcf_isa_b_emac 22
+#define bfd_mach_mcf_isa_b_float 23
+#define bfd_mach_mcf_isa_b_float_mac 24
+#define bfd_mach_mcf_isa_b_float_emac 25
+#define bfd_mach_mcf_isa_c 26
+#define bfd_mach_mcf_isa_c_mac 27
+#define bfd_mach_mcf_isa_c_emac 28
bfd_arch_vax, /* DEC Vax */
bfd_arch_i960, /* Intel 960 */
/* The order of the following is important.
@@ -1739,6 +1804,8 @@ enum bfd_architecture
/* Nonzero if MACH is a 64 bit sparc architecture. */
#define bfd_mach_sparc_64bit_p(mach) \
((mach) >= bfd_mach_sparc_v9 && (mach) != bfd_mach_sparc_v8plusb)
+ bfd_arch_spu, /* PowerPC SPU */
+#define bfd_mach_spu 256
bfd_arch_mips, /* MIPS Rxxxx */
#define bfd_mach_mips3000 3000
#define bfd_mach_mips3900 3900
@@ -1876,6 +1943,7 @@ enum bfd_architecture
#define bfd_mach_arm_XScale 10
#define bfd_mach_arm_ep9312 11
#define bfd_mach_arm_iWMMXt 12
+#define bfd_mach_arm_iWMMXt2 13
bfd_arch_ns32k, /* National Semiconductors ns32000 */
bfd_arch_w65, /* WDC 65816 */
bfd_arch_tic30, /* Texas Instruments TMS320C30 */
@@ -1917,6 +1985,9 @@ enum bfd_architecture
#define bfd_mach_fr500 500
#define bfd_mach_fr550 550
bfd_arch_mcore,
+ bfd_arch_mep,
+#define bfd_mach_mep 1
+#define bfd_mach_mep_h1 0x6831
bfd_arch_ia64, /* HP/Intel ia64 */
#define bfd_mach_ia64_elf64 64
#define bfd_mach_ia64_elf32 32
@@ -1937,8 +2008,11 @@ enum bfd_architecture
#define bfd_mach_avr3 3
#define bfd_mach_avr4 4
#define bfd_mach_avr5 5
+#define bfd_mach_avr6 6
bfd_arch_bfin, /* ADI Blackfin */
#define bfd_mach_bfin 1
+ bfd_arch_cr16, /* National Semiconductor CompactRISC (ie CR16). */
+#define bfd_mach_cr16 1
bfd_arch_cr16c, /* National Semiconductor CompactRISC. */
#define bfd_mach_cr16c 1
bfd_arch_crx, /* National Semiconductor CRX. */
@@ -1950,6 +2024,7 @@ enum bfd_architecture
bfd_arch_s390, /* IBM s390 */
#define bfd_mach_s390_31 31
#define bfd_mach_s390_64 64
+ bfd_arch_score, /* Sunplus score */
bfd_arch_openrisc, /* OpenRISC */
bfd_arch_mmix, /* Donald Knuth's educational processor. */
bfd_arch_xstormy16,
@@ -2427,6 +2502,22 @@ relocation types already defined. */
BFD_RELOC_SPARC_TLS_TPOFF32,
BFD_RELOC_SPARC_TLS_TPOFF64,
+/* SPU Relocations. */
+ BFD_RELOC_SPU_IMM7,
+ BFD_RELOC_SPU_IMM8,
+ BFD_RELOC_SPU_IMM10,
+ BFD_RELOC_SPU_IMM10W,
+ BFD_RELOC_SPU_IMM16,
+ BFD_RELOC_SPU_IMM16W,
+ BFD_RELOC_SPU_IMM18,
+ BFD_RELOC_SPU_PCREL9a,
+ BFD_RELOC_SPU_PCREL9b,
+ BFD_RELOC_SPU_PCREL16,
+ BFD_RELOC_SPU_LO16,
+ BFD_RELOC_SPU_HI16,
+ BFD_RELOC_SPU_PPU32,
+ BFD_RELOC_SPU_PPU64,
+
/* Alpha ECOFF and ELF relocations. Some of these treat the symbol or
"addend" in some special way.
For GPDISP_HI16 ("gpdisp") relocations, the symbol is ignored when
@@ -2909,6 +3000,16 @@ pc-relative or some form of GOT-indirect relocation. */
/* 31-bit PC relative address. */
BFD_RELOC_ARM_PREL31,
+/* Low and High halfword relocations for MOVW and MOVT instructions. */
+ BFD_RELOC_ARM_MOVW,
+ BFD_RELOC_ARM_MOVT,
+ BFD_RELOC_ARM_MOVW_PCREL,
+ BFD_RELOC_ARM_MOVT_PCREL,
+ BFD_RELOC_ARM_THUMB_MOVW,
+ BFD_RELOC_ARM_THUMB_MOVT,
+ BFD_RELOC_ARM_THUMB_MOVW_PCREL,
+ BFD_RELOC_ARM_THUMB_MOVT_PCREL,
+
/* Relocations for setting up GOTs and PLTs for shared libraries. */
BFD_RELOC_ARM_JUMP_SLOT,
BFD_RELOC_ARM_GLOB_DAT,
@@ -2928,11 +3029,42 @@ pc-relative or some form of GOT-indirect relocation. */
BFD_RELOC_ARM_TLS_IE32,
BFD_RELOC_ARM_TLS_LE32,
+/* ARM group relocations. */
+ BFD_RELOC_ARM_ALU_PC_G0_NC,
+ BFD_RELOC_ARM_ALU_PC_G0,
+ BFD_RELOC_ARM_ALU_PC_G1_NC,
+ BFD_RELOC_ARM_ALU_PC_G1,
+ BFD_RELOC_ARM_ALU_PC_G2,
+ BFD_RELOC_ARM_LDR_PC_G0,
+ BFD_RELOC_ARM_LDR_PC_G1,
+ BFD_RELOC_ARM_LDR_PC_G2,
+ BFD_RELOC_ARM_LDRS_PC_G0,
+ BFD_RELOC_ARM_LDRS_PC_G1,
+ BFD_RELOC_ARM_LDRS_PC_G2,
+ BFD_RELOC_ARM_LDC_PC_G0,
+ BFD_RELOC_ARM_LDC_PC_G1,
+ BFD_RELOC_ARM_LDC_PC_G2,
+ BFD_RELOC_ARM_ALU_SB_G0_NC,
+ BFD_RELOC_ARM_ALU_SB_G0,
+ BFD_RELOC_ARM_ALU_SB_G1_NC,
+ BFD_RELOC_ARM_ALU_SB_G1,
+ BFD_RELOC_ARM_ALU_SB_G2,
+ BFD_RELOC_ARM_LDR_SB_G0,
+ BFD_RELOC_ARM_LDR_SB_G1,
+ BFD_RELOC_ARM_LDR_SB_G2,
+ BFD_RELOC_ARM_LDRS_SB_G0,
+ BFD_RELOC_ARM_LDRS_SB_G1,
+ BFD_RELOC_ARM_LDRS_SB_G2,
+ BFD_RELOC_ARM_LDC_SB_G0,
+ BFD_RELOC_ARM_LDC_SB_G1,
+ BFD_RELOC_ARM_LDC_SB_G2,
+
/* These relocs are only used within the ARM assembler. They are not
(at present) written to any object files. */
BFD_RELOC_ARM_IMMEDIATE,
BFD_RELOC_ARM_ADRL_IMMEDIATE,
BFD_RELOC_ARM_T32_IMMEDIATE,
+ BFD_RELOC_ARM_T32_ADD_IMM,
BFD_RELOC_ARM_T32_IMM12,
BFD_RELOC_ARM_T32_ADD_PC12,
BFD_RELOC_ARM_SHIFT_IMM,
@@ -3446,6 +3578,29 @@ short offset into 11 bits. */
BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2,
BFD_RELOC_MCORE_RVA,
+/* Toshiba Media Processor Relocations. */
+ BFD_RELOC_MEP_8,
+ BFD_RELOC_MEP_16,
+ BFD_RELOC_MEP_32,
+ BFD_RELOC_MEP_PCREL8A2,
+ BFD_RELOC_MEP_PCREL12A2,
+ BFD_RELOC_MEP_PCREL17A2,
+ BFD_RELOC_MEP_PCREL24A2,
+ BFD_RELOC_MEP_PCABS24A2,
+ BFD_RELOC_MEP_LOW16,
+ BFD_RELOC_MEP_HI16U,
+ BFD_RELOC_MEP_HI16S,
+ BFD_RELOC_MEP_GPREL,
+ BFD_RELOC_MEP_TPREL,
+ BFD_RELOC_MEP_TPREL7,
+ BFD_RELOC_MEP_TPREL7A2,
+ BFD_RELOC_MEP_TPREL7A4,
+ BFD_RELOC_MEP_UIMM24,
+ BFD_RELOC_MEP_ADDR24A4,
+ BFD_RELOC_MEP_GNU_VTINHERIT,
+ BFD_RELOC_MEP_GNU_VTENTRY,
+
+
/* These are relocations for the GETA instruction. */
BFD_RELOC_MMIX_GETA,
BFD_RELOC_MMIX_GETA_1,
@@ -3545,10 +3700,22 @@ of 32 bit value) into 8 bit immediate value of LDI insn. */
command address) into 8 bit immediate value of LDI insn. */
BFD_RELOC_AVR_LO8_LDI_PM,
+/* This is a 16 bit reloc for the AVR that stores 8 bit value
+(command address) into 8 bit immediate value of LDI insn. If the address
+is beyond the 128k boundary, the linker inserts a jump stub for this reloc
+in the lower 128k. */
+ BFD_RELOC_AVR_LO8_LDI_GS,
+
/* This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
of command address) into 8 bit immediate value of LDI insn. */
BFD_RELOC_AVR_HI8_LDI_PM,
+/* This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
+of command address) into 8 bit immediate value of LDI insn. If the address
+is beyond the 128k boundary, the linker inserts a jump stub for this reloc
+below 128k. */
+ BFD_RELOC_AVR_HI8_LDI_GS,
+
/* This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
of command address) into 8 bit immediate value of LDI insn. */
BFD_RELOC_AVR_HH8_LDI_PM,
@@ -3689,6 +3856,31 @@ instructions */
BFD_RELOC_390_GOTPLT20,
BFD_RELOC_390_TLS_GOTIE20,
+/* Score relocations */
+ BFD_RELOC_SCORE_DUMMY1,
+
+/* Low 16 bit for load/store */
+ BFD_RELOC_SCORE_GPREL15,
+
+/* This is a 24-bit reloc with the right 1 bit assumed to be 0 */
+ BFD_RELOC_SCORE_DUMMY2,
+ BFD_RELOC_SCORE_JMP,
+
+/* This is a 19-bit reloc with the right 1 bit assumed to be 0 */
+ BFD_RELOC_SCORE_BRANCH,
+
+/* This is a 11-bit reloc with the right 1 bit assumed to be 0 */
+ BFD_RELOC_SCORE16_JMP,
+
+/* This is a 8-bit reloc with the right 1 bit assumed to be 0 */
+ BFD_RELOC_SCORE16_BRANCH,
+
+/* Undocumented Score relocs */
+ BFD_RELOC_SCORE_GOT15,
+ BFD_RELOC_SCORE_GOT_LO16,
+ BFD_RELOC_SCORE_CALL15,
+ BFD_RELOC_SCORE_DUMMY_HI16,
+
/* Scenix IP2K - 9-bit register number / data address */
BFD_RELOC_IP2K_FR9,
@@ -3913,6 +4105,35 @@ This is the 5 bits of a value. */
BFD_RELOC_16C_IMM32,
BFD_RELOC_16C_IMM32_C,
+/* NS CR16 Relocations. */
+ BFD_RELOC_CR16_NUM8,
+ BFD_RELOC_CR16_NUM16,
+ BFD_RELOC_CR16_NUM32,
+ BFD_RELOC_CR16_NUM32a,
+ BFD_RELOC_CR16_REGREL0,
+ BFD_RELOC_CR16_REGREL4,
+ BFD_RELOC_CR16_REGREL4a,
+ BFD_RELOC_CR16_REGREL14,
+ BFD_RELOC_CR16_REGREL14a,
+ BFD_RELOC_CR16_REGREL16,
+ BFD_RELOC_CR16_REGREL20,
+ BFD_RELOC_CR16_REGREL20a,
+ BFD_RELOC_CR16_ABS20,
+ BFD_RELOC_CR16_ABS24,
+ BFD_RELOC_CR16_IMM4,
+ BFD_RELOC_CR16_IMM8,
+ BFD_RELOC_CR16_IMM16,
+ BFD_RELOC_CR16_IMM20,
+ BFD_RELOC_CR16_IMM24,
+ BFD_RELOC_CR16_IMM32,
+ BFD_RELOC_CR16_IMM32a,
+ BFD_RELOC_CR16_DISP4,
+ BFD_RELOC_CR16_DISP8,
+ BFD_RELOC_CR16_DISP16,
+ BFD_RELOC_CR16_DISP20,
+ BFD_RELOC_CR16_DISP24,
+ BFD_RELOC_CR16_DISP24a,
+
/* NS CRX Relocations. */
BFD_RELOC_CRX_REL4,
BFD_RELOC_CRX_REL8,
@@ -4026,6 +4247,10 @@ This is the 5 bits of a value. */
BFD_RELOC_XSTORMY16_24,
BFD_RELOC_XSTORMY16_FPTR16,
+/* Self-describing complex relocations. */
+ BFD_RELOC_RELC,
+
+
/* Infineon Relocations. */
BFD_RELOC_XC16X_PAG,
BFD_RELOC_XC16X_POF,
@@ -4163,6 +4388,8 @@ BFD_RELOC_XTENSA_ASM_EXPAND. */
typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
reloc_howto_type *bfd_reloc_type_lookup
(bfd *abfd, bfd_reloc_code_real_type code);
+reloc_howto_type *bfd_reloc_name_lookup
+ (bfd *abfd, const char *reloc_name);
const char *bfd_get_reloc_code_name (bfd_reloc_code_real_type code);
@@ -4275,6 +4502,14 @@ typedef struct bfd_symbol
/* This symbol is thread local. Used in ELF. */
#define BSF_THREAD_LOCAL 0x40000
+ /* This symbol represents a complex relocation expression,
+ with the expression tree serialized in the symbol name. */
+#define BSF_RELC 0x80000
+
+ /* This symbol represents a signed complex relocation expression,
+ with the expression tree serialized in the symbol name. */
+#define BSF_SRELC 0x100000
+
flagword flags;
/* A pointer to the section to which this symbol is
@@ -4442,7 +4677,7 @@ struct bfd
/* Stuff only useful for archives. */
void *arelt_data;
struct bfd *my_archive; /* The containing archive BFD. */
- struct bfd *next; /* The next BFD in the archive. */
+ struct bfd *archive_next; /* The next BFD in the archive. */
struct bfd *archive_head; /* The first BFD in the archive. */
bfd_boolean has_armap;
@@ -4524,13 +4759,14 @@ typedef enum bfd_error
bfd_error_bad_value,
bfd_error_file_truncated,
bfd_error_file_too_big,
+ bfd_error_on_input,
bfd_error_invalid_error_code
}
bfd_error_type;
bfd_error_type bfd_get_error (void);
-void bfd_set_error (bfd_error_type error_tag);
+void bfd_set_error (bfd_error_type error_tag, ...);
const char *bfd_errmsg (bfd_error_type error_tag);
@@ -4585,8 +4821,8 @@ bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags);
#define bfd_set_private_flags(abfd, flags) \
BFD_SEND (abfd, _bfd_set_private_flags, (abfd, flags))
-#define bfd_sizeof_headers(abfd, reloc) \
- BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc))
+#define bfd_sizeof_headers(abfd, info) \
+ BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, info))
#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
BFD_SEND (abfd, _bfd_find_nearest_line, \
@@ -4694,6 +4930,16 @@ void bfd_preserve_restore (bfd *, struct bfd_preserve *);
void bfd_preserve_finish (bfd *, struct bfd_preserve *);
+bfd_vma bfd_emul_get_maxpagesize (const char *);
+
+void bfd_emul_set_maxpagesize (const char *, bfd_vma);
+
+bfd_vma bfd_emul_get_commonpagesize (const char *);
+
+void bfd_emul_set_commonpagesize (const char *, bfd_vma);
+
+char *bfd_demangle (bfd *, const char *, int);
+
/* Extracted from archive.c. */
symindex bfd_get_next_mapent
(bfd *abfd, symindex previous, carsym **sym);
@@ -4992,7 +5238,8 @@ typedef struct bfd_target
#define BFD_JUMP_TABLE_RELOCS(NAME) \
NAME##_get_reloc_upper_bound, \
NAME##_canonicalize_reloc, \
- NAME##_bfd_reloc_type_lookup
+ NAME##_bfd_reloc_type_lookup, \
+ NAME##_bfd_reloc_name_lookup
long (*_get_reloc_upper_bound) (bfd *, sec_ptr);
long (*_bfd_canonicalize_reloc)
@@ -5000,6 +5247,9 @@ typedef struct bfd_target
/* See documentation on reloc types. */
reloc_howto_type *
(*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
+ reloc_howto_type *
+ (*reloc_name_lookup) (bfd *, const char *);
+
/* Routines used when writing an object file. */
#define BFD_JUMP_TABLE_WRITE(NAME) \
@@ -5028,7 +5278,7 @@ typedef struct bfd_target
NAME##_bfd_discard_group, \
NAME##_section_already_linked \
- int (*_bfd_sizeof_headers) (bfd *, bfd_boolean);
+ int (*_bfd_sizeof_headers) (bfd *, struct bfd_link_info *);
bfd_byte * (*_bfd_get_relocated_section_contents)
(bfd *, struct bfd_link_info *, struct bfd_link_order *,
bfd_byte *, bfd_boolean, struct bfd_symbol **);
@@ -5071,7 +5321,8 @@ typedef struct bfd_target
/* Check if SEC has been already linked during a reloceatable or
final link. */
- void (*_section_already_linked) (bfd *, struct bfd_section *);
+ void (*_section_already_linked) (bfd *, struct bfd_section *,
+ struct bfd_link_info *);
/* Routines to handle dynamic symbols and relocs. */
#define BFD_JUMP_TABLE_DYNAMIC(NAME) \
@@ -5131,10 +5382,11 @@ bfd_boolean bfd_link_split_section (bfd *abfd, asection *sec);
#define bfd_link_split_section(abfd, sec) \
BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec))
-void bfd_section_already_linked (bfd *abfd, asection *sec);
+void bfd_section_already_linked (bfd *abfd, asection *sec,
+ struct bfd_link_info *info);
-#define bfd_section_already_linked(abfd, sec) \
- BFD_SEND (abfd, _section_already_linked, (abfd, sec))
+#define bfd_section_already_linked(abfd, sec, info) \
+ BFD_SEND (abfd, _section_already_linked, (abfd, sec, info))
/* Extracted from simple.c. */
bfd_byte *bfd_simple_get_relocated_section_contents
diff --git a/bfd/bfd.c b/bfd/bfd.c
index 733f6ee0272d..510df0ab27f5 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -1,6 +1,6 @@
/* Generic BFD library interface and support routines.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -139,7 +139,7 @@ CODE_FRAGMENT
. {* Stuff only useful for archives. *}
. void *arelt_data;
. struct bfd *my_archive; {* The containing archive BFD. *}
-. struct bfd *next; {* The next BFD in the archive. *}
+. struct bfd *archive_next; {* The next BFD in the archive. *}
. struct bfd *archive_head; {* The first BFD in the archive. *}
. bfd_boolean has_armap;
.
@@ -202,11 +202,12 @@ CODE_FRAGMENT
.
*/
-#include "bfd.h"
-#include "bfdver.h"
#include "sysdep.h"
#include <stdarg.h>
+#include "bfd.h"
+#include "bfdver.h"
#include "libiberty.h"
+#include "demangle.h"
#include "safe-ctype.h"
#include "bfdlink.h"
#include "libbfd.h"
@@ -271,6 +272,7 @@ CODE_FRAGMENT
. bfd_error_bad_value,
. bfd_error_file_truncated,
. bfd_error_file_too_big,
+. bfd_error_on_input,
. bfd_error_invalid_error_code
.}
.bfd_error_type;
@@ -278,6 +280,8 @@ CODE_FRAGMENT
*/
static bfd_error_type bfd_error = bfd_error_no_error;
+static bfd *input_bfd = NULL;
+static bfd_error_type input_error = bfd_error_no_error;
const char *const bfd_errmsgs[] =
{
@@ -300,6 +304,7 @@ const char *const bfd_errmsgs[] =
N_("Bad value"),
N_("File truncated"),
N_("File too big"),
+ N_("Error reading %s: %s"),
N_("#<Invalid error code>")
};
@@ -325,16 +330,32 @@ FUNCTION
bfd_set_error
SYNOPSIS
- void bfd_set_error (bfd_error_type error_tag);
+ void bfd_set_error (bfd_error_type error_tag, ...);
DESCRIPTION
Set the BFD error condition to be @var{error_tag}.
+ If @var{error_tag} is bfd_error_on_input, then this function
+ takes two more parameters, the input bfd where the error
+ occurred, and the bfd_error_type error.
*/
void
-bfd_set_error (bfd_error_type error_tag)
+bfd_set_error (bfd_error_type error_tag, ...)
{
bfd_error = error_tag;
+ if (error_tag == bfd_error_on_input)
+ {
+ /* This is an error that occurred during bfd_close when
+ writing an archive, but on one of the input files. */
+ va_list ap;
+
+ va_start (ap, error_tag);
+ input_bfd = va_arg (ap, bfd *);
+ input_error = va_arg (ap, int);
+ if (input_error >= bfd_error_on_input)
+ abort ();
+ va_end (ap);
+ }
}
/*
@@ -355,6 +376,19 @@ bfd_errmsg (bfd_error_type error_tag)
#ifndef errno
extern int errno;
#endif
+ if (error_tag == bfd_error_on_input)
+ {
+ char *buf;
+ const char *msg = bfd_errmsg (input_error);
+
+ if (asprintf (&buf, _(bfd_errmsgs [error_tag]), input_bfd->filename, msg)
+ != -1)
+ return buf;
+
+ /* Ick, what to do on out of memory? */
+ return msg;
+ }
+
if (error_tag == bfd_error_system_call)
return xstrerror (errno);
@@ -382,16 +416,10 @@ DESCRIPTION
void
bfd_perror (const char *message)
{
- if (bfd_get_error () == bfd_error_system_call)
- /* Must be a system error then. */
- perror ((char *) message);
+ if (message == NULL || *message == '\0')
+ fprintf (stderr, "%s\n", bfd_errmsg (bfd_get_error ()));
else
- {
- if (message == NULL || *message == '\0')
- fprintf (stderr, "%s\n", bfd_errmsg (bfd_get_error ()));
- else
- fprintf (stderr, "%s: %s\n", message, bfd_errmsg (bfd_get_error ()));
- }
+ fprintf (stderr, "%s: %s\n", message, bfd_errmsg (bfd_get_error ()));
}
/*
@@ -419,6 +447,23 @@ static const char *_bfd_error_program_name;
%A section name from section. For group components, print group name too.
%B file name from bfd. For archive components, prints archive too.
+
+ Note - because these two extra format specifiers require special handling
+ they are scanned for and processed in this function, before calling
+ vfprintf. This means that the *arguments* for these format specifiers
+ must be the first ones in the variable argument list, regardless of where
+ the specifiers appear in the format string. Thus for example calling
+ this function with a format string of:
+
+ "blah %s blah %A blah %d blah %B"
+
+ would involve passing the arguments as:
+
+ "blah %s blah %A blah %d blah %B",
+ asection_for_the_%A,
+ bfd_for_the_%B,
+ string_for_the_%s,
+ integer_for_the_%d);
*/
void
@@ -483,7 +528,11 @@ _bfd_default_error_handler (const char *fmt, ...)
if (p[1] == 'B')
{
bfd *abfd = va_arg (ap, bfd *);
- if (abfd->my_archive)
+
+ if (abfd == NULL)
+ /* Invoking %B with a null bfd pointer is an internal error. */
+ abort ();
+ else if (abfd->my_archive)
snprintf (bufp, avail, "%s(%s)",
abfd->my_archive->filename, abfd->filename);
else
@@ -492,10 +541,14 @@ _bfd_default_error_handler (const char *fmt, ...)
else
{
asection *sec = va_arg (ap, asection *);
- bfd *abfd = sec->owner;
+ bfd *abfd;
const char *group = NULL;
struct coff_comdat_info *ci;
+ if (sec == NULL)
+ /* Invoking %A with a null section pointer is an internal error. */
+ abort ();
+ abfd = sec->owner;
if (abfd != NULL
&& bfd_get_flavour (abfd) == bfd_target_elf_flavour
&& elf_next_in_group (sec) != NULL
@@ -851,14 +904,16 @@ bfd_get_sign_extend_vma (bfd *abfd)
name = bfd_get_target (abfd);
- /* Return a proper value for DJGPP & PE COFF (x86 COFF variants).
+ /* Return a proper value for DJGPP & PE COFF.
This function is required for DWARF2 support, but there is
no place to store this information in the COFF back end.
Should enough other COFF targets add support for DWARF2,
a place will have to be found. Until then, this hack will do. */
- if (strncmp (name, "coff-go32", sizeof ("coff-go32") - 1) == 0
+ if (CONST_STRNEQ (name, "coff-go32")
|| strcmp (name, "pe-i386") == 0
- || strcmp (name, "pei-i386") == 0)
+ || strcmp (name, "pei-i386") == 0
+ || strcmp (name, "pe-arm-wince-little") == 0
+ || strcmp (name, "pei-arm-wince-little") == 0)
return 1;
bfd_set_error (bfd_error_wrong_format);
@@ -1158,8 +1213,8 @@ FUNCTION
DESCRIPTION
The following functions exist but have not yet been documented.
-.#define bfd_sizeof_headers(abfd, reloc) \
-. BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc))
+.#define bfd_sizeof_headers(abfd, info) \
+. BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, info))
.
.#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
. BFD_SEND (abfd, _bfd_find_nearest_line, \
@@ -1298,11 +1353,10 @@ bfd_record_phdr (bfd *abfd,
amt = sizeof (struct elf_segment_map);
amt += ((bfd_size_type) count - 1) * sizeof (asection *);
- m = bfd_alloc (abfd, amt);
+ m = bfd_zalloc (abfd, amt);
if (m == NULL)
return FALSE;
- m->next = NULL;
m->p_type = type;
m->p_flags = flags;
m->p_paddr = at;
@@ -1335,6 +1389,15 @@ bfd_fprintf_vma (bfd *abfd, void *stream, bfd_vma value)
{
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
get_elf_backend_data (abfd)->elf_backend_fprintf_vma (abfd, stream, value);
+#ifdef BFD64
+ /* fprintf_vma() on a 64-bit enabled host will always print a 64-bit
+ value, but really we want to display the address in the target's
+ address size. Since we do not have a field in the bfd structure
+ to tell us this, we take a guess, based on the target's name. */
+ else if (strstr (bfd_get_target (abfd), "64") == NULL
+ && strcmp (bfd_get_target (abfd), "mmo") != 0)
+ fprintf ((FILE *) stream, "%08lx", (unsigned long) (value & 0xffffffff));
+#endif
else
fprintf_vma ((FILE *) stream, value);
}
@@ -1513,3 +1576,212 @@ bfd_preserve_finish (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_preserve *preserve)
objalloc. */
bfd_hash_table_free (&preserve->section_htab);
}
+
+/*
+FUNCTION
+ bfd_emul_get_maxpagesize
+
+SYNOPSIS
+ bfd_vma bfd_emul_get_maxpagesize (const char *);
+
+DESCRIPTION
+ Returns the maximum page size, in bytes, as determined by
+ emulation.
+
+RETURNS
+ Returns the maximum page size in bytes for ELF, abort
+ otherwise.
+*/
+
+bfd_vma
+bfd_emul_get_maxpagesize (const char *emul)
+{
+ const bfd_target *target;
+
+ target = bfd_find_target (emul, NULL);
+ if (target != NULL
+ && target->flavour == bfd_target_elf_flavour)
+ return xvec_get_elf_backend_data (target)->maxpagesize;
+
+ abort ();
+ return 0;
+}
+
+static void
+bfd_elf_set_pagesize (const bfd_target *target, bfd_vma size,
+ int offset, const bfd_target *orig_target)
+{
+ if (target->flavour == bfd_target_elf_flavour)
+ {
+ const struct elf_backend_data *bed;
+
+ bed = xvec_get_elf_backend_data (target);
+ *((bfd_vma *) ((char *) bed + offset)) = size;
+ }
+
+ if (target->alternative_target
+ && target->alternative_target != orig_target)
+ bfd_elf_set_pagesize (target->alternative_target, size, offset,
+ orig_target);
+}
+
+/*
+FUNCTION
+ bfd_emul_set_maxpagesize
+
+SYNOPSIS
+ void bfd_emul_set_maxpagesize (const char *, bfd_vma);
+
+DESCRIPTION
+ For ELF, set the maximum page size for the emulation. It is
+ a no-op for other formats.
+
+*/
+
+void
+bfd_emul_set_maxpagesize (const char *emul, bfd_vma size)
+{
+ const bfd_target *target;
+
+ target = bfd_find_target (emul, NULL);
+ if (target)
+ bfd_elf_set_pagesize (target, size,
+ offsetof (struct elf_backend_data,
+ maxpagesize), target);
+}
+
+/*
+FUNCTION
+ bfd_emul_get_commonpagesize
+
+SYNOPSIS
+ bfd_vma bfd_emul_get_commonpagesize (const char *);
+
+DESCRIPTION
+ Returns the common page size, in bytes, as determined by
+ emulation.
+
+RETURNS
+ Returns the common page size in bytes for ELF, abort otherwise.
+*/
+
+bfd_vma
+bfd_emul_get_commonpagesize (const char *emul)
+{
+ const bfd_target *target;
+
+ target = bfd_find_target (emul, NULL);
+ if (target != NULL
+ && target->flavour == bfd_target_elf_flavour)
+ return xvec_get_elf_backend_data (target)->commonpagesize;
+
+ abort ();
+ return 0;
+}
+
+/*
+FUNCTION
+ bfd_emul_set_commonpagesize
+
+SYNOPSIS
+ void bfd_emul_set_commonpagesize (const char *, bfd_vma);
+
+DESCRIPTION
+ For ELF, set the common page size for the emulation. It is
+ a no-op for other formats.
+
+*/
+
+void
+bfd_emul_set_commonpagesize (const char *emul, bfd_vma size)
+{
+ const bfd_target *target;
+
+ target = bfd_find_target (emul, NULL);
+ if (target)
+ bfd_elf_set_pagesize (target, size,
+ offsetof (struct elf_backend_data,
+ commonpagesize), target);
+}
+
+/*
+FUNCTION
+ bfd_demangle
+
+SYNOPSIS
+ char *bfd_demangle (bfd *, const char *, int);
+
+DESCRIPTION
+ Wrapper around cplus_demangle. Strips leading underscores and
+ other such chars that would otherwise confuse the demangler.
+ If passed a g++ v3 ABI mangled name, returns a buffer allocated
+ with malloc holding the demangled name. Returns NULL otherwise
+ and on memory alloc failure.
+*/
+
+char *
+bfd_demangle (bfd *abfd, const char *name, int options)
+{
+ char *res, *alloc;
+ const char *pre, *suf;
+ size_t pre_len;
+
+ if (abfd != NULL
+ && *name != '\0'
+ && bfd_get_symbol_leading_char (abfd) == *name)
+ ++name;
+
+ /* This is a hack for better error reporting on XCOFF, PowerPC64-ELF
+ or the MS PE format. These formats have a number of leading '.'s
+ on at least some symbols, so we remove all dots to avoid
+ confusing the demangler. */
+ pre = name;
+ while (*name == '.' || *name == '$')
+ ++name;
+ pre_len = name - pre;
+
+ /* Strip off @plt and suchlike too. */
+ alloc = NULL;
+ suf = strchr (name, '@');
+ if (suf != NULL)
+ {
+ alloc = bfd_malloc (suf - name + 1);
+ if (alloc == NULL)
+ return NULL;
+ memcpy (alloc, name, suf - name);
+ alloc[suf - name] = '\0';
+ name = alloc;
+ }
+
+ res = cplus_demangle (name, options);
+
+ if (alloc != NULL)
+ free (alloc);
+
+ if (res == NULL)
+ return NULL;
+
+ /* Put back any prefix or suffix. */
+ if (pre_len != 0 || suf != NULL)
+ {
+ size_t len;
+ size_t suf_len;
+ char *final;
+
+ len = strlen (res);
+ if (suf == NULL)
+ suf = res + len;
+ suf_len = strlen (suf) + 1;
+ final = bfd_malloc (pre_len + len + suf_len);
+ if (final != NULL)
+ {
+ memcpy (final, pre, pre_len);
+ memcpy (final + pre_len, res, len);
+ memcpy (final + pre_len + len, suf, suf_len);
+ }
+ free (res);
+ res = final;
+ }
+
+ return res;
+}
diff --git a/bfd/bfdio.c b/bfd/bfdio.c
index 22ea886b5cb0..0df25c3baf80 100644
--- a/bfd/bfdio.c
+++ b/bfd/bfdio.c
@@ -1,7 +1,7 @@
/* Low-level I/O routines for BFDs.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -23,12 +23,10 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "sysdep.h"
-
+#include <limits.h>
#include "bfd.h"
#include "libbfd.h"
-#include <limits.h>
-
#ifndef S_IXUSR
#define S_IXUSR 0100 /* Execute by owner. */
#endif
@@ -116,6 +114,15 @@ bfd_bread (void *ptr, bfd_size_type size, bfd *abfd)
{
size_t nread;
+ /* If this is an archive element, don't read past the end of
+ this element. */
+ if (abfd->arelt_data != NULL)
+ {
+ size_t maxbytes = ((struct areltdata *) abfd->arelt_data)->parsed_size;
+ if (size > maxbytes)
+ size = maxbytes;
+ }
+
if ((abfd->flags & BFD_IN_MEMORY) != 0)
{
struct bfd_in_memory *bim;
@@ -401,7 +408,7 @@ FUNCTION
bfd_get_size
SYNOPSIS
- long bfd_get_size (bfd *abfd);
+ file_ptr bfd_get_size (bfd *abfd);
DESCRIPTION
Return the file size (as read from file system) for the file
@@ -429,7 +436,7 @@ DESCRIPTION
size reasonable?".
*/
-long
+file_ptr
bfd_get_size (bfd *abfd)
{
struct stat buf;
diff --git a/bfd/binary.c b/bfd/binary.c
index 458626f02a35..b5347dd4ba45 100644
--- a/bfd/binary.c
+++ b/bfd/binary.c
@@ -1,6 +1,6 @@
/* BFD back-end for binary objects.
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005 Free Software Foundation, Inc.
+ 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>
This file is part of BFD, the Binary File Descriptor library.
@@ -32,8 +32,8 @@
the file. objcopy cooperates by specially setting the start
address to zero by default. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "safe-ctype.h"
#include "libbfd.h"
@@ -63,6 +63,7 @@ binary_object_p (bfd *abfd)
{
struct stat statbuf;
asection *sec;
+ flagword flags;
if (abfd->target_defaulted)
{
@@ -80,10 +81,10 @@ binary_object_p (bfd *abfd)
}
/* One data section. */
- sec = bfd_make_section (abfd, ".data");
+ flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS;
+ sec = bfd_make_section_with_flags (abfd, ".data", flags);
if (sec == NULL)
return NULL;
- sec->flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS;
sec->vma = 0;
sec->size = statbuf.st_size;
sec->filepos = 0;
@@ -220,9 +221,6 @@ binary_get_symbol_info (bfd *ignore_abfd ATTRIBUTE_UNUSED,
#define binary_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
#define binary_read_minisymbols _bfd_generic_read_minisymbols
#define binary_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
-#define binary_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
-#define binary_get_reloc_upper_bound ((long (*) (bfd *, asection *)) bfd_0l)
-#define binary_canonicalize_reloc ((long (*) (bfd *, asection *, arelent **, asymbol **)) bfd_0l)
#define binary_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
/* Set the architecture of a binary file. */
@@ -305,7 +303,7 @@ binary_set_section_contents (bfd *abfd,
static int
binary_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
- bfd_boolean exec ATTRIBUTE_UNUSED)
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
return 0;
}
@@ -367,7 +365,7 @@ const bfd_target binary_vec =
BFD_JUMP_TABLE_CORE (_bfd_nocore),
BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
BFD_JUMP_TABLE_SYMBOLS (binary),
- BFD_JUMP_TABLE_RELOCS (binary),
+ BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
BFD_JUMP_TABLE_WRITE (binary),
BFD_JUMP_TABLE_LINK (binary),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
diff --git a/bfd/bout.c b/bfd/bout.c
index 5102ba776223..fe132129d67e 100644
--- a/bfd/bout.c
+++ b/bfd/bout.c
@@ -1,6 +1,6 @@
/* BFD back-end for Intel 960 b.out binaries.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -20,8 +20,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "bfdlink.h"
#include "genlink.h"
@@ -635,7 +635,8 @@ callj_callback (bfd *abfd,
}
static reloc_howto_type *
-b_out_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, bfd_reloc_code_real_type code)
+b_out_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_reloc_code_real_type code)
{
switch (code)
{
@@ -651,6 +652,20 @@ b_out_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, bfd_reloc_code_real_typ
}
}
+static reloc_howto_type *
+b_out_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ if (strcasecmp (howto_reloc_callj.name, r_name) == 0)
+ return &howto_reloc_callj;
+ if (strcasecmp (howto_reloc_abs32.name, r_name) == 0)
+ return &howto_reloc_abs32;
+ if (strcasecmp (howto_reloc_pcrel24.name, r_name) == 0)
+ return &howto_reloc_pcrel24;
+
+ return NULL;
+}
+
/* Allocate enough room for all the reloc entries, plus pointers to them all. */
static bfd_boolean
@@ -990,7 +1005,8 @@ b_out_set_arch_mach (bfd *abfd,
}
static int
-b_out_sizeof_headers (bfd *ignore_abfd ATTRIBUTE_UNUSED, bfd_boolean ignore ATTRIBUTE_UNUSED)
+b_out_sizeof_headers (bfd *ignore_abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
return sizeof (struct external_exec);
}
diff --git a/bfd/cache.c b/bfd/cache.c
index 6db6a6b4d56d..5252cc9d1320 100644
--- a/bfd/cache.c
+++ b/bfd/cache.c
@@ -1,7 +1,7 @@
/* BFD library -- caching of file descriptors.
Copyright 1990, 1991, 1992, 1993, 1994, 1996, 2000, 2001, 2002,
- 2003, 2004, 2005 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
Hacked by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
@@ -40,8 +40,8 @@ SUBSECTION
Caching functions
*/
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "libiberty.h"
diff --git a/bfd/cf-i386lynx.c b/bfd/cf-i386lynx.c
index 45e699e0b638..d28a30260102 100644
--- a/bfd/cf-i386lynx.c
+++ b/bfd/cf-i386lynx.c
@@ -1,5 +1,5 @@
/* BFD back-end for Intel 386 COFF LynxOS files.
- Copyright 1993, 1994, 1995 Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 2007 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#define TARGET_SYM i386lynx_coff_vec
#define TARGET_NAME "coff-i386-lynx"
diff --git a/bfd/cisco-core.c b/bfd/cisco-core.c
index b7f735b59dee..dfa3a1f28bc5 100644
--- a/bfd/cisco-core.c
+++ b/bfd/cisco-core.c
@@ -1,5 +1,5 @@
/* BFD back-end for CISCO crash dumps.
- Copyright 1994, 1997, 1999, 2000, 2001, 2002, 2004
+ Copyright 1994, 1997, 1999, 2000, 2001, 2002, 2004, 2006, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
/* core_file_failing_signal returns a host signal (this probably should
be fixed). */
@@ -88,13 +88,14 @@ cisco_core_file_validate (abfd, crash_info_loc)
char buf[4];
unsigned int crashinfo_offset;
crashinfo_external crashinfo;
- int nread;
+ bfd_size_type nread;
unsigned int magic;
unsigned int version;
unsigned int rambase;
sec_ptr asect;
struct stat statbuf;
bfd_size_type amt;
+ flagword flags;
if (bfd_seek (abfd, (file_ptr) crash_info_loc, SEEK_SET) != 0)
return NULL;
@@ -241,10 +242,10 @@ cisco_core_file_validate (abfd, crash_info_loc)
/* Create a ".data" section that maps the entire file, which is
essentially a dump of the target system's RAM. */
- asect = bfd_make_section_anyway (abfd, ".data");
+ flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
+ asect = bfd_make_section_anyway_with_flags (abfd, ".data", flags);
if (asect == NULL)
goto error_return;
- asect->flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
/* The size of memory is the size of the core file itself. */
asect->size = statbuf.st_size;
asect->vma = rambase;
@@ -253,10 +254,10 @@ cisco_core_file_validate (abfd, crash_info_loc)
/* Create a ".crash" section to allow access to the saved
crash information. */
- asect = bfd_make_section_anyway (abfd, ".crash");
+ flags = SEC_HAS_CONTENTS;
+ asect = bfd_make_section_anyway_with_flags (abfd, ".crash", flags);
if (asect == NULL)
goto error_return;
- asect->flags = SEC_HAS_CONTENTS;
asect->vma = 0;
asect->filepos = crashinfo_offset;
asect->size = sizeof (crashinfo);
@@ -264,10 +265,9 @@ cisco_core_file_validate (abfd, crash_info_loc)
/* Create a ".reg" section to allow access to the saved
registers. */
- asect = bfd_make_section_anyway (abfd, ".reg");
+ asect = bfd_make_section_anyway_with_flags (abfd, ".reg", flags);
if (asect == NULL)
goto error_return;
- asect->flags = SEC_HAS_CONTENTS;
asect->vma = 0;
asect->filepos = bfd_get_32 (abfd, crashinfo.registers) - rambase;
/* Since we don't know the exact size of the saved register info,
diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c
index d9b890502d3f..dcb182bff9b5 100644
--- a/bfd/coff-alpha.c
+++ b/bfd/coff-alpha.c
@@ -1,6 +1,6 @@
/* BFD back-end for ALPHA Extended-Coff files.
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
Modified from coff-mips.c by Steve Chamberlain <sac@cygnus.com> and
Ian Lance Taylor <ian@cygnus.com>.
@@ -20,8 +20,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "coff/internal.h"
@@ -1244,6 +1244,22 @@ alpha_bfd_reloc_type_lookup (abfd, code)
return &alpha_howto_table[alpha_type];
}
+
+static reloc_howto_type *
+alpha_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (alpha_howto_table) / sizeof (alpha_howto_table[0]);
+ i++)
+ if (alpha_howto_table[i].name != NULL
+ && strcasecmp (alpha_howto_table[i].name, r_name) == 0)
+ return &alpha_howto_table[i];
+
+ return NULL;
+}
/* A helper routine for alpha_relocate_section which converts an
external reloc when generating relocatable output. Returns the
@@ -2361,6 +2377,8 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data =
/* Looking up a reloc type is Alpha specific. */
#define _bfd_ecoff_bfd_reloc_type_lookup alpha_bfd_reloc_type_lookup
+#define _bfd_ecoff_bfd_reloc_name_lookup \
+ alpha_bfd_reloc_name_lookup
/* So is getting relocated section contents. */
#define _bfd_ecoff_bfd_get_relocated_section_contents \
diff --git a/bfd/coff-apollo.c b/bfd/coff-apollo.c
index 2fe1b3e55675..171a62f43002 100644
--- a/bfd/coff-apollo.c
+++ b/bfd/coff-apollo.c
@@ -1,6 +1,6 @@
/* BFD back-end for Apollo 68000 COFF binaries.
- Copyright 1990, 1991, 1992, 1993, 1994, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1992, 1993, 1994, 1999, 2000, 2001, 2002, 2003,
+ 2007 Free Software Foundation, Inc.
By Troy Rollo (troy@cbme.unsw.edu.au)
Based on m68k standard COFF version Written by Cygnus Support.
@@ -20,8 +20,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "coff/apollo.h"
#include "coff/internal.h"
diff --git a/bfd/coff-arm.c b/bfd/coff-arm.c
index 6b83dc7af7fd..28cd4e736ea1 100644
--- a/bfd/coff-arm.c
+++ b/bfd/coff-arm.c
@@ -1,6 +1,6 @@
/* BFD back-end for ARM COFF files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -20,8 +20,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "coff/arm.h"
#include "coff/internal.h"
@@ -163,6 +163,19 @@ coff_arm_reloc (bfd *abfd,
/* These most certainly belong somewhere else. Just had to get rid of
the manifest constants in the code. */
+
+#ifdef ARM_WINCE
+
+#define ARM_26D 0
+#define ARM_32 1
+#define ARM_RVA32 2
+#define ARM_26 3
+#define ARM_THUMB12 4
+#define ARM_SECTION 14
+#define ARM_SECREL 15
+
+#else
+
#define ARM_8 0
#define ARM_16 1
#define ARM_32 2
@@ -179,20 +192,6 @@ coff_arm_reloc (bfd *abfd,
#define ARM_THUMB12 13
#define ARM_THUMB23 14
-#ifdef ARM_WINCE
-#undef ARM_32
-#undef ARM_RVA32
-#undef ARM_26
-#undef ARM_THUMB12
-#undef ARM_26D
-
-#define ARM_26D 0
-#define ARM_32 1
-#define ARM_RVA32 2
-#define ARM_26 3
-#define ARM_THUMB12 4
-#define ARM_SECTION 14
-#define ARM_SECREL 15
#endif
static bfd_reloc_status_type aoutarm_fix_pcrel_26_done
@@ -220,7 +219,7 @@ static reloc_howto_type aoutarm_std_reloc_howto[] =
complain_overflow_dont,
aoutarm_fix_pcrel_26_done,
"ARM_26D",
- FALSE,
+ TRUE, /* partial_inplace. */
0x00ffffff,
0x0,
PCRELOFFSET),
@@ -233,7 +232,7 @@ static reloc_howto_type aoutarm_std_reloc_howto[] =
complain_overflow_bitfield,
coff_arm_reloc,
"ARM_32",
- FALSE,
+ TRUE, /* partial_inplace. */
0xffffffff,
0xffffffff,
PCRELOFFSET),
@@ -246,7 +245,7 @@ static reloc_howto_type aoutarm_std_reloc_howto[] =
complain_overflow_bitfield,
coff_arm_reloc,
"ARM_RVA32",
- FALSE,
+ TRUE, /* partial_inplace. */
0xffffffff,
0xffffffff,
PCRELOFFSET),
@@ -294,7 +293,7 @@ static reloc_howto_type aoutarm_std_reloc_howto[] =
complain_overflow_bitfield,
coff_arm_reloc,
"ARM_SECTION",
- FALSE,
+ TRUE, /* partial_inplace. */
0x0000ffff,
0x0000ffff,
PCRELOFFSET),
@@ -307,7 +306,7 @@ static reloc_howto_type aoutarm_std_reloc_howto[] =
complain_overflow_bitfield,
coff_arm_reloc,
"ARM_SECREL",
- FALSE,
+ TRUE, /* partial_inplace. */
0xffffffff,
0xffffffff,
PCRELOFFSET),
@@ -539,6 +538,32 @@ coff_arm_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
if (rel->r_type == ARM_RVA32)
*addendp -= pe_data (sec->output_section->owner)->pe_opthdr.ImageBase;
+#if defined COFF_WITH_PE && defined ARM_WINCE
+ if (rel->r_type == ARM_SECREL)
+ {
+ bfd_vma osect_vma;
+
+ if (h && (h->type == bfd_link_hash_defined
+ || h->type == bfd_link_hash_defweak))
+ osect_vma = h->root.u.def.section->output_section->vma;
+ else
+ {
+ asection *sec;
+ int i;
+
+ /* Sigh, the only way to get the section to offset against
+ is to find it the hard way. */
+
+ for (sec = abfd->sections, i = 1; i < sym->n_scnum; i++)
+ sec = sec->next;
+
+ osect_vma = sec->output_section->vma;
+ }
+
+ *addendp -= osect_vma;
+ }
+#endif
+
return howto;
}
@@ -808,6 +833,7 @@ coff_arm_reloc_type_lookup (bfd * abfd, bfd_reloc_code_real_type code)
ASTD (BFD_RELOC_RVA, ARM_RVA32);
ASTD (BFD_RELOC_ARM_PCREL_BRANCH, ARM_26);
ASTD (BFD_RELOC_THUMB_PCREL_BRANCH12, ARM_THUMB12);
+ ASTD (BFD_RELOC_32_SECREL, ARM_SECREL);
#else
ASTD (BFD_RELOC_8, ARM_8);
ASTD (BFD_RELOC_16, ARM_16);
@@ -827,6 +853,23 @@ coff_arm_reloc_type_lookup (bfd * abfd, bfd_reloc_code_real_type code)
}
}
+static reloc_howto_type *
+coff_arm_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (aoutarm_std_reloc_howto)
+ / sizeof (aoutarm_std_reloc_howto[0]));
+ i++)
+ if (aoutarm_std_reloc_howto[i].name != NULL
+ && strcasecmp (aoutarm_std_reloc_howto[i].name, r_name) == 0)
+ return &aoutarm_std_reloc_howto[i];
+
+ return NULL;
+}
+
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER 2
#define COFF_PAGE_SIZE 0x1000
@@ -1209,12 +1252,14 @@ coff_arm_relocate_section (bfd *output_bfd,
generation of bl's instruction offset. */
addend -= 8;
#endif
- howto = &fake_arm26_reloc;
+ howto = & fake_arm26_reloc;
}
#ifdef ARM_WINCE
/* MS ARM-CE makes the reloc relative to the opcode's pc, not
the next opcode's pc, so is off by one. */
+ if (howto->pc_relative && !info->relocatable)
+ addend -= 8;
#endif
/* If we are doing a relocatable link, then we can just ignore
@@ -1938,12 +1983,11 @@ bfd_arm_get_bfd_for_interworking (bfd * abfd,
if (sec == NULL)
{
- flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_CODE | SEC_READONLY;
-
- sec = bfd_make_section (abfd, ARM2THUMB_GLUE_SECTION_NAME);
-
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+ | SEC_CODE | SEC_READONLY);
+ sec = bfd_make_section_with_flags (abfd, ARM2THUMB_GLUE_SECTION_NAME,
+ flags);
if (sec == NULL
- || ! bfd_set_section_flags (abfd, sec, flags)
|| ! bfd_set_section_alignment (abfd, sec, 2))
return FALSE;
}
@@ -1952,12 +1996,12 @@ bfd_arm_get_bfd_for_interworking (bfd * abfd,
if (sec == NULL)
{
- flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_CODE | SEC_READONLY;
-
- sec = bfd_make_section (abfd, THUMB2ARM_GLUE_SECTION_NAME);
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+ | SEC_CODE | SEC_READONLY);
+ sec = bfd_make_section_with_flags (abfd, THUMB2ARM_GLUE_SECTION_NAME,
+ flags);
if (sec == NULL
- || ! bfd_set_section_flags (abfd, sec, flags)
|| ! bfd_set_section_alignment (abfd, sec, 2))
return FALSE;
}
@@ -2085,6 +2129,7 @@ bfd_arm_process_before_allocation (bfd * abfd,
#endif /* ! defined (COFF_IMAGE_WITH_PE) */
#define coff_bfd_reloc_type_lookup coff_arm_reloc_type_lookup
+#define coff_bfd_reloc_name_lookup coff_arm_reloc_name_lookup
#define coff_relocate_section coff_arm_relocate_section
#define coff_bfd_is_local_label_name coff_arm_is_local_label_name
#define coff_adjust_symndx coff_arm_adjust_symndx
@@ -2397,7 +2442,9 @@ Warning: Clearing the interworking flag of %B because non-interworking code in %
/* Note: the definitions here of LOCAL_LABEL_PREFIX and USER_LABEL_PREIFX
*must* match the definitions in gcc/config/arm/{coff|semi|aout}.h. */
+#ifndef LOCAL_LABEL_PREFIX
#define LOCAL_LABEL_PREFIX ""
+#endif
#ifndef USER_LABEL_PREFIX
#define USER_LABEL_PREFIX "_"
#endif
diff --git a/bfd/coff-aux.c b/bfd/coff-aux.c
index e22d85566a69..f28a9483fd5d 100644
--- a/bfd/coff-aux.c
+++ b/bfd/coff-aux.c
@@ -1,5 +1,5 @@
/* BFD back-end for Apple M68K COFF A/UX 3.x files.
- Copyright 1996, 1997, 2000, 2002 Free Software Foundation, Inc.
+ Copyright 1996, 1997, 2000, 2002, 2007 Free Software Foundation, Inc.
Written by Richard Henderson <rth@tamu.edu>.
This file is part of BFD, the Binary File Descriptor library.
@@ -37,8 +37,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
#define COFF_COMMON_ADDEND
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
static bfd_boolean coff_m68k_aux_link_add_one_symbol
PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword,
diff --git a/bfd/coff-h8300.c b/bfd/coff-h8300.c
index 9c858e1ef1ed..99c0a5a9832e 100644
--- a/bfd/coff-h8300.c
+++ b/bfd/coff-h8300.c
@@ -1,6 +1,6 @@
/* BFD back-end for Renesas H8/300 COFF binaries.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Steve Chamberlain, <sac@cygnus.com>.
@@ -20,8 +20,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "bfdlink.h"
#include "genlink.h"
@@ -1276,12 +1276,12 @@ h8300_bfd_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
/* Make sure the appropriate flags are set, including SEC_IN_MEMORY. */
flags = (SEC_ALLOC | SEC_LOAD
| SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_READONLY);
- htab->vectors_sec = bfd_make_section (abfd, ".vectors");
+ htab->vectors_sec = bfd_make_section_with_flags (abfd, ".vectors",
+ flags);
/* If the section wasn't created, or we couldn't set the flags,
quit quickly now, rather than dying a painful death later. */
- if (!htab->vectors_sec
- || !bfd_set_section_flags (abfd, htab->vectors_sec, flags))
+ if (!htab->vectors_sec)
return FALSE;
/* Also create the vector hash table. */
diff --git a/bfd/coff-h8500.c b/bfd/coff-h8500.c
index e9c878d820a0..7297fe689335 100644
--- a/bfd/coff-h8500.c
+++ b/bfd/coff-h8500.c
@@ -1,6 +1,6 @@
/* BFD back-end for Renesas H8/500 COFF binaries.
- Copyright 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003, 2004,
+ 2005, 2007 Free Software Foundation, Inc.
Contributed by Cygnus Support.
Written by Steve Chamberlain, <sac@cygnus.com>.
@@ -20,8 +20,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "bfdlink.h"
#include "coff/h8500.h"
diff --git a/bfd/coff-i386.c b/bfd/coff-i386.c
index 0d71cd000657..81d380012336 100644
--- a/bfd/coff-i386.c
+++ b/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, 2003, 2004
+ 2000, 2001, 2002, 2003, 2004, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -20,8 +20,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "coff/i386.h"
@@ -546,6 +546,7 @@ coff_i386_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
}
#define coff_bfd_reloc_type_lookup coff_i386_reloc_type_lookup
+#define coff_bfd_reloc_name_lookup coff_i386_reloc_name_lookup
static reloc_howto_type *
coff_i386_reloc_type_lookup (abfd, code)
@@ -578,6 +579,20 @@ coff_i386_reloc_type_lookup (abfd, code)
}
}
+static reloc_howto_type *
+coff_i386_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0; i < sizeof (howto_table) / sizeof (howto_table[0]); i++)
+ if (howto_table[i].name != NULL
+ && strcasecmp (howto_table[i].name, r_name) == 0)
+ return &howto_table[i];
+
+ return NULL;
+}
+
#define coff_rtype_to_howto coff_i386_rtype_to_howto
#ifdef TARGET_UNDERSCORE
diff --git a/bfd/coff-i860.c b/bfd/coff-i860.c
index 723e823f1c7b..53e0fd199ea8 100644
--- a/bfd/coff-i860.c
+++ b/bfd/coff-i860.c
@@ -1,6 +1,6 @@
/* BFD back-end for Intel i860 COFF files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
Created mostly by substituting "860" for "386" in coff-i386.c
Harry Dolan <dolan@ssd.intel.com>, October 1995
@@ -20,8 +20,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "coff/i860.h"
@@ -555,6 +555,20 @@ coff_i860_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
}
}
+static reloc_howto_type *
+coff_i860_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0; i < sizeof (howto_table) / sizeof (howto_table[0]); i++)
+ if (howto_table[i].name != NULL
+ && strcasecmp (howto_table[i].name, r_name) == 0)
+ return &howto_table[i];
+
+ return NULL;
+}
+
/* This is called from coff_slurp_reloc_table for each relocation
entry. This special handling is due to the `PAIR' relocation
which has a different meaning for the `r_symndx' field. */
@@ -620,6 +634,7 @@ i860_reloc_processing (arelent *cache_ptr, struct internal_reloc *dst,
#define coff_rtype_to_howto coff_i860_rtype_to_howto
#define coff_bfd_reloc_type_lookup coff_i860_reloc_type_lookup
+#define coff_bfd_reloc_name_lookup coff_i860_reloc_name_lookup
#define RELOC_PROCESSING(relent, reloc, symbols, abfd, section) \
i860_reloc_processing (relent, reloc, symbols, abfd, section)
diff --git a/bfd/coff-i960.c b/bfd/coff-i960.c
index 741e15d41ea7..e83fbac774e8 100644
--- a/bfd/coff-i960.c
+++ b/bfd/coff-i960.c
@@ -1,6 +1,6 @@
/* BFD back-end for Intel 960 COFF files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1999, 2000, 2001,
- 2002, 2003, 2004 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -22,8 +22,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
#define I960 1
#define BADMAG(x) I960BADMAG(x)
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "coff/i960.h"
#include "coff/internal.h"
@@ -296,6 +296,20 @@ coff_i960_reloc_type_lookup (abfd, code)
}
}
+static reloc_howto_type *
+coff_i960_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ if (strcasecmp (howto_optcall.name, r_name) == 0)
+ return &howto_optcall;
+ if (strcasecmp (howto_rellong.name, r_name) == 0)
+ return &howto_rellong;
+ if (strcasecmp (howto_iprmed.name, r_name) == 0)
+ return &howto_iprmed;
+
+ return NULL;
+}
+
/* The real code is in coffcode.h */
#define RTYPE2HOWTO(cache_ptr, dst) \
@@ -613,6 +627,7 @@ coff_i960_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp)
#define coff_adjust_symndx coff_i960_adjust_symndx
#define coff_bfd_reloc_type_lookup coff_i960_reloc_type_lookup
+#define coff_bfd_reloc_name_lookup coff_i960_reloc_name_lookup
#include "coffcode.h"
diff --git a/bfd/coff-ia64.c b/bfd/coff-ia64.c
index 1e3b3440f2ef..32702a8f6ff1 100644
--- a/bfd/coff-ia64.c
+++ b/bfd/coff-ia64.c
@@ -1,5 +1,5 @@
/* BFD back-end for HP/Intel IA-64 COFF files.
- Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002, 2007 Free Software Foundation, Inc.
Contributed by David Mosberger <davidm@hpl.hp.com>
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "coff/ia64.h"
#include "coff/internal.h"
diff --git a/bfd/coff-m68k.c b/bfd/coff-m68k.c
index d389a4ff1e00..b06334983571 100644
--- a/bfd/coff-m68k.c
+++ b/bfd/coff-m68k.c
@@ -1,6 +1,6 @@
/* BFD back-end for Motorola 68000 COFF binaries.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999,
- 2000, 2001, 2002, 2003, 2005
+ 2000, 2001, 2002, 2003, 2005, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -20,8 +20,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "coff/m68k.h"
#include "coff/internal.h"
@@ -91,6 +91,7 @@ m68k_coff_is_local_label_name (abfd, name)
#define m68k_rtype2howto _bfd_m68kcoff_rtype2howto
#define m68k_howto2rtype _bfd_m68kcoff_howto2rtype
#define m68k_reloc_type_lookup _bfd_m68kcoff_reloc_type_lookup
+#define m68k_reloc_name_lookup _bfd_m68kcoff_reloc_name_lookup
#endif
#ifdef ONLY_DECLARE_RELOCS
@@ -123,6 +124,8 @@ extern void m68k_rtype2howto PARAMS ((arelent *internal, int relocentry));
extern int m68k_howto2rtype PARAMS ((reloc_howto_type *));
extern reloc_howto_type *m68k_reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type));
+extern reloc_howto_type *m68k_reloc_name_lookup
+ PARAMS ((bfd *, const char *));
#else
#ifdef STATIC_RELOCS
@@ -132,6 +135,7 @@ extern reloc_howto_type *m68k_reloc_type_lookup
#endif
STAT_REL reloc_howto_type * m68k_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type));
+STAT_REL reloc_howto_type * m68k_reloc_name_lookup PARAMS ((bfd *, const char *));
STAT_REL int m68k_howto2rtype PARAMS ((reloc_howto_type *));
STAT_REL void m68k_rtype2howto PARAMS ((arelent *, int));
@@ -198,6 +202,22 @@ m68k_reloc_type_lookup (abfd, code)
/*NOTREACHED*/
}
+STAT_REL reloc_howto_type *
+m68k_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (m68kcoff_howto_table) / sizeof (m68kcoff_howto_table[0]);
+ i++)
+ if (m68kcoff_howto_table[i].name != NULL
+ && strcasecmp (m68kcoff_howto_table[i].name, r_name) == 0)
+ return &m68kcoff_howto_table[i];
+
+ return NULL;
+}
+
#endif /* not ONLY_DECLARE_RELOCS */
#define RTYPE2HOWTO(internal, relocentry) \
@@ -207,6 +227,7 @@ m68k_reloc_type_lookup (abfd, code)
external.r_type = m68k_howto2rtype (internal)
#define coff_bfd_reloc_type_lookup m68k_reloc_type_lookup
+#define coff_bfd_reloc_name_lookup m68k_reloc_name_lookup
#ifndef COFF_COMMON_ADDEND
#ifndef coff_rtype_to_howto
@@ -230,11 +251,12 @@ m68kcoff_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
arelent relent;
reloc_howto_type *howto;
+ relent.howto = NULL;
RTYPE2HOWTO (&relent, rel);
howto = relent.howto;
- if (howto->pc_relative)
+ if (howto != NULL && howto->pc_relative)
*addendp += sec->vma;
return howto;
@@ -390,6 +412,7 @@ m68kcoff_common_addend_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
arelent relent;
reloc_howto_type *howto;
+ relent.howto = NULL;
RTYPE2HOWTO (&relent, rel);
howto = relent.howto;
diff --git a/bfd/coff-m88k.c b/bfd/coff-m88k.c
index 422798b1af40..101cdcb738e1 100644
--- a/bfd/coff-m88k.c
+++ b/bfd/coff-m88k.c
@@ -1,7 +1,6 @@
/* BFD back-end for Motorola 88000 COFF "Binary Compatibility Standard" files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003
- Free Software Foundation, Inc.
+ 2001, 2002, 2003, 2007 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -21,8 +20,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#define M88 1 /* Customize various include files */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "coff/m88k.h"
#include "coff/internal.h"
diff --git a/bfd/coff-maxq.c b/bfd/coff-maxq.c
index 6414cb9c206e..b3881d323a10 100644
--- a/bfd/coff-maxq.c
+++ b/bfd/coff-maxq.c
@@ -1,5 +1,5 @@
/* BFD back-end for MAXQ COFF binaries.
- Copyright 2004 Free Software Foundation, Inc.
+ Copyright 2004, 2007 Free Software Foundation, Inc.
Contributed by Vineet Sharma (vineets@noida.hcltech.com) Inderpreet S.
(inderpreetb@noida.hcltech.com)
@@ -22,8 +22,8 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "coff/maxq.h"
#include "coff/internal.h"
@@ -82,7 +82,6 @@ coff_maxq20_reloc (bfd * abfd,
bfd * output_bfd ATTRIBUTE_UNUSED,
char ** error_message ATTRIBUTE_UNUSED)
{
- reloc_howto_type *howto = NULL;
unsigned char *addr = NULL;
unsigned long x = 0;
long call_addr = 0;
@@ -96,7 +95,6 @@ coff_maxq20_reloc (bfd * abfd,
if (data && reloc_entry)
{
- howto = reloc_entry->howto;
addr = (unsigned char *) data + reloc_entry->address;
call_addr = call_addr - call_addr;
call_addr = get_symbol_value (symbol_in);
@@ -374,69 +372,56 @@ static reloc_howto_type howto_table[] =
EMPTY_HOWTO (10),
};
-/* Map BFD reloc types to MAXQ COFF reloc types. */
-
-typedef struct maxq_reloc_map
-{
- bfd_reloc_code_real_type bfd_reloc_val;
- unsigned int maxq_reloc_val;
- reloc_howto_type * table;
-}
-reloc_map;
-
-static const reloc_map maxq_reloc_map[] =
-{
- {BFD_RELOC_16_PCREL_S2, SHORT_JUMP, howto_table},
- {BFD_RELOC_16, LONG_JUMP, howto_table},
-};
-
static reloc_howto_type *
maxq_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
bfd_reloc_code_real_type code)
{
- unsigned int i;
-
- for (i = 0; i < ARRAY_SIZE (maxq_reloc_map); i++)
+ switch (code)
{
- const reloc_map *entry;
-
- entry = maxq_reloc_map + i;
-
- switch (code)
- {
- /* SHORT JUMP */
- case BFD_RELOC_16_PCREL_S2:
- return howto_table + 3;
-
- /* INTERSEGMENT JUMP */
- case BFD_RELOC_24:
- return howto_table + 4;
-
- /* BYTE RELOC */
- case BFD_RELOC_8:
- return howto_table + 7;
-
- /* WORD RELOC */
- case BFD_RELOC_16:
- return howto_table + 5;
-
- /* LONG RELOC */
- case BFD_RELOC_32:
- return howto_table + 2;
+ /* SHORT JUMP */
+ case BFD_RELOC_16_PCREL_S2:
+ return howto_table + 3;
+
+ /* INTERSEGMENT JUMP */
+ case BFD_RELOC_24:
+ return howto_table + 4;
+
+ /* BYTE RELOC */
+ case BFD_RELOC_8:
+ return howto_table + 7;
+
+ /* WORD RELOC */
+ case BFD_RELOC_16:
+ return howto_table + 5;
+
+ /* LONG RELOC */
+ case BFD_RELOC_32:
+ return howto_table + 2;
+
+ /* LONG JUMP */
+ case BFD_RELOC_14:
+ return howto_table + 6;
+
+ default:
+ return NULL;
+ }
+}
- /* LONG JUMP */
- case BFD_RELOC_14:
- return howto_table + 6;
+static reloc_howto_type *
+maxq_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name)
+{
+ unsigned int i;
- default:
- return NULL;
- }
- }
+ for (i = 0; i < sizeof (howto_table) / sizeof (howto_table[0]); i++)
+ if (howto_table[i].name != NULL
+ && strcasecmp (howto_table[i].name, r_name) == 0)
+ return &howto_table[i];
return NULL;
}
#define coff_bfd_reloc_type_lookup maxq_reloc_type_lookup
+#define coff_bfd_reloc_name_lookup maxq_reloc_name_lookup
/* Perform any necessary magic to the addend in a reloc entry. */
#define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \
diff --git a/bfd/coff-mcore.c b/bfd/coff-mcore.c
index 08935fd62971..291474cbec9f 100644
--- a/bfd/coff-mcore.c
+++ b/bfd/coff-mcore.c
@@ -1,5 +1,5 @@
/* BFD back-end for Motorola MCore COFF/PE
- Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -19,8 +19,8 @@ along with this program; if not, write to the Free Software
Foundation, 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "coff/mcore.h"
#include "coff/internal.h"
@@ -283,9 +283,25 @@ mcore_coff_reloc_type_lookup (abfd, code)
}
/*NOTREACHED*/
}
-
#undef HOW2MAP
+static reloc_howto_type *
+mcore_coff_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (mcore_coff_howto_table)
+ / sizeof (mcore_coff_howto_table[0]));
+ i++)
+ if (mcore_coff_howto_table[i].name != NULL
+ && strcasecmp (mcore_coff_howto_table[i].name, r_name) == 0)
+ return &mcore_coff_howto_table[i];
+
+ return NULL;
+}
+
#define RTYPE2HOWTO(cache_ptr, dst) \
(cache_ptr)->howto = mcore_coff_howto_table + (dst)->r_type;
@@ -538,6 +554,7 @@ coff_mcore_relocate_section (output_bfd, info, input_bfd, input_section,
/* We use the special COFF backend linker, with our own special touch. */
#define coff_bfd_reloc_type_lookup mcore_coff_reloc_type_lookup
+#define coff_bfd_reloc_name_lookup mcore_coff_reloc_name_lookup
#define coff_relocate_section coff_mcore_relocate_section
#define coff_rtype_to_howto coff_mcore_rtype_to_howto
diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c
index 34b072c4138e..d5dafc7bf35f 100644
--- a/bfd/coff-mips.c
+++ b/bfd/coff-mips.c
@@ -1,6 +1,6 @@
/* BFD back-end for MIPS Extended-Coff files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004
+ 2000, 2001, 2002, 2003, 2004, 2007
Free Software Foundation, Inc.
Original version by Per Bothner.
Full support added by Ian Lance Taylor, ian@cygnus.com.
@@ -21,8 +21,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "coff/internal.h"
@@ -769,6 +769,22 @@ mips_bfd_reloc_type_lookup (abfd, code)
return &mips_howto_table[mips_type];
}
+
+static reloc_howto_type *
+mips_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (mips_howto_table) / sizeof (mips_howto_table[0]);
+ i++)
+ if (mips_howto_table[i].name != NULL
+ && strcasecmp (mips_howto_table[i].name, r_name) == 0)
+ return &mips_howto_table[i];
+
+ return NULL;
+}
/* A helper routine for mips_relocate_section which handles the REFHI
relocations. The REFHI relocation must be followed by a REFLO
@@ -1375,6 +1391,7 @@ static const struct ecoff_backend_data mips_ecoff_backend_data =
/* Looking up a reloc type is MIPS specific. */
#define _bfd_ecoff_bfd_reloc_type_lookup mips_bfd_reloc_type_lookup
+#define _bfd_ecoff_bfd_reloc_name_lookup mips_bfd_reloc_name_lookup
/* Getting relocated section contents is generic. */
#define _bfd_ecoff_bfd_get_relocated_section_contents \
diff --git a/bfd/coff-or32.c b/bfd/coff-or32.c
index c8f0fe03601a..077e8f6bab28 100644
--- a/bfd/coff-or32.c
+++ b/bfd/coff-or32.c
@@ -1,5 +1,5 @@
/* BFD back-end for OpenRISC 1000 COFF binaries.
- Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
Contributed by Ivan Guzvinec <ivang@opencores.org>
This file is part of BFD, the Binary File Descriptor library.
@@ -20,8 +20,8 @@
#define OR32 1
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "coff/or32.h"
#include "coff/internal.h"
@@ -317,11 +317,7 @@ reloc_processing (relent,reloc, symbols, abfd, section)
}
else
{
- asymbol *ptr;
relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx];
-
- ptr = *(relent->sym_ptr_ptr);
-
relent->addend = 0;
relent->address-= section->vma;
diff --git a/bfd/coff-pmac.c b/bfd/coff-pmac.c
index 5e5086738456..49ceb5241b07 100644
--- a/bfd/coff-pmac.c
+++ b/bfd/coff-pmac.c
@@ -1,5 +1,5 @@
/* BFD back-end for Apple et al PowerPC Mac "XCOFF" files.
- Copyright 1995, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1995, 2000, 2001, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -24,8 +24,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
#define TARGET_SYM pmac_xcoff_vec
#define TARGET_NAME "xcoff-powermac"
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "coff/internal.h"
#include "coff/rs6000.h"
diff --git a/bfd/coff-ppc.c b/bfd/coff-ppc.c
index b4427936933a..72ade4e8ad25 100644
--- a/bfd/coff-ppc.c
+++ b/bfd/coff-ppc.c
@@ -1,6 +1,6 @@
/* BFD back-end for PowerPC Microsoft Portable Executable files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Original version pieced together by Kim Knuttila (krk@cygnus.com)
@@ -33,9 +33,8 @@
- dlltool will not produce correct output in some .reloc cases, and will
not produce the right glue code for dll function calls. */
-#include "bfd.h"
#include "sysdep.h"
-
+#include "bfd.h"
#include "libbfd.h"
#include "coff/powerpc.h"
@@ -1332,7 +1331,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
DUMP_RELOC2 (howto->name, rel);
- if (strncmp(".idata$2",input_section->name,8) == 0 && first_thunk_address == 0)
+ if (CONST_STRNEQ (input_section->name, ".idata$2") && first_thunk_address == 0)
{
/* Set magic values. */
int idata5offset;
@@ -1961,8 +1960,23 @@ ppc_coff_reloc_type_lookup (abfd, code)
return NULL;
}
}
-
#undef HOW2MAP
+
+static reloc_howto_type *
+ppc_coff_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (ppc_coff_howto_table) / sizeof (ppc_coff_howto_table[0]);
+ i++)
+ if (ppc_coff_howto_table[i].name != NULL
+ && strcasecmp (ppc_coff_howto_table[i].name, r_name) == 0)
+ return &ppc_coff_howto_table[i];
+
+ return NULL;
+}
/* Tailor coffcode.h -- macro heaven. */
@@ -1971,6 +1985,7 @@ ppc_coff_reloc_type_lookup (abfd, code)
/* We use the special COFF backend linker, with our own special touch. */
#define coff_bfd_reloc_type_lookup ppc_coff_reloc_type_lookup
+#define coff_bfd_reloc_name_lookup ppc_coff_reloc_name_lookup
#define coff_rtype_to_howto coff_ppc_rtype_to_howto
#define coff_relocate_section coff_ppc_relocate_section
#define coff_bfd_final_link ppc_bfd_coff_final_link
diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index 951587f99b1e..f446f497306a 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -1,12 +1,7 @@
/* BFD back-end for IBM RS/6000 "XCOFF" files.
- Copyright 1990-1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ Copyright 1990-1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
- FIXME: Can someone provide a transliteration of this name into ASCII?
- Using the following chars caused a compiler warning on HIUX (so I replaced
- them with octal escapes), and isn't useful without an understanding of what
- character set it is.
- Written by Metin G. Ozisik, Mimi Ph\373\364ng-Th\345o V\365,
- and John Gilmore.
+ Written by Metin G. Ozisik, Mimi Phuong-Thao Vo, and John Gilmore.
Archive support from Damon A. Permezel.
Contributed by IBM Corporation and Cygnus Support.
@@ -26,8 +21,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "coff/internal.h"
@@ -59,7 +54,7 @@ extern bfd_boolean _bfd_xcoff_write_armap
extern bfd_boolean _bfd_xcoff_write_archive_contents
PARAMS ((bfd *));
extern int _bfd_xcoff_sizeof_headers
- PARAMS ((bfd *, bfd_boolean));
+ PARAMS ((bfd *, struct bfd_link_info *));
extern void _bfd_xcoff_swap_sym_in
PARAMS ((bfd *, PTR, PTR));
extern unsigned int _bfd_xcoff_swap_sym_out
@@ -98,6 +93,7 @@ void xcoff_rtype2howto
#define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data
#define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name
#define coff_bfd_reloc_type_lookup _bfd_xcoff_reloc_type_lookup
+#define coff_bfd_reloc_name_lookup _bfd_xcoff_reloc_name_lookup
#ifdef AIX_CORE
extern const bfd_target * rs6000coff_core_p
PARAMS ((bfd *abfd));
@@ -1051,6 +1047,21 @@ _bfd_xcoff_reloc_type_lookup (abfd, code)
}
}
+static reloc_howto_type *
+_bfd_xcoff_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (xcoff_howto_table) / sizeof (xcoff_howto_table[0]);
+ i++)
+ if (xcoff_howto_table[i].name != NULL
+ && strcasecmp (xcoff_howto_table[i].name, r_name) == 0)
+ return &xcoff_howto_table[i];
+
+ return NULL;
+}
/* XCOFF archive support. The original version of this code was by
Damon A. Permezel. It was enhanced to permit cross support, and
@@ -1638,7 +1649,7 @@ xcoff_write_armap_old (abfd, elength, map, orl_count, stridx)
+ SXCOFFARFMAG
+ arelt_size (sub));
fileoff = (fileoff + 1) &~ 1;
- sub = sub->next;
+ sub = sub->archive_next;
}
for (i = 0; i < orl_count; i++)
@@ -1809,7 +1820,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
}
i++;
}
- current_bfd = current_bfd->next;
+ current_bfd = current_bfd->archive_next;
if (current_bfd != NULL)
arch_info = bfd_get_arch_info (current_bfd);
}
@@ -1913,7 +1924,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
+ SXCOFFARFMAG
+ arelt_size (current_bfd));
fileoff += fileoff & 1;
- current_bfd = current_bfd->next;
+ current_bfd = current_bfd->archive_next;
if (current_bfd != NULL)
arch_info = bfd_get_arch_info (current_bfd);
}
@@ -1934,7 +1945,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
}
i++;
}
- current_bfd = current_bfd->next;
+ current_bfd = current_bfd->archive_next;
if (current_bfd != NULL)
arch_info = bfd_get_arch_info (current_bfd);
}
@@ -2009,7 +2020,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
+ SXCOFFARFMAG
+ arelt_size (current_bfd));
fileoff += fileoff & 1;
- current_bfd = current_bfd->next;
+ current_bfd = current_bfd->archive_next;
if (current_bfd != NULL)
arch_info = bfd_get_arch_info (current_bfd);
}
@@ -2030,7 +2041,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
}
i++;
}
- current_bfd = current_bfd->next;
+ current_bfd = current_bfd->archive_next;
if (current_bfd != NULL)
arch_info = bfd_get_arch_info (current_bfd);
}
@@ -2089,7 +2100,7 @@ xcoff_write_archive_contents_old (abfd)
count = 0;
total_namlen = 0;
- for (sub = abfd->archive_head; sub != NULL; sub = sub->next)
+ for (sub = abfd->archive_head; sub != NULL; sub = sub->archive_next)
{
++count;
total_namlen += strlen (normalize_filename (sub)) + 1;
@@ -2105,7 +2116,9 @@ xcoff_write_archive_contents_old (abfd)
hasobjects = FALSE;
prevoff = 0;
nextoff = SIZEOF_AR_FILE_HDR;
- for (sub = abfd->archive_head, i = 0; sub != NULL; sub = sub->next, i++)
+ for (sub = abfd->archive_head, i = 0;
+ sub != NULL;
+ sub = sub->archive_next, i++)
{
const char *name;
bfd_size_type namlen;
@@ -2253,7 +2266,7 @@ xcoff_write_archive_contents_old (abfd)
abfd) != XCOFFARMAG_ELEMENT_SIZE)
return FALSE;
}
- for (sub = abfd->archive_head; sub != NULL; sub = sub->next)
+ for (sub = abfd->archive_head; sub != NULL; sub = sub->archive_next)
{
const char *name;
bfd_size_type namlen;
@@ -2323,7 +2336,7 @@ xcoff_write_archive_contents_big (abfd)
hasobjects = FALSE;
for (current_bfd = abfd->archive_head, count = 0, total_namlen = 0;
current_bfd != NULL;
- current_bfd = current_bfd->next, count++)
+ current_bfd = current_bfd->archive_next, count++)
{
total_namlen += strlen (normalize_filename (current_bfd)) + 1;
@@ -2345,7 +2358,7 @@ xcoff_write_archive_contents_big (abfd)
nextoff = SIZEOF_AR_FILE_HDR_BIG;
for (current_bfd = abfd->archive_head, i = 0;
current_bfd != NULL;
- current_bfd = current_bfd->next, i++)
+ current_bfd = current_bfd->archive_next, i++)
{
const char *name;
bfd_size_type namlen;
@@ -2512,8 +2525,9 @@ xcoff_write_archive_contents_big (abfd)
offsets = NULL;
}
- for (current_bfd = abfd->archive_head; current_bfd != NULL;
- current_bfd = current_bfd->next)
+ for (current_bfd = abfd->archive_head;
+ current_bfd != NULL;
+ current_bfd = current_bfd->archive_next)
{
const char *name;
size_t namlen;
@@ -2573,9 +2587,8 @@ _bfd_xcoff_write_archive_contents (abfd)
always uses an a.out header. */
int
-_bfd_xcoff_sizeof_headers (abfd, reloc)
- bfd *abfd;
- bfd_boolean reloc ATTRIBUTE_UNUSED;
+_bfd_xcoff_sizeof_headers (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
int size;
@@ -4179,6 +4192,7 @@ const bfd_target rs6000coff_vec =
coff_get_reloc_upper_bound,
coff_canonicalize_reloc,
_bfd_xcoff_reloc_type_lookup,
+ _bfd_xcoff_reloc_name_lookup,
/* Write */
coff_set_arch_mach,
@@ -4429,6 +4443,7 @@ const bfd_target pmac_xcoff_vec =
coff_get_reloc_upper_bound,
coff_canonicalize_reloc,
_bfd_xcoff_reloc_type_lookup,
+ _bfd_xcoff_reloc_name_lookup,
/* Write */
coff_set_arch_mach,
diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c
index fcfee718982d..3734fb37912e 100644
--- a/bfd/coff-sh.c
+++ b/bfd/coff-sh.c
@@ -1,6 +1,6 @@
/* BFD back-end for Renesas Super-H COFF binaries.
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
Contributed by Cygnus Support.
Written by Steve Chamberlain, <sac@cygnus.com>.
Relaxing code written by Ian Lance Taylor, <ian@cygnus.com>.
@@ -21,8 +21,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libiberty.h"
#include "libbfd.h"
#include "bfdlink.h"
@@ -494,6 +494,7 @@ static const struct shcoff_reloc_map sh_reloc_map[] =
/* Given a BFD reloc code, return the howto structure for the
corresponding SH PE reloc. */
#define coff_bfd_reloc_type_lookup sh_coff_reloc_type_lookup
+#define coff_bfd_reloc_name_lookup sh_coff_reloc_name_lookup
static reloc_howto_type *
sh_coff_reloc_type_lookup (abfd, code)
@@ -510,6 +511,20 @@ sh_coff_reloc_type_lookup (abfd, code)
return NULL;
}
+static reloc_howto_type *
+sh_coff_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0; i < sizeof (sh_coff_howtos) / sizeof (sh_coff_howtos[0]); i++)
+ if (sh_coff_howtos[i].name != NULL
+ && strcasecmp (sh_coff_howtos[i].name, r_name) == 0)
+ return &sh_coff_howtos[i];
+
+ return NULL;
+}
+
/* This macro is used in coffcode.h to get the howto corresponding to
an internal reloc. */
@@ -2510,8 +2525,9 @@ _bfd_sh_align_load_span (abfd, sec, contents, swap, relocs,
next2_insn = bfd_get_16 (abfd, contents + i + 4);
next2_op = sh_insn_info (next2_insn);
- if ((next2_op->flags & (LOAD | STORE)) == 0
- && sh_load_use (insn, op, next2_insn, next2_op))
+ if (next2_op == NULL
+ || ((next2_op->flags & (LOAD | STORE)) == 0
+ && sh_load_use (insn, op, next2_insn, next2_op)))
ok = FALSE;
}
diff --git a/bfd/coff-sparc.c b/bfd/coff-sparc.c
index 0236f525e66f..236c7bfd4e38 100644
--- a/bfd/coff-sparc.c
+++ b/bfd/coff-sparc.c
@@ -1,6 +1,6 @@
/* BFD back-end for Sparc COFF files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001,
- 2002, 2003, 2005 Free Software Foundation, Inc.
+ 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -19,8 +19,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "coff/sparc.h"
#include "coff/internal.h"
@@ -158,6 +158,24 @@ coff_sparc_reloc_type_lookup (abfd, code)
}
#define coff_bfd_reloc_type_lookup coff_sparc_reloc_type_lookup
+static reloc_howto_type *
+coff_sparc_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (coff_sparc_howto_table)
+ / sizeof (coff_sparc_howto_table[0]));
+ i++)
+ if (coff_sparc_howto_table[i].name != NULL
+ && strcasecmp (coff_sparc_howto_table[i].name, r_name) == 0)
+ return &coff_sparc_howto_table[i];
+
+ return NULL;
+}
+#define coff_bfd_reloc_name_lookup coff_sparc_reloc_name_lookup
+
static void
rtype2howto (cache_ptr, dst)
arelent *cache_ptr;
diff --git a/bfd/coff-stgo32.c b/bfd/coff-stgo32.c
index 3c5fdbb6e804..61f18f0c1f35 100644
--- a/bfd/coff-stgo32.c
+++ b/bfd/coff-stgo32.c
@@ -1,5 +1,5 @@
/* BFD back-end for Intel 386 COFF files (DJGPP variant with a stub).
- Copyright 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2006 Free Software Foundation, Inc.
Written by Robert Hoehne.
This file is part of BFD, the Binary File Descriptor library.
@@ -354,7 +354,7 @@ create_go32_stub (abfd)
close (f);
goto stub_end;
}
- if (memcmp (magic, "go32stub", 8) != 0)
+ if (! CONST_STRNEQ (magic, "go32stub"))
{
close (f);
goto stub_end;
diff --git a/bfd/coff-tic30.c b/bfd/coff-tic30.c
index b1ff5dbdfbff..dd97b2f8abbb 100644
--- a/bfd/coff-tic30.c
+++ b/bfd/coff-tic30.c
@@ -1,5 +1,6 @@
/* BFD back-end for TMS320C30 coff binaries.
- Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002, 2007
+ Free Software Foundation, Inc.
Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au)
This file is part of BFD, the Binary File Descriptor library.
@@ -19,8 +20,8 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "bfdlink.h"
#include "coff/tic30.h"
@@ -52,6 +53,7 @@ reloc_howto_type tic30_coff_howto_table[] =
#ifndef coff_bfd_reloc_type_lookup
#define coff_bfd_reloc_type_lookup tic30_coff_reloc_type_lookup
+#define coff_bfd_reloc_name_lookup tic30_coff_reloc_name_lookup
/* For the case statement use the code values used in tc_gen_reloc to
map to the howto table entries that match those in both the aout
@@ -80,6 +82,23 @@ tic30_coff_reloc_type_lookup (abfd, code)
}
}
+static reloc_howto_type *
+tic30_coff_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (tic30_coff_howto_table)
+ / sizeof (tic30_coff_howto_table[0]));
+ i++)
+ if (tic30_coff_howto_table[i].name != NULL
+ && strcasecmp (tic30_coff_howto_table[i].name, r_name) == 0)
+ return &tic30_coff_howto_table[i];
+
+ return NULL;
+}
+
#endif
/* Turn a howto into a reloc number. */
diff --git a/bfd/coff-tic4x.c b/bfd/coff-tic4x.c
index 1e95411e9e62..110fe1c1295e 100644
--- a/bfd/coff-tic4x.c
+++ b/bfd/coff-tic4x.c
@@ -1,5 +1,5 @@
/* BFD back-end for TMS320C4X coff binaries.
- Copyright 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2005
+ Copyright 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2005, 2007
Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz)
@@ -21,8 +21,8 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "bfdlink.h"
#include "coff/tic4x.h"
@@ -117,6 +117,8 @@ reloc_howto_type tic4x_howto_table[] =
#undef coff_bfd_reloc_type_lookup
#define coff_bfd_reloc_type_lookup tic4x_coff_reloc_type_lookup
+#undef coff_bfd_reloc_name_lookup
+#define coff_bfd_reloc_name_lookup tic4x_coff_reloc_name_lookup
/* For the case statement use the code values used tc_gen_reloc (defined in
bfd/reloc.c) to map to the howto table entries. */
@@ -150,6 +152,21 @@ tic4x_coff_reloc_type_lookup (abfd, code)
return NULL;
}
+static reloc_howto_type *
+tic4x_coff_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (tic4x_howto_table) / sizeof (tic4x_howto_table[0]);
+ i++)
+ if (tic4x_howto_table[i].name != NULL
+ && strcasecmp (tic4x_howto_table[i].name, r_name) == 0)
+ return &tic4x_howto_table[i];
+
+ return NULL;
+}
/* Code to turn a r_type into a howto ptr, uses the above howto table.
Called after some initial checking by the tic4x_rtype_to_howto fn
diff --git a/bfd/coff-tic54x.c b/bfd/coff-tic54x.c
index f16fe899671d..6b3e686b57bf 100644
--- a/bfd/coff-tic54x.c
+++ b/bfd/coff-tic54x.c
@@ -1,5 +1,5 @@
/* BFD back-end for TMS320C54X coff binaries.
- Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007
Free Software Foundation, Inc.
Contributed by Timothy Wall (twall@cygnus.com)
@@ -20,8 +20,8 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "bfdlink.h"
#include "coff/tic54x.h"
@@ -229,6 +229,7 @@ reloc_howto_type tic54x_howto_table[] =
};
#define coff_bfd_reloc_type_lookup tic54x_coff_reloc_type_lookup
+#define coff_bfd_reloc_name_lookup tic54x_coff_reloc_name_lookup
/* For the case statement use the code values used tc_gen_reloc (defined in
bfd/reloc.c) to map to the howto table entries. */
@@ -259,6 +260,22 @@ tic54x_coff_reloc_type_lookup (abfd, code)
}
}
+static reloc_howto_type *
+tic54x_coff_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (tic54x_howto_table) / sizeof (tic54x_howto_table[0]);
+ i++)
+ if (tic54x_howto_table[i].name != NULL
+ && strcasecmp (tic54x_howto_table[i].name, r_name) == 0)
+ return &tic54x_howto_table[i];
+
+ return NULL;
+}
+
/* Code to turn a r_type into a howto ptr, uses the above howto table.
Called after some initial checking by the tic54x_rtype_to_howto fn below. */
diff --git a/bfd/coff-tic80.c b/bfd/coff-tic80.c
index ec9cbeef59aa..3fcedd7e6056 100644
--- a/bfd/coff-tic80.c
+++ b/bfd/coff-tic80.c
@@ -1,5 +1,5 @@
/* BFD back-end for Texas Instruments TMS320C80 Multimedia Video Processor (MVP).
- Copyright 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007
Free Software Foundation, Inc.
Written by Fred Fish (fnf@cygnus.com)
@@ -24,9 +24,9 @@ along with this program; if not, write to the Free Software
Foundation, 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
+#include "sysdep.h"
#include "bfd.h"
#include "bfdlink.h"
-#include "sysdep.h"
#include "libbfd.h"
#ifdef _CONST
/* Newlib-based hosts define _CONST as a STDC-safe alias for const,
diff --git a/bfd/coff-w65.c b/bfd/coff-w65.c
index 7a1cfb73928b..ce8f1dc2bca8 100644
--- a/bfd/coff-w65.c
+++ b/bfd/coff-w65.c
@@ -1,6 +1,6 @@
/* BFD back-end for WDC 65816 COFF binaries.
- Copyright 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
+ Copyright 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+ 2006, 2007 Free Software Foundation, Inc.
Written by Steve Chamberlain, <sac@cygnus.com>.
This file is part of BFD, the Binary File Descriptor library.
@@ -19,8 +19,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "bfdlink.h"
#include "coff/w65.h"
@@ -105,7 +105,7 @@ reloc_processing (relent, reloc, symbols, abfd, section)
if (((int) reloc->r_symndx) > 0)
relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx];
else
- relent->sym_ptr_ptr = (asymbol **)&(bfd_abs_symbol);
+ relent->sym_ptr_ptr = (asymbol **) bfd_abs_section_ptr->symbol_ptr_ptr;
relent->addend = reloc->r_offset;
diff --git a/bfd/coff-we32k.c b/bfd/coff-we32k.c
index a488e2dc644d..e7b0b5c03307 100644
--- a/bfd/coff-we32k.c
+++ b/bfd/coff-we32k.c
@@ -1,5 +1,5 @@
/* BFD back-end for we32k COFF files.
- Copyright 1992, 1993, 1994, 1999, 2000, 2002, 2003
+ Copyright 1992, 1993, 1994, 1999, 2000, 2002, 2003, 2007
Free Software Foundation, Inc.
Contributed by Brendan Kehoe (brendan@cs.widener.edu).
@@ -19,8 +19,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "coff/we32k.h"
#include "coff/internal.h"
diff --git a/bfd/coff-x86_64.c b/bfd/coff-x86_64.c
new file mode 100644
index 000000000000..a30349f16080
--- /dev/null
+++ b/bfd/coff-x86_64.c
@@ -0,0 +1,783 @@
+/* BFD back-end for AMD 64 COFF files.
+ Copyright 2006, 2007 Free Software Foundation, Inc.
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+
+ Written by Kai Tietz, OneVision Software GmbH&CoKg. */
+
+#ifndef COFF_WITH_pex64
+#define COFF_WITH_pex64
+#endif
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "libbfd.h"
+#include "coff/x86_64.h"
+#include "coff/internal.h"
+#include "coff/pe.h"
+#include "libcoff.h"
+#include "libiberty.h"
+
+#define BADMAG(x) AMD64BADMAG(x)
+
+#ifdef COFF_WITH_pex64
+# undef AOUTSZ
+# define AOUTSZ PEPAOUTSZ
+# define PEAOUTHDR PEPAOUTHDR
+#endif
+
+#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
+
+/* The page size is a guess based on ELF. */
+
+#define COFF_PAGE_SIZE 0x1000
+
+/* For some reason when using AMD COFF the value stored in the .text
+ section for a reference to a common symbol is the value itself plus
+ any desired offset. Ian Taylor, Cygnus Support. */
+
+/* If we are producing relocatable output, we need to do some
+ adjustments to the object file that are not done by the
+ bfd_perform_relocation function. This function is called by every
+ reloc type to make any required adjustments. */
+
+static bfd_reloc_status_type
+coff_amd64_reloc (bfd *abfd,
+ arelent *reloc_entry,
+ asymbol *symbol,
+ void * data,
+ asection *input_section ATTRIBUTE_UNUSED,
+ bfd *output_bfd,
+ char **error_message ATTRIBUTE_UNUSED)
+{
+ symvalue diff;
+
+#if !defined(COFF_WITH_PE)
+ if (output_bfd == NULL)
+ return bfd_reloc_continue;
+#endif
+
+ if (bfd_is_com_section (symbol->section))
+ {
+#if !defined(COFF_WITH_PE)
+ /* We are relocating a common symbol. The current value in the
+ object file is ORIG + OFFSET, where ORIG is the value of the
+ common symbol as seen by the object file when it was compiled
+ (this may be zero if the symbol was undefined) and OFFSET is
+ the offset into the common symbol (normally zero, but may be
+ non-zero when referring to a field in a common structure).
+ ORIG is the negative of reloc_entry->addend, which is set by
+ the CALC_ADDEND macro below. We want to replace the value in
+ the object file with NEW + OFFSET, where NEW is the value of
+ the common symbol which we are going to put in the final
+ object file. NEW is symbol->value. */
+ diff = symbol->value + reloc_entry->addend;
+#else
+ /* In PE mode, we do not offset the common symbol. */
+ diff = reloc_entry->addend;
+#endif
+ }
+ else
+ {
+ /* For some reason bfd_perform_relocation always effectively
+ ignores the addend for a COFF target when producing
+ relocatable output. This seems to be always wrong for 386
+ COFF, so we handle the addend here instead. */
+#if defined(COFF_WITH_PE)
+ if (output_bfd == NULL)
+ {
+ reloc_howto_type *howto = reloc_entry->howto;
+
+ /* Although PC relative relocations are very similar between
+ PE and non-PE formats, but they are off by 1 << howto->size
+ bytes. For the external relocation, PE is very different
+ from others. See md_apply_fix3 () in gas/config/tc-amd64.c.
+ When we link PE and non-PE object files together to
+ generate a non-PE executable, we have to compensate it
+ here. */
+ if(howto->pc_relative && howto->pcrel_offset)
+ diff = -(1 << howto->size);
+ else if(symbol->flags & BSF_WEAK)
+ diff = reloc_entry->addend - symbol->value;
+ else
+ diff = -reloc_entry->addend;
+ }
+ else
+#endif
+ diff = reloc_entry->addend;
+ }
+
+#if defined(COFF_WITH_PE)
+ /* FIXME: How should this case be handled? */
+ if (reloc_entry->howto->type == R_AMD64_IMAGEBASE
+ && output_bfd != NULL
+ && bfd_get_flavour (output_bfd) == bfd_target_coff_flavour)
+ diff -= pe_data (output_bfd)->pe_opthdr.ImageBase;
+#endif
+
+#define DOIT(x) \
+ x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + diff) & howto->dst_mask))
+
+ if (diff != 0)
+ {
+ reloc_howto_type *howto = reloc_entry->howto;
+ unsigned char *addr = (unsigned char *) data + reloc_entry->address;
+
+ switch (howto->size)
+ {
+ case 0:
+ {
+ char x = bfd_get_8 (abfd, addr);
+ DOIT (x);
+ bfd_put_8 (abfd, x, addr);
+ }
+ break;
+
+ case 1:
+ {
+ short x = bfd_get_16 (abfd, addr);
+ DOIT (x);
+ bfd_put_16 (abfd, (bfd_vma) x, addr);
+ }
+ break;
+
+ case 2:
+ {
+ long x = bfd_get_32 (abfd, addr);
+ DOIT (x);
+ bfd_put_32 (abfd, (bfd_vma) x, addr);
+ }
+ break;
+ case 4:
+ {
+ long long x = bfd_get_64 (abfd, addr);
+ DOIT (x);
+ bfd_put_64 (abfd, (bfd_vma) x, addr);
+ }
+ break;
+
+ default:
+ abort ();
+ }
+ }
+
+ /* Now let bfd_perform_relocation finish everything up. */
+ return bfd_reloc_continue;
+}
+
+#if defined(COFF_WITH_PE)
+/* Return TRUE if this relocation should appear in the output .reloc
+ section. */
+
+static bfd_boolean
+in_reloc_p (bfd *abfd ATTRIBUTE_UNUSED, reloc_howto_type *howto)
+{
+ return ! howto->pc_relative && howto->type != R_AMD64_IMAGEBASE;
+}
+#endif /* COFF_WITH_PE */
+
+#ifndef PCRELOFFSET
+#define PCRELOFFSET TRUE
+#endif
+
+static reloc_howto_type howto_table[] =
+{
+ EMPTY_HOWTO (0),
+ HOWTO (R_AMD64_DIR64, /* type 1*/
+ 0, /* rightshift */
+ 4, /* size (0 = byte, 1 = short, 2 = long, 4 = long long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ coff_amd64_reloc, /* special_function */
+ "R_X86_64_64", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffffffffffffll, /* src_mask */
+ 0xffffffffffffffffll, /* dst_mask */
+ TRUE), /* pcrel_offset */
+ HOWTO (R_AMD64_DIR32, /* type 2 */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ coff_amd64_reloc, /* special_function */
+ "R_X86_64_32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+ /* PE IMAGE_REL_AMD64_ADDR32NB relocation (3). */
+ HOWTO (R_AMD64_IMAGEBASE, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ coff_amd64_reloc, /* special_function */
+ "rva32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+ /* 32-bit longword PC relative relocation (4). */
+ HOWTO (R_AMD64_PCRLONG, /* type 4 */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ coff_amd64_reloc, /* special_function */
+ "R_X86_64_PC32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ PCRELOFFSET), /* pcrel_offset */
+
+ HOWTO (R_AMD64_PCRLONG_1, /* type 5 */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ coff_amd64_reloc, /* special_function */
+ "DISP32+1", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ PCRELOFFSET), /* pcrel_offset */
+ HOWTO (R_AMD64_PCRLONG_2, /* type 6 */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ coff_amd64_reloc, /* special_function */
+ "DISP32+2", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ PCRELOFFSET), /* pcrel_offset */
+ HOWTO (R_AMD64_PCRLONG_3, /* type 7 */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ coff_amd64_reloc, /* special_function */
+ "DISP32+3", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ PCRELOFFSET), /* pcrel_offset */
+ HOWTO (R_AMD64_PCRLONG_4, /* type 8 */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ coff_amd64_reloc, /* special_function */
+ "DISP32+4", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ PCRELOFFSET), /* pcrel_offset */
+ HOWTO (R_AMD64_PCRLONG_5, /* type 9 */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ coff_amd64_reloc, /* special_function */
+ "DISP32+5", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ PCRELOFFSET), /* pcrel_offset */
+ EMPTY_HOWTO (10), /* R_AMD64_SECTION 10 */
+#if defined(COFF_WITH_PE)
+ /* 32-bit longword section relative relocation (11). */
+ HOWTO (R_AMD64_SECREL, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ coff_amd64_reloc, /* special_function */
+ "secrel32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+#else
+ EMPTY_HOWTO (11),
+#endif
+ EMPTY_HOWTO (12),
+ EMPTY_HOWTO (13),
+#ifndef DONT_EXTEND_AMD64
+ HOWTO (R_AMD64_PCRQUAD,
+ 0, /* rightshift */
+ 4, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ coff_amd64_reloc, /* special_function */
+ "R_X86_64_PC64", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffffffffffffll, /* src_mask */
+ 0xffffffffffffffffll, /* dst_mask */
+ PCRELOFFSET), /* pcrel_offset */
+#else
+ EMPTY_HOWTO (14),
+#endif
+ /* Byte relocation (15). */
+ HOWTO (R_RELBYTE, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ coff_amd64_reloc, /* special_function */
+ "R_X86_64_8", /* name */
+ TRUE, /* partial_inplace */
+ 0x000000ff, /* src_mask */
+ 0x000000ff, /* dst_mask */
+ PCRELOFFSET), /* pcrel_offset */
+ /* 16-bit word relocation (16). */
+ HOWTO (R_RELWORD, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ coff_amd64_reloc, /* special_function */
+ "R_X86_64_16", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ PCRELOFFSET), /* pcrel_offset */
+ /* 32-bit longword relocation (17). */
+ HOWTO (R_RELLONG, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ coff_amd64_reloc, /* special_function */
+ "R_X86_64_32S", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ PCRELOFFSET), /* pcrel_offset */
+ /* Byte PC relative relocation (18). */
+ HOWTO (R_PCRBYTE, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ coff_amd64_reloc, /* special_function */
+ "R_X86_64_PC8", /* name */
+ TRUE, /* partial_inplace */
+ 0x000000ff, /* src_mask */
+ 0x000000ff, /* dst_mask */
+ PCRELOFFSET), /* pcrel_offset */
+ /* 16-bit word PC relative relocation (19). */
+ HOWTO (R_PCRWORD, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ coff_amd64_reloc, /* special_function */
+ "R_X86_64_PC16", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ PCRELOFFSET), /* pcrel_offset */
+ /* 32-bit longword PC relative relocation (20). */
+ HOWTO (R_PCRLONG, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ coff_amd64_reloc, /* special_function */
+ "R_X86_64_PC32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ PCRELOFFSET) /* pcrel_offset */
+};
+
+/* Turn a howto into a reloc nunmber */
+
+#define SELECT_RELOC(x,howto) { x.r_type = howto->type; }
+#define I386 1 /* Customize coffcode.h */
+#define AMD64 1
+
+#define RTYPE2HOWTO(cache_ptr, dst) \
+ ((cache_ptr)->howto = \
+ ((dst)->r_type < ARRAY_SIZE (howto_table)) \
+ ? howto_table + (dst)->r_type \
+ : NULL)
+
+/* For 386 COFF a STYP_NOLOAD | STYP_BSS section is part of a shared
+ library. On some other COFF targets STYP_BSS is normally
+ STYP_NOLOAD. */
+#define BSS_NOLOAD_IS_SHARED_LIBRARY
+
+/* Compute the addend of a reloc. If the reloc is to a common symbol,
+ the object file contains the value of the common symbol. By the
+ time this is called, the linker may be using a different symbol
+ from a different object file with a different value. Therefore, we
+ hack wildly to locate the original symbol from this file so that we
+ can make the correct adjustment. This macro sets coffsym to the
+ symbol from the original file, and uses it to set the addend value
+ correctly. If this is not a common symbol, the usual addend
+ calculation is done, except that an additional tweak is needed for
+ PC relative relocs.
+ FIXME: This macro refers to symbols and asect; these are from the
+ calling function, not the macro arguments. */
+
+#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \
+ { \
+ coff_symbol_type *coffsym = NULL; \
+ \
+ if (ptr && bfd_asymbol_bfd (ptr) != abfd) \
+ coffsym = (obj_symbols (abfd) \
+ + (cache_ptr->sym_ptr_ptr - symbols)); \
+ else if (ptr) \
+ coffsym = coff_symbol_from (abfd, ptr); \
+ \
+ if (coffsym != NULL \
+ && coffsym->native->u.syment.n_scnum == 0) \
+ cache_ptr->addend = - coffsym->native->u.syment.n_value; \
+ else if (ptr && bfd_asymbol_bfd (ptr) == abfd \
+ && ptr->section != NULL) \
+ cache_ptr->addend = - (ptr->section->vma + ptr->value); \
+ else \
+ cache_ptr->addend = 0; \
+ if (ptr && howto_table[reloc.r_type].pc_relative) \
+ cache_ptr->addend += asect->vma; \
+ }
+
+/* We use the special COFF backend linker. For normal AMD64 COFF, we
+ can use the generic relocate_section routine. For PE, we need our
+ own routine. */
+
+#if !defined(COFF_WITH_PE)
+
+#define coff_relocate_section _bfd_coff_generic_relocate_section
+
+#else /* COFF_WITH_PE */
+
+/* The PE relocate section routine. The only difference between this
+ and the regular routine is that we don't want to do anything for a
+ relocatable link. */
+
+static bfd_boolean
+coff_pe_amd64_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)
+{
+ if (info->relocatable)
+ return TRUE;
+
+ return _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,input_section, contents,relocs, syms, sections);
+}
+
+#define coff_relocate_section coff_pe_amd64_relocate_section
+
+#endif /* COFF_WITH_PE */
+
+/* Convert an rtype to howto for the COFF backend linker. */
+
+static reloc_howto_type *
+coff_amd64_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *sec,
+ struct internal_reloc *rel,
+ struct coff_link_hash_entry *h,
+ struct internal_syment *sym,
+ bfd_vma *addendp)
+{
+ reloc_howto_type *howto;
+
+ if (rel->r_type > ARRAY_SIZE (howto_table))
+ {
+ bfd_set_error (bfd_error_bad_value);
+ return NULL;
+ }
+ if (rel->r_type >= R_AMD64_PCRLONG_1 && rel->r_type <= R_AMD64_PCRLONG_5)
+ {
+ rel->r_vaddr += (bfd_vma)(rel->r_type-R_AMD64_PCRLONG);
+ rel->r_type = R_AMD64_PCRLONG;
+ }
+ howto = howto_table + rel->r_type;
+
+#if defined(COFF_WITH_PE)
+ /* Cancel out code in _bfd_coff_generic_relocate_section. */
+ *addendp = 0;
+#endif
+
+ if (howto->pc_relative)
+ *addendp += sec->vma;
+
+ if (sym != NULL && sym->n_scnum == 0 && sym->n_value != 0)
+ {
+ /* This is a common symbol. The section contents include the
+ size (sym->n_value) as an addend. The relocate_section
+ function will be adding in the final value of the symbol. We
+ need to subtract out the current size in order to get the
+ correct result. */
+ BFD_ASSERT (h != NULL);
+
+#if !defined(COFF_WITH_PE)
+ /* I think we *do* want to bypass this. If we don't, I have
+ seen some data parameters get the wrong relocation address.
+ If I link two versions with and without this section bypassed
+ and then do a binary comparison, the addresses which are
+ different can be looked up in the map. The case in which
+ this section has been bypassed has addresses which correspond
+ to values I can find in the map. */
+ *addendp -= sym->n_value;
+#endif
+ }
+
+#if !defined(COFF_WITH_PE)
+ /* If the output symbol is common (in which case this must be a
+ relocatable link), we need to add in the final size of the
+ common symbol. */
+ if (h != NULL && h->root.type == bfd_link_hash_common)
+ *addendp += h->root.u.c.size;
+#endif
+
+#if defined(COFF_WITH_PE)
+ if (howto->pc_relative)
+ {
+ *addendp -= 4;
+
+ /* If the symbol is defined, then the generic code is going to
+ add back the symbol value in order to cancel out an
+ adjustment it made to the addend. However, we set the addend
+ to 0 at the start of this function. We need to adjust here,
+ to avoid the adjustment the generic code will make. FIXME:
+ This is getting a bit hackish. */
+ if (sym != NULL && sym->n_scnum != 0)
+ *addendp -= sym->n_value;
+ }
+
+ if (rel->r_type == R_AMD64_IMAGEBASE
+ && (bfd_get_flavour (sec->output_section->owner) == bfd_target_coff_flavour))
+ *addendp -= pe_data (sec->output_section->owner)->pe_opthdr.ImageBase;
+
+ if (rel->r_type == R_AMD64_SECREL)
+ {
+ bfd_vma osect_vma;
+
+ if (h && (h->type == bfd_link_hash_defined || h->type == bfd_link_hash_defweak))
+ osect_vma = h->root.u.def.section->output_section->vma;
+ else
+ {
+ asection *sec;
+ int i;
+
+ /* Sigh, the only way to get the section to offset against
+ is to find it the hard way. */
+ for (sec = abfd->sections, i = 1; i < sym->n_scnum; i++)
+ sec = sec->next;
+
+ osect_vma = sec->output_section->vma;
+ }
+
+ *addendp -= osect_vma;
+ }
+#endif
+
+ return howto;
+}
+
+#define coff_bfd_reloc_type_lookup coff_amd64_reloc_type_lookup
+#define coff_bfd_reloc_name_lookup coff_amd64_reloc_name_lookup
+
+static reloc_howto_type *
+coff_amd64_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, bfd_reloc_code_real_type code)
+{
+ switch (code)
+ {
+ case BFD_RELOC_RVA:
+ return howto_table + R_AMD64_IMAGEBASE;
+ case BFD_RELOC_32:
+ return howto_table + R_AMD64_DIR32;
+ case BFD_RELOC_64:
+ return howto_table + R_AMD64_DIR64;
+ case BFD_RELOC_64_PCREL:
+#ifndef DONT_EXTEND_AMD64
+ return howto_table + R_AMD64_PCRQUAD;
+#else
+ /* Fall through. */
+#endif
+ case BFD_RELOC_32_PCREL:
+ return howto_table + R_AMD64_PCRLONG;
+ case BFD_RELOC_X86_64_32S:
+ return howto_table + R_RELLONG;
+ case BFD_RELOC_16:
+ return howto_table + R_RELWORD;
+ case BFD_RELOC_16_PCREL:
+ return howto_table + R_PCRWORD;
+ case BFD_RELOC_8:
+ return howto_table + R_RELBYTE;
+ case BFD_RELOC_8_PCREL:
+ return howto_table + R_PCRBYTE;
+#if defined(COFF_WITH_PE)
+ case BFD_RELOC_32_SECREL:
+ return howto_table + R_AMD64_SECREL;
+#endif
+ default:
+ BFD_FAIL ();
+ return 0;
+ }
+}
+
+static reloc_howto_type *
+coff_amd64_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0; i < sizeof (howto_table) / sizeof (howto_table[0]); i++)
+ if (howto_table[i].name != NULL
+ && strcasecmp (howto_table[i].name, r_name) == 0)
+ return &howto_table[i];
+
+ return NULL;
+}
+
+#define coff_rtype_to_howto coff_amd64_rtype_to_howto
+
+#ifdef TARGET_UNDERSCORE
+
+/* If amd64 gcc uses underscores for symbol names, then it does not use
+ a leading dot for local labels, so if TARGET_UNDERSCORE is defined
+ we treat all symbols starting with L as local. */
+
+static bfd_boolean
+coff_amd64_is_local_label_name (bfd *abfd, const char *name)
+{
+ if (name[0] == 'L')
+ return TRUE;
+
+ return _bfd_coff_is_local_label_name (abfd, name);
+}
+
+#define coff_bfd_is_local_label_name coff_amd64_is_local_label_name
+
+#endif /* TARGET_UNDERSCORE */
+
+#include "coffcode.h"
+
+#ifdef PE
+#define amd64coff_object_p pe_bfd_object_p
+#else
+#define amd64coff_object_p coff_object_p
+#endif
+
+const bfd_target
+#ifdef TARGET_SYM
+ TARGET_SYM =
+#else
+ x86_64coff_vec =
+#endif
+{
+#ifdef TARGET_NAME
+ TARGET_NAME,
+#else
+ "coff-x86-64", /* Name. */
+#endif
+ bfd_target_coff_flavour,
+ BFD_ENDIAN_LITTLE, /* Data byte order is little. */
+ BFD_ENDIAN_LITTLE, /* Header byte order is little. */
+
+ (HAS_RELOC | EXEC_P | /* Object flags. */
+ HAS_LINENO | HAS_DEBUG |
+ HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
+
+ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* Section flags. */
+#if defined(COFF_WITH_PE)
+ | SEC_LINK_ONCE | SEC_LINK_DUPLICATES | SEC_READONLY
+#endif
+ | SEC_CODE | SEC_DATA),
+
+#ifdef TARGET_UNDERSCORE
+ TARGET_UNDERSCORE, /* Leading underscore. */
+#else
+ 0, /* Leading underscore. */
+#endif
+ '/', /* Ar_pad_char. */
+ 15, /* Ar_max_namelen. */
+
+ bfd_getl64, bfd_getl_signed_64, bfd_putl64,
+ bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+ bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Data. */
+ bfd_getl64, bfd_getl_signed_64, bfd_putl64,
+ bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+ bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Hdrs. */
+
+ /* Note that we allow an object file to be treated as a core file as well. */
+ { _bfd_dummy_target, amd64coff_object_p, /* BFD_check_format. */
+ bfd_generic_archive_p, amd64coff_object_p },
+ { bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format. */
+ bfd_false },
+ { bfd_false, coff_write_object_contents, /* bfd_write_contents. */
+ _bfd_write_archive_contents, bfd_false },
+
+ BFD_JUMP_TABLE_GENERIC (coff),
+ BFD_JUMP_TABLE_COPY (coff),
+ BFD_JUMP_TABLE_CORE (_bfd_nocore),
+ BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
+ BFD_JUMP_TABLE_SYMBOLS (coff),
+ BFD_JUMP_TABLE_RELOCS (coff),
+ BFD_JUMP_TABLE_WRITE (coff),
+ BFD_JUMP_TABLE_LINK (coff),
+ BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
+
+ NULL,
+
+ COFF_SWAP_TABLE
+};
diff --git a/bfd/coff-z80.c b/bfd/coff-z80.c
index 512c2b8677e6..cb5a0e3dd1ae 100644
--- a/bfd/coff-z80.c
+++ b/bfd/coff-z80.c
@@ -1,5 +1,5 @@
/* BFD back-end for Zilog Z80 COFF binaries.
- Copyright 2005 Free Software Foundation, Inc.
+ Copyright 2005, 2007 Free Software Foundation, Inc.
Contributed by Arnold Metselaar <arnold_m@operamail.com>
This file is part of BFD, the Binary File Descriptor library.
@@ -19,8 +19,8 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "bfdlink.h"
#include "coff/z80.h"
@@ -123,6 +123,26 @@ coff_z80_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
}
}
+static reloc_howto_type *
+coff_z80_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ if (strcasecmp (r_imm8.name, r_name) == 0)
+ return &r_imm8;
+ if (strcasecmp (r_imm16.name, r_name) == 0)
+ return &r_imm16;
+ if (strcasecmp (r_imm24.name, r_name) == 0)
+ return &r_imm24;
+ if (strcasecmp (r_imm32.name, r_name) == 0)
+ return &r_imm32;
+ if (strcasecmp (r_jr.name, r_name) == 0)
+ return &r_jr;
+ if (strcasecmp (r_off8.name, r_name) == 0)
+ return &r_off8;
+
+ return NULL;
+}
+
/* Perform any necessary magic to the addend in a reloc entry. */
#define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \
@@ -248,6 +268,7 @@ extra_case (bfd *in_abfd,
#define coff_reloc16_extra_cases extra_case
#define coff_bfd_reloc_type_lookup coff_z80_reloc_type_lookup
+#define coff_bfd_reloc_name_lookup coff_z80_reloc_name_lookup
#include "coffcode.h"
diff --git a/bfd/coff-z8k.c b/bfd/coff-z8k.c
index 8fc2f1692398..fb07db3a6e5a 100644
--- a/bfd/coff-z8k.c
+++ b/bfd/coff-z8k.c
@@ -1,6 +1,6 @@
/* BFD back-end for Zilog Z800n COFF binaries.
Copyright 1992, 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005 Free Software Foundation, Inc.
+ 2004, 2005, 2007 Free Software Foundation, Inc.
Contributed by Cygnus Support.
Written by Steve Chamberlain, <sac@cygnus.com>.
@@ -20,8 +20,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "bfdlink.h"
#include "coff/z8k.h"
@@ -135,6 +135,30 @@ coff_z8k_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
}
}
+static reloc_howto_type *
+coff_z8k_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ if (strcasecmp (r_imm8.name, r_name) == 0)
+ return &r_imm8;
+ if (strcasecmp (r_da.name, r_name) == 0)
+ return &r_da;
+ if (strcasecmp (r_imm32.name, r_name) == 0)
+ return &r_imm32;
+ if (strcasecmp (r_jr.name, r_name) == 0)
+ return &r_jr;
+ if (strcasecmp (r_rel16.name, r_name) == 0)
+ return &r_rel16;
+ if (strcasecmp (r_disp7.name, r_name) == 0)
+ return &r_disp7;
+ if (strcasecmp (r_callr.name, r_name) == 0)
+ return &r_callr;
+ if (strcasecmp (r_imm4l.name, r_name) == 0)
+ return &r_imm4l;
+
+ return NULL;
+}
+
/* Perform any necessary magic to the addend in a reloc entry. */
#define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \
@@ -345,6 +369,7 @@ extra_case (bfd *in_abfd,
#define coff_reloc16_extra_cases extra_case
#define coff_bfd_reloc_type_lookup coff_z8k_reloc_type_lookup
+#define coff_bfd_reloc_name_lookup coff_z8k_reloc_name_lookup
#include "coffcode.h"
diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c
index e0aa87ef6775..5e0804f00fc7 100644
--- a/bfd/coff64-rs6000.c
+++ b/bfd/coff64-rs6000.c
@@ -1,5 +1,5 @@
/* BFD back-end for IBM RS/6000 "XCOFF64" files.
- Copyright 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written Clinton Popetz.
Contributed by Cygnus Support.
@@ -20,8 +20,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "coff/internal.h"
@@ -127,7 +127,7 @@ extern bfd_boolean _bfd_xcoff_write_armap
extern bfd_boolean _bfd_xcoff_write_archive_contents
PARAMS ((bfd *));
extern int _bfd_xcoff_sizeof_headers
- PARAMS ((bfd *, bfd_boolean));
+ PARAMS ((bfd *, struct bfd_link_info *));
extern void _bfd_xcoff_swap_sym_in
PARAMS ((bfd *, PTR, PTR));
extern unsigned int _bfd_xcoff_swap_sym_out
@@ -161,7 +161,7 @@ static const bfd_target *xcoff64_archive_p
static bfd *xcoff64_openr_next_archived_file
PARAMS ((bfd *, bfd *));
static int xcoff64_sizeof_headers
- PARAMS ((bfd *, bfd_boolean));
+ PARAMS ((bfd *, struct bfd_link_info *));
static asection *xcoff64_create_csect_from_smclas
PARAMS ((bfd *, union internal_auxent *, const char *));
static bfd_boolean xcoff64_is_lineno_count_overflow
@@ -237,6 +237,7 @@ bfd_boolean (*xcoff64_calculate_relocation[XCOFF_MAX_CALCULATE_RELOCATION])
#define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data
#define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name
#define coff_bfd_reloc_type_lookup xcoff64_reloc_type_lookup
+#define coff_bfd_reloc_name_lookup xcoff64_reloc_name_lookup
#ifdef AIX_CORE
extern const bfd_target * rs6000coff_core_p
PARAMS ((bfd *abfd));
@@ -1843,6 +1844,22 @@ xcoff64_reloc_type_lookup (abfd, code)
}
}
+static reloc_howto_type *
+xcoff64_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (xcoff64_howto_table) / sizeof (xcoff64_howto_table[0]);
+ i++)
+ if (xcoff64_howto_table[i].name != NULL
+ && strcasecmp (xcoff64_howto_table[i].name, r_name) == 0)
+ return &xcoff64_howto_table[i];
+
+ return NULL;
+}
+
/* Read in the armap of an XCOFF archive. */
static bfd_boolean
@@ -2056,9 +2073,8 @@ xcoff64_openr_next_archived_file (archive, last_file)
always uses an a.out header. */
static int
-xcoff64_sizeof_headers (abfd, reloc)
- bfd *abfd;
- bfd_boolean reloc ATTRIBUTE_UNUSED;
+xcoff64_sizeof_headers (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
int size;
@@ -2726,6 +2742,7 @@ const bfd_target rs6000coff64_vec =
coff_get_reloc_upper_bound,
coff_canonicalize_reloc,
xcoff64_reloc_type_lookup,
+ xcoff64_reloc_name_lookup,
/* Write */
coff_set_arch_mach,
@@ -2977,6 +2994,7 @@ const bfd_target aix5coff64_vec =
coff_get_reloc_upper_bound,
coff_canonicalize_reloc,
xcoff64_reloc_type_lookup,
+ xcoff64_reloc_name_lookup,
/* Write */
coff_set_arch_mach,
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 256732c314d4..a2aac5f63b4c 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -1,6 +1,6 @@
/* Support for the generic parts of most COFF variants, for BFD.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -427,7 +427,7 @@ sec_to_styp_flags (const char *sec_name, flagword sec_flags)
styp_flags = STYP_LIT;
#endif /* _LIT */
}
- else if (!strncmp (sec_name, DOT_DEBUG, sizeof (DOT_DEBUG) - 1))
+ else if (CONST_STRNEQ (sec_name, DOT_DEBUG))
{
/* Handle the XCOFF debug section and DWARF2 debug sections. */
if (!sec_name[6])
@@ -435,12 +435,12 @@ sec_to_styp_flags (const char *sec_name, flagword sec_flags)
else
styp_flags = STYP_DEBUG_INFO;
}
- else if (!strncmp (sec_name, ".stab", 5))
+ else if (CONST_STRNEQ (sec_name, ".stab"))
{
styp_flags = STYP_DEBUG_INFO;
}
#ifdef COFF_LONG_SECTION_NAMES
- else if (!strncmp (sec_name, GNU_LINKONCE_WI, sizeof (GNU_LINKONCE_WI) - 1))
+ else if (CONST_STRNEQ (sec_name, GNU_LINKONCE_WI))
{
styp_flags = STYP_DEBUG_INFO;
}
@@ -529,8 +529,8 @@ sec_to_styp_flags (const char *sec_name, flagword sec_flags)
but there are more IMAGE_SCN_* flags. */
/* FIXME: There is no gas syntax to specify the debug section flag. */
- if (strncmp (sec_name, DOT_DEBUG, sizeof (DOT_DEBUG) - 1) == 0
- || strncmp (sec_name, GNU_LINKONCE_WI, sizeof (GNU_LINKONCE_WI) - 1) == 0)
+ if (CONST_STRNEQ (sec_name, DOT_DEBUG)
+ || CONST_STRNEQ (sec_name, GNU_LINKONCE_WI))
sec_flags = SEC_DEBUGGING;
/* skip LOAD */
@@ -674,14 +674,14 @@ styp_to_sec_flags (bfd *abfd ATTRIBUTE_UNUSED,
#endif
sec_flags |= SEC_ALLOC;
}
- else if (strncmp (name, DOT_DEBUG, sizeof (DOT_DEBUG) - 1) == 0
+ else if (CONST_STRNEQ (name, DOT_DEBUG)
#ifdef _COMMENT
|| strcmp (name, _COMMENT) == 0
#endif
#ifdef COFF_LONG_SECTION_NAMES
- || strncmp (name, GNU_LINKONCE_WI, sizeof (GNU_LINKONCE_WI) - 1) == 0
+ || CONST_STRNEQ (name, GNU_LINKONCE_WI)
#endif
- || strncmp (name, ".stab", 5) == 0)
+ || CONST_STRNEQ (name, ".stab"))
{
#ifdef COFF_PAGE_SIZE
sec_flags |= SEC_DEBUGGING;
@@ -715,7 +715,7 @@ styp_to_sec_flags (bfd *abfd ATTRIBUTE_UNUSED,
The symbols will be defined as weak, so that multiple definitions
are permitted. The GNU linker extension is to actually discard
all but one of the sections. */
- if (strncmp (name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) == 0)
+ if (CONST_STRNEQ (name, ".gnu.linkonce"))
sec_flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
#endif
@@ -1071,7 +1071,7 @@ styp_to_sec_flags (bfd *abfd,
/* The MS PE spec sets the DISCARDABLE flag on .reloc sections
but we do not want them to be labelled as debug section, since
then strip would remove them. */
- if (strncmp (name, ".reloc", sizeof ".reloc" - 1) != 0)
+ if (! CONST_STRNEQ (name, ".reloc"))
sec_flags |= SEC_DEBUGGING;
break;
case IMAGE_SCN_MEM_SHARED:
@@ -1126,7 +1126,7 @@ styp_to_sec_flags (bfd *abfd,
The symbols will be defined as weak, so that multiple definitions
are permitted. The GNU linker extension is to actually discard
all but one of the sections. */
- if (strncmp (name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) == 0)
+ if (CONST_STRNEQ (name, ".gnu.linkonce"))
sec_flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
#endif
@@ -1546,6 +1546,9 @@ static const unsigned int coff_section_alignment_table_size =
static bfd_boolean
coff_new_section_hook (bfd * abfd, asection * section)
{
+ combined_entry_type *native;
+ bfd_size_type amt;
+
section->alignment_power = COFF_DEFAULT_SECTION_ALIGNMENT_POWER;
#ifdef RS6000COFF_C
@@ -1557,34 +1560,31 @@ coff_new_section_hook (bfd * abfd, asection * section)
section->alignment_power = bfd_xcoff_data_align_power (abfd);
#endif
- /* PR binutils/2724: Only real sections have a symbol that
- has the coff_symbol_type structure allocated for it. */
- if (! bfd_is_const_section (section))
- {
- combined_entry_type *native;
- bfd_size_type amt;
+ /* Set up the section symbol. */
+ if (!_bfd_generic_new_section_hook (abfd, section))
+ return FALSE;
- /* Allocate aux records for section symbols, to store size and
- related info.
+ /* Allocate aux records for section symbols, to store size and
+ related info.
- @@ The 10 is a guess at a plausible maximum number of aux entries
- (but shouldn't be a constant). */
- amt = sizeof (combined_entry_type) * 10;
- native = bfd_zalloc (abfd, amt);
- if (native == NULL)
- return FALSE;
+ @@ The 10 is a guess at a plausible maximum number of aux entries
+ (but shouldn't be a constant). */
+ amt = sizeof (combined_entry_type) * 10;
+ native = bfd_zalloc (abfd, amt);
+ if (native == NULL)
+ return FALSE;
- /* We don't need to set up n_name, n_value, or n_scnum in the native
- symbol information, since they'll be overridden by the BFD symbol
- anyhow. However, we do need to set the type and storage class,
- in case this symbol winds up getting written out. The value 0
- for n_numaux is already correct. */
- native->u.syment.n_type = T_NULL;
- native->u.syment.n_sclass = C_STAT;
+ /* We don't need to set up n_name, n_value, or n_scnum in the native
+ symbol information, since they'll be overridden by the BFD symbol
+ anyhow. However, we do need to set the type and storage class,
+ in case this symbol winds up getting written out. The value 0
+ for n_numaux is already correct. */
+
+ native->u.syment.n_type = T_NULL;
+ native->u.syment.n_sclass = C_STAT;
+
+ coffsymbol (section->symbol)->native = native;
- coffsymbol (section->symbol)->native = native;
- }
-
coff_set_custom_section_alignment (abfd, section,
coff_section_alignment_table,
coff_section_alignment_table_size);
@@ -1882,9 +1882,15 @@ coff_set_arch_mach_hook (bfd *abfd, void * filehdr)
#ifdef I386MAGIC
case I386MAGIC:
case I386PTXMAGIC:
- case I386AIXMAGIC: /* Danbury PS/2 AIX C Compiler */
- case LYNXCOFFMAGIC: /* shadows the m68k Lynx number below, sigh */
+ case I386AIXMAGIC: /* Danbury PS/2 AIX C Compiler. */
+ case LYNXCOFFMAGIC: /* Shadows the m68k Lynx number below, sigh. */
+ arch = bfd_arch_i386;
+ break;
+#endif
+#ifdef AMD64MAGIC
+ case AMD64MAGIC:
arch = bfd_arch_i386;
+ machine = bfd_mach_x86_64;
break;
#endif
#ifdef IA64MAGIC
@@ -2532,11 +2538,15 @@ coff_write_relocs (bfd * abfd, int first_undef)
else
{
n.r_symndx = get_index ((*(q->sym_ptr_ptr)));
- /* Take notice if the symbol reloc points to a symbol
- we don't have in our symbol table. What should we
- do for this?? */
+ /* Check to see if the symbol reloc points to a symbol
+ we don't have in our symbol table. */
if (n.r_symndx > obj_conv_table_size (abfd))
- abort ();
+ {
+ bfd_set_error (bfd_error_bad_value);
+ _bfd_error_handler (_("%B: reloc against a non-existant symbol index: %ld"),
+ abfd, n.r_symndx);
+ return FALSE;
+ }
}
}
@@ -2717,13 +2727,18 @@ coff_set_flags (bfd * abfd,
return TRUE;
#endif
-#ifdef I386MAGIC
+#if defined(I386MAGIC) || defined(AMD64MAGIC)
case bfd_arch_i386:
+#if defined(I386MAGIC)
*magicp = I386MAGIC;
-#ifdef LYNXOS
+#endif
+#if defined LYNXOS
/* Just overwrite the usual value if we're doing Lynx. */
*magicp = LYNXCOFFMAGIC;
#endif
+#if defined AMD64MAGIC
+ *magicp = AMD64MAGIC;
+#endif
return TRUE;
#endif
@@ -3755,6 +3770,7 @@ coff_write_object_contents (bfd * abfd)
internal_f.f_flags |= IMAGE_FILE_LARGE_ADDRESS_AWARE;
#endif
+#ifndef COFF_WITH_pex64
#ifdef COFF_WITH_PE
internal_f.f_flags |= IMAGE_FILE_32BIT_MACHINE;
#else
@@ -3763,6 +3779,7 @@ coff_write_object_contents (bfd * abfd)
else
internal_f.f_flags |= F_AR32W;
#endif
+#endif
#ifdef TI_TARGET_ID
/* Target id is used in TI COFF v1 and later; COFF0 won't use this field,
@@ -3856,16 +3873,18 @@ coff_write_object_contents (bfd * abfd)
#if defined(I386)
#define __A_MAGIC_SET__
-#if defined(LYNXOS)
+#if defined LYNXOS
internal_a.magic = LYNXCOFFMAGIC;
-#else /* LYNXOS */
+#elif defined AMD64
+ internal_a.magic = IMAGE_NT_OPTIONAL_HDR64_MAGIC;
+#else
internal_a.magic = ZMAGIC;
-#endif /* LYNXOS */
+#endif
#endif /* I386 */
#if defined(IA64)
#define __A_MAGIC_SET__
- internal_a.magic = ZMAGIC;
+ internal_a.magic = PE32PMAGIC;
#endif /* IA64 */
#if defined(SPARC)
@@ -4851,6 +4870,7 @@ coff_slurp_reloc_table (bfd * abfd, sec_ptr asect, asymbol ** symbols)
cache_ptr = reloc_cache + idx;
src = native_relocs + idx;
+ dst.r_offset = 0;
coff_swap_reloc_in (abfd, src, &dst);
#ifdef RELOC_PROCESSING
@@ -4931,6 +4951,7 @@ coff_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
{
arelent genrel;
+ genrel.howto = NULL;
RTYPE2HOWTO (&genrel, rel);
return genrel.howto;
}
@@ -5314,6 +5335,9 @@ static const bfd_coff_backend_data ticoff1_swap_table =
#ifndef coff_bfd_reloc_type_lookup
#define coff_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
#endif
+#ifndef coff_bfd_reloc_name_lookup
+#define coff_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup
+#endif
#ifndef coff_bfd_get_relocated_section_contents
#define coff_bfd_get_relocated_section_contents \
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index c541e6a590eb..8884a7f14db5 100644
--- a/bfd/coffgen.c
+++ b/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, 2003, 2004, 2005
+ 2000, 2001, 2002, 2003, 2004, 2005, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -37,8 +37,8 @@
Those functions may not use any COFF specific information, such as
coff_data (abfd). */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "coff/internal.h"
#include "libcoff.h"
@@ -1901,7 +1901,16 @@ coff_print_symbol (bfd *abfd,
combined->u.syment.n_type,
combined->u.syment.n_sclass,
combined->u.syment.n_numaux);
- fprintf_vma (file, val);
+#ifdef BFD64
+ /* fprintf_vma() on a 64-bit enabled host will always print a 64-bit
+ value, but really we want to display the address in the target's
+ address size. Since we do not have a field in the bfd structure
+ to tell us this, we take a guess, based on the target's name. */
+ if (strstr (bfd_get_target (abfd), "64") == NULL)
+ fprintf (file, "%08lx", (unsigned long) (val & 0xffffffff));
+ else
+#endif
+ fprintf_vma (file, val);
fprintf (file, " %s", symbol->name);
for (aux = 0; aux < combined->u.syment.n_numaux; aux++)
@@ -2238,11 +2247,11 @@ coff_find_inliner_info (bfd *abfd,
}
int
-coff_sizeof_headers (bfd *abfd, bfd_boolean reloc)
+coff_sizeof_headers (bfd *abfd, struct bfd_link_info *info)
{
size_t size;
- if (! reloc)
+ if (!info->relocatable)
size = bfd_coff_filhsz (abfd) + bfd_coff_aoutsz (abfd);
else
size = bfd_coff_filhsz (abfd);
diff --git a/bfd/cofflink.c b/bfd/cofflink.c
index a1f6684bb61c..1ed7107fc1dd 100644
--- a/bfd/cofflink.c
+++ b/bfd/cofflink.c
@@ -1,6 +1,6 @@
/* COFF specific linker code.
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005, 2006 Free Software Foundation, Inc.
+ 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -21,8 +21,8 @@
/* This file contains the COFF backend linker code. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "coff/internal.h"
@@ -232,7 +232,7 @@ coff_link_check_ar_symbols (bfd *abfd,
/* Auto import. */
if (!h
&& info->pei386_auto_import
- && !strncmp (name,"__imp_", 6))
+ && CONST_STRNEQ (name, "__imp_"))
h = bfd_link_hash_lookup (info->hash, name + 6, FALSE, FALSE, TRUE);
/* We are only interested in symbols that are currently
@@ -439,7 +439,7 @@ coff_link_add_symbols (bfd *abfd,
|| classification == COFF_SYMBOL_PE_SECTION)
&& coff_section_data (abfd, section) != NULL
&& coff_section_data (abfd, section)->comdat != NULL
- && strncmp (name, "??_", 3) == 0
+ && CONST_STRNEQ (name, "??_")
&& strcmp (name, coff_section_data (abfd, section)->comdat->name) == 0)
{
if (*sym_hash == NULL)
@@ -583,7 +583,7 @@ coff_link_add_symbols (bfd *abfd,
asection *stab;
for (stab = abfd->sections; stab; stab = stab->next)
- if (strncmp (".stab", stab->name, 5) == 0
+ if (CONST_STRNEQ (stab->name, ".stab")
&& (!stab->name[5]
|| (stab->name[5] == '.' && ISDIGIT (stab->name[6]))))
{
@@ -1232,16 +1232,14 @@ process_embedded_commands (bfd *output_bfd,
s++;
continue;
}
- if (strncmp (s, "-attr", 5) == 0)
+ if (CONST_STRNEQ (s, "-attr"))
{
char *name;
char *attribs;
asection *asec;
int loop = 1;
int had_write = 0;
- int had_read = 0;
int had_exec= 0;
- int had_shared= 0;
s += 5;
s = get_name (s, &name);
@@ -1255,10 +1253,8 @@ process_embedded_commands (bfd *output_bfd,
had_write = 1;
break;
case 'R':
- had_read = 1;
break;
case 'S':
- had_shared = 1;
break;
case 'X':
had_exec = 1;
@@ -1276,11 +1272,11 @@ process_embedded_commands (bfd *output_bfd,
asec->flags |= SEC_READONLY;
}
}
- else if (strncmp (s,"-heap", 5) == 0)
- s = dores_com (s+5, output_bfd, 1);
+ else if (CONST_STRNEQ (s, "-heap"))
+ s = dores_com (s + 5, output_bfd, 1);
- else if (strncmp (s,"-stack", 6) == 0)
- s = dores_com (s+6, output_bfd, 0);
+ else if (CONST_STRNEQ (s, "-stack"))
+ s = dores_com (s + 6, output_bfd, 0);
else
s++;
@@ -1925,6 +1921,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *finfo, bfd *input_bfd)
generate two symbols with the same name, but only one
will have aux entries. */
BFD_ASSERT (isymp->n_numaux == 0
+ || h->numaux == 0
|| h->numaux == isymp->n_numaux);
}
@@ -1940,7 +1937,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *finfo, bfd *input_bfd)
union internal_auxent aux;
union internal_auxent *auxp;
- if (h != NULL)
+ if (h != NULL && h->aux != NULL && (h->numaux > i))
auxp = h->aux + i;
else
{
diff --git a/bfd/config.bfd b/bfd/config.bfd
index 4fd72c1c1527..10b0b9481570 100755
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -31,12 +31,7 @@ targ_underscore=no
# Catch obsolete configurations.
case $targ in
- m68*-apple-aux* | \
- m68*-apollo-* | \
- m68*-bull-sysv* | \
- m68*-*-rtemscoff* | \
- i960-*-rtems* | \
- or32-*-rtems* | \
+ maxq-*-coff | \
null)
if test "x$enable_obsolete" != xyes; then
echo "*** Configuration $targ is obsolete." >&2
@@ -48,6 +43,12 @@ case $targ in
esac
case $targ in
+ m68*-apple-aux* | \
+ m68*-apollo-* | \
+ m68*-bull-sysv* | \
+ m68*-*-rtemscoff* | \
+ i960-*-rtems* | \
+ or32-*-rtems* | \
m68*-*-lynxos* | \
sparc-*-lynxos* | \
vax-*-vms* | \
@@ -75,9 +76,11 @@ bfin*) targ_archs=bfd_bfin_arch ;;
c30*) targ_archs=bfd_tic30_arch ;;
c4x*) targ_archs=bfd_tic4x_arch ;;
c54x*) targ_archs=bfd_tic54x_arch ;;
+cr16*) targ_archs=bfd_cr16_arch ;;
crisv32) targ_archs=bfd_cris_arch ;;
crx*) targ_archs=bfd_crx_arch ;;
dlx*) targ_archs=bfd_dlx_arch ;;
+fido*) targ_archs=bfd_m68k_arch ;;
hppa*) targ_archs=bfd_hppa_arch ;;
i[3-7]86) targ_archs=bfd_i386_arch ;;
i370) targ_archs=bfd_i370_arch ;;
@@ -95,10 +98,11 @@ rs6000) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
s390*) targ_archs=bfd_s390_arch ;;
sh*) targ_archs=bfd_sh_arch ;;
sparc*) targ_archs=bfd_sparc_arch ;;
+spu*) targ_archs=bfd_spu_arch ;;
strongarm*) targ_archs=bfd_arm_arch ;;
thumb*) targ_archs=bfd_arm_arch ;;
v850*) targ_archs=bfd_v850_arch ;;
-x86_64) targ_archs=bfd_i386_arch ;;
+x86_64*) targ_archs=bfd_i386_arch ;;
xscale*) targ_archs=bfd_arm_arch ;;
xtensa*) targ_archs=bfd_xtensa_arch ;;
z80|r800) targ_archs=bfd_z80_arch ;;
@@ -137,6 +141,7 @@ case "${targ}" in
alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
targ_defvec=bfd_elf64_alpha_freebsd_vec
targ_selvecs=ecoffalpha_little_vec
+ want64=true
# FreeBSD <= 4.0 supports only the old nonstandard way of ABI labelling.
case "${targ}" in
alpha*-*-freebsd3* | alpha*-*-freebsd4 | alpha*-*-freebsd4.0*)
@@ -146,36 +151,49 @@ case "${targ}" in
alpha*-*-netbsd* | alpha*-*-openbsd*)
targ_defvec=bfd_elf64_alpha_vec
targ_selvecs=ecoffalpha_little_vec
+ want64=true
;;
alpha*-*-netware*)
targ_defvec=ecoffalpha_little_vec
targ_selvecs=nlm32_alpha_vec
+ want64=true
;;
alpha*-*-linuxecoff*)
targ_defvec=ecoffalpha_little_vec
targ_selvecs=bfd_elf64_alpha_vec
+ want64=true
;;
alpha*-*-linux-* | alpha*-*-elf*)
targ_defvec=bfd_elf64_alpha_vec
targ_selvecs=ecoffalpha_little_vec
+ want64=true
;;
alpha*-*-*vms*)
targ_defvec=vms_alpha_vec
+ want64=true
;;
alpha*-*-*)
targ_defvec=ecoffalpha_little_vec
+ want64=true
;;
ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu)
targ_defvec=bfd_elf64_ia64_little_vec
targ_selvecs="bfd_elf64_ia64_big_vec bfd_efi_app_ia64_vec"
+ want64=true
;;
ia64*-*-hpux*)
targ_defvec=bfd_elf32_ia64_hpux_big_vec
targ_selvecs="bfd_elf64_ia64_hpux_big_vec"
+ want64=true
;;
- sparc64-*-freebsd* | sparc64-*-netbsd* | sparc64-*-openbsd* | sparc64-*-kfreebsd*-gnu)
+ sparc64-*-freebsd* | sparc64-*-kfreebsd*-gnu)
+ targ_defvec=bfd_elf64_sparc_freebsd_vec
+ targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec"
+ ;;
+ sparc64-*-netbsd* | sparc64-*-openbsd*)
targ_defvec=bfd_elf64_sparc_vec
targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec"
+ want64=true
;;
#endif /* BFD64 */
@@ -215,8 +233,8 @@ case "${targ}" in
targ_cflags=-DARM_COFF_BUGFIX
;;
arm-wince-pe | arm-*-wince)
- targ_defvec=armpe_little_vec
- targ_selvecs="armpe_little_vec armpe_big_vec armpei_little_vec armpei_big_vec"
+ targ_defvec=arm_wince_pe_little_vec
+ targ_selvecs="arm_wince_pe_little_vec arm_wince_pe_big_vec arm_wince_pei_little_vec arm_wince_pei_big_vec"
targ_underscore=no
targ_cflags="-DARM_WINCE -DARM_COFF_BUGFIX"
;;
@@ -336,6 +354,11 @@ case "${targ}" in
targ_underscore=yes
;;
+ cr16-*-elf*)
+ targ_defvec=bfd_elf32_cr16_vec
+ targ_underscore=yes
+ ;;
+
cr16c-*-elf*)
targ_defvec=bfd_elf32_cr16c_vec
targ_underscore=yes
@@ -365,6 +388,11 @@ case "${targ}" in
targ_defvec=bfd_elf32_d30v_vec
;;
+ fido-*-elf* )
+ targ_defvec=bfd_elf32_m68k_vec
+ targ_selvecs="m68kcoff_vec ieee_vec"
+ ;;
+
fr30-*-elf)
targ_defvec=bfd_elf32_fr30_vec
;;
@@ -403,11 +431,13 @@ case "${targ}" in
hppa*64*-*-linux-*)
targ_defvec=bfd_elf64_hppa_linux_vec
targ_selvecs=bfd_elf64_hppa_vec
+ want64=true
;;
hppa*64*-*-hpux11*)
targ_defvec=bfd_elf64_hppa_vec
targ_selvecs=bfd_elf64_hppa_linux_vec
targ_cflags=-DHPUX_LARGE_AR_IDS
+ want64=true
;;
#endif
@@ -549,18 +579,28 @@ case "${targ}" in
x86_64-*-elf*)
targ_defvec=bfd_elf64_x86_64_vec
targ_selvecs="bfd_elf32_i386_vec i386coff_vec"
+ want64=true
;;
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"
+ targ_defvec=bfd_elf64_x86_64_freebsd_vec
+ targ_selvecs="bfd_elf32_i386_freebsd_vec i386coff_vec bfd_efi_app_ia32_vec bfd_efi_app_x86_64_vec bfd_elf32_i386_vec bfd_elf64_x86_64_vec"
+ want64=true
;;
x86_64-*-netbsd* | x86_64-*-openbsd*)
targ_defvec=bfd_elf64_x86_64_vec
- targ_selvecs="bfd_elf32_i386_vec i386netbsd_vec i386coff_vec bfd_efi_app_ia32_vec"
+ targ_selvecs="bfd_elf32_i386_vec i386netbsd_vec i386coff_vec bfd_efi_app_ia32_vec bfd_efi_app_x86_64_vec"
+ want64=true
;;
x86_64-*-linux-*)
targ_defvec=bfd_elf64_x86_64_vec
- targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec"
+ targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec bfd_efi_app_x86_64_vec"
+ want64=true
+ ;;
+ x86_64-*-mingw*)
+ targ_defvec=x86_64pe_vec
+ targ_selvecs="x86_64pe_vec x86_64pei_vec x86_64coff_vec bfd_elf64_x86_64_vec"
+ want64=true
+ targ_underscore=yes
;;
#endif
i[3-7]86-*-lynxos*)
@@ -640,7 +680,7 @@ case "${targ}" in
targ_selvecs="b_out_vec_big_host icoff_little_vec icoff_big_vec ieee_vec"
targ_underscore=yes
;;
- i960-*-vxworks5.* | i960-*-coff* | i960-*-sysv* | i960-*-rtems*)
+ i960-*-vxworks5.* | i960-*-coff* | i960-*-sysv*)
targ_defvec=icoff_little_vec
targ_selvecs="icoff_big_vec b_out_vec_little_host b_out_vec_big_host ieee_vec"
targ_underscore=yes
@@ -671,17 +711,14 @@ case "${targ}" in
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
;;
@@ -695,13 +732,6 @@ case "${targ}" in
targ_selvecs="bfd_elf32_m68hc11_vec bfd_elf32_m68hc12_vec"
;;
- m68*-apollo-*)
- targ_defvec=apollocoff_vec
- ;;
- m68*-bull-sysv*)
- targ_defvec=m68kcoffun_vec
- targ_underscore=yes
- ;;
m68*-motorola-sysv*)
targ_defvec=m68ksysvcoff_vec
;;
@@ -717,10 +747,6 @@ case "${targ}" in
targ_selvecs="cisco_core_big_vec ieee_vec"
targ_underscore=yes
;;
- m68*-*-rtemscoff*)
- targ_defvec=m68kcoff_vec
- targ_selvecs="m68kcoff_vec versados_vec ieee_vec aout0_big_vec"
- ;;
m68*-*-elf* | m68*-*-sysv4* | m68*-*-uclinux*)
targ_defvec=bfd_elf32_m68k_vec
targ_selvecs="m68kcoff_vec ieee_vec"
@@ -784,9 +810,6 @@ case "${targ}" in
targ_defvec=bfd_elf32_m68k_vec
targ_selvecs=m68kcoff_vec
;;
- m68*-apple-aux*)
- targ_defvec=m68kaux_coff_vec
- ;;
m68*-*-psos*)
targ_defvec=bfd_elf32_m68k_vec
targ_selvecs=ieee_vec
@@ -823,6 +846,11 @@ case "${targ}" in
targ_selvecs="mcore_pe_big_vec mcore_pe_little_vec mcore_pei_big_vec mcore_pei_little_vec"
;;
+ mep-*-elf)
+ targ_defvec=bfd_elf32_mep_vec
+ targ_selvecs=bfd_elf32_mep_little_vec
+ ;;
+
mips*-big-*)
targ_defvec=ecoff_big_vec
targ_selvecs=ecoff_little_vec
@@ -847,6 +875,7 @@ case "${targ}" in
mips*-*-irix6*)
targ_defvec=bfd_elf32_nbigmips_vec
targ_selvecs="bfd_elf32_nlittlemips_vec bfd_elf32_bigmips_vec bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
+ want64=true
;;
#endif
mips*-*-irix5*)
@@ -873,12 +902,24 @@ case "${targ}" in
mips*el-*-vxworks*)
targ_defvec=bfd_elf32_littlemips_vxworks_vec
targ_selvecs="bfd_elf32_littlemips_vec bfd_elf32_bigmips_vxworks_vec bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
+ want64=true
;;
mips*-*-vxworks*)
targ_defvec=bfd_elf32_bigmips_vxworks_vec
targ_selvecs="bfd_elf32_bigmips_vec bfd_elf32_littlemips_vxworks_vec bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
+ want64=true
;;
#endif
+ mips*el-sde-elf*)
+ targ_defvec=bfd_elf32_tradlittlemips_vec
+ targ_selvecs="bfd_elf32_tradbigmips_vec bfd_elf32_ntradbigmips_vec bfd_elf32_ntradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec"
+ want64=true
+ ;;
+ mips*-sde-elf*)
+ targ_defvec=bfd_elf32_tradbigmips_vec
+ targ_selvecs="bfd_elf32_tradlittlemips_vec bfd_elf32_ntradbigmips_vec bfd_elf32_ntradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec"
+ want64=true
+ ;;
mips*el-*-elf* | mips*el-*-vxworks* | mips*-*-chorus*)
targ_defvec=bfd_elf32_littlemips_vec
targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
@@ -895,6 +936,7 @@ case "${targ}" in
mips64*-*-openbsd*)
targ_defvec=bfd_elf64_tradbigmips_vec
targ_selvecs="bfd_elf32_ntradlittlemips_vec bfd_elf32_ntradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf32_tradbigmips_vec bfd_elf64_tradlittlemips_vec"
+ want64=true
;;
#endif
mips*el-*-openbsd*)
@@ -909,10 +951,12 @@ case "${targ}" in
mips64*el-*-linux*)
targ_defvec=bfd_elf32_ntradlittlemips_vec
targ_selvecs="bfd_elf32_ntradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf32_tradbigmips_vec bfd_elf64_tradlittlemips_vec bfd_elf64_tradbigmips_vec"
+ want64=true
;;
mips64*-*-linux*)
targ_defvec=bfd_elf32_ntradbigmips_vec
targ_selvecs="bfd_elf32_ntradlittlemips_vec bfd_elf32_tradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec"
+ want64=true
;;
#endif
mips*el-*-linux*)
@@ -929,6 +973,7 @@ case "${targ}" in
mmix-*-*)
targ_defvec=bfd_elf64_mmix_vec
targ_selvecs=bfd_mmo_vec
+ want64=true
;;
#endif
mn10200-*-*)
@@ -961,7 +1006,7 @@ case "${targ}" in
targ_defvec=bfd_elf32_openrisc_vec
;;
- or32-*-coff | or32-*-rtems* )
+ or32-*-coff)
targ_defvec=or32coff_big_vec
targ_underscore=yes
;;
@@ -1026,15 +1071,18 @@ case "${targ}" in
powerpc64-*-aix*)
targ_defvec=rs6000coff64_vec
targ_selvecs=rs6000coff_vec
+ want64=true
;;
powerpc64-*-elf* | powerpc-*-elf64* | powerpc64-*-linux* | \
powerpc64-*-*bsd*)
targ_defvec=bfd_elf64_powerpc_vec
targ_selvecs="bfd_elf64_powerpcle_vec bfd_elf32_powerpc_vec bfd_elf32_powerpcle_vec rs6000coff_vec rs6000coff64_vec"
+ want64=true
;;
powerpc64le-*-elf* | powerpcle-*-elf64*)
targ_defvec=bfd_elf64_powerpcle_vec
targ_selvecs="bfd_elf64_powerpc_vec bfd_elf32_powerpcle_vec bfd_elf32_powerpc_vec rs6000coff_vec rs6000coff64_vec"
+ want64=true
;;
#endif
powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \
@@ -1099,40 +1147,49 @@ case "${targ}" in
s390x-*-linux*)
targ_defvec=bfd_elf64_s390_vec
targ_selvecs=bfd_elf32_s390_vec
+ want64=true
;;
s390x-*-tpf*)
targ_defvec=bfd_elf64_s390_vec
+ want64=true
;;
#endif
+ score*-*-elf*)
+ targ_defvec=bfd_elf32_bigscore_vec
+ targ_selvecs=bfd_elf32_littlescore_vec
+ ;;
+
#ifdef BFD64
sh64l*-*-elf*)
targ_defvec=bfd_elf32_sh64l_vec
targ_selvecs="bfd_elf32_sh64_vec bfd_elf64_sh64l_vec bfd_elf64_sh64_vec bfd_elf32_shl_vec bfd_elf32_sh_vec"
targ_underscore=yes
+ want64=true
;;
sh64-*-elf*)
targ_defvec=bfd_elf32_sh64_vec
targ_selvecs="bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec bfd_elf32_sh_vec bfd_elf32_shl_vec"
targ_underscore=yes
+ want64=true
;;
sh64eb-*-linux*)
targ_defvec=bfd_elf32_sh64blin_vec
targ_selvecs="bfd_elf32_sh64lin_vec bfd_elf64_sh64blin_vec bfd_elf64_sh64lin_vec bfd_elf32_shblin_vec bfd_elf32_shlin_vec"
+ want64=true
;;
sh64-*-linux*)
targ_defvec=bfd_elf32_sh64lin_vec
targ_selvecs="bfd_elf32_sh64blin_vec bfd_elf64_sh64lin_vec bfd_elf64_sh64blin_vec bfd_elf32_shlin_vec bfd_elf32_shblin_vec"
+ want64=true
;;
-#endif /* BFD64 */
-
sh-*-linux*)
targ_defvec=bfd_elf32_shblin_vec
- targ_selvecs=bfd_elf32_shlin_vec
-#ifdef BFD64
- targ_selvecs="${targ_selvecs} bfd_elf32_sh64lin_vec bfd_elf32_sh64blin_vec bfd_elf64_sh64lin_vec bfd_elf64_sh64blin_vec"
-#endif
+ targ_selvecs="bfd_elf32_shlin_vec bfd_elf32_sh64lin_vec bfd_elf32_sh64blin_vec bfd_elf64_sh64lin_vec bfd_elf64_sh64blin_vec"
+ want64=true
;;
+#endif /* BFD64 */
+
sh*eb-*-linux*)
targ_defvec=bfd_elf32_shblin_vec
targ_selvecs=bfd_elf32_shlin_vec
@@ -1142,40 +1199,49 @@ case "${targ}" in
targ_selvecs=bfd_elf32_shblin_vec
;;
+ sh-*-uclinux* | sh[12]-*-uclinux*)
+ targ_defvec=bfd_elf32_sh_vec
+ targ_selvecs="bfd_elf32_shblin_vec bfd_elf32_shlin_vec"
+#ifdef BFD64
+ targ_selvecs="${targ_selvecs} bfd_elf32_sh64lin_vec bfd_elf32_sh64blin_vec bfd_elf64_sh64lin_vec bfd_elf64_sh64blin_vec"
+#endif
+ ;;
+
#ifdef BFD64
sh5le-*-netbsd*)
targ_defvec=bfd_elf32_sh64lnbsd_vec
targ_selvecs="bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec bfd_elf32_shnbsd_vec bfd_elf32_shlnbsd_vec"
+ want64=true
;;
sh5-*-netbsd*)
targ_defvec=bfd_elf32_sh64nbsd_vec
targ_selvecs="bfd_elf32_sh64lnbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec bfd_elf32_shnbsd_vec bfd_elf32_shlnbsd_vec"
+ want64=true
;;
sh64le-*-netbsd*)
targ_defvec=bfd_elf64_sh64lnbsd_vec
targ_selvecs="bfd_elf64_sh64nbsd_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec bfd_elf32_shnbsd_vec bfd_elf32_shlnbsd_vec"
+ want64=true
;;
sh64-*-netbsd*)
targ_defvec=bfd_elf64_sh64nbsd_vec
targ_selvecs="bfd_elf64_sh64lnbsd_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec bfd_elf32_shnbsd_vec bfd_elf32_shlnbsd_vec"
+ want64=true
;;
-#endif
sh*l*-*-netbsdelf*)
targ_defvec=bfd_elf32_shlnbsd_vec
- targ_selvecs="bfd_elf32_shnbsd_vec shcoff_vec shlcoff_vec"
-#ifdef BFD64
- targ_selvecs="${targ_selvecs} bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec"
-#endif
+ targ_selvecs="bfd_elf32_shnbsd_vec shcoff_vec shlcoff_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec"
+ want64=true
;;
sh-*-netbsdelf*)
targ_defvec=bfd_elf32_shnbsd_vec
- targ_selvecs="bfd_elf32_shlnbsd_vec shcoff_vec shlcoff_vec"
-#ifdef BFD64
- targ_selvecs="${targ_selvecs} bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec"
-#endif
+ targ_selvecs="bfd_elf32_shlnbsd_vec shcoff_vec shlcoff_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec"
+ want64=true
;;
+#endif
+
sh*-*-netbsdelf*)
targ_defvec=bfd_elf32_shnbsd_vec
targ_selvecs="bfd_elf32_shlnbsd_vec shcoff_vec shlcoff_vec"
@@ -1185,40 +1251,48 @@ case "${targ}" in
targ_selvecs="shlcoff_vec shlcoff_small_vec"
targ_underscore=yes
;;
+
+#ifdef BFD64
shl*-*-elf* | sh[1234]l*-*-elf* | sh3el*-*-elf* | shl*-*-kaos*)
targ_defvec=bfd_elf32_shl_vec
- targ_selvecs="bfd_elf32_sh_vec shlcoff_vec shcoff_vec shlcoff_small_vec shcoff_small_vec"
-#ifdef BFD64
- targ_selvecs="${targ_selvecs} bfd_elf32_sh64_vec bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec"
-#endif
+ targ_selvecs="bfd_elf32_sh_vec shlcoff_vec shcoff_vec shlcoff_small_vec shcoff_small_vec bfd_elf32_sh64_vec bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec"
targ_underscore=yes
+ want64=true
;;
+#endif
+
sh-*-rtemscoff*)
targ_defvec=shcoff_vec
targ_selvecs="shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec"
targ_underscore=yes
;;
+
+#ifdef BFD64
sh-*-elf* | sh[1234]*-elf* | sh-*-rtems* | sh-*-kaos*)
targ_defvec=bfd_elf32_sh_vec
- targ_selvecs="bfd_elf32_shl_vec shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec"
-#ifdef BFD64
- targ_selvecs="${targ_selvecs} bfd_elf32_sh64_vec bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec"
-#endif
+ targ_selvecs="bfd_elf32_shl_vec shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec bfd_elf32_sh64_vec bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec"
targ_underscore=yes
+ want64=true
;;
+#endif
+
sh-*-nto*)
targ_defvec=bfd_elf32_sh_vec
targ_selvecs="bfd_elf32_shl_vec shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec"
targ_underscore=yes
;;
+ sh*-*-openbsd*)
+ targ_defvec=bfd_elf32_shlnbsd_vec
+ targ_selvecs="bfd_elf32_shnbsd_vec shcoff_vec shlcoff_vec"
+ ;;
sh-*-pe)
targ_defvec=shlpe_vec
targ_selvecs="shlpe_vec shlpei_vec"
targ_underscore=yes
;;
sh-*-vxworks)
- targ_defvec=bfd_elf32_sh_vec
- targ_selvecs="bfd_elf32_shl_vec"
+ targ_defvec=bfd_elf32_shvxworks_vec
+ targ_selvecs="bfd_elf32_shlvxworks_vec"
# FIXME None of the following are actually used on this target, but
# they're necessary for coff-sh.c (which is unconditionally used) to be
# compiled correctly.
@@ -1279,6 +1353,7 @@ case "${targ}" in
sparc-*-solaris2* | sparcv9-*-solaris2* | sparc64-*-solaris2*)
targ_defvec=bfd_elf32_sparc_vec
targ_selvecs="bfd_elf64_sparc_vec sunos_big_vec"
+ want64=true
;;
#endif
sparc-*-sysv4*)
@@ -1296,14 +1371,17 @@ case "${targ}" in
sparc64-*-aout*)
targ_defvec=sunos_big_vec
targ_underscore=yes
+ want64=true
;;
sparc64-*-linux-*)
targ_defvec=bfd_elf64_sparc_vec
targ_selvecs="bfd_elf32_sparc_vec sparclinux_vec sunos_big_vec"
+ want64=true
;;
sparc64-*-elf*)
targ_defvec=bfd_elf64_sparc_vec
targ_selvecs=bfd_elf32_sparc_vec
+ want64=true
;;
#endif /* BFD64 */
sparc*-*-coff*)
@@ -1318,6 +1396,10 @@ case "${targ}" in
targ_underscore=yes
;;
+ spu-*-elf)
+ targ_defvec=bfd_elf32_spu_vec
+ ;;
+
#if HAVE_host_aout_vec
tahoe-*-*)
targ_defvec=host_aout_vec
diff --git a/bfd/config.in b/bfd/config.in
index 6c738257d982..aa91dd698881 100644
--- a/bfd/config.in
+++ b/bfd/config.in
@@ -1,29 +1,9 @@
/* config.in. Generated from configure.in by autoheader. */
-/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
- systems. This function is required for `alloca.c' support on those systems.
- */
-#undef CRAY_STACKSEG_END
-
-/* Define to 1 if using `alloca.c'. */
-#undef C_ALLOCA
-
-/* Define to 1 if NLS is requested */
+/* Define to 1 if translation of program messages to the user's native
+ language is requested. */
#undef ENABLE_NLS
-/* Define to 1 if you have `alloca', as a function or macro. */
-#undef HAVE_ALLOCA
-
-/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
- */
-#undef HAVE_ALLOCA_H
-
-/* Define to 1 if you have the <argz.h> header file. */
-#undef HAVE_ARGZ_H
-
-/* Define to 1 if you have the `dcgettext' function. */
-#undef HAVE_DCGETTEXT
-
/* Define to 1 if you have the declaration of `basename', and to 0 if you
don't. */
#undef HAVE_DECL_BASENAME
@@ -83,6 +63,9 @@
*/
#undef HAVE_DIRENT_H
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
/* Define to 1 if you have the `fcntl' function. */
#undef HAVE_FCNTL
@@ -107,33 +90,18 @@
/* Define to 1 if you have the `ftello64' function. */
#undef HAVE_FTELLO64
-/* Define to 1 if you have the `getcwd' function. */
-#undef HAVE_GETCWD
-
/* Define to 1 if you have the `getgid' function. */
#undef HAVE_GETGID
/* Define to 1 if you have the `getpagesize' function. */
#undef HAVE_GETPAGESIZE
-/* Define as 1 if you have gettext and don't want to use GNU gettext. */
-#undef HAVE_GETTEXT
-
/* Define to 1 if you have the `getuid' function. */
#undef HAVE_GETUID
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
-/* Define if your locale.h file contains LC_MESSAGES. */
-#undef HAVE_LC_MESSAGES
-
-/* Define to 1 if you have the <limits.h> header file. */
-#undef HAVE_LIMITS_H
-
-/* Define to 1 if you have the <locale.h> header file. */
-#undef HAVE_LOCALE_H
-
/* Define if <sys/procfs.h> has lwpstatus_t. */
#undef HAVE_LWPSTATUS_T
@@ -149,9 +117,6 @@
/* Define to 1 if you have the `madvise' function. */
#undef HAVE_MADVISE
-/* Define to 1 if you have the <malloc.h> header file. */
-#undef HAVE_MALLOC_H
-
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
@@ -161,15 +126,9 @@
/* Define to 1 if you have the `mprotect' function. */
#undef HAVE_MPROTECT
-/* Define to 1 if you have the `munmap' function. */
-#undef HAVE_MUNMAP
-
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
#undef HAVE_NDIR_H
-/* Define to 1 if you have the <nl_types.h> header file. */
-#undef HAVE_NL_TYPES_H
-
/* Define if <sys/procfs.h> has prpsinfo32_t. */
#undef HAVE_PRPSINFO32_T
@@ -200,21 +159,12 @@
/* Define if <sys/procfs.h> has pstatus_t. */
#undef HAVE_PSTATUS_T
-/* Define to 1 if you have the `putenv' function. */
-#undef HAVE_PUTENV
-
/* Define if <sys/procfs.h> has pxstatus_t. */
#undef HAVE_PXSTATUS_T
-/* Define to 1 if you have the `setenv' function. */
-#undef HAVE_SETENV
-
/* Define to 1 if you have the `setitimer' function. */
#undef HAVE_SETITIMER
-/* Define to 1 if you have the `setlocale' function. */
-#undef HAVE_SETLOCALE
-
/* Define to 1 if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_H
@@ -224,15 +174,6 @@
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
-/* Define if you have the stpcpy function */
-#undef HAVE_STPCPY
-
-/* Define to 1 if you have the `strcasecmp' function. */
-#undef HAVE_STRCASECMP
-
-/* Define to 1 if you have the `strchr' function. */
-#undef HAVE_STRCHR
-
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
@@ -259,9 +200,6 @@
*/
#undef HAVE_SYS_NDIR_H
-/* Define to 1 if you have the <sys/param.h> header file. */
-#undef HAVE_SYS_PARAM_H
-
/* Define to 1 if you have the <sys/procfs.h> header file. */
#undef HAVE_SYS_PROCFS_H
@@ -280,20 +218,12 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
-/* Define to 1 if you have the <values.h> header file. */
-#undef HAVE_VALUES_H
-
/* Define if <sys/procfs.h> has win32_pstatus_t. */
#undef HAVE_WIN32_PSTATUS_T
-/* Define to 1 if you have the `__argz_count' function. */
-#undef HAVE___ARGZ_COUNT
-
-/* Define to 1 if you have the `__argz_next' function. */
-#undef HAVE___ARGZ_NEXT
-
-/* Define to 1 if you have the `__argz_stringify' function. */
-#undef HAVE___ARGZ_STRINGIFY
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#undef LT_OBJDIR
/* Name of package */
#undef PACKAGE
@@ -313,6 +243,12 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
+/* The size of a `char', as computed by sizeof. */
+#undef SIZEOF_CHAR
+
+/* The size of a `int', as computed by sizeof. */
+#undef SIZEOF_INT
+
/* The size of a `long', as computed by sizeof. */
#undef SIZEOF_LONG
@@ -322,13 +258,11 @@
/* The size of a `off_t', as computed by sizeof. */
#undef SIZEOF_OFF_T
-/* If using the C implementation of alloca, define if you know the
- direction of stack growth for your system; otherwise it will be
- automatically deduced at run-time.
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown */
-#undef STACK_DIRECTION
+/* The size of a `short', as computed by sizeof. */
+#undef SIZEOF_SHORT
+
+/* The size of a `void *', as computed by sizeof. */
+#undef SIZEOF_VOID_P
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
@@ -358,18 +292,3 @@
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
-
-/* Define to empty if `const' does not conform to ANSI C. */
-#undef const
-
-/* Define to `__inline__' or `__inline' if that's what the C compiler
- calls it, or to nothing if 'inline' is not supported under any name. */
-#ifndef __cplusplus
-#undef inline
-#endif
-
-/* Define to `long' if <sys/types.h> does not define. */
-#undef off_t
-
-/* Define to `unsigned' if <sys/types.h> does not define. */
-#undef size_t
diff --git a/bfd/configure b/bfd/configure
index af6c22b5a669..3cff895158fc 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -241,6 +241,155 @@ IFS=" $as_nl"
$as_unset CDPATH
+
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$lt_ECHO in
+X*--fallback-echo)
+ # Remove one level of quotation (which was required for Make).
+ ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','`
+ ;;
+esac
+
+ECHO=${lt_ECHO-echo}
+if test "X$1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X$1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then
+ # Yippee, $ECHO works!
+ :
+else
+ # Restart under the correct shell.
+ exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<_LT_EOF
+$*
+_LT_EOF
+ exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test -z "$lt_ECHO"; then
+ if test "X${echo_test_string+set}" != Xset; then
+ # find a string as large as possible, as long as the shell can cope with it
+ for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
+ # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+ if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
+ { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
+ then
+ break
+ fi
+ done
+ fi
+
+ if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ :
+ else
+ # The Solaris, AIX, and Digital Unix default echo programs unquote
+ # backslashes. This makes it impossible to quote backslashes using
+ # echo "$something" | sed 's/\\/\\\\/g'
+ #
+ # So, first we look for a working echo in the user's PATH.
+
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for dir in $PATH /usr/ucb; do
+ IFS="$lt_save_ifs"
+ if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+ test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ ECHO="$dir/echo"
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+
+ if test "X$ECHO" = Xecho; then
+ # We didn't find a better echo, so look for alternatives.
+ if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # This shell has a builtin print -r that does the trick.
+ ECHO='print -r'
+ elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
+ test "X$CONFIG_SHELL" != X/bin/ksh; then
+ # If we have ksh, try running configure again with it.
+ ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+ export ORIGINAL_CONFIG_SHELL
+ CONFIG_SHELL=/bin/ksh
+ export CONFIG_SHELL
+ exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
+ else
+ # Try using printf.
+ ECHO='printf %s\n'
+ if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # Cool, printf works
+ :
+ elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+ export CONFIG_SHELL
+ SHELL="$CONFIG_SHELL"
+ export SHELL
+ ECHO="$CONFIG_SHELL $0 --fallback-echo"
+ elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ ECHO="$CONFIG_SHELL $0 --fallback-echo"
+ else
+ # maybe with a smaller string...
+ prev=:
+
+ for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
+ if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
+ then
+ break
+ fi
+ prev="$cmd"
+ done
+
+ if test "$prev" != 'sed 50q "$0"'; then
+ echo_test_string=`eval $prev`
+ export echo_test_string
+ exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
+ else
+ # Oops. We lost completely, so just stick with echo.
+ ECHO=echo
+ fi
+ fi
+ fi
+ fi
+ fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+lt_ECHO=$ECHO
+if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
+ lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
+fi
+
+
+
+
# Name of the host.
# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
# so uname gets run too.
@@ -309,7 +458,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE AR ac_ct_AR RANLIB ac_ct_RANLIB LN_S LIBTOOL WARN_CFLAGS NO_WERROR MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT INSTALL_LIBBFD_TRUE INSTALL_LIBBFD_FALSE host_noncanonical target_noncanonical bfdlibdir bfdincludedir CPP EGREP ALLOCA USE_NLS MSGFMT GMSGFMT XGETTEXT USE_INCLUDED_LIBINTL CATALOGS CATOBJEXT DATADIRNAME GMOFILES INSTOBJEXT INTLDEPS INTLLIBS INTLOBJS POFILES POSUB INCLUDE_LOCALE_H GT_NO GT_YES MKINSTALLDIRS l HDEFINES BFD_HOST_64BIT_LONG BFD_HOST_LONG_LONG BFD_HOST_64_BIT_DEFINED BFD_HOST_64_BIT BFD_HOST_U_64_BIT CC_FOR_BUILD EXEEXT_FOR_BUILD COREFILE COREFLAG WIN32LDFLAGS WIN32LIBADD TDEFINES wordsize bfd_libs all_backends bfd_backends bfd_machines bfd_default_target_size bfd_file_ptr bfd_ufile_ptr tdefaults datarootdir docdir htmldir LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE AR ac_ct_AR RANLIB ac_ct_RANLIB LIBTOOL SED EGREP FGREP GREP LD DUMPBIN ac_ct_DUMPBIN NM LN_S lt_ECHO CPP DEBUGDIR PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI WARN_CFLAGS NO_WERROR MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT GENINSRC_NEVER_TRUE GENINSRC_NEVER_FALSE INSTALL_LIBBFD_TRUE INSTALL_LIBBFD_FALSE host_noncanonical target_noncanonical bfdlibdir bfdincludedir USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT MKINSTALLDIRS MSGFMT MSGMERGE HDEFINES BFD_HOST_64BIT_LONG BFD_HOST_LONG_LONG BFD_HOST_64_BIT_DEFINED BFD_HOST_64_BIT BFD_HOST_U_64_BIT CC_FOR_BUILD EXEEXT_FOR_BUILD COREFILE COREFLAG WIN32LDFLAGS WIN32LIBADD TDEFINES wordsize bfd64_libs all_backends bfd_backends bfd_machines bfd_default_target_size bfd_file_ptr bfd_ufile_ptr tdefaults datarootdir docdir htmldir LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -852,16 +1001,19 @@ Optional Features:
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors
- --enable-shared=PKGS build shared libraries default=no
- --enable-static=PKGS build static libraries default=yes
- --enable-fast-install=PKGS optimize for fast installation default=yes
+ --enable-shared[=PKGS]
+ build shared libraries [default=no]
+ --enable-static[=PKGS]
+ build static libraries [default=yes]
+ --enable-fast-install[=PKGS]
+ optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
--enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)
--enable-targets alternative target configurations
--enable-commonbfdlib build shared BFD/opcodes/libiberty library
--enable-secureplt Default to creating read-only plt entries
- --enable-werror treat compile warnings as errors
- --enable-build-warnings Enable build-time compiler warnings
+ --enable-werror treat compile warnings as errors
+ --enable-build-warnings enable build-time compiler warnings
--enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer
--enable-install-libbfd controls installation of libbfd and related headers
@@ -870,10 +1022,16 @@ Optional Features:
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --with-gnu-ld assume the C compiler uses GNU ld default=no
- --with-pic try to use only PIC/non-PIC objects default=use both
+ --with-pic try to use only PIC/non-PIC objects [default=use
+ both]
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]
--with-mmap try using mmap for BFD input files if available
- --with-included-gettext use the GNU gettext library included here
+ --with-separate-debug-dir=DIR
+ Look for global separate debug info in DIR
+ [default=LIBDIR/debug]
+ --with-pkgversion=PKG Use PKG in the version string in place of "GNU
+ Binutils"
+ --with-bugurl=URL Direct users to URL to report a bug
Some influential environment variables:
CC C compiler command
@@ -2836,7 +2994,7 @@ fi
# Define the identity of the package.
PACKAGE=bfd
- VERSION=2.17
+ VERSION=2.17.50
cat >>confdefs.h <<_ACEOF
@@ -3240,1303 +3398,34 @@ fi
if test "${enable_shared+set}" = set; then
enableval="$enable_shared"
p=${PACKAGE-default}
-case $enableval in
-yes) enable_shared=yes ;;
-no) enable_shared=no ;;
-*)
- enable_shared=no
- # Look at the argument we got. We use all the common list separators.
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
- for pkg in $enableval; do
- if test "X$pkg" = "X$p"; then
- enable_shared=yes
- fi
- done
- IFS="$ac_save_ifs"
- ;;
-esac
-else
- enable_shared=no
-fi;
-
-# Check whether --enable-static or --disable-static was given.
-if test "${enable_static+set}" = set; then
- enableval="$enable_static"
- p=${PACKAGE-default}
-case $enableval in
-yes) enable_static=yes ;;
-no) enable_static=no ;;
-*)
- enable_static=no
- # Look at the argument we got. We use all the common list separators.
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
- for pkg in $enableval; do
- if test "X$pkg" = "X$p"; then
- enable_static=yes
- fi
- done
- IFS="$ac_save_ifs"
- ;;
-esac
-else
- enable_static=yes
-fi;
-# Check whether --enable-fast-install or --disable-fast-install was given.
-if test "${enable_fast_install+set}" = set; then
- enableval="$enable_fast_install"
- p=${PACKAGE-default}
-case $enableval in
-yes) enable_fast_install=yes ;;
-no) enable_fast_install=no ;;
-*)
- enable_fast_install=no
- # Look at the argument we got. We use all the common list separators.
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
- for pkg in $enableval; do
- if test "X$pkg" = "X$p"; then
- enable_fast_install=yes
- fi
- done
- IFS="$ac_save_ifs"
- ;;
-esac
-else
- enable_fast_install=yes
-fi;
-
-# Check whether --with-gnu-ld or --without-gnu-ld was given.
-if test "${with_gnu_ld+set}" = set; then
- withval="$with_gnu_ld"
- test "$withval" = no || with_gnu_ld=yes
-else
- with_gnu_ld=no
-fi;
-ac_prog=ld
-if test "$GCC" = yes; then
- # Check if gcc -print-prog-name=ld gives a path.
- echo "$as_me:$LINENO: checking for ld used by GCC" >&5
-echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6
- case $host in
- *-*-mingw*)
- # gcc leaves a trailing carriage return which upsets mingw
- ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
- *)
- ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
- esac
- case $ac_prog in
- # Accept absolute paths.
- [\\/]* | [A-Za-z]:[\\/]*)
- re_direlt='/[^/][^/]*/\.\./'
- # Canonicalize the path of ld
- ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
- while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
- ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
- done
- test -z "$LD" && LD="$ac_prog"
- ;;
- "")
- # If it fails, then pretend we aren't using GCC.
- ac_prog=ld
- ;;
- *)
- # If it is relative, then search for the first ld in PATH.
- with_gnu_ld=unknown
- ;;
- esac
-elif test "$with_gnu_ld" = yes; then
- echo "$as_me:$LINENO: checking for GNU ld" >&5
-echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6
-else
- echo "$as_me:$LINENO: checking for non-GNU ld" >&5
-echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6
-fi
-if test "${lt_cv_path_LD+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -z "$LD"; then
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
- lt_cv_path_LD="$ac_dir/$ac_prog"
- # Check to see if the program is GNU ld. I'd rather use --version,
- # but apparently some GNU ld's only accept -v.
- # Break only if it was the GNU/non-GNU ld that we prefer.
- if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
- test "$with_gnu_ld" != no && break
- else
- test "$with_gnu_ld" != yes && break
- fi
- fi
- done
- IFS="$ac_save_ifs"
-else
- lt_cv_path_LD="$LD" # Let the user override the test with a path.
-fi
-fi
-
-LD="$lt_cv_path_LD"
-if test -n "$LD"; then
- echo "$as_me:$LINENO: result: $LD" >&5
-echo "${ECHO_T}$LD" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
-echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
- { (exit 1); exit 1; }; }
-echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
-echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6
-if test "${lt_cv_prog_gnu_ld+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- # I'd rather use --version here, but apparently some GNU ld's only accept -v.
-if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
- lt_cv_prog_gnu_ld=yes
-else
- lt_cv_prog_gnu_ld=no
-fi
-fi
-echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
-echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6
-with_gnu_ld=$lt_cv_prog_gnu_ld
-
-
-echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
-echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6
-if test "${lt_cv_ld_reload_flag+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- lt_cv_ld_reload_flag='-r'
-fi
-echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
-echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6
-reload_flag=$lt_cv_ld_reload_flag
-test -n "$reload_flag" && reload_flag=" $reload_flag"
-
-echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5
-echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6
-if test "${lt_cv_path_NM+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$NM"; then
- # Let the user override the test.
- lt_cv_path_NM="$NM"
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
- for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
- test -z "$ac_dir" && ac_dir=.
- tmp_nm=$ac_dir/${ac_tool_prefix}nm
- if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then
- # Check to see if the nm accepts a BSD-compat flag.
- # Adding the `sed 1q' prevents false positives on HP-UX, which says:
- # nm: unknown option "B" ignored
- # Tru64's nm complains that /dev/null is an invalid object file
- if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then
- lt_cv_path_NM="$tmp_nm -B"
- break
- elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
- lt_cv_path_NM="$tmp_nm -p"
- break
- else
- lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
- continue # so that we can try to find one that supports BSD flags
- fi
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
-fi
-fi
-
-NM="$lt_cv_path_NM"
-echo "$as_me:$LINENO: result: $NM" >&5
-echo "${ECHO_T}$NM" >&6
-
-echo "$as_me:$LINENO: checking whether ln -s works" >&5
-echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6
-LN_S=$as_ln_s
-if test "$LN_S" = "ln -s"; then
- echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-else
- echo "$as_me:$LINENO: result: no, using $LN_S" >&5
-echo "${ECHO_T}no, using $LN_S" >&6
-fi
-
-echo "$as_me:$LINENO: checking how to recognise dependant libraries" >&5
-echo $ECHO_N "checking how to recognise dependant libraries... $ECHO_C" >&6
-if test "${lt_cv_deplibs_check_method+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- lt_cv_file_magic_cmd='$MAGIC_CMD'
-lt_cv_file_magic_test_file=
-lt_cv_deplibs_check_method='unknown'
-# Need to set the preceding variable on all platforms that support
-# interlibrary dependencies.
-# 'none' -- dependencies not supported.
-# `unknown' -- same as none, but documents that we really don't know.
-# 'pass_all' -- all dependencies passed with no checks.
-# 'test_compile' -- check by making test program.
-# 'file_magic [regex]' -- check by looking for files in library path
-# which responds to the $file_magic_cmd with a given egrep regex.
-# If you have `file' or equivalent on your system and you're not sure
-# whether `pass_all' will *always* work, you probably want this one.
-
-case $host_os in
-aix*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-beos*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-bsdi4*)
- lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
- lt_cv_file_magic_cmd='/usr/bin/file -L'
- lt_cv_file_magic_test_file=/shlib/libc.so
- ;;
-
-cygwin* | mingw* |pw32*)
- lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
- lt_cv_file_magic_cmd='$OBJDUMP -f'
- ;;
-
-darwin* | rhapsody*)
- # this will be overwritten by pass_all, but leave it in just in case
- lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library'
- lt_cv_file_magic_cmd='/usr/bin/file -L'
- case "$host_os" in
- rhapsody* | darwin1.012)
- lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System'
- ;;
- *) # Darwin 1.3 on
- lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
- ;;
- esac
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-freebsd* | kfreebsd*-gnu)
- if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
- case $host_cpu in
- i*86 )
- # Not sure whether the presence of OpenBSD here was a mistake.
- # Let's accept both of them until this is cleared up.
- lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'
- lt_cv_file_magic_cmd=/usr/bin/file
- lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
- ;;
- esac
- else
- lt_cv_deplibs_check_method=pass_all
- fi
- ;;
-
-gnu*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-hpux10.20*|hpux11*)
- case $host_cpu in
- hppa*)
- lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
- lt_cv_file_magic_cmd=/usr/bin/file
- lt_cv_file_magic_test_file=/usr/lib/libc.sl
- ;;
- ia64*)
- lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
- lt_cv_file_magic_cmd=/usr/bin/file
- lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
- ;;
- esac
- ;;
-
-irix5* | irix6*)
- case $host_os in
- irix5*)
- # this will be overridden with pass_all, but let us keep it just in case
- lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
- ;;
- *)
- case $LD in
- *-32|*"-32 ") libmagic=32-bit;;
- *-n32|*"-n32 ") libmagic=N32;;
- *-64|*"-64 ") libmagic=64-bit;;
- *) libmagic=never-match;;
- esac
- # this will be overridden with pass_all, but let us keep it just in case
- lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"
- ;;
- esac
- lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-# This must be Linux ELF.
-linux-gnu*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-netbsd* | knetbsd*-gnu)
- if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
- lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
- else
- lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$'
- fi
- ;;
-
-newsos6)
- lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
- lt_cv_file_magic_cmd=/usr/bin/file
- lt_cv_file_magic_test_file=/usr/lib/libnls.so
- ;;
-
-osf3* | osf4* | osf5*)
- # this will be overridden with pass_all, but let us keep it just in case
- lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
- lt_cv_file_magic_test_file=/shlib/libc.so
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-sco3.2v5*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-solaris*)
- lt_cv_deplibs_check_method=pass_all
- lt_cv_file_magic_test_file=/lib/libc.so
- ;;
-
-sysv5uw[78]* | sysv4*uw2*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
- case $host_vendor in
- ncr)
- lt_cv_deplibs_check_method=pass_all
- ;;
- motorola)
- lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
- lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
- ;;
- esac
- ;;
-esac
-
-fi
-echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
-echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6
-file_magic_cmd=$lt_cv_file_magic_cmd
-deplibs_check_method=$lt_cv_deplibs_check_method
-
-
-
-
-# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
-
-# find the maximum length of command line arguments
-echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
-echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6
-if test "${lt_cv_sys_max_cmd_len+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- i=0
- teststring="ABCD"
-
- case $build_os in
- msdosdjgpp*)
- # On DJGPP, this test can blow up pretty badly due to problems in libc
- # (any single argument exceeding 2000 bytes causes a buffer overrun
- # during glob expansion). Even if it were fixed, the result of this
- # check would be larger than it should be.
- lt_cv_sys_max_cmd_len=12288; # 12K is about right
- ;;
-
- cygwin* | mingw*)
- # On Win9x/ME, this test blows up -- it succeeds, but takes
- # about 5 minutes as the teststring grows exponentially.
- # Worse, since 9x/ME are not pre-emptively multitasking,
- # you end up with a "frozen" computer, even though with patience
- # the test eventually succeeds (with a max line length of 256k).
- # Instead, let's just punt: use the minimum linelength reported by
- # all of the supported platforms: 8192 (on NT/2K/XP).
- lt_cv_sys_max_cmd_len=8192;
- ;;
-
- amigaos*)
- # On AmigaOS with pdksh, this test takes hours, literally.
- # So we just punt and use a minimum line length of 8192.
- lt_cv_sys_max_cmd_len=8192;
- ;;
-
- netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
- # This has been around since 386BSD, at least. Likely further.
- if test -x /sbin/sysctl; then
- lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
- elif test -x /usr/sbin/sysctl; then
- lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
- else
- lt_cv_sys_max_cmd_len=65536 # usable default for *BSD
- fi
- # And add a safety zone
- lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
- lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
- ;;
- esac
-
-fi
-
-if test -n "$lt_cv_sys_max_cmd_len" ; then
- echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
-echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6
-else
- echo "$as_me:$LINENO: result: none" >&5
-echo "${ECHO_T}none" >&6
-fi
-
-
-# Only perform the check for file, if the check method requires it
-case $deplibs_check_method in
-file_magic*)
- if test "$file_magic_cmd" = '$MAGIC_CMD'; then
- echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
-echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6
-if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- case $MAGIC_CMD in
- /*)
- lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
- ;;
- ?:/*)
- lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
- ;;
- *)
- ac_save_MAGIC_CMD="$MAGIC_CMD"
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="/usr/bin:$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/${ac_tool_prefix}file; then
- lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
- if test -n "$file_magic_test_file"; then
- case $deplibs_check_method in
- "file_magic "*)
- file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
- MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
- if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
- egrep "$file_magic_regex" > /dev/null; then
- :
- else
- cat <<EOF 1>&2
-
-*** Warning: the command libtool uses to detect shared libraries,
-*** $file_magic_cmd, produces output that libtool cannot recognize.
-*** The result is that libtool may fail to recognize shared libraries
-*** as such. This will affect the creation of libtool libraries that
-*** depend on shared libraries, but programs linked with such libtool
-*** libraries will work regardless of this problem. Nevertheless, you
-*** may want to report the problem to your system manager and/or to
-*** bug-libtool@gnu.org
-
-EOF
- fi ;;
- esac
- fi
- break
- fi
- done
- IFS="$ac_save_ifs"
- MAGIC_CMD="$ac_save_MAGIC_CMD"
- ;;
-esac
-fi
-
-MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
-if test -n "$MAGIC_CMD"; then
- echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
-echo "${ECHO_T}$MAGIC_CMD" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-if test -z "$lt_cv_path_MAGIC_CMD"; then
- if test -n "$ac_tool_prefix"; then
- echo "$as_me:$LINENO: checking for file" >&5
-echo $ECHO_N "checking for file... $ECHO_C" >&6
-if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- case $MAGIC_CMD in
- /*)
- lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
- ;;
- ?:/*)
- lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
- ;;
- *)
- ac_save_MAGIC_CMD="$MAGIC_CMD"
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="/usr/bin:$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/file; then
- lt_cv_path_MAGIC_CMD="$ac_dir/file"
- if test -n "$file_magic_test_file"; then
- case $deplibs_check_method in
- "file_magic "*)
- file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
- MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
- if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
- egrep "$file_magic_regex" > /dev/null; then
- :
- else
- cat <<EOF 1>&2
-
-*** Warning: the command libtool uses to detect shared libraries,
-*** $file_magic_cmd, produces output that libtool cannot recognize.
-*** The result is that libtool may fail to recognize shared libraries
-*** as such. This will affect the creation of libtool libraries that
-*** depend on shared libraries, but programs linked with such libtool
-*** libraries will work regardless of this problem. Nevertheless, you
-*** may want to report the problem to your system manager and/or to
-*** bug-libtool@gnu.org
-
-EOF
- fi ;;
- esac
- fi
- break
- fi
- done
- IFS="$ac_save_ifs"
- MAGIC_CMD="$ac_save_MAGIC_CMD"
- ;;
-esac
-fi
-
-MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
-if test -n "$MAGIC_CMD"; then
- echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
-echo "${ECHO_T}$MAGIC_CMD" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- else
- MAGIC_CMD=:
- fi
-fi
-
- fi
- ;;
-esac
-
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_RANLIB+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-RANLIB=$ac_cv_prog_RANLIB
-if test -n "$RANLIB"; then
- echo "$as_me:$LINENO: result: $RANLIB" >&5
-echo "${ECHO_T}$RANLIB" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_RANLIB"; then
- ac_ct_RANLIB=$RANLIB
- # Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_RANLIB"; then
- ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_RANLIB="ranlib"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
- test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
-fi
-fi
-ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
-if test -n "$ac_ct_RANLIB"; then
- echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
-echo "${ECHO_T}$ac_ct_RANLIB" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- RANLIB=$ac_ct_RANLIB
-else
- RANLIB="$ac_cv_prog_RANLIB"
-fi
-
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
-set dummy ${ac_tool_prefix}strip; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_STRIP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$STRIP"; then
- ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_STRIP="${ac_tool_prefix}strip"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-STRIP=$ac_cv_prog_STRIP
-if test -n "$STRIP"; then
- echo "$as_me:$LINENO: result: $STRIP" >&5
-echo "${ECHO_T}$STRIP" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_STRIP"; then
- ac_ct_STRIP=$STRIP
- # Extract the first word of "strip", so it can be a program name with args.
-set dummy strip; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_STRIP"; then
- ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_STRIP="strip"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
- test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
-fi
-fi
-ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
-if test -n "$ac_ct_STRIP"; then
- echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
-echo "${ECHO_T}$ac_ct_STRIP" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- STRIP=$ac_ct_STRIP
-else
- STRIP="$ac_cv_prog_STRIP"
-fi
-
-
-# Check for any special flags to pass to ltconfig.
-libtool_flags="--cache-file=$cache_file"
-test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
-test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
-test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
-test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc"
-test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
-
-
-# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
-if test "${enable_libtool_lock+set}" = set; then
- enableval="$enable_libtool_lock"
-
-fi;
-test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
-test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
-
-
-# Check whether --with-pic or --without-pic was given.
-if test "${with_pic+set}" = set; then
- withval="$with_pic"
- pic_mode="$withval"
-else
- pic_mode=default
-fi;
-test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic"
-test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
-
-# Some flags need to be propagated to the compiler or linker for good
-# libtool support.
-case $host in
-*-*-irix6*)
- # Find out which ABI we are using.
- echo '#line 4035 "configure"' > conftest.$ac_ext
- if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- if test "$lt_cv_prog_gnu_ld" = yes; then
- case `/usr/bin/file conftest.$ac_objext` in
- *32-bit*)
- LD="${LD-ld} -melf32bsmip"
- ;;
- *N32*)
- LD="${LD-ld} -melf32bmipn32"
- ;;
- *64-bit*)
- LD="${LD-ld} -melf64bmip"
- ;;
- esac
- else
- case `/usr/bin/file conftest.$ac_objext` in
- *32-bit*)
- LD="${LD-ld} -32"
- ;;
- *N32*)
- LD="${LD-ld} -n32"
- ;;
- *64-bit*)
- LD="${LD-ld} -64"
- ;;
- esac
- fi
- fi
- rm -rf conftest*
- ;;
-
-ia64-*-hpux*)
- # Find out which ABI we are using.
- echo 'int i;' > conftest.$ac_ext
- if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- case "`/usr/bin/file conftest.o`" in
- *ELF-32*)
- HPUX_IA64_MODE="32"
- ;;
- *ELF-64*)
- HPUX_IA64_MODE="64"
- ;;
- esac
- fi
- rm -rf conftest*
- ;;
-
-x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
- # Find out which ABI we are using.
- echo 'int i;' > conftest.$ac_ext
- if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- case "`/usr/bin/file conftest.o`" in
- *32-bit*)
- case $host in
- x86_64-*linux*)
- LD="${LD-ld} -m elf_i386"
- ;;
- ppc64-*linux*|powerpc64-*linux*)
- LD="${LD-ld} -m elf32ppclinux"
- ;;
- s390x-*linux*)
- LD="${LD-ld} -m elf_s390"
- ;;
- sparc64-*linux*)
- LD="${LD-ld} -m elf32_sparc"
- ;;
- esac
- ;;
- *64-bit*)
- case $host in
- x86_64-*linux*)
- LD="${LD-ld} -m elf_x86_64"
- ;;
- ppc*-*linux*|powerpc*-*linux*)
- LD="${LD-ld} -m elf64ppc"
- ;;
- s390*-*linux*)
- LD="${LD-ld} -m elf64_s390"
- ;;
- sparc*-*linux*)
- LD="${LD-ld} -m elf64_sparc"
- ;;
- esac
- ;;
- esac
- fi
- rm -rf conftest*
- ;;
-
-*-*-sco3.2v5*)
- # On SCO OpenServer 5, we need -belf to get full-featured binaries.
- SAVE_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -belf"
- echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
-echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6
-if test "${lt_cv_cc_needs_belf+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
-
- ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- lt_cv_cc_needs_belf=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-lt_cv_cc_needs_belf=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
- ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-fi
-echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
-echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6
- if test x"$lt_cv_cc_needs_belf" != x"yes"; then
- # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
- CFLAGS="$SAVE_CFLAGS"
- fi
- ;;
-
-
-esac
-
-
-# Save cache, so that ltconfig can load it
-cat >confcache <<\_ACEOF
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs, see configure's option --config-cache.
-# It is not useful on other systems. If it contains results you don't
-# want to keep, you may remove or edit it.
-#
-# config.status only pays attention to the cache file if you give it
-# the --recheck option to rerun configure.
-#
-# `ac_cv_env_foo' variables (set or unset) will be overridden when
-# loading this file, other *unset* `ac_cv_foo' will be assigned the
-# following values.
-
-_ACEOF
-
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# Ultrix sh set writes to stderr and can't be redirected directly,
-# and sets the high bit in the cache file unless we assign to the vars.
-{
- (set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote
- # substitution turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- "s/'/'\\\\''/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
- ;;
+ case $enableval in
+ yes) enable_shared=yes ;;
+ no) enable_shared=no ;;
*)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n \
- "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
;;
- esac;
-} |
- sed '
- t clear
- : clear
- s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
- t end
- /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
- : end' >>confcache
-if diff $cache_file confcache >/dev/null 2>&1; then :; else
- if test -w $cache_file; then
- test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
- cat confcache >$cache_file
- else
- echo "not updating unwritable cache $cache_file"
- fi
-fi
-rm -f confcache
-
-# Actually configure libtool. ac_aux_dir is where install-sh is found.
-AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
-MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
-LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
-AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
-objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
-deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \
-${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
-$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \
-|| { { echo "$as_me:$LINENO: error: libtool configure failed" >&5
-echo "$as_me: error: libtool configure failed" >&2;}
- { (exit 1); exit 1; }; }
-
-# Reload cache, that may have been modified by ltconfig
-if test -r "$cache_file"; then
- # Some versions of bash will fail to source /dev/null (special
- # files actually), so we avoid doing that.
- if test -f "$cache_file"; then
- { echo "$as_me:$LINENO: loading cache $cache_file" >&5
-echo "$as_me: loading cache $cache_file" >&6;}
- case $cache_file in
- [\\/]* | ?:[\\/]* ) . $cache_file;;
- *) . ./$cache_file;;
esac
- fi
-else
- { echo "$as_me:$LINENO: creating cache $cache_file" >&5
-echo "$as_me: creating cache $cache_file" >&6;}
- >$cache_file
-fi
-
-
-# This can be used to rebuild libtool when needed
-LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh"
-
-# Always use our own libtool.
-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
-
-# Redirect the config.log output again, so that the ltconfig log is not
-# clobbered by the next message.
-exec 5>>./config.log
-
-
-
-
-
-
-
-# Check whether --enable-64-bit-bfd or --disable-64-bit-bfd was given.
-if test "${enable_64_bit_bfd+set}" = set; then
- enableval="$enable_64_bit_bfd"
- case "${enableval}" in
- yes) want64=true ;;
- no) want64=false ;;
- *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for 64-bit-bfd option" >&5
-echo "$as_me: error: bad value ${enableval} for 64-bit-bfd option" >&2;}
- { (exit 1); exit 1; }; } ;;
-esac
-else
- want64=false
-fi; # Check whether --enable-targets or --disable-targets was given.
-if test "${enable_targets+set}" = set; then
- enableval="$enable_targets"
- case "${enableval}" in
- yes | "") { { echo "$as_me:$LINENO: error: enable-targets option must specify target names or 'all'" >&5
-echo "$as_me: error: enable-targets option must specify target names or 'all'" >&2;}
- { (exit 1); exit 1; }; }
- ;;
- no) enable_targets= ;;
- *) enable_targets=$enableval ;;
-esac
-fi; # Check whether --enable-commonbfdlib or --disable-commonbfdlib was given.
-if test "${enable_commonbfdlib+set}" = set; then
- enableval="$enable_commonbfdlib"
- case "${enableval}" in
- yes) commonbfdlib=true ;;
- no) commonbfdlib=false ;;
- *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for BFD commonbfdlib option" >&5
-echo "$as_me: error: bad value ${enableval} for BFD commonbfdlib option" >&2;}
- { (exit 1); exit 1; }; } ;;
-esac
-fi;
-# Check whether --with-mmap or --without-mmap was given.
-if test "${with_mmap+set}" = set; then
- withval="$with_mmap"
- case "${withval}" in
- yes) want_mmap=true ;;
- no) want_mmap=false ;;
- *) { { echo "$as_me:$LINENO: error: bad value ${withval} for BFD with-mmap option" >&5
-echo "$as_me: error: bad value ${withval} for BFD with-mmap option" >&2;}
- { (exit 1); exit 1; }; } ;;
-esac
-else
- want_mmap=false
-fi;
-# Check whether --enable-secureplt or --disable-secureplt was given.
-if test "${enable_secureplt+set}" = set; then
- enableval="$enable_secureplt"
- case "${enableval}" in
- yes) use_secureplt=true ;;
- no) use_secureplt=false ;;
- *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for secureplt option" >&5
-echo "$as_me: error: bad value ${enableval} for secureplt option" >&2;}
- { (exit 1); exit 1; }; } ;;
-esac
-else
- use_secureplt=false
-fi; if test $use_secureplt = true; then
-
-cat >>confdefs.h <<\_ACEOF
-#define USE_SECUREPLT 1
-_ACEOF
-
-fi
-
-
-GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
-
-# Check whether --enable-werror or --disable-werror was given.
-if test "${enable_werror+set}" = set; then
- enableval="$enable_werror"
- case "${enableval}" in
- yes | y) ERROR_ON_WARNING="yes" ;;
- no | n) ERROR_ON_WARNING="no" ;;
- *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-werror" >&5
-echo "$as_me: error: bad value ${enableval} for --enable-werror" >&2;}
- { (exit 1); exit 1; }; } ;;
- esac
-fi;
-
-# Enable -Werror by default when using gcc
-if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
- ERROR_ON_WARNING=yes
-fi
-
-NO_WERROR=
-if test "${ERROR_ON_WARNING}" = yes ; then
- GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
- NO_WERROR="-Wno-error"
-fi
-
-if test "${GCC}" = yes ; then
- WARN_CFLAGS="${GCC_WARN_CFLAGS}"
-fi
-
-# Check whether --enable-build-warnings or --disable-build-warnings was given.
-if test "${enable_build_warnings+set}" = set; then
- enableval="$enable_build_warnings"
- case "${enableval}" in
- yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
- no) if test "${GCC}" = yes ; then
- WARN_CFLAGS="-w"
- fi;;
- ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
- WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
- *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
- WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
- *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
-esac
-fi;
-
-if test x"$silent" != x"yes" && test x"$WARN_CFLAGS" != x""; then
- echo "Setting warning flags = $WARN_CFLAGS" 6>&1
-fi
-
-
-
-
-
- ac_config_headers="$ac_config_headers config.h:config.in"
-
-
-if test -z "$target" ; then
- { { echo "$as_me:$LINENO: error: Unrecognized target system type; please check config.sub." >&5
-echo "$as_me: error: Unrecognized target system type; please check config.sub." >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5
-echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6
- # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
-if test "${enable_maintainer_mode+set}" = set; then
- enableval="$enable_maintainer_mode"
- USE_MAINTAINER_MODE=$enableval
else
- USE_MAINTAINER_MODE=no
-fi;
- echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5
-echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6
-
-
-if test $USE_MAINTAINER_MODE = yes; then
- MAINTAINER_MODE_TRUE=
- MAINTAINER_MODE_FALSE='#'
-else
- MAINTAINER_MODE_TRUE='#'
- MAINTAINER_MODE_FALSE=
-fi
-
- MAINT=$MAINTAINER_MODE_TRUE
-
-
- case ${build_alias} in
- "") build_noncanonical=${build} ;;
- *) build_noncanonical=${build_alias} ;;
-esac
-
- case ${host_alias} in
- "") host_noncanonical=${build_noncanonical} ;;
- *) host_noncanonical=${host_alias} ;;
-esac
-
- case ${target_alias} in
- "") target_noncanonical=${host_noncanonical} ;;
- *) target_noncanonical=${target_alias} ;;
-esac
-
-echo "$as_me:$LINENO: checking whether to install libbfd" >&5
-echo $ECHO_N "checking whether to install libbfd... $ECHO_C" >&6
- # Check whether --enable-install-libbfd or --disable-install-libbfd was given.
-if test "${enable_install_libbfd+set}" = set; then
- enableval="$enable_install_libbfd"
- install_libbfd_p=$enableval
-else
- if test "${host}" = "${target}" || test "$enable_shared" = "yes"; then
- install_libbfd_p=yes
- else
- install_libbfd_p=no
- fi
+ enable_shared=no
fi;
- echo "$as_me:$LINENO: result: $install_libbfd_p" >&5
-echo "${ECHO_T}$install_libbfd_p" >&6
-if test $install_libbfd_p = yes; then
- INSTALL_LIBBFD_TRUE=
- INSTALL_LIBBFD_FALSE='#'
-else
- INSTALL_LIBBFD_TRUE='#'
- INSTALL_LIBBFD_FALSE=
-fi
- # Need _noncanonical variables for this.
- # libbfd.a is a host library containing target dependent code
- bfdlibdir='$(libdir)'
- bfdincludedir='$(includedir)'
- if test "${host}" != "${target}"; then
- bfdlibdir='$(exec_prefix)/$(host_noncanonical)/$(target_noncanonical)/lib'
- bfdincludedir='$(exec_prefix)/$(host_noncanonical)/$(target_noncanonical)/include'
- fi
-
-
-
-
-host64=false
-target64=false
-bfd_default_target_size=32
-
-# host stuff:
-
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -5273,7 +4162,1149 @@ _ACEOF
-ALL_LINGUAS="fr tr ja es sv da zh_CN ro rw vi"
+
+
+macro_version='2.1a'
+macro_revision='1.2435'
+
+
+
+
+
+
+
+
+
+
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+# Set options
+
+enable_dlopen=no
+
+
+enable_win32_dll=no
+
+
+
+# Check whether --enable-static or --disable-static was given.
+if test "${enable_static+set}" = set; then
+ enableval="$enable_static"
+ p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_static=yes ;;
+ no) enable_static=no ;;
+ *)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_static=yes
+fi;
+
+
+
+
+
+
+
+
+
+# Check whether --with-pic or --without-pic was given.
+if test "${with_pic+set}" = set; then
+ withval="$with_pic"
+ pic_mode="$withval"
+else
+ pic_mode=default
+fi;
+
+test -z "$pic_mode" && pic_mode=default
+
+
+
+
+
+
+
+# Check whether --enable-fast-install or --disable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+ enableval="$enable_fast_install"
+ p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_fast_install=yes ;;
+ no) enable_fast_install=no ;;
+ *)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_fast_install=yes
+fi;
+
+
+
+
+
+
+
+
+echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
+echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6
+if test "${lt_cv_path_SED+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for lt_ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+ lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+ fi
+ done
+ done
+done
+IFS=$as_save_IFS
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+ test ! -f $lt_ac_sed && continue
+ cat /dev/null > conftest.in
+ lt_ac_count=0
+ echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+ # Check for GNU sed and select it if it is found.
+ if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+ lt_cv_path_SED=$lt_ac_sed
+ break
+ fi
+ while true; do
+ cat conftest.in conftest.in >conftest.tmp
+ mv conftest.tmp conftest.in
+ cp conftest.in conftest.nl
+ echo >>conftest.nl
+ $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+ cmp -s conftest.out conftest.nl || break
+ # 10000 chars as input seems more than enough
+ test $lt_ac_count -gt 10 && break
+ lt_ac_count=`expr $lt_ac_count + 1`
+ if test $lt_ac_count -gt $lt_ac_max; then
+ lt_ac_max=$lt_ac_count
+ lt_cv_path_SED=$lt_ac_sed
+ fi
+ done
+done
+
+fi
+
+SED=$lt_cv_path_SED
+
+echo "$as_me:$LINENO: result: $SED" >&5
+echo "${ECHO_T}$SED" >&6
+
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+
+
+
+
+
+
+
+
+
+
+
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+ then ac_cv_prog_egrep='grep -E'
+ else ac_cv_prog_egrep='egrep'
+ fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
+
+echo "$as_me:$LINENO: checking for fgrep" >&5
+echo $ECHO_N "checking for fgrep... $ECHO_C" >&6
+if test "${ac_cv_prog_fgrep+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if echo 'ab*c' | (grep -F 'ab*c') >/dev/null 2>&1
+ then ac_cv_prog_fgrep='grep -F'
+ else ac_cv_prog_fgrep='fgrep'
+ fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_fgrep" >&5
+echo "${ECHO_T}$ac_cv_prog_fgrep" >&6
+ FGREP=$ac_cv_prog_fgrep
+
+
+test -z "$GREP" && GREP=grep
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-gnu-ld or --without-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+ withval="$with_gnu_ld"
+ test "$withval" = no || with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi;
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [\\/]* | ?:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the pathname of ld
+ ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+ while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6
+else
+ echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6
+fi
+if test "${lt_cv_path_LD+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -z "$LD"; then
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+ { (exit 1); exit 1; }; }
+echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6
+if test "${lt_cv_prog_gnu_ld+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+
+
+
+
+
+
+
+echo "$as_me:$LINENO: checking for BSD- or MS-compatible name lister (nm)" >&5
+echo $ECHO_N "checking for BSD- or MS-compatible name lister (nm)... $ECHO_C" >&6
+if test "${lt_cv_path_NM+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ lt_nm_to_check="${ac_tool_prefix}nm"
+ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+ lt_nm_to_check="$lt_nm_to_check nm"
+ fi
+ for lt_tmp_nm in $lt_nm_to_check; do
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/$lt_tmp_nm"
+ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+ */dev/null* | *'Invalid file or object type'*)
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ ;;
+ *)
+ case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+ */dev/null*)
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ ;;
+ *)
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+ done
+ : ${lt_cv_path_NM=no}
+fi
+fi
+echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
+echo "${ECHO_T}$lt_cv_path_NM" >&6
+if test "$lt_cv_path_NM" != "no"; then
+ NM="$lt_cv_path_NM"
+else
+ # Didn't find any BSD compatible name lister, look for dumpbin.
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in "dumpbin -symbols" "link -dump -symbols"
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_DUMPBIN+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$DUMPBIN"; then
+ ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+DUMPBIN=$ac_cv_prog_DUMPBIN
+if test -n "$DUMPBIN"; then
+ echo "$as_me:$LINENO: result: $DUMPBIN" >&5
+echo "${ECHO_T}$DUMPBIN" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$DUMPBIN" && break
+ done
+fi
+if test -z "$DUMPBIN"; then
+ ac_ct_DUMPBIN=$DUMPBIN
+ for ac_prog in "dumpbin -symbols" "link -dump -symbols"
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_DUMPBIN"; then
+ ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
+if test -n "$ac_ct_DUMPBIN"; then
+ echo "$as_me:$LINENO: result: $ac_ct_DUMPBIN" >&5
+echo "${ECHO_T}$ac_ct_DUMPBIN" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$ac_ct_DUMPBIN" && break
+done
+test -n "$ac_ct_DUMPBIN" || ac_ct_DUMPBIN=":"
+
+ DUMPBIN=$ac_ct_DUMPBIN
+fi
+
+
+ if test "$DUMPBIN" != ":"; then
+ NM="$DUMPBIN"
+ fi
+fi
+test -z "$NM" && NM=nm
+
+
+
+
+
+
+echo "$as_me:$LINENO: checking the name lister ($NM) interface" >&5
+echo $ECHO_N "checking the name lister ($NM) interface... $ECHO_C" >&6
+if test "${lt_cv_nm_interface+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_cv_nm_interface="BSD nm"
+ echo "int some_variable = 0;" > conftest.$ac_ext
+ (eval echo "\"\$as_me:4668: $ac_compile\"" >&5)
+ (eval "$ac_compile" 2>conftest.err)
+ cat conftest.err >&5
+ (eval echo "\"\$as_me:4671: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+ cat conftest.err >&5
+ (eval echo "\"\$as_me:4674: output\"" >&5)
+ cat conftest.out >&5
+ if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+ lt_cv_nm_interface="MS dumpbin"
+ fi
+ rm -f conftest*
+fi
+echo "$as_me:$LINENO: result: $lt_cv_nm_interface" >&5
+echo "${ECHO_T}$lt_cv_nm_interface" >&6
+
+echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+ echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+echo "${ECHO_T}no, using $LN_S" >&6
+fi
+
+# find the maximum length of command line arguments
+echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
+echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6
+if test "${lt_cv_sys_max_cmd_len+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ i=0
+ teststring="ABCD"
+
+ case $build_os in
+ msdosdjgpp*)
+ # On DJGPP, this test can blow up pretty badly due to problems in libc
+ # (any single argument exceeding 2000 bytes causes a buffer overrun
+ # during glob expansion). Even if it were fixed, the result of this
+ # check would be larger than it should be.
+ lt_cv_sys_max_cmd_len=12288; # 12K is about right
+ ;;
+
+ gnu*)
+ # Under GNU Hurd, this test is not required because there is
+ # no limit to the length of command line arguments.
+ # Libtool will interpret -1 as no limit whatsoever
+ lt_cv_sys_max_cmd_len=-1;
+ ;;
+
+ cygwin* | mingw*)
+ # On Win9x/ME, this test blows up -- it succeeds, but takes
+ # about 5 minutes as the teststring grows exponentially.
+ # Worse, since 9x/ME are not pre-emptively multitasking,
+ # you end up with a "frozen" computer, even though with patience
+ # the test eventually succeeds (with a max line length of 256k).
+ # Instead, let's just punt: use the minimum linelength reported by
+ # all of the supported platforms: 8192 (on NT/2K/XP).
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ amigaos*)
+ # On AmigaOS with pdksh, this test takes hours, literally.
+ # So we just punt and use a minimum line length of 8192.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+ # This has been around since 386BSD, at least. Likely further.
+ if test -x /sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+ elif test -x /usr/sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+ else
+ lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
+ fi
+ # And add a safety zone
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ ;;
+
+ interix*)
+ # We know the value 262144 and hardcode it with a safety zone (like BSD)
+ lt_cv_sys_max_cmd_len=196608
+ ;;
+
+ osf*)
+ # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+ # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+ # nice to cause kernel panics so lets avoid the loop below.
+ # First set a reasonable default.
+ lt_cv_sys_max_cmd_len=16384
+ #
+ if test -x /sbin/sysconfig; then
+ case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+ *1*) lt_cv_sys_max_cmd_len=-1 ;;
+ esac
+ fi
+ ;;
+ sco3.2v5*)
+ lt_cv_sys_max_cmd_len=102400
+ ;;
+ sysv5* | sco5v6* | sysv4.2uw2*)
+ kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+ if test -n "$kargmax"; then
+ lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'`
+ else
+ lt_cv_sys_max_cmd_len=32768
+ fi
+ ;;
+ *)
+ lt_cv_sys_max_cmd_len=`getconf ARG_MAX 2> /dev/null`
+ if test -n $lt_cv_sys_max_cmd_len; then
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ else
+ # Make teststring a little bigger before we do anything with it.
+ # a 1K string should be a reasonable start.
+ for i in 1 2 3 4 5 6 7 8 ; do
+ teststring=$teststring$teststring
+ done
+ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+ # If test is not a shell built-in, we'll probably end up computing a
+ # maximum length that is only half of the actual maximum length, but
+ # we can't tell.
+ while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
+ = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
+ test $i != 17 # 1/2 MB should be enough
+ do
+ i=`expr $i + 1`
+ teststring=$teststring$teststring
+ done
+ # Only check the string length outside the loop.
+ lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+ teststring=
+ # Add a significant safety factor because C++ compilers can tack on
+ # massive amounts of additional arguments before passing them to the
+ # linker. It appears as though 1/2 is a usable value.
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+ fi
+ ;;
+ esac
+
+fi
+
+if test -n $lt_cv_sys_max_cmd_len ; then
+ echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
+echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6
+else
+ echo "$as_me:$LINENO: result: none" >&5
+echo "${ECHO_T}none" >&6
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+
+
+
+
+
+
+: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+
+echo "$as_me:$LINENO: checking whether the shell understands some XSI constructs" >&5
+echo $ECHO_N "checking whether the shell understands some XSI constructs... $ECHO_C" >&6
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+ test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
+ = c,a/b,, ) >/dev/null 2>&1 \
+ && xsi_shell=yes
+echo "$as_me:$LINENO: result: $xsi_shell" >&5
+echo "${ECHO_T}$xsi_shell" >&6
+
+
+echo "$as_me:$LINENO: checking whether the shell understands \"+=\"" >&5
+echo $ECHO_N "checking whether the shell understands \"+=\"... $ECHO_C" >&6
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
+ >/dev/null 2>&1 \
+ && lt_shell_append=yes
+echo "$as_me:$LINENO: result: $lt_shell_append" >&5
+echo "${ECHO_T}$lt_shell_append" >&6
+
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ lt_unset=unset
+else
+ lt_unset=false
+fi
+
+
+
+
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+ # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+ lt_SP2NL='tr \040 \012'
+ lt_NL2SP='tr \015\012 \040\040'
+ ;;
+ *) # EBCDIC based system
+ lt_SP2NL='tr \100 \n'
+ lt_NL2SP='tr \r\n \100\100'
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
+echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6
+if test "${lt_cv_ld_reload_flag+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_cv_ld_reload_flag='-r'
+fi
+echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
+echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+ darwin*)
+ if test "$GCC" = yes; then
+ reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+ else
+ reload_cmds='$LD$reload_flag -o $output$reload_objs'
+ fi
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+
+echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5
+echo $ECHO_N "checking how to recognize dependent libraries... $ECHO_C" >&6
+if test "${lt_cv_deplibs_check_method+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix4* | aix5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi[45]*)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin*)
+ # func_win32_libid is a shell function defined in ltmain.sh
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ ;;
+
+mingw* | pw32*)
+ # Base MSYS/MinGW do not provide the 'file' command needed by
+ # func_win32_libid shell function, so use a weaker test based on 'objdump',
+ # unless we find 'file', for example because we are cross-compiling.
+ if ( file / ) >/dev/null 2>&1; then
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ else
+ lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ fi
+ ;;
+
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+freebsd* | dragonfly*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ ;;
+ esac
+ else
+ lt_cv_deplibs_check_method=pass_all
+ fi
+ ;;
+
+gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+hpux10.20* | hpux11*)
+ lt_cv_file_magic_cmd=/usr/bin/file
+ case $host_cpu in
+ ia64*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
+ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+ ;;
+ hppa*64*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'
+ lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+ ;;
+ *)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+ lt_cv_file_magic_test_file=/usr/lib/libc.sl
+ ;;
+ esac
+ ;;
+
+interix[3-9]*)
+ # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
+ fi
+ ;;
+
+newos6*)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libnls.so
+ ;;
+
+*nto* | *qnx*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+openbsd*)
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+ fi
+ ;;
+
+osf3* | osf4* | osf5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+rdos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.3*)
+ case $host_vendor in
+ motorola)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ ncr)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ sequent)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+ ;;
+ sni)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+ siemens)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ pc)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ esac
+ ;;
+
+tpf*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+esac
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
+echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_AR+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$AR"; then
+ ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AR="${ac_tool_prefix}ar"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+ echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_AR"; then
+ ac_ct_AR=$AR
+ # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_AR"; then
+ ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_AR="ar"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ test -z "$ac_cv_prog_ac_ct_AR" && ac_cv_prog_ac_ct_AR="false"
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+ echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+echo "${ECHO_T}$ac_ct_AR" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ AR=$ac_ct_AR
+else
+ AR="$ac_cv_prog_AR"
+fi
+
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+
+
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ STRIP=$ac_ct_STRIP
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+test -z "$STRIP" && STRIP=:
+
+
+
+
+
+
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
@@ -5354,6 +5385,533 @@ else
RANLIB="$ac_cv_prog_RANLIB"
fi
+test -z "$RANLIB" && RANLIB=:
+
+
+
+
+
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+ case $host_os in
+ openbsd*)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+ ;;
+ *)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+ ;;
+ esac
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
+echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6
+if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+ symcode='[BCDT]'
+ ;;
+cygwin* | mingw* | pw32*)
+ symcode='[ABCDGISTW]'
+ ;;
+hpux*)
+ if test "$host_cpu" = ia64; then
+ symcode='[ABCDEGRST]'
+ fi
+ ;;
+irix* | nonstopux*)
+ symcode='[BCDEGRST]'
+ ;;
+osf*)
+ symcode='[BCDEGQRST]'
+ ;;
+solaris*)
+ symcode='[BDRT]'
+ ;;
+sco3.2v5*)
+ symcode='[DT]'
+ ;;
+sysv4.2uw2*)
+ symcode='[DT]'
+ ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+ symcode='[ABDT]'
+ ;;
+sysv4)
+ symcode='[DFNSTU]'
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+ symcode='[ABCDGIRSTW]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+ opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+ ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+ # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+ symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+ # Write the raw and C identifiers.
+ if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ # Fake it for dumpbin and say T for any non-static function
+ # and D for any global variable.
+ # Also find C++ and __fastcall symbols from MSVC++,
+ # which start with @ or ?.
+ lt_cv_sys_global_symbol_pipe="$AWK '"\
+" {last_section=section; section=\$ 3};"\
+" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+" \$ 0!~/External *\|/{next};"\
+" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+" {if(hide[section]) next};"\
+" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+" s[1]~/^[@?]/{print s[1], s[1]; next};"\
+" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+" ' prfx=^$ac_symprfx"
+ else
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+ fi
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+
+ rm -f conftest*
+ cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5
+ (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && test -s "$nlist"; then
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+ else
+ rm -f "$nlist"T
+ fi
+
+ # Make sure that we snagged all the symbols we need.
+ if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+ if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<_LT_EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+ # Now generate the symbol file.
+ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+ cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols. */
+const struct {
+ const char *name;
+ void *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[] =
+{
+ { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+ cat <<\_LT_EOF >> conftest.$ac_ext
+ {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+ # Now try linking the two files.
+ mv conftest.$ac_objext conftstm.$ac_objext
+ lt_save_LIBS="$LIBS"
+ lt_save_CFLAGS="$CFLAGS"
+ LIBS="conftstm.$ac_objext"
+ CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && test -s conftest${ac_exeext}; then
+ pipe_works=yes
+ fi
+ LIBS="$lt_save_LIBS"
+ CFLAGS="$lt_save_CFLAGS"
+ else
+ echo "cannot find nm_test_func in $nlist" >&5
+ fi
+ else
+ echo "cannot find nm_test_var in $nlist" >&5
+ fi
+ else
+ echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+ fi
+ else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ fi
+ rm -f conftest* conftst*
+
+ # Do not use the global_symbol_pipe unless it works.
+ if test "$pipe_works" = yes; then
+ break
+ else
+ lt_cv_sys_global_symbol_pipe=
+ fi
+done
+
+fi
+
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+ lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+ echo "$as_me:$LINENO: result: failed" >&5
+echo "${ECHO_T}failed" >&6
+else
+ echo "$as_me:$LINENO: result: ok" >&5
+echo "${ECHO_T}ok" >&6
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+ enableval="$enable_libtool_lock"
+
+fi;
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *ELF-32*)
+ HPUX_IA64_MODE="32"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '#line 5729 "configure"' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -melf32bsmip"
+ ;;
+ *N32*)
+ LD="${LD-ld} -melf32bmipn32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -melf64bmip"
+ ;;
+ esac
+ else
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ fi
+ rm -rf conftest*
+ ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.o` in
+ *32-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_i386_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ ppc64-*linux*|powerpc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_x86_64_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*|s390*-*tpf*)
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
+echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6
+if test "${lt_cv_cc_needs_belf+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ lt_cv_cc_needs_belf=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+lt_cv_cc_needs_belf=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
+echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+sparc*-*solaris*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.o` in
+ *64-bit*)
+ case $lt_cv_prog_gnu_ld in
+ yes*) LD="${LD-ld} -m elf64_sparc" ;;
+ *) LD="${LD-ld} -64" ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+esac
+
+need_locks="$enable_libtool_lock"
+
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -5589,21 +6147,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-echo "$as_me:$LINENO: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6
-if test "${ac_cv_prog_egrep+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if echo a | (grep -E '(a|b)') >/dev/null 2>&1
- then ac_cv_prog_egrep='grep -E'
- else ac_cv_prog_egrep='egrep'
- fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
-echo "${ECHO_T}$ac_cv_prog_egrep" >&6
- EGREP=$ac_cv_prog_egrep
-
-
echo "$as_me:$LINENO: checking for ANSI C header files" >&5
echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
if test "${ac_cv_header_stdc+set}" = set; then
@@ -5770,132 +6313,34 @@ _ACEOF
fi
-echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
-echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
-if test "${ac_cv_c_const+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
-int
-main ()
-{
-/* FIXME: Include the comments suggested by Paul. */
-#ifndef __cplusplus
- /* Ultrix mips cc rejects this. */
- typedef int charset[2];
- const charset x;
- /* SunOS 4.1.1 cc rejects this. */
- char const *const *ccp;
- char **p;
- /* NEC SVR4.0.2 mips cc rejects this. */
- struct point {int x, y;};
- static struct point const zero = {0,0};
- /* AIX XL C 1.02.0.0 rejects this.
- It does not let you subtract one const X* pointer from another in
- an arm of an if-expression whose if-part is not a constant
- expression */
- const char *g = "string";
- ccp = &g + (g ? g-g : 0);
- /* HPUX 7.0 cc rejects these. */
- ++ccp;
- p = (char**) ccp;
- ccp = (char const *const *) p;
- { /* SCO 3.2v4 cc rejects this. */
- char *t;
- char const *s = 0 ? (char *) 0 : (char const *) 0;
-
- *t++ = 0;
- }
- { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
- int x[] = {25, 17};
- const int *foo = &x[0];
- ++foo;
- }
- { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
- typedef const int *iptr;
- iptr p = 0;
- ++p;
- }
- { /* AIX XL C 1.02.0.0 rejects this saying
- "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
- struct s { int j; const int *ap[3]; };
- struct s *b; b->j = 5;
- }
- { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
- const int foo = 10;
- }
-#endif
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_c_const=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_c_const=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
-echo "${ECHO_T}$ac_cv_c_const" >&6
-if test $ac_cv_c_const = no; then
-cat >>confdefs.h <<\_ACEOF
-#define const
-_ACEOF
-fi
-echo "$as_me:$LINENO: checking for inline" >&5
-echo $ECHO_N "checking for inline... $ECHO_C" >&6
-if test "${ac_cv_c_inline+set}" = set; then
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_cv_c_inline=no
-for ac_kw in inline __inline__ __inline; do
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-#ifndef __cplusplus
-typedef int foo_t;
-static $ac_kw foo_t static_foo () {return 0; }
-$ac_kw foo_t foo () {return 0; }
-#endif
+$ac_includes_default
+#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
@@ -5919,47 +6364,29 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_cv_c_inline=$ac_kw; break
+ eval "$as_ac_Header=yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
+eval "$as_ac_Header=no"
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-
fi
-echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
-echo "${ECHO_T}$ac_cv_c_inline" >&6
-
-
-case $ac_cv_c_inline in
- inline | yes) ;;
- *)
- case $ac_cv_c_inline in
- no) ac_val=;;
- *) ac_val=$ac_cv_c_inline;;
- esac
- cat >>confdefs.h <<_ACEOF
-#ifndef __cplusplus
-#define inline $ac_val
-#endif
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
- ;;
-esac
-
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
-
-
-
-
+fi
+done
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
- inttypes.h stdint.h unistd.h
+for ac_header in dlfcn.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_header" >&5
@@ -6020,156 +6447,1357 @@ fi
done
-echo "$as_me:$LINENO: checking for off_t" >&5
-echo $ECHO_N "checking for off_t... $ECHO_C" >&6
-if test "${ac_cv_type_off_t+set}" = set; then
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+test -z "$LN_S" && LN_S="ln -s"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+echo "$as_me:$LINENO: checking for objdir" >&5
+echo $ECHO_N "checking for objdir... $ECHO_C" >&6
+if test "${lt_cv_objdir+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if ((off_t *) 0)
- return 0;
-if (sizeof (off_t))
- return 0;
- ;
- return 0;
-}
+ rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+ lt_cv_objdir=.libs
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+fi
+echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5
+echo "${ECHO_T}$lt_cv_objdir" >&6
+objdir=$lt_cv_objdir
+
+
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define LT_OBJDIR "$lt_cv_objdir/"
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_type_off_t=yes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+case $host_os in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+ fi
+ ;;
+esac
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
+echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+ case $MAGIC_CMD in
+[\\/*] | ?:[\\/]*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/${ac_tool_prefix}file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<_LT_EOF 1>&2
-ac_cv_type_off_t=no
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5
-echo "${ECHO_T}$ac_cv_type_off_t" >&6
-if test $ac_cv_type_off_t = yes; then
- :
+
+
+
+
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ echo "$as_me:$LINENO: checking for file" >&5
+echo $ECHO_N "checking for file... $ECHO_C" >&6
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
+ case $MAGIC_CMD in
+[\\/*] | ?:[\\/]*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<_LT_EOF 1>&2
-cat >>confdefs.h <<_ACEOF
-#define off_t long
-_ACEOF
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+_LT_EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac
fi
-echo "$as_me:$LINENO: checking for size_t" >&5
-echo $ECHO_N "checking for size_t... $ECHO_C" >&6
-if test "${ac_cv_type_size_t+set}" = set; then
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+
+ else
+ MAGIC_CMD=:
+ fi
+fi
+
+ fi
+ ;;
+esac
+
+# Use C for the default configuration in the libtool script
+
+lt_save_CC="$CC"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+objext=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM conftest*
+
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+
+lt_prog_compiler_no_builtin_flag=
+
+if test "$GCC" = yes; then
+ lt_prog_compiler_no_builtin_flag=' -fno-builtin'
+
+ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if ((size_t *) 0)
- return 0;
-if (sizeof (size_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_type_size_t=yes
+ lt_cv_prog_compiler_rtti_exceptions=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="-fno-rtti -fno-exceptions"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:6829: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:6833: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_rtti_exceptions=yes
+ fi
+ fi
+ $RM conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+ lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+ :
+fi
-ac_cv_type_size_t=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
+
+
+
+
+ lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
+
+echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
+
+ if test "$GCC" = yes; then
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_static='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ if test "$host_cpu" = m68k; then
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
+ fi
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+
+ mingw* | cygwin* | pw32* | os2*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ lt_prog_compiler_pic='-DDLL_EXPORT'
+ ;;
+
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ lt_prog_compiler_pic='-fno-common'
+ ;;
+
+ hpux*)
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ esac
+ ;;
+
+ interix[3-9]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+
+ msdosdjgpp*)
+ # Just because we use GCC doesn't mean we suddenly get shared libraries
+ # on systems that don't support them.
+ lt_prog_compiler_can_build_shared=no
+ enable_shared=no
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic='-fPIC -shared'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ lt_prog_compiler_pic=-Kconform_pic
+ fi
+ ;;
+
+ *)
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ esac
+ else
+ # PORTME Check for flag to pass linker flags through the system compiler.
+ case $host_os in
+ aix*)
+ lt_prog_compiler_wl='-Wl,'
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static='-Bstatic'
+ else
+ lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+ darwin*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ case $cc_basename in
+ xlc*)
+ lt_prog_compiler_pic='-qnocommon'
+ lt_prog_compiler_wl='-Wl,'
+ ;;
+ esac
+ ;;
+
+ mingw* | cygwin* | pw32* | os2*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ lt_prog_compiler_pic='-DDLL_EXPORT'
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ lt_prog_compiler_wl='-Wl,'
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic='+Z'
+ ;;
+ esac
+ # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ lt_prog_compiler_static='${wl}-a ${wl}archive'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ lt_prog_compiler_wl='-Wl,'
+ # PIC (with -KPIC) is the default.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ linux* | k*bsd*-gnu)
+ case $cc_basename in
+ icc* | ecc*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-static'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95*)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fpic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+ ccc*)
+ lt_prog_compiler_wl='-Wl,'
+ # All Alpha code is PIC.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C 5.9
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl='-Wl,'
+ ;;
+ *Sun\ F*)
+ # Sun Fortran 8.3 passes all unrecognized flags to the linker
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl=''
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ newsos6)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic='-fPIC -shared'
+ ;;
+
+ osf3* | osf4* | osf5*)
+ lt_prog_compiler_wl='-Wl,'
+ # All OSF/1 code is PIC.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ rdos*)
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ solaris*)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ case $cc_basename in
+ f77* | f90* | f95*)
+ lt_prog_compiler_wl='-Qoption ld ';;
+ *)
+ lt_prog_compiler_wl='-Wl,';;
+ esac
+ ;;
+
+ sunos4*)
+ lt_prog_compiler_wl='-Qoption ld '
+ lt_prog_compiler_pic='-PIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ lt_prog_compiler_pic='-Kconform_pic'
+ lt_prog_compiler_static='-Bstatic'
+ fi
+ ;;
+
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ unicos*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_can_build_shared=no
+ ;;
+
+ uts4*)
+ lt_prog_compiler_pic='-pic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ *)
+ lt_prog_compiler_can_build_shared=no
+ ;;
+ esac
+ fi
+
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ lt_prog_compiler_pic=
+ ;;
+ *)
+ lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+ ;;
+esac
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic" >&6
+
+
+
+
+
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic"; then
+ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6
+if test "${lt_prog_compiler_pic_works+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_prog_compiler_pic_works=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:7151: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:7155: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_prog_compiler_pic_works=yes
+ fi
+ fi
+ $RM conftest*
+
fi
-echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
-echo "${ECHO_T}$ac_cv_type_size_t" >&6
-if test $ac_cv_type_size_t = yes; then
- :
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6
+
+if test x"$lt_prog_compiler_pic_works" = xyes; then
+ case $lt_prog_compiler_pic in
+ "" | " "*) ;;
+ *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
+ esac
else
+ lt_prog_compiler_pic=
+ lt_prog_compiler_can_build_shared=no
+fi
-cat >>confdefs.h <<_ACEOF
-#define size_t unsigned
-_ACEOF
+fi
+
+
+
+
+
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
+echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6
+if test "${lt_prog_compiler_static_works+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_prog_compiler_static_works=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_prog_compiler_static_works=yes
+ fi
+ else
+ lt_prog_compiler_static_works=yes
+ fi
+ fi
+ $RM conftest*
+ LDFLAGS="$save_LDFLAGS"
fi
+echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works" >&6
-# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
-# for constant arguments. Useless!
-echo "$as_me:$LINENO: checking for working alloca.h" >&5
-echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6
-if test "${ac_cv_working_alloca_h+set}" = set; then
+if test x"$lt_prog_compiler_static_works" = xyes; then
+ :
+else
+ lt_prog_compiler_static=
+fi
+
+
+
+
+
+
+
+ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat >conftest.$ac_ext <<_ACEOF
+ lt_cv_prog_compiler_c_o=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:7256: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:7260: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6
+
+
+
+
+
+
+ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_cv_prog_compiler_c_o=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:7311: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:7315: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6
+
+
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6
+ hard_links=yes
+ $RM conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6
+ if test "$hard_links" = no; then
+ { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+
+
+
+
+
+
+ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6
+
+ runpath_var=
+ allow_undefined_flag=
+ always_export_symbols=no
+ archive_cmds=
+ archive_expsym_cmds=
+ compiler_needs_object=no
+ enable_shared_with_static_runtimes=no
+ export_dynamic_flag_spec=
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ hardcode_automatic=no
+ hardcode_direct=no
+ hardcode_direct_absolute=no
+ hardcode_libdir_flag_spec=
+ hardcode_libdir_flag_spec_ld=
+ hardcode_libdir_separator=
+ hardcode_minus_L=no
+ hardcode_shlibpath_var=unsupported
+ inherit_rpath=no
+ link_all_deplibs=unknown
+ module_cmds=
+ module_expsym_cmds=
+ old_archive_from_new_cmds=
+ old_archive_from_expsyms_cmds=
+ thread_safe_flag_spec=
+ whole_archive_flag_spec=
+ # include_expsyms should be a list of space-separated symbols to be *always*
+ # included in the symbol list
+ include_expsyms=
+ # exclude_expsyms can be an extended regexp of symbols to exclude
+ # it will be wrapped by ` (' and `)$', so one must not match beginning or
+ # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+ # as well as any symbol that contains `d'.
+ exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
+ # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+ # platforms (ab)use it in PIC code, but their linkers get confused if
+ # the symbol is explicitly referenced. Since portable code cannot
+ # rely on this symbol name, it's probably fine to never include it in
+ # preloaded symbol tables.
+ extract_expsyms_cmds=
+
+ case $host_os in
+ cygwin* | mingw* | pw32*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+ esac
+
+ ld_shlibs=yes
+ if test "$with_gnu_ld" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # Set some defaults for GNU ld with shared library support. These
+ # are reset later if shared libraries are not supported. Putting them
+ # here allows them to be overridden if necessary.
+ runpath_var=LD_RUN_PATH
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ export_dynamic_flag_spec='${wl}--export-dynamic'
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+ whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec=
+ fi
+ supports_anon_versioning=no
+ case `$LD -v 2>&1` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+ *\ 2.11.*) ;; # other 2.11 versions
+ *) supports_anon_versioning=yes ;;
+ esac
+
+ # See if GNU ld supports shared libraries.
+ case $host_os in
+ aix3* | aix4* | aix5*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+_LT_EOF
+ fi
+ ;;
+
+ amigaos*)
+ if test "$host_cpu" = m68k; then
+ archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ fi
+
+ # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+ # that the semantics of dynamic libraries on AmigaOS, at least up
+ # to version 4, is to share data among multiple programs linked
+ # with the same dynamic library. Since this doesn't match the
+ # behavior of shared libraries on other platforms, we can't use
+ # them.
+ ld_shlibs=no
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+ # as there is no search path for DLLs.
+ hardcode_libdir_flag_spec='-L$libdir'
+ allow_undefined_flag=unsupported
+ always_export_symbols=no
+ enable_shared_with_static_runtimes=yes
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ interix[3-9]*)
+ hardcode_direct=no
+ hardcode_shlibpath_var=no
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+
+ gnu* | linux* | tpf* | k*bsd*-gnu)
+ tmp_diet=no
+ if test "$host_os" = linux-dietlibc; then
+ case $cc_basename in
+ diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn)
+ esac
+ fi
+ if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+ && test "$tmp_diet" = no
+ then
+ tmp_addflag=
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag -Mnomain' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ esac
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*) # Sun C 5.9
+ whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+ compiler_needs_object=yes
+ tmp_sharedflag='-G' ;;
+ *Sun\ F*) # Sun Fortran 8.3
+ tmp_sharedflag='-G' ;;
+ *)
+ tmp_sharedflag='-shared' ;;
+ esac
+ archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+ if test "x$supports_anon_versioning" = xyes; then
+ archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ fi
+ ;;
+
+ solaris*)
+ if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ ;;
+ *)
+ # For security reasons, it is highly recommended that you always
+ # use absolute paths for naming shared libraries, and exclude the
+ # DT_RUNPATH tag from executables and libraries. But doing so
+ # requires that you compile everything twice, which is a pain.
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+ ;;
+
+ sunos4*)
+ archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+
+ if test "$ld_shlibs" = no; then
+ runpath_var=
+ hardcode_libdir_flag_spec=
+ export_dynamic_flag_spec=
+ whole_archive_flag_spec=
+ fi
+ else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+ archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L=yes
+ if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ hardcode_direct=unsupported
+ fi
+ ;;
+
+ aix4* | aix5*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+ export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ else
+ export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ fi
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ archive_cmds=''
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ hardcode_libdir_separator=':'
+ link_all_deplibs=yes
+ file_list_spec='${wl}-f,'
+
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[012]|aix4.[012].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" &&
+ strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ :
+ else
+ # We have old collect2
+ hardcode_direct=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ hardcode_minus_L=yes
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_libdir_separator=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ always_export_symbols=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ allow_undefined_flag='-berok'
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-#include <alloca.h>
+
int
main ()
{
-char *p = (char *) alloca (2 * sizeof (int));
+
;
return 0;
}
@@ -6196,62 +7824,49 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_cv_working_alloca_h=yes
+
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_working_alloca_h=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5
-echo "${ECHO_T}$ac_cv_working_alloca_h" >&6
-if test $ac_cv_working_alloca_h = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_ALLOCA_H 1
-_ACEOF
-
-fi
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
-echo "$as_me:$LINENO: checking for alloca" >&5
-echo $ECHO_N "checking for alloca... $ECHO_C" >&6
-if test "${ac_cv_func_alloca_works+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag="-z nodefs"
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-#ifdef __GNUC__
-# define alloca __builtin_alloca
-#else
-# ifdef _MSC_VER
-# include <malloc.h>
-# define alloca _alloca
-# else
-# if HAVE_ALLOCA_H
-# include <alloca.h>
-# else
-# ifdef _AIX
- #pragma alloca
-# else
-# ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-# endif
-# endif
-# endif
-# endif
-#endif
int
main ()
{
-char *p = (char *) alloca (1);
+
;
return 0;
}
@@ -6278,125 +7893,277 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_cv_func_alloca_works=yes
+
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_func_alloca_works=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5
-echo "${ECHO_T}$ac_cv_func_alloca_works" >&6
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ no_undefined_flag=' ${wl}-bernotok'
+ allow_undefined_flag=' ${wl}-berok'
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec='$convenience'
+ archive_cmds_need_lc=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
-if test $ac_cv_func_alloca_works = yes; then
+ amigaos*)
+ if test "$host_cpu" = m68k; then
+ archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ fi
+ # see comment about different semantics on the GNU ld section
+ ld_shlibs=no
+ ;;
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_ALLOCA 1
-_ACEOF
+ bsdi[45]*)
+ export_dynamic_flag_spec=-rdynamic
+ ;;
-else
- # The SVR3 libPW and SVR4 libucb both contain incompatible functions
-# that cause trouble. Some versions do not even contain alloca or
-# contain a buggy version. If you still want to use their alloca,
-# use ar to extract alloca.o from them instead of compiling alloca.c.
+ cygwin* | mingw* | pw32*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec=' '
+ allow_undefined_flag=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ old_archive_from_new_cmds='true'
+ # FIXME: Should let the user specify the lib program.
+ old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+ fix_srcfile_path='`cygpath -w "$srcfile"`'
+ enable_shared_with_static_runtimes=yes
+ ;;
-ALLOCA=alloca.$ac_objext
+ darwin* | rhapsody*)
+ case $host_os in
+ rhapsody* | darwin1.[012])
+ allow_undefined_flag='${wl}-undefined ${wl}suppress'
+ ;;
+ *) # Darwin 1.3 on
+ case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
+ 10.[012])
+ allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ ;;
+ 10.*)
+ allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup'
+ ;;
+ esac
+ ;;
+ esac
+ archive_cmds_need_lc=no
+ hardcode_direct=no
+ hardcode_automatic=yes
+ hardcode_shlibpath_var=unsupported
+ whole_archive_flag_spec=''
+ link_all_deplibs=yes
+ if test "$GCC" = yes ; then
+ if test "${lt_cv_apple_cc_single_mod+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_cv_apple_cc_single_mod=no
+ if test -z "${LT_MULTI_MODULE}"; then
+ # By default we will add the -single_module flag. You can override
+ # by either setting the environment variable LT_MULTI_MODULE
+ # non-empty at configure time, or by adding -multi-module to the
+ # link flags.
+ echo "int foo(void){return 1;}" > conftest.c
+ $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+ -dynamiclib ${wl}-single_module conftest.c
+ if test -f libconftest.dylib; then
+ lt_cv_apple_cc_single_mod=yes
+ rm libconftest.dylib
+ fi
+ rm conftest.$ac_ext
+ fi
+fi
-cat >>confdefs.h <<\_ACEOF
-#define C_ALLOCA 1
-_ACEOF
+ output_verbose_link_cmd=echo
+ if test "X$lt_cv_apple_cc_single_mod" = Xyes ; then
+ archive_cmds='$CC -dynamiclib $single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+ archive_expsym_cmds='sed "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $single_module -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+ archive_expsym_cmds='sed "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ fi
+ module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ module_expsym_cmds='sed -e "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ case $cc_basename in
+ xlc*)
+ output_verbose_link_cmd=echo
+ archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`$ECHO $rpath/$soname` $verstring'
+ module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ archive_expsym_cmds='sed "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ module_expsym_cmds='sed "s,^,_," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ ;;
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+ fi
+ ;;
+ dgux*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
-echo "$as_me:$LINENO: checking whether \`alloca.c' needs Cray hooks" >&5
-echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6
-if test "${ac_cv_os_cray+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#if defined(CRAY) && ! defined(CRAY2)
-webecray
-#else
-wenotbecray
-#endif
+ freebsd1*)
+ ld_shlibs=no
+ ;;
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "webecray" >/dev/null 2>&1; then
- ac_cv_os_cray=yes
-else
- ac_cv_os_cray=no
-fi
-rm -f conftest*
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
-fi
-echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5
-echo "${ECHO_T}$ac_cv_os_cray" >&6
-if test $ac_cv_os_cray = yes; then
- for ac_func in _getb67 GETB67 getb67; do
- as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd* | dragonfly*)
+ archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
+ hpux9*)
+ if test "$GCC" = yes; then
+ archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ fi
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ export_dynamic_flag_spec='${wl}-E'
+ ;;
-#undef $ac_func
+ hpux10*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_flag_spec_ld='+b $libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ export_dynamic_flag_spec='${wl}-E'
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ fi
+ ;;
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
-#endif
+ hpux11*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ else
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ hardcode_direct=no
+ hardcode_shlibpath_var=no
+ ;;
+ *)
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ export_dynamic_flag_spec='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ ;;
+ esac
+ fi
+ ;;
-int
-main ()
-{
-return f != $ac_func;
- ;
- return 0;
-}
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ # Try to use the -exported_symbol ld option, if it does not
+ # work, assume that -exports_file does not work either and
+ # implicitly export all symbols.
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+ cat >conftest.$ac_ext <<_ACEOF
+int foo(void) {}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
@@ -6420,304 +8187,933 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- eval "$as_ac_var=yes"
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-eval "$as_ac_var=no"
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
-if test `eval echo '${'$as_ac_var'}'` = yes; then
+ LDFLAGS="$save_LDFLAGS"
+ else
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ inherit_rpath=yes
+ link_all_deplibs=yes
+ ;;
-cat >>confdefs.h <<_ACEOF
-#define CRAY_STACKSEG_END $ac_func
-_ACEOF
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
- break
-fi
+ newsos6)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_shlibpath_var=no
+ ;;
- done
-fi
+ *nto* | *qnx*)
+ ;;
-echo "$as_me:$LINENO: checking stack direction for C alloca" >&5
-echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6
-if test "${ac_cv_c_stack_direction+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test "$cross_compiling" = yes; then
- ac_cv_c_stack_direction=0
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-int
-find_stack_direction ()
-{
- static char *addr = 0;
- auto char dummy;
- if (addr == 0)
- {
- addr = &dummy;
- return find_stack_direction ();
- }
- else
- return (&dummy > addr) ? 1 : -1;
-}
+ openbsd*)
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ hardcode_direct_absolute=yes
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec='${wl}-E'
+ else
+ case $host_os in
+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ *)
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ ;;
-int
-main ()
-{
- exit (find_stack_direction () < 0);
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_c_stack_direction=1
-else
- echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+ os2*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ allow_undefined_flag=unsupported
+ archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
-( exit $ac_status )
-ac_cv_c_stack_direction=-1
-fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5
-echo "${ECHO_T}$ac_cv_c_stack_direction" >&6
+ osf3*)
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
-cat >>confdefs.h <<_ACEOF
-#define STACK_DIRECTION $ac_cv_c_stack_direction
-_ACEOF
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+ # Both c and cxx compiler support -rpath directly
+ hardcode_libdir_flag_spec='-rpath $libdir'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_separator=:
+ ;;
-fi
+ solaris*)
+ no_undefined_flag=' -z defs'
+ if test "$GCC" = yes; then
+ wlarc='${wl}'
+ archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ else
+ case `$CC -V 2>&1` in
+ *"Compilers 5.0"*)
+ wlarc=''
+ archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+ ;;
+ *)
+ wlarc='${wl}'
+ archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ ;;
+ esac
+ fi
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_shlibpath_var=no
+ case $host_os in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'. GCC discards it without `$wl',
+ # but is careful enough not to reorder.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ if test "$GCC" = yes; then
+ whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ else
+ whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
+ fi
+ ;;
+ esac
+ link_all_deplibs=yes
+ ;;
+ sunos4*)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+ sysv4)
+ case $host_vendor in
+ sni)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ reload_cmds='$CC -r -o $output$reload_objs'
+ hardcode_direct=no
+ ;;
+ motorola)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var=no
+ ;;
-for ac_header in stdlib.h unistd.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ sysv4.3*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ export_dynamic_flag_spec='-Bexport'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ld_shlibs=yes
+ fi
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+ no_undefined_flag='${wl}-z,text'
+ archive_cmds_need_lc=no
+ hardcode_shlibpath_var=no
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ no_undefined_flag='${wl}-z,text'
+ allow_undefined_flag='${wl}-z,nodefs'
+ archive_cmds_need_lc=no
+ hardcode_shlibpath_var=no
+ hardcode_libdir_flag_spec='${wl}-R,$libdir'
+ hardcode_libdir_separator=':'
+ link_all_deplibs=yes
+ export_dynamic_flag_spec='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ uts4*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+
+ if test x$host_vendor = xsni; then
+ case $host in
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
+ ;;
+ esac
+ fi
+ fi
+
+echo "$as_me:$LINENO: result: $ld_shlibs" >&5
+echo "${ECHO_T}$ld_shlibs" >&6
+test "$ld_shlibs" = no && can_build_shared=no
+
+with_gnu_ld=$with_gnu_ld
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc" in
+x|xyes)
+ # Assume -lc should be added
+ archive_cmds_need_lc=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $archive_cmds in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6
+ $RM conftest*
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ (exit $ac_status); } 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$lt_prog_compiler_wl
+ pic_flag=$lt_prog_compiler_pic
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$allow_undefined_flag
+ allow_undefined_flag=
+ if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\"") >&5
+ (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+ (exit $ac_status); }
+ then
+ archive_cmds_need_lc=no
+ else
+ archive_cmds_need_lc=yes
+ fi
+ allow_undefined_flag=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $RM conftest*
+ echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
+echo "${ECHO_T}$archive_cmds_need_lc" >&6
+ ;;
+ esac
+ fi
+ ;;
+esac
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6
+withGCC=$GCC
+if test "$withGCC" = yes; then
+ case $host_os in
+ darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+ *) lt_awk_arg="/^libraries:/" ;;
+ esac
+ lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then
+ # if the path contains ";" then we assume it to be the separator
+ # otherwise default to the standard path separator (i.e. ":") - it is
+ # assumed that no part of a normal pathname contains ";" but that should
+ # okay in the real world where ";" in dirpaths is itself problematic.
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'`
else
- ac_cpp_err=
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+ # Ok, now we have the path, separated by spaces, we can step through it
+ # and add multilib dir if necessary.
+ lt_tmp_lt_search_path_spec=
+ lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+ for lt_sys_path in $lt_search_path_spec; do
+ if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+ else
+ test -d "$lt_sys_path" && \
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+ fi
+ done
+ lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+ lt_foo="";
+ lt_count=0;
+ for (lt_i = NF; lt_i > 0; lt_i--) {
+ if ($lt_i != "" && $lt_i != ".") {
+ if ($lt_i == "..") {
+ lt_count++;
+ } else {
+ if (lt_count == 0) {
+ lt_foo="/" $lt_i lt_foo;
+ } else {
+ lt_count--;
+ }
+ }
+ }
+ }
+ if (lt_foo != "") { lt_freq[lt_foo]++; }
+ if (lt_freq[lt_foo] == 1) { print lt_foo; }
+}'`
+ sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
+else
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
+case $host_os in
+aix3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+ shlibpath_var=LIBPATH
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
+ # AIX 3 has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+
+aix4* | aix5*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ hardcode_into_libs=yes
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # With GCC up to 2.95.x, collect2 would create an import file
+ # for dependence libraries. The import file would start with
+ # the line `#! .'. This would cause the generated library to
+ # depend on `.', always an invalid library. This was fixed in
+ # development snapshots of GCC prior to 3.0.
+ case $host_os in
+ aix4 | aix4.[01] | aix4.[01].*)
+ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+ echo ' yes '
+ echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+ :
+ else
+ can_build_shared=no
+ fi
+ ;;
+ esac
+ # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ fi
+ shlibpath_var=LIBPATH
+ fi
+ ;;
+
+amigaos*)
+ if test "$host_cpu" = m68k; then
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+ else
+ dynamic_linker=no
+ fi
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[45]*)
+ version_type=linux
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw* | pw32*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $withGCC,$host_os in
+ yes,cygwin* | yes,mingw* | yes,pw32*)
+ library_names_spec='$libname.dll.a'
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname~
+ chmod a+x \$dldir/$dlname~
+ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+ eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+ fi'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $RM \$dlpath'
+ shlibpath_overrides_runpath=yes
+
+ case $host_os in
+ cygwin*)
+ # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+ ;;
+ mingw*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+ # It is most probably a Windows format PATH printed by
+ # mingw gcc, but we are running on Cygwin. Gcc prints its search
+ # path with ; separators, and with drive letters. We can handle the
+ # drive letters (cygwin fileutils understands them), so leave them,
+ # especially as we might pass files found there to a mingw objdump,
+ # which wouldn't understand a cygwinified path. Ahh.
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ ;;
+ pw32*)
+ # pw32 DLLs use 'pw' prefix rather than 'lib'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ esac
;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to the AC_PACKAGE_NAME lists. ##
-## ------------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
+
+ *)
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ esac
+ dynamic_linker='Win32 ld.exe'
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ ;;
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
+darwin* | rhapsody*)
+ dynamic_linker="$host_os dyld"
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
-fi
+dgux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
-done
+freebsd1*)
+ dynamic_linker=no
+ ;;
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[123]*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ version_type=freebsd-$objformat
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+ freebsd2*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ freebsd3.[01]* | freebsdelf3.[01]*)
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ *) # from 4.6 on, and DragonFly
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
-for ac_func in getpagesize
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ case $host_cpu in
+ ia64*)
+ shrext_cmds='.so'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.so"
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ if test "X$HPUX_IA64_MODE" = X32; then
+ sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+ else
+ sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+ fi
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ hppa*64*)
+ shrext_cmds='.sl'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ *)
+ shrext_cmds='.sl'
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+ esac
+ # HP-UX runs *really* slowly unless shared libraries are mode 555.
+ postinstall_cmds='chmod 555 $lib'
+ ;;
+
+interix[3-9]*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux
+ else
+ version_type=irix
+ fi ;;
+ esac
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+ case $host_os in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+ libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+ libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+ libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ hardcode_into_libs=yes
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+ dynamic_linker=no
+ ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ # Some binutils ld are patched to set DT_RUNPATH
+ save_LDFLAGS=$LDFLAGS
+ save_libdir=$libdir
+ eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
+ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
-#endif
int
main ()
{
-return f != $ac_func;
+
;
return 0;
}
@@ -6744,200 +9140,236 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- eval "$as_ac_var=yes"
+ if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir"; then
+ shlibpath_overrides_runpath=yes
+fi
+
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-eval "$as_ac_var=no"
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
-if test `eval echo '${'$as_ac_var'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
+ LDFLAGS=$save_LDFLAGS
+ libdir=$save_libdir
+
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ hardcode_into_libs=yes
+
+ # Append ld.so.conf contents to the search path
+ if test -f /etc/ld.so.conf; then
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ fi
-fi
-done
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
+ # powerpc, because MkLinux only supported shared libraries with the
+ # GNU dynamic linker. Since this was broken with cross compilers,
+ # most powerpc-linux boxes support dynamic linking these days and
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
-echo "$as_me:$LINENO: checking for working mmap" >&5
-echo $ECHO_N "checking for working mmap... $ECHO_C" >&6
-if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test "$cross_compiling" = yes; then
- ac_cv_func_mmap_fixed_mapped=no
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-/* malloc might have been renamed as rpl_malloc. */
-#undef malloc
+netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
-/* Thanks to Mike Haertel and Jim Avera for this test.
- Here is a matrix of mmap possibilities:
- mmap private not fixed
- mmap private fixed at somewhere currently unmapped
- mmap private fixed at somewhere already mapped
- mmap shared not fixed
- mmap shared fixed at somewhere currently unmapped
- mmap shared fixed at somewhere already mapped
- For private mappings, we should verify that changes cannot be read()
- back from the file, nor mmap's back from the file at a different
- address. (There have been systems where private was not correctly
- implemented like the infamous i386 svr4.0, and systems where the
- VM page cache was not coherent with the file system buffer cache
- like early versions of FreeBSD and possibly contemporary NetBSD.)
- For shared mappings, we should conversely verify that changes get
- propagated back to all the places they're supposed to be.
+newsos6)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
- Grep wants private fixed already mapped.
- The main things grep needs to know about mmap are:
- * does it exist and is it safe to write into the mmap'd area
- * how to use it (BSD variants) */
+*nto* | *qnx*)
+ version_type=qnx
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='ldqnx.so'
+ ;;
-#include <fcntl.h>
-#include <sys/mman.h>
+openbsd*)
+ version_type=sunos
+ sys_lib_dlsearch_path_spec="/usr/lib"
+ need_lib_prefix=no
+ # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+ case $host_os in
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
+ esac
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ case $host_os in
+ openbsd2.[89] | openbsd2.[89].*)
+ shlibpath_overrides_runpath=no
+ ;;
+ *)
+ shlibpath_overrides_runpath=yes
+ ;;
+ esac
+ else
+ shlibpath_overrides_runpath=yes
+ fi
+ ;;
-#if !STDC_HEADERS && !HAVE_STDLIB_H
-char *malloc ();
-#endif
+os2*)
+ libname_spec='$name'
+ shrext_cmds=".dll"
+ need_lib_prefix=no
+ library_names_spec='$libname${shared_ext} $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
-/* This mess was copied from the GNU getpagesize.h. */
-#if !HAVE_GETPAGESIZE
-/* Assume that all systems that can run configure have sys/param.h. */
-# if !HAVE_SYS_PARAM_H
-# define HAVE_SYS_PARAM_H 1
-# endif
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
-# ifdef _SC_PAGESIZE
-# define getpagesize() sysconf(_SC_PAGESIZE)
-# else /* no _SC_PAGESIZE */
-# if HAVE_SYS_PARAM_H
-# include <sys/param.h>
-# ifdef EXEC_PAGESIZE
-# define getpagesize() EXEC_PAGESIZE
-# else /* no EXEC_PAGESIZE */
-# ifdef NBPG
-# define getpagesize() NBPG * CLSIZE
-# ifndef CLSIZE
-# define CLSIZE 1
-# endif /* no CLSIZE */
-# else /* no NBPG */
-# ifdef NBPC
-# define getpagesize() NBPC
-# else /* no NBPC */
-# ifdef PAGESIZE
-# define getpagesize() PAGESIZE
-# endif /* PAGESIZE */
-# endif /* no NBPC */
-# endif /* no NBPG */
-# endif /* no EXEC_PAGESIZE */
-# else /* no HAVE_SYS_PARAM_H */
-# define getpagesize() 8192 /* punt totally */
-# endif /* no HAVE_SYS_PARAM_H */
-# endif /* no _SC_PAGESIZE */
+rdos*)
+ dynamic_linker=no
+ ;;
-#endif /* no HAVE_GETPAGESIZE */
+solaris*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ ;;
-int
-main ()
-{
- char *data, *data2, *data3;
- int i, pagesize;
- int fd;
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
- pagesize = getpagesize ();
+sysv4 | sysv4.3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_vendor in
+ sni)
+ shlibpath_overrides_runpath=no
+ need_lib_prefix=no
+ runpath_var=LD_RUN_PATH
+ ;;
+ siemens)
+ need_lib_prefix=no
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ ;;
+ esac
+ ;;
- /* First, make a file with some known garbage in it. */
- data = (char *) malloc (pagesize);
- if (!data)
- exit (1);
- for (i = 0; i < pagesize; ++i)
- *(data + i) = rand ();
- umask (0);
- fd = creat ("conftest.mmap", 0600);
- if (fd < 0)
- exit (1);
- if (write (fd, data, pagesize) != pagesize)
- exit (1);
- close (fd);
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux
+ library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+ soname_spec='$libname${shared_ext}.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
- /* Next, try to mmap the file at a fixed address which already has
- something else allocated at it. If we can, also make sure that
- we see the same garbage. */
- fd = open ("conftest.mmap", O_RDWR);
- if (fd < 0)
- exit (1);
- data2 = (char *) malloc (2 * pagesize);
- if (!data2)
- exit (1);
- data2 += (pagesize - ((long) data2 & (pagesize - 1))) & (pagesize - 1);
- if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_FIXED, fd, 0L))
- exit (1);
- for (i = 0; i < pagesize; ++i)
- if (*(data + i) != *(data2 + i))
- exit (1);
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ version_type=freebsd-elf
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ if test "$with_gnu_ld" = yes; then
+ sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ case $host_os in
+ sco3.2v5*)
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+ ;;
+ esac
+ fi
+ sys_lib_dlsearch_path_spec='/usr/lib'
+ ;;
- /* Finally, make sure that changes to the mapped area do not
- percolate back to the file as seen by read(). (This is a bug on
- some variants of i386 svr4.0.) */
- for (i = 0; i < pagesize; ++i)
- *(data2 + i) = *(data2 + i) + 1;
- data3 = (char *) malloc (pagesize);
- if (!data3)
- exit (1);
- if (read (fd, data3, pagesize) != pagesize)
- exit (1);
- for (i = 0; i < pagesize; ++i)
- if (*(data + i) != *(data3 + i))
- exit (1);
- close (fd);
- exit (0);
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_func_mmap_fixed_mapped=yes
-else
- echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+tpf*)
+ # TPF is a cross-target only. Preferred cross-host = GNU/Linux.
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_name_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
-( exit $ac_status )
-ac_cv_func_mmap_fixed_mapped=no
-fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5
-echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6
-if test $ac_cv_func_mmap_fixed_mapped = yes; then
+uts4*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_MMAP 1
-_ACEOF
+*)
+ dynamic_linker=no
+ ;;
+esac
+echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6
+test "$dynamic_linker" = no && can_build_shared=no
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
fi
-rm -f conftest.mmap
@@ -6949,155 +9381,13 @@ rm -f conftest.mmap
-for ac_header in argz.h limits.h locale.h nl_types.h malloc.h string.h \
-unistd.h values.h sys/param.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to the AC_PACKAGE_NAME lists. ##
-## ------------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-fi
-done
@@ -7109,62 +9399,159 @@ done
-for ac_func in getcwd munmap putenv setenv setlocale strchr strcasecmp \
-__argz_count __argz_stringify __argz_next
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" ||
+ test -n "$runpath_var" ||
+ test "X$hardcode_automatic" = "Xyes" ; then
+
+ # We can hardcode non-existent directories.
+ if test "$hardcode_direct" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no &&
+ test "$hardcode_minus_L" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action=unsupported
+fi
+echo "$as_me:$LINENO: result: $hardcode_action" >&5
+echo "${ECHO_T}$hardcode_action" >&6
+
+if test "$hardcode_action" = relink ||
+ test "$inherit_rpath" = yes; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+
+
+
+
+
+
+ if test "x$enable_dlopen" != xyes; then
+ enable_dlopen=unknown
+ enable_dlopen_self=unknown
+ enable_dlopen_self_static=unknown
+else
+ lt_cv_dlopen=no
+ lt_cv_dlopen_libs=
+
+ case $host_os in
+ beos*)
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ;;
+
+ mingw* | pw32*)
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
+ ;;
+
+ cygwin*)
+ lt_cv_dlopen="dlopen"
+ lt_cv_dlopen_libs=
+ ;;
+
+ darwin*)
+ # if libdl is installed we need to link against it
+ echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat >conftest.$ac_ext <<_ACEOF
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
-{
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
-#endif
-
+char dlopen ();
int
main ()
{
-return f != $ac_func;
+dlopen ();
;
return 0;
}
@@ -7191,35 +9578,35 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- eval "$as_ac_var=yes"
+ ac_cv_lib_dl_dlopen=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-eval "$as_ac_var=no"
+ac_cv_lib_dl_dlopen=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
-if test `eval echo '${'$as_ac_var'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
+if test $ac_cv_lib_dl_dlopen = yes; then
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
-fi
-done
+ lt_cv_dlopen="dyld"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+fi
- if test "${ac_cv_func_stpcpy+set}" != "set"; then
+ ;;
-for ac_func in stpcpy
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
+ *)
+ echo "$as_me:$LINENO: checking for shl_load" >&5
+echo $ECHO_N "checking for shl_load... $ECHO_C" >&6
+if test "${ac_cv_func_shl_load+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
@@ -7228,12 +9615,12 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+/* Define shl_load to an innocuous variant, in case <limits.h> declares shl_load.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
+#define shl_load innocuous_shl_load
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
+ which can conflict with char shl_load (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
@@ -7243,7 +9630,7 @@ cat >>conftest.$ac_ext <<_ACEOF
# include <assert.h>
#endif
-#undef $ac_func
+#undef shl_load
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
@@ -7252,14 +9639,14 @@ extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
-char $ac_func ();
+char shl_load ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+#if defined (__stub_shl_load) || defined (__stub___shl_load)
choke me
#else
-char (*f) () = $ac_func;
+char (*f) () = shl_load;
#endif
#ifdef __cplusplus
}
@@ -7268,7 +9655,7 @@ char (*f) () = $ac_func;
int
main ()
{
-return f != $ac_func;
+return f != shl_load;
;
return 0;
}
@@ -7295,52 +9682,46 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- eval "$as_ac_var=yes"
+ ac_cv_func_shl_load=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-eval "$as_ac_var=no"
+ac_cv_func_shl_load=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
-if test `eval echo '${'$as_ac_var'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
- fi
- if test "${ac_cv_func_stpcpy}" = "yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_STPCPY 1
-_ACEOF
-
- fi
-
- if test $ac_cv_header_locale_h = yes; then
- echo "$as_me:$LINENO: checking for LC_MESSAGES" >&5
-echo $ECHO_N "checking for LC_MESSAGES... $ECHO_C" >&6
-if test "${am_cv_val_LC_MESSAGES+set}" = set; then
+echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
+echo "${ECHO_T}$ac_cv_func_shl_load" >&6
+if test $ac_cv_func_shl_load = yes; then
+ lt_cv_dlopen="shl_load"
+else
+ echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat >conftest.$ac_ext <<_ACEOF
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-#include <locale.h>
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char shl_load ();
int
main ()
{
-return LC_MESSAGES
+shl_load ();
;
return 0;
}
@@ -7367,85 +9748,81 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- am_cv_val_LC_MESSAGES=yes
+ ac_cv_lib_dld_shl_load=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-am_cv_val_LC_MESSAGES=no
+ac_cv_lib_dld_shl_load=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $am_cv_val_LC_MESSAGES" >&5
-echo "${ECHO_T}$am_cv_val_LC_MESSAGES" >&6
- if test $am_cv_val_LC_MESSAGES = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LC_MESSAGES 1
-_ACEOF
-
- fi
- fi
- echo "$as_me:$LINENO: checking whether NLS is requested" >&5
-echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6
- # Check whether --enable-nls or --disable-nls was given.
-if test "${enable_nls+set}" = set; then
- enableval="$enable_nls"
- USE_NLS=$enableval
-else
- USE_NLS=yes
-fi;
- echo "$as_me:$LINENO: result: $USE_NLS" >&5
-echo "${ECHO_T}$USE_NLS" >&6
-
-
- USE_INCLUDED_LIBINTL=no
-
- if test "$USE_NLS" = "yes"; then
- echo "$as_me:$LINENO: checking whether included gettext is requested" >&5
-echo $ECHO_N "checking whether included gettext is requested... $ECHO_C" >&6
-
-# Check whether --with-included-gettext or --without-included-gettext was given.
-if test "${with_included_gettext+set}" = set; then
- withval="$with_included_gettext"
- nls_cv_force_use_gnu_gettext=$withval
+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6
+if test $ac_cv_lib_dld_shl_load = yes; then
+ lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"
else
- nls_cv_force_use_gnu_gettext=no
-fi;
- echo "$as_me:$LINENO: result: $nls_cv_force_use_gnu_gettext" >&5
-echo "${ECHO_T}$nls_cv_force_use_gnu_gettext" >&6
-
- nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
- if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
- nls_cv_header_intl=
- nls_cv_header_libgt=
- CATOBJEXT=
-
- if test "${ac_cv_header_libintl_h+set}" = set; then
- echo "$as_me:$LINENO: checking for libintl.h" >&5
-echo $ECHO_N "checking for libintl.h... $ECHO_C" >&6
-if test "${ac_cv_header_libintl_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for dlopen" >&5
+echo $ECHO_N "checking for dlopen... $ECHO_C" >&6
+if test "${ac_cv_func_dlopen+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_libintl_h" >&5
-echo "${ECHO_T}$ac_cv_header_libintl_h" >&6
else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking libintl.h usability" >&5
-echo $ECHO_N "checking libintl.h usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-$ac_includes_default
-#include <libintl.h>
+/* Define dlopen to an innocuous variant, in case <limits.h> declares dlopen.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define dlopen innocuous_dlopen
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char dlopen (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef dlopen
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char dlopen ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_dlopen) || defined (__stub___dlopen)
+choke me
+#else
+char (*f) () = dlopen;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != dlopen;
+ ;
+ return 0;
+}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
@@ -7459,123 +9836,52 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_header_compiler=yes
+ ac_cv_func_dlopen=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_header_compiler=no
+ac_cv_func_dlopen=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking libintl.h presence" >&5
-echo $ECHO_N "checking libintl.h presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <libintl.h>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
+echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
+echo "${ECHO_T}$ac_cv_func_dlopen" >&6
+if test $ac_cv_func_dlopen = yes; then
+ lt_cv_dlopen="dlopen"
else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: libintl.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: libintl.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: libintl.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: libintl.h: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: libintl.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: libintl.h: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: libintl.h: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: libintl.h: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: libintl.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: libintl.h: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: libintl.h: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: libintl.h: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: libintl.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: libintl.h: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: libintl.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: libintl.h: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to the AC_PACKAGE_NAME lists. ##
-## ------------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for libintl.h" >&5
-echo $ECHO_N "checking for libintl.h... $ECHO_C" >&6
-if test "${ac_cv_header_libintl_h+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_header_libintl_h=$ac_header_preproc
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_libintl_h" >&5
-echo "${ECHO_T}$ac_cv_header_libintl_h" >&6
-
-fi
-if test $ac_cv_header_libintl_h = yes; then
- echo "$as_me:$LINENO: checking for gettext in libc" >&5
-echo $ECHO_N "checking for gettext in libc... $ECHO_C" >&6
-if test "${gt_cv_func_gettext_libc+set}" = set; then
+ echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat >conftest.$ac_ext <<_ACEOF
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-#include <libintl.h>
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char dlopen ();
int
main ()
{
-return (int) gettext ("")
+dlopen ();
;
return 0;
}
@@ -7602,27 +9908,29 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- gt_cv_func_gettext_libc=yes
+ ac_cv_lib_dl_dlopen=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-gt_cv_func_gettext_libc=no
+ac_cv_lib_dl_dlopen=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $gt_cv_func_gettext_libc" >&5
-echo "${ECHO_T}$gt_cv_func_gettext_libc" >&6
-
- if test "$gt_cv_func_gettext_libc" != "yes"; then
- echo "$as_me:$LINENO: checking for bindtextdomain in -lintl" >&5
-echo $ECHO_N "checking for bindtextdomain in -lintl... $ECHO_C" >&6
-if test "${ac_cv_lib_intl_bindtextdomain+set}" = set; then
+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
+if test $ac_cv_lib_dl_dlopen = yes; then
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+ echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
+echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6
+if test "${ac_cv_lib_svld_dlopen+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lintl $LIBS"
+LIBS="-lsvld $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -7636,11 +9944,11 @@ extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
-char bindtextdomain ();
+char dlopen ();
int
main ()
{
-bindtextdomain ();
+dlopen ();
;
return 0;
}
@@ -7667,36 +9975,47 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_cv_lib_intl_bindtextdomain=yes
+ ac_cv_lib_svld_dlopen=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_lib_intl_bindtextdomain=no
+ac_cv_lib_svld_dlopen=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_intl_bindtextdomain" >&5
-echo "${ECHO_T}$ac_cv_lib_intl_bindtextdomain" >&6
-if test $ac_cv_lib_intl_bindtextdomain = yes; then
- echo "$as_me:$LINENO: checking for gettext in libintl" >&5
-echo $ECHO_N "checking for gettext in libintl... $ECHO_C" >&6
-if test "${gt_cv_func_gettext_libintl+set}" = set; then
+echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6
+if test $ac_cv_lib_svld_dlopen = yes; then
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+ echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
+echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6
+if test "${ac_cv_lib_dld_dld_link+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat >conftest.$ac_ext <<_ACEOF
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char dld_link ();
int
main ()
{
-return (int) gettext ("")
+dld_link ();
;
return 0;
}
@@ -7723,311 +10042,822 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- gt_cv_func_gettext_libintl=yes
+ ac_cv_lib_dld_dld_link=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-gt_cv_func_gettext_libintl=no
+ac_cv_lib_dld_dld_link=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $gt_cv_func_gettext_libintl" >&5
-echo "${ECHO_T}$gt_cv_func_gettext_libintl" >&6
+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6
+if test $ac_cv_lib_dld_dld_link = yes; then
+ lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"
fi
- fi
- if test "$gt_cv_func_gettext_libc" = "yes" \
- || test "$gt_cv_func_gettext_libintl" = "yes"; then
+fi
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_GETTEXT 1
-_ACEOF
- # Extract the first word of "msgfmt", so it can be a program name with args.
-set dummy msgfmt; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_MSGFMT+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- case "$MSGFMT" in
- /*)
- ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
- ;;
- *)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then
- ac_cv_path_MSGFMT="$ac_dir/$ac_word"
- break
- fi
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="no"
- ;;
-esac
fi
-MSGFMT="$ac_cv_path_MSGFMT"
-if test -n "$MSGFMT"; then
- echo "$as_me:$LINENO: result: $MSGFMT" >&5
-echo "${ECHO_T}$MSGFMT" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+
+
fi
- if test "$MSGFMT" != "no"; then
-for ac_func in dcgettext
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
+
+fi
+
+
+fi
+
+ ;;
+ esac
+
+ if test "x$lt_cv_dlopen" != xno; then
+ enable_dlopen=yes
+ else
+ enable_dlopen=no
+ fi
+
+ case $lt_cv_dlopen in
+ dlopen)
+ save_CPPFLAGS="$CPPFLAGS"
+ test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+ save_LDFLAGS="$LDFLAGS"
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+ save_LIBS="$LIBS"
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
+echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6
+if test "${lt_cv_dlopen_self+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
+ if test "$cross_compiling" = yes; then :
+ lt_cv_dlopen_self=cross
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+#line 10108 "configure"
+#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
-#ifdef __STDC__
-# include <limits.h>
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
#else
-# include <assert.h>
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
#endif
-#undef $ac_func
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
-/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
-extern "C"
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ exit (status);
+}
+_LT_EOF
+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&5 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+ x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+ x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
+ esac
+ else :
+ # compilation failed
+ lt_cv_dlopen_self=no
+ fi
+fi
+rm -fr conftest*
+
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self" >&6
+
+ if test "x$lt_cv_dlopen_self" = xyes; then
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+ echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
+echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6
+if test "${lt_cv_dlopen_self_static+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$cross_compiling" = yes; then :
+ lt_cv_dlopen_self_static=cross
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+#line 10208 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
#else
-char (*f) () = $ac_func;
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
#ifdef __cplusplus
-}
+extern "C" void exit (int);
#endif
-int
-main ()
+void fnord() { int i=42;}
+int main ()
{
-return f != $ac_func;
- ;
- return 0;
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ exit (status);
}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+_LT_EOF
+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- eval "$as_ac_var=yes"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+ (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&5 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+ x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+ x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
+ esac
+ else :
+ # compilation failed
+ lt_cv_dlopen_self_static=no
+ fi
+fi
+rm -fr conftest*
+
-eval "$as_ac_var=no"
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6
+ fi
+
+ CPPFLAGS="$save_CPPFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ LIBS="$save_LIBS"
+ ;;
+ esac
+
+ case $lt_cv_dlopen_self in
+ yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+ *) enable_dlopen_self=unknown ;;
+ esac
+
+ case $lt_cv_dlopen_self_static in
+ yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+ *) enable_dlopen_self_static=unknown ;;
+ esac
fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
-if test `eval echo '${'$as_ac_var'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+striplib=
+old_striplib=
+echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+ test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+ test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+ case $host_os in
+ darwin*)
+ if test -n "$STRIP" ; then
+ striplib="$STRIP -x"
+ old_striplib="$STRIP -S"
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+ fi
+ ;;
+ *)
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+ ;;
+ esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+ # Report which library types will actually be built
+ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6
+ echo "$as_me:$LINENO: result: $can_build_shared" >&5
+echo "${ECHO_T}$can_build_shared" >&6
+
+ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6
+ test "$can_build_shared" = "no" && enable_shared=no
+
+ # On AIX, shared libraries and static libraries use the same namespace, and
+ # are all built from PIC.
+ case $host_os in
+ aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+
+ aix4* | aix5*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+ esac
+ echo "$as_me:$LINENO: result: $enable_shared" >&5
+echo "${ECHO_T}$enable_shared" >&6
+
+ echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6
+ # Make sure either enable_shared or enable_static is yes.
+ test "$enable_shared" = yes || enable_static=yes
+ echo "$as_me:$LINENO: result: $enable_static" >&5
+echo "${ECHO_T}$enable_static" >&6
+
+
+
+
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ac_config_commands="$ac_config_commands libtool"
+
+
+
+
+# Only expand once:
+
+
+
+# Check whether --enable-64-bit-bfd or --disable-64-bit-bfd was given.
+if test "${enable_64_bit_bfd+set}" = set; then
+ enableval="$enable_64_bit_bfd"
+ case "${enableval}" in
+ yes) want64=true ;;
+ no) want64=false ;;
+ *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for 64-bit-bfd option" >&5
+echo "$as_me: error: bad value ${enableval} for 64-bit-bfd option" >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+else
+ want64=false
+fi; # Check whether --enable-targets or --disable-targets was given.
+if test "${enable_targets+set}" = set; then
+ enableval="$enable_targets"
+ case "${enableval}" in
+ yes | "") { { echo "$as_me:$LINENO: error: enable-targets option must specify target names or 'all'" >&5
+echo "$as_me: error: enable-targets option must specify target names or 'all'" >&2;}
+ { (exit 1); exit 1; }; }
+ ;;
+ no) enable_targets= ;;
+ *) enable_targets=$enableval ;;
+esac
+fi; # Check whether --enable-commonbfdlib or --disable-commonbfdlib was given.
+if test "${enable_commonbfdlib+set}" = set; then
+ enableval="$enable_commonbfdlib"
+ case "${enableval}" in
+ yes) commonbfdlib=true ;;
+ no) commonbfdlib=false ;;
+ *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for BFD commonbfdlib option" >&5
+echo "$as_me: error: bad value ${enableval} for BFD commonbfdlib option" >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+fi;
+# Check whether --with-mmap or --without-mmap was given.
+if test "${with_mmap+set}" = set; then
+ withval="$with_mmap"
+ case "${withval}" in
+ yes) want_mmap=true ;;
+ no) want_mmap=false ;;
+ *) { { echo "$as_me:$LINENO: error: bad value ${withval} for BFD with-mmap option" >&5
+echo "$as_me: error: bad value ${withval} for BFD with-mmap option" >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+else
+ want_mmap=false
+fi;
+# Check whether --enable-secureplt or --disable-secureplt was given.
+if test "${enable_secureplt+set}" = set; then
+ enableval="$enable_secureplt"
+ case "${enableval}" in
+ yes) use_secureplt=true ;;
+ no) use_secureplt=false ;;
+ *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for secureplt option" >&5
+echo "$as_me: error: bad value ${enableval} for secureplt option" >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+else
+ use_secureplt=false
+fi; if test $use_secureplt = true; then
+
+cat >>confdefs.h <<\_ACEOF
+#define USE_SECUREPLT 1
_ACEOF
fi
-done
- # Extract the first word of "gmsgfmt", so it can be a program name with args.
-set dummy gmsgfmt; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_GMSGFMT+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+DEBUGDIR=${libdir}/debug
+
+
+# Check whether --with-separate-debug-dir or --without-separate-debug-dir was given.
+if test "${with_separate_debug_dir+set}" = set; then
+ withval="$with_separate_debug_dir"
+ DEBUGDIR="${withval}"
+fi;
+
+
+
+
+# Check whether --with-pkgversion or --without-pkgversion was given.
+if test "${with_pkgversion+set}" = set; then
+ withval="$with_pkgversion"
+ case "$withval" in
+ yes) { { echo "$as_me:$LINENO: error: package version not specified" >&5
+echo "$as_me: error: package version not specified" >&2;}
+ { (exit 1); exit 1; }; } ;;
+ no) PKGVERSION= ;;
+ *) PKGVERSION="($withval) " ;;
+ esac
else
- case $GMSGFMT in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
- ;;
+ PKGVERSION="(GNU Binutils) "
+
+fi;
+
+
+
+
+# Check whether --with-bugurl or --without-bugurl was given.
+if test "${with_bugurl+set}" = set; then
+ withval="$with_bugurl"
+ case "$withval" in
+ yes) { { echo "$as_me:$LINENO: error: bug URL not specified" >&5
+echo "$as_me: error: bug URL not specified" >&2;}
+ { (exit 1); exit 1; }; } ;;
+ no) BUGURL=
+ ;;
+ *) BUGURL="$withval"
+ ;;
+ esac
+else
+ BUGURL="http://www.sourceware.org/bugzilla/"
+
+fi;
+ case ${BUGURL} in
+ "")
+ REPORT_BUGS_TO=
+ REPORT_BUGS_TEXI=
+ ;;
*)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
+ REPORT_BUGS_TO="<$BUGURL>"
+ REPORT_BUGS_TEXI=@uref{`echo "$BUGURL" | sed 's/@/@@/g'`}
+ ;;
+ esac;
- test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
- ;;
+
+
+
+
+GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
+
+# Check whether --enable-werror or --disable-werror was given.
+if test "${enable_werror+set}" = set; then
+ enableval="$enable_werror"
+ case "${enableval}" in
+ yes | y) ERROR_ON_WARNING="yes" ;;
+ no | n) ERROR_ON_WARNING="no" ;;
+ *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-werror" >&5
+echo "$as_me: error: bad value ${enableval} for --enable-werror" >&2;}
+ { (exit 1); exit 1; }; } ;;
+ esac
+fi;
+
+# Enable -Werror by default when using gcc
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+ ERROR_ON_WARNING=yes
+fi
+
+NO_WERROR=
+if test "${ERROR_ON_WARNING}" = yes ; then
+ GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
+ NO_WERROR="-Wno-error"
+fi
+
+if test "${GCC}" = yes ; then
+ WARN_CFLAGS="${GCC_WARN_CFLAGS}"
+fi
+
+# Check whether --enable-build-warnings or --disable-build-warnings was given.
+if test "${enable_build_warnings+set}" = set; then
+ enableval="$enable_build_warnings"
+ case "${enableval}" in
+ yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
+ no) if test "${GCC}" = yes ; then
+ WARN_CFLAGS="-w"
+ fi;;
+ ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
+ WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
+ *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
+ WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
+ *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
esac
+fi;
+
+if test x"$silent" != x"yes" && test x"$WARN_CFLAGS" != x""; then
+ echo "Setting warning flags = $WARN_CFLAGS" 6>&1
fi
-GMSGFMT=$ac_cv_path_GMSGFMT
-if test -n "$GMSGFMT"; then
- echo "$as_me:$LINENO: result: $GMSGFMT" >&5
-echo "${ECHO_T}$GMSGFMT" >&6
+
+
+
+
+ ac_config_headers="$ac_config_headers config.h:config.in"
+
+
+if test -z "$target" ; then
+ { { echo "$as_me:$LINENO: error: Unrecognized target system type; please check config.sub." >&5
+echo "$as_me: error: Unrecognized target system type; please check config.sub." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6
+ # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then
+ enableval="$enable_maintainer_mode"
+ USE_MAINTAINER_MODE=$enableval
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ USE_MAINTAINER_MODE=no
+fi;
+ echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5
+echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6
+
+
+if test $USE_MAINTAINER_MODE = yes; then
+ MAINTAINER_MODE_TRUE=
+ MAINTAINER_MODE_FALSE='#'
+else
+ MAINTAINER_MODE_TRUE='#'
+ MAINTAINER_MODE_FALSE=
fi
- # Extract the first word of "xgettext", so it can be a program name with args.
-set dummy xgettext; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_XGETTEXT+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+ MAINT=$MAINTAINER_MODE_TRUE
+
+
+
+
+if false; then
+ GENINSRC_NEVER_TRUE=
+ GENINSRC_NEVER_FALSE='#'
else
- case "$XGETTEXT" in
- /*)
- ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
- ;;
- *)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then
- ac_cv_path_XGETTEXT="$ac_dir/$ac_word"
- break
- fi
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":"
- ;;
-esac
+ GENINSRC_NEVER_TRUE='#'
+ GENINSRC_NEVER_FALSE=
fi
-XGETTEXT="$ac_cv_path_XGETTEXT"
-if test -n "$XGETTEXT"; then
- echo "$as_me:$LINENO: result: $XGETTEXT" >&5
-echo "${ECHO_T}$XGETTEXT" >&6
+
+ case ${build_alias} in
+ "") build_noncanonical=${build} ;;
+ *) build_noncanonical=${build_alias} ;;
+esac
+
+ case ${host_alias} in
+ "") host_noncanonical=${build_noncanonical} ;;
+ *) host_noncanonical=${host_alias} ;;
+esac
+
+ case ${target_alias} in
+ "") target_noncanonical=${host_noncanonical} ;;
+ *) target_noncanonical=${target_alias} ;;
+esac
+
+echo "$as_me:$LINENO: checking whether to install libbfd" >&5
+echo $ECHO_N "checking whether to install libbfd... $ECHO_C" >&6
+ # Check whether --enable-install-libbfd or --disable-install-libbfd was given.
+if test "${enable_install_libbfd+set}" = set; then
+ enableval="$enable_install_libbfd"
+ install_libbfd_p=$enableval
else
+ if test "${host}" = "${target}" || test "$enable_shared" = "yes"; then
+ install_libbfd_p=yes
+ else
+ install_libbfd_p=no
+ fi
+fi;
+ echo "$as_me:$LINENO: result: $install_libbfd_p" >&5
+echo "${ECHO_T}$install_libbfd_p" >&6
+
+
+if test $install_libbfd_p = yes; then
+ INSTALL_LIBBFD_TRUE=
+ INSTALL_LIBBFD_FALSE='#'
+else
+ INSTALL_LIBBFD_TRUE='#'
+ INSTALL_LIBBFD_FALSE=
+fi
+
+ # Need _noncanonical variables for this.
+
+
+
+
+ # libbfd.a is a host library containing target dependent code
+ bfdlibdir='$(libdir)'
+ bfdincludedir='$(includedir)'
+ if test "${host}" != "${target}"; then
+ bfdlibdir='$(exec_prefix)/$(host_noncanonical)/$(target_noncanonical)/lib'
+ bfdincludedir='$(exec_prefix)/$(host_noncanonical)/$(target_noncanonical)/include'
+ fi
+
+
+
+
+
+
+host64=false
+target64=false
+bfd_default_target_size=32
+
+# host stuff:
+
+ALL_LINGUAS="fr tr ja es sv da zh_CN ro rw vi"
+# If we haven't got the data from the intl directory,
+# assume NLS is disabled.
+USE_NLS=no
+LIBINTL=
+LIBINTL_DEP=
+INCINTL=
+XGETTEXT=
+GMSGFMT=
+POSUB=
+
+if test -f ../intl/config.intl; then
+ . ../intl/config.intl
+fi
+echo "$as_me:$LINENO: checking whether NLS is requested" >&5
+echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6
+if test x"$USE_NLS" != xyes; then
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
-fi
+else
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
+cat >>confdefs.h <<\_ACEOF
+#define ENABLE_NLS 1
_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-int
-main ()
-{
-extern int _nl_msg_cat_cntr;
- return _nl_msg_cat_cntr
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+
+ echo "$as_me:$LINENO: checking for catalogs to be installed" >&5
+echo $ECHO_N "checking for catalogs to be installed... $ECHO_C" >&6
+ # Look for .po and .gmo files in the source directory.
+ CATALOGS=
+ XLINGUAS=
+ for cat in $srcdir/po/*.gmo $srcdir/po/*.po; do
+ # If there aren't any .gmo files the shell will give us the
+ # literal string "../path/to/srcdir/po/*.gmo" which has to be
+ # weeded out.
+ case "$cat" in *\**)
+ continue;;
+ esac
+ # The quadruple backslash is collapsed to a double backslash
+ # by the backticks, then collapsed again by the double quotes,
+ # leaving us with one backslash in the sed expression (right
+ # before the dot that mustn't act as a wildcard).
+ cat=`echo $cat | sed -e "s!$srcdir/po/!!" -e "s!\\\\.po!.gmo!"`
+ lang=`echo $cat | sed -e "s!\\\\.gmo!!"`
+ # The user is allowed to set LINGUAS to a list of languages to
+ # install catalogs for. If it's empty that means "all of them."
+ if test "x$LINGUAS" = x; then
+ CATALOGS="$CATALOGS $cat"
+ XLINGUAS="$XLINGUAS $lang"
+ else
+ case "$LINGUAS" in *$lang*)
+ CATALOGS="$CATALOGS $cat"
+ XLINGUAS="$XLINGUAS $lang"
+ ;;
+ esac
+ fi
+ done
+ LINGUAS="$XLINGUAS"
+ echo "$as_me:$LINENO: result: $LINGUAS" >&5
+echo "${ECHO_T}$LINGUAS" >&6
+
+
+ DATADIRNAME=share
+
+ INSTOBJEXT=.mo
+
+ GENCAT=gencat
+
CATOBJEXT=.gmo
- DATADIRNAME=share
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-CATOBJEXT=.mo
- DATADIRNAME=lib
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
- INSTOBJEXT=.mo
- fi
- fi
-fi
+ MKINSTALLDIRS=
+ if test -n "$ac_aux_dir"; then
+ case "$ac_aux_dir" in
+ /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;;
+ *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;;
+ esac
+ fi
+ if test -z "$MKINSTALLDIRS"; then
+ MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
+ fi
+ echo "$as_me:$LINENO: checking whether NLS is requested" >&5
+echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6
+ # Check whether --enable-nls or --disable-nls was given.
+if test "${enable_nls+set}" = set; then
+ enableval="$enable_nls"
+ USE_NLS=$enableval
+else
+ USE_NLS=yes
+fi;
+ echo "$as_me:$LINENO: result: $USE_NLS" >&5
+echo "${ECHO_T}$USE_NLS" >&6
+
+
- if test x"$CATOBJEXT" = x && test -d $srcdir/../intl; then
- # Neither gettext nor catgets in included in the C library.
- # Fall back on GNU gettext library (assuming it is present).
- nls_cv_use_gnu_gettext=yes
- fi
- fi
- if test "$nls_cv_use_gnu_gettext" = "yes"; then
- INTLOBJS="\$(GETTOBJS)"
- # Extract the first word of "msgfmt", so it can be a program name with args.
+
+
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+# Find out how to test for executable files. Don't use a zero-byte file,
+# as systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+ ac_executable_p="test -x"
+else
+ ac_executable_p="test -f"
+fi
+rm -f conf$$.file
+
+# Extract the first word of "msgfmt", so it can be a program name with args.
set dummy msgfmt; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
@@ -8035,27 +10865,31 @@ if test "${ac_cv_path_MSGFMT+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
case "$MSGFMT" in
- /*)
- ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
- ;;
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
+ ;;
*)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then
- ac_cv_path_MSGFMT="$ac_dir/$ac_word"
- break
- fi
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="msgfmt"
- ;;
+ ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$ac_save_IFS"
+ test -z "$ac_dir" && ac_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
+ if $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
+ (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
+ ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exec_ext"
+ break 2
+ fi
+ fi
+ done
+ done
+ IFS="$ac_save_IFS"
+ test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":"
+ ;;
esac
fi
MSGFMT="$ac_cv_path_MSGFMT"
-if test -n "$MSGFMT"; then
+if test "$MSGFMT" != ":"; then
echo "$as_me:$LINENO: result: $MSGFMT" >&5
echo "${ECHO_T}$MSGFMT" >&6
else
@@ -8063,7 +10897,7 @@ else
echo "${ECHO_T}no" >&6
fi
- # Extract the first word of "gmsgfmt", so it can be a program name with args.
+ # Extract the first word of "gmsgfmt", so it can be a program name with args.
set dummy gmsgfmt; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
@@ -8103,7 +10937,37 @@ else
echo "${ECHO_T}no" >&6
fi
- # Extract the first word of "xgettext", so it can be a program name with args.
+
+
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+# Find out how to test for executable files. Don't use a zero-byte file,
+# as systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+ ac_executable_p="test -x"
+else
+ ac_executable_p="test -f"
+fi
+rm -f conf$$.file
+
+# Extract the first word of "xgettext", so it can be a program name with args.
set dummy xgettext; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
@@ -8111,27 +10975,31 @@ if test "${ac_cv_path_XGETTEXT+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
case "$XGETTEXT" in
- /*)
- ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
- ;;
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
+ ;;
*)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then
- ac_cv_path_XGETTEXT="$ac_dir/$ac_word"
- break
- fi
- fi
- done
- IFS="$ac_save_ifs"
+ ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$ac_save_IFS"
+ test -z "$ac_dir" && ac_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
+ if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
+ (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
+ ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext"
+ break 2
+ fi
+ fi
+ done
+ done
+ IFS="$ac_save_IFS"
test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":"
- ;;
+ ;;
esac
fi
XGETTEXT="$ac_cv_path_XGETTEXT"
-if test -n "$XGETTEXT"; then
+if test "$XGETTEXT" != ":"; then
echo "$as_me:$LINENO: result: $XGETTEXT" >&5
echo "${ECHO_T}$XGETTEXT" >&6
else
@@ -8139,282 +11007,103 @@ else
echo "${ECHO_T}no" >&6
fi
+ rm -f messages.po
- USE_INCLUDED_LIBINTL=yes
- CATOBJEXT=.gmo
- INSTOBJEXT=.mo
- DATADIRNAME=share
- INTLDEPS='$(top_builddir)/../intl/libintl.a'
- INTLLIBS=$INTLDEPS
- LIBS=`echo $LIBS | sed -e 's/-lintl//'`
- nls_cv_header_intl=libintl.h
- nls_cv_header_libgt=libgettext.h
- fi
-
- if test "$XGETTEXT" != ":"; then
- if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
- : ;
- else
- echo "$as_me:$LINENO: result: found xgettext programs is not GNU xgettext; ignore it" >&5
-echo "${ECHO_T}found xgettext programs is not GNU xgettext; ignore it" >&6
- XGETTEXT=":"
- fi
- fi
-
- # We need to process the po/ directory.
- POSUB=po
- else
- DATADIRNAME=share
- nls_cv_header_intl=libintl.h
- nls_cv_header_libgt=libgettext.h
- fi
-
- # If this is used in GNU gettext we have to set USE_NLS to `yes'
- # because some of the sources are only built for this goal.
- if test "$PACKAGE" = gettext; then
- USE_NLS=yes
- USE_INCLUDED_LIBINTL=yes
- fi
-
- for lang in $ALL_LINGUAS; do
- GMOFILES="$GMOFILES $lang.gmo"
- POFILES="$POFILES $lang.po"
- done
-
-
-
-
-
-
-
-
-
-
-
-
- if test "x$CATOBJEXT" != "x"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define ENABLE_NLS 1
-_ACEOF
-
- fi
-
-
- if test "x$CATOBJEXT" != "x"; then
- if test "x$ALL_LINGUAS" = "x"; then
- LINGUAS=
- else
- echo "$as_me:$LINENO: checking for catalogs to be installed" >&5
-echo $ECHO_N "checking for catalogs to be installed... $ECHO_C" >&6
- NEW_LINGUAS=
- for lang in ${LINGUAS=$ALL_LINGUAS}; do
- case "$ALL_LINGUAS" in
- *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
- esac
- done
- LINGUAS=$NEW_LINGUAS
- echo "$as_me:$LINENO: result: $LINGUAS" >&5
-echo "${ECHO_T}$LINGUAS" >&6
- fi
-
- if test -n "$LINGUAS"; then
- for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
- fi
- fi
-
- if test $ac_cv_header_locale_h = yes; then
- INCLUDE_LOCALE_H="#include <locale.h>"
- else
- INCLUDE_LOCALE_H="\
-/* The system does not provide the header <locale.h>. Take care yourself. */"
- fi
-
-
- if test -f $srcdir/po2tbl.sed.in; then
- if test "$CATOBJEXT" = ".cat"; then
- if test "${ac_cv_header_linux_version_h+set}" = set; then
- echo "$as_me:$LINENO: checking for linux/version.h" >&5
-echo $ECHO_N "checking for linux/version.h... $ECHO_C" >&6
-if test "${ac_cv_header_linux_version_h+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_linux_version_h" >&5
-echo "${ECHO_T}$ac_cv_header_linux_version_h" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking linux/version.h usability" >&5
-echo $ECHO_N "checking linux/version.h usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <linux/version.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-# Is the header present?
-echo "$as_me:$LINENO: checking linux/version.h presence" >&5
-echo $ECHO_N "checking linux/version.h presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <linux/version.h>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
else
- ac_cpp_err=
+ PATH_SEPARATOR=:
fi
-else
- ac_cpp_err=yes
+ rm -f conf$$.sh
fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
- ac_header_preproc=no
+# Find out how to test for executable files. Don't use a zero-byte file,
+# as systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+ ac_executable_p="test -x"
+else
+ ac_executable_p="test -f"
fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
+rm -f conf$$.file
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: linux/version.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: linux/version.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: linux/version.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: linux/version.h: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
+# Extract the first word of "msgmerge", so it can be a program name with args.
+set dummy msgmerge; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_MSGMERGE+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case "$MSGMERGE" in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path.
;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: linux/version.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: linux/version.h: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: linux/version.h: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: linux/version.h: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: linux/version.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: linux/version.h: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: linux/version.h: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: linux/version.h: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: linux/version.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: linux/version.h: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: linux/version.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: linux/version.h: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to the AC_PACKAGE_NAME lists. ##
-## ------------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
+ *)
+ ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$ac_save_IFS"
+ test -z "$ac_dir" && ac_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
+ if $ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1; then
+ ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext"
+ break 2
+ fi
+ fi
+ done
+ done
+ IFS="$ac_save_IFS"
+ test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":"
;;
esac
-echo "$as_me:$LINENO: checking for linux/version.h" >&5
-echo $ECHO_N "checking for linux/version.h... $ECHO_C" >&6
-if test "${ac_cv_header_linux_version_h+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_header_linux_version_h=$ac_header_preproc
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_linux_version_h" >&5
-echo "${ECHO_T}$ac_cv_header_linux_version_h" >&6
-
fi
-if test $ac_cv_header_linux_version_h = yes; then
- msgformat=linux
+MSGMERGE="$ac_cv_path_MSGMERGE"
+if test "$MSGMERGE" != ":"; then
+ echo "$as_me:$LINENO: result: $MSGMERGE" >&5
+echo "${ECHO_T}$MSGMERGE" >&6
else
- msgformat=xopen
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
+ if test "$GMSGFMT" != ":"; then
+ if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 &&
+ (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
+ : ;
+ else
+ GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'`
+ echo "$as_me:$LINENO: result: found $GMSGFMT program is not GNU msgfmt; ignore it" >&5
+echo "${ECHO_T}found $GMSGFMT program is not GNU msgfmt; ignore it" >&6
+ GMSGFMT=":"
+ fi
+ fi
- sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed
- fi
- sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
- $srcdir/po2tbl.sed.in > po2tbl.sed
- fi
-
- if test "$PACKAGE" = "gettext"; then
- GT_NO="#NO#"
- GT_YES=
- else
- GT_NO=
- GT_YES="#YES#"
- fi
-
-
-
- MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs"
+ if test "$XGETTEXT" != ":"; then
+ if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
+ (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
+ : ;
+ else
+ echo "$as_me:$LINENO: result: found xgettext program is not GNU xgettext; ignore it" >&5
+echo "${ECHO_T}found xgettext program is not GNU xgettext; ignore it" >&6
+ XGETTEXT=":"
+ fi
+ rm -f messages.po
+ fi
+ ac_config_commands="$ac_config_commands default-1"
- l=
-
-
- if test -f $srcdir/po/POTFILES.in; then
- test -d po || mkdir po
- if test "x$srcdir" != "x."; then
- if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
- posrcprefix="$srcdir/"
- else
- posrcprefix="../$srcdir/"
- fi
- else
- posrcprefix="../"
- fi
- rm -f po/POTFILES
- sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
- < $srcdir/po/POTFILES.in > po/POTFILES
- fi
# Permit host specific settings.
@@ -9760,6 +12449,2853 @@ fi
done
+
+
+inttype_headers=`echo inttypes.h sys/inttypes.h | sed -e 's/,/ /g'`
+
+acx_cv_header_stdint=stddef.h
+acx_cv_header_stdint_kind="(already complete)"
+for i in stdint.h $inttype_headers; do
+ unset ac_cv_type_uintptr_t
+ unset ac_cv_type_uintmax_t
+ unset ac_cv_type_int_least32_t
+ unset ac_cv_type_int_fast32_t
+ unset ac_cv_type_uint64_t
+ echo $ECHO_N "looking for a compliant stdint.h in $i, $ECHO_C" >&6
+ echo "$as_me:$LINENO: checking for uintmax_t" >&5
+echo $ECHO_N "checking for uintmax_t... $ECHO_C" >&6
+if test "${ac_cv_type_uintmax_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <$i>
+
+int
+main ()
+{
+if ((uintmax_t *) 0)
+ return 0;
+if (sizeof (uintmax_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_uintmax_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_uintmax_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_uintmax_t" >&5
+echo "${ECHO_T}$ac_cv_type_uintmax_t" >&6
+if test $ac_cv_type_uintmax_t = yes; then
+ acx_cv_header_stdint=$i
+else
+ continue
+fi
+
+ echo "$as_me:$LINENO: checking for uintptr_t" >&5
+echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6
+if test "${ac_cv_type_uintptr_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <$i>
+
+int
+main ()
+{
+if ((uintptr_t *) 0)
+ return 0;
+if (sizeof (uintptr_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_uintptr_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_uintptr_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5
+echo "${ECHO_T}$ac_cv_type_uintptr_t" >&6
+if test $ac_cv_type_uintptr_t = yes; then
+ :
+else
+ acx_cv_header_stdint_kind="(mostly complete)"
+fi
+
+ echo "$as_me:$LINENO: checking for int_least32_t" >&5
+echo $ECHO_N "checking for int_least32_t... $ECHO_C" >&6
+if test "${ac_cv_type_int_least32_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <$i>
+
+int
+main ()
+{
+if ((int_least32_t *) 0)
+ return 0;
+if (sizeof (int_least32_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_int_least32_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_int_least32_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_int_least32_t" >&5
+echo "${ECHO_T}$ac_cv_type_int_least32_t" >&6
+if test $ac_cv_type_int_least32_t = yes; then
+ :
+else
+ acx_cv_header_stdint_kind="(mostly complete)"
+fi
+
+ echo "$as_me:$LINENO: checking for int_fast32_t" >&5
+echo $ECHO_N "checking for int_fast32_t... $ECHO_C" >&6
+if test "${ac_cv_type_int_fast32_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <$i>
+
+int
+main ()
+{
+if ((int_fast32_t *) 0)
+ return 0;
+if (sizeof (int_fast32_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_int_fast32_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_int_fast32_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_int_fast32_t" >&5
+echo "${ECHO_T}$ac_cv_type_int_fast32_t" >&6
+if test $ac_cv_type_int_fast32_t = yes; then
+ :
+else
+ acx_cv_header_stdint_kind="(mostly complete)"
+fi
+
+ echo "$as_me:$LINENO: checking for uint64_t" >&5
+echo $ECHO_N "checking for uint64_t... $ECHO_C" >&6
+if test "${ac_cv_type_uint64_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <$i>
+
+int
+main ()
+{
+if ((uint64_t *) 0)
+ return 0;
+if (sizeof (uint64_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_uint64_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_uint64_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_uint64_t" >&5
+echo "${ECHO_T}$ac_cv_type_uint64_t" >&6
+if test $ac_cv_type_uint64_t = yes; then
+ :
+else
+ acx_cv_header_stdint_kind="(lacks uint64_t)"
+fi
+
+ break
+done
+if test "$acx_cv_header_stdint" = stddef.h; then
+ acx_cv_header_stdint_kind="(lacks uintmax_t)"
+ for i in stdint.h $inttype_headers; do
+ unset ac_cv_type_uintptr_t
+ unset ac_cv_type_uint32_t
+ unset ac_cv_type_uint64_t
+ echo $ECHO_N "looking for an incomplete stdint.h in $i, $ECHO_C" >&6
+ echo "$as_me:$LINENO: checking for uint32_t" >&5
+echo $ECHO_N "checking for uint32_t... $ECHO_C" >&6
+if test "${ac_cv_type_uint32_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <$i>
+
+int
+main ()
+{
+if ((uint32_t *) 0)
+ return 0;
+if (sizeof (uint32_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_uint32_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_uint32_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_uint32_t" >&5
+echo "${ECHO_T}$ac_cv_type_uint32_t" >&6
+if test $ac_cv_type_uint32_t = yes; then
+ acx_cv_header_stdint=$i
+else
+ continue
+fi
+
+ echo "$as_me:$LINENO: checking for uint64_t" >&5
+echo $ECHO_N "checking for uint64_t... $ECHO_C" >&6
+if test "${ac_cv_type_uint64_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <$i>
+
+int
+main ()
+{
+if ((uint64_t *) 0)
+ return 0;
+if (sizeof (uint64_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_uint64_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_uint64_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_uint64_t" >&5
+echo "${ECHO_T}$ac_cv_type_uint64_t" >&6
+
+ echo "$as_me:$LINENO: checking for uintptr_t" >&5
+echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6
+if test "${ac_cv_type_uintptr_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <$i>
+
+int
+main ()
+{
+if ((uintptr_t *) 0)
+ return 0;
+if (sizeof (uintptr_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_uintptr_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_uintptr_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5
+echo "${ECHO_T}$ac_cv_type_uintptr_t" >&6
+
+ break
+ done
+fi
+if test "$acx_cv_header_stdint" = stddef.h; then
+ acx_cv_header_stdint_kind="(u_intXX_t style)"
+ for i in sys/types.h $inttype_headers; do
+ unset ac_cv_type_u_int32_t
+ unset ac_cv_type_u_int64_t
+ echo $ECHO_N "looking for u_intXX_t types in $i, $ECHO_C" >&6
+ echo "$as_me:$LINENO: checking for u_int32_t" >&5
+echo $ECHO_N "checking for u_int32_t... $ECHO_C" >&6
+if test "${ac_cv_type_u_int32_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <$i>
+
+int
+main ()
+{
+if ((u_int32_t *) 0)
+ return 0;
+if (sizeof (u_int32_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_u_int32_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_u_int32_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_u_int32_t" >&5
+echo "${ECHO_T}$ac_cv_type_u_int32_t" >&6
+if test $ac_cv_type_u_int32_t = yes; then
+ acx_cv_header_stdint=$i
+else
+ continue
+fi
+
+ echo "$as_me:$LINENO: checking for u_int64_t" >&5
+echo $ECHO_N "checking for u_int64_t... $ECHO_C" >&6
+if test "${ac_cv_type_u_int64_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <$i>
+
+int
+main ()
+{
+if ((u_int64_t *) 0)
+ return 0;
+if (sizeof (u_int64_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_u_int64_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_u_int64_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_u_int64_t" >&5
+echo "${ECHO_T}$ac_cv_type_u_int64_t" >&6
+
+ break
+ done
+fi
+if test "$acx_cv_header_stdint" = stddef.h; then
+ acx_cv_header_stdint_kind="(using manual detection)"
+fi
+
+test -z "$ac_cv_type_uintptr_t" && ac_cv_type_uintptr_t=no
+test -z "$ac_cv_type_uint64_t" && ac_cv_type_uint64_t=no
+test -z "$ac_cv_type_u_int64_t" && ac_cv_type_u_int64_t=no
+test -z "$ac_cv_type_int_least32_t" && ac_cv_type_int_least32_t=no
+test -z "$ac_cv_type_int_fast32_t" && ac_cv_type_int_fast32_t=no
+
+# ----------------- Summarize what we found so far
+
+echo "$as_me:$LINENO: checking what to include in bfd_stdint.h" >&5
+echo $ECHO_N "checking what to include in bfd_stdint.h... $ECHO_C" >&6
+
+case `$as_basename bfd_stdint.h ||
+$as_expr X/bfd_stdint.h : '.*/\([^/][^/]*\)/*$' \| \
+ Xbfd_stdint.h : 'X\(//\)$' \| \
+ Xbfd_stdint.h : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X/bfd_stdint.h |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'` in
+ stdint.h) { echo "$as_me:$LINENO: WARNING: are you sure you want it there?" >&5
+echo "$as_me: WARNING: are you sure you want it there?" >&2;} ;;
+ inttypes.h) { echo "$as_me:$LINENO: WARNING: are you sure you want it there?" >&5
+echo "$as_me: WARNING: are you sure you want it there?" >&2;} ;;
+ *) ;;
+esac
+
+echo "$as_me:$LINENO: result: $acx_cv_header_stdint $acx_cv_header_stdint_kind" >&5
+echo "${ECHO_T}$acx_cv_header_stdint $acx_cv_header_stdint_kind" >&6
+
+# ----------------- done included file, check C basic types --------
+
+# Lacking an uintptr_t? Test size of void *
+case "$acx_cv_header_stdint:$ac_cv_type_uintptr_t" in
+ stddef.h:* | *:no) echo "$as_me:$LINENO: checking for void *" >&5
+echo $ECHO_N "checking for void *... $ECHO_C" >&6
+if test "${ac_cv_type_void_p+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((void * *) 0)
+ return 0;
+if (sizeof (void *))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_void_p=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_void_p=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_void_p" >&5
+echo "${ECHO_T}$ac_cv_type_void_p" >&6
+
+echo "$as_me:$LINENO: checking size of void *" >&5
+echo $ECHO_N "checking size of void *... $ECHO_C" >&6
+if test "${ac_cv_sizeof_void_p+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$ac_cv_type_void_p" = yes; then
+ # The cast to unsigned long works around a bug in the HP C Compiler
+ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+ # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+ # This bug is HP SR number 8606223364.
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (void *))) >= 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (void *))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr $ac_mid + 1`
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (void *))) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (void *))) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_hi=`expr '(' $ac_mid ')' - 1`
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo= ac_hi=
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (void *))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_void_p=$ac_lo;;
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (void *), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (void *), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+else
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+long longval () { return (long) (sizeof (void *)); }
+unsigned long ulongval () { return (long) (sizeof (void *)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ exit (1);
+ if (((long) (sizeof (void *))) < 0)
+ {
+ long i = longval ();
+ if (i != ((long) (sizeof (void *))))
+ exit (1);
+ fprintf (f, "%ld\n", i);
+ }
+ else
+ {
+ unsigned long i = ulongval ();
+ if (i != ((long) (sizeof (void *))))
+ exit (1);
+ fprintf (f, "%lu\n", i);
+ }
+ exit (ferror (f) || fclose (f) != 0);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sizeof_void_p=`cat conftest.val`
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (void *), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (void *), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.val
+else
+ ac_cv_sizeof_void_p=0
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_void_p" >&5
+echo "${ECHO_T}$ac_cv_sizeof_void_p" >&6
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
+_ACEOF
+
+ ;;
+esac
+
+# Lacking an uint64_t? Test size of long
+case "$acx_cv_header_stdint:$ac_cv_type_uint64_t:$ac_cv_type_u_int64_t" in
+ stddef.h:*:* | *:no:no) echo "$as_me:$LINENO: checking for long" >&5
+echo $ECHO_N "checking for long... $ECHO_C" >&6
+if test "${ac_cv_type_long+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((long *) 0)
+ return 0;
+if (sizeof (long))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_long=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_long=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5
+echo "${ECHO_T}$ac_cv_type_long" >&6
+
+echo "$as_me:$LINENO: checking size of long" >&5
+echo $ECHO_N "checking size of long... $ECHO_C" >&6
+if test "${ac_cv_sizeof_long+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$ac_cv_type_long" = yes; then
+ # The cast to unsigned long works around a bug in the HP C Compiler
+ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+ # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+ # This bug is HP SR number 8606223364.
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) >= 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr $ac_mid + 1`
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_hi=`expr '(' $ac_mid ')' - 1`
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo= ac_hi=
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_long=$ac_lo;;
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (long), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+else
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+long longval () { return (long) (sizeof (long)); }
+unsigned long ulongval () { return (long) (sizeof (long)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ exit (1);
+ if (((long) (sizeof (long))) < 0)
+ {
+ long i = longval ();
+ if (i != ((long) (sizeof (long))))
+ exit (1);
+ fprintf (f, "%ld\n", i);
+ }
+ else
+ {
+ unsigned long i = ulongval ();
+ if (i != ((long) (sizeof (long))))
+ exit (1);
+ fprintf (f, "%lu\n", i);
+ }
+ exit (ferror (f) || fclose (f) != 0);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sizeof_long=`cat conftest.val`
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (long), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.val
+else
+ ac_cv_sizeof_long=0
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5
+echo "${ECHO_T}$ac_cv_sizeof_long" >&6
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG $ac_cv_sizeof_long
+_ACEOF
+
+ ;;
+esac
+
+if test $acx_cv_header_stdint = stddef.h; then
+ # Lacking a good header? Test size of everything and deduce all types.
+ echo "$as_me:$LINENO: checking for int" >&5
+echo $ECHO_N "checking for int... $ECHO_C" >&6
+if test "${ac_cv_type_int+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((int *) 0)
+ return 0;
+if (sizeof (int))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_int=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_int=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5
+echo "${ECHO_T}$ac_cv_type_int" >&6
+
+echo "$as_me:$LINENO: checking size of int" >&5
+echo $ECHO_N "checking size of int... $ECHO_C" >&6
+if test "${ac_cv_sizeof_int+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$ac_cv_type_int" = yes; then
+ # The cast to unsigned long works around a bug in the HP C Compiler
+ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+ # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+ # This bug is HP SR number 8606223364.
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (int))) >= 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr $ac_mid + 1`
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (int))) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (int))) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_hi=`expr '(' $ac_mid ')' - 1`
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo= ac_hi=
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_int=$ac_lo;;
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (int), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+else
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+long longval () { return (long) (sizeof (int)); }
+unsigned long ulongval () { return (long) (sizeof (int)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ exit (1);
+ if (((long) (sizeof (int))) < 0)
+ {
+ long i = longval ();
+ if (i != ((long) (sizeof (int))))
+ exit (1);
+ fprintf (f, "%ld\n", i);
+ }
+ else
+ {
+ unsigned long i = ulongval ();
+ if (i != ((long) (sizeof (int))))
+ exit (1);
+ fprintf (f, "%lu\n", i);
+ }
+ exit (ferror (f) || fclose (f) != 0);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sizeof_int=`cat conftest.val`
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (int), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.val
+else
+ ac_cv_sizeof_int=0
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5
+echo "${ECHO_T}$ac_cv_sizeof_int" >&6
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_INT $ac_cv_sizeof_int
+_ACEOF
+
+
+ echo "$as_me:$LINENO: checking for short" >&5
+echo $ECHO_N "checking for short... $ECHO_C" >&6
+if test "${ac_cv_type_short+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((short *) 0)
+ return 0;
+if (sizeof (short))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_short=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_short=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_short" >&5
+echo "${ECHO_T}$ac_cv_type_short" >&6
+
+echo "$as_me:$LINENO: checking size of short" >&5
+echo $ECHO_N "checking size of short... $ECHO_C" >&6
+if test "${ac_cv_sizeof_short+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$ac_cv_type_short" = yes; then
+ # The cast to unsigned long works around a bug in the HP C Compiler
+ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+ # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+ # This bug is HP SR number 8606223364.
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (short))) >= 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (short))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr $ac_mid + 1`
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (short))) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (short))) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_hi=`expr '(' $ac_mid ')' - 1`
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo= ac_hi=
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (short))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_short=$ac_lo;;
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (short), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+else
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+long longval () { return (long) (sizeof (short)); }
+unsigned long ulongval () { return (long) (sizeof (short)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ exit (1);
+ if (((long) (sizeof (short))) < 0)
+ {
+ long i = longval ();
+ if (i != ((long) (sizeof (short))))
+ exit (1);
+ fprintf (f, "%ld\n", i);
+ }
+ else
+ {
+ unsigned long i = ulongval ();
+ if (i != ((long) (sizeof (short))))
+ exit (1);
+ fprintf (f, "%lu\n", i);
+ }
+ exit (ferror (f) || fclose (f) != 0);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sizeof_short=`cat conftest.val`
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (short), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.val
+else
+ ac_cv_sizeof_short=0
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5
+echo "${ECHO_T}$ac_cv_sizeof_short" >&6
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_SHORT $ac_cv_sizeof_short
+_ACEOF
+
+
+ echo "$as_me:$LINENO: checking for char" >&5
+echo $ECHO_N "checking for char... $ECHO_C" >&6
+if test "${ac_cv_type_char+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((char *) 0)
+ return 0;
+if (sizeof (char))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_char=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_char=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_char" >&5
+echo "${ECHO_T}$ac_cv_type_char" >&6
+
+echo "$as_me:$LINENO: checking size of char" >&5
+echo $ECHO_N "checking size of char... $ECHO_C" >&6
+if test "${ac_cv_sizeof_char+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$ac_cv_type_char" = yes; then
+ # The cast to unsigned long works around a bug in the HP C Compiler
+ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+ # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+ # This bug is HP SR number 8606223364.
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (char))) >= 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (char))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr $ac_mid + 1`
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (char))) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (char))) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_hi=`expr '(' $ac_mid ')' - 1`
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo= ac_hi=
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (char))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_char=$ac_lo;;
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (char), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (char), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+else
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+long longval () { return (long) (sizeof (char)); }
+unsigned long ulongval () { return (long) (sizeof (char)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ exit (1);
+ if (((long) (sizeof (char))) < 0)
+ {
+ long i = longval ();
+ if (i != ((long) (sizeof (char))))
+ exit (1);
+ fprintf (f, "%ld\n", i);
+ }
+ else
+ {
+ unsigned long i = ulongval ();
+ if (i != ((long) (sizeof (char))))
+ exit (1);
+ fprintf (f, "%lu\n", i);
+ }
+ exit (ferror (f) || fclose (f) != 0);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sizeof_char=`cat conftest.val`
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (char), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (char), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.val
+else
+ ac_cv_sizeof_char=0
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_char" >&5
+echo "${ECHO_T}$ac_cv_sizeof_char" >&6
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_CHAR $ac_cv_sizeof_char
+_ACEOF
+
+
+
+ echo "$as_me:$LINENO: checking for type equivalent to int8_t" >&5
+echo $ECHO_N "checking for type equivalent to int8_t... $ECHO_C" >&6
+ case "$ac_cv_sizeof_char" in
+ 1) acx_cv_type_int8_t=char ;;
+ *) { { echo "$as_me:$LINENO: error: no 8-bit type" >&5
+echo "$as_me: error: no 8-bit type" >&2;}
+ { (exit please report a bug); exit please report a bug; }; }
+ esac
+ echo "$as_me:$LINENO: result: $acx_cv_type_int8_t" >&5
+echo "${ECHO_T}$acx_cv_type_int8_t" >&6
+
+ echo "$as_me:$LINENO: checking for type equivalent to int16_t" >&5
+echo $ECHO_N "checking for type equivalent to int16_t... $ECHO_C" >&6
+ case "$ac_cv_sizeof_int:$ac_cv_sizeof_short" in
+ 2:*) acx_cv_type_int16_t=int ;;
+ *:2) acx_cv_type_int16_t=short ;;
+ *) { { echo "$as_me:$LINENO: error: no 16-bit type" >&5
+echo "$as_me: error: no 16-bit type" >&2;}
+ { (exit please report a bug); exit please report a bug; }; }
+ esac
+ echo "$as_me:$LINENO: result: $acx_cv_type_int16_t" >&5
+echo "${ECHO_T}$acx_cv_type_int16_t" >&6
+
+ echo "$as_me:$LINENO: checking for type equivalent to int32_t" >&5
+echo $ECHO_N "checking for type equivalent to int32_t... $ECHO_C" >&6
+ case "$ac_cv_sizeof_int:$ac_cv_sizeof_long" in
+ 4:*) acx_cv_type_int32_t=int ;;
+ *:4) acx_cv_type_int32_t=long ;;
+ *) { { echo "$as_me:$LINENO: error: no 32-bit type" >&5
+echo "$as_me: error: no 32-bit type" >&2;}
+ { (exit please report a bug); exit please report a bug; }; }
+ esac
+ echo "$as_me:$LINENO: result: $acx_cv_type_int32_t" >&5
+echo "${ECHO_T}$acx_cv_type_int32_t" >&6
+fi
+
+# These tests are here to make the output prettier
+
+if test "$ac_cv_type_uint64_t" != yes && test "$ac_cv_type_u_int64_t" != yes; then
+ case "$ac_cv_sizeof_long" in
+ 8) acx_cv_type_int64_t=long ;;
+ esac
+ echo "$as_me:$LINENO: checking for type equivalent to int64_t" >&5
+echo $ECHO_N "checking for type equivalent to int64_t... $ECHO_C" >&6
+ echo "$as_me:$LINENO: result: ${acx_cv_type_int64_t-'using preprocessor symbols'}" >&5
+echo "${ECHO_T}${acx_cv_type_int64_t-'using preprocessor symbols'}" >&6
+fi
+
+# Now we can use the above types
+
+if test "$ac_cv_type_uintptr_t" != yes; then
+ echo "$as_me:$LINENO: checking for type equivalent to intptr_t" >&5
+echo $ECHO_N "checking for type equivalent to intptr_t... $ECHO_C" >&6
+ case $ac_cv_sizeof_void_p in
+ 2) acx_cv_type_intptr_t=int16_t ;;
+ 4) acx_cv_type_intptr_t=int32_t ;;
+ 8) acx_cv_type_intptr_t=int64_t ;;
+ *) { { echo "$as_me:$LINENO: error: no equivalent for intptr_t" >&5
+echo "$as_me: error: no equivalent for intptr_t" >&2;}
+ { (exit please report a bug); exit please report a bug; }; }
+ esac
+ echo "$as_me:$LINENO: result: $acx_cv_type_intptr_t" >&5
+echo "${ECHO_T}$acx_cv_type_intptr_t" >&6
+fi
+
+# ----------------- done all checks, emit header -------------
+ ac_config_commands="$ac_config_commands bfd_stdint.h"
+
+
+
echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
if test "${ac_cv_header_time+set}" = set; then
@@ -11467,7 +17003,9 @@ if test "${target}" = "${host}"; then
alpha*-*-*) COREFILE=osf-core.lo ;;
arm-*-freebsd* | arm-*-kfreebsd*-gnu)
COREFILE='' ;;
- arm-*-netbsd*) COREFILE=netbsd-core.lo ;;
+ arm-*-netbsd* | arm-*-openbsd*)
+ COREFILE=netbsd-core.lo
+ ;;
arm-*-riscix) COREFILE=trad-core.lo ;;
hppa*-*-hpux*) COREFILE=hpux-core.lo ;;
hppa*-*-hiux*) COREFILE=hpux-core.lo ;;
@@ -11674,7 +17212,9 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
powerpc-*-netbsd*) COREFILE=netbsd-core.lo ;;
powerpc-*-*bsd*) COREFILE=netbsd-core.lo ;;
s390*-*-*) COREFILE=trad-core.lo ;;
- sh*-*-netbsd*) COREFILE=netbsd-core.lo ;;
+ sh*-*-netbsd* | sh*-*-openbsd*)
+ COREFILE=netbsd-core.lo
+ ;;
sparc-*-netbsd* | sparc*-*-openbsd*)
COREFILE=netbsd-core.lo
;;
@@ -13038,7 +18578,7 @@ selarchs="$f"
# Target backend .o files.
tb=
-elf="elf.lo elflink.lo elf-strtab.lo elf-eh-frame.lo dwarf1.lo"
+elf="elf.lo elflink.lo elf-attrs.lo elf-strtab.lo elf-eh-frame.lo dwarf1.lo"
for vec in $selvecs
do
@@ -13057,6 +18597,10 @@ do
arm_epoc_pe_little_vec) tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;;
arm_epoc_pei_big_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;;
arm_epoc_pei_little_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;;
+ arm_wince_pe_big_vec) tb="$tb pe-arm-wince.lo pe-arm.lo peigen.lo cofflink.lo " ;;
+ arm_wince_pe_little_vec) tb="$tb pe-arm-wince.lo pe-arm.lo peigen.lo cofflink.lo " ;;
+ arm_wince_pei_big_vec) tb="$tb pei-arm-wince.lo pei-arm.lo peigen.lo cofflink.lo " ;;
+ arm_wince_pei_little_vec) tb="$tb pei-arm-wince.lo pei-arm.lo peigen.lo cofflink.lo " ;;
armcoff_big_vec) tb="$tb coff-arm.lo cofflink.lo " ;;
armcoff_little_vec) tb="$tb coff-arm.lo cofflink.lo " ;;
armnetbsd_vec) tb="$tb armnetbsd.lo aout32.lo" ;;
@@ -13067,6 +18611,7 @@ do
b_out_vec_big_host) tb="$tb bout.lo aout32.lo" ;;
b_out_vec_little_host) tb="$tb bout.lo aout32.lo" ;;
bfd_efi_app_ia32_vec) tb="$tb efi-app-ia32.lo peigen.lo cofflink.lo" ;;
+ bfd_efi_app_x86_64_vec) tb="$tb efi-app-x86_64.lo pex64igen.lo cofflink.lo" ;target_size=64;;
bfd_efi_app_ia64_vec) tb="$tb efi-app-ia64.lo pepigen.lo cofflink.lo"; target_size=64 ;;
bfd_elf32_am33lin_vec) tb="$tb elf32-am33lin.lo elf32.lo $elf" ;;
bfd_elf32_avr_vec) tb="$tb elf32-avr.lo elf32.lo $elf" ;;
@@ -13082,6 +18627,7 @@ do
bfd_elf32_bigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_bigmips_vxworks_vec)
tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
+ bfd_elf32_cr16_vec) tb="$tb elf32-cr16.lo elf32.lo $elf" ;;
bfd_elf32_cr16c_vec) tb="$tb elf32-cr16c.lo elf32.lo $elf" ;;
bfd_elf32_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;;
bfd_elf32_crx_vec) tb="$tb elf32-crx.lo elf32.lo $elf" ;;
@@ -13127,6 +18673,8 @@ do
bfd_elf32_m88k_vec) tb="$tb elf32-m88k.lo elf32.lo $elf" ;;
bfd_elf32_mcore_big_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
bfd_elf32_mcore_little_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
+ bfd_elf32_mep_vec) tb="$tb elf32-mep.lo elf32.lo $elf" ;;
+ bfd_elf32_mep_little_vec) tb="$tb elf32-mep.lo elf32.lo $elf" ;;
bfd_elf32_mn10200_vec) tb="$tb elf-m10200.lo elf32.lo $elf" ;;
bfd_elf32_mn10300_vec) tb="$tb elf-m10300.lo elf32.lo $elf" ;;
bfd_elf32_mt_vec) tb="$tb elf32-mt.lo elf32.lo $elf" ;;
@@ -13143,24 +18691,29 @@ do
bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_powerpc_vxworks_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_s390_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;;
+ bfd_elf32_bigscore_vec) tb="$tb elf32-score.lo elf32.lo $elf" ;;
+ bfd_elf32_littlescore_vec) tb="$tb elf32-score.lo elf32.lo $elf" ;;
# FIXME: We include cofflink.lo not because it's needed for
# bfd_elf32_sh64[l]_vec, but because we include bfd_elf32_sh[l]_vec
# which needs it but does not list it. Should be fixed in right place.
- bfd_elf32_sh64_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
- bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
- bfd_elf32_sh64lin_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
- bfd_elf32_sh64blin_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
- bfd_elf32_sh64lnbsd_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;;
- bfd_elf32_sh64nbsd_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;;
- bfd_elf32_sh_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
- bfd_elf32_shblin_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
- bfd_elf32_shl_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
- bfd_elf32_shl_symbian_vec) tb="$tb elf32-sh-symbian.lo elf32-sh64-com.lo elf32.lo $elf coff-sh.lo" ;;
- bfd_elf32_shlin_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
- bfd_elf32_shlnbsd_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
- bfd_elf32_shnbsd_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+ bfd_elf32_sh64_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
+ bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
+ bfd_elf32_sh64lin_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
+ bfd_elf32_sh64blin_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
+ bfd_elf32_sh64lnbsd_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" ;;
+ bfd_elf32_sh64nbsd_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" ;;
+ bfd_elf32_sh_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;;
+ bfd_elf32_shblin_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+ bfd_elf32_shl_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;;
+ bfd_elf32_shl_symbian_vec) tb="$tb elf32-sh-symbian.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;;
+ bfd_elf32_shlin_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+ bfd_elf32_shlnbsd_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+ bfd_elf32_shlvxworks_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;;
+ bfd_elf32_shnbsd_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+ bfd_elf32_shvxworks_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;;
bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_sparc_vxworks_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;;
+ bfd_elf32_spu_vec) tb="$tb elf32-spu.lo elf32.lo $elf" ;;
bfd_elf32_tradbigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_us_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;;
@@ -13192,8 +18745,10 @@ do
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 elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_sparc_freebsd_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_tradbigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
+ bfd_elf64_x86_64_freebsd_vec) tb="$tb elf64-x86-64.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_x86_64_vec) tb="$tb elf64-x86-64.lo elf64.lo $elf"; target_size=64 ;;
bfd_mmo_vec) tb="$tb mmo.lo" target_size=64 ;;
bfd_powerpc_pe_vec) tb="$tb pe-ppc.lo peigen.lo cofflink.lo" ;;
@@ -13216,6 +18771,7 @@ do
i386aout_vec) tb="$tb i386aout.lo aout32.lo" ;;
i386bsd_vec) tb="$tb i386bsd.lo aout32.lo" ;;
i386coff_vec) tb="$tb coff-i386.lo cofflink.lo" ;;
+ x86_64coff_vec) tb="$tb coff-x86_64.lo cofflink.lo"; target_size=64 ;;
i386dynix_vec) tb="$tb i386dynix.lo aout32.lo" ;;
i386freebsd_vec) tb="$tb i386freebsd.lo aout32.lo" ;;
i386linux_vec) tb="$tb i386linux.lo aout32.lo" ;;
@@ -13227,6 +18783,8 @@ do
i386os9k_vec) tb="$tb i386os9k.lo aout32.lo" ;;
i386pe_vec) tb="$tb pe-i386.lo peigen.lo cofflink.lo" ;;
i386pei_vec) tb="$tb pei-i386.lo peigen.lo cofflink.lo" ;;
+ x86_64pe_vec) tb="$tb pe-x86_64.lo pex64igen.lo cofflink.lo"; target_size=64 ;;
+ x86_64pei_vec) tb="$tb pei-x86_64.lo pex64igen.lo cofflink.lo"; target_size=64 ;;
i860coff_vec) tb="$tb coff-i860.lo cofflink.lo" ;;
icoff_big_vec) tb="$tb coff-i960.lo cofflink.lo" ;;
icoff_little_vec) tb="$tb coff-i960.lo cofflink.lo" ;;
@@ -13379,7 +18937,7 @@ fi # all_targets is true
case ${host64}-${target64}-${want64} in
*true*)
wordsize=64
- bfd_libs='$(BFD64_LIBS) $(BFD32_LIBS)'
+ bfd64_libs='$(BFD64_LIBS)'
all_backends='$(BFD64_BACKENDS) $(BFD32_BACKENDS)'
if test $BFD_HOST_64_BIT_DEFINED = 0; then
{ echo "$as_me:$LINENO: WARNING: You have requested a 64 bit BFD configuration, but" >&5
@@ -13420,7 +18978,6 @@ echo "$as_me: error: A newer version of gcc is needed for the requested 64-bit B
;;
false-false-false)
wordsize=32
- bfd_libs='$(BFD32_LIBS)'
all_backends='$(BFD32_BACKENDS)'
;;
esac
@@ -14524,6 +20081,7 @@ esac
rm -f doc/config.status
ac_config_files="$ac_config_files Makefile doc/Makefile bfd-in3.h:bfd-in2.h po/Makefile.in:po/Make-in"
+
ac_config_commands="$ac_config_commands default"
@@ -14643,6 +20201,13 @@ echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
+if test -z "${GENINSRC_NEVER_TRUE}" && test -z "${GENINSRC_NEVER_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"GENINSRC_NEVER\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"GENINSRC_NEVER\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
if test -z "${INSTALL_LIBBFD_TRUE}" && test -z "${INSTALL_LIBBFD_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"INSTALL_LIBBFD\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
@@ -15086,6 +20651,272 @@ cat >>$CONFIG_STATUS <<_ACEOF
AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`'
+macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`'
+enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`'
+host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`'
+host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`'
+host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`'
+build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`'
+build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`'
+build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`'
+SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`'
+Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`'
+GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`'
+EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`'
+FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`'
+LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`'
+NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`'
+LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`'
+exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`'
+lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`'
+lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`'
+AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`'
+STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`'
+compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`'
+GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`'
+objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`'
+SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`'
+ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`'
+need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`'
+libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`'
+fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
+need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`'
+version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`'
+striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`'
+
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# Quote evaled strings.
+for var in SED \
+GREP \
+EGREP \
+FGREP \
+LD \
+NM \
+LN_S \
+lt_SP2NL \
+lt_NL2SP \
+reload_flag \
+deplibs_check_method \
+file_magic_cmd \
+AR \
+AR_FLAGS \
+STRIP \
+RANLIB \
+CC \
+CFLAGS \
+compiler \
+lt_cv_sys_global_symbol_pipe \
+lt_cv_sys_global_symbol_to_cdecl \
+lt_cv_sys_global_symbol_to_c_name_address \
+SHELL \
+ECHO \
+lt_prog_compiler_no_builtin_flag \
+lt_prog_compiler_wl \
+lt_prog_compiler_pic \
+lt_prog_compiler_static \
+lt_cv_prog_compiler_c_o \
+need_locks \
+shrext_cmds \
+export_dynamic_flag_spec \
+whole_archive_flag_spec \
+compiler_needs_object \
+with_gnu_ld \
+allow_undefined_flag \
+no_undefined_flag \
+hardcode_libdir_flag_spec \
+hardcode_libdir_flag_spec_ld \
+hardcode_libdir_separator \
+fix_srcfile_path \
+exclude_expsyms \
+include_expsyms \
+file_list_spec \
+variables_saved_for_relink \
+libname_spec \
+library_names_spec \
+soname_spec \
+finish_eval \
+old_striplib \
+striplib; do
+ case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+# Double-quote double-evaled strings.
+for var in reload_cmds \
+old_postinstall_cmds \
+old_postuninstall_cmds \
+old_archive_cmds \
+extract_expsyms_cmds \
+old_archive_from_new_cmds \
+old_archive_from_expsyms_cmds \
+archive_cmds \
+archive_expsym_cmds \
+module_cmds \
+module_expsym_cmds \
+export_symbols_cmds \
+prelink_cmds \
+postinstall_cmds \
+postuninstall_cmds \
+finish_cmds \
+sys_lib_search_path_spec \
+sys_lib_dlsearch_path_spec; do
+ case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+# Fix-up fallback echo if it was mangled by the above quoting rules.
+case \$lt_ECHO in
+*'\\\$0 --fallback-echo"') lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\`
+ ;;
+esac
+
+ac_aux_dir='$ac_aux_dir'
+xsi_shell='$xsi_shell'
+lt_shell_append='$lt_shell_append'
+
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+
+ PACKAGE='$PACKAGE'
+ VERSION='$VERSION'
+ TIMESTAMP='$TIMESTAMP'
+ RM='$RM'
+ ofile='$ofile'
+
+
+
+# Capture the value of obsolete ALL_LINGUAS because we need it to compute
+ # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it
+ # from automake.
+ eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
+ # Capture the value of LINGUAS because we need it to compute CATALOGS.
+ LINGUAS="${LINGUAS-%UNSET%}"
+
+
+GCC="$GCC"
+CC="$CC"
+acx_cv_header_stdint="$acx_cv_header_stdint"
+acx_cv_type_int8_t="$acx_cv_type_int8_t"
+acx_cv_type_int16_t="$acx_cv_type_int16_t"
+acx_cv_type_int32_t="$acx_cv_type_int32_t"
+acx_cv_type_int64_t="$acx_cv_type_int64_t"
+acx_cv_type_intptr_t="$acx_cv_type_intptr_t"
+ac_cv_type_uintmax_t="$ac_cv_type_uintmax_t"
+ac_cv_type_uintptr_t="$ac_cv_type_uintptr_t"
+ac_cv_type_uint64_t="$ac_cv_type_uint64_t"
+ac_cv_type_u_int64_t="$ac_cv_type_u_int64_t"
+ac_cv_type_u_int32_t="$ac_cv_type_u_int32_t"
+ac_cv_type_int_least32_t="$ac_cv_type_int_least32_t"
+ac_cv_type_int_fast32_t="$ac_cv_type_int_fast32_t"
+ac_cv_sizeof_void_p="$ac_cv_sizeof_void_p"
+
+
+
_ACEOF
@@ -15100,6 +20931,9 @@ do
"bfd-in3.h" ) CONFIG_FILES="$CONFIG_FILES bfd-in3.h:bfd-in2.h" ;;
"po/Makefile.in" ) CONFIG_FILES="$CONFIG_FILES po/Makefile.in:po/Make-in" ;;
"depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "libtool" ) CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
+ "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
+ "bfd_stdint.h" ) CONFIG_COMMANDS="$CONFIG_COMMANDS bfd_stdint.h" ;;
"default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
"config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.in" ;;
*) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
@@ -15241,42 +21075,50 @@ s,@AR@,$AR,;t t
s,@ac_ct_AR@,$ac_ct_AR,;t t
s,@RANLIB@,$RANLIB,;t t
s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
-s,@LN_S@,$LN_S,;t t
s,@LIBTOOL@,$LIBTOOL,;t t
+s,@SED@,$SED,;t t
+s,@EGREP@,$EGREP,;t t
+s,@FGREP@,$FGREP,;t t
+s,@GREP@,$GREP,;t t
+s,@LD@,$LD,;t t
+s,@DUMPBIN@,$DUMPBIN,;t t
+s,@ac_ct_DUMPBIN@,$ac_ct_DUMPBIN,;t t
+s,@NM@,$NM,;t t
+s,@LN_S@,$LN_S,;t t
+s,@lt_ECHO@,$lt_ECHO,;t t
+s,@CPP@,$CPP,;t t
+s,@DEBUGDIR@,$DEBUGDIR,;t t
+s,@PKGVERSION@,$PKGVERSION,;t t
+s,@REPORT_BUGS_TO@,$REPORT_BUGS_TO,;t t
+s,@REPORT_BUGS_TEXI@,$REPORT_BUGS_TEXI,;t t
s,@WARN_CFLAGS@,$WARN_CFLAGS,;t t
s,@NO_WERROR@,$NO_WERROR,;t t
s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t
s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t
s,@MAINT@,$MAINT,;t t
+s,@GENINSRC_NEVER_TRUE@,$GENINSRC_NEVER_TRUE,;t t
+s,@GENINSRC_NEVER_FALSE@,$GENINSRC_NEVER_FALSE,;t t
s,@INSTALL_LIBBFD_TRUE@,$INSTALL_LIBBFD_TRUE,;t t
s,@INSTALL_LIBBFD_FALSE@,$INSTALL_LIBBFD_FALSE,;t t
s,@host_noncanonical@,$host_noncanonical,;t t
s,@target_noncanonical@,$target_noncanonical,;t t
s,@bfdlibdir@,$bfdlibdir,;t t
s,@bfdincludedir@,$bfdincludedir,;t t
-s,@CPP@,$CPP,;t t
-s,@EGREP@,$EGREP,;t t
-s,@ALLOCA@,$ALLOCA,;t t
s,@USE_NLS@,$USE_NLS,;t t
-s,@MSGFMT@,$MSGFMT,;t t
-s,@GMSGFMT@,$GMSGFMT,;t t
+s,@LIBINTL@,$LIBINTL,;t t
+s,@LIBINTL_DEP@,$LIBINTL_DEP,;t t
+s,@INCINTL@,$INCINTL,;t t
s,@XGETTEXT@,$XGETTEXT,;t t
-s,@USE_INCLUDED_LIBINTL@,$USE_INCLUDED_LIBINTL,;t t
+s,@GMSGFMT@,$GMSGFMT,;t t
+s,@POSUB@,$POSUB,;t t
s,@CATALOGS@,$CATALOGS,;t t
-s,@CATOBJEXT@,$CATOBJEXT,;t t
s,@DATADIRNAME@,$DATADIRNAME,;t t
-s,@GMOFILES@,$GMOFILES,;t t
s,@INSTOBJEXT@,$INSTOBJEXT,;t t
-s,@INTLDEPS@,$INTLDEPS,;t t
-s,@INTLLIBS@,$INTLLIBS,;t t
-s,@INTLOBJS@,$INTLOBJS,;t t
-s,@POFILES@,$POFILES,;t t
-s,@POSUB@,$POSUB,;t t
-s,@INCLUDE_LOCALE_H@,$INCLUDE_LOCALE_H,;t t
-s,@GT_NO@,$GT_NO,;t t
-s,@GT_YES@,$GT_YES,;t t
+s,@GENCAT@,$GENCAT,;t t
+s,@CATOBJEXT@,$CATOBJEXT,;t t
s,@MKINSTALLDIRS@,$MKINSTALLDIRS,;t t
-s,@l@,$l,;t t
+s,@MSGFMT@,$MSGFMT,;t t
+s,@MSGMERGE@,$MSGMERGE,;t t
s,@HDEFINES@,$HDEFINES,;t t
s,@BFD_HOST_64BIT_LONG@,$BFD_HOST_64BIT_LONG,;t t
s,@BFD_HOST_LONG_LONG@,$BFD_HOST_LONG_LONG,;t t
@@ -15291,7 +21133,7 @@ s,@WIN32LDFLAGS@,$WIN32LDFLAGS,;t t
s,@WIN32LIBADD@,$WIN32LIBADD,;t t
s,@TDEFINES@,$TDEFINES,;t t
s,@wordsize@,$wordsize,;t t
-s,@bfd_libs@,$bfd_libs,;t t
+s,@bfd64_libs@,$bfd64_libs,;t t
s,@all_backends@,$all_backends,;t t
s,@bfd_backends@,$bfd_backends,;t t
s,@bfd_machines@,$bfd_machines,;t t
@@ -15986,7 +21828,1002 @@ echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;}
done
done
;;
- default ) sed -e '/SRC-POTFILES =/r po/SRC-POTFILES' -e '/BLD-POTFILES =/r po/BLD-POTFILES' po/Makefile.in > po/Makefile ;;
+ libtool )
+
+ # See if we are running on zsh, and set the options which allow our
+ # commands through without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+
+ cfgfile="${ofile}T"
+ trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+ $RM "$cfgfile"
+
+ cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me (GNU $PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006, 2007 Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# The names of the tagged configurations supported by this script.
+available_tags=""
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Which release of libtool.m4 was used?
+macro_version=$macro_version
+macro_revision=$macro_revision
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# What type of objects to build.
+pic_mode=$pic_mode
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="\$SED -e 1s/^X//"
+
+# A grep program that handles long lines.
+GREP=$lt_GREP
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# A literal string matcher.
+FGREP=$lt_FGREP
+
+# A BSD- or MS-compatible name lister.
+NM=$lt_NM
+
+# Whether we need soft or hard links.
+LN_S=$lt_LN_S
+
+# What is the maximum length of a command?
+max_cmd_len=$max_cmd_len
+
+# Object file suffix (normally "o").
+objext=$ac_objext
+
+# Executable file suffix (normally "").
+exeext=$exeext
+
+# whether the shell understands "unset".
+lt_unset=$lt_unset
+
+# turn spaces into newlines.
+SP2NL=$lt_lt_SP2NL
+
+# turn newlines into spaces.
+NL2SP=$lt_lt_NL2SP
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == "file_magic".
+file_magic_cmd=$lt_file_magic_cmd
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A symbol stripping program.
+STRIP=$lt_STRIP
+
+# Commands used to install an old-style archive.
+RANLIB=$lt_RANLIB
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# A C compiler.
+LTCC=$lt_CC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_CFLAGS
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration.
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair.
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that does not interpret backslashes.
+ECHO=$lt_ECHO
+
+# Used to examine libraries when file_magic_cmd begins with "file".
+MAGIC_CMD=$MAGIC_CMD
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Old archive suffix (normally "a").
+libext=$libext
+
+# Shared library suffix (normally ".so").
+shrext_cmds=$lt_shrext_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at link time.
+variables_saved_for_relink=$lt_variables_saved_for_relink
+
+# Do we need the "lib" prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Library versioning type.
+version_type=$version_type
+
+# Shared library runtime path variable.
+runpath_var=$runpath_var
+
+# Shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Command to use after installation of a shared archive.
+postinstall_cmds=$lt_postinstall_cmds
+
+# Command to use after uninstallation of a shared archive.
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# As "finish_cmds", except a single script fragment to be evaled but
+# not shown.
+finish_eval=$lt_finish_eval
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Compile-time system search path for libraries.
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries.
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds
+
+# A language specific compiler.
+CC=$lt_compiler
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# If ld is used when linking, flag to hardcode \$libdir into a binary
+# during linking. This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
+# library is relocated.
+hardcode_direct_absolute=$hardcode_direct_absolute
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Set to "yes" if building a shared library automatically hardcodes DIR
+# into the library and all subsequent libraries and executables linked
+# against it.
+hardcode_automatic=$hardcode_automatic
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+ case $host_os in
+ aix3*)
+ cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program. For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+fi
+_LT_EOF
+ ;;
+ esac
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+
+ # We use sed instead of cat because bash on DJGPP gets confused if
+ # if finds mixed CR/LF and LF-only lines. Since sed operates in
+ # text mode, it properly converts lines to CR/LF. This bash problem
+ # is reportedly fixed, but why not run on old versions too?
+ sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
+ || (rm -f "$cfgfile"; exit 1)
+
+ case $xsi_shell in
+ yes)
+ cat << \_LT_EOF >> "$cfgfile"
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE. If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+ case ${1} in
+ */*) func_dirname_result="${1%/*}${2}" ;;
+ * ) func_dirname_result="${3}" ;;
+ esac
+}
+
+# func_basename file
+func_basename ()
+{
+ func_basename_result="${1##*/}"
+}
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+func_stripname ()
+{
+ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+ # positional parameters, so assign one to ordinary parameter first.
+ func_stripname_result=${3}
+ func_stripname_result=${func_stripname_result#"${1}"}
+ func_stripname_result=${func_stripname_result%"${2}"}
+}
+
+# func_opt_split
+func_opt_split ()
+{
+ func_opt_split_opt=${1%%=*}
+ func_opt_split_arg=${1#*=}
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+ case ${1} in
+ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+ *) func_lo2o_result=${1} ;;
+ esac
+}
+_LT_EOF
+ ;;
+ *) # Bourne compatible functions.
+ cat << \_LT_EOF >> "$cfgfile"
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE. If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+ # Extract subdirectory from the argument.
+ func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
+ if test "X$func_dirname_result" = "X${1}"; then
+ func_dirname_result="${3}"
+ else
+ func_dirname_result="$func_dirname_result${2}"
+ fi
+}
+
+# func_basename file
+func_basename ()
+{
+ func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
+}
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+ case ${2} in
+ .*) func_stripname_result=`$ECHO "X${3}" \
+ | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
+ *) func_stripname_result=`$ECHO "X${3}" \
+ | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
+ esac
+}
+
+# sed scripts:
+my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
+my_sed_long_arg='1s/^-[^=]*=//'
+
+# func_opt_split
+func_opt_split ()
+{
+ func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"`
+ func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"`
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+ func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
+}
+_LT_EOF
+esac
+
+case $lt_shell_append in
+ yes)
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+ eval "$1+=\$2"
+}
+_LT_EOF
+ ;;
+ *)
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+ eval "$1=\$$1\$2"
+}
+_LT_EOF
+ ;;
+ esac
+
+
+ sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
+ || (rm -f "$cfgfile"; exit 1)
+
+ mv -f "$cfgfile" "$ofile" ||
+ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+ chmod +x "$ofile"
+
+ ;;
+ default-1 )
+ for ac_file in $CONFIG_FILES; do
+ # Support "outfile[:infile[:infile...]]"
+ case "$ac_file" in
+ *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ esac
+ # PO directories have a Makefile.in generated from Makefile.in.in.
+ case "$ac_file" in */Makefile.in)
+ # Adjust a relative srcdir.
+ ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
+ ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
+ ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
+ # In autoconf-2.13 it is called $ac_given_srcdir.
+ # In autoconf-2.50 it is called $srcdir.
+ test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
+ case "$ac_given_srcdir" in
+ .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
+ /*) top_srcdir="$ac_given_srcdir" ;;
+ *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+ if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
+ rm -f "$ac_dir/POTFILES"
+ test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
+ cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
+ POMAKEFILEDEPS="POTFILES.in"
+ # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend
+ # on $ac_dir but don't depend on user-specified configuration
+ # parameters.
+ if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
+ # The LINGUAS file contains the set of available languages.
+ if test -n "$OBSOLETE_ALL_LINGUAS"; then
+ test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
+ fi
+ ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
+ # Hide the ALL_LINGUAS assigment from automake.
+ eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
+ POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
+ else
+ # The set of available languages was given in configure.in.
+ eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
+ fi
+ case "$ac_given_srcdir" in
+ .) srcdirpre= ;;
+ *) srcdirpre='$(srcdir)/' ;;
+ esac
+ POFILES=
+ GMOFILES=
+ UPDATEPOFILES=
+ DUMMYPOFILES=
+ for lang in $ALL_LINGUAS; do
+ POFILES="$POFILES $srcdirpre$lang.po"
+ GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
+ UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
+ DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
+ done
+ # CATALOGS depends on both $ac_dir and the user's LINGUAS
+ # environment variable.
+ INST_LINGUAS=
+ if test -n "$ALL_LINGUAS"; then
+ for presentlang in $ALL_LINGUAS; do
+ useit=no
+ if test "%UNSET%" != "$LINGUAS"; then
+ desiredlanguages="$LINGUAS"
+ else
+ desiredlanguages="$ALL_LINGUAS"
+ fi
+ for desiredlang in $desiredlanguages; do
+ # Use the presentlang catalog if desiredlang is
+ # a. equal to presentlang, or
+ # b. a variant of presentlang (because in this case,
+ # presentlang can be used as a fallback for messages
+ # which are not translated in the desiredlang catalog).
+ case "$desiredlang" in
+ "$presentlang"*) useit=yes;;
+ esac
+ done
+ if test $useit = yes; then
+ INST_LINGUAS="$INST_LINGUAS $presentlang"
+ fi
+ done
+ fi
+ CATALOGS=
+ if test -n "$INST_LINGUAS"; then
+ for lang in $INST_LINGUAS; do
+ CATALOGS="$CATALOGS $lang.gmo"
+ done
+ fi
+ test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
+ sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
+ for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
+ if test -f "$f"; then
+ case "$f" in
+ *.orig | *.bak | *~) ;;
+ *) cat "$f" >> "$ac_dir/Makefile" ;;
+ esac
+ fi
+ done
+ fi
+ ;;
+ esac
+ done ;;
+ bfd_stdint.h )
+if test "$GCC" = yes; then
+ echo "/* generated for " `$CC --version | sed 1q` "*/" > tmp-stdint.h
+else
+ echo "/* generated for $CC */" > tmp-stdint.h
+fi
+
+sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ #ifndef GCC_GENERATED_STDINT_H
+ #define GCC_GENERATED_STDINT_H 1
+
+ #include <sys/types.h>
+EOF
+
+if test "$acx_cv_header_stdint" != stdint.h; then
+ echo "#include <stddef.h>" >> tmp-stdint.h
+fi
+if test "$acx_cv_header_stdint" != stddef.h; then
+ echo "#include <$acx_cv_header_stdint>" >> tmp-stdint.h
+fi
+
+sed 's/^ *//' >> tmp-stdint.h <<EOF
+ /* glibc uses these symbols as guards to prevent redefinitions. */
+ #ifdef __int8_t_defined
+ #define _INT8_T
+ #define _INT16_T
+ #define _INT32_T
+ #endif
+ #ifdef __uint32_t_defined
+ #define _UINT32_T
+ #endif
+
+EOF
+
+# ----------------- done header, emit basic int types -------------
+if test "$acx_cv_header_stdint" = stddef.h; then
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ #ifndef _UINT8_T
+ #define _UINT8_T
+ #ifndef __uint8_t_defined
+ #define __uint8_t_defined
+ typedef unsigned $acx_cv_type_int8_t uint8_t;
+ #endif
+ #endif
+
+ #ifndef _UINT16_T
+ #define _UINT16_T
+ #ifndef __uint16_t_defined
+ #define __uint16_t_defined
+ typedef unsigned $acx_cv_type_int16_t uint16_t;
+ #endif
+ #endif
+
+ #ifndef _UINT32_T
+ #define _UINT32_T
+ #ifndef __uint32_t_defined
+ #define __uint32_t_defined
+ typedef unsigned $acx_cv_type_int32_t uint32_t;
+ #endif
+ #endif
+
+ #ifndef _INT8_T
+ #define _INT8_T
+ #ifndef __int8_t_defined
+ #define __int8_t_defined
+ typedef $acx_cv_type_int8_t int8_t;
+ #endif
+ #endif
+
+ #ifndef _INT16_T
+ #define _INT16_T
+ #ifndef __int16_t_defined
+ #define __int16_t_defined
+ typedef $acx_cv_type_int16_t int16_t;
+ #endif
+ #endif
+
+ #ifndef _INT32_T
+ #define _INT32_T
+ #ifndef __int32_t_defined
+ #define __int32_t_defined
+ typedef $acx_cv_type_int32_t int32_t;
+ #endif
+ #endif
+EOF
+elif test "$ac_cv_type_u_int32_t" = yes; then
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ /* int8_t int16_t int32_t defined by inet code, we do the u_intXX types */
+ #ifndef _INT8_T
+ #define _INT8_T
+ #endif
+ #ifndef _INT16_T
+ #define _INT16_T
+ #endif
+ #ifndef _INT32_T
+ #define _INT32_T
+ #endif
+
+ #ifndef _UINT8_T
+ #define _UINT8_T
+ #ifndef __uint8_t_defined
+ #define __uint8_t_defined
+ typedef u_int8_t uint8_t;
+ #endif
+ #endif
+
+ #ifndef _UINT16_T
+ #define _UINT16_T
+ #ifndef __uint16_t_defined
+ #define __uint16_t_defined
+ typedef u_int16_t uint16_t;
+ #endif
+ #endif
+
+ #ifndef _UINT32_T
+ #define _UINT32_T
+ #ifndef __uint32_t_defined
+ #define __uint32_t_defined
+ typedef u_int32_t uint32_t;
+ #endif
+ #endif
+EOF
+else
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ /* Some systems have guard macros to prevent redefinitions, define them. */
+ #ifndef _INT8_T
+ #define _INT8_T
+ #endif
+ #ifndef _INT16_T
+ #define _INT16_T
+ #endif
+ #ifndef _INT32_T
+ #define _INT32_T
+ #endif
+ #ifndef _UINT8_T
+ #define _UINT8_T
+ #endif
+ #ifndef _UINT16_T
+ #define _UINT16_T
+ #endif
+ #ifndef _UINT32_T
+ #define _UINT32_T
+ #endif
+EOF
+fi
+
+# ------------- done basic int types, emit int64_t types ------------
+if test "$ac_cv_type_uint64_t" = yes; then
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ /* system headers have good uint64_t and int64_t */
+ #ifndef _INT64_T
+ #define _INT64_T
+ #endif
+ #ifndef _UINT64_T
+ #define _UINT64_T
+ #endif
+EOF
+elif test "$ac_cv_type_u_int64_t" = yes; then
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ /* system headers have an u_int64_t (and int64_t) */
+ #ifndef _INT64_T
+ #define _INT64_T
+ #endif
+ #ifndef _UINT64_T
+ #define _UINT64_T
+ #ifndef __uint64_t_defined
+ #define __uint64_t_defined
+ typedef u_int64_t uint64_t;
+ #endif
+ #endif
+EOF
+elif test -n "$acx_cv_type_int64_t"; then
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ /* architecture has a 64-bit type, $acx_cv_type_int64_t */
+ #ifndef _INT64_T
+ #define _INT64_T
+ typedef $acx_cv_type_int64_t int64_t;
+ #endif
+ #ifndef _UINT64_T
+ #define _UINT64_T
+ #ifndef __uint64_t_defined
+ #define __uint64_t_defined
+ typedef unsigned $acx_cv_type_int64_t uint64_t;
+ #endif
+ #endif
+EOF
+else
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ /* some common heuristics for int64_t, using compiler-specific tests */
+ #if defined __STDC_VERSION__ && (__STDC_VERSION__-0) >= 199901L
+ #ifndef _INT64_T
+ #define _INT64_T
+ #ifndef __int64_t_defined
+ typedef long long int64_t;
+ #endif
+ #endif
+ #ifndef _UINT64_T
+ #define _UINT64_T
+ typedef unsigned long long uint64_t;
+ #endif
+
+ #elif defined __GNUC__ && defined (__STDC__) && __STDC__-0
+ /* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and
+ does not implement __extension__. But that compiler doesn't define
+ __GNUC_MINOR__. */
+ # if __GNUC__ < 2 || (__NeXT__ && !__GNUC_MINOR__)
+ # define __extension__
+ # endif
+
+ # ifndef _INT64_T
+ # define _INT64_T
+ __extension__ typedef long long int64_t;
+ # endif
+ # ifndef _UINT64_T
+ # define _UINT64_T
+ __extension__ typedef unsigned long long uint64_t;
+ # endif
+
+ #elif !defined __STRICT_ANSI__
+ # if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__
+
+ # ifndef _INT64_T
+ # define _INT64_T
+ typedef __int64 int64_t;
+ # endif
+ # ifndef _UINT64_T
+ # define _UINT64_T
+ typedef unsigned __int64 uint64_t;
+ # endif
+ # endif /* compiler */
+
+ #endif /* ANSI version */
+EOF
+fi
+
+# ------------- done int64_t types, emit intptr types ------------
+if test "$ac_cv_type_uintptr_t" != yes; then
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ /* Define intptr_t based on sizeof(void*) = $ac_cv_sizeof_void_p */
+ #ifndef __uintptr_t_defined
+ typedef u$acx_cv_type_intptr_t uintptr_t;
+ #endif
+ #ifndef __intptr_t_defined
+ typedef $acx_cv_type_intptr_t intptr_t;
+ #endif
+EOF
+fi
+
+# ------------- done intptr types, emit int_least types ------------
+if test "$ac_cv_type_int_least32_t" != yes; then
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ /* Define int_least types */
+ typedef int8_t int_least8_t;
+ typedef int16_t int_least16_t;
+ typedef int32_t int_least32_t;
+ #ifdef _INT64_T
+ typedef int64_t int_least64_t;
+ #endif
+
+ typedef uint8_t uint_least8_t;
+ typedef uint16_t uint_least16_t;
+ typedef uint32_t uint_least32_t;
+ #ifdef _UINT64_T
+ typedef uint64_t uint_least64_t;
+ #endif
+EOF
+fi
+
+# ------------- done intptr types, emit int_fast types ------------
+if test "$ac_cv_type_int_fast32_t" != yes; then
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ /* Define int_fast types. short is often slow */
+ typedef int8_t int_fast8_t;
+ typedef int int_fast16_t;
+ typedef int32_t int_fast32_t;
+ #ifdef _INT64_T
+ typedef int64_t int_fast64_t;
+ #endif
+
+ typedef uint8_t uint_fast8_t;
+ typedef unsigned int uint_fast16_t;
+ typedef uint32_t uint_fast32_t;
+ #ifdef _UINT64_T
+ typedef uint64_t uint_fast64_t;
+ #endif
+EOF
+fi
+
+if test "$ac_cv_type_uintmax_t" != yes; then
+ sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ /* Define intmax based on what we found */
+ #ifdef _INT64_T
+ typedef int64_t intmax_t;
+ #else
+ typedef long intmax_t;
+ #endif
+ #ifdef _UINT64_T
+ typedef uint64_t uintmax_t;
+ #else
+ typedef unsigned long uintmax_t;
+ #endif
+EOF
+fi
+
+sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+ #endif /* GCC_GENERATED_STDINT_H */
+EOF
+
+if test -r bfd_stdint.h && cmp -s tmp-stdint.h bfd_stdint.h; then
+ rm -f tmp-stdint.h
+else
+ mv -f tmp-stdint.h bfd_stdint.h
+fi
+
+ ;;
+ default )
+case "$srcdir" in
+ .) srcdirpre= ;;
+ *) srcdirpre='$(srcdir)/' ;;
+esac
+POFILES=
+GMOFILES=
+for lang in dummy $OBSOLETE_ALL_LINGUAS; do
+ if test $lang != dummy; then
+ POFILES="$POFILES $srcdirpre$lang.po"
+ GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
+ fi
+done
+sed -e '/SRC-POTFILES =/r po/SRC-POTFILES' \
+ -e '/BLD-POTFILES =/r po/BLD-POTFILES' \
+ -e "s,@POFILES@,$POFILES," \
+ -e "s,@GMOFILES@,$GMOFILES," \
+ po/Makefile.in > po/Makefile ;;
esac
done
_ACEOF
diff --git a/bfd/configure.in b/bfd/configure.in
index 212f96142fd8..1ea98ae0259a 100644
--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -8,7 +8,7 @@ AC_CONFIG_SRCDIR([libbfd.c])
AC_CANONICAL_TARGET
AC_ISC_POSIX
-AM_INIT_AUTOMAKE(bfd, 2.17)
+AM_INIT_AUTOMAKE(bfd, 2.17.50)
dnl These must be called before AM_PROG_LIBTOOL, because it may want
dnl to call AC_CHECK_PROG.
@@ -19,7 +19,10 @@ dnl Default to a non shared library. This may be overridden by the
dnl configure option --enable-shared.
AM_DISABLE_SHARED
-AM_PROG_LIBTOOL
+AC_PROG_CC
+AC_GNU_SOURCE
+
+AC_PROG_LIBTOOL
AC_ARG_ENABLE(64-bit-bfd,
[ --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)],
@@ -63,6 +66,17 @@ if test $use_secureplt = true; then
[Define if we should default to creating read-only plt entries])
fi
+DEBUGDIR=${libdir}/debug
+
+AC_ARG_WITH(separate-debug-dir,
+ AS_HELP_STRING([--with-separate-debug-dir=DIR],
+ [Look for global separate debug info in DIR [[default=LIBDIR/debug]]]),
+[DEBUGDIR="${withval}"])
+AC_SUBST(DEBUGDIR)
+
+ACX_PKGVERSION([GNU Binutils])
+ACX_BUGURL([http://www.sourceware.org/bugzilla/])
+
AM_BINUTILS_WARNINGS
AM_CONFIG_HEADER(config.h:config.in)
@@ -72,6 +86,7 @@ if test -z "$target" ; then
fi
AM_MAINTAINER_MODE
+AM_CONDITIONAL(GENINSRC_NEVER, false)
AM_INSTALL_LIBBFD
AC_EXEEXT
@@ -81,11 +96,9 @@ bfd_default_target_size=32
# host stuff:
-AC_PROG_CC
-AC_GNU_SOURCE
-
ALL_LINGUAS="fr tr ja es sv da zh_CN ro rw vi"
-CY_GNU_GETTEXT
+ZW_GNU_GETTEXT_SISTER_DIR
+AM_PO_SUBDIRS
# Permit host specific settings.
. ${srcdir}/configure.host
@@ -135,6 +148,7 @@ BFD_CC_FOR_BUILD
AC_CHECK_HEADERS(stddef.h string.h strings.h stdlib.h time.h unistd.h)
AC_CHECK_HEADERS(fcntl.h sys/file.h sys/time.h)
+GCC_HEADER_STDINT(bfd_stdint.h)
AC_HEADER_TIME
AC_HEADER_DIRENT
ACX_HEADER_STRING
@@ -178,7 +192,9 @@ if test "${target}" = "${host}"; then
alpha*-*-*) COREFILE=osf-core.lo ;;
arm-*-freebsd* | arm-*-kfreebsd*-gnu)
COREFILE='' ;;
- arm-*-netbsd*) COREFILE=netbsd-core.lo ;;
+ arm-*-netbsd* | arm-*-openbsd*)
+ COREFILE=netbsd-core.lo
+ ;;
arm-*-riscix) COREFILE=trad-core.lo ;;
hppa*-*-hpux*) COREFILE=hpux-core.lo ;;
hppa*-*-hiux*) COREFILE=hpux-core.lo ;;
@@ -361,7 +377,9 @@ changequote([,])dnl
powerpc-*-netbsd*) COREFILE=netbsd-core.lo ;;
powerpc-*-*bsd*) COREFILE=netbsd-core.lo ;;
s390*-*-*) COREFILE=trad-core.lo ;;
- sh*-*-netbsd*) COREFILE=netbsd-core.lo ;;
+ sh*-*-netbsd* | sh*-*-openbsd*)
+ COREFILE=netbsd-core.lo
+ ;;
sparc-*-netbsd* | sparc*-*-openbsd*)
COREFILE=netbsd-core.lo
;;
@@ -551,7 +569,7 @@ selarchs="$f"
# Target backend .o files.
tb=
-elf="elf.lo elflink.lo elf-strtab.lo elf-eh-frame.lo dwarf1.lo"
+elf="elf.lo elflink.lo elf-attrs.lo elf-strtab.lo elf-eh-frame.lo dwarf1.lo"
for vec in $selvecs
do
@@ -570,6 +588,10 @@ do
arm_epoc_pe_little_vec) tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;;
arm_epoc_pei_big_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;;
arm_epoc_pei_little_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;;
+ arm_wince_pe_big_vec) tb="$tb pe-arm-wince.lo pe-arm.lo peigen.lo cofflink.lo " ;;
+ arm_wince_pe_little_vec) tb="$tb pe-arm-wince.lo pe-arm.lo peigen.lo cofflink.lo " ;;
+ arm_wince_pei_big_vec) tb="$tb pei-arm-wince.lo pei-arm.lo peigen.lo cofflink.lo " ;;
+ arm_wince_pei_little_vec) tb="$tb pei-arm-wince.lo pei-arm.lo peigen.lo cofflink.lo " ;;
armcoff_big_vec) tb="$tb coff-arm.lo cofflink.lo " ;;
armcoff_little_vec) tb="$tb coff-arm.lo cofflink.lo " ;;
armnetbsd_vec) tb="$tb armnetbsd.lo aout32.lo" ;;
@@ -580,6 +602,7 @@ do
b_out_vec_big_host) tb="$tb bout.lo aout32.lo" ;;
b_out_vec_little_host) tb="$tb bout.lo aout32.lo" ;;
bfd_efi_app_ia32_vec) tb="$tb efi-app-ia32.lo peigen.lo cofflink.lo" ;;
+ bfd_efi_app_x86_64_vec) tb="$tb efi-app-x86_64.lo pex64igen.lo cofflink.lo" ;target_size=64;;
bfd_efi_app_ia64_vec) tb="$tb efi-app-ia64.lo pepigen.lo cofflink.lo"; target_size=64 ;;
bfd_elf32_am33lin_vec) tb="$tb elf32-am33lin.lo elf32.lo $elf" ;;
bfd_elf32_avr_vec) tb="$tb elf32-avr.lo elf32.lo $elf" ;;
@@ -595,6 +618,7 @@ do
bfd_elf32_bigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_bigmips_vxworks_vec)
tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
+ bfd_elf32_cr16_vec) tb="$tb elf32-cr16.lo elf32.lo $elf" ;;
bfd_elf32_cr16c_vec) tb="$tb elf32-cr16c.lo elf32.lo $elf" ;;
bfd_elf32_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;;
bfd_elf32_crx_vec) tb="$tb elf32-crx.lo elf32.lo $elf" ;;
@@ -640,6 +664,8 @@ do
bfd_elf32_m88k_vec) tb="$tb elf32-m88k.lo elf32.lo $elf" ;;
bfd_elf32_mcore_big_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
bfd_elf32_mcore_little_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
+ bfd_elf32_mep_vec) tb="$tb elf32-mep.lo elf32.lo $elf" ;;
+ bfd_elf32_mep_little_vec) tb="$tb elf32-mep.lo elf32.lo $elf" ;;
bfd_elf32_mn10200_vec) tb="$tb elf-m10200.lo elf32.lo $elf" ;;
bfd_elf32_mn10300_vec) tb="$tb elf-m10300.lo elf32.lo $elf" ;;
bfd_elf32_mt_vec) tb="$tb elf32-mt.lo elf32.lo $elf" ;;
@@ -656,24 +682,29 @@ do
bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_powerpc_vxworks_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_s390_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;;
+ bfd_elf32_bigscore_vec) tb="$tb elf32-score.lo elf32.lo $elf" ;;
+ bfd_elf32_littlescore_vec) tb="$tb elf32-score.lo elf32.lo $elf" ;;
# FIXME: We include cofflink.lo not because it's needed for
# bfd_elf32_sh64[l]_vec, but because we include bfd_elf32_sh[l]_vec
# which needs it but does not list it. Should be fixed in right place.
- bfd_elf32_sh64_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
- bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
- bfd_elf32_sh64lin_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
- bfd_elf32_sh64blin_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
- bfd_elf32_sh64lnbsd_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;;
- bfd_elf32_sh64nbsd_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;;
- bfd_elf32_sh_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
- bfd_elf32_shblin_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
- bfd_elf32_shl_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
- bfd_elf32_shl_symbian_vec) tb="$tb elf32-sh-symbian.lo elf32-sh64-com.lo elf32.lo $elf coff-sh.lo" ;;
- bfd_elf32_shlin_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
- bfd_elf32_shlnbsd_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
- bfd_elf32_shnbsd_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+ bfd_elf32_sh64_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
+ bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
+ bfd_elf32_sh64lin_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
+ bfd_elf32_sh64blin_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
+ bfd_elf32_sh64lnbsd_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" ;;
+ bfd_elf32_sh64nbsd_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf cofflink.lo" ;;
+ bfd_elf32_sh_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;;
+ bfd_elf32_shblin_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+ bfd_elf32_shl_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;;
+ bfd_elf32_shl_symbian_vec) tb="$tb elf32-sh-symbian.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;;
+ bfd_elf32_shlin_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+ bfd_elf32_shlnbsd_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+ bfd_elf32_shlvxworks_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;;
+ bfd_elf32_shnbsd_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+ bfd_elf32_shvxworks_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;;
bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_sparc_vxworks_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;;
+ bfd_elf32_spu_vec) tb="$tb elf32-spu.lo elf32.lo $elf" ;;
bfd_elf32_tradbigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_us_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;;
@@ -705,8 +736,10 @@ do
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 elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_sparc_freebsd_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_tradbigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
+ bfd_elf64_x86_64_freebsd_vec) tb="$tb elf64-x86-64.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_x86_64_vec) tb="$tb elf64-x86-64.lo elf64.lo $elf"; target_size=64 ;;
bfd_mmo_vec) tb="$tb mmo.lo" target_size=64 ;;
bfd_powerpc_pe_vec) tb="$tb pe-ppc.lo peigen.lo cofflink.lo" ;;
@@ -729,6 +762,7 @@ do
i386aout_vec) tb="$tb i386aout.lo aout32.lo" ;;
i386bsd_vec) tb="$tb i386bsd.lo aout32.lo" ;;
i386coff_vec) tb="$tb coff-i386.lo cofflink.lo" ;;
+ x86_64coff_vec) tb="$tb coff-x86_64.lo cofflink.lo"; target_size=64 ;;
i386dynix_vec) tb="$tb i386dynix.lo aout32.lo" ;;
i386freebsd_vec) tb="$tb i386freebsd.lo aout32.lo" ;;
i386linux_vec) tb="$tb i386linux.lo aout32.lo" ;;
@@ -740,6 +774,8 @@ do
i386os9k_vec) tb="$tb i386os9k.lo aout32.lo" ;;
i386pe_vec) tb="$tb pe-i386.lo peigen.lo cofflink.lo" ;;
i386pei_vec) tb="$tb pei-i386.lo peigen.lo cofflink.lo" ;;
+ x86_64pe_vec) tb="$tb pe-x86_64.lo pex64igen.lo cofflink.lo"; target_size=64 ;;
+ x86_64pei_vec) tb="$tb pei-x86_64.lo pex64igen.lo cofflink.lo"; target_size=64 ;;
i860coff_vec) tb="$tb coff-i860.lo cofflink.lo" ;;
icoff_big_vec) tb="$tb coff-i960.lo cofflink.lo" ;;
icoff_little_vec) tb="$tb coff-i960.lo cofflink.lo" ;;
@@ -890,7 +926,7 @@ fi # all_targets is true
case ${host64}-${target64}-${want64} in
*true*)
wordsize=64
- bfd_libs='$(BFD64_LIBS) $(BFD32_LIBS)'
+ bfd64_libs='$(BFD64_LIBS)'
all_backends='$(BFD64_BACKENDS) $(BFD32_BACKENDS)'
if test $BFD_HOST_64_BIT_DEFINED = 0; then
AC_MSG_WARN([You have requested a 64 bit BFD configuration, but])
@@ -911,13 +947,12 @@ case ${host64}-${target64}-${want64} in
;;
false-false-false)
wordsize=32
- bfd_libs='$(BFD32_LIBS)'
all_backends='$(BFD32_BACKENDS)'
;;
esac
AC_SUBST(wordsize)
-AC_SUBST(bfd_libs)
+AC_SUBST(bfd64_libs)
AC_SUBST(all_backends)
AC_SUBST(bfd_backends)
AC_SUBST(bfd_machines)
@@ -962,7 +997,28 @@ esac
rm -f doc/config.status
AC_CONFIG_FILES([Makefile doc/Makefile bfd-in3.h:bfd-in2.h po/Makefile.in:po/Make-in])
-AC_CONFIG_COMMANDS([default],[[sed -e '/SRC-POTFILES =/r po/SRC-POTFILES' -e '/BLD-POTFILES =/r po/BLD-POTFILES' po/Makefile.in > po/Makefile]],[[]])
+
+dnl We need this duplication, even though we use AM_PO_SUBDIRS, because of
+dnl our two separate POTFILES. Yuck.
+AC_CONFIG_COMMANDS([default],
+[[
+case "$srcdir" in
+ .) srcdirpre= ;;
+ *) srcdirpre='$(srcdir)/' ;;
+esac
+POFILES=
+GMOFILES=
+for lang in dummy $OBSOLETE_ALL_LINGUAS; do
+ if test $lang != dummy; then
+ POFILES="$POFILES $srcdirpre$lang.po"
+ GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
+ fi
+done
+sed -e '/SRC-POTFILES =/r po/SRC-POTFILES' \
+ -e '/BLD-POTFILES =/r po/BLD-POTFILES' \
+ -e "s,@POFILES@,$POFILES," \
+ -e "s,@GMOFILES@,$GMOFILES," \
+ po/Makefile.in > po/Makefile]],[[]])
dnl Required by html and install-html
AC_SUBST(datarootdir)
diff --git a/bfd/corefile.c b/bfd/corefile.c
index 602de911a2c5..58cd7f613f6d 100644
--- a/bfd/corefile.c
+++ b/bfd/corefile.c
@@ -1,6 +1,6 @@
/* Core file generic interface routines for BFD.
- Copyright 1990, 1991, 1992, 1993, 1994, 2000, 2001, 2002, 2003, 2005
- Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1992, 1993, 1994, 2000, 2001, 2002, 2003, 2005,
+ 2007 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -30,8 +30,8 @@ DESCRIPTION
These are functions pertaining to core files.
*/
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
/*
diff --git a/bfd/cpu-alpha.c b/bfd/cpu-alpha.c
index 48b748d9f36e..db7abfbdb29f 100644
--- a/bfd/cpu-alpha.c
+++ b/bfd/cpu-alpha.c
@@ -1,5 +1,5 @@
/* BFD support for the Alpha architecture.
- Copyright 1992, 1993, 1998, 2000, 2002, 2003
+ Copyright 1992, 1993, 1998, 2000, 2002, 2003, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#define N(BITS_WORD, BITS_ADDR, NUMBER, PRINT, DEFAULT, NEXT) \
diff --git a/bfd/cpu-arc.c b/bfd/cpu-arc.c
index ef97da0eda2e..bf9a739149f4 100644
--- a/bfd/cpu-arc.c
+++ b/bfd/cpu-arc.c
@@ -1,5 +1,6 @@
/* BFD support for the ARC processor
- Copyright 1994, 1995, 1997, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1994, 1995, 1997, 2001, 2002, 2007
+ Free Software Foundation, Inc.
Contributed by Doug Evans (dje@cygnus.com).
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +19,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#define ARC(mach, print_name, default_p, next) \
diff --git a/bfd/cpu-arm.c b/bfd/cpu-arm.c
index a28a1f9e8fcf..a44b98395eee 100644
--- a/bfd/cpu-arm.c
+++ b/bfd/cpu-arm.c
@@ -1,5 +1,5 @@
/* BFD support for the ARM processor
- Copyright 1994, 1997, 1999, 2000, 2002, 2003, 2004, 2005
+ Copyright 1994, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2007
Free Software Foundation, Inc.
Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
@@ -19,8 +19,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "libiberty.h"
@@ -92,7 +92,8 @@ processors[] =
{ bfd_mach_arm_4, "strongarm1100" },
{ bfd_mach_arm_XScale, "xscale" },
{ bfd_mach_arm_ep9312, "ep9312" },
- { bfd_mach_arm_iWMMXt, "iwmmxt" }
+ { bfd_mach_arm_iWMMXt, "iwmmxt" },
+ { bfd_mach_arm_iWMMXt2, "iwmmxt2" }
};
static bfd_boolean
@@ -137,7 +138,8 @@ static const bfd_arch_info_type arch_info_struct[] =
N (bfd_mach_arm_5TE, "armv5te", FALSE, & arch_info_struct[9]),
N (bfd_mach_arm_XScale, "xscale", FALSE, & arch_info_struct[10]),
N (bfd_mach_arm_ep9312, "ep9312", FALSE, & arch_info_struct[11]),
- N (bfd_mach_arm_iWMMXt,"iwmmxt", FALSE, NULL)
+ N (bfd_mach_arm_iWMMXt, "iwmmxt", FALSE, & arch_info_struct[12]),
+ N (bfd_mach_arm_iWMMXt2, "iwmmxt2", FALSE, NULL)
};
const bfd_arch_info_type bfd_arm_arch =
@@ -179,7 +181,9 @@ bfd_arm_merge_machines (bfd *ibfd, bfd *obfd)
Intel XScale binary, since these architecture have co-processors which
will not both be present on the same physical hardware. */
else if (in == bfd_mach_arm_ep9312
- && (out == bfd_mach_arm_XScale || out == bfd_mach_arm_iWMMXt))
+ && (out == bfd_mach_arm_XScale
+ || out == bfd_mach_arm_iWMMXt
+ || out == bfd_mach_arm_iWMMXt2))
{
_bfd_error_handler (_("\
ERROR: %B is compiled for the EP9312, whereas %B is compiled for XScale"),
@@ -188,7 +192,9 @@ ERROR: %B is compiled for the EP9312, whereas %B is compiled for XScale"),
return FALSE;
}
else if (out == bfd_mach_arm_ep9312
- && (in == bfd_mach_arm_XScale || in == bfd_mach_arm_iWMMXt))
+ && (in == bfd_mach_arm_XScale
+ || in == bfd_mach_arm_iWMMXt
+ || in == bfd_mach_arm_iWMMXt2))
{
_bfd_error_handler (_("\
ERROR: %B is compiled for the EP9312, whereas %B is compiled for XScale"),
@@ -309,6 +315,7 @@ bfd_arm_update_notes (bfd *abfd, const char *note_section)
case bfd_mach_arm_XScale: expected = "XScale"; break;
case bfd_mach_arm_ep9312: expected = "ep9312"; break;
case bfd_mach_arm_iWMMXt: expected = "iWMMXt"; break;
+ case bfd_mach_arm_iWMMXt2: expected = "iWMMXt2"; break;
}
if (strcmp (arch_string, expected) != 0)
@@ -355,7 +362,8 @@ architectures[] =
{ "armv5te", bfd_mach_arm_5TE },
{ "XScale", bfd_mach_arm_XScale },
{ "ep9312", bfd_mach_arm_ep9312 },
- { "iWMMXt", bfd_mach_arm_iWMMXt }
+ { "iWMMXt", bfd_mach_arm_iWMMXt },
+ { "iWMMXt2", bfd_mach_arm_iWMMXt2 }
};
/* Extract the machine number stored in a note section. */
@@ -402,14 +410,22 @@ bfd_arm_get_mach_from_notes (bfd *abfd, const char *note_section)
}
bfd_boolean
-bfd_is_arm_mapping_symbol_name (const char * name)
+bfd_is_arm_special_symbol_name (const char * name, int type)
{
/* The ARM compiler outputs several obsolete forms. Recognize them
- in addition to the standard $a, $t and $d. */
- return (name != NULL)
- && (name[0] == '$')
- && ((name[1] == 'a') || (name[1] == 't') || (name[1] == 'd')
- || (name[1] == 'm') || (name[1] == 'f') || (name[1] == 'p'))
- && (name[2] == 0 || name[2] == '.');
+ in addition to the standard $a, $t and $d. We are somewhat loose
+ in what we accept here, since the full set is not documented. */
+ if (!name || name[0] != '$')
+ return FALSE;
+ if (name[1] == 'a' || name[1] == 't' || name[1] == 'd')
+ type &= BFD_ARM_SPECIAL_SYM_TYPE_MAP;
+ else if (name[1] == 'm' || name[1] == 'f' || name[1] == 'p')
+ type &= BFD_ARM_SPECIAL_SYM_TYPE_TAG;
+ else if (name[1] >= 'a' && name[1] <= 'z')
+ type &= BFD_ARM_SPECIAL_SYM_TYPE_OTHER;
+ else
+ return FALSE;
+
+ return (type != 0 && (name[2] == 0 || name[2] == '.'));
}
diff --git a/bfd/cpu-avr.c b/bfd/cpu-avr.c
index 4c8c193f6169..82b282ac22f3 100644
--- a/bfd/cpu-avr.c
+++ b/bfd/cpu-avr.c
@@ -1,5 +1,5 @@
/* BFD library support routines for the AVR architecture.
- Copyright 1999, 2000, 2002, 2006 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2002, 2006, 2007 Free Software Foundation, Inc.
Contributed by Denis Chertykov <denisc@overta.ru>
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
/* This routine is provided two arch_infos and works out which AVR
@@ -82,7 +82,10 @@ static const bfd_arch_info_type arch_info_struct[] =
N (16, bfd_mach_avr4, "avr:4", FALSE, & arch_info_struct[4]),
/* ATmega161, ATmega163, ATmega32, AT94K. */
- N (22, bfd_mach_avr5, "avr:5", FALSE, NULL)
+ N (22, bfd_mach_avr5, "avr:5", FALSE, & arch_info_struct[5]),
+
+ /* ATmega256x. */
+ N (22, bfd_mach_avr6, "avr:6", FALSE, NULL)
};
const bfd_arch_info_type bfd_avr_arch =
diff --git a/bfd/cpu-bfin.c b/bfd/cpu-bfin.c
index 6de6757a9a82..e30ee37d08c3 100644
--- a/bfd/cpu-bfin.c
+++ b/bfd/cpu-bfin.c
@@ -1,6 +1,6 @@
/* BFD Support for the ADI Blackfin processor.
- Copyright 2005 Free Software Foundation, Inc.
+ Copyright 2005, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -19,8 +19,8 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_bfin_arch =
diff --git a/bfd/cpu-cr16.c b/bfd/cpu-cr16.c
new file mode 100644
index 000000000000..5695f0eda87b
--- /dev/null
+++ b/bfd/cpu-cr16.c
@@ -0,0 +1,40 @@
+/* BFD support for the CR16 processor.
+ Copyright 2007 Free Software Foundation, Inc.
+ Written by M R Swami Reddy
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "libbfd.h"
+
+
+const bfd_arch_info_type bfd_cr16_arch =
+ {
+ 16, /* 16 bits in a word. */
+ 32, /* 32 bits in an address. */
+ 8, /* 8 bits in a byte. */
+ bfd_arch_cr16, /* enum bfd_architecture arch. */
+ bfd_mach_cr16,
+ "cr16", /* Arch name. */
+ "cr16", /* Printable name. */
+ 1, /* Unsigned int section alignment power. */
+ TRUE, /* The one and only. */
+ bfd_default_compatible,
+ bfd_default_scan ,
+ 0,
+ };
diff --git a/bfd/cpu-cr16c.c b/bfd/cpu-cr16c.c
index 1ab39ed6fec4..08eea01a84ed 100644
--- a/bfd/cpu-cr16c.c
+++ b/bfd/cpu-cr16c.c
@@ -1,5 +1,5 @@
/* BFD support for the CR16C processor.
- Copyright 2004 Free Software Foundation, Inc.
+ Copyright 2004, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,8 +17,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_cr16c_arch =
diff --git a/bfd/cpu-cris.c b/bfd/cpu-cris.c
index e89d74b5055c..0e6c24d32f8d 100644
--- a/bfd/cpu-cris.c
+++ b/bfd/cpu-cris.c
@@ -1,5 +1,6 @@
/* BFD support for the Axis CRIS architecture.
- Copyright 2000, 2002, 2004, 2005 Free Software Foundation, Inc.
+ Copyright 2000, 2002, 2004, 2005, 2007
+ Free Software Foundation, Inc.
Contributed by Axis Communications AB.
Written by Hans-Peter Nilsson.
@@ -19,8 +20,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
/* This routine is provided two arch_infos and returns the lowest common
diff --git a/bfd/cpu-crx.c b/bfd/cpu-crx.c
index 9605dd578f43..855d2e6d9aaf 100644
--- a/bfd/cpu-crx.c
+++ b/bfd/cpu-crx.c
@@ -1,5 +1,5 @@
/* BFD support for the CRX processor.
- Copyright 2004 Free Software Foundation, Inc.
+ Copyright 2004, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,8 +17,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
diff --git a/bfd/cpu-d10v.c b/bfd/cpu-d10v.c
index 18061a137976..77ca6ff4974b 100644
--- a/bfd/cpu-d10v.c
+++ b/bfd/cpu-d10v.c
@@ -1,5 +1,6 @@
/* BFD support for the D10V processor
- Copyright 1996, 1999, 2000, 2002, 2005 Free Software Foundation, Inc.
+ Copyright 1996, 1999, 2000, 2002, 2005, 2007
+ Free Software Foundation, Inc.
Contributed by Martin Hunt (hunt@cygnus.com).
This file is part of BFD, the Binary File Descriptor library.
@@ -19,8 +20,8 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
static const bfd_arch_info_type d10v_ts3_info =
diff --git a/bfd/cpu-d30v.c b/bfd/cpu-d30v.c
index 5346cb3219ff..cec22428b225 100644
--- a/bfd/cpu-d30v.c
+++ b/bfd/cpu-d30v.c
@@ -1,5 +1,5 @@
/* BFD support for the Mitsubishi D30V processor
- Copyright 1997, 2002, 2005 Free Software Foundation, Inc.
+ Copyright 1997, 2002, 2005, 2007 Free Software Foundation, Inc.
Contributed by Martin Hunt (hunt@cygnus.com).
This file is part of BFD, the Binary File Descriptor library.
@@ -19,8 +19,8 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_d30v_arch =
diff --git a/bfd/cpu-dlx.c b/bfd/cpu-dlx.c
index d4771cae7a79..f71ed098bef5 100644
--- a/bfd/cpu-dlx.c
+++ b/bfd/cpu-dlx.c
@@ -1,5 +1,5 @@
/* BFD support for the DLX Microprocessor architecture.
- Copyright 2002 Free Software Foundation, Inc.
+ Copyright 2002, 2007 Free Software Foundation, Inc.
Hacked by Kuang Hwa Lin <kuang@sbcglobal.net>
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_dlx_arch =
diff --git a/bfd/cpu-fr30.c b/bfd/cpu-fr30.c
index 585d820b84a4..fd3057436d6b 100644
--- a/bfd/cpu-fr30.c
+++ b/bfd/cpu-fr30.c
@@ -1,5 +1,5 @@
/* BFD support for the FR30 processor.
- Copyright 1998, 2002 Free Software Foundation, Inc.
+ Copyright 1998, 2002, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_fr30_arch =
diff --git a/bfd/cpu-frv.c b/bfd/cpu-frv.c
index f80066b9bbac..4d803095c78c 100644
--- a/bfd/cpu-frv.c
+++ b/bfd/cpu-frv.c
@@ -1,5 +1,5 @@
/* BFD support for the FRV processor.
- Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#define FRV_ARCH(MACHINE, NAME, DEFAULT, NEXT) \
diff --git a/bfd/cpu-h8300.c b/bfd/cpu-h8300.c
index e7a2bf263ea2..cb9d0d8715b8 100644
--- a/bfd/cpu-h8300.c
+++ b/bfd/cpu-h8300.c
@@ -1,6 +1,6 @@
/* BFD library support routines for the Renesas H8/300 architecture.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2000, 2001, 2002,
- 2003, 2004 Free Software Foundation, Inc.
+ 2003, 2004, 2007 Free Software Foundation, Inc.
Hacked by Steve Chamberlain of Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -19,8 +19,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
static bfd_boolean
diff --git a/bfd/cpu-h8500.c b/bfd/cpu-h8500.c
index 11193275eec8..78788aec66ae 100644
--- a/bfd/cpu-h8500.c
+++ b/bfd/cpu-h8500.c
@@ -1,5 +1,5 @@
/* BFD library support routines for the H8/500 architecture.
- Copyright 1993, 1995, 1999, 2000, 2001, 2002, 2003, 2005
+ Copyright 1993, 1995, 1999, 2000, 2001, 2002, 2003, 2005, 2007
Free Software Foundation, Inc.
Hacked by Steve Chamberlain of Cygnus Support.
@@ -19,8 +19,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
static bfd_boolean scan_mach
diff --git a/bfd/cpu-hppa.c b/bfd/cpu-hppa.c
index de9d1f43b277..b11ce8d94b25 100644
--- a/bfd/cpu-hppa.c
+++ b/bfd/cpu-hppa.c
@@ -1,5 +1,5 @@
/* BFD support for the HP Precision Architecture architecture.
- Copyright 1992, 1995, 1998, 1999, 2000, 2002, 2003
+ Copyright 1992, 1995, 1998, 1999, 2000, 2002, 2003, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
static const bfd_arch_info_type bfd_hppa10_arch =
diff --git a/bfd/cpu-i370.c b/bfd/cpu-i370.c
index d7d712f3ff99..1fa97580602f 100644
--- a/bfd/cpu-i370.c
+++ b/bfd/cpu-i370.c
@@ -1,5 +1,5 @@
/* BFD i370 CPU definition
- Copyright 1994, 1995, 1996, 1998, 1999, 2000, 2002, 2005
+ Copyright 1994, 1995, 1996, 1998, 1999, 2000, 2002, 2005, 2007
Free Software Foundation, Inc.
Contributed by Ian Lance Taylor, Cygnus Support.
Hacked by Linas Vepstas <linas@linas.org> in 1998, 1999
@@ -21,8 +21,8 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
static const bfd_arch_info_type arch_info_struct[] =
diff --git a/bfd/cpu-i386.c b/bfd/cpu-i386.c
index 8886c47d0a09..339c7d994001 100644
--- a/bfd/cpu-i386.c
+++ b/bfd/cpu-i386.c
@@ -1,5 +1,5 @@
/* BFD support for the Intel 386 architecture.
- Copyright 1992, 1994, 1995, 1996, 1998, 2000, 2001, 2002, 2004
+ Copyright 1992, 1994, 1995, 1996, 1998, 2000, 2001, 2002, 2004, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_x86_64_arch_intel_syntax =
diff --git a/bfd/cpu-i860.c b/bfd/cpu-i860.c
index 33262fe553d0..df38ddfc9bab 100644
--- a/bfd/cpu-i860.c
+++ b/bfd/cpu-i860.c
@@ -1,5 +1,6 @@
/* BFD support for the Intel 860 architecture.
- Copyright 1992, 1995, 2000, 2002 Free Software Foundation, Inc.
+ Copyright 1992, 1995, 2000, 2002, 2007
+ Free Software Foundation, Inc.
Created mostly by substituting "860" for "386" in cpu-i386.c
Harry Dolan <dolan@ssd.intel.com>, October 1995
@@ -19,8 +20,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_i860_arch =
diff --git a/bfd/cpu-i960.c b/bfd/cpu-i960.c
index 7a9be7ca640a..3569aac789d2 100644
--- a/bfd/cpu-i960.c
+++ b/bfd/cpu-i960.c
@@ -1,26 +1,26 @@
/* BFD library support routines for the i960 architecture.
- Copyright 1990, 1991, 1993, 1994, 1996, 1999, 2000, 2001, 2002
- Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1993, 1994, 1996, 1999, 2000, 2001, 2002, 2006,
+ 2007 Free Software Foundation, Inc.
Hacked by 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
static bfd_boolean scan_960_mach
@@ -57,7 +57,7 @@ scan_960_mach (ap, string)
}
/* In some bfds the cpu-id is written as "80960KA", "80960KB",
"80960CA" or "80960MC". */
- else if (strncmp ("80960", string, 5) == 0)
+ else if (CONST_STRNEQ (string, "80960"))
{
string += 5;
diff --git a/bfd/cpu-ia64.c b/bfd/cpu-ia64.c
index e172f5a85f2b..a38d24de41bc 100644
--- a/bfd/cpu-ia64.c
+++ b/bfd/cpu-ia64.c
@@ -1,5 +1,5 @@
/* BFD support for the ia64 architecture.
- Copyright 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2002, 2007 Free Software Foundation, Inc.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_ia64_elf32_arch =
diff --git a/bfd/cpu-ip2k.c b/bfd/cpu-ip2k.c
index a03df757af6c..9e303d744c55 100644
--- a/bfd/cpu-ip2k.c
+++ b/bfd/cpu-ip2k.c
@@ -1,5 +1,5 @@
/* BFD support for the Scenix IP2xxx processor.
- Copyright 2000, 2002 Free Software Foundation, Inc.
+ Copyright 2000, 2002, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,8 +17,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_ip2k_nonext_arch =
diff --git a/bfd/cpu-iq2000.c b/bfd/cpu-iq2000.c
index c3331db05be5..ace95e2780ef 100644
--- a/bfd/cpu-iq2000.c
+++ b/bfd/cpu-iq2000.c
@@ -1,5 +1,5 @@
/* BFD support for the Vitesse IQ2000 processor.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
static const bfd_arch_info_type arch_info_struct[] =
diff --git a/bfd/cpu-m10200.c b/bfd/cpu-m10200.c
index 6f511113906c..d3d596f2d34a 100644
--- a/bfd/cpu-m10200.c
+++ b/bfd/cpu-m10200.c
@@ -1,5 +1,5 @@
/* BFD support for the Matsushita 10200 processor
- Copyright 1996, 1997, 2002 Free Software Foundation, Inc.
+ Copyright 1996, 1997, 2002, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_mn10200_arch =
diff --git a/bfd/cpu-m10300.c b/bfd/cpu-m10300.c
index c417928d83f3..7aece6e69d77 100644
--- a/bfd/cpu-m10300.c
+++ b/bfd/cpu-m10300.c
@@ -1,5 +1,5 @@
/* BFD support for the Matsushita 10300 processor
- Copyright 1996, 1997, 1999, 2000, 2002, 2003
+ Copyright 1996, 1997, 1999, 2000, 2002, 2003, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_am33_2_arch =
diff --git a/bfd/cpu-m32c.c b/bfd/cpu-m32c.c
index e60b746ffc2d..f61ff980f638 100644
--- a/bfd/cpu-m32c.c
+++ b/bfd/cpu-m32c.c
@@ -1,5 +1,5 @@
/* BFD support for the M16C/M32C processors.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,8 +17,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
static const bfd_arch_info_type arch_info_struct[] =
diff --git a/bfd/cpu-m32r.c b/bfd/cpu-m32r.c
index 0b5c8dafcdaa..dbc742a1c105 100644
--- a/bfd/cpu-m32r.c
+++ b/bfd/cpu-m32r.c
@@ -1,5 +1,6 @@
/* BFD support for the M32R processor.
- Copyright 1996, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
+ Copyright 1996, 1999, 2000, 2002, 2003, 2007
+ Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,8 +18,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#define N(number, print, default, next) \
diff --git a/bfd/cpu-m68hc11.c b/bfd/cpu-m68hc11.c
index 386d2480de69..e293a2cf5dc7 100644
--- a/bfd/cpu-m68hc11.c
+++ b/bfd/cpu-m68hc11.c
@@ -1,5 +1,5 @@
/* BFD support for the Motorola 68HC11 processor
- Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_m68hc11_arch =
diff --git a/bfd/cpu-m68hc12.c b/bfd/cpu-m68hc12.c
index 43520a1028f6..52c4f2f23e63 100644
--- a/bfd/cpu-m68hc12.c
+++ b/bfd/cpu-m68hc12.c
@@ -1,5 +1,5 @@
/* BFD support for the Motorola 68HC12 processor
- Copyright 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2002, 2003, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_m68hc12s_arch =
diff --git a/bfd/cpu-m68k.c b/bfd/cpu-m68k.c
index 5be4aa047cce..07abf9da130d 100644
--- a/bfd/cpu-m68k.c
+++ b/bfd/cpu-m68k.c
@@ -1,6 +1,6 @@
/* BFD library support routines for architectures.
Copyright 1990, 1991, 1992, 1993, 1994, 1997, 1998, 2000, 2001, 2002,
- 2003, 2004, 2006 Free Software Foundation, Inc.
+ 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
Hacked by Steve Chamberlain of Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -19,8 +19,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "opcode/m68k.h"
@@ -41,53 +41,60 @@ static const bfd_arch_info_type arch_info_struct[] =
N(bfd_mach_m68040, "m68k:68040", FALSE, &arch_info_struct[6]),
N(bfd_mach_m68060, "m68k:68060", FALSE, &arch_info_struct[7]),
N(bfd_mach_cpu32, "m68k:cpu32", FALSE, &arch_info_struct[8]),
+ N(bfd_mach_fido, "m68k:fido", FALSE, &arch_info_struct[9]),
/* Various combinations of CF architecture features */
N(bfd_mach_mcf_isa_a_nodiv, "m68k:isa-a:nodiv",
- FALSE, &arch_info_struct[9]),
- N(bfd_mach_mcf_isa_a, "m68k:isa-a",
FALSE, &arch_info_struct[10]),
- N(bfd_mach_mcf_isa_a_mac, "m68k:isa-a:mac",
+ N(bfd_mach_mcf_isa_a, "m68k:isa-a",
FALSE, &arch_info_struct[11]),
- N(bfd_mach_mcf_isa_a_emac, "m68k:isa-a:emac",
+ N(bfd_mach_mcf_isa_a_mac, "m68k:isa-a:mac",
FALSE, &arch_info_struct[12]),
- N(bfd_mach_mcf_isa_aplus, "m68k:isa-aplus",
+ N(bfd_mach_mcf_isa_a_emac, "m68k:isa-a:emac",
FALSE, &arch_info_struct[13]),
- N(bfd_mach_mcf_isa_aplus_mac, "m68k:isa-aplus:mac",
+ N(bfd_mach_mcf_isa_aplus, "m68k:isa-aplus",
FALSE, &arch_info_struct[14]),
- N(bfd_mach_mcf_isa_aplus_emac, "m68k:isa-aplus:emac",
+ N(bfd_mach_mcf_isa_aplus_mac, "m68k:isa-aplus:mac",
FALSE, &arch_info_struct[15]),
- N(bfd_mach_mcf_isa_b_nousp, "m68k:isa-b:nousp",
+ N(bfd_mach_mcf_isa_aplus_emac, "m68k:isa-aplus:emac",
FALSE, &arch_info_struct[16]),
- N(bfd_mach_mcf_isa_b_nousp_mac, "m68k:isa-b:nousp:mac",
+ N(bfd_mach_mcf_isa_b_nousp, "m68k:isa-b:nousp",
FALSE, &arch_info_struct[17]),
- N(bfd_mach_mcf_isa_b_nousp_emac, "m68k:isa-b:nousp:emac",
+ N(bfd_mach_mcf_isa_b_nousp_mac, "m68k:isa-b:nousp:mac",
FALSE, &arch_info_struct[18]),
- N(bfd_mach_mcf_isa_b, "m68k:isa-b",
+ N(bfd_mach_mcf_isa_b_nousp_emac, "m68k:isa-b:nousp:emac",
FALSE, &arch_info_struct[19]),
- N(bfd_mach_mcf_isa_b_mac, "m68k:isa-b:mac",
+ N(bfd_mach_mcf_isa_b, "m68k:isa-b",
FALSE, &arch_info_struct[20]),
- N(bfd_mach_mcf_isa_b_emac, "m68k:isa-b:emac",
+ N(bfd_mach_mcf_isa_b_mac, "m68k:isa-b:mac",
FALSE, &arch_info_struct[21]),
- N(bfd_mach_mcf_isa_b_float, "m68k:isa-b:float",
+ N(bfd_mach_mcf_isa_b_emac, "m68k:isa-b:emac",
FALSE, &arch_info_struct[22]),
- N(bfd_mach_mcf_isa_b_float_mac, "m68k:isa-b:float:mac",
+ N(bfd_mach_mcf_isa_b_float, "m68k:isa-b:float",
FALSE, &arch_info_struct[23]),
- N(bfd_mach_mcf_isa_b_float_emac, "m68k:isa-b:float:emac",
+ N(bfd_mach_mcf_isa_b_float_mac, "m68k:isa-b:float:mac",
FALSE, &arch_info_struct[24]),
+ N(bfd_mach_mcf_isa_b_float_emac, "m68k:isa-b:float:emac",
+ FALSE, &arch_info_struct[25]),
+ N(bfd_mach_mcf_isa_c, "m68k:isa-c",
+ FALSE, &arch_info_struct[26]),
+ N(bfd_mach_mcf_isa_c_mac, "m68k:isa-c:mac",
+ FALSE, &arch_info_struct[27]),
+ N(bfd_mach_mcf_isa_c_emac, "m68k:isa-c:emac",
+ FALSE, &arch_info_struct[28]),
/* Legacy names for CF architectures */
- N(bfd_mach_mcf_isa_a_nodiv, "m68k:5200", FALSE, &arch_info_struct[25]),
- N(bfd_mach_mcf_isa_a_mac,"m68k:5206e", FALSE, &arch_info_struct[26]),
- N(bfd_mach_mcf_isa_a_mac, "m68k:5307", FALSE, &arch_info_struct[27]),
- N(bfd_mach_mcf_isa_b_nousp_mac, "m68k:5407", FALSE, &arch_info_struct[28]),
- N(bfd_mach_mcf_isa_aplus_emac, "m68k:528x", FALSE, &arch_info_struct[29]),
- N(bfd_mach_mcf_isa_aplus_emac, "m68k:521x", FALSE, &arch_info_struct[30]),
- N(bfd_mach_mcf_isa_a_emac, "m68k:5249", FALSE, &arch_info_struct[31]),
+ N(bfd_mach_mcf_isa_a_nodiv, "m68k:5200", FALSE, &arch_info_struct[29]),
+ N(bfd_mach_mcf_isa_a_mac,"m68k:5206e", FALSE, &arch_info_struct[30]),
+ N(bfd_mach_mcf_isa_a_mac, "m68k:5307", FALSE, &arch_info_struct[31]),
+ N(bfd_mach_mcf_isa_b_nousp_mac, "m68k:5407", FALSE, &arch_info_struct[32]),
+ N(bfd_mach_mcf_isa_aplus_emac, "m68k:528x", FALSE, &arch_info_struct[33]),
+ N(bfd_mach_mcf_isa_aplus_emac, "m68k:521x", FALSE, &arch_info_struct[34]),
+ N(bfd_mach_mcf_isa_a_emac, "m68k:5249", FALSE, &arch_info_struct[35]),
N(bfd_mach_mcf_isa_b_float_emac, "m68k:547x",
- FALSE, &arch_info_struct[32]),
+ FALSE, &arch_info_struct[36]),
N(bfd_mach_mcf_isa_b_float_emac, "m68k:548x",
- FALSE, &arch_info_struct[33]),
+ FALSE, &arch_info_struct[37]),
N(bfd_mach_mcf_isa_b_float_emac, "m68k:cfv4e", FALSE, 0),
};
@@ -107,6 +114,7 @@ static const unsigned m68k_arch_features[] =
m68040|m68881|m68851,
m68060|m68881|m68851,
cpu32|m68881,
+ fido_a|m68881,
mcfisa_a,
mcfisa_a|mcfhwdiv,
mcfisa_a|mcfhwdiv|mcfmac,
@@ -123,6 +131,9 @@ static const unsigned m68k_arch_features[] =
mcfisa_a|mcfhwdiv|mcfisa_b|mcfusp|cfloat,
mcfisa_a|mcfhwdiv|mcfisa_b|mcfusp|cfloat|mcfmac,
mcfisa_a|mcfhwdiv|mcfisa_b|mcfusp|cfloat|mcfemac,
+ mcfisa_a|mcfhwdiv|mcfisa_c|mcfusp,
+ mcfisa_a|mcfhwdiv|mcfisa_c|mcfusp|mcfmac,
+ mcfisa_a|mcfhwdiv|mcfisa_c|mcfusp|mcfemac,
};
/* Return the count of bits set in MASK */
@@ -202,24 +213,48 @@ bfd_m68k_compatible (const bfd_arch_info_type *a,
if (a->mach <= bfd_mach_m68060 && b->mach <= bfd_mach_m68060)
/* Merge m68k machine. */
return a->mach > b->mach ? a : b;
- else if (a->mach == bfd_mach_cpu32 && b->mach == bfd_mach_cpu32)
- /* CPU32 is compatible with itself. */
- return a;
- else if (a->mach >= bfd_mach_mcf_isa_a_nodiv
- && b->mach >= bfd_mach_mcf_isa_a_nodiv)
+ else if (a->mach >= bfd_mach_cpu32 && b->mach >= bfd_mach_cpu32)
{
- /* Merge cf machine. */
+ /* Merge the machine features. */
unsigned features = (bfd_m68k_mach_to_features (a->mach)
| bfd_m68k_mach_to_features (b->mach));
+ /* CPU32 and Coldfire are incompatible. */
+ if ((~features & (cpu32 | mcfisa_a)) == 0)
+ return NULL;
+
+ /* Fido and Coldfire are incompatible. */
+ if ((~features & (fido_a | mcfisa_a)) == 0)
+ return NULL;
+
/* ISA A+ and ISA B are incompatible. */
if ((~features & (mcfisa_aa | mcfisa_b)) == 0)
return NULL;
+ /* ISA B and ISA C are incompatible. */
+ if ((~features & (mcfisa_b | mcfisa_c)) == 0)
+ return NULL;
+
/* MAC and EMAC code cannot be merged. */
if ((~features & (mcfmac | mcfemac)) == 0)
return NULL;
+ /* CPU32 is compatible with Fido except that Fido does not
+ support tbl instructions. Warn when the user wants to mix
+ the two. */
+ if ((a->mach == bfd_mach_cpu32 && b->mach == bfd_mach_fido)
+ || (a->mach == bfd_mach_fido && b->mach == bfd_mach_cpu32))
+ {
+ static int cpu32_fido_mix_warning;
+ if (!cpu32_fido_mix_warning)
+ {
+ cpu32_fido_mix_warning = 1;
+ (*_bfd_error_handler) ("warning: linking CPU32 objects with fido objects");
+ }
+ return bfd_lookup_arch (a->arch,
+ bfd_m68k_features_to_mach (fido_a | m68881));
+ }
+
return bfd_lookup_arch (a->arch, bfd_m68k_features_to_mach (features));
}
else
diff --git a/bfd/cpu-m88k.c b/bfd/cpu-m88k.c
index 394b42ec5d06..ce0dbb4ee01b 100644
--- a/bfd/cpu-m88k.c
+++ b/bfd/cpu-m88k.c
@@ -1,5 +1,6 @@
/* bfd back-end for m88k support
- Copyright 1990, 1991, 1994, 2000, 2002 Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1994, 2000, 2002, 2007
+ Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +19,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_m88k_arch =
diff --git a/bfd/cpu-maxq.c b/bfd/cpu-maxq.c
index 523ef8886163..adf2d8d19267 100644
--- a/bfd/cpu-maxq.c
+++ b/bfd/cpu-maxq.c
@@ -1,5 +1,5 @@
/* BFD support for the MAXQ20/10 architecture.
- Copyright 2004, 2005 Free Software Foundation, Inc.
+ Copyright 2004, 2005, 2007 Free Software Foundation, Inc.
Written by Vineet Sharma(vineets@noida.hcltech.com)
Inderpreet Singh(inderpreetb@noida.hcltech.com)
@@ -20,8 +20,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
/* MAXQ Archtecture info. */
diff --git a/bfd/cpu-mcore.c b/bfd/cpu-mcore.c
index 949fa430c46d..8957224725b9 100644
--- a/bfd/cpu-mcore.c
+++ b/bfd/cpu-mcore.c
@@ -1,5 +1,5 @@
/* BFD library support routines for Motorola's MCore architecture
- Copyright 1993, 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright 1993, 1999, 2000, 2002, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_mcore_arch =
diff --git a/bfd/cpu-mep.c b/bfd/cpu-mep.c
new file mode 100644
index 000000000000..d5ee1d67b423
--- /dev/null
+++ b/bfd/cpu-mep.c
@@ -0,0 +1,28 @@
+/* BFD support for the Toshiba Media Engine Processor.
+ Copyright (C) 2001, 2002, 2004, 2007 Free Software Foundation, Inc.
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "libbfd.h"
+
+#define MA(x, n, def, y) { 32, 32, 8, bfd_arch_mep, x, "mep", n, \
+ 2, def, bfd_default_compatible, bfd_default_scan, y }
+
+static const bfd_arch_info_type bfd_h1_arch = MA (bfd_mach_mep_h1, "h1", FALSE, NULL);
+const bfd_arch_info_type bfd_mep_arch = MA (bfd_mach_mep, "mep", TRUE, & bfd_h1_arch);
diff --git a/bfd/cpu-mips.c b/bfd/cpu-mips.c
index 5f4dccafbb7a..f4783790c959 100644
--- a/bfd/cpu-mips.c
+++ b/bfd/cpu-mips.c
@@ -1,6 +1,6 @@
/* bfd back-end for mips support
Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001,
- 2002, 2003, 2004 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -19,8 +19,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
static const bfd_arch_info_type *mips_compatible
diff --git a/bfd/cpu-mmix.c b/bfd/cpu-mmix.c
index fc0e875c78bb..712713707a28 100644
--- a/bfd/cpu-mmix.c
+++ b/bfd/cpu-mmix.c
@@ -1,5 +1,5 @@
/* BFD library support routines for MMIX.
- Copyright 2001, 2002 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2007 Free Software Foundation, Inc.
Contributed by Hans-Peter Nilsson (hp@bitrange.com)
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type
diff --git a/bfd/cpu-msp430.c b/bfd/cpu-msp430.c
index 18e371667d61..f7f369a355d8 100644
--- a/bfd/cpu-msp430.c
+++ b/bfd/cpu-msp430.c
@@ -1,5 +1,5 @@
/* BFD library support routines for the MSP architecture.
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2007 Free Software Foundation, Inc.
Contributed by Dmitry Diky <diwil@mail.ru>
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
static const bfd_arch_info_type *compatible
diff --git a/bfd/cpu-mt.c b/bfd/cpu-mt.c
index 43b442aee9f8..4d07c4347c4f 100644
--- a/bfd/cpu-mt.c
+++ b/bfd/cpu-mt.c
@@ -1,5 +1,5 @@
/* BFD support for the Morpho Technologies MT processor.
- Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2005, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,8 +17,8 @@
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 "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type arch_info_struct[] =
diff --git a/bfd/cpu-ns32k.c b/bfd/cpu-ns32k.c
index f7e2f1197e38..447b26fe9812 100644
--- a/bfd/cpu-ns32k.c
+++ b/bfd/cpu-ns32k.c
@@ -1,6 +1,6 @@
/* BFD support for the ns32k architecture.
Copyright 1990, 1991, 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005 Free Software Foundation, Inc.
+ 2004, 2005, 2007 Free Software Foundation, Inc.
Almost totally rewritten by Ian Dall from initial work
by Andrew Cagney.
@@ -20,8 +20,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "ns32k.h"
diff --git a/bfd/cpu-openrisc.c b/bfd/cpu-openrisc.c
index bf26d51c50ae..a6de202371b6 100644
--- a/bfd/cpu-openrisc.c
+++ b/bfd/cpu-openrisc.c
@@ -1,5 +1,5 @@
/* BFD support for the OpenRISC architecture.
- Copyright 2001, 2002 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2007 Free Software Foundation, Inc.
Contributed by Johan Rydberg, jrydberg@opencores.org
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#define N(BITS_WORD, BITS_ADDR, NUMBER, PRINT, DEFAULT, NEXT) \
diff --git a/bfd/cpu-or32.c b/bfd/cpu-or32.c
index 41c218b0ffd2..ddb79240a6bc 100644
--- a/bfd/cpu-or32.c
+++ b/bfd/cpu-or32.c
@@ -1,5 +1,5 @@
/* BFD support for the OpenRISC 1000 architecture.
- Copyright 2002 Free Software Foundation, Inc.
+ Copyright 2002, 2007 Free Software Foundation, Inc.
Contributed by Ivan Guzvinec <ivang@opencores.org>
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_or32_arch =
diff --git a/bfd/cpu-pdp11.c b/bfd/cpu-pdp11.c
index 98efd4d33445..7609c8ebb0a1 100644
--- a/bfd/cpu-pdp11.c
+++ b/bfd/cpu-pdp11.c
@@ -1,5 +1,5 @@
/* BFD back-end for PDP-11 support.
- Copyright 2001, 2002 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_pdp11_arch =
diff --git a/bfd/cpu-pj.c b/bfd/cpu-pj.c
index 60f0303116e7..6972ceb65395 100644
--- a/bfd/cpu-pj.c
+++ b/bfd/cpu-pj.c
@@ -1,5 +1,5 @@
/* BFD library support routines for the Pico Java architecture.
- Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002, 2007 Free Software Foundation, Inc.
Hacked by Steve Chamberlain of Transmeta. sac@pobox.com
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_pj_arch =
diff --git a/bfd/cpu-powerpc.c b/bfd/cpu-powerpc.c
index 2584d6511622..e35833061298 100644
--- a/bfd/cpu-powerpc.c
+++ b/bfd/cpu-powerpc.c
@@ -1,5 +1,5 @@
/* BFD PowerPC CPU definition
- Copyright 1994, 1995, 1996, 2000, 2001, 2002, 2003
+ Copyright 1994, 1995, 1996, 2000, 2001, 2002, 2003, 2007
Free Software Foundation, Inc.
Contributed by Ian Lance Taylor, Cygnus Support.
@@ -19,8 +19,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
/* The common PowerPC architecture is compatible with the RS/6000. */
diff --git a/bfd/cpu-rs6000.c b/bfd/cpu-rs6000.c
index 43c7be7539f9..4ed1d71e1a9b 100644
--- a/bfd/cpu-rs6000.c
+++ b/bfd/cpu-rs6000.c
@@ -1,11 +1,7 @@
/* BFD back-end for rs6000 support
- Copyright 1990, 1991, 1993, 1995, 2000, 2002, 2003
+ Copyright 1990, 1991, 1993, 1995, 2000, 2002, 2003, 2007
Free Software Foundation, Inc.
- FIXME: Can someone provide a transliteration of this name into ASCII?
- Using the following chars caused a compiler warning on HIUX (so I replaced
- them with octal escapes), and isn't useful without an understanding of what
- character set it is.
- Written by Mimi Ph\373\364ng-Th\345o V\365 of IBM
+ Written by Mimi Phuong-Thao Vo of IBM
and John Gilmore of Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -24,8 +20,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
/* The RS/6000 architecture is compatible with the PowerPC common
diff --git a/bfd/cpu-s390.c b/bfd/cpu-s390.c
index e7c714f26dc8..b385a9c6bdb1 100644
--- a/bfd/cpu-s390.c
+++ b/bfd/cpu-s390.c
@@ -1,5 +1,5 @@
/* BFD support for the s390 processor.
- Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002, 2007 Free Software Foundation, Inc.
Contributed by Carl B. Pedersen and Martin Schwidefsky.
This file is part of BFD, the Binary File Descriptor library.
@@ -19,8 +19,8 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_s390_64_arch =
diff --git a/bfd/cpu-score.c b/bfd/cpu-score.c
new file mode 100644
index 000000000000..90d3113bd66b
--- /dev/null
+++ b/bfd/cpu-score.c
@@ -0,0 +1,51 @@
+/* BFD support for the score processor
+ Copyright 2006, 2007 Free Software Foundation, Inc.
+ Contributed by
+ Mei Ligang (ligang@sunnorth.com.cn)
+ Pei-Lin Tsai (pltsai@sunplus.com)
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "libbfd.h"
+
+const bfd_arch_info_type
+bfd_score_arch =
+{
+ 32, /* There's 32 bits_per_word. */
+ 32, /* There's 32 bits_per_address. */
+ 8, /* There's 8 bits_per_byte. */
+ bfd_arch_score, /* One of enum bfd_architecture, defined
+ in archures.c and provided in
+ generated header files. */
+ 0, /* Only 1 machine, but #255 for
+ historical reasons. */
+ "score", /* The arch_name. */
+ "score", /* The printable name is the same. */
+ 4, /* Section alignment power; each section
+ is aligned to (only) 2^4 bytes. */
+ TRUE, /* This is the default "machine", since
+ there's only one. */
+ bfd_default_compatible, /* A default function for testing
+ "machine" compatibility of two
+ bfd_arch_info_type. */
+ bfd_default_scan, /* Check if an bfd_arch_info_type is a
+ match. */
+ NULL /* Pointer to next bfd_arch_info_type in
+ the same family. */
+};
diff --git a/bfd/cpu-sh.c b/bfd/cpu-sh.c
index 531431c1dcdd..4aa99c18e496 100644
--- a/bfd/cpu-sh.c
+++ b/bfd/cpu-sh.c
@@ -1,6 +1,6 @@
/* BFD library support routines for the Renesas / SuperH SH architecture.
- Copyright 1993, 1994, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005,
+ 2007 Free Software Foundation, Inc.
Hacked by Steve Chamberlain of Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -19,8 +19,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "../opcodes/sh-opc.h"
diff --git a/bfd/cpu-sparc.c b/bfd/cpu-sparc.c
index 42153269a24b..35a109e2c497 100644
--- a/bfd/cpu-sparc.c
+++ b/bfd/cpu-sparc.c
@@ -1,5 +1,5 @@
/* BFD support for the SPARC architecture.
- Copyright 1992, 1995, 1996, 1998, 2000, 2002
+ Copyright 1992, 1995, 1996, 1998, 2000, 2002, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
static const bfd_arch_info_type arch_info_struct[] =
diff --git a/bfd/cpu-spu.c b/bfd/cpu-spu.c
new file mode 100644
index 000000000000..540a19fa71bb
--- /dev/null
+++ b/bfd/cpu-spu.c
@@ -0,0 +1,54 @@
+/* Copyright 2006, 2007 Free Software Foundation, Inc.
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "libbfd.h"
+
+
+static const bfd_arch_info_type *
+spu_compatible (const bfd_arch_info_type *a, const bfd_arch_info_type *b)
+{
+ BFD_ASSERT (a->arch == bfd_arch_spu);
+ switch (b->arch)
+ {
+ default:
+ return NULL;
+ case bfd_arch_spu:
+ return bfd_default_compatible (a, b);
+ }
+ /*NOTREACHED*/
+}
+
+const bfd_arch_info_type bfd_spu_arch[] =
+{
+ {
+ 32, /* 32 bits in a word */
+ 32, /* 32 bits in an address */
+ 8, /* 8 bits in a byte */
+ bfd_arch_spu, /* architecture */
+ bfd_mach_spu, /* machine */
+ "spu", /* architecture name */
+ "spu:256K", /* printable name */
+ 3, /* aligned power */
+ TRUE, /* the default machine for the architecture */
+ spu_compatible, /* the spu is only compatible with itself, see above */
+ bfd_default_scan,
+ 0, /* next -- there are none! */
+ }
+};
diff --git a/bfd/cpu-tic30.c b/bfd/cpu-tic30.c
index 29e6f3be12d6..8506b41a84a1 100644
--- a/bfd/cpu-tic30.c
+++ b/bfd/cpu-tic30.c
@@ -1,5 +1,5 @@
/* BFD support for the Texas Instruments TMS320C30 architecture.
- Copyright 1998, 2002 Free Software Foundation, Inc.
+ Copyright 1998, 2002, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_tic30_arch =
diff --git a/bfd/cpu-tic4x.c b/bfd/cpu-tic4x.c
index 8ff88839db22..dfcfe1612414 100644
--- a/bfd/cpu-tic4x.c
+++ b/bfd/cpu-tic4x.c
@@ -1,5 +1,5 @@
/* bfd back-end for TMS320C[34]x support
- Copyright 1996, 1997, 2002, 2003 Free Software Foundation, Inc.
+ Copyright 1996, 1997, 2002, 2003, 2007 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz)
@@ -19,8 +19,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
static bfd_boolean tic4x_scan
diff --git a/bfd/cpu-tic54x.c b/bfd/cpu-tic54x.c
index debfe6929d62..f3f6d3287abe 100644
--- a/bfd/cpu-tic54x.c
+++ b/bfd/cpu-tic54x.c
@@ -1,5 +1,5 @@
/* BFD support for the Texas Instruments TMS320C54X architecture.
- Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2002, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_tic54x_arch =
diff --git a/bfd/cpu-tic80.c b/bfd/cpu-tic80.c
index 7dca8c7cf0cd..88bf0a11958d 100644
--- a/bfd/cpu-tic80.c
+++ b/bfd/cpu-tic80.c
@@ -1,5 +1,5 @@
/* bfd back-end for TI TMS320C80 (MVP) support
- Copyright 1996, 2002 Free Software Foundation, Inc.
+ Copyright 1996, 2002, 2007 Free Software Foundation, Inc.
Written by Fred Fish at Cygnus support (fnf@cygnus.com)
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_tic80_arch =
diff --git a/bfd/cpu-v850.c b/bfd/cpu-v850.c
index 5a776ddbe068..30d3a7dd797c 100644
--- a/bfd/cpu-v850.c
+++ b/bfd/cpu-v850.c
@@ -1,5 +1,5 @@
/* BFD support for the NEC V850 processor
- Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2003
+ Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "safe-ctype.h"
diff --git a/bfd/cpu-vax.c b/bfd/cpu-vax.c
index 1af84a624511..cea4e98cf1dc 100644
--- a/bfd/cpu-vax.c
+++ b/bfd/cpu-vax.c
@@ -1,5 +1,6 @@
/* bfd back-end for vax support
- Copyright 1990, 1991, 1994, 2000, 2002 Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1994, 2000, 2002, 2007
+ Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +19,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_vax_arch =
diff --git a/bfd/cpu-w65.c b/bfd/cpu-w65.c
index 82e485f92361..1acaf32939f6 100644
--- a/bfd/cpu-w65.c
+++ b/bfd/cpu-w65.c
@@ -1,5 +1,6 @@
/* BFD library support routines for the WDC 65816 architecture.
- Copyright 1995, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1995, 1999, 2000, 2001, 2002, 2007
+ Free Software Foundation, Inc.
Hacked by Steve Chamberlain of Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +19,8 @@ You w65ould have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
static bfd_boolean scan_mach
diff --git a/bfd/cpu-we32k.c b/bfd/cpu-we32k.c
index c0e7ab637ddc..2aab22e27cf7 100644
--- a/bfd/cpu-we32k.c
+++ b/bfd/cpu-we32k.c
@@ -1,5 +1,5 @@
/* bfd back-end for we32k support
- Copyright 1992, 2000, 2002 Free Software Foundation, Inc.
+ Copyright 1992, 2000, 2002, 2007 Free Software Foundation, Inc.
Contributed by Brendan Kehoe (brendan@cs.widener.edu).
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_we32k_arch =
diff --git a/bfd/cpu-xc16x.c b/bfd/cpu-xc16x.c
index 11569003629f..b173107b9b67 100644
--- a/bfd/cpu-xc16x.c
+++ b/bfd/cpu-xc16x.c
@@ -1,5 +1,5 @@
/* BFD support for the Infineon XC16X Microcontroller.
- Copyright 2006 Free Software Foundation, Inc.
+ Copyright 2006, 2007 Free Software Foundation, Inc.
Contributed by KPIT Cummins Infosystems
This file is part of BFD, the Binary File Descriptor library.
@@ -20,8 +20,8 @@
Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type xc16xs_info_struct =
diff --git a/bfd/cpu-xstormy16.c b/bfd/cpu-xstormy16.c
index 62c5302222d7..b2be98b70b68 100644
--- a/bfd/cpu-xstormy16.c
+++ b/bfd/cpu-xstormy16.c
@@ -1,5 +1,5 @@
/* BFD support for the XSTORMY16 processor.
- Copyright 2001, 2002 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,8 +17,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_xstormy16_arch =
diff --git a/bfd/cpu-xtensa.c b/bfd/cpu-xtensa.c
index 797143194a99..59f37fb0eb79 100644
--- a/bfd/cpu-xtensa.c
+++ b/bfd/cpu-xtensa.c
@@ -1,5 +1,5 @@
/* BFD support for the Xtensa processor.
- Copyright 2003 Free Software Foundation, Inc.
+ Copyright 2003, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,8 +17,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_xtensa_arch =
diff --git a/bfd/cpu-z80.c b/bfd/cpu-z80.c
index 3fd6fd481767..f106afbd8057 100644
--- a/bfd/cpu-z80.c
+++ b/bfd/cpu-z80.c
@@ -1,5 +1,5 @@
/* BFD library support routines for the Z80 architecture.
- Copyright 2005 Free Software Foundation, Inc.
+ Copyright 2005, 2007 Free Software Foundation, Inc.
Contributed by Arnold Metselaar <arnold_m@operamail.com>
This file is part of BFD, the Binary File Descriptor library.
@@ -19,8 +19,8 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_z80_arch;
diff --git a/bfd/cpu-z8k.c b/bfd/cpu-z8k.c
index 043bbc50dce1..4d47b4e974a0 100644
--- a/bfd/cpu-z8k.c
+++ b/bfd/cpu-z8k.c
@@ -1,5 +1,5 @@
/* BFD library support routines for the Z800n architecture.
- Copyright 1992, 1993, 1994, 2000, 2001, 2002, 2003
+ Copyright 1992, 1993, 1994, 2000, 2001, 2002, 2003, 2007
Free Software Foundation, Inc.
Hacked by Steve Chamberlain of Cygnus Support.
@@ -19,8 +19,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
/* This routine is provided two arch_infos and returns whether
diff --git a/bfd/doc/ChangeLog b/bfd/doc/ChangeLog
index 7909268f98bf..6b96b613d139 100644
--- a/bfd/doc/ChangeLog
+++ b/bfd/doc/ChangeLog
@@ -1,7 +1,56 @@
+2007-07-02 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.in: Regenerate.
+
+2007-06-30 H.J. Lu <hongjiu.lu@intel.com>
+
+ * Makefile.in: Likewise.
+
+2007-06-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ * Makefile.in: Regenerated.
+
+2007-05-22 Nick Clifton <nickc@redhat.com>
+
+ * bfd.texinfo: Use @copying around the copyright notice.
+ * bfdint.texi: Likewise.
+
+2007-05-21 Nick Clifton <nickc@redhat.com>
+
+ * bfdint.texi: Add GNU Free Documentation License notice.
+
+2007-04-24 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.in: Regenerate.
+
+2007-02-17 Mark Mitchell <mark@codesourcery.com>
+ Nathan Sidwell <nathan@codesourcery.com>
+ Vladimir Prus <vladimir@codesourcery.com
+ Joseph Myers <joseph@codesourcery.com>
+
+ * Makefile.in: Regenerate.
+
+2006-07-24 Ralk Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * bfd..texinfo: Fix spelling mistakes.
+ * bfdint.texinfo: Likewise.
+
+2006-07-18 Nigel Stephens <nigel@mips.com>
+
+ * bfd.texinfo: Add @section for "What to Put Where".
+
2006-06-07 Joseph S. Myers <joseph@codesourcery.com>
* bfd.texinfo: Remove local @tex code.
+2006-06-05 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.in: Regenerate.
+
+2006-05-11 Carlos O'Donell <carlos@codesourcery.com>
+
+ * bfd.texinfo: Rename "Index" to "BFD Index"
+
2006-04-06 Carlos O'Donell <carlos@codesourcery.com>
* Makefile.am: Add install-html and install-html-am targets.
diff --git a/bfd/doc/Makefile.am b/bfd/doc/Makefile.am
index 6d221faad4a2..6ff434a6e7e6 100644
--- a/bfd/doc/Makefile.am
+++ b/bfd/doc/Makefile.am
@@ -8,7 +8,8 @@ DOCFILES = aoutx.texi archive.texi archures.texi \
libbfd.texi bfdwin.texi bfdio.texi \
opncls.texi reloc.texi section.texi \
syms.texi targets.texi init.texi hash.texi linker.texi \
- mmo.texi
+ mmo.texi \
+ bfdver.texi
PROTOS = archive.p archures.p bfd.p \
core.p format.p \
@@ -51,6 +52,7 @@ SRCIPROT = $(srcdir)/../cache.c $(srcdir)/../libbfd.c \
TEXIDIR = $(srcdir)/../../texinfo/fsf
info_TEXINFOS = bfd.texinfo
+bfd_TEXINFOS = $(DOCFILES) bfdsumm.texi
MKDOC = chew$(EXEEXT_FOR_BUILD)
@@ -68,8 +70,6 @@ chew.o: chew.c
protos: libbfd.h libcoff.h bfd.h
-$(srcdir)/bfd.info bfd.dvi bfd.html: $(DOCFILES) bfdsumm.texi bfd.texinfo
-
# We can't replace these rules with an implicit rule, because
# makes without VPATH support couldn't find the .h files in `..'.
@@ -274,6 +274,17 @@ bfd.h: $(BFD_H_DEP)
echo "#endif" >> $@
echo "#endif" >> $@
+bfdver.texi: $(srcdir)/Makefile.in
+ @echo "creating $@"; \
+ echo "@set VERSION $(VERSION)" > bfdver.texi; \
+ if [ -n "$(PKGVERSION)" ]; then \
+ echo "@set VERSION_PACKAGE $(PKGVERSION)" >> bfdver.texi; \
+ fi; \
+ echo "@set UPDATED `date '+%B %Y'`" >> bfdver.texi; \
+ if [ -n "$(REPORT_BUGS_TEXI)" ]; then \
+ echo "@set BUGURL $(REPORT_BUGS_TEXI)" >> bfdver.texi; \
+ fi
+
noinst_TEXINFOS = bfdint.texi
MOSTLYCLEANFILES = $(MKDOC) *.o
@@ -309,6 +320,11 @@ install-html-am: $(HTMLS)
fi; \
done
+MAINTAINERCLEANFILES += bfd.info
-
-
+# Automake 1.9 will only build info files in the objdir if they are
+# mentioned in DISTCLEANFILES. It doesn't have to be unconditional,
+# though, so we use a bogus condition.
+if GENINSRC_NEVER
+DISTCLEANFILES += bfd.info
+endif
diff --git a/bfd/doc/Makefile.in b/bfd/doc/Makefile.in
index ad81061ec7b7..02b15d0dbe30 100644
--- a/bfd/doc/Makefile.in
+++ b/bfd/doc/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -36,13 +36,26 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+
+# Automake 1.9 will only build info files in the objdir if they are
+# mentioned in DISTCLEANFILES. It doesn't have to be unconditional,
+# though, so we use a bogus condition.
+@GENINSRC_NEVER_TRUE@am__append_1 = bfd.info
subdir = doc
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+ $(bfd_TEXINFOS)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/../config/acx.m4 $(top_srcdir)/../bfd/bfd.m4 \
- $(top_srcdir)/../bfd/warning.m4 $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/../gettext.m4 $(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
+ $(top_srcdir)/../config/depstand.m4 \
+ $(top_srcdir)/../config/gettext-sister.m4 \
+ $(top_srcdir)/../config/lead-dot.m4 \
+ $(top_srcdir)/../config/nls.m4 $(top_srcdir)/../config/po.m4 \
+ $(top_srcdir)/../config/progtest.m4 \
+ $(top_srcdir)/../config/stdint.m4 $(top_srcdir)/../libtool.m4 \
+ $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
+ $(top_srcdir)/../ltversion.m4 $(top_srcdir)/bfd.m4 \
+ $(top_srcdir)/warning.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
@@ -51,7 +64,7 @@ CONFIG_CLEAN_FILES =
depcomp =
am__depfiles_maybe =
SOURCES =
-INFO_DEPS = $(srcdir)/bfd.info
+INFO_DEPS = bfd.info
TEXINFO_TEX = $(top_srcdir)/../texinfo/texinfo.tex
am__TEXINFO_TEX_DIR = $(top_srcdir)/../texinfo
DVIS = bfd.dvi
@@ -69,7 +82,6 @@ MAKEINFOHTML = $(MAKEINFO) --html
AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS)
DVIPS = dvips
ACLOCAL = @ACLOCAL@
-ALLOCA = @ALLOCA@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
@@ -95,20 +107,24 @@ CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DATADIRNAME = @DATADIRNAME@
+DEBUGDIR = @DEBUGDIR@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
-GMOFILES = @GMOFILES@
+FGREP = @FGREP@
+GENCAT = @GENCAT@
+GENINSRC_NEVER_FALSE = @GENINSRC_NEVER_FALSE@
+GENINSRC_NEVER_TRUE = @GENINSRC_NEVER_TRUE@
GMSGFMT = @GMSGFMT@
-GT_NO = @GT_NO@
-GT_YES = @GT_YES@
+GREP = @GREP@
HDEFINES = @HDEFINES@
-INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
+INCINTL = @INCINTL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_LIBBFD_FALSE = @INSTALL_LIBBFD_FALSE@
INSTALL_LIBBFD_TRUE = @INSTALL_LIBBFD_TRUE@
@@ -116,10 +132,10 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTOBJEXT = @INSTOBJEXT@
-INTLDEPS = @INTLDEPS@
-INTLLIBS = @INTLLIBS@
-INTLOBJS = @INTLOBJS@
+LD = @LD@
LDFLAGS = @LDFLAGS@
+LIBINTL = @LIBINTL@
+LIBINTL_DEP = @LIBINTL_DEP@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
@@ -131,6 +147,8 @@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
+MSGMERGE = @MSGMERGE@
+NM = @NM@
NO_WERROR = @NO_WERROR@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
@@ -140,14 +158,16 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
-POFILES = @POFILES@
+PKGVERSION = @PKGVERSION@
POSUB = @POSUB@
RANLIB = @RANLIB@
+REPORT_BUGS_TEXI = @REPORT_BUGS_TEXI@
+REPORT_BUGS_TO = @REPORT_BUGS_TO@
+SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
TDEFINES = @TDEFINES@
-USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
WARN_CFLAGS = @WARN_CFLAGS@
@@ -156,6 +176,7 @@ WIN32LIBADD = @WIN32LIBADD@
XGETTEXT = @XGETTEXT@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
all_backends = @all_backends@
@@ -166,10 +187,10 @@ am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
+bfd64_libs = @bfd64_libs@
bfd_backends = @bfd_backends@
bfd_default_target_size = @bfd_default_target_size@
bfd_file_ptr = @bfd_file_ptr@
-bfd_libs = @bfd_libs@
bfd_machines = @bfd_machines@
bfd_ufile_ptr = @bfd_ufile_ptr@
bfdincludedir = @bfdincludedir@
@@ -194,10 +215,10 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
-l = @l@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@@ -221,7 +242,8 @@ DOCFILES = aoutx.texi archive.texi archures.texi \
libbfd.texi bfdwin.texi bfdio.texi \
opncls.texi reloc.texi section.texi \
syms.texi targets.texi init.texi hash.texi linker.texi \
- mmo.texi
+ mmo.texi \
+ bfdver.texi
PROTOS = archive.p archures.p bfd.p \
core.p format.p \
@@ -263,6 +285,7 @@ SRCIPROT = $(srcdir)/../cache.c $(srcdir)/../libbfd.c \
TEXIDIR = $(srcdir)/../../texinfo/fsf
info_TEXINFOS = bfd.texinfo
+bfd_TEXINFOS = $(DOCFILES) bfdsumm.texi
MKDOC = chew$(EXEEXT_FOR_BUILD)
INCLUDES = -I.. -I$(srcdir)/.. -I$(srcdir)/../../include \
-I$(srcdir)/../../intl -I../../intl
@@ -314,13 +337,14 @@ BFD_H_DEP = \
noinst_TEXINFOS = bfdint.texi
MOSTLYCLEANFILES = $(MKDOC) *.o
CLEANFILES = *.p *.ip
-DISTCLEANFILES = bfd.?? bfd.??? bfd.h libbfd.h libcoff.h texput.log
-MAINTAINERCLEANFILES = $(DOCFILES)
+DISTCLEANFILES = bfd.?? bfd.??? bfd.h libbfd.h libcoff.h texput.log \
+ $(am__append_1)
+MAINTAINERCLEANFILES = $(DOCFILES) bfd.info
html__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
all: all-am
.SUFFIXES:
-.SUFFIXES: .dvi .html .info .pdf .ps .texinfo
+.SUFFIXES: .dvi .ps
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
@@ -330,9 +354,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --cygnus doc/Makefile'; \
cd $(top_srcdir) && \
- $(AUTOMAKE) --foreign doc/Makefile
+ $(AUTOMAKE) --cygnus doc/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -360,40 +384,38 @@ clean-libtool:
distclean-libtool:
-rm -f libtool
-.texinfo.info:
+bfd.info: bfd.texinfo $(bfd_TEXINFOS)
restore=: && backupdir="$(am__leading_dot)am$$$$" && \
- am__cwd=`pwd` && cd $(srcdir) && \
rm -rf $$backupdir && mkdir $$backupdir && \
- for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \
- if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \
- done; \
- cd "$$am__cwd"; \
+ if ($(MAKEINFO) --version) >/dev/null 2>&1; then \
+ for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \
+ if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \
+ done; \
+ else :; fi && \
if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \
- -o $@ $<; \
+ -o $@ `test -f 'bfd.texinfo' || echo '$(srcdir)/'`bfd.texinfo; \
then \
rc=0; \
- cd $(srcdir); \
else \
rc=$$?; \
- cd $(srcdir) && \
$$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \
fi; \
rm -rf $$backupdir; exit $$rc
-.texinfo.dvi:
+bfd.dvi: bfd.texinfo $(bfd_TEXINFOS)
TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
- $(TEXI2DVI) $<
+ $(TEXI2DVI) -o $@ `test -f 'bfd.texinfo' || echo '$(srcdir)/'`bfd.texinfo
-.texinfo.pdf:
+bfd.pdf: bfd.texinfo $(bfd_TEXINFOS)
TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
- $(TEXI2PDF) $<
+ $(TEXI2PDF) -o $@ `test -f 'bfd.texinfo' || echo '$(srcdir)/'`bfd.texinfo
-.texinfo.html:
+bfd.html: bfd.texinfo $(bfd_TEXINFOS)
rm -rf $(@:.html=.htp)
if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \
- -o $(@:.html=.htp) $<; \
+ -o $(@:.html=.htp) `test -f 'bfd.texinfo' || echo '$(srcdir)/'`bfd.texinfo; \
then \
rm -rf $@; \
if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \
@@ -403,11 +425,8 @@ distclean-libtool:
rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \
exit 1; \
fi
-$(srcdir)/bfd.info: bfd.texinfo
-bfd.dvi: bfd.texinfo
-bfd.pdf: bfd.texinfo
-bfd.html: bfd.texinfo
.dvi.ps:
+ TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
$(DVIPS) -o $@ $<
uninstall-info-am:
@@ -600,8 +619,6 @@ chew.o: chew.c
protos: libbfd.h libcoff.h bfd.h
-$(srcdir)/bfd.info bfd.dvi bfd.html: $(DOCFILES) bfdsumm.texi bfd.texinfo
-
# We can't replace these rules with an implicit rule, because
# makes without VPATH support couldn't find the .h files in `..'.
@@ -762,6 +779,17 @@ bfd.h: $(BFD_H_DEP)
echo "#endif" >> $@
echo "#endif" >> $@
+bfdver.texi: $(srcdir)/Makefile.in
+ @echo "creating $@"; \
+ echo "@set VERSION $(VERSION)" > bfdver.texi; \
+ if [ -n "$(PKGVERSION)" ]; then \
+ echo "@set VERSION_PACKAGE $(PKGVERSION)" >> bfdver.texi; \
+ fi; \
+ echo "@set UPDATED `date '+%B %Y'`" >> bfdver.texi; \
+ if [ -n "$(REPORT_BUGS_TEXI)" ]; then \
+ echo "@set BUGURL $(REPORT_BUGS_TEXI)" >> bfdver.texi; \
+ fi
+
# We want install to imply install-info as per GNU standards, despite the
# cygnus option.
install: install-info
diff --git a/bfd/doc/aoutx.texi b/bfd/doc/aoutx.texi
deleted file mode 100644
index 7cf9787f106f..000000000000
--- a/bfd/doc/aoutx.texi
+++ /dev/null
@@ -1,213 +0,0 @@
-@section a.out backends
-
-
-@strong{Description}@*
-BFD supports a number of different flavours of a.out format,
-though the major differences are only the sizes of the
-structures on disk, and the shape of the relocation
-information.
-
-The support is split into a basic support file @file{aoutx.h}
-and other files which derive functions from the base. One
-derivation file is @file{aoutf1.h} (for a.out flavour 1), and
-adds to the basic a.out functions support for sun3, sun4, 386
-and 29k a.out files, to create a target jump vector for a
-specific target.
-
-This information is further split out into more specific files
-for each machine, including @file{sunos.c} for sun3 and sun4,
-@file{newsos3.c} for the Sony NEWS, and @file{demo64.c} for a
-demonstration of a 64 bit a.out format.
-
-The base file @file{aoutx.h} defines general mechanisms for
-reading and writing records to and from disk and various
-other methods which BFD requires. It is included by
-@file{aout32.c} and @file{aout64.c} to form the names
-@code{aout_32_swap_exec_header_in}, @code{aout_64_swap_exec_header_in}, etc.
-
-As an example, this is what goes on to make the back end for a
-sun4, from @file{aout32.c}:
-
-@example
- #define ARCH_SIZE 32
- #include "aoutx.h"
-@end example
-
-Which exports names:
-
-@example
- ...
- aout_32_canonicalize_reloc
- aout_32_find_nearest_line
- aout_32_get_lineno
- aout_32_get_reloc_upper_bound
- ...
-@end example
-
-from @file{sunos.c}:
-
-@example
- #define TARGET_NAME "a.out-sunos-big"
- #define VECNAME sunos_big_vec
- #include "aoutf1.h"
-@end example
-
-requires all the names from @file{aout32.c}, and produces the jump vector
-
-@example
- sunos_big_vec
-@end example
-
-The file @file{host-aout.c} is a special case. It is for a large set
-of hosts that use ``more or less standard'' a.out files, and
-for which cross-debugging is not interesting. It uses the
-standard 32-bit a.out support routines, but determines the
-file offsets and addresses of the text, data, and BSS
-sections, the machine architecture and machine type, and the
-entry point address, in a host-dependent manner. Once these
-values have been determined, generic code is used to handle
-the object file.
-
-When porting it to run on a new system, you must supply:
-
-@example
- HOST_PAGE_SIZE
- HOST_SEGMENT_SIZE
- HOST_MACHINE_ARCH (optional)
- HOST_MACHINE_MACHINE (optional)
- HOST_TEXT_START_ADDR
- HOST_STACK_END_ADDR
-@end example
-
-in the file @file{../include/sys/h-@var{XXX}.h} (for your host). These
-values, plus the structures and macros defined in @file{a.out.h} on
-your host system, will produce a BFD target that will access
-ordinary a.out files on your host. To configure a new machine
-to use @file{host-aout.c}, specify:
-
-@example
- TDEFAULTS = -DDEFAULT_VECTOR=host_aout_big_vec
- TDEPFILES= host-aout.o trad-core.o
-@end example
-
-in the @file{config/@var{XXX}.mt} file, and modify @file{configure.in}
-to use the
-@file{@var{XXX}.mt} file (by setting "@code{bfd_target=XXX}") when your
-configuration is selected.
-
-@subsection Relocations
-
-
-@strong{Description}@*
-The file @file{aoutx.h} provides for both the @emph{standard}
-and @emph{extended} forms of a.out relocation records.
-
-The standard records contain only an
-address, a symbol index, and a type field. The extended records
-(used on 29ks and sparcs) also have a full integer for an
-addend.
-
-@subsection Internal entry points
-
-
-@strong{Description}@*
-@file{aoutx.h} exports several routines for accessing the
-contents of an a.out file, which are gathered and exported in
-turn by various format specific files (eg sunos.c).
-
-@findex aout_@var{size}_swap_exec_header_in
-@subsubsection @code{aout_@var{size}_swap_exec_header_in}
-@strong{Synopsis}
-@example
-void aout_@var{size}_swap_exec_header_in,
- (bfd *abfd,
- struct external_exec *bytes,
- struct internal_exec *execp);
-@end example
-@strong{Description}@*
-Swap the information in an executable header @var{raw_bytes} taken
-from a raw byte stream memory image into the internal exec header
-structure @var{execp}.
-
-@findex aout_@var{size}_swap_exec_header_out
-@subsubsection @code{aout_@var{size}_swap_exec_header_out}
-@strong{Synopsis}
-@example
-void aout_@var{size}_swap_exec_header_out
- (bfd *abfd,
- struct internal_exec *execp,
- struct external_exec *raw_bytes);
-@end example
-@strong{Description}@*
-Swap the information in an internal exec header structure
-@var{execp} into the buffer @var{raw_bytes} ready for writing to disk.
-
-@findex aout_@var{size}_some_aout_object_p
-@subsubsection @code{aout_@var{size}_some_aout_object_p}
-@strong{Synopsis}
-@example
-const bfd_target *aout_@var{size}_some_aout_object_p
- (bfd *abfd,
- struct internal_exec *execp,
- const bfd_target *(*callback_to_real_object_p) (bfd *));
-@end example
-@strong{Description}@*
-Some a.out variant thinks that the file open in @var{abfd}
-checking is an a.out file. Do some more checking, and set up
-for access if it really is. Call back to the calling
-environment's "finish up" function just before returning, to
-handle any last-minute setup.
-
-@findex aout_@var{size}_mkobject
-@subsubsection @code{aout_@var{size}_mkobject}
-@strong{Synopsis}
-@example
-bfd_boolean aout_@var{size}_mkobject, (bfd *abfd);
-@end example
-@strong{Description}@*
-Initialize BFD @var{abfd} for use with a.out files.
-
-@findex aout_@var{size}_machine_type
-@subsubsection @code{aout_@var{size}_machine_type}
-@strong{Synopsis}
-@example
-enum machine_type aout_@var{size}_machine_type
- (enum bfd_architecture arch,
- unsigned long machine,
- bfd_boolean *unknown);
-@end example
-@strong{Description}@*
-Keep track of machine architecture and machine type for
-a.out's. Return the @code{machine_type} for a particular
-architecture and machine, or @code{M_UNKNOWN} if that exact architecture
-and machine can't be represented in a.out format.
-
-If the architecture is understood, machine type 0 (default)
-is always understood.
-
-@findex aout_@var{size}_set_arch_mach
-@subsubsection @code{aout_@var{size}_set_arch_mach}
-@strong{Synopsis}
-@example
-bfd_boolean aout_@var{size}_set_arch_mach,
- (bfd *,
- enum bfd_architecture arch,
- unsigned long machine);
-@end example
-@strong{Description}@*
-Set the architecture and the machine of the BFD @var{abfd} to the
-values @var{arch} and @var{machine}. Verify that @var{abfd}'s format
-can support the architecture required.
-
-@findex aout_@var{size}_new_section_hook
-@subsubsection @code{aout_@var{size}_new_section_hook}
-@strong{Synopsis}
-@example
-bfd_boolean aout_@var{size}_new_section_hook,
- (bfd *abfd,
- asection *newsect);
-@end example
-@strong{Description}@*
-Called by the BFD in response to a @code{bfd_make_section}
-request.
-
diff --git a/bfd/doc/archive.texi b/bfd/doc/archive.texi
deleted file mode 100644
index 3d0a97d4b82e..000000000000
--- a/bfd/doc/archive.texi
+++ /dev/null
@@ -1,99 +0,0 @@
-@section Archives
-
-
-@strong{Description}@*
-An archive (or library) is just another BFD. It has a symbol
-table, although there's not much a user program will do with it.
-
-The big difference between an archive BFD and an ordinary BFD
-is that the archive doesn't have sections. Instead it has a
-chain of BFDs that are considered its contents. These BFDs can
-be manipulated like any other. The BFDs contained in an
-archive opened for reading will all be opened for reading. You
-may put either input or output BFDs into an archive opened for
-output; they will be handled correctly when the archive is closed.
-
-Use @code{bfd_openr_next_archived_file} to step through
-the contents of an archive opened for input. You don't
-have to read the entire archive if you don't want
-to! Read it until you find what you want.
-
-Archive contents of output BFDs are chained through the
-@code{next} pointer in a BFD. The first one is findable through
-the @code{archive_head} slot of the archive. Set it with
-@code{bfd_set_archive_head} (q.v.). A given BFD may be in only one
-open output archive at a time.
-
-As expected, the BFD archive code is more general than the
-archive code of any given environment. BFD archives may
-contain files of different formats (e.g., a.out and coff) and
-even different architectures. You may even place archives
-recursively into archives!
-
-This can cause unexpected confusion, since some archive
-formats are more expressive than others. For instance, Intel
-COFF archives can preserve long filenames; SunOS a.out archives
-cannot. If you move a file from the first to the second
-format and back again, the filename may be truncated.
-Likewise, different a.out environments have different
-conventions as to how they truncate filenames, whether they
-preserve directory names in filenames, etc. When
-interoperating with native tools, be sure your files are
-homogeneous.
-
-Beware: most of these formats do not react well to the
-presence of spaces in filenames. We do the best we can, but
-can't always handle this case due to restrictions in the format of
-archives. Many Unix utilities are braindead in regards to
-spaces and such in filenames anyway, so this shouldn't be much
-of a restriction.
-
-Archives are supported in BFD in @code{archive.c}.
-
-@subsection Archive functions
-
-
-@findex bfd_get_next_mapent
-@subsubsection @code{bfd_get_next_mapent}
-@strong{Synopsis}
-@example
-symindex bfd_get_next_mapent
- (bfd *abfd, symindex previous, carsym **sym);
-@end example
-@strong{Description}@*
-Step through archive @var{abfd}'s symbol table (if it
-has one). Successively update @var{sym} with the next symbol's
-information, returning that symbol's (internal) index into the
-symbol table.
-
-Supply @code{BFD_NO_MORE_SYMBOLS} as the @var{previous} entry to get
-the first one; returns @code{BFD_NO_MORE_SYMBOLS} when you've already
-got the last one.
-
-A @code{carsym} is a canonical archive symbol. The only
-user-visible element is its name, a null-terminated string.
-
-@findex bfd_set_archive_head
-@subsubsection @code{bfd_set_archive_head}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_set_archive_head (bfd *output, bfd *new_head);
-@end example
-@strong{Description}@*
-Set the head of the chain of
-BFDs contained in the archive @var{output} to @var{new_head}.
-
-@findex bfd_openr_next_archived_file
-@subsubsection @code{bfd_openr_next_archived_file}
-@strong{Synopsis}
-@example
-bfd *bfd_openr_next_archived_file (bfd *archive, bfd *previous);
-@end example
-@strong{Description}@*
-Provided a BFD, @var{archive}, containing an archive and NULL, open
-an input BFD on the first contained element and returns that.
-Subsequent calls should pass
-the archive and the previous return value to return a created
-BFD to the next contained element. NULL is returned when there
-are no more.
-
diff --git a/bfd/doc/archures.texi b/bfd/doc/archures.texi
deleted file mode 100644
index bf72179dad31..000000000000
--- a/bfd/doc/archures.texi
+++ /dev/null
@@ -1,585 +0,0 @@
-@section Architectures
-BFD keeps one atom in a BFD describing the
-architecture of the data attached to the BFD: a pointer to a
-@code{bfd_arch_info_type}.
-
-Pointers to structures can be requested independently of a BFD
-so that an architecture's information can be interrogated
-without access to an open BFD.
-
-The architecture information is provided by each architecture package.
-The set of default architectures is selected by the macro
-@code{SELECT_ARCHITECTURES}. This is normally set up in the
-@file{config/@var{target}.mt} file of your choice. If the name is not
-defined, then all the architectures supported are included.
-
-When BFD starts up, all the architectures are called with an
-initialize method. It is up to the architecture back end to
-insert as many items into the list of architectures as it wants to;
-generally this would be one for each machine and one for the
-default case (an item with a machine field of 0).
-
-BFD's idea of an architecture is implemented in @file{archures.c}.
-
-@subsection bfd_architecture
-
-
-@strong{Description}@*
-This enum gives the object file's CPU architecture, in a
-global sense---i.e., what processor family does it belong to?
-Another field indicates which processor within
-the family is in use. The machine gives a number which
-distinguishes different versions of the architecture,
-containing, for example, 2 and 3 for Intel i960 KA and i960 KB,
-and 68020 and 68030 for Motorola 68020 and 68030.
-@example
-enum bfd_architecture
-@{
- bfd_arch_unknown, /* File arch not known. */
- bfd_arch_obscure, /* Arch known, not one of these. */
- bfd_arch_m68k, /* Motorola 68xxx */
-#define bfd_mach_m68000 1
-#define bfd_mach_m68008 2
-#define bfd_mach_m68010 3
-#define bfd_mach_m68020 4
-#define bfd_mach_m68030 5
-#define bfd_mach_m68040 6
-#define bfd_mach_m68060 7
-#define bfd_mach_cpu32 8
-#define bfd_mach_mcf_isa_a_nodiv 9
-#define bfd_mach_mcf_isa_a 10
-#define bfd_mach_mcf_isa_a_mac 11
-#define bfd_mach_mcf_isa_a_emac 12
-#define bfd_mach_mcf_isa_aplus 13
-#define bfd_mach_mcf_isa_aplus_mac 14
-#define bfd_mach_mcf_isa_aplus_emac 15
-#define bfd_mach_mcf_isa_b_nousp 16
-#define bfd_mach_mcf_isa_b_nousp_mac 17
-#define bfd_mach_mcf_isa_b_nousp_emac 18
-#define bfd_mach_mcf_isa_b 19
-#define bfd_mach_mcf_isa_b_mac 20
-#define bfd_mach_mcf_isa_b_emac 21
-#define bfd_mach_mcf_isa_b_float 22
-#define bfd_mach_mcf_isa_b_float_mac 23
-#define bfd_mach_mcf_isa_b_float_emac 24
- bfd_arch_vax, /* DEC Vax */
- bfd_arch_i960, /* Intel 960 */
- /* The order of the following is important.
- lower number indicates a machine type that
- only accepts a subset of the instructions
- available to machines with higher numbers.
- The exception is the "ca", which is
- incompatible with all other machines except
- "core". */
-
-#define bfd_mach_i960_core 1
-#define bfd_mach_i960_ka_sa 2
-#define bfd_mach_i960_kb_sb 3
-#define bfd_mach_i960_mc 4
-#define bfd_mach_i960_xa 5
-#define bfd_mach_i960_ca 6
-#define bfd_mach_i960_jx 7
-#define bfd_mach_i960_hx 8
-
- bfd_arch_or32, /* OpenRISC 32 */
-
- bfd_arch_sparc, /* SPARC */
-#define bfd_mach_sparc 1
-/* The difference between v8plus and v9 is that v9 is a true 64 bit env. */
-#define bfd_mach_sparc_sparclet 2
-#define bfd_mach_sparc_sparclite 3
-#define bfd_mach_sparc_v8plus 4
-#define bfd_mach_sparc_v8plusa 5 /* with ultrasparc add'ns. */
-#define bfd_mach_sparc_sparclite_le 6
-#define bfd_mach_sparc_v9 7
-#define bfd_mach_sparc_v9a 8 /* with ultrasparc add'ns. */
-#define bfd_mach_sparc_v8plusb 9 /* with cheetah add'ns. */
-#define bfd_mach_sparc_v9b 10 /* with cheetah add'ns. */
-/* Nonzero if MACH has the v9 instruction set. */
-#define bfd_mach_sparc_v9_p(mach) \
- ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \
- && (mach) != bfd_mach_sparc_sparclite_le)
-/* Nonzero if MACH is a 64 bit sparc architecture. */
-#define bfd_mach_sparc_64bit_p(mach) \
- ((mach) >= bfd_mach_sparc_v9 && (mach) != bfd_mach_sparc_v8plusb)
- bfd_arch_mips, /* MIPS Rxxxx */
-#define bfd_mach_mips3000 3000
-#define bfd_mach_mips3900 3900
-#define bfd_mach_mips4000 4000
-#define bfd_mach_mips4010 4010
-#define bfd_mach_mips4100 4100
-#define bfd_mach_mips4111 4111
-#define bfd_mach_mips4120 4120
-#define bfd_mach_mips4300 4300
-#define bfd_mach_mips4400 4400
-#define bfd_mach_mips4600 4600
-#define bfd_mach_mips4650 4650
-#define bfd_mach_mips5000 5000
-#define bfd_mach_mips5400 5400
-#define bfd_mach_mips5500 5500
-#define bfd_mach_mips6000 6000
-#define bfd_mach_mips7000 7000
-#define bfd_mach_mips8000 8000
-#define bfd_mach_mips9000 9000
-#define bfd_mach_mips10000 10000
-#define bfd_mach_mips12000 12000
-#define bfd_mach_mips16 16
-#define bfd_mach_mips5 5
-#define bfd_mach_mips_sb1 12310201 /* octal 'SB', 01 */
-#define bfd_mach_mipsisa32 32
-#define bfd_mach_mipsisa32r2 33
-#define bfd_mach_mipsisa64 64
-#define bfd_mach_mipsisa64r2 65
- bfd_arch_i386, /* Intel 386 */
-#define bfd_mach_i386_i386 1
-#define bfd_mach_i386_i8086 2
-#define bfd_mach_i386_i386_intel_syntax 3
-#define bfd_mach_x86_64 64
-#define bfd_mach_x86_64_intel_syntax 65
- bfd_arch_we32k, /* AT&T WE32xxx */
- bfd_arch_tahoe, /* CCI/Harris Tahoe */
- bfd_arch_i860, /* Intel 860 */
- bfd_arch_i370, /* IBM 360/370 Mainframes */
- bfd_arch_romp, /* IBM ROMP PC/RT */
- bfd_arch_convex, /* Convex */
- bfd_arch_m88k, /* Motorola 88xxx */
- bfd_arch_m98k, /* Motorola 98xxx */
- bfd_arch_pyramid, /* Pyramid Technology */
- bfd_arch_h8300, /* Renesas H8/300 (formerly Hitachi H8/300) */
-#define bfd_mach_h8300 1
-#define bfd_mach_h8300h 2
-#define bfd_mach_h8300s 3
-#define bfd_mach_h8300hn 4
-#define bfd_mach_h8300sn 5
-#define bfd_mach_h8300sx 6
-#define bfd_mach_h8300sxn 7
- bfd_arch_pdp11, /* DEC PDP-11 */
- bfd_arch_powerpc, /* PowerPC */
-#define bfd_mach_ppc 32
-#define bfd_mach_ppc64 64
-#define bfd_mach_ppc_403 403
-#define bfd_mach_ppc_403gc 4030
-#define bfd_mach_ppc_505 505
-#define bfd_mach_ppc_601 601
-#define bfd_mach_ppc_602 602
-#define bfd_mach_ppc_603 603
-#define bfd_mach_ppc_ec603e 6031
-#define bfd_mach_ppc_604 604
-#define bfd_mach_ppc_620 620
-#define bfd_mach_ppc_630 630
-#define bfd_mach_ppc_750 750
-#define bfd_mach_ppc_860 860
-#define bfd_mach_ppc_a35 35
-#define bfd_mach_ppc_rs64ii 642
-#define bfd_mach_ppc_rs64iii 643
-#define bfd_mach_ppc_7400 7400
-#define bfd_mach_ppc_e500 500
- bfd_arch_rs6000, /* IBM RS/6000 */
-#define bfd_mach_rs6k 6000
-#define bfd_mach_rs6k_rs1 6001
-#define bfd_mach_rs6k_rsc 6003
-#define bfd_mach_rs6k_rs2 6002
- bfd_arch_hppa, /* HP PA RISC */
-#define bfd_mach_hppa10 10
-#define bfd_mach_hppa11 11
-#define bfd_mach_hppa20 20
-#define bfd_mach_hppa20w 25
- bfd_arch_d10v, /* Mitsubishi D10V */
-#define bfd_mach_d10v 1
-#define bfd_mach_d10v_ts2 2
-#define bfd_mach_d10v_ts3 3
- bfd_arch_d30v, /* Mitsubishi D30V */
- bfd_arch_dlx, /* DLX */
- bfd_arch_m68hc11, /* Motorola 68HC11 */
- bfd_arch_m68hc12, /* Motorola 68HC12 */
-#define bfd_mach_m6812_default 0
-#define bfd_mach_m6812 1
-#define bfd_mach_m6812s 2
- bfd_arch_z8k, /* Zilog Z8000 */
-#define bfd_mach_z8001 1
-#define bfd_mach_z8002 2
- bfd_arch_h8500, /* Renesas H8/500 (formerly Hitachi H8/500) */
- bfd_arch_sh, /* Renesas / SuperH SH (formerly Hitachi SH) */
-#define bfd_mach_sh 1
-#define bfd_mach_sh2 0x20
-#define bfd_mach_sh_dsp 0x2d
-#define bfd_mach_sh2a 0x2a
-#define bfd_mach_sh2a_nofpu 0x2b
-#define bfd_mach_sh2a_nofpu_or_sh4_nommu_nofpu 0x2a1
-#define bfd_mach_sh2a_nofpu_or_sh3_nommu 0x2a2
-#define bfd_mach_sh2a_or_sh4 0x2a3
-#define bfd_mach_sh2a_or_sh3e 0x2a4
-#define bfd_mach_sh2e 0x2e
-#define bfd_mach_sh3 0x30
-#define bfd_mach_sh3_nommu 0x31
-#define bfd_mach_sh3_dsp 0x3d
-#define bfd_mach_sh3e 0x3e
-#define bfd_mach_sh4 0x40
-#define bfd_mach_sh4_nofpu 0x41
-#define bfd_mach_sh4_nommu_nofpu 0x42
-#define bfd_mach_sh4a 0x4a
-#define bfd_mach_sh4a_nofpu 0x4b
-#define bfd_mach_sh4al_dsp 0x4d
-#define bfd_mach_sh5 0x50
- bfd_arch_alpha, /* Dec Alpha */
-#define bfd_mach_alpha_ev4 0x10
-#define bfd_mach_alpha_ev5 0x20
-#define bfd_mach_alpha_ev6 0x30
- bfd_arch_arm, /* Advanced Risc Machines ARM. */
-#define bfd_mach_arm_unknown 0
-#define bfd_mach_arm_2 1
-#define bfd_mach_arm_2a 2
-#define bfd_mach_arm_3 3
-#define bfd_mach_arm_3M 4
-#define bfd_mach_arm_4 5
-#define bfd_mach_arm_4T 6
-#define bfd_mach_arm_5 7
-#define bfd_mach_arm_5T 8
-#define bfd_mach_arm_5TE 9
-#define bfd_mach_arm_XScale 10
-#define bfd_mach_arm_ep9312 11
-#define bfd_mach_arm_iWMMXt 12
- bfd_arch_ns32k, /* National Semiconductors ns32000 */
- bfd_arch_w65, /* WDC 65816 */
- bfd_arch_tic30, /* Texas Instruments TMS320C30 */
- bfd_arch_tic4x, /* Texas Instruments TMS320C3X/4X */
-#define bfd_mach_tic3x 30
-#define bfd_mach_tic4x 40
- bfd_arch_tic54x, /* Texas Instruments TMS320C54X */
- bfd_arch_tic80, /* TI TMS320c80 (MVP) */
- bfd_arch_v850, /* NEC V850 */
-#define bfd_mach_v850 1
-#define bfd_mach_v850e 'E'
-#define bfd_mach_v850e1 '1'
- bfd_arch_arc, /* ARC Cores */
-#define bfd_mach_arc_5 5
-#define bfd_mach_arc_6 6
-#define bfd_mach_arc_7 7
-#define bfd_mach_arc_8 8
- bfd_arch_m32c, /* Renesas M16C/M32C. */
-#define bfd_mach_m16c 0x75
-#define bfd_mach_m32c 0x78
- bfd_arch_m32r, /* Renesas M32R (formerly Mitsubishi M32R/D) */
-#define bfd_mach_m32r 1 /* For backwards compatibility. */
-#define bfd_mach_m32rx 'x'
-#define bfd_mach_m32r2 '2'
- bfd_arch_mn10200, /* Matsushita MN10200 */
- bfd_arch_mn10300, /* Matsushita MN10300 */
-#define bfd_mach_mn10300 300
-#define bfd_mach_am33 330
-#define bfd_mach_am33_2 332
- bfd_arch_fr30,
-#define bfd_mach_fr30 0x46523330
- bfd_arch_frv,
-#define bfd_mach_frv 1
-#define bfd_mach_frvsimple 2
-#define bfd_mach_fr300 300
-#define bfd_mach_fr400 400
-#define bfd_mach_fr450 450
-#define bfd_mach_frvtomcat 499 /* fr500 prototype */
-#define bfd_mach_fr500 500
-#define bfd_mach_fr550 550
- bfd_arch_mcore,
- bfd_arch_ia64, /* HP/Intel ia64 */
-#define bfd_mach_ia64_elf64 64
-#define bfd_mach_ia64_elf32 32
- bfd_arch_ip2k, /* Ubicom IP2K microcontrollers. */
-#define bfd_mach_ip2022 1
-#define bfd_mach_ip2022ext 2
- bfd_arch_iq2000, /* Vitesse IQ2000. */
-#define bfd_mach_iq2000 1
-#define bfd_mach_iq10 2
- bfd_arch_mt,
-#define bfd_mach_ms1 1
-#define bfd_mach_mrisc2 2
-#define bfd_mach_ms2 3
- bfd_arch_pj,
- bfd_arch_avr, /* Atmel AVR microcontrollers. */
-#define bfd_mach_avr1 1
-#define bfd_mach_avr2 2
-#define bfd_mach_avr3 3
-#define bfd_mach_avr4 4
-#define bfd_mach_avr5 5
- bfd_arch_bfin, /* ADI Blackfin */
-#define bfd_mach_bfin 1
- bfd_arch_cr16c, /* National Semiconductor CompactRISC. */
-#define bfd_mach_cr16c 1
- bfd_arch_crx, /* National Semiconductor CRX. */
-#define bfd_mach_crx 1
- bfd_arch_cris, /* Axis CRIS */
-#define bfd_mach_cris_v0_v10 255
-#define bfd_mach_cris_v32 32
-#define bfd_mach_cris_v10_v32 1032
- bfd_arch_s390, /* IBM s390 */
-#define bfd_mach_s390_31 31
-#define bfd_mach_s390_64 64
- bfd_arch_openrisc, /* OpenRISC */
- bfd_arch_mmix, /* Donald Knuth's educational processor. */
- bfd_arch_xstormy16,
-#define bfd_mach_xstormy16 1
- bfd_arch_msp430, /* Texas Instruments MSP430 architecture. */
-#define bfd_mach_msp11 11
-#define bfd_mach_msp110 110
-#define bfd_mach_msp12 12
-#define bfd_mach_msp13 13
-#define bfd_mach_msp14 14
-#define bfd_mach_msp15 15
-#define bfd_mach_msp16 16
-#define bfd_mach_msp21 21
-#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_xc16x, /* Infineon's XC16X Series. */
-#define bfd_mach_xc16x 1
-#define bfd_mach_xc16xl 2
-#define bfd_mach_xc16xs 3
- bfd_arch_xtensa, /* Tensilica's Xtensa cores. */
-#define bfd_mach_xtensa 1
- bfd_arch_maxq, /* Dallas MAXQ 10/20 */
-#define bfd_mach_maxq10 10
-#define bfd_mach_maxq20 20
- bfd_arch_z80,
-#define bfd_mach_z80strict 1 /* No undocumented opcodes. */
-#define bfd_mach_z80 3 /* With ixl, ixh, iyl, and iyh. */
-#define bfd_mach_z80full 7 /* All undocumented instructions. */
-#define bfd_mach_r800 11 /* R800: successor with multiplication. */
- bfd_arch_last
- @};
-@end example
-
-@subsection bfd_arch_info
-
-
-@strong{Description}@*
-This structure contains information on architectures for use
-within BFD.
-@example
-
-typedef struct bfd_arch_info
-@{
- int bits_per_word;
- int bits_per_address;
- int bits_per_byte;
- enum bfd_architecture arch;
- unsigned long mach;
- const char *arch_name;
- const char *printable_name;
- unsigned int section_align_power;
- /* TRUE if this is the default machine for the architecture.
- The default arch should be the first entry for an arch so that
- all the entries for that arch can be accessed via @code{next}. */
- bfd_boolean the_default;
- const struct bfd_arch_info * (*compatible)
- (const struct bfd_arch_info *a, const struct bfd_arch_info *b);
-
- bfd_boolean (*scan) (const struct bfd_arch_info *, const char *);
-
- const struct bfd_arch_info *next;
-@}
-bfd_arch_info_type;
-
-@end example
-
-@findex bfd_printable_name
-@subsubsection @code{bfd_printable_name}
-@strong{Synopsis}
-@example
-const char *bfd_printable_name (bfd *abfd);
-@end example
-@strong{Description}@*
-Return a printable string representing the architecture and machine
-from the pointer to the architecture info structure.
-
-@findex bfd_scan_arch
-@subsubsection @code{bfd_scan_arch}
-@strong{Synopsis}
-@example
-const bfd_arch_info_type *bfd_scan_arch (const char *string);
-@end example
-@strong{Description}@*
-Figure out if BFD supports any cpu which could be described with
-the name @var{string}. Return a pointer to an @code{arch_info}
-structure if a machine is found, otherwise NULL.
-
-@findex bfd_arch_list
-@subsubsection @code{bfd_arch_list}
-@strong{Synopsis}
-@example
-const char **bfd_arch_list (void);
-@end example
-@strong{Description}@*
-Return a freshly malloced NULL-terminated vector of the names
-of all the valid BFD architectures. Do not modify the names.
-
-@findex bfd_arch_get_compatible
-@subsubsection @code{bfd_arch_get_compatible}
-@strong{Synopsis}
-@example
-const bfd_arch_info_type *bfd_arch_get_compatible
- (const bfd *abfd, const bfd *bbfd, bfd_boolean accept_unknowns);
-@end example
-@strong{Description}@*
-Determine whether two BFDs' architectures and machine types
-are compatible. Calculates the lowest common denominator
-between the two architectures and machine types implied by
-the BFDs and returns a pointer to an @code{arch_info} structure
-describing the compatible machine.
-
-@findex bfd_default_arch_struct
-@subsubsection @code{bfd_default_arch_struct}
-@strong{Description}@*
-The @code{bfd_default_arch_struct} is an item of
-@code{bfd_arch_info_type} which has been initialized to a fairly
-generic state. A BFD starts life by pointing to this
-structure, until the correct back end has determined the real
-architecture of the file.
-@example
-extern const bfd_arch_info_type bfd_default_arch_struct;
-@end example
-
-@findex bfd_set_arch_info
-@subsubsection @code{bfd_set_arch_info}
-@strong{Synopsis}
-@example
-void bfd_set_arch_info (bfd *abfd, const bfd_arch_info_type *arg);
-@end example
-@strong{Description}@*
-Set the architecture info of @var{abfd} to @var{arg}.
-
-@findex bfd_default_set_arch_mach
-@subsubsection @code{bfd_default_set_arch_mach}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_default_set_arch_mach
- (bfd *abfd, enum bfd_architecture arch, unsigned long mach);
-@end example
-@strong{Description}@*
-Set the architecture and machine type in BFD @var{abfd}
-to @var{arch} and @var{mach}. Find the correct
-pointer to a structure and insert it into the @code{arch_info}
-pointer.
-
-@findex bfd_get_arch
-@subsubsection @code{bfd_get_arch}
-@strong{Synopsis}
-@example
-enum bfd_architecture bfd_get_arch (bfd *abfd);
-@end example
-@strong{Description}@*
-Return the enumerated type which describes the BFD @var{abfd}'s
-architecture.
-
-@findex bfd_get_mach
-@subsubsection @code{bfd_get_mach}
-@strong{Synopsis}
-@example
-unsigned long bfd_get_mach (bfd *abfd);
-@end example
-@strong{Description}@*
-Return the long type which describes the BFD @var{abfd}'s
-machine.
-
-@findex bfd_arch_bits_per_byte
-@subsubsection @code{bfd_arch_bits_per_byte}
-@strong{Synopsis}
-@example
-unsigned int bfd_arch_bits_per_byte (bfd *abfd);
-@end example
-@strong{Description}@*
-Return the number of bits in one of the BFD @var{abfd}'s
-architecture's bytes.
-
-@findex bfd_arch_bits_per_address
-@subsubsection @code{bfd_arch_bits_per_address}
-@strong{Synopsis}
-@example
-unsigned int bfd_arch_bits_per_address (bfd *abfd);
-@end example
-@strong{Description}@*
-Return the number of bits in one of the BFD @var{abfd}'s
-architecture's addresses.
-
-@findex bfd_default_compatible
-@subsubsection @code{bfd_default_compatible}
-@strong{Synopsis}
-@example
-const bfd_arch_info_type *bfd_default_compatible
- (const bfd_arch_info_type *a, const bfd_arch_info_type *b);
-@end example
-@strong{Description}@*
-The default function for testing for compatibility.
-
-@findex bfd_default_scan
-@subsubsection @code{bfd_default_scan}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_default_scan
- (const struct bfd_arch_info *info, const char *string);
-@end example
-@strong{Description}@*
-The default function for working out whether this is an
-architecture hit and a machine hit.
-
-@findex bfd_get_arch_info
-@subsubsection @code{bfd_get_arch_info}
-@strong{Synopsis}
-@example
-const bfd_arch_info_type *bfd_get_arch_info (bfd *abfd);
-@end example
-@strong{Description}@*
-Return the architecture info struct in @var{abfd}.
-
-@findex bfd_lookup_arch
-@subsubsection @code{bfd_lookup_arch}
-@strong{Synopsis}
-@example
-const bfd_arch_info_type *bfd_lookup_arch
- (enum bfd_architecture arch, unsigned long machine);
-@end example
-@strong{Description}@*
-Look for the architecture info structure which matches the
-arguments @var{arch} and @var{machine}. A machine of 0 matches the
-machine/architecture structure which marks itself as the
-default.
-
-@findex bfd_printable_arch_mach
-@subsubsection @code{bfd_printable_arch_mach}
-@strong{Synopsis}
-@example
-const char *bfd_printable_arch_mach
- (enum bfd_architecture arch, unsigned long machine);
-@end example
-@strong{Description}@*
-Return a printable string representing the architecture and
-machine type.
-
-This routine is depreciated.
-
-@findex bfd_octets_per_byte
-@subsubsection @code{bfd_octets_per_byte}
-@strong{Synopsis}
-@example
-unsigned int bfd_octets_per_byte (bfd *abfd);
-@end example
-@strong{Description}@*
-Return the number of octets (8-bit quantities) per target byte
-(minimum addressable unit). In most cases, this will be one, but some
-DSP targets have 16, 32, or even 48 bits per byte.
-
-@findex bfd_arch_mach_octets_per_byte
-@subsubsection @code{bfd_arch_mach_octets_per_byte}
-@strong{Synopsis}
-@example
-unsigned int bfd_arch_mach_octets_per_byte
- (enum bfd_architecture arch, unsigned long machine);
-@end example
-@strong{Description}@*
-See bfd_octets_per_byte.
-
-This routine is provided for those cases where a bfd * is not
-available
-
diff --git a/bfd/doc/bfd.info b/bfd/doc/bfd.info
deleted file mode 100644
index 14f4c2cdedd0..000000000000
--- a/bfd/doc/bfd.info
+++ /dev/null
@@ -1,10305 +0,0 @@
-This is ../.././bfd/doc/bfd.info, produced by makeinfo version 4.8 from
-../.././bfd/doc/bfd.texinfo.
-
-START-INFO-DIR-ENTRY
-* Bfd: (bfd). The Binary File Descriptor library.
-END-INFO-DIR-ENTRY
-
- This file documents the BFD library.
-
- Copyright (C) 1991, 2000, 2001, 2003 Free Software Foundation, Inc.
-
- Permission is granted to copy, distribute and/or modify this document
- under the terms of the GNU Free Documentation License, Version 1.1
- or any later version published by the Free Software Foundation;
- with no Invariant Sections, with no Front-Cover Texts, and with no
- Back-Cover Texts. A copy of the license is included in the
-section entitled "GNU Free Documentation License".
-
-
-File: bfd.info, Node: Top, Next: Overview, Prev: (dir), Up: (dir)
-
- This file documents the binary file descriptor library libbfd.
-
-* Menu:
-
-* Overview:: Overview of BFD
-* BFD front end:: BFD front end
-* BFD back ends:: BFD back ends
-* GNU Free Documentation License:: GNU Free Documentation License
-* Index:: Index
-
-
-File: bfd.info, Node: Overview, Next: BFD front end, Prev: Top, Up: Top
-
-1 Introduction
-**************
-
-BFD is a package which allows applications to use the same routines to
-operate on object files whatever the object file format. A new object
-file format can be supported simply by creating a new BFD back end and
-adding it to the library.
-
- BFD is split into two parts: the front end, and the back ends (one
-for each object file format).
- * The front end of BFD provides the interface to the user. It manages
- memory and various canonical data structures. The front end also
- decides which back end to use and when to call back end routines.
-
- * The back ends provide BFD its view of the real world. Each back
- end provides a set of calls which the BFD front end can use to
- maintain its canonical form. The back ends also may keep around
- information for their own use, for greater efficiency.
-
-* Menu:
-
-* History:: History
-* How It Works:: How It Works
-* What BFD Version 2 Can Do:: What BFD Version 2 Can Do
-
-
-File: bfd.info, Node: History, Next: How It Works, Prev: Overview, Up: Overview
-
-1.1 History
-===========
-
-One spur behind BFD was the desire, on the part of the GNU 960 team at
-Intel Oregon, for interoperability of applications on their COFF and
-b.out file formats. Cygnus was providing GNU support for the team, and
-was contracted to provide the required functionality.
-
- The name came from a conversation David Wallace was having with
-Richard Stallman about the library: RMS said that it would be quite
-hard--David said "BFD". Stallman was right, but the name stuck.
-
- At the same time, Ready Systems wanted much the same thing, but for
-different object file formats: IEEE-695, Oasys, Srecords, a.out and 68k
-coff.
-
- BFD was first implemented by members of Cygnus Support; Steve
-Chamberlain (`sac@cygnus.com'), John Gilmore (`gnu@cygnus.com'), K.
-Richard Pixley (`rich@cygnus.com') and David Henkel-Wallace
-(`gumby@cygnus.com').
-
-
-File: bfd.info, Node: How It Works, Next: What BFD Version 2 Can Do, Prev: History, Up: Overview
-
-1.2 How To Use BFD
-==================
-
-To use the library, include `bfd.h' and link with `libbfd.a'.
-
- BFD provides a common interface to the parts of an object file for a
-calling application.
-
- When an application sucessfully opens a target file (object,
-archive, or whatever), a pointer to an internal structure is returned.
-This pointer points to a structure called `bfd', described in `bfd.h'.
-Our convention is to call this pointer a BFD, and instances of it
-within code `abfd'. All operations on the target object file are
-applied as methods to the BFD. The mapping is defined within `bfd.h'
-in a set of macros, all beginning with `bfd_' to reduce namespace
-pollution.
-
- For example, this sequence does what you would probably expect:
-return the number of sections in an object file attached to a BFD
-`abfd'.
-
- #include "bfd.h"
-
- unsigned int number_of_sections (abfd)
- bfd *abfd;
- {
- return bfd_count_sections (abfd);
- }
-
- The abstraction used within BFD is that an object file has:
-
- * a header,
-
- * a number of sections containing raw data (*note Sections::),
-
- * a set of relocations (*note Relocations::), and
-
- * some symbol information (*note Symbols::).
- Also, BFDs opened for archives have the additional attribute of an
-index and contain subordinate BFDs. This approach is fine for a.out and
-coff, but loses efficiency when applied to formats such as S-records and
-IEEE-695.
-
-
-File: bfd.info, Node: What BFD Version 2 Can Do, Prev: How It Works, Up: Overview
-
-1.3 What BFD Version 2 Can Do
-=============================
-
-When an object file is opened, BFD subroutines automatically determine
-the format of the input object file. They then build a descriptor in
-memory with pointers to routines that will be used to access elements of
-the object file's data structures.
-
- As different information from the object files is required, BFD
-reads from different sections of the file and processes them. For
-example, a very common operation for the linker is processing symbol
-tables. Each BFD back end provides a routine for converting between
-the object file's representation of symbols and an internal canonical
-format. When the linker asks for the symbol table of an object file, it
-calls through a memory pointer to the routine from the relevant BFD
-back end which reads and converts the table into a canonical form. The
-linker then operates upon the canonical form. When the link is finished
-and the linker writes the output file's symbol table, another BFD back
-end routine is called to take the newly created symbol table and
-convert it into the chosen output format.
-
-* Menu:
-
-* BFD information loss:: Information Loss
-* Canonical format:: The BFD canonical object-file format
-
-
-File: bfd.info, Node: BFD information loss, Next: Canonical format, Up: What BFD Version 2 Can Do
-
-1.3.1 Information Loss
-----------------------
-
-_Information can be lost during output._ The output formats supported
-by BFD do not provide identical facilities, and information which can
-be described in one form has nowhere to go in another format. One
-example of this is alignment information in `b.out'. There is nowhere
-in an `a.out' format file to store alignment information on the
-contained data, so when a file is linked from `b.out' and an `a.out'
-image is produced, alignment information will not propagate to the
-output file. (The linker will still use the alignment information
-internally, so the link is performed correctly).
-
- Another example is COFF section names. COFF files may contain an
-unlimited number of sections, each one with a textual section name. If
-the target of the link is a format which does not have many sections
-(e.g., `a.out') or has sections without names (e.g., the Oasys format),
-the link cannot be done simply. You can circumvent this problem by
-describing the desired input-to-output section mapping with the linker
-command language.
-
- _Information can be lost during canonicalization._ The BFD internal
-canonical form of the external formats is not exhaustive; there are
-structures in input formats for which there is no direct representation
-internally. This means that the BFD back ends cannot maintain all
-possible data richness through the transformation between external to
-internal and back to external formats.
-
- This limitation is only a problem when an application reads one
-format and writes another. Each BFD back end is responsible for
-maintaining as much data as possible, and the internal BFD canonical
-form has structures which are opaque to the BFD core, and exported only
-to the back ends. When a file is read in one format, the canonical form
-is generated for BFD and the application. At the same time, the back
-end saves away any information which may otherwise be lost. If the data
-is then written back in the same format, the back end routine will be
-able to use the canonical form provided by the BFD core as well as the
-information it prepared earlier. Since there is a great deal of
-commonality between back ends, there is no information lost when
-linking or copying big endian COFF to little endian COFF, or `a.out' to
-`b.out'. When a mixture of formats is linked, the information is only
-lost from the files whose format differs from the destination.
-
-
-File: bfd.info, Node: Canonical format, Prev: BFD information loss, Up: What BFD Version 2 Can Do
-
-1.3.2 The BFD canonical object-file format
-------------------------------------------
-
-The greatest potential for loss of information occurs when there is the
-least overlap between the information provided by the source format,
-that stored by the canonical format, and that needed by the destination
-format. A brief description of the canonical form may help you
-understand which kinds of data you can count on preserving across
-conversions.
-
-_files_
- Information stored on a per-file basis includes target machine
- architecture, particular implementation format type, a demand
- pageable bit, and a write protected bit. Information like Unix
- magic numbers is not stored here--only the magic numbers' meaning,
- so a `ZMAGIC' file would have both the demand pageable bit and the
- write protected text bit set. The byte order of the target is
- stored on a per-file basis, so that big- and little-endian object
- files may be used with one another.
-
-_sections_
- Each section in the input file contains the name of the section,
- the section's original address in the object file, size and
- alignment information, various flags, and pointers into other BFD
- data structures.
-
-_symbols_
- Each symbol contains a pointer to the information for the object
- file which originally defined it, its name, its value, and various
- flag bits. When a BFD back end reads in a symbol table, it
- relocates all symbols to make them relative to the base of the
- section where they were defined. Doing this ensures that each
- symbol points to its containing section. Each symbol also has a
- varying amount of hidden private data for the BFD back end. Since
- the symbol points to the original file, the private data format
- for that symbol is accessible. `ld' can operate on a collection
- of symbols of wildly different formats without problems.
-
- Normal global and simple local symbols are maintained on output,
- so an output file (no matter its format) will retain symbols
- pointing to functions and to global, static, and common variables.
- Some symbol information is not worth retaining; in `a.out', type
- information is stored in the symbol table as long symbol names.
- This information would be useless to most COFF debuggers; the
- linker has command line switches to allow users to throw it away.
-
- There is one word of type information within the symbol, so if the
- format supports symbol type information within symbols (for
- example, COFF, IEEE, Oasys) and the type is simple enough to fit
- within one word (nearly everything but aggregates), the
- information will be preserved.
-
-_relocation level_
- Each canonical BFD relocation record contains a pointer to the
- symbol to relocate to, the offset of the data to relocate, the
- section the data is in, and a pointer to a relocation type
- descriptor. Relocation is performed by passing messages through
- the relocation type descriptor and the symbol pointer. Therefore,
- relocations can be performed on output data using a relocation
- method that is only available in one of the input formats. For
- instance, Oasys provides a byte relocation format. A relocation
- record requesting this relocation type would point indirectly to a
- routine to perform this, so the relocation may be performed on a
- byte being written to a 68k COFF file, even though 68k COFF has no
- such relocation type.
-
-_line numbers_
- Object formats can contain, for debugging purposes, some form of
- mapping between symbols, source line numbers, and addresses in the
- output file. These addresses have to be relocated along with the
- symbol information. Each symbol with an associated list of line
- number records points to the first record of the list. The head
- of a line number list consists of a pointer to the symbol, which
- allows finding out the address of the function whose line number
- is being described. The rest of the list is made up of pairs:
- offsets into the section and line numbers. Any format which can
- simply derive this information can pass it successfully between
- formats (COFF, IEEE and Oasys).
-
-
-File: bfd.info, Node: BFD front end, Next: BFD back ends, Prev: Overview, Up: Top
-
-2 BFD Front End
-***************
-
-2.1 `typedef bfd'
-=================
-
-A BFD has type `bfd'; objects of this type are the cornerstone of any
-application using BFD. Using BFD consists of making references though
-the BFD and to data in the BFD.
-
- Here is the structure that defines the type `bfd'. It contains the
-major data about the file and pointers to the rest of the data.
-
-
- struct bfd
- {
- /* A unique identifier of the BFD */
- unsigned int id;
-
- /* The filename the application opened the BFD with. */
- const char *filename;
-
- /* A pointer to the target jump table. */
- const struct bfd_target *xvec;
-
- /* The IOSTREAM, and corresponding IO vector that provide access
- to the file backing the BFD. */
- void *iostream;
- const struct bfd_iovec *iovec;
-
- /* Is the file descriptor being cached? That is, can it be closed as
- needed, and re-opened when accessed later? */
- bfd_boolean cacheable;
-
- /* Marks whether there was a default target specified when the
- BFD was opened. This is used to select which matching algorithm
- to use to choose the back end. */
- bfd_boolean target_defaulted;
-
- /* The caching routines use these to maintain a
- least-recently-used list of BFDs. */
- struct bfd *lru_prev, *lru_next;
-
- /* When a file is closed by the caching routines, BFD retains
- state information on the file here... */
- ufile_ptr where;
-
- /* ... and here: (``once'' means at least once). */
- bfd_boolean opened_once;
-
- /* Set if we have a locally maintained mtime value, rather than
- getting it from the file each time. */
- bfd_boolean mtime_set;
-
- /* File modified time, if mtime_set is TRUE. */
- long mtime;
-
- /* Reserved for an unimplemented file locking extension. */
- int ifd;
-
- /* The format which belongs to the BFD. (object, core, etc.) */
- bfd_format format;
-
- /* The direction with which the BFD was opened. */
- enum bfd_direction
- {
- no_direction = 0,
- read_direction = 1,
- write_direction = 2,
- both_direction = 3
- }
- direction;
-
- /* Format_specific flags. */
- flagword flags;
-
- /* Currently my_archive is tested before adding origin to
- anything. I believe that this can become always an add of
- origin, with origin set to 0 for non archive files. */
- ufile_ptr origin;
-
- /* Remember when output has begun, to stop strange things
- from happening. */
- bfd_boolean output_has_begun;
-
- /* A hash table for section names. */
- struct bfd_hash_table section_htab;
-
- /* Pointer to linked list of sections. */
- struct bfd_section *sections;
-
- /* The last section on the section list. */
- struct bfd_section *section_last;
-
- /* The number of sections. */
- unsigned int section_count;
-
- /* Stuff only useful for object files:
- The start address. */
- bfd_vma start_address;
-
- /* Used for input and output. */
- unsigned int symcount;
-
- /* Symbol table for output BFD (with symcount entries). */
- struct bfd_symbol **outsymbols;
-
- /* Used for slurped dynamic symbol tables. */
- unsigned int dynsymcount;
-
- /* Pointer to structure which contains architecture information. */
- const struct bfd_arch_info *arch_info;
-
- /* Flag set if symbols from this BFD should not be exported. */
- bfd_boolean no_export;
-
- /* Stuff only useful for archives. */
- void *arelt_data;
- struct bfd *my_archive; /* The containing archive BFD. */
- struct bfd *next; /* The next BFD in the archive. */
- struct bfd *archive_head; /* The first BFD in the archive. */
- bfd_boolean has_armap;
-
- /* A chain of BFD structures involved in a link. */
- struct bfd *link_next;
-
- /* A field used by _bfd_generic_link_add_archive_symbols. This will
- be used only for archive elements. */
- int archive_pass;
-
- /* Used by the back end to hold private data. */
- union
- {
- struct aout_data_struct *aout_data;
- struct artdata *aout_ar_data;
- struct _oasys_data *oasys_obj_data;
- struct _oasys_ar_data *oasys_ar_data;
- struct coff_tdata *coff_obj_data;
- struct pe_tdata *pe_obj_data;
- struct xcoff_tdata *xcoff_obj_data;
- struct ecoff_tdata *ecoff_obj_data;
- struct ieee_data_struct *ieee_data;
- struct ieee_ar_data_struct *ieee_ar_data;
- struct srec_data_struct *srec_data;
- struct ihex_data_struct *ihex_data;
- struct tekhex_data_struct *tekhex_data;
- struct elf_obj_tdata *elf_obj_data;
- struct nlm_obj_tdata *nlm_obj_data;
- struct bout_data_struct *bout_data;
- struct mmo_data_struct *mmo_data;
- struct sun_core_struct *sun_core_data;
- struct sco5_core_struct *sco5_core_data;
- struct trad_core_struct *trad_core_data;
- struct som_data_struct *som_data;
- struct hpux_core_struct *hpux_core_data;
- struct hppabsd_core_struct *hppabsd_core_data;
- struct sgi_core_struct *sgi_core_data;
- struct lynx_core_struct *lynx_core_data;
- struct osf_core_struct *osf_core_data;
- struct cisco_core_struct *cisco_core_data;
- struct versados_data_struct *versados_data;
- struct netbsd_core_struct *netbsd_core_data;
- struct mach_o_data_struct *mach_o_data;
- struct mach_o_fat_data_struct *mach_o_fat_data;
- struct bfd_pef_data_struct *pef_data;
- struct bfd_pef_xlib_data_struct *pef_xlib_data;
- struct bfd_sym_data_struct *sym_data;
- void *any;
- }
- tdata;
-
- /* Used by the application to hold private data. */
- void *usrdata;
-
- /* Where all the allocated stuff under this BFD goes. This is a
- struct objalloc *, but we use void * to avoid requiring the inclusion
- of objalloc.h. */
- void *memory;
- };
-
-2.2 Error reporting
-===================
-
-Most BFD functions return nonzero on success (check their individual
-documentation for precise semantics). On an error, they call
-`bfd_set_error' to set an error condition that callers can check by
-calling `bfd_get_error'. If that returns `bfd_error_system_call', then
-check `errno'.
-
- The easiest way to report a BFD error to the user is to use
-`bfd_perror'.
-
-2.2.1 Type `bfd_error_type'
----------------------------
-
-The values returned by `bfd_get_error' are defined by the enumerated
-type `bfd_error_type'.
-
-
- typedef enum bfd_error
- {
- bfd_error_no_error = 0,
- bfd_error_system_call,
- bfd_error_invalid_target,
- bfd_error_wrong_format,
- bfd_error_wrong_object_format,
- bfd_error_invalid_operation,
- bfd_error_no_memory,
- bfd_error_no_symbols,
- bfd_error_no_armap,
- bfd_error_no_more_archived_files,
- bfd_error_malformed_archive,
- bfd_error_file_not_recognized,
- bfd_error_file_ambiguously_recognized,
- bfd_error_no_contents,
- bfd_error_nonrepresentable_section,
- bfd_error_no_debug_section,
- bfd_error_bad_value,
- bfd_error_file_truncated,
- bfd_error_file_too_big,
- bfd_error_invalid_error_code
- }
- bfd_error_type;
-
-2.2.1.1 `bfd_get_error'
-.......................
-
-*Synopsis*
- bfd_error_type bfd_get_error (void);
- *Description*
-Return the current BFD error condition.
-
-2.2.1.2 `bfd_set_error'
-.......................
-
-*Synopsis*
- void bfd_set_error (bfd_error_type error_tag);
- *Description*
-Set the BFD error condition to be ERROR_TAG.
-
-2.2.1.3 `bfd_errmsg'
-....................
-
-*Synopsis*
- const char *bfd_errmsg (bfd_error_type error_tag);
- *Description*
-Return a string describing the error ERROR_TAG, or the system error if
-ERROR_TAG is `bfd_error_system_call'.
-
-2.2.1.4 `bfd_perror'
-....................
-
-*Synopsis*
- void bfd_perror (const char *message);
- *Description*
-Print to the standard error stream a string describing the last BFD
-error that occurred, or the last system error if the last BFD error was
-a system call failure. If MESSAGE is non-NULL and non-empty, the error
-string printed is preceded by MESSAGE, a colon, and a space. It is
-followed by a newline.
-
-2.2.2 BFD error handler
------------------------
-
-Some BFD functions want to print messages describing the problem. They
-call a BFD error handler function. This function may be overridden by
-the program.
-
- The BFD error handler acts like printf.
-
-
- typedef void (*bfd_error_handler_type) (const char *, ...);
-
-2.2.2.1 `bfd_set_error_handler'
-...............................
-
-*Synopsis*
- bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type);
- *Description*
-Set the BFD error handler function. Returns the previous function.
-
-2.2.2.2 `bfd_set_error_program_name'
-....................................
-
-*Synopsis*
- void bfd_set_error_program_name (const char *);
- *Description*
-Set the program name to use when printing a BFD error. This is printed
-before the error message followed by a colon and space. The string
-must not be changed after it is passed to this function.
-
-2.2.2.3 `bfd_get_error_handler'
-...............................
-
-*Synopsis*
- bfd_error_handler_type bfd_get_error_handler (void);
- *Description*
-Return the BFD error handler function.
-
-2.3 Miscellaneous
-=================
-
-2.3.1 Miscellaneous functions
------------------------------
-
-2.3.1.1 `bfd_get_reloc_upper_bound'
-...................................
-
-*Synopsis*
- long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect);
- *Description*
-Return the number of bytes required to store the relocation information
-associated with section SECT attached to bfd ABFD. If an error occurs,
-return -1.
-
-2.3.1.2 `bfd_canonicalize_reloc'
-................................
-
-*Synopsis*
- long bfd_canonicalize_reloc
- (bfd *abfd, asection *sec, arelent **loc, asymbol **syms);
- *Description*
-Call the back end associated with the open BFD ABFD and translate the
-external form of the relocation information attached to SEC into the
-internal canonical form. Place the table into memory at LOC, which has
-been preallocated, usually by a call to `bfd_get_reloc_upper_bound'.
-Returns the number of relocs, or -1 on error.
-
- The SYMS table is also needed for horrible internal magic reasons.
-
-2.3.1.3 `bfd_set_reloc'
-.......................
-
-*Synopsis*
- void bfd_set_reloc
- (bfd *abfd, asection *sec, arelent **rel, unsigned int count);
- *Description*
-Set the relocation pointer and count within section SEC to the values
-REL and COUNT. The argument ABFD is ignored.
-
-2.3.1.4 `bfd_set_file_flags'
-............................
-
-*Synopsis*
- bfd_boolean bfd_set_file_flags (bfd *abfd, flagword flags);
- *Description*
-Set the flag word in the BFD ABFD to the value FLAGS.
-
- Possible errors are:
- * `bfd_error_wrong_format' - The target bfd was not of object format.
-
- * `bfd_error_invalid_operation' - The target bfd was open for
- reading.
-
- * `bfd_error_invalid_operation' - The flag word contained a bit
- which was not applicable to the type of file. E.g., an attempt
- was made to set the `D_PAGED' bit on a BFD format which does not
- support demand paging.
-
-2.3.1.5 `bfd_get_arch_size'
-...........................
-
-*Synopsis*
- int bfd_get_arch_size (bfd *abfd);
- *Description*
-Returns the architecture address size, in bits, as determined by the
-object file's format. For ELF, this information is included in the
-header.
-
- *Returns*
-Returns the arch size in bits if known, `-1' otherwise.
-
-2.3.1.6 `bfd_get_sign_extend_vma'
-.................................
-
-*Synopsis*
- int bfd_get_sign_extend_vma (bfd *abfd);
- *Description*
-Indicates if the target architecture "naturally" sign extends an
-address. Some architectures implicitly sign extend address values when
-they are converted to types larger than the size of an address. For
-instance, bfd_get_start_address() will return an address sign extended
-to fill a bfd_vma when this is the case.
-
- *Returns*
-Returns `1' if the target architecture is known to sign extend
-addresses, `0' if the target architecture is known to not sign extend
-addresses, and `-1' otherwise.
-
-2.3.1.7 `bfd_set_start_address'
-...............................
-
-*Synopsis*
- bfd_boolean bfd_set_start_address (bfd *abfd, bfd_vma vma);
- *Description*
-Make VMA the entry point of output BFD ABFD.
-
- *Returns*
-Returns `TRUE' on success, `FALSE' otherwise.
-
-2.3.1.8 `bfd_get_gp_size'
-.........................
-
-*Synopsis*
- unsigned int bfd_get_gp_size (bfd *abfd);
- *Description*
-Return the maximum size of objects to be optimized using the GP
-register under MIPS ECOFF. This is typically set by the `-G' argument
-to the compiler, assembler or linker.
-
-2.3.1.9 `bfd_set_gp_size'
-.........................
-
-*Synopsis*
- void bfd_set_gp_size (bfd *abfd, unsigned int i);
- *Description*
-Set the maximum size of objects to be optimized using the GP register
-under ECOFF or MIPS ELF. This is typically set by the `-G' argument to
-the compiler, assembler or linker.
-
-2.3.1.10 `bfd_scan_vma'
-.......................
-
-*Synopsis*
- bfd_vma bfd_scan_vma (const char *string, const char **end, int base);
- *Description*
-Convert, like `strtoul', a numerical expression STRING into a `bfd_vma'
-integer, and return that integer. (Though without as many bells and
-whistles as `strtoul'.) The expression is assumed to be unsigned
-(i.e., positive). If given a BASE, it is used as the base for
-conversion. A base of 0 causes the function to interpret the string in
-hex if a leading "0x" or "0X" is found, otherwise in octal if a leading
-zero is found, otherwise in decimal.
-
- If the value would overflow, the maximum `bfd_vma' value is returned.
-
-2.3.1.11 `bfd_copy_private_header_data'
-.......................................
-
-*Synopsis*
- bfd_boolean bfd_copy_private_header_data (bfd *ibfd, bfd *obfd);
- *Description*
-Copy private BFD header information from the BFD IBFD to the the BFD
-OBFD. This copies information that may require sections to exist, but
-does not require symbol tables. Return `true' on success, `false' on
-error. Possible error returns are:
-
- * `bfd_error_no_memory' - Not enough memory exists to create private
- data for OBFD.
-
- #define bfd_copy_private_header_data(ibfd, obfd) \
- BFD_SEND (obfd, _bfd_copy_private_header_data, \
- (ibfd, obfd))
-
-2.3.1.12 `bfd_copy_private_bfd_data'
-....................................
-
-*Synopsis*
- bfd_boolean bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd);
- *Description*
-Copy private BFD information from the BFD IBFD to the the BFD OBFD.
-Return `TRUE' on success, `FALSE' on error. Possible error returns are:
-
- * `bfd_error_no_memory' - Not enough memory exists to create private
- data for OBFD.
-
- #define bfd_copy_private_bfd_data(ibfd, obfd) \
- BFD_SEND (obfd, _bfd_copy_private_bfd_data, \
- (ibfd, obfd))
-
-2.3.1.13 `bfd_merge_private_bfd_data'
-.....................................
-
-*Synopsis*
- bfd_boolean bfd_merge_private_bfd_data (bfd *ibfd, bfd *obfd);
- *Description*
-Merge private BFD information from the BFD IBFD to the the output file
-BFD OBFD when linking. Return `TRUE' on success, `FALSE' on error.
-Possible error returns are:
-
- * `bfd_error_no_memory' - Not enough memory exists to create private
- data for OBFD.
-
- #define bfd_merge_private_bfd_data(ibfd, obfd) \
- BFD_SEND (obfd, _bfd_merge_private_bfd_data, \
- (ibfd, obfd))
-
-2.3.1.14 `bfd_set_private_flags'
-................................
-
-*Synopsis*
- bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags);
- *Description*
-Set private BFD flag information in the BFD ABFD. Return `TRUE' on
-success, `FALSE' on error. Possible error returns are:
-
- * `bfd_error_no_memory' - Not enough memory exists to create private
- data for OBFD.
-
- #define bfd_set_private_flags(abfd, flags) \
- BFD_SEND (abfd, _bfd_set_private_flags, (abfd, flags))
-
-2.3.1.15 `Other functions'
-..........................
-
-*Description*
-The following functions exist but have not yet been documented.
- #define bfd_sizeof_headers(abfd, reloc) \
- BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc))
-
- #define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
- BFD_SEND (abfd, _bfd_find_nearest_line, \
- (abfd, sec, syms, off, file, func, line))
-
- #define bfd_find_line(abfd, syms, sym, file, line) \
- BFD_SEND (abfd, _bfd_find_line, \
- (abfd, syms, sym, file, line))
-
- #define bfd_find_inliner_info(abfd, file, func, line) \
- BFD_SEND (abfd, _bfd_find_inliner_info, \
- (abfd, file, func, line))
-
- #define bfd_debug_info_start(abfd) \
- BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
-
- #define bfd_debug_info_end(abfd) \
- BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
-
- #define bfd_debug_info_accumulate(abfd, section) \
- BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
-
- #define bfd_stat_arch_elt(abfd, stat) \
- BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
-
- #define bfd_update_armap_timestamp(abfd) \
- BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
-
- #define bfd_set_arch_mach(abfd, arch, mach)\
- BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
-
- #define bfd_relax_section(abfd, section, link_info, again) \
- BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
-
- #define bfd_gc_sections(abfd, link_info) \
- BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info))
-
- #define bfd_merge_sections(abfd, link_info) \
- BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
-
- #define bfd_is_group_section(abfd, sec) \
- BFD_SEND (abfd, _bfd_is_group_section, (abfd, sec))
-
- #define bfd_discard_group(abfd, sec) \
- BFD_SEND (abfd, _bfd_discard_group, (abfd, sec))
-
- #define bfd_link_hash_table_create(abfd) \
- BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
-
- #define bfd_link_hash_table_free(abfd, hash) \
- BFD_SEND (abfd, _bfd_link_hash_table_free, (hash))
-
- #define bfd_link_add_symbols(abfd, info) \
- BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
-
- #define bfd_link_just_syms(abfd, sec, info) \
- BFD_SEND (abfd, _bfd_link_just_syms, (sec, info))
-
- #define bfd_final_link(abfd, info) \
- BFD_SEND (abfd, _bfd_final_link, (abfd, info))
-
- #define bfd_free_cached_info(abfd) \
- BFD_SEND (abfd, _bfd_free_cached_info, (abfd))
-
- #define bfd_get_dynamic_symtab_upper_bound(abfd) \
- BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd))
-
- #define bfd_print_private_bfd_data(abfd, file)\
- BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file))
-
- #define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \
- BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols))
-
- #define bfd_get_synthetic_symtab(abfd, count, syms, dyncount, dynsyms, ret) \
- BFD_SEND (abfd, _bfd_get_synthetic_symtab, (abfd, count, syms, \
- dyncount, dynsyms, ret))
-
- #define bfd_get_dynamic_reloc_upper_bound(abfd) \
- BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd))
-
- #define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \
- BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms))
-
- extern bfd_byte *bfd_get_relocated_section_contents
- (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *,
- bfd_boolean, asymbol **);
-
-2.3.1.16 `bfd_alt_mach_code'
-............................
-
-*Synopsis*
- bfd_boolean bfd_alt_mach_code (bfd *abfd, int alternative);
- *Description*
-When more than one machine code number is available for the same
-machine type, this function can be used to switch between the preferred
-one (alternative == 0) and any others. Currently, only ELF supports
-this feature, with up to two alternate machine codes.
-
- struct bfd_preserve
- {
- void *marker;
- void *tdata;
- flagword flags;
- const struct bfd_arch_info *arch_info;
- struct bfd_section *sections;
- struct bfd_section *section_last;
- unsigned int section_count;
- struct bfd_hash_table section_htab;
- };
-
-2.3.1.17 `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.
-
-2.3.1.18 `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.
-
-2.3.1.19 `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.
-
-2.3.1.20 `struct bfd_iovec'
-...........................
-
-*Description*
-The `struct bfd_iovec' contains the internal file I/O class. Each
-`BFD' has an instance of this class and all file I/O is routed through
-it (it is assumed that the instance implements all methods listed
-below).
- struct bfd_iovec
- {
- /* To avoid problems with macros, a "b" rather than "f"
- prefix is prepended to each method name. */
- /* Attempt to read/write NBYTES on ABFD's IOSTREAM storing/fetching
- bytes starting at PTR. Return the number of bytes actually
- transfered (a read past end-of-file returns less than NBYTES),
- or -1 (setting `bfd_error') if an error occurs. */
- file_ptr (*bread) (struct bfd *abfd, void *ptr, file_ptr nbytes);
- file_ptr (*bwrite) (struct bfd *abfd, const void *ptr,
- file_ptr nbytes);
- /* Return the current IOSTREAM file offset, or -1 (setting `bfd_error'
- if an error occurs. */
- file_ptr (*btell) (struct bfd *abfd);
- /* For the following, on successful completion a value of 0 is returned.
- Otherwise, a value of -1 is returned (and `bfd_error' is set). */
- int (*bseek) (struct bfd *abfd, file_ptr offset, int whence);
- int (*bclose) (struct bfd *abfd);
- int (*bflush) (struct bfd *abfd);
- int (*bstat) (struct bfd *abfd, struct stat *sb);
- };
-
-2.3.1.21 `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).
-
-2.3.1.22 `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 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?".
-
-* Menu:
-
-* Memory Usage::
-* Initialization::
-* Sections::
-* Symbols::
-* Archives::
-* Formats::
-* Relocations::
-* Core Files::
-* Targets::
-* Architectures::
-* Opening and Closing::
-* Internal::
-* File Caching::
-* Linker Functions::
-* Hash Tables::
-
-
-File: bfd.info, Node: Memory Usage, Next: Initialization, Prev: BFD front end, Up: BFD front end
-
-2.4 Memory Usage
-================
-
-BFD keeps all of its internal structures in obstacks. There is one
-obstack per open BFD file, into which the current state is stored. When
-a BFD is closed, the obstack is deleted, and so everything which has
-been allocated by BFD for the closing file is thrown away.
-
- BFD does not free anything created by an application, but pointers
-into `bfd' structures become invalid on a `bfd_close'; for example,
-after a `bfd_close' the vector passed to `bfd_canonicalize_symtab' is
-still around, since it has been allocated by the application, but the
-data that it pointed to are lost.
-
- The general rule is to not close a BFD until all operations dependent
-upon data from the BFD have been completed, or all the data from within
-the file has been copied. To help with the management of memory, there
-is a function (`bfd_alloc_size') which returns the number of bytes in
-obstacks associated with the supplied BFD. This could be used to select
-the greediest open BFD, close it to reclaim the memory, perform some
-operation and reopen the BFD again, to get a fresh copy of the data
-structures.
-
-
-File: bfd.info, Node: Initialization, Next: Sections, Prev: Memory Usage, Up: BFD front end
-
-2.5 Initialization
-==================
-
-2.5.1 Initialization functions
-------------------------------
-
-These are the functions that handle initializing a BFD.
-
-2.5.1.1 `bfd_init'
-..................
-
-*Synopsis*
- void bfd_init (void);
- *Description*
-This routine must be called before any other BFD function to initialize
-magical internal data structures.
-
-
-File: bfd.info, Node: Sections, Next: Symbols, Prev: Initialization, Up: BFD front end
-
-2.6 Sections
-============
-
-The raw data contained within a BFD is maintained through the section
-abstraction. A single BFD may have any number of sections. It keeps
-hold of them by pointing to the first; each one points to the next in
-the list.
-
- Sections are supported in BFD in `section.c'.
-
-* Menu:
-
-* Section Input::
-* Section Output::
-* typedef asection::
-* section prototypes::
-
-
-File: bfd.info, Node: Section Input, Next: Section Output, Prev: Sections, Up: Sections
-
-2.6.1 Section input
--------------------
-
-When a BFD is opened for reading, the section structures are created
-and attached to the BFD.
-
- Each section has a name which describes the section in the outside
-world--for example, `a.out' would contain at least three sections,
-called `.text', `.data' and `.bss'.
-
- Names need not be unique; for example a COFF file may have several
-sections named `.data'.
-
- Sometimes a BFD will contain more than the "natural" number of
-sections. A back end may attach other sections containing constructor
-data, or an application may add a section (using `bfd_make_section') to
-the sections attached to an already open BFD. For example, the linker
-creates an extra section `COMMON' for each input file's BFD to hold
-information about common storage.
-
- The raw data is not necessarily read in when the section descriptor
-is created. Some targets may leave the data in place until a
-`bfd_get_section_contents' call is made. Other back ends may read in
-all the data at once. For example, an S-record file has to be read
-once to determine the size of the data. An IEEE-695 file doesn't
-contain raw data in sections, but data and relocation expressions
-intermixed, so the data area has to be parsed to get out the data and
-relocations.
-
-
-File: bfd.info, Node: Section Output, Next: typedef asection, Prev: Section Input, Up: Sections
-
-2.6.2 Section output
---------------------
-
-To write a new object style BFD, the various sections to be written
-have to be created. They are attached to the BFD in the same way as
-input sections; data is written to the sections using
-`bfd_set_section_contents'.
-
- Any program that creates or combines sections (e.g., the assembler
-and linker) must use the `asection' fields `output_section' and
-`output_offset' to indicate the file sections to which each section
-must be written. (If the section is being created from scratch,
-`output_section' should probably point to the section itself and
-`output_offset' should probably be zero.)
-
- The data to be written comes from input sections attached (via
-`output_section' pointers) to the output sections. The output section
-structure can be considered a filter for the input section: the output
-section determines the vma of the output data and the name, but the
-input section determines the offset into the output section of the data
-to be written.
-
- E.g., to create a section "O", starting at 0x100, 0x123 long,
-containing two subsections, "A" at offset 0x0 (i.e., at vma 0x100) and
-"B" at offset 0x20 (i.e., at vma 0x120) the `asection' structures would
-look like:
-
- section name "A"
- output_offset 0x00
- size 0x20
- output_section -----------> section name "O"
- | vma 0x100
- section name "B" | size 0x123
- output_offset 0x20 |
- size 0x103 |
- output_section --------|
-
-2.6.3 Link orders
------------------
-
-The data within a section is stored in a "link_order". These are much
-like the fixups in `gas'. The link_order abstraction allows a section
-to grow and shrink within itself.
-
- A link_order knows how big it is, and which is the next link_order
-and where the raw data for it is; it also points to a list of
-relocations which apply to it.
-
- The link_order is used by the linker to perform relaxing on final
-code. The compiler creates code which is as big as necessary to make
-it work without relaxing, and the user can select whether to relax.
-Sometimes relaxing takes a lot of time. The linker runs around the
-relocations to see if any are attached to data which can be shrunk, if
-so it does it on a link_order by link_order basis.
-
-
-File: bfd.info, Node: typedef asection, Next: section prototypes, Prev: Section Output, Up: Sections
-
-2.6.4 typedef asection
-----------------------
-
-Here is the section structure:
-
-
- typedef struct bfd_section
- {
- /* The name of the section; the name isn't a copy, the pointer is
- the same as that passed to bfd_make_section. */
- const char *name;
-
- /* A unique sequence number. */
- int id;
-
- /* Which section in the bfd; 0..n-1 as sections are created in a bfd. */
- int index;
-
- /* The next section in the list belonging to the BFD, or NULL. */
- struct bfd_section *next;
-
- /* The previous section in the list belonging to the BFD, or NULL. */
- struct bfd_section *prev;
-
- /* The field flags contains attributes of the section. Some
- flags are read in from the object file, and some are
- synthesized from other information. */
- flagword flags;
-
- #define SEC_NO_FLAGS 0x000
-
- /* Tells the OS to allocate space for this section when loading.
- This is clear for a section containing debug information only. */
- #define SEC_ALLOC 0x001
-
- /* Tells the OS to load the section from the file when loading.
- This is clear for a .bss section. */
- #define SEC_LOAD 0x002
-
- /* The section contains data still to be relocated, so there is
- some relocation information too. */
- #define SEC_RELOC 0x004
-
- /* A signal to the OS that the section contains read only data. */
- #define SEC_READONLY 0x008
-
- /* The section contains code only. */
- #define SEC_CODE 0x010
-
- /* The section contains data only. */
- #define SEC_DATA 0x020
-
- /* The section will reside in ROM. */
- #define SEC_ROM 0x040
-
- /* The section contains constructor information. This section
- type is used by the linker to create lists of constructors and
- destructors used by `g++'. When a back end sees a symbol
- which should be used in a constructor list, it creates a new
- section for the type of name (e.g., `__CTOR_LIST__'), attaches
- the symbol to it, and builds a relocation. To build the lists
- of constructors, all the linker has to do is catenate all the
- sections called `__CTOR_LIST__' and relocate the data
- contained within - exactly the operations it would peform on
- standard data. */
- #define SEC_CONSTRUCTOR 0x080
-
- /* The section has contents - a data section could be
- `SEC_ALLOC' | `SEC_HAS_CONTENTS'; a debug section could be
- `SEC_HAS_CONTENTS' */
- #define SEC_HAS_CONTENTS 0x100
-
- /* An instruction to the linker to not output the section
- even if it has information which would normally be written. */
- #define SEC_NEVER_LOAD 0x200
-
- /* The section contains thread local data. */
- #define SEC_THREAD_LOCAL 0x400
-
- /* The section has GOT references. This flag is only for the
- linker, and is currently only used by the elf32-hppa back end.
- It will be set if global offset table references were detected
- in this section, which indicate to the linker that the section
- contains PIC code, and must be handled specially when doing a
- static link. */
- #define SEC_HAS_GOT_REF 0x800
-
- /* The section contains common symbols (symbols may be defined
- multiple times, the value of a symbol is the amount of
- space it requires, and the largest symbol value is the one
- used). Most targets have exactly one of these (which we
- translate to bfd_com_section_ptr), but ECOFF has two. */
- #define SEC_IS_COMMON 0x1000
-
- /* The section contains only debugging information. For
- example, this is set for ELF .debug and .stab sections.
- strip tests this flag to see if a section can be
- discarded. */
- #define SEC_DEBUGGING 0x2000
-
- /* The contents of this section are held in memory pointed to
- by the contents field. This is checked by bfd_get_section_contents,
- and the data is retrieved from memory if appropriate. */
- #define SEC_IN_MEMORY 0x4000
-
- /* The contents of this section are to be excluded by the
- linker for executable and shared objects unless those
- objects are to be further relocated. */
- #define SEC_EXCLUDE 0x8000
-
- /* The contents of this section are to be sorted based on the sum of
- the symbol and addend values specified by the associated relocation
- entries. Entries without associated relocation entries will be
- appended to the end of the section in an unspecified order. */
- #define SEC_SORT_ENTRIES 0x10000
-
- /* When linking, duplicate sections of the same name should be
- discarded, rather than being combined into a single section as
- is usually done. This is similar to how common symbols are
- handled. See SEC_LINK_DUPLICATES below. */
- #define SEC_LINK_ONCE 0x20000
-
- /* If SEC_LINK_ONCE is set, this bitfield describes how the linker
- should handle duplicate sections. */
- #define SEC_LINK_DUPLICATES 0x40000
-
- /* This value for SEC_LINK_DUPLICATES means that duplicate
- sections with the same name should simply be discarded. */
- #define SEC_LINK_DUPLICATES_DISCARD 0x0
-
- /* This value for SEC_LINK_DUPLICATES means that the linker
- should warn if there are any duplicate sections, although
- it should still only link one copy. */
- #define SEC_LINK_DUPLICATES_ONE_ONLY 0x80000
-
- /* This value for SEC_LINK_DUPLICATES means that the linker
- should warn if any duplicate sections are a different size. */
- #define SEC_LINK_DUPLICATES_SAME_SIZE 0x100000
-
- /* This value for SEC_LINK_DUPLICATES means that the linker
- should warn if any duplicate sections contain different
- contents. */
- #define SEC_LINK_DUPLICATES_SAME_CONTENTS \
- (SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE)
-
- /* This section was created by the linker as part of dynamic
- relocation or other arcane processing. It is skipped when
- going through the first-pass output, trusting that someone
- else up the line will take care of it later. */
- #define SEC_LINKER_CREATED 0x200000
-
- /* This section should not be subject to garbage collection. */
- #define SEC_KEEP 0x400000
-
- /* This section contains "short" data, and should be placed
- "near" the GP. */
- #define SEC_SMALL_DATA 0x800000
-
- /* Attempt to merge identical entities in the section.
- Entity size is given in the entsize field. */
- #define SEC_MERGE 0x1000000
-
- /* If given with SEC_MERGE, entities to merge are zero terminated
- strings where entsize specifies character size instead of fixed
- size entries. */
- #define SEC_STRINGS 0x2000000
-
- /* This section contains data about section groups. */
- #define SEC_GROUP 0x4000000
-
- /* The section is a COFF shared library section. This flag is
- only for the linker. If this type of section appears in
- the input file, the linker must copy it to the output file
- without changing the vma or size. FIXME: Although this
- was originally intended to be general, it really is COFF
- specific (and the flag was renamed to indicate this). It
- might be cleaner to have some more general mechanism to
- allow the back end to control what the linker does with
- sections. */
- #define SEC_COFF_SHARED_LIBRARY 0x10000000
-
- /* This section contains data which may be shared with other
- executables or shared objects. This is for COFF only. */
- #define SEC_COFF_SHARED 0x20000000
-
- /* When a section with this flag is being linked, then if the size of
- the input section is less than a page, it should not cross a page
- boundary. If the size of the input section is one page or more,
- it should be aligned on a page boundary. This is for TI
- TMS320C54X only. */
- #define SEC_TIC54X_BLOCK 0x40000000
-
- /* Conditionally link this section; do not link if there are no
- references found to any symbol in the section. This is for TI
- TMS320C54X only. */
- #define SEC_TIC54X_CLINK 0x80000000
-
- /* End of section flags. */
-
- /* Some internal packed boolean fields. */
-
- /* See the vma field. */
- unsigned int user_set_vma : 1;
-
- /* A mark flag used by some of the linker backends. */
- unsigned int linker_mark : 1;
-
- /* Another mark flag used by some of the linker backends. Set for
- output sections that have an input section. */
- unsigned int linker_has_input : 1;
-
- /* Mark flags used by some linker backends for garbage collection. */
- unsigned int gc_mark : 1;
- unsigned int gc_mark_from_eh : 1;
-
- /* The following flags are used by the ELF linker. */
-
- /* 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. The generic code doesn't touch
- these fields. */
-
- /* Nonzero if this section has TLS related relocations. */
- unsigned int has_tls_reloc:1;
-
- /* Nonzero if this section has a gp reloc. */
- unsigned int has_gp_reloc:1;
-
- /* Nonzero if this section needs the relax finalize pass. */
- unsigned int need_finalize_relax:1;
-
- /* Whether relocations have been processed. */
- unsigned int reloc_done : 1;
-
- /* End of internal packed boolean fields. */
-
- /* The virtual memory address of the section - where it will be
- at run time. The symbols are relocated against this. The
- user_set_vma flag is maintained by bfd; if it's not set, the
- backend can assign addresses (for example, in `a.out', where
- the default address for `.data' is dependent on the specific
- target and various flags). */
- bfd_vma vma;
-
- /* The load address of the section - where it would be in a
- rom image; really only used for writing section header
- information. */
- bfd_vma lma;
-
- /* The size of the section in octets, as it will be output.
- Contains a value even if the section has no contents (e.g., the
- size of `.bss'). */
- bfd_size_type size;
-
- /* For input sections, the original size on disk of the section, in
- octets. This field is used by the linker relaxation code. It is
- currently only set for sections where the linker relaxation scheme
- doesn't cache altered section and reloc contents (stabs, eh_frame,
- SEC_MERGE, some coff relaxing targets), and thus the original size
- needs to be kept to read the section multiple times.
- For output sections, rawsize holds the section size calculated on
- a previous linker relaxation pass. */
- bfd_size_type rawsize;
-
- /* If this section is going to be output, then this value is the
- offset in *bytes* into the output section of the first byte in the
- input section (byte ==> smallest addressable unit on the
- target). In most cases, if this was going to start at the
- 100th octet (8-bit quantity) in the output section, this value
- would be 100. However, if the target byte size is 16 bits
- (bfd_octets_per_byte is "2"), this value would be 50. */
- bfd_vma output_offset;
-
- /* The output section through which to map on output. */
- struct bfd_section *output_section;
-
- /* The alignment requirement of the section, as an exponent of 2 -
- e.g., 3 aligns to 2^3 (or 8). */
- unsigned int alignment_power;
-
- /* If an input section, a pointer to a vector of relocation
- records for the data in this section. */
- struct reloc_cache_entry *relocation;
-
- /* If an output section, a pointer to a vector of pointers to
- relocation records for the data in this section. */
- struct reloc_cache_entry **orelocation;
-
- /* The number of relocation records in one of the above. */
- unsigned reloc_count;
-
- /* Information below is back end specific - and not always used
- or updated. */
-
- /* File position of section data. */
- file_ptr filepos;
-
- /* File position of relocation info. */
- file_ptr rel_filepos;
-
- /* File position of line data. */
- file_ptr line_filepos;
-
- /* Pointer to data for applications. */
- void *userdata;
-
- /* If the SEC_IN_MEMORY flag is set, this points to the actual
- contents. */
- unsigned char *contents;
-
- /* Attached line number information. */
- alent *lineno;
-
- /* Number of line number records. */
- unsigned int lineno_count;
-
- /* Entity size for merging purposes. */
- unsigned int entsize;
-
- /* Points to the kept section if this section is a link-once section,
- and is discarded. */
- struct bfd_section *kept_section;
-
- /* When a section is being output, this value changes as more
- linenumbers are written out. */
- file_ptr moving_line_filepos;
-
- /* What the section number is in the target world. */
- int target_index;
-
- void *used_by_bfd;
-
- /* If this is a constructor section then here is a list of the
- relocations created to relocate items within it. */
- struct relent_chain *constructor_chain;
-
- /* The BFD which owns the section. */
- bfd *owner;
-
- /* A symbol which points at this section only. */
- struct bfd_symbol *symbol;
- struct bfd_symbol **symbol_ptr_ptr;
-
- /* Early in the link process, map_head and map_tail are used to build
- a list of input sections attached to an output section. Later,
- output sections use these fields for a list of bfd_link_order
- structs. */
- union {
- struct bfd_link_order *link_order;
- struct bfd_section *s;
- } map_head, map_tail;
- } asection;
-
- /* These sections are global, and are managed by BFD. The application
- and target back end are not permitted to change the values in
- these sections. New code should use the section_ptr macros rather
- than referring directly to the const sections. The const sections
- may eventually vanish. */
- #define BFD_ABS_SECTION_NAME "*ABS*"
- #define BFD_UND_SECTION_NAME "*UND*"
- #define BFD_COM_SECTION_NAME "*COM*"
- #define BFD_IND_SECTION_NAME "*IND*"
-
- /* The absolute section. */
- extern asection bfd_abs_section;
- #define bfd_abs_section_ptr ((asection *) &bfd_abs_section)
- #define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
- /* Pointer to the undefined section. */
- extern asection bfd_und_section;
- #define bfd_und_section_ptr ((asection *) &bfd_und_section)
- #define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
- /* Pointer to the common section. */
- extern asection bfd_com_section;
- #define bfd_com_section_ptr ((asection *) &bfd_com_section)
- /* Pointer to the indirect section. */
- extern asection bfd_ind_section;
- #define bfd_ind_section_ptr ((asection *) &bfd_ind_section)
- #define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr)
-
- #define bfd_is_const_section(SEC) \
- ( ((SEC) == bfd_abs_section_ptr) \
- || ((SEC) == bfd_und_section_ptr) \
- || ((SEC) == bfd_com_section_ptr) \
- || ((SEC) == bfd_ind_section_ptr))
-
- extern const struct bfd_symbol * const bfd_abs_symbol;
- extern const struct bfd_symbol * const bfd_com_symbol;
- extern const struct bfd_symbol * const bfd_und_symbol;
- extern const struct bfd_symbol * const bfd_ind_symbol;
-
- /* Macros to handle insertion and deletion of a bfd's sections. These
- only handle the list pointers, ie. do not adjust section_count,
- target_index etc. */
- #define bfd_section_list_remove(ABFD, S) \
- do \
- { \
- asection *_s = S; \
- asection *_next = _s->next; \
- asection *_prev = _s->prev; \
- if (_prev) \
- _prev->next = _next; \
- else \
- (ABFD)->sections = _next; \
- if (_next) \
- _next->prev = _prev; \
- else \
- (ABFD)->section_last = _prev; \
- } \
- while (0)
- #define bfd_section_list_append(ABFD, S) \
- do \
- { \
- asection *_s = S; \
- bfd *_abfd = ABFD; \
- _s->next = NULL; \
- if (_abfd->section_last) \
- { \
- _s->prev = _abfd->section_last; \
- _abfd->section_last->next = _s; \
- } \
- else \
- { \
- _s->prev = NULL; \
- _abfd->sections = _s; \
- } \
- _abfd->section_last = _s; \
- } \
- while (0)
- #define bfd_section_list_prepend(ABFD, S) \
- do \
- { \
- asection *_s = S; \
- bfd *_abfd = ABFD; \
- _s->prev = NULL; \
- if (_abfd->sections) \
- { \
- _s->next = _abfd->sections; \
- _abfd->sections->prev = _s; \
- } \
- else \
- { \
- _s->next = NULL; \
- _abfd->section_last = _s; \
- } \
- _abfd->sections = _s; \
- } \
- while (0)
- #define bfd_section_list_insert_after(ABFD, A, S) \
- do \
- { \
- asection *_a = A; \
- asection *_s = S; \
- asection *_next = _a->next; \
- _s->next = _next; \
- _s->prev = _a; \
- _a->next = _s; \
- if (_next) \
- _next->prev = _s; \
- else \
- (ABFD)->section_last = _s; \
- } \
- while (0)
- #define bfd_section_list_insert_before(ABFD, B, S) \
- do \
- { \
- asection *_b = B; \
- asection *_s = S; \
- asection *_prev = _b->prev; \
- _s->prev = _prev; \
- _s->next = _b; \
- _b->prev = _s; \
- if (_prev) \
- _prev->next = _s; \
- else \
- (ABFD)->sections = _s; \
- } \
- while (0)
- #define bfd_section_removed_from_list(ABFD, S) \
- ((S)->next == NULL ? (ABFD)->section_last != (S) : (S)->next->prev != (S))
-
- #define BFD_FAKE_SECTION(SEC, FLAGS, SYM, SYM_PTR, NAME, IDX) \
- /* name, id, index, next, prev, flags, user_set_vma, */ \
- { NAME, IDX, 0, NULL, NULL, FLAGS, 0, \
- \
- /* linker_mark, linker_has_input, gc_mark, gc_mark_from_eh, */ \
- 0, 0, 1, 0, \
- \
- /* segment_mark, sec_info_type, use_rela_p, has_tls_reloc, */ \
- 0, 0, 0, 0, \
- \
- /* has_gp_reloc, need_finalize_relax, reloc_done, */ \
- 0, 0, 0, \
- \
- /* vma, lma, size, rawsize */ \
- 0, 0, 0, 0, \
- \
- /* output_offset, output_section, alignment_power, */ \
- 0, (struct bfd_section *) &SEC, 0, \
- \
- /* relocation, orelocation, reloc_count, filepos, rel_filepos, */ \
- NULL, NULL, 0, 0, 0, \
- \
- /* line_filepos, userdata, contents, lineno, lineno_count, */ \
- 0, NULL, NULL, NULL, 0, \
- \
- /* entsize, kept_section, moving_line_filepos, */ \
- 0, NULL, 0, \
- \
- /* target_index, used_by_bfd, constructor_chain, owner, */ \
- 0, NULL, NULL, NULL, \
- \
- /* symbol, */ \
- (struct bfd_symbol *) SYM, \
- \
- /* symbol_ptr_ptr, */ \
- (struct bfd_symbol **) SYM_PTR, \
- \
- /* map_head, map_tail */ \
- { NULL }, { NULL } \
- }
-
-
-File: bfd.info, Node: section prototypes, Prev: typedef asection, Up: Sections
-
-2.6.5 Section prototypes
-------------------------
-
-These are the functions exported by the section handling part of BFD.
-
-2.6.5.1 `bfd_section_list_clear'
-................................
-
-*Synopsis*
- void bfd_section_list_clear (bfd *);
- *Description*
-Clears the section list, and also resets the section count and hash
-table entries.
-
-2.6.5.2 `bfd_get_section_by_name'
-.................................
-
-*Synopsis*
- asection *bfd_get_section_by_name (bfd *abfd, const char *name);
- *Description*
-Run through ABFD and return the one of the `asection's whose name
-matches NAME, otherwise `NULL'. *Note Sections::, for more information.
-
- This should only be used in special cases; the normal way to process
-all sections of a given name is to use `bfd_map_over_sections' and
-`strcmp' on the name (or better yet, base it on the section flags or
-something else) for each section.
-
-2.6.5.3 `bfd_get_section_by_name_if'
-....................................
-
-*Synopsis*
- asection *bfd_get_section_by_name_if
- (bfd *abfd,
- const char *name,
- bfd_boolean (*func) (bfd *abfd, asection *sect, void *obj),
- void *obj);
- *Description*
-Call the provided function FUNC for each section attached to the BFD
-ABFD whose name matches NAME, passing OBJ as an argument. The function
-will be called as if by
-
- func (abfd, the_section, obj);
-
- It returns the first section for which FUNC returns true, otherwise
-`NULL'.
-
-2.6.5.4 `bfd_get_unique_section_name'
-.....................................
-
-*Synopsis*
- char *bfd_get_unique_section_name
- (bfd *abfd, const char *templat, int *count);
- *Description*
-Invent a section name that is unique in ABFD by tacking a dot and a
-digit suffix onto the original TEMPLAT. If COUNT is non-NULL, then it
-specifies the first number tried as a suffix to generate a unique name.
-The value pointed to by COUNT will be incremented in this case.
-
-2.6.5.5 `bfd_make_section_old_way'
-..................................
-
-*Synopsis*
- asection *bfd_make_section_old_way (bfd *abfd, const char *name);
- *Description*
-Create a new empty section called NAME and attach it to the end of the
-chain of sections for the BFD ABFD. An attempt to create a section with
-a name which is already in use returns its pointer without changing the
-section chain.
-
- It has the funny name since this is the way it used to be before it
-was rewritten....
-
- Possible errors are:
- * `bfd_error_invalid_operation' - If output has already started for
- this BFD.
-
- * `bfd_error_no_memory' - If memory allocation fails.
-
-2.6.5.6 `bfd_make_section_anyway_with_flags'
-............................................
-
-*Synopsis*
- asection *bfd_make_section_anyway_with_flags
- (bfd *abfd, const char *name, flagword flags);
- *Description*
-Create a new empty section called NAME and attach it to the end of the
-chain of sections for ABFD. Create a new section even if there is
-already a section with that name. Also set the attributes of the new
-section to the value FLAGS.
-
- Return `NULL' and set `bfd_error' on error; possible errors are:
- * `bfd_error_invalid_operation' - If output has already started for
- ABFD.
-
- * `bfd_error_no_memory' - If memory allocation fails.
-
-2.6.5.7 `bfd_make_section_anyway'
-.................................
-
-*Synopsis*
- asection *bfd_make_section_anyway (bfd *abfd, const char *name);
- *Description*
-Create a new empty section called NAME and attach it to the end of the
-chain of sections for ABFD. Create a new section even if there is
-already a section with that name.
-
- Return `NULL' and set `bfd_error' on error; possible errors are:
- * `bfd_error_invalid_operation' - If output has already started for
- ABFD.
-
- * `bfd_error_no_memory' - If memory allocation fails.
-
-2.6.5.8 `bfd_make_section_with_flags'
-.....................................
-
-*Synopsis*
- asection *bfd_make_section_with_flags
- (bfd *, const char *name, flagword flags);
- *Description*
-Like `bfd_make_section_anyway', but return `NULL' (without calling
-bfd_set_error ()) without changing the section chain if there is
-already a section named NAME. Also set the attributes of the new
-section to the value FLAGS. If there is an error, return `NULL' and set
-`bfd_error'.
-
-2.6.5.9 `bfd_make_section'
-..........................
-
-*Synopsis*
- asection *bfd_make_section (bfd *, const char *name);
- *Description*
-Like `bfd_make_section_anyway', but return `NULL' (without calling
-bfd_set_error ()) without changing the section chain if there is
-already a section named NAME. If there is an error, return `NULL' and
-set `bfd_error'.
-
-2.6.5.10 `bfd_set_section_flags'
-................................
-
-*Synopsis*
- bfd_boolean bfd_set_section_flags
- (bfd *abfd, asection *sec, flagword flags);
- *Description*
-Set the attributes of the section SEC in the BFD ABFD to the value
-FLAGS. Return `TRUE' on success, `FALSE' on error. Possible error
-returns are:
-
- * `bfd_error_invalid_operation' - The section cannot have one or
- more of the attributes requested. For example, a .bss section in
- `a.out' may not have the `SEC_HAS_CONTENTS' field set.
-
-2.6.5.11 `bfd_map_over_sections'
-................................
-
-*Synopsis*
- void bfd_map_over_sections
- (bfd *abfd,
- void (*func) (bfd *abfd, asection *sect, void *obj),
- void *obj);
- *Description*
-Call the provided function FUNC for each section attached to the BFD
-ABFD, passing OBJ as an argument. The function will be called as if by
-
- func (abfd, the_section, obj);
-
- This is the preferred method for iterating over sections; an
-alternative would be to use a loop:
-
- section *p;
- for (p = abfd->sections; p != NULL; p = p->next)
- func (abfd, p, ...)
-
-2.6.5.12 `bfd_sections_find_if'
-...............................
-
-*Synopsis*
- asection *bfd_sections_find_if
- (bfd *abfd,
- bfd_boolean (*operation) (bfd *abfd, asection *sect, void *obj),
- void *obj);
- *Description*
-Call the provided function OPERATION for each section attached to the
-BFD ABFD, passing OBJ as an argument. The function will be called as if
-by
-
- operation (abfd, the_section, obj);
-
- It returns the first section for which OPERATION returns true.
-
-2.6.5.13 `bfd_set_section_size'
-...............................
-
-*Synopsis*
- bfd_boolean bfd_set_section_size
- (bfd *abfd, asection *sec, bfd_size_type val);
- *Description*
-Set SEC to the size VAL. If the operation is ok, then `TRUE' is
-returned, else `FALSE'.
-
- Possible error returns:
- * `bfd_error_invalid_operation' - Writing has started to the BFD, so
- setting the size is invalid.
-
-2.6.5.14 `bfd_set_section_contents'
-...................................
-
-*Synopsis*
- bfd_boolean bfd_set_section_contents
- (bfd *abfd, asection *section, const void *data,
- file_ptr offset, bfd_size_type count);
- *Description*
-Sets the contents of the section SECTION in BFD ABFD to the data
-starting in memory at DATA. The data is written to the output section
-starting at offset OFFSET for COUNT octets.
-
- Normally `TRUE' is returned, else `FALSE'. Possible error returns
-are:
- * `bfd_error_no_contents' - The output section does not have the
- `SEC_HAS_CONTENTS' attribute, so nothing can be written to it.
-
- * and some more too
- This routine is front end to the back end function
-`_bfd_set_section_contents'.
-
-2.6.5.15 `bfd_get_section_contents'
-...................................
-
-*Synopsis*
- bfd_boolean bfd_get_section_contents
- (bfd *abfd, asection *section, void *location, file_ptr offset,
- bfd_size_type count);
- *Description*
-Read data from SECTION in BFD ABFD into memory starting at LOCATION.
-The data is read at an offset of OFFSET from the start of the input
-section, and is read for COUNT bytes.
-
- If the contents of a constructor with the `SEC_CONSTRUCTOR' flag set
-are requested or if the section does not have the `SEC_HAS_CONTENTS'
-flag set, then the LOCATION is filled with zeroes. If no errors occur,
-`TRUE' is returned, else `FALSE'.
-
-2.6.5.16 `bfd_malloc_and_get_section'
-.....................................
-
-*Synopsis*
- bfd_boolean bfd_malloc_and_get_section
- (bfd *abfd, asection *section, bfd_byte **buf);
- *Description*
-Read all data from SECTION in BFD ABFD into a buffer, *BUF, malloc'd by
-this function.
-
-2.6.5.17 `bfd_copy_private_section_data'
-........................................
-
-*Synopsis*
- bfd_boolean bfd_copy_private_section_data
- (bfd *ibfd, asection *isec, bfd *obfd, asection *osec);
- *Description*
-Copy private section information from ISEC in the BFD IBFD to the
-section OSEC in the BFD OBFD. Return `TRUE' on success, `FALSE' on
-error. Possible error returns are:
-
- * `bfd_error_no_memory' - Not enough memory exists to create private
- data for OSEC.
-
- #define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \
- BFD_SEND (obfd, _bfd_copy_private_section_data, \
- (ibfd, isection, obfd, osection))
-
-2.6.5.18 `bfd_generic_is_group_section'
-.......................................
-
-*Synopsis*
- bfd_boolean bfd_generic_is_group_section (bfd *, const asection *sec);
- *Description*
-Returns TRUE if SEC is a member of a group.
-
-2.6.5.19 `bfd_generic_discard_group'
-....................................
-
-*Synopsis*
- bfd_boolean bfd_generic_discard_group (bfd *abfd, asection *group);
- *Description*
-Remove all members of GROUP from the output.
-
-
-File: bfd.info, Node: Symbols, Next: Archives, Prev: Sections, Up: BFD front end
-
-2.7 Symbols
-===========
-
-BFD tries to maintain as much symbol information as it can when it
-moves information from file to file. BFD passes information to
-applications though the `asymbol' structure. When the application
-requests the symbol table, BFD reads the table in the native form and
-translates parts of it into the internal format. To maintain more than
-the information passed to applications, some targets keep some
-information "behind the scenes" in a structure only the particular back
-end knows about. For example, the coff back end keeps the original
-symbol table structure as well as the canonical structure when a BFD is
-read in. On output, the coff back end can reconstruct the output symbol
-table so that no information is lost, even information unique to coff
-which BFD doesn't know or understand. If a coff symbol table were read,
-but were written through an a.out back end, all the coff specific
-information would be lost. The symbol table of a BFD is not necessarily
-read in until a canonicalize request is made. Then the BFD back end
-fills in a table provided by the application with pointers to the
-canonical information. To output symbols, the application provides BFD
-with a table of pointers to pointers to `asymbol's. This allows
-applications like the linker to output a symbol as it was read, since
-the "behind the scenes" information will be still available.
-
-* Menu:
-
-* Reading Symbols::
-* Writing Symbols::
-* Mini Symbols::
-* typedef asymbol::
-* symbol handling functions::
-
-
-File: bfd.info, Node: Reading Symbols, Next: Writing Symbols, Prev: Symbols, Up: Symbols
-
-2.7.1 Reading symbols
----------------------
-
-There are two stages to reading a symbol table from a BFD: allocating
-storage, and the actual reading process. This is an excerpt from an
-application which reads the symbol table:
-
- long storage_needed;
- asymbol **symbol_table;
- long number_of_symbols;
- long i;
-
- storage_needed = bfd_get_symtab_upper_bound (abfd);
-
- if (storage_needed < 0)
- FAIL
-
- if (storage_needed == 0)
- return;
-
- symbol_table = xmalloc (storage_needed);
- ...
- number_of_symbols =
- bfd_canonicalize_symtab (abfd, symbol_table);
-
- if (number_of_symbols < 0)
- FAIL
-
- for (i = 0; i < number_of_symbols; i++)
- process_symbol (symbol_table[i]);
-
- All storage for the symbols themselves is in an objalloc connected
-to the BFD; it is freed when the BFD is closed.
-
-
-File: bfd.info, Node: Writing Symbols, Next: Mini Symbols, Prev: Reading Symbols, Up: Symbols
-
-2.7.2 Writing symbols
----------------------
-
-Writing of a symbol table is automatic when a BFD open for writing is
-closed. The application attaches a vector of pointers to pointers to
-symbols to the BFD being written, and fills in the symbol count. The
-close and cleanup code reads through the table provided and performs
-all the necessary operations. The BFD output code must always be
-provided with an "owned" symbol: one which has come from another BFD,
-or one which has been created using `bfd_make_empty_symbol'. Here is an
-example showing the creation of a symbol table with only one element:
-
- #include "bfd.h"
- int main (void)
- {
- bfd *abfd;
- asymbol *ptrs[2];
- asymbol *new;
-
- abfd = bfd_openw ("foo","a.out-sunos-big");
- bfd_set_format (abfd, bfd_object);
- new = bfd_make_empty_symbol (abfd);
- new->name = "dummy_symbol";
- new->section = bfd_make_section_old_way (abfd, ".text");
- new->flags = BSF_GLOBAL;
- new->value = 0x12345;
-
- ptrs[0] = new;
- ptrs[1] = 0;
-
- bfd_set_symtab (abfd, ptrs, 1);
- bfd_close (abfd);
- return 0;
- }
-
- ./makesym
- nm foo
- 00012345 A dummy_symbol
-
- Many formats cannot represent arbitrary symbol information; for
-instance, the `a.out' object format does not allow an arbitrary number
-of sections. A symbol pointing to a section which is not one of
-`.text', `.data' or `.bss' cannot be described.
-
-
-File: bfd.info, Node: Mini Symbols, Next: typedef asymbol, Prev: Writing Symbols, Up: Symbols
-
-2.7.3 Mini Symbols
-------------------
-
-Mini symbols provide read-only access to the symbol table. They use
-less memory space, but require more time to access. They can be useful
-for tools like nm or objdump, which may have to handle symbol tables of
-extremely large executables.
-
- The `bfd_read_minisymbols' function will read the symbols into
-memory in an internal form. It will return a `void *' pointer to a
-block of memory, a symbol count, and the size of each symbol. The
-pointer is allocated using `malloc', and should be freed by the caller
-when it is no longer needed.
-
- The function `bfd_minisymbol_to_symbol' will take a pointer to a
-minisymbol, and a pointer to a structure returned by
-`bfd_make_empty_symbol', and return a `asymbol' structure. The return
-value may or may not be the same as the value from
-`bfd_make_empty_symbol' which was passed in.
-
-
-File: bfd.info, Node: typedef asymbol, Next: symbol handling functions, Prev: Mini Symbols, Up: Symbols
-
-2.7.4 typedef asymbol
----------------------
-
-An `asymbol' has the form:
-
-
- typedef struct bfd_symbol
- {
- /* A pointer to the BFD which owns the symbol. This information
- is necessary so that a back end can work out what additional
- information (invisible to the application writer) is carried
- with the symbol.
-
- This field is *almost* redundant, since you can use section->owner
- instead, except that some symbols point to the global sections
- bfd_{abs,com,und}_section. This could be fixed by making
- these globals be per-bfd (or per-target-flavor). FIXME. */
- struct bfd *the_bfd; /* Use bfd_asymbol_bfd(sym) to access this field. */
-
- /* The text of the symbol. The name is left alone, and not copied; the
- application may not alter it. */
- const char *name;
-
- /* The value of the symbol. This really should be a union of a
- numeric value with a pointer, since some flags indicate that
- a pointer to another symbol is stored here. */
- symvalue value;
-
- /* Attributes of a symbol. */
- #define BSF_NO_FLAGS 0x00
-
- /* The symbol has local scope; `static' in `C'. The value
- is the offset into the section of the data. */
- #define BSF_LOCAL 0x01
-
- /* The symbol has global scope; initialized data in `C'. The
- value is the offset into the section of the data. */
- #define BSF_GLOBAL 0x02
-
- /* The symbol has global scope and is exported. The value is
- the offset into the section of the data. */
- #define BSF_EXPORT BSF_GLOBAL /* No real difference. */
-
- /* A normal C symbol would be one of:
- `BSF_LOCAL', `BSF_FORT_COMM', `BSF_UNDEFINED' or
- `BSF_GLOBAL'. */
-
- /* The symbol is a debugging record. The value has an arbitrary
- meaning, unless BSF_DEBUGGING_RELOC is also set. */
- #define BSF_DEBUGGING 0x08
-
- /* The symbol denotes a function entry point. Used in ELF,
- perhaps others someday. */
- #define BSF_FUNCTION 0x10
-
- /* Used by the linker. */
- #define BSF_KEEP 0x20
- #define BSF_KEEP_G 0x40
-
- /* A weak global symbol, overridable without warnings by
- a regular global symbol of the same name. */
- #define BSF_WEAK 0x80
-
- /* This symbol was created to point to a section, e.g. ELF's
- STT_SECTION symbols. */
- #define BSF_SECTION_SYM 0x100
-
- /* The symbol used to be a common symbol, but now it is
- allocated. */
- #define BSF_OLD_COMMON 0x200
-
- /* The default value for common data. */
- #define BFD_FORT_COMM_DEFAULT_VALUE 0
-
- /* In some files the type of a symbol sometimes alters its
- location in an output file - ie in coff a `ISFCN' symbol
- which is also `C_EXT' symbol appears where it was
- declared and not at the end of a section. This bit is set
- by the target BFD part to convey this information. */
- #define BSF_NOT_AT_END 0x400
-
- /* Signal that the symbol is the label of constructor section. */
- #define BSF_CONSTRUCTOR 0x800
-
- /* Signal that the symbol is a warning symbol. The name is a
- warning. The name of the next symbol is the one to warn about;
- if a reference is made to a symbol with the same name as the next
- symbol, a warning is issued by the linker. */
- #define BSF_WARNING 0x1000
-
- /* Signal that the symbol is indirect. This symbol is an indirect
- pointer to the symbol with the same name as the next symbol. */
- #define BSF_INDIRECT 0x2000
-
- /* BSF_FILE marks symbols that contain a file name. This is used
- for ELF STT_FILE symbols. */
- #define BSF_FILE 0x4000
-
- /* Symbol is from dynamic linking information. */
- #define BSF_DYNAMIC 0x8000
-
- /* The symbol denotes a data object. Used in ELF, and perhaps
- others someday. */
- #define BSF_OBJECT 0x10000
-
- /* This symbol is a debugging symbol. The value is the offset
- into the section of the data. BSF_DEBUGGING should be set
- as well. */
- #define BSF_DEBUGGING_RELOC 0x20000
-
- /* This symbol is thread local. Used in ELF. */
- #define BSF_THREAD_LOCAL 0x40000
-
- flagword flags;
-
- /* A pointer to the section to which this symbol is
- relative. This will always be non NULL, there are special
- sections for undefined and absolute symbols. */
- struct bfd_section *section;
-
- /* Back end special data. */
- union
- {
- void *p;
- bfd_vma i;
- }
- udata;
- }
- asymbol;
-
-
-File: bfd.info, Node: symbol handling functions, Prev: typedef asymbol, Up: Symbols
-
-2.7.5 Symbol handling functions
--------------------------------
-
-2.7.5.1 `bfd_get_symtab_upper_bound'
-....................................
-
-*Description*
-Return the number of bytes required to store a vector of pointers to
-`asymbols' for all the symbols in the BFD ABFD, including a terminal
-NULL pointer. If there are no symbols in the BFD, then return 0. If an
-error occurs, return -1.
- #define bfd_get_symtab_upper_bound(abfd) \
- BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd))
-
-2.7.5.2 `bfd_is_local_label'
-............................
-
-*Synopsis*
- bfd_boolean bfd_is_local_label (bfd *abfd, asymbol *sym);
- *Description*
-Return TRUE if the given symbol SYM in the BFD ABFD is a compiler
-generated local label, else return FALSE.
-
-2.7.5.3 `bfd_is_local_label_name'
-.................................
-
-*Synopsis*
- bfd_boolean bfd_is_local_label_name (bfd *abfd, const char *name);
- *Description*
-Return TRUE if a symbol with the name NAME in the BFD ABFD is a
-compiler generated local label, else return FALSE. This just checks
-whether the name has the form of a local label.
- #define bfd_is_local_label_name(abfd, name) \
- BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name))
-
-2.7.5.4 `bfd_is_target_special_symbol'
-......................................
-
-*Synopsis*
- bfd_boolean bfd_is_target_special_symbol (bfd *abfd, asymbol *sym);
- *Description*
-Return TRUE iff a symbol SYM in the BFD ABFD is something special to
-the particular target represented by the BFD. Such symbols should
-normally not be mentioned to the user.
- #define bfd_is_target_special_symbol(abfd, sym) \
- BFD_SEND (abfd, _bfd_is_target_special_symbol, (abfd, sym))
-
-2.7.5.5 `bfd_canonicalize_symtab'
-.................................
-
-*Description*
-Read the symbols from the BFD ABFD, and fills in the vector LOCATION
-with pointers to the symbols and a trailing NULL. Return the actual
-number of symbol pointers, not including the NULL.
- #define bfd_canonicalize_symtab(abfd, location) \
- BFD_SEND (abfd, _bfd_canonicalize_symtab, (abfd, location))
-
-2.7.5.6 `bfd_set_symtab'
-........................
-
-*Synopsis*
- bfd_boolean bfd_set_symtab
- (bfd *abfd, asymbol **location, unsigned int count);
- *Description*
-Arrange that when the output BFD ABFD is closed, the table LOCATION of
-COUNT pointers to symbols will be written.
-
-2.7.5.7 `bfd_print_symbol_vandf'
-................................
-
-*Synopsis*
- void bfd_print_symbol_vandf (bfd *abfd, void *file, asymbol *symbol);
- *Description*
-Print the value and flags of the SYMBOL supplied to the stream FILE.
-
-2.7.5.8 `bfd_make_empty_symbol'
-...............................
-
-*Description*
-Create a new `asymbol' structure for the BFD ABFD and return a pointer
-to it.
-
- This routine is necessary because each back end has private
-information surrounding the `asymbol'. Building your own `asymbol' and
-pointing to it will not create the private information, and will cause
-problems later on.
- #define bfd_make_empty_symbol(abfd) \
- BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
-
-2.7.5.9 `_bfd_generic_make_empty_symbol'
-........................................
-
-*Synopsis*
- asymbol *_bfd_generic_make_empty_symbol (bfd *);
- *Description*
-Create a new `asymbol' structure for the BFD ABFD and return a pointer
-to it. Used by core file routines, binary back-end and anywhere else
-where no private info is needed.
-
-2.7.5.10 `bfd_make_debug_symbol'
-................................
-
-*Description*
-Create a new `asymbol' structure for the BFD ABFD, to be used as a
-debugging symbol. Further details of its use have yet to be worked out.
- #define bfd_make_debug_symbol(abfd,ptr,size) \
- BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size))
-
-2.7.5.11 `bfd_decode_symclass'
-..............................
-
-*Description*
-Return a character corresponding to the symbol class of SYMBOL, or '?'
-for an unknown class.
-
- *Synopsis*
- int bfd_decode_symclass (asymbol *symbol);
-
-2.7.5.12 `bfd_is_undefined_symclass'
-....................................
-
-*Description*
-Returns non-zero if the class symbol returned by bfd_decode_symclass
-represents an undefined symbol. Returns zero otherwise.
-
- *Synopsis*
- bfd_boolean bfd_is_undefined_symclass (int symclass);
-
-2.7.5.13 `bfd_symbol_info'
-..........................
-
-*Description*
-Fill in the basic info about symbol that nm needs. Additional info may
-be added by the back-ends after calling this function.
-
- *Synopsis*
- void bfd_symbol_info (asymbol *symbol, symbol_info *ret);
-
-2.7.5.14 `bfd_copy_private_symbol_data'
-.......................................
-
-*Synopsis*
- bfd_boolean bfd_copy_private_symbol_data
- (bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym);
- *Description*
-Copy private symbol information from ISYM in the BFD IBFD to the symbol
-OSYM in the BFD OBFD. Return `TRUE' on success, `FALSE' on error.
-Possible error returns are:
-
- * `bfd_error_no_memory' - Not enough memory exists to create private
- data for OSEC.
-
- #define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \
- BFD_SEND (obfd, _bfd_copy_private_symbol_data, \
- (ibfd, isymbol, obfd, osymbol))
-
-
-File: bfd.info, Node: Archives, Next: Formats, Prev: Symbols, Up: BFD front end
-
-2.8 Archives
-============
-
-*Description*
-An archive (or library) is just another BFD. It has a symbol table,
-although there's not much a user program will do with it.
-
- The big difference between an archive BFD and an ordinary BFD is
-that the archive doesn't have sections. Instead it has a chain of BFDs
-that are considered its contents. These BFDs can be manipulated like
-any other. The BFDs contained in an archive opened for reading will
-all be opened for reading. You may put either input or output BFDs
-into an archive opened for output; they will be handled correctly when
-the archive is closed.
-
- Use `bfd_openr_next_archived_file' to step through the contents of
-an archive opened for input. You don't have to read the entire archive
-if you don't want to! Read it until you find what you want.
-
- Archive contents of output BFDs are chained through the `next'
-pointer in a BFD. The first one is findable through the `archive_head'
-slot of the archive. Set it with `bfd_set_archive_head' (q.v.). A
-given BFD may be in only one open output archive at a time.
-
- As expected, the BFD archive code is more general than the archive
-code of any given environment. BFD archives may contain files of
-different formats (e.g., a.out and coff) and even different
-architectures. You may even place archives recursively into archives!
-
- This can cause unexpected confusion, since some archive formats are
-more expressive than others. For instance, Intel COFF archives can
-preserve long filenames; SunOS a.out archives cannot. If you move a
-file from the first to the second format and back again, the filename
-may be truncated. Likewise, different a.out environments have different
-conventions as to how they truncate filenames, whether they preserve
-directory names in filenames, etc. When interoperating with native
-tools, be sure your files are homogeneous.
-
- Beware: most of these formats do not react well to the presence of
-spaces in filenames. We do the best we can, but can't always handle
-this case due to restrictions in the format of archives. Many Unix
-utilities are braindead in regards to spaces and such in filenames
-anyway, so this shouldn't be much of a restriction.
-
- Archives are supported in BFD in `archive.c'.
-
-2.8.1 Archive functions
------------------------
-
-2.8.1.1 `bfd_get_next_mapent'
-.............................
-
-*Synopsis*
- symindex bfd_get_next_mapent
- (bfd *abfd, symindex previous, carsym **sym);
- *Description*
-Step through archive ABFD's symbol table (if it has one). Successively
-update SYM with the next symbol's information, returning that symbol's
-(internal) index into the symbol table.
-
- Supply `BFD_NO_MORE_SYMBOLS' as the PREVIOUS entry to get the first
-one; returns `BFD_NO_MORE_SYMBOLS' when you've already got the last one.
-
- A `carsym' is a canonical archive symbol. The only user-visible
-element is its name, a null-terminated string.
-
-2.8.1.2 `bfd_set_archive_head'
-..............................
-
-*Synopsis*
- bfd_boolean bfd_set_archive_head (bfd *output, bfd *new_head);
- *Description*
-Set the head of the chain of BFDs contained in the archive OUTPUT to
-NEW_HEAD.
-
-2.8.1.3 `bfd_openr_next_archived_file'
-......................................
-
-*Synopsis*
- bfd *bfd_openr_next_archived_file (bfd *archive, bfd *previous);
- *Description*
-Provided a BFD, ARCHIVE, containing an archive and NULL, open an input
-BFD on the first contained element and returns that. Subsequent calls
-should pass the archive and the previous return value to return a
-created BFD to the next contained element. NULL is returned when there
-are no more.
-
-
-File: bfd.info, Node: Formats, Next: Relocations, Prev: Archives, Up: BFD front end
-
-2.9 File formats
-================
-
-A format is a BFD concept of high level file contents type. The formats
-supported by BFD are:
-
- * `bfd_object'
- The BFD may contain data, symbols, relocations and debug info.
-
- * `bfd_archive'
- The BFD contains other BFDs and an optional index.
-
- * `bfd_core'
- The BFD contains the result of an executable core dump.
-
-2.9.1 File format functions
----------------------------
-
-2.9.1.1 `bfd_check_format'
-..........................
-
-*Synopsis*
- bfd_boolean bfd_check_format (bfd *abfd, bfd_format format);
- *Description*
-Verify if the file attached to the BFD ABFD is compatible with the
-format FORMAT (i.e., one of `bfd_object', `bfd_archive' or `bfd_core').
-
- If the BFD has been set to a specific target before the call, only
-the named target and format combination is checked. If the target has
-not been set, or has been set to `default', then all the known target
-backends is interrogated to determine a match. If the default target
-matches, it is used. If not, exactly one target must recognize the
-file, or an error results.
-
- The function returns `TRUE' on success, otherwise `FALSE' with one
-of the following error codes:
-
- * `bfd_error_invalid_operation' - if `format' is not one of
- `bfd_object', `bfd_archive' or `bfd_core'.
-
- * `bfd_error_system_call' - if an error occured during a read - even
- some file mismatches can cause bfd_error_system_calls.
-
- * `file_not_recognised' - none of the backends recognised the file
- format.
-
- * `bfd_error_file_ambiguously_recognized' - more than one backend
- recognised the file format.
-
-2.9.1.2 `bfd_check_format_matches'
-..................................
-
-*Synopsis*
- bfd_boolean bfd_check_format_matches
- (bfd *abfd, bfd_format format, char ***matching);
- *Description*
-Like `bfd_check_format', except when it returns FALSE with `bfd_errno'
-set to `bfd_error_file_ambiguously_recognized'. In that case, if
-MATCHING is not NULL, it will be filled in with a NULL-terminated list
-of the names of the formats that matched, allocated with `malloc'.
-Then the user may choose a format and try again.
-
- When done with the list that MATCHING points to, the caller should
-free it.
-
-2.9.1.3 `bfd_set_format'
-........................
-
-*Synopsis*
- bfd_boolean bfd_set_format (bfd *abfd, bfd_format format);
- *Description*
-This function sets the file format of the BFD ABFD to the format
-FORMAT. If the target set in the BFD does not support the format
-requested, the format is invalid, or the BFD is not open for writing,
-then an error occurs.
-
-2.9.1.4 `bfd_format_string'
-...........................
-
-*Synopsis*
- const char *bfd_format_string (bfd_format format);
- *Description*
-Return a pointer to a const string `invalid', `object', `archive',
-`core', or `unknown', depending upon the value of FORMAT.
-
-
-File: bfd.info, Node: Relocations, Next: Core Files, Prev: Formats, Up: BFD front end
-
-2.10 Relocations
-================
-
-BFD maintains relocations in much the same way it maintains symbols:
-they are left alone until required, then read in en-masse and
-translated into an internal form. A common routine
-`bfd_perform_relocation' acts upon the canonical form to do the fixup.
-
- Relocations are maintained on a per section basis, while symbols are
-maintained on a per BFD basis.
-
- All that a back end has to do to fit the BFD interface is to create
-a `struct reloc_cache_entry' for each relocation in a particular
-section, and fill in the right bits of the structures.
-
-* Menu:
-
-* typedef arelent::
-* howto manager::
-
-
-File: bfd.info, Node: typedef arelent, Next: howto manager, Prev: Relocations, Up: Relocations
-
-2.10.1 typedef arelent
-----------------------
-
-This is the structure of a relocation entry:
-
-
- typedef enum bfd_reloc_status
- {
- /* No errors detected. */
- bfd_reloc_ok,
-
- /* The relocation was performed, but there was an overflow. */
- bfd_reloc_overflow,
-
- /* The address to relocate was not within the section supplied. */
- bfd_reloc_outofrange,
-
- /* Used by special functions. */
- bfd_reloc_continue,
-
- /* Unsupported relocation size requested. */
- bfd_reloc_notsupported,
-
- /* Unused. */
- bfd_reloc_other,
-
- /* The symbol to relocate against was undefined. */
- bfd_reloc_undefined,
-
- /* The relocation was performed, but may not be ok - presently
- generated only when linking i960 coff files with i960 b.out
- symbols. If this type is returned, the error_message argument
- to bfd_perform_relocation will be set. */
- bfd_reloc_dangerous
- }
- bfd_reloc_status_type;
-
-
- typedef struct reloc_cache_entry
- {
- /* A pointer into the canonical table of pointers. */
- struct bfd_symbol **sym_ptr_ptr;
-
- /* offset in section. */
- bfd_size_type address;
-
- /* addend for relocation value. */
- bfd_vma addend;
-
- /* Pointer to how to perform the required relocation. */
- reloc_howto_type *howto;
-
- }
- arelent;
- *Description*
-Here is a description of each of the fields within an `arelent':
-
- * `sym_ptr_ptr'
- The symbol table pointer points to a pointer to the symbol
-associated with the relocation request. It is the pointer into the
-table returned by the back end's `canonicalize_symtab' action. *Note
-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.
-
- * `address'
- The `address' field gives the offset in bytes from the base of the
-section data which owns the relocation record to the first byte of
-relocatable information. The actual data relocated will be relative to
-this point; for example, a relocation type which modifies the bottom
-two bytes of a four byte word would not touch the first byte pointed to
-in a big endian world.
-
- * `addend'
- The `addend' is a value provided by the back end to be added (!) to
-the relocation offset. Its interpretation is dependent upon the howto.
-For example, on the 68k the code:
-
- char foo[];
- main()
- {
- return foo[0x12345678];
- }
-
- Could be compiled into:
-
- linkw fp,#-4
- moveb @#12345678,d0
- extbl d0
- unlk fp
- rts
-
- This could create a reloc pointing to `foo', but leave the offset in
-the data, something like:
-
- RELOCATION RECORDS FOR [.text]:
- offset type value
- 00000006 32 _foo
-
- 00000000 4e56 fffc ; linkw fp,#-4
- 00000004 1039 1234 5678 ; moveb @#12345678,d0
- 0000000a 49c0 ; extbl d0
- 0000000c 4e5e ; unlk fp
- 0000000e 4e75 ; rts
-
- Using coff and an 88k, some instructions don't have enough space in
-them to represent the full address range, and pointers have to be
-loaded in two parts. So you'd get something like:
-
- or.u r13,r0,hi16(_foo+0x12345678)
- ld.b r2,r13,lo16(_foo+0x12345678)
- jmp r1
-
- This should create two relocs, both pointing to `_foo', and with
-0x12340000 in their addend field. The data would consist of:
-
- RELOCATION RECORDS FOR [.text]:
- offset type value
- 00000002 HVRT16 _foo+0x12340000
- 00000006 LVRT16 _foo+0x12340000
-
- 00000000 5da05678 ; or.u r13,r0,0x5678
- 00000004 1c4d5678 ; ld.b r2,r13,0x5678
- 00000008 f400c001 ; jmp r1
-
- The relocation routine digs out the value from the data, adds it to
-the addend to get the original offset, and then adds the value of
-`_foo'. Note that all 32 bits have to be kept around somewhere, to cope
-with carry from bit 15 to bit 16.
-
- One further example is the sparc and the a.out format. The sparc has
-a similar problem to the 88k, in that some instructions don't have room
-for an entire offset, but on the sparc the parts are created in odd
-sized lumps. The designers of the a.out format chose to not use the
-data within the section for storing part of the offset; all the offset
-is kept within the reloc. Anything in the data should be ignored.
-
- save %sp,-112,%sp
- sethi %hi(_foo+0x12345678),%g2
- ldsb [%g2+%lo(_foo+0x12345678)],%i0
- ret
- restore
-
- Both relocs contain a pointer to `foo', and the offsets contain junk.
-
- RELOCATION RECORDS FOR [.text]:
- offset type value
- 00000004 HI22 _foo+0x12345678
- 00000008 LO10 _foo+0x12345678
-
- 00000000 9de3bf90 ; save %sp,-112,%sp
- 00000004 05000000 ; sethi %hi(_foo+0),%g2
- 00000008 f048a000 ; ldsb [%g2+%lo(_foo+0)],%i0
- 0000000c 81c7e008 ; ret
- 00000010 81e80000 ; restore
-
- * `howto'
- The `howto' field can be imagined as a relocation instruction. It is
-a pointer to a structure which contains information on what to do with
-all of the other information in the reloc record and data section. A
-back end would normally have a relocation instruction set and turn
-relocations into pointers to the correct structure on input - but it
-would be possible to create each howto field on demand.
-
-2.10.1.1 `enum complain_overflow'
-.................................
-
-Indicates what sort of overflow checking should be done when performing
-a relocation.
-
-
- enum complain_overflow
- {
- /* Do not complain on overflow. */
- complain_overflow_dont,
-
- /* Complain if the value overflows when considered as a signed
- number one bit larger than the field. ie. A bitfield of N bits
- is allowed to represent -2**n to 2**n-1. */
- complain_overflow_bitfield,
-
- /* Complain if the value overflows when considered as a signed
- number. */
- complain_overflow_signed,
-
- /* Complain if the value overflows when considered as an
- unsigned number. */
- complain_overflow_unsigned
- };
-
-2.10.1.2 `reloc_howto_type'
-...........................
-
-The `reloc_howto_type' is a structure which contains all the
-information that libbfd needs to know to tie up a back end's data.
-
- struct bfd_symbol; /* Forward declaration. */
-
- struct reloc_howto_struct
- {
- /* The type field has mainly a documentary use - the back end can
- do what it wants with it, though normally the back end's
- external idea of what a reloc number is stored
- in this field. For example, a PC relative word relocation
- in a coff environment has the type 023 - because that's
- what the outside world calls a R_PCRWORD reloc. */
- unsigned int type;
-
- /* The value the final relocation is shifted right by. This drops
- unwanted data from the relocation. */
- unsigned int rightshift;
-
- /* The size of the item to be relocated. This is *not* a
- power-of-two measure. To get the number of bytes operated
- on by a type of relocation, use bfd_get_reloc_size. */
- int size;
-
- /* The number of bits in the item to be relocated. This is used
- when doing overflow checking. */
- unsigned int bitsize;
-
- /* Notes that the relocation is relative to the location in the
- data section of the addend. The relocation function will
- subtract from the relocation value the address of the location
- being relocated. */
- bfd_boolean pc_relative;
-
- /* The bit position of the reloc value in the destination.
- The relocated value is left shifted by this amount. */
- unsigned int bitpos;
-
- /* What type of overflow error should be checked for when
- relocating. */
- enum complain_overflow complain_on_overflow;
-
- /* If this field is non null, then the supplied function is
- called rather than the normal function. This allows really
- strange relocation methods to be accommodated (e.g., i960 callj
- instructions). */
- bfd_reloc_status_type (*special_function)
- (bfd *, arelent *, struct bfd_symbol *, void *, asection *,
- bfd *, char **);
-
- /* The textual name of the relocation type. */
- char *name;
-
- /* Some formats record a relocation addend in the section contents
- rather than with the relocation. For ELF formats this is the
- distinction between USE_REL and USE_RELA (though the code checks
- for USE_REL == 1/0). The value of this field is TRUE if the
- addend is recorded with the section contents; when performing a
- partial link (ld -r) the section contents (the data) will be
- modified. The value of this field is FALSE if addends are
- recorded with the relocation (in arelent.addend); when performing
- a partial link the relocation will be modified.
- All relocations for all ELF USE_RELA targets should set this field
- to FALSE (values of TRUE should be looked on with suspicion).
- However, the converse is not true: not all relocations of all ELF
- USE_REL targets set this field to TRUE. Why this is so is peculiar
- to each particular target. For relocs that aren't used in partial
- links (e.g. GOT stuff) it doesn't matter what this is set to. */
- bfd_boolean partial_inplace;
-
- /* src_mask selects the part of the instruction (or data) to be used
- in the relocation sum. If the target relocations don't have an
- addend in the reloc, eg. ELF USE_REL, src_mask will normally equal
- dst_mask to extract the addend from the section contents. If
- relocations do have an addend in the reloc, eg. ELF USE_RELA, this
- field should be zero. Non-zero values for ELF USE_RELA targets are
- bogus as in those cases the value in the dst_mask part of the
- section contents should be treated as garbage. */
- bfd_vma src_mask;
-
- /* dst_mask selects which parts of the instruction (or data) are
- replaced with a relocated value. */
- bfd_vma dst_mask;
-
- /* When some formats create PC relative instructions, they leave
- the value of the pc of the place being relocated in the offset
- slot of the instruction, so that a PC relative relocation can
- be made just by adding in an ordinary offset (e.g., sun3 a.out).
- Some formats leave the displacement part of an instruction
- empty (e.g., m88k bcs); this flag signals the fact. */
- bfd_boolean pcrel_offset;
- };
-
-2.10.1.3 `The HOWTO Macro'
-..........................
-
-*Description*
-The HOWTO define is horrible and will go away.
- #define HOWTO(C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \
- { (unsigned) C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC }
-
- *Description*
-And will be replaced with the totally magic way. But for the moment, we
-are compatible, so do it this way.
- #define NEWHOWTO(FUNCTION, NAME, SIZE, REL, IN) \
- HOWTO (0, 0, SIZE, 0, REL, 0, complain_overflow_dont, FUNCTION, \
- NAME, FALSE, 0, 0, IN)
-
- *Description*
-This is used to fill in an empty howto entry in an array.
- #define EMPTY_HOWTO(C) \
- HOWTO ((C), 0, 0, 0, FALSE, 0, complain_overflow_dont, NULL, \
- NULL, FALSE, 0, 0, FALSE)
-
- *Description*
-Helper routine to turn a symbol into a relocation value.
- #define HOWTO_PREPARE(relocation, symbol) \
- { \
- if (symbol != NULL) \
- { \
- if (bfd_is_com_section (symbol->section)) \
- { \
- relocation = 0; \
- } \
- else \
- { \
- relocation = symbol->value; \
- } \
- } \
- }
-
-2.10.1.4 `bfd_get_reloc_size'
-.............................
-
-*Synopsis*
- unsigned int bfd_get_reloc_size (reloc_howto_type *);
- *Description*
-For a reloc_howto_type that operates on a fixed number of bytes, this
-returns the number of bytes operated on.
-
-2.10.1.5 `arelent_chain'
-........................
-
-*Description*
-How relocs are tied together in an `asection':
- typedef struct relent_chain
- {
- arelent relent;
- struct relent_chain *next;
- }
- arelent_chain;
-
-2.10.1.6 `bfd_check_overflow'
-.............................
-
-*Synopsis*
- bfd_reloc_status_type bfd_check_overflow
- (enum complain_overflow how,
- unsigned int bitsize,
- unsigned int rightshift,
- unsigned int addrsize,
- bfd_vma relocation);
- *Description*
-Perform overflow checking on RELOCATION which has BITSIZE significant
-bits and will be shifted right by RIGHTSHIFT bits, on a machine with
-addresses containing ADDRSIZE significant bits. The result is either of
-`bfd_reloc_ok' or `bfd_reloc_overflow'.
-
-2.10.1.7 `bfd_perform_relocation'
-.................................
-
-*Synopsis*
- bfd_reloc_status_type bfd_perform_relocation
- (bfd *abfd,
- arelent *reloc_entry,
- void *data,
- asection *input_section,
- bfd *output_bfd,
- char **error_message);
- *Description*
-If OUTPUT_BFD is supplied to this function, the generated image will be
-relocatable; the relocations are copied to the output file after they
-have been changed to reflect the new state of the world. There are two
-ways of reflecting the results of partial linkage in an output file: by
-modifying the output data in place, and by modifying the relocation
-record. Some native formats (e.g., basic a.out and basic coff) have no
-way of specifying an addend in the relocation type, so the addend has
-to go in the output data. This is no big deal since in these formats
-the output data slot will always be big enough for the addend. Complex
-reloc types with addends were invented to solve just this problem. The
-ERROR_MESSAGE argument is set to an error message if this return
-`bfd_reloc_dangerous'.
-
-2.10.1.8 `bfd_install_relocation'
-.................................
-
-*Synopsis*
- bfd_reloc_status_type bfd_install_relocation
- (bfd *abfd,
- arelent *reloc_entry,
- void *data, bfd_vma data_start,
- asection *input_section,
- char **error_message);
- *Description*
-This looks remarkably like `bfd_perform_relocation', except it does not
-expect that the section contents have been filled in. I.e., it's
-suitable for use when creating, rather than applying a relocation.
-
- For now, this function should be considered reserved for the
-assembler.
-
-
-File: bfd.info, Node: howto manager, Prev: typedef arelent, Up: Relocations
-
-2.10.2 The howto manager
-------------------------
-
-When an application wants to create a relocation, but doesn't know what
-the target machine might call it, it can find out by using this bit of
-code.
-
-2.10.2.1 `bfd_reloc_code_type'
-..............................
-
-*Description*
-The insides of a reloc code. The idea is that, eventually, there will
-be one enumerator for every type of relocation we ever do. Pass one of
-these values to `bfd_reloc_type_lookup', and it'll return a howto
-pointer.
-
- This does mean that the application must determine the correct
-enumerator value; you can't get a howto pointer from a random set of
-attributes.
-
- Here are the possible values for `enum bfd_reloc_code_real':
-
- -- : BFD_RELOC_64
- -- : BFD_RELOC_32
- -- : BFD_RELOC_26
- -- : BFD_RELOC_24
- -- : BFD_RELOC_16
- -- : BFD_RELOC_14
- -- : BFD_RELOC_8
- Basic absolute relocations of N bits.
-
- -- : BFD_RELOC_64_PCREL
- -- : BFD_RELOC_32_PCREL
- -- : BFD_RELOC_24_PCREL
- -- : BFD_RELOC_16_PCREL
- -- : BFD_RELOC_12_PCREL
- -- : BFD_RELOC_8_PCREL
- PC-relative relocations. Sometimes these are relative to the
- address of the relocation itself; sometimes they are relative to
- the start of the section containing the relocation. It depends on
- the specific target.
-
- The 24-bit relocation is used in some Intel 960 configurations.
-
- -- : BFD_RELOC_32_SECREL
- Section relative relocations. Some targets need this for DWARF2.
-
- -- : BFD_RELOC_32_GOT_PCREL
- -- : BFD_RELOC_16_GOT_PCREL
- -- : BFD_RELOC_8_GOT_PCREL
- -- : BFD_RELOC_32_GOTOFF
- -- : BFD_RELOC_16_GOTOFF
- -- : BFD_RELOC_LO16_GOTOFF
- -- : BFD_RELOC_HI16_GOTOFF
- -- : BFD_RELOC_HI16_S_GOTOFF
- -- : BFD_RELOC_8_GOTOFF
- -- : BFD_RELOC_64_PLT_PCREL
- -- : BFD_RELOC_32_PLT_PCREL
- -- : BFD_RELOC_24_PLT_PCREL
- -- : BFD_RELOC_16_PLT_PCREL
- -- : BFD_RELOC_8_PLT_PCREL
- -- : BFD_RELOC_64_PLTOFF
- -- : BFD_RELOC_32_PLTOFF
- -- : BFD_RELOC_16_PLTOFF
- -- : BFD_RELOC_LO16_PLTOFF
- -- : BFD_RELOC_HI16_PLTOFF
- -- : BFD_RELOC_HI16_S_PLTOFF
- -- : BFD_RELOC_8_PLTOFF
- For ELF.
-
- -- : BFD_RELOC_68K_GLOB_DAT
- -- : BFD_RELOC_68K_JMP_SLOT
- -- : BFD_RELOC_68K_RELATIVE
- Relocations used by 68K ELF.
-
- -- : BFD_RELOC_32_BASEREL
- -- : BFD_RELOC_16_BASEREL
- -- : BFD_RELOC_LO16_BASEREL
- -- : BFD_RELOC_HI16_BASEREL
- -- : BFD_RELOC_HI16_S_BASEREL
- -- : BFD_RELOC_8_BASEREL
- -- : BFD_RELOC_RVA
- Linkage-table relative.
-
- -- : BFD_RELOC_8_FFnn
- Absolute 8-bit relocation, but used to form an address like 0xFFnn.
-
- -- : BFD_RELOC_32_PCREL_S2
- -- : BFD_RELOC_16_PCREL_S2
- -- : BFD_RELOC_23_PCREL_S2
- These PC-relative relocations are stored as word displacements -
- i.e., byte displacements shifted right two bits. The 30-bit word
- displacement (<<32_PCREL_S2>> - 32 bits, shifted 2) is used on the
- SPARC. (SPARC tools generally refer to this as <<WDISP30>>.) The
- signed 16-bit displacement is used on the MIPS, and the 23-bit
- displacement is used on the Alpha.
-
- -- : BFD_RELOC_HI22
- -- : BFD_RELOC_LO10
- High 22 bits and low 10 bits of 32-bit value, placed into lower
- bits of the target word. These are used on the SPARC.
-
- -- : BFD_RELOC_GPREL16
- -- : BFD_RELOC_GPREL32
- For systems that allocate a Global Pointer register, these are
- displacements off that register. These relocation types are
- handled specially, because the value the register will have is
- decided relatively late.
-
- -- : BFD_RELOC_I960_CALLJ
- Reloc types used for i960/b.out.
-
- -- : BFD_RELOC_NONE
- -- : BFD_RELOC_SPARC_WDISP22
- -- : BFD_RELOC_SPARC22
- -- : BFD_RELOC_SPARC13
- -- : BFD_RELOC_SPARC_GOT10
- -- : BFD_RELOC_SPARC_GOT13
- -- : BFD_RELOC_SPARC_GOT22
- -- : BFD_RELOC_SPARC_PC10
- -- : BFD_RELOC_SPARC_PC22
- -- : BFD_RELOC_SPARC_WPLT30
- -- : BFD_RELOC_SPARC_COPY
- -- : BFD_RELOC_SPARC_GLOB_DAT
- -- : BFD_RELOC_SPARC_JMP_SLOT
- -- : BFD_RELOC_SPARC_RELATIVE
- -- : BFD_RELOC_SPARC_UA16
- -- : BFD_RELOC_SPARC_UA32
- -- : BFD_RELOC_SPARC_UA64
- SPARC ELF relocations. There is probably some overlap with other
- relocation types already defined.
-
- -- : BFD_RELOC_SPARC_BASE13
- -- : BFD_RELOC_SPARC_BASE22
- I think these are specific to SPARC a.out (e.g., Sun 4).
-
- -- : BFD_RELOC_SPARC_64
- -- : BFD_RELOC_SPARC_10
- -- : BFD_RELOC_SPARC_11
- -- : BFD_RELOC_SPARC_OLO10
- -- : BFD_RELOC_SPARC_HH22
- -- : BFD_RELOC_SPARC_HM10
- -- : BFD_RELOC_SPARC_LM22
- -- : BFD_RELOC_SPARC_PC_HH22
- -- : BFD_RELOC_SPARC_PC_HM10
- -- : BFD_RELOC_SPARC_PC_LM22
- -- : BFD_RELOC_SPARC_WDISP16
- -- : BFD_RELOC_SPARC_WDISP19
- -- : BFD_RELOC_SPARC_7
- -- : BFD_RELOC_SPARC_6
- -- : BFD_RELOC_SPARC_5
- -- : BFD_RELOC_SPARC_DISP64
- -- : BFD_RELOC_SPARC_PLT32
- -- : BFD_RELOC_SPARC_PLT64
- -- : BFD_RELOC_SPARC_HIX22
- -- : BFD_RELOC_SPARC_LOX10
- -- : BFD_RELOC_SPARC_H44
- -- : BFD_RELOC_SPARC_M44
- -- : BFD_RELOC_SPARC_L44
- -- : BFD_RELOC_SPARC_REGISTER
- SPARC64 relocations
-
- -- : BFD_RELOC_SPARC_REV32
- SPARC little endian relocation
-
- -- : 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
- SPARC TLS relocations
-
- -- : BFD_RELOC_ALPHA_GPDISP_HI16
- Alpha ECOFF and ELF relocations. Some of these treat the symbol or
- "addend" in some special way. For GPDISP_HI16 ("gpdisp")
- relocations, the symbol is ignored when writing; when reading, it
- will be the absolute section symbol. The addend is the
- displacement in bytes of the "lda" instruction from the "ldah"
- instruction (which is at the address of this reloc).
-
- -- : BFD_RELOC_ALPHA_GPDISP_LO16
- For GPDISP_LO16 ("ignore") relocations, the symbol is handled as
- with GPDISP_HI16 relocs. The addend is ignored when writing the
- relocations out, and is filled in with the file's GP value on
- reading, for convenience.
-
- -- : BFD_RELOC_ALPHA_GPDISP
- The ELF GPDISP relocation is exactly the same as the GPDISP_HI16
- relocation except that there is no accompanying GPDISP_LO16
- relocation.
-
- -- : BFD_RELOC_ALPHA_LITERAL
- -- : BFD_RELOC_ALPHA_ELF_LITERAL
- -- : BFD_RELOC_ALPHA_LITUSE
- The Alpha LITERAL/LITUSE relocs are produced by a symbol reference;
- the assembler turns it into a LDQ instruction to load the address
- of the symbol, and then fills in a register in the real
- instruction.
-
- The LITERAL reloc, at the LDQ instruction, refers to the .lita
- section symbol. The addend is ignored when writing, but is filled
- in with the file's GP value on reading, for convenience, as with
- the GPDISP_LO16 reloc.
-
- The ELF_LITERAL reloc is somewhere between 16_GOTOFF and
- GPDISP_LO16. It should refer to the symbol to be referenced, as
- with 16_GOTOFF, but it generates output not based on the position
- within the .got section, but relative to the GP value chosen for
- the file during the final link stage.
-
- The LITUSE reloc, on the instruction using the loaded address,
- gives information to the linker that it might be able to use to
- optimize away some literal section references. The symbol is
- ignored (read as the absolute section symbol), and the "addend"
- indicates the type of instruction using the register: 1 - "memory"
- fmt insn 2 - byte-manipulation (byte offset reg) 3 - jsr (target
- of branch)
-
- -- : BFD_RELOC_ALPHA_HINT
- The HINT relocation indicates a value that should be filled into
- the "hint" field of a jmp/jsr/ret instruction, for possible branch-
- prediction logic which may be provided on some processors.
-
- -- : BFD_RELOC_ALPHA_LINKAGE
- The LINKAGE relocation outputs a linkage pair in the object file,
- which is filled by the linker.
-
- -- : BFD_RELOC_ALPHA_CODEADDR
- The CODEADDR relocation outputs a STO_CA in the object file, which
- is filled by the linker.
-
- -- : BFD_RELOC_ALPHA_GPREL_HI16
- -- : BFD_RELOC_ALPHA_GPREL_LO16
- The GPREL_HI/LO relocations together form a 32-bit offset from the
- GP register.
-
- -- : BFD_RELOC_ALPHA_BRSGP
- Like BFD_RELOC_23_PCREL_S2, except that the source and target must
- share a common GP, and the target address is adjusted for
- STO_ALPHA_STD_GPLOAD.
-
- -- : BFD_RELOC_ALPHA_TLSGD
- -- : BFD_RELOC_ALPHA_TLSLDM
- -- : BFD_RELOC_ALPHA_DTPMOD64
- -- : BFD_RELOC_ALPHA_GOTDTPREL16
- -- : BFD_RELOC_ALPHA_DTPREL64
- -- : BFD_RELOC_ALPHA_DTPREL_HI16
- -- : BFD_RELOC_ALPHA_DTPREL_LO16
- -- : BFD_RELOC_ALPHA_DTPREL16
- -- : BFD_RELOC_ALPHA_GOTTPREL16
- -- : BFD_RELOC_ALPHA_TPREL64
- -- : BFD_RELOC_ALPHA_TPREL_HI16
- -- : BFD_RELOC_ALPHA_TPREL_LO16
- -- : BFD_RELOC_ALPHA_TPREL16
- Alpha thread-local storage relocations.
-
- -- : BFD_RELOC_MIPS_JMP
- Bits 27..2 of the relocation address shifted right 2 bits; simple
- reloc otherwise.
-
- -- : BFD_RELOC_MIPS16_JMP
- The MIPS16 jump instruction.
-
- -- : BFD_RELOC_MIPS16_GPREL
- MIPS16 GP relative reloc.
-
- -- : BFD_RELOC_HI16
- High 16 bits of 32-bit value; simple reloc.
-
- -- : BFD_RELOC_HI16_S
- High 16 bits of 32-bit value but the low 16 bits will be sign
- extended and added to form the final result. If the low 16 bits
- form a negative number, we need to add one to the high value to
- compensate for the borrow when the low bits are added.
-
- -- : BFD_RELOC_LO16
- Low 16 bits.
-
- -- : BFD_RELOC_HI16_PCREL
- High 16 bits of 32-bit pc-relative value
-
- -- : BFD_RELOC_HI16_S_PCREL
- High 16 bits of 32-bit pc-relative value, adjusted
-
- -- : BFD_RELOC_LO16_PCREL
- Low 16 bits of pc-relative value
-
- -- : BFD_RELOC_MIPS16_HI16
- MIPS16 high 16 bits of 32-bit value.
-
- -- : BFD_RELOC_MIPS16_HI16_S
- MIPS16 high 16 bits of 32-bit value but the low 16 bits will be
- sign extended and added to form the final result. If the low 16
- bits form a negative number, we need to add one to the high value
- to compensate for the borrow when the low bits are added.
-
- -- : BFD_RELOC_MIPS16_LO16
- MIPS16 low 16 bits.
-
- -- : BFD_RELOC_MIPS_LITERAL
- Relocation against a MIPS literal section.
-
- -- : BFD_RELOC_MIPS_GOT16
- -- : BFD_RELOC_MIPS_CALL16
- -- : BFD_RELOC_MIPS_GOT_HI16
- -- : BFD_RELOC_MIPS_GOT_LO16
- -- : BFD_RELOC_MIPS_CALL_HI16
- -- : BFD_RELOC_MIPS_CALL_LO16
- -- : BFD_RELOC_MIPS_SUB
- -- : BFD_RELOC_MIPS_GOT_PAGE
- -- : BFD_RELOC_MIPS_GOT_OFST
- -- : BFD_RELOC_MIPS_GOT_DISP
- -- : BFD_RELOC_MIPS_SHIFT5
- -- : BFD_RELOC_MIPS_SHIFT6
- -- : BFD_RELOC_MIPS_INSERT_A
- -- : BFD_RELOC_MIPS_INSERT_B
- -- : BFD_RELOC_MIPS_DELETE
- -- : BFD_RELOC_MIPS_HIGHEST
- -- : BFD_RELOC_MIPS_HIGHER
- -- : BFD_RELOC_MIPS_SCN_DISP
- -- : BFD_RELOC_MIPS_REL16
- -- : BFD_RELOC_MIPS_RELGOT
- -- : BFD_RELOC_MIPS_JALR
- -- : BFD_RELOC_MIPS_TLS_DTPMOD32
- -- : BFD_RELOC_MIPS_TLS_DTPREL32
- -- : BFD_RELOC_MIPS_TLS_DTPMOD64
- -- : BFD_RELOC_MIPS_TLS_DTPREL64
- -- : BFD_RELOC_MIPS_TLS_GD
- -- : BFD_RELOC_MIPS_TLS_LDM
- -- : BFD_RELOC_MIPS_TLS_DTPREL_HI16
- -- : BFD_RELOC_MIPS_TLS_DTPREL_LO16
- -- : BFD_RELOC_MIPS_TLS_GOTTPREL
- -- : BFD_RELOC_MIPS_TLS_TPREL32
- -- : BFD_RELOC_MIPS_TLS_TPREL64
- -- : BFD_RELOC_MIPS_TLS_TPREL_HI16
- -- : BFD_RELOC_MIPS_TLS_TPREL_LO16
- MIPS ELF relocations.
-
- -- : BFD_RELOC_MIPS_COPY
- -- : BFD_RELOC_MIPS_JUMP_SLOT
- MIPS ELF relocations (VxWorks extensions).
-
- -- : BFD_RELOC_FRV_LABEL16
- -- : BFD_RELOC_FRV_LABEL24
- -- : BFD_RELOC_FRV_LO16
- -- : BFD_RELOC_FRV_HI16
- -- : BFD_RELOC_FRV_GPREL12
- -- : BFD_RELOC_FRV_GPRELU12
- -- : BFD_RELOC_FRV_GPREL32
- -- : BFD_RELOC_FRV_GPRELHI
- -- : BFD_RELOC_FRV_GPRELLO
- -- : BFD_RELOC_FRV_GOT12
- -- : BFD_RELOC_FRV_GOTHI
- -- : BFD_RELOC_FRV_GOTLO
- -- : BFD_RELOC_FRV_FUNCDESC
- -- : BFD_RELOC_FRV_FUNCDESC_GOT12
- -- : BFD_RELOC_FRV_FUNCDESC_GOTHI
- -- : BFD_RELOC_FRV_FUNCDESC_GOTLO
- -- : BFD_RELOC_FRV_FUNCDESC_VALUE
- -- : BFD_RELOC_FRV_FUNCDESC_GOTOFF12
- -- : BFD_RELOC_FRV_FUNCDESC_GOTOFFHI
- -- : BFD_RELOC_FRV_FUNCDESC_GOTOFFLO
- -- : BFD_RELOC_FRV_GOTOFF12
- -- : BFD_RELOC_FRV_GOTOFFHI
- -- : BFD_RELOC_FRV_GOTOFFLO
- -- : BFD_RELOC_FRV_GETTLSOFF
- -- : BFD_RELOC_FRV_TLSDESC_VALUE
- -- : BFD_RELOC_FRV_GOTTLSDESC12
- -- : BFD_RELOC_FRV_GOTTLSDESCHI
- -- : BFD_RELOC_FRV_GOTTLSDESCLO
- -- : BFD_RELOC_FRV_TLSMOFF12
- -- : BFD_RELOC_FRV_TLSMOFFHI
- -- : BFD_RELOC_FRV_TLSMOFFLO
- -- : BFD_RELOC_FRV_GOTTLSOFF12
- -- : BFD_RELOC_FRV_GOTTLSOFFHI
- -- : BFD_RELOC_FRV_GOTTLSOFFLO
- -- : BFD_RELOC_FRV_TLSOFF
- -- : BFD_RELOC_FRV_TLSDESC_RELAX
- -- : BFD_RELOC_FRV_GETTLSOFF_RELAX
- -- : BFD_RELOC_FRV_TLSOFF_RELAX
- -- : BFD_RELOC_FRV_TLSMOFF
- Fujitsu Frv Relocations.
-
- -- : BFD_RELOC_MN10300_GOTOFF24
- This is a 24bit GOT-relative reloc for the mn10300.
-
- -- : BFD_RELOC_MN10300_GOT32
- This is a 32bit GOT-relative reloc for the mn10300, offset by two
- bytes in the instruction.
-
- -- : BFD_RELOC_MN10300_GOT24
- This is a 24bit GOT-relative reloc for the mn10300, offset by two
- bytes in the instruction.
-
- -- : BFD_RELOC_MN10300_GOT16
- This is a 16bit GOT-relative reloc for the mn10300, offset by two
- bytes in the instruction.
-
- -- : BFD_RELOC_MN10300_COPY
- Copy symbol at runtime.
-
- -- : BFD_RELOC_MN10300_GLOB_DAT
- Create GOT entry.
-
- -- : BFD_RELOC_MN10300_JMP_SLOT
- Create PLT entry.
-
- -- : BFD_RELOC_MN10300_RELATIVE
- Adjust by program base.
-
- -- : BFD_RELOC_386_GOT32
- -- : BFD_RELOC_386_PLT32
- -- : BFD_RELOC_386_COPY
- -- : BFD_RELOC_386_GLOB_DAT
- -- : BFD_RELOC_386_JUMP_SLOT
- -- : BFD_RELOC_386_RELATIVE
- -- : BFD_RELOC_386_GOTOFF
- -- : BFD_RELOC_386_GOTPC
- -- : BFD_RELOC_386_TLS_TPOFF
- -- : BFD_RELOC_386_TLS_IE
- -- : BFD_RELOC_386_TLS_GOTIE
- -- : BFD_RELOC_386_TLS_LE
- -- : BFD_RELOC_386_TLS_GD
- -- : BFD_RELOC_386_TLS_LDM
- -- : BFD_RELOC_386_TLS_LDO_32
- -- : BFD_RELOC_386_TLS_IE_32
- -- : BFD_RELOC_386_TLS_LE_32
- -- : BFD_RELOC_386_TLS_DTPMOD32
- -- : BFD_RELOC_386_TLS_DTPOFF32
- -- : BFD_RELOC_386_TLS_TPOFF32
- -- : BFD_RELOC_386_TLS_GOTDESC
- -- : BFD_RELOC_386_TLS_DESC_CALL
- -- : BFD_RELOC_386_TLS_DESC
- i386/elf relocations
-
- -- : BFD_RELOC_X86_64_GOT32
- -- : BFD_RELOC_X86_64_PLT32
- -- : BFD_RELOC_X86_64_COPY
- -- : BFD_RELOC_X86_64_GLOB_DAT
- -- : BFD_RELOC_X86_64_JUMP_SLOT
- -- : BFD_RELOC_X86_64_RELATIVE
- -- : BFD_RELOC_X86_64_GOTPCREL
- -- : BFD_RELOC_X86_64_32S
- -- : BFD_RELOC_X86_64_DTPMOD64
- -- : BFD_RELOC_X86_64_DTPOFF64
- -- : BFD_RELOC_X86_64_TPOFF64
- -- : BFD_RELOC_X86_64_TLSGD
- -- : BFD_RELOC_X86_64_TLSLD
- -- : BFD_RELOC_X86_64_DTPOFF32
- -- : BFD_RELOC_X86_64_GOTTPOFF
- -- : BFD_RELOC_X86_64_TPOFF32
- -- : BFD_RELOC_X86_64_GOTOFF64
- -- : BFD_RELOC_X86_64_GOTPC32
- -- : BFD_RELOC_X86_64_GOT64
- -- : BFD_RELOC_X86_64_GOTPCREL64
- -- : BFD_RELOC_X86_64_GOTPC64
- -- : BFD_RELOC_X86_64_GOTPLT64
- -- : BFD_RELOC_X86_64_PLTOFF64
- -- : BFD_RELOC_X86_64_GOTPC32_TLSDESC
- -- : BFD_RELOC_X86_64_TLSDESC_CALL
- -- : BFD_RELOC_X86_64_TLSDESC
- x86-64/elf relocations
-
- -- : BFD_RELOC_NS32K_IMM_8
- -- : BFD_RELOC_NS32K_IMM_16
- -- : BFD_RELOC_NS32K_IMM_32
- -- : BFD_RELOC_NS32K_IMM_8_PCREL
- -- : BFD_RELOC_NS32K_IMM_16_PCREL
- -- : BFD_RELOC_NS32K_IMM_32_PCREL
- -- : BFD_RELOC_NS32K_DISP_8
- -- : BFD_RELOC_NS32K_DISP_16
- -- : BFD_RELOC_NS32K_DISP_32
- -- : BFD_RELOC_NS32K_DISP_8_PCREL
- -- : BFD_RELOC_NS32K_DISP_16_PCREL
- -- : BFD_RELOC_NS32K_DISP_32_PCREL
- ns32k relocations
-
- -- : BFD_RELOC_PDP11_DISP_8_PCREL
- -- : BFD_RELOC_PDP11_DISP_6_PCREL
- PDP11 relocations
-
- -- : BFD_RELOC_PJ_CODE_HI16
- -- : BFD_RELOC_PJ_CODE_LO16
- -- : BFD_RELOC_PJ_CODE_DIR16
- -- : BFD_RELOC_PJ_CODE_DIR32
- -- : BFD_RELOC_PJ_CODE_REL16
- -- : BFD_RELOC_PJ_CODE_REL32
- Picojava relocs. Not all of these appear in object files.
-
- -- : BFD_RELOC_PPC_B26
- -- : BFD_RELOC_PPC_BA26
- -- : BFD_RELOC_PPC_TOC16
- -- : BFD_RELOC_PPC_B16
- -- : BFD_RELOC_PPC_B16_BRTAKEN
- -- : BFD_RELOC_PPC_B16_BRNTAKEN
- -- : BFD_RELOC_PPC_BA16
- -- : BFD_RELOC_PPC_BA16_BRTAKEN
- -- : BFD_RELOC_PPC_BA16_BRNTAKEN
- -- : BFD_RELOC_PPC_COPY
- -- : BFD_RELOC_PPC_GLOB_DAT
- -- : BFD_RELOC_PPC_JMP_SLOT
- -- : BFD_RELOC_PPC_RELATIVE
- -- : BFD_RELOC_PPC_LOCAL24PC
- -- : BFD_RELOC_PPC_EMB_NADDR32
- -- : BFD_RELOC_PPC_EMB_NADDR16
- -- : BFD_RELOC_PPC_EMB_NADDR16_LO
- -- : BFD_RELOC_PPC_EMB_NADDR16_HI
- -- : BFD_RELOC_PPC_EMB_NADDR16_HA
- -- : BFD_RELOC_PPC_EMB_SDAI16
- -- : BFD_RELOC_PPC_EMB_SDA2I16
- -- : BFD_RELOC_PPC_EMB_SDA2REL
- -- : BFD_RELOC_PPC_EMB_SDA21
- -- : BFD_RELOC_PPC_EMB_MRKREF
- -- : BFD_RELOC_PPC_EMB_RELSEC16
- -- : BFD_RELOC_PPC_EMB_RELST_LO
- -- : BFD_RELOC_PPC_EMB_RELST_HI
- -- : BFD_RELOC_PPC_EMB_RELST_HA
- -- : BFD_RELOC_PPC_EMB_BIT_FLD
- -- : BFD_RELOC_PPC_EMB_RELSDA
- -- : BFD_RELOC_PPC64_HIGHER
- -- : BFD_RELOC_PPC64_HIGHER_S
- -- : BFD_RELOC_PPC64_HIGHEST
- -- : BFD_RELOC_PPC64_HIGHEST_S
- -- : BFD_RELOC_PPC64_TOC16_LO
- -- : BFD_RELOC_PPC64_TOC16_HI
- -- : BFD_RELOC_PPC64_TOC16_HA
- -- : BFD_RELOC_PPC64_TOC
- -- : BFD_RELOC_PPC64_PLTGOT16
- -- : BFD_RELOC_PPC64_PLTGOT16_LO
- -- : BFD_RELOC_PPC64_PLTGOT16_HI
- -- : BFD_RELOC_PPC64_PLTGOT16_HA
- -- : BFD_RELOC_PPC64_ADDR16_DS
- -- : BFD_RELOC_PPC64_ADDR16_LO_DS
- -- : BFD_RELOC_PPC64_GOT16_DS
- -- : BFD_RELOC_PPC64_GOT16_LO_DS
- -- : BFD_RELOC_PPC64_PLT16_LO_DS
- -- : BFD_RELOC_PPC64_SECTOFF_DS
- -- : BFD_RELOC_PPC64_SECTOFF_LO_DS
- -- : BFD_RELOC_PPC64_TOC16_DS
- -- : BFD_RELOC_PPC64_TOC16_LO_DS
- -- : BFD_RELOC_PPC64_PLTGOT16_DS
- -- : BFD_RELOC_PPC64_PLTGOT16_LO_DS
- Power(rs6000) and PowerPC 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
- PowerPC and PowerPC64 thread-local storage relocations.
-
- -- : BFD_RELOC_I370_D12
- IBM 370/390 relocations
-
- -- : BFD_RELOC_CTOR
- The type of reloc used to build a constructor table - at the moment
- probably a 32 bit wide absolute relocation, but the target can
- choose. It generally does map to one of the other relocation
- types.
-
- -- : BFD_RELOC_ARM_PCREL_BRANCH
- ARM 26 bit pc-relative branch. The lowest two bits must be zero
- and are not stored in the instruction.
-
- -- : BFD_RELOC_ARM_PCREL_BLX
- ARM 26 bit pc-relative branch. The lowest bit must be zero and is
- not stored in the instruction. The 2nd lowest bit comes from a 1
- bit field in the instruction.
-
- -- : BFD_RELOC_THUMB_PCREL_BLX
- Thumb 22 bit pc-relative branch. The lowest bit must be zero and
- is not stored in the instruction. The 2nd lowest bit comes from a
- 1 bit field in the instruction.
-
- -- : BFD_RELOC_ARM_PCREL_CALL
- ARM 26-bit pc-relative branch for an unconditional BL or BLX
- instruction.
-
- -- : BFD_RELOC_ARM_PCREL_JUMP
- ARM 26-bit pc-relative branch for B or conditional BL instruction.
-
- -- : BFD_RELOC_THUMB_PCREL_BRANCH7
- -- : BFD_RELOC_THUMB_PCREL_BRANCH9
- -- : BFD_RELOC_THUMB_PCREL_BRANCH12
- -- : BFD_RELOC_THUMB_PCREL_BRANCH20
- -- : BFD_RELOC_THUMB_PCREL_BRANCH23
- -- : BFD_RELOC_THUMB_PCREL_BRANCH25
- Thumb 7-, 9-, 12-, 20-, 23-, and 25-bit pc-relative branches. The
- lowest bit must be zero and is not stored in the instruction.
- Note that the corresponding ELF R_ARM_THM_JUMPnn constant has an
- "nn" one smaller in all cases. Note further that BRANCH23
- corresponds to R_ARM_THM_CALL.
-
- -- : BFD_RELOC_ARM_OFFSET_IMM
- 12-bit immediate offset, used in ARM-format ldr and str
- instructions.
-
- -- : BFD_RELOC_ARM_THUMB_OFFSET
- 5-bit immediate offset, used in Thumb-format ldr and str
- instructions.
-
- -- : BFD_RELOC_ARM_TARGET1
- Pc-relative or absolute relocation depending on target. Used for
- entries in .init_array sections.
-
- -- : BFD_RELOC_ARM_ROSEGREL32
- Read-only segment base relative address.
-
- -- : BFD_RELOC_ARM_SBREL32
- Data segment base relative address.
-
- -- : BFD_RELOC_ARM_TARGET2
- This reloc is used for references to RTTI data from exception
- handling tables. The actual definition depends on the target. It
- may be a pc-relative or some form of GOT-indirect relocation.
-
- -- : BFD_RELOC_ARM_PREL31
- 31-bit PC relative address.
-
- -- : BFD_RELOC_ARM_JUMP_SLOT
- -- : BFD_RELOC_ARM_GLOB_DAT
- -- : BFD_RELOC_ARM_GOT32
- -- : BFD_RELOC_ARM_PLT32
- -- : BFD_RELOC_ARM_RELATIVE
- -- : BFD_RELOC_ARM_GOTOFF
- -- : BFD_RELOC_ARM_GOTPC
- Relocations for setting up GOTs and PLTs for shared libraries.
-
- -- : BFD_RELOC_ARM_TLS_GD32
- -- : BFD_RELOC_ARM_TLS_LDO32
- -- : BFD_RELOC_ARM_TLS_LDM32
- -- : BFD_RELOC_ARM_TLS_DTPOFF32
- -- : BFD_RELOC_ARM_TLS_DTPMOD32
- -- : BFD_RELOC_ARM_TLS_TPOFF32
- -- : BFD_RELOC_ARM_TLS_IE32
- -- : BFD_RELOC_ARM_TLS_LE32
- ARM thread-local storage relocations.
-
- -- : BFD_RELOC_ARM_IMMEDIATE
- -- : BFD_RELOC_ARM_ADRL_IMMEDIATE
- -- : BFD_RELOC_ARM_T32_IMMEDIATE
- -- : BFD_RELOC_ARM_T32_IMM12
- -- : BFD_RELOC_ARM_T32_ADD_PC12
- -- : BFD_RELOC_ARM_SHIFT_IMM
- -- : BFD_RELOC_ARM_SMC
- -- : BFD_RELOC_ARM_SWI
- -- : BFD_RELOC_ARM_MULTI
- -- : BFD_RELOC_ARM_CP_OFF_IMM
- -- : BFD_RELOC_ARM_CP_OFF_IMM_S2
- -- : BFD_RELOC_ARM_T32_CP_OFF_IMM
- -- : BFD_RELOC_ARM_T32_CP_OFF_IMM_S2
- -- : BFD_RELOC_ARM_ADR_IMM
- -- : BFD_RELOC_ARM_LDR_IMM
- -- : BFD_RELOC_ARM_LITERAL
- -- : BFD_RELOC_ARM_IN_POOL
- -- : BFD_RELOC_ARM_OFFSET_IMM8
- -- : BFD_RELOC_ARM_T32_OFFSET_U8
- -- : BFD_RELOC_ARM_T32_OFFSET_IMM
- -- : BFD_RELOC_ARM_HWLITERAL
- -- : BFD_RELOC_ARM_THUMB_ADD
- -- : BFD_RELOC_ARM_THUMB_IMM
- -- : BFD_RELOC_ARM_THUMB_SHIFT
- These relocs are only used within the ARM assembler. They are not
- (at present) written to any object files.
-
- -- : BFD_RELOC_SH_PCDISP8BY2
- -- : BFD_RELOC_SH_PCDISP12BY2
- -- : BFD_RELOC_SH_IMM3
- -- : BFD_RELOC_SH_IMM3U
- -- : BFD_RELOC_SH_DISP12
- -- : BFD_RELOC_SH_DISP12BY2
- -- : BFD_RELOC_SH_DISP12BY4
- -- : BFD_RELOC_SH_DISP12BY8
- -- : BFD_RELOC_SH_DISP20
- -- : BFD_RELOC_SH_DISP20BY8
- -- : BFD_RELOC_SH_IMM4
- -- : BFD_RELOC_SH_IMM4BY2
- -- : BFD_RELOC_SH_IMM4BY4
- -- : BFD_RELOC_SH_IMM8
- -- : BFD_RELOC_SH_IMM8BY2
- -- : BFD_RELOC_SH_IMM8BY4
- -- : BFD_RELOC_SH_PCRELIMM8BY2
- -- : BFD_RELOC_SH_PCRELIMM8BY4
- -- : BFD_RELOC_SH_SWITCH16
- -- : BFD_RELOC_SH_SWITCH32
- -- : BFD_RELOC_SH_USES
- -- : BFD_RELOC_SH_COUNT
- -- : BFD_RELOC_SH_ALIGN
- -- : BFD_RELOC_SH_CODE
- -- : BFD_RELOC_SH_DATA
- -- : BFD_RELOC_SH_LABEL
- -- : BFD_RELOC_SH_LOOP_START
- -- : BFD_RELOC_SH_LOOP_END
- -- : BFD_RELOC_SH_COPY
- -- : BFD_RELOC_SH_GLOB_DAT
- -- : BFD_RELOC_SH_JMP_SLOT
- -- : BFD_RELOC_SH_RELATIVE
- -- : BFD_RELOC_SH_GOTPC
- -- : BFD_RELOC_SH_GOT_LOW16
- -- : BFD_RELOC_SH_GOT_MEDLOW16
- -- : BFD_RELOC_SH_GOT_MEDHI16
- -- : BFD_RELOC_SH_GOT_HI16
- -- : BFD_RELOC_SH_GOTPLT_LOW16
- -- : BFD_RELOC_SH_GOTPLT_MEDLOW16
- -- : BFD_RELOC_SH_GOTPLT_MEDHI16
- -- : BFD_RELOC_SH_GOTPLT_HI16
- -- : BFD_RELOC_SH_PLT_LOW16
- -- : BFD_RELOC_SH_PLT_MEDLOW16
- -- : BFD_RELOC_SH_PLT_MEDHI16
- -- : BFD_RELOC_SH_PLT_HI16
- -- : BFD_RELOC_SH_GOTOFF_LOW16
- -- : BFD_RELOC_SH_GOTOFF_MEDLOW16
- -- : BFD_RELOC_SH_GOTOFF_MEDHI16
- -- : BFD_RELOC_SH_GOTOFF_HI16
- -- : BFD_RELOC_SH_GOTPC_LOW16
- -- : BFD_RELOC_SH_GOTPC_MEDLOW16
- -- : BFD_RELOC_SH_GOTPC_MEDHI16
- -- : BFD_RELOC_SH_GOTPC_HI16
- -- : BFD_RELOC_SH_COPY64
- -- : BFD_RELOC_SH_GLOB_DAT64
- -- : BFD_RELOC_SH_JMP_SLOT64
- -- : BFD_RELOC_SH_RELATIVE64
- -- : BFD_RELOC_SH_GOT10BY4
- -- : BFD_RELOC_SH_GOT10BY8
- -- : BFD_RELOC_SH_GOTPLT10BY4
- -- : BFD_RELOC_SH_GOTPLT10BY8
- -- : BFD_RELOC_SH_GOTPLT32
- -- : BFD_RELOC_SH_SHMEDIA_CODE
- -- : BFD_RELOC_SH_IMMU5
- -- : BFD_RELOC_SH_IMMS6
- -- : BFD_RELOC_SH_IMMS6BY32
- -- : BFD_RELOC_SH_IMMU6
- -- : BFD_RELOC_SH_IMMS10
- -- : BFD_RELOC_SH_IMMS10BY2
- -- : BFD_RELOC_SH_IMMS10BY4
- -- : BFD_RELOC_SH_IMMS10BY8
- -- : BFD_RELOC_SH_IMMS16
- -- : BFD_RELOC_SH_IMMU16
- -- : BFD_RELOC_SH_IMM_LOW16
- -- : BFD_RELOC_SH_IMM_LOW16_PCREL
- -- : BFD_RELOC_SH_IMM_MEDLOW16
- -- : BFD_RELOC_SH_IMM_MEDLOW16_PCREL
- -- : BFD_RELOC_SH_IMM_MEDHI16
- -- : BFD_RELOC_SH_IMM_MEDHI16_PCREL
- -- : BFD_RELOC_SH_IMM_HI16
- -- : BFD_RELOC_SH_IMM_HI16_PCREL
- -- : BFD_RELOC_SH_PT_16
- -- : BFD_RELOC_SH_TLS_GD_32
- -- : BFD_RELOC_SH_TLS_LD_32
- -- : BFD_RELOC_SH_TLS_LDO_32
- -- : BFD_RELOC_SH_TLS_IE_32
- -- : BFD_RELOC_SH_TLS_LE_32
- -- : BFD_RELOC_SH_TLS_DTPMOD32
- -- : BFD_RELOC_SH_TLS_DTPOFF32
- -- : BFD_RELOC_SH_TLS_TPOFF32
- Renesas / SuperH SH relocs. Not all of these appear in object
- files.
-
- -- : BFD_RELOC_ARC_B22_PCREL
- ARC Cores relocs. ARC 22 bit pc-relative branch. The lowest two
- bits must be zero and are not stored in the instruction. The high
- 20 bits are installed in bits 26 through 7 of the instruction.
-
- -- : BFD_RELOC_ARC_B26
- ARC 26 bit absolute branch. The lowest two bits must be zero and
- are not stored in the instruction. The high 24 bits are installed
- in bits 23 through 0.
-
- -- : BFD_RELOC_BFIN_16_IMM
- ADI Blackfin 16 bit immediate absolute reloc.
-
- -- : BFD_RELOC_BFIN_16_HIGH
- ADI Blackfin 16 bit immediate absolute reloc higher 16 bits.
-
- -- : BFD_RELOC_BFIN_4_PCREL
- ADI Blackfin 'a' part of LSETUP.
-
- -- : BFD_RELOC_BFIN_5_PCREL
- ADI Blackfin.
-
- -- : BFD_RELOC_BFIN_16_LOW
- ADI Blackfin 16 bit immediate absolute reloc lower 16 bits.
-
- -- : BFD_RELOC_BFIN_10_PCREL
- ADI Blackfin.
-
- -- : BFD_RELOC_BFIN_11_PCREL
- ADI Blackfin 'b' part of LSETUP.
-
- -- : BFD_RELOC_BFIN_12_PCREL_JUMP
- ADI Blackfin.
-
- -- : BFD_RELOC_BFIN_12_PCREL_JUMP_S
- ADI Blackfin Short jump, pcrel.
-
- -- : BFD_RELOC_BFIN_24_PCREL_CALL_X
- ADI Blackfin Call.x not implemented.
-
- -- : BFD_RELOC_BFIN_24_PCREL_JUMP_L
- ADI Blackfin Long Jump pcrel.
-
- -- : BFD_RELOC_BFIN_GOT17M4
- -- : BFD_RELOC_BFIN_GOTHI
- -- : BFD_RELOC_BFIN_GOTLO
- -- : BFD_RELOC_BFIN_FUNCDESC
- -- : BFD_RELOC_BFIN_FUNCDESC_GOT17M4
- -- : BFD_RELOC_BFIN_FUNCDESC_GOTHI
- -- : BFD_RELOC_BFIN_FUNCDESC_GOTLO
- -- : BFD_RELOC_BFIN_FUNCDESC_VALUE
- -- : BFD_RELOC_BFIN_FUNCDESC_GOTOFF17M4
- -- : BFD_RELOC_BFIN_FUNCDESC_GOTOFFHI
- -- : BFD_RELOC_BFIN_FUNCDESC_GOTOFFLO
- -- : BFD_RELOC_BFIN_GOTOFF17M4
- -- : BFD_RELOC_BFIN_GOTOFFHI
- -- : BFD_RELOC_BFIN_GOTOFFLO
- ADI Blackfin FD-PIC relocations.
-
- -- : BFD_RELOC_BFIN_GOT
- ADI Blackfin GOT relocation.
-
- -- : BFD_RELOC_BFIN_PLTPC
- ADI Blackfin PLTPC relocation.
-
- -- : BFD_ARELOC_BFIN_PUSH
- ADI Blackfin arithmetic relocation.
-
- -- : BFD_ARELOC_BFIN_CONST
- ADI Blackfin arithmetic relocation.
-
- -- : BFD_ARELOC_BFIN_ADD
- ADI Blackfin arithmetic relocation.
-
- -- : BFD_ARELOC_BFIN_SUB
- ADI Blackfin arithmetic relocation.
-
- -- : BFD_ARELOC_BFIN_MULT
- ADI Blackfin arithmetic relocation.
-
- -- : BFD_ARELOC_BFIN_DIV
- ADI Blackfin arithmetic relocation.
-
- -- : BFD_ARELOC_BFIN_MOD
- ADI Blackfin arithmetic relocation.
-
- -- : BFD_ARELOC_BFIN_LSHIFT
- ADI Blackfin arithmetic relocation.
-
- -- : BFD_ARELOC_BFIN_RSHIFT
- ADI Blackfin arithmetic relocation.
-
- -- : BFD_ARELOC_BFIN_AND
- ADI Blackfin arithmetic relocation.
-
- -- : BFD_ARELOC_BFIN_OR
- ADI Blackfin arithmetic relocation.
-
- -- : BFD_ARELOC_BFIN_XOR
- ADI Blackfin arithmetic relocation.
-
- -- : BFD_ARELOC_BFIN_LAND
- ADI Blackfin arithmetic relocation.
-
- -- : BFD_ARELOC_BFIN_LOR
- ADI Blackfin arithmetic relocation.
-
- -- : BFD_ARELOC_BFIN_LEN
- ADI Blackfin arithmetic relocation.
-
- -- : BFD_ARELOC_BFIN_NEG
- ADI Blackfin arithmetic relocation.
-
- -- : BFD_ARELOC_BFIN_COMP
- ADI Blackfin arithmetic relocation.
-
- -- : BFD_ARELOC_BFIN_PAGE
- ADI Blackfin arithmetic relocation.
-
- -- : BFD_ARELOC_BFIN_HWPAGE
- ADI Blackfin arithmetic relocation.
-
- -- : BFD_ARELOC_BFIN_ADDR
- ADI Blackfin arithmetic relocation.
-
- -- : BFD_RELOC_D10V_10_PCREL_R
- Mitsubishi D10V relocs. This is a 10-bit reloc with the right 2
- bits assumed to be 0.
-
- -- : BFD_RELOC_D10V_10_PCREL_L
- Mitsubishi D10V relocs. This is a 10-bit reloc with the right 2
- bits assumed to be 0. This is the same as the previous reloc
- except it is in the left container, i.e., shifted left 15 bits.
-
- -- : BFD_RELOC_D10V_18
- This is an 18-bit reloc with the right 2 bits assumed to be 0.
-
- -- : BFD_RELOC_D10V_18_PCREL
- This is an 18-bit reloc with the right 2 bits assumed to be 0.
-
- -- : BFD_RELOC_D30V_6
- Mitsubishi D30V relocs. This is a 6-bit absolute reloc.
-
- -- : BFD_RELOC_D30V_9_PCREL
- This is a 6-bit pc-relative reloc with the right 3 bits assumed to
- be 0.
-
- -- : BFD_RELOC_D30V_9_PCREL_R
- This is a 6-bit pc-relative reloc with the right 3 bits assumed to
- be 0. Same as the previous reloc but on the right side of the
- container.
-
- -- : BFD_RELOC_D30V_15
- This is a 12-bit absolute reloc with the right 3 bitsassumed to be
- 0.
-
- -- : BFD_RELOC_D30V_15_PCREL
- This is a 12-bit pc-relative reloc with the right 3 bits assumed
- to be 0.
-
- -- : BFD_RELOC_D30V_15_PCREL_R
- This is a 12-bit pc-relative reloc with the right 3 bits assumed
- to be 0. Same as the previous reloc but on the right side of the
- container.
-
- -- : BFD_RELOC_D30V_21
- This is an 18-bit absolute reloc with the right 3 bits assumed to
- be 0.
-
- -- : BFD_RELOC_D30V_21_PCREL
- This is an 18-bit pc-relative reloc with the right 3 bits assumed
- to be 0.
-
- -- : BFD_RELOC_D30V_21_PCREL_R
- This is an 18-bit pc-relative reloc with the right 3 bits assumed
- to be 0. Same as the previous reloc but on the right side of the
- container.
-
- -- : BFD_RELOC_D30V_32
- This is a 32-bit absolute reloc.
-
- -- : BFD_RELOC_D30V_32_PCREL
- This is a 32-bit pc-relative reloc.
-
- -- : BFD_RELOC_DLX_HI16_S
- DLX relocs
-
- -- : BFD_RELOC_DLX_LO16
- DLX relocs
-
- -- : BFD_RELOC_DLX_JMP26
- DLX relocs
-
- -- : BFD_RELOC_M32C_HI8
- -- : BFD_RELOC_M32C_RL_JUMP
- -- : BFD_RELOC_M32C_RL_1ADDR
- -- : BFD_RELOC_M32C_RL_2ADDR
- Renesas M16C/M32C Relocations.
-
- -- : BFD_RELOC_M32R_24
- Renesas M32R (formerly Mitsubishi M32R) relocs. This is a 24 bit
- absolute address.
-
- -- : BFD_RELOC_M32R_10_PCREL
- This is a 10-bit pc-relative reloc with the right 2 bits assumed
- to be 0.
-
- -- : BFD_RELOC_M32R_18_PCREL
- This is an 18-bit reloc with the right 2 bits assumed to be 0.
-
- -- : BFD_RELOC_M32R_26_PCREL
- This is a 26-bit reloc with the right 2 bits assumed to be 0.
-
- -- : BFD_RELOC_M32R_HI16_ULO
- This is a 16-bit reloc containing the high 16 bits of an address
- used when the lower 16 bits are treated as unsigned.
-
- -- : BFD_RELOC_M32R_HI16_SLO
- This is a 16-bit reloc containing the high 16 bits of an address
- used when the lower 16 bits are treated as signed.
-
- -- : BFD_RELOC_M32R_LO16
- This is a 16-bit reloc containing the lower 16 bits of an address.
-
- -- : BFD_RELOC_M32R_SDA16
- This is a 16-bit reloc containing the small data area offset for
- use in add3, load, and store instructions.
-
- -- : 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_GOTOFF_HI_ULO
- -- : BFD_RELOC_M32R_GOTOFF_HI_SLO
- -- : BFD_RELOC_M32R_GOTOFF_LO
- -- : BFD_RELOC_M32R_GOTPC24
- -- : BFD_RELOC_M32R_GOT16_HI_ULO
- -- : BFD_RELOC_M32R_GOT16_HI_SLO
- -- : BFD_RELOC_M32R_GOT16_LO
- -- : BFD_RELOC_M32R_GOTPC_HI_ULO
- -- : BFD_RELOC_M32R_GOTPC_HI_SLO
- -- : BFD_RELOC_M32R_GOTPC_LO
- For PIC.
-
- -- : BFD_RELOC_V850_9_PCREL
- This is a 9-bit reloc
-
- -- : BFD_RELOC_V850_22_PCREL
- This is a 22-bit reloc
-
- -- : BFD_RELOC_V850_SDA_16_16_OFFSET
- This is a 16 bit offset from the short data area pointer.
-
- -- : BFD_RELOC_V850_SDA_15_16_OFFSET
- This is a 16 bit offset (of which only 15 bits are used) from the
- short data area pointer.
-
- -- : BFD_RELOC_V850_ZDA_16_16_OFFSET
- This is a 16 bit offset from the zero data area pointer.
-
- -- : BFD_RELOC_V850_ZDA_15_16_OFFSET
- This is a 16 bit offset (of which only 15 bits are used) from the
- zero data area pointer.
-
- -- : BFD_RELOC_V850_TDA_6_8_OFFSET
- This is an 8 bit offset (of which only 6 bits are used) from the
- tiny data area pointer.
-
- -- : BFD_RELOC_V850_TDA_7_8_OFFSET
- This is an 8bit offset (of which only 7 bits are used) from the
- tiny data area pointer.
-
- -- : BFD_RELOC_V850_TDA_7_7_OFFSET
- This is a 7 bit offset from the tiny data area pointer.
-
- -- : BFD_RELOC_V850_TDA_16_16_OFFSET
- This is a 16 bit offset from the tiny data area pointer.
-
- -- : BFD_RELOC_V850_TDA_4_5_OFFSET
- This is a 5 bit offset (of which only 4 bits are used) from the
- tiny data area pointer.
-
- -- : BFD_RELOC_V850_TDA_4_4_OFFSET
- This is a 4 bit offset from the tiny data area pointer.
-
- -- : BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET
- This is a 16 bit offset from the short data area pointer, with the
- bits placed non-contiguously in the instruction.
-
- -- : BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET
- This is a 16 bit offset from the zero data area pointer, with the
- bits placed non-contiguously in the instruction.
-
- -- : BFD_RELOC_V850_CALLT_6_7_OFFSET
- This is a 6 bit offset from the call table base pointer.
-
- -- : BFD_RELOC_V850_CALLT_16_16_OFFSET
- This is a 16 bit offset from the call table base pointer.
-
- -- : BFD_RELOC_V850_LONGCALL
- Used for relaxing indirect function calls.
-
- -- : BFD_RELOC_V850_LONGJUMP
- Used for relaxing indirect jumps.
-
- -- : BFD_RELOC_V850_ALIGN
- Used to maintain alignment whilst relaxing.
-
- -- : BFD_RELOC_V850_LO16_SPLIT_OFFSET
- This is a variation of BFD_RELOC_LO16 that can be used in v850e
- ld.bu instructions.
-
- -- : BFD_RELOC_MN10300_32_PCREL
- This is a 32bit pcrel reloc for the mn10300, offset by two bytes
- in the instruction.
-
- -- : BFD_RELOC_MN10300_16_PCREL
- This is a 16bit pcrel reloc for the mn10300, offset by two bytes
- in the instruction.
-
- -- : BFD_RELOC_TIC30_LDP
- This is a 8bit DP reloc for the tms320c30, where the most
- significant 8 bits of a 24 bit word are placed into the least
- significant 8 bits of the opcode.
-
- -- : BFD_RELOC_TIC54X_PARTLS7
- This is a 7bit reloc for the tms320c54x, where the least
- significant 7 bits of a 16 bit word are placed into the least
- significant 7 bits of the opcode.
-
- -- : BFD_RELOC_TIC54X_PARTMS9
- This is a 9bit DP reloc for the tms320c54x, where the most
- significant 9 bits of a 16 bit word are placed into the least
- significant 9 bits of the opcode.
-
- -- : BFD_RELOC_TIC54X_23
- This is an extended address 23-bit reloc for the tms320c54x.
-
- -- : BFD_RELOC_TIC54X_16_OF_23
- This is a 16-bit reloc for the tms320c54x, where the least
- significant 16 bits of a 23-bit extended address are placed into
- the opcode.
-
- -- : BFD_RELOC_TIC54X_MS7_OF_23
- This is a reloc for the tms320c54x, where the most significant 7
- bits of a 23-bit extended address are placed into the opcode.
-
- -- : BFD_RELOC_FR30_48
- This is a 48 bit reloc for the FR30 that stores 32 bits.
-
- -- : BFD_RELOC_FR30_20
- This is a 32 bit reloc for the FR30 that stores 20 bits split up
- into two sections.
-
- -- : BFD_RELOC_FR30_6_IN_4
- This is a 16 bit reloc for the FR30 that stores a 6 bit word
- offset in 4 bits.
-
- -- : BFD_RELOC_FR30_8_IN_8
- This is a 16 bit reloc for the FR30 that stores an 8 bit byte
- offset into 8 bits.
-
- -- : BFD_RELOC_FR30_9_IN_8
- This is a 16 bit reloc for the FR30 that stores a 9 bit short
- offset into 8 bits.
-
- -- : BFD_RELOC_FR30_10_IN_8
- This is a 16 bit reloc for the FR30 that stores a 10 bit word
- offset into 8 bits.
-
- -- : BFD_RELOC_FR30_9_PCREL
- This is a 16 bit reloc for the FR30 that stores a 9 bit pc relative
- short offset into 8 bits.
-
- -- : BFD_RELOC_FR30_12_PCREL
- This is a 16 bit reloc for the FR30 that stores a 12 bit pc
- relative short offset into 11 bits.
-
- -- : BFD_RELOC_MCORE_PCREL_IMM8BY4
- -- : BFD_RELOC_MCORE_PCREL_IMM11BY2
- -- : BFD_RELOC_MCORE_PCREL_IMM4BY2
- -- : BFD_RELOC_MCORE_PCREL_32
- -- : BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2
- -- : BFD_RELOC_MCORE_RVA
- Motorola Mcore relocations.
-
- -- : BFD_RELOC_MMIX_GETA
- -- : BFD_RELOC_MMIX_GETA_1
- -- : BFD_RELOC_MMIX_GETA_2
- -- : BFD_RELOC_MMIX_GETA_3
- These are relocations for the GETA instruction.
-
- -- : BFD_RELOC_MMIX_CBRANCH
- -- : BFD_RELOC_MMIX_CBRANCH_J
- -- : BFD_RELOC_MMIX_CBRANCH_1
- -- : BFD_RELOC_MMIX_CBRANCH_2
- -- : BFD_RELOC_MMIX_CBRANCH_3
- These are relocations for a conditional branch instruction.
-
- -- : BFD_RELOC_MMIX_PUSHJ
- -- : BFD_RELOC_MMIX_PUSHJ_1
- -- : BFD_RELOC_MMIX_PUSHJ_2
- -- : BFD_RELOC_MMIX_PUSHJ_3
- -- : BFD_RELOC_MMIX_PUSHJ_STUBBABLE
- These are relocations for the PUSHJ instruction.
-
- -- : BFD_RELOC_MMIX_JMP
- -- : BFD_RELOC_MMIX_JMP_1
- -- : BFD_RELOC_MMIX_JMP_2
- -- : BFD_RELOC_MMIX_JMP_3
- These are relocations for the JMP instruction.
-
- -- : BFD_RELOC_MMIX_ADDR19
- This is a relocation for a relative address as in a GETA
- instruction or a branch.
-
- -- : BFD_RELOC_MMIX_ADDR27
- This is a relocation for a relative address as in a JMP
- instruction.
-
- -- : BFD_RELOC_MMIX_REG_OR_BYTE
- This is a relocation for an instruction field that may be a general
- register or a value 0..255.
-
- -- : BFD_RELOC_MMIX_REG
- This is a relocation for an instruction field that may be a general
- register.
-
- -- : BFD_RELOC_MMIX_BASE_PLUS_OFFSET
- This is a relocation for two instruction fields holding a register
- and an offset, the equivalent of the relocation.
-
- -- : BFD_RELOC_MMIX_LOCAL
- This relocation is an assertion that the expression is not
- allocated as a global register. It does not modify contents.
-
- -- : BFD_RELOC_AVR_7_PCREL
- This is a 16 bit reloc for the AVR that stores 8 bit pc relative
- short offset into 7 bits.
-
- -- : BFD_RELOC_AVR_13_PCREL
- This is a 16 bit reloc for the AVR that stores 13 bit pc relative
- short offset into 12 bits.
-
- -- : BFD_RELOC_AVR_16_PM
- This is a 16 bit reloc for the AVR that stores 17 bit value
- (usually program memory address) into 16 bits.
-
- -- : BFD_RELOC_AVR_LO8_LDI
- This is a 16 bit reloc for the AVR that stores 8 bit value (usually
- data memory address) into 8 bit immediate value of LDI insn.
-
- -- : BFD_RELOC_AVR_HI8_LDI
- This is a 16 bit reloc for the AVR that stores 8 bit value (high 8
- bit of data memory address) into 8 bit immediate value of LDI insn.
-
- -- : BFD_RELOC_AVR_HH8_LDI
- This is a 16 bit reloc for the AVR that stores 8 bit value (most
- high 8 bit of program memory address) into 8 bit immediate value
- of LDI insn.
-
- -- : BFD_RELOC_AVR_MS8_LDI
- This is a 16 bit reloc for the AVR that stores 8 bit value (most
- high 8 bit of 32 bit value) into 8 bit immediate value of LDI insn.
-
- -- : BFD_RELOC_AVR_LO8_LDI_NEG
- This is a 16 bit reloc for the AVR that stores negated 8 bit value
- (usually data memory address) into 8 bit immediate value of SUBI
- insn.
-
- -- : BFD_RELOC_AVR_HI8_LDI_NEG
- This is a 16 bit reloc for the AVR that stores negated 8 bit value
- (high 8 bit of data memory address) into 8 bit immediate value of
- SUBI insn.
-
- -- : BFD_RELOC_AVR_HH8_LDI_NEG
- This is a 16 bit reloc for the AVR that stores negated 8 bit value
- (most high 8 bit of program memory address) into 8 bit immediate
- value of LDI or SUBI insn.
-
- -- : BFD_RELOC_AVR_MS8_LDI_NEG
- This is a 16 bit reloc for the AVR that stores negated 8 bit value
- (msb of 32 bit value) into 8 bit immediate value of LDI insn.
-
- -- : BFD_RELOC_AVR_LO8_LDI_PM
- This is a 16 bit reloc for the AVR that stores 8 bit value (usually
- command address) into 8 bit immediate value of LDI insn.
-
- -- : BFD_RELOC_AVR_HI8_LDI_PM
- This is a 16 bit reloc for the AVR that stores 8 bit value (high 8
- bit of command address) into 8 bit immediate value of LDI insn.
-
- -- : BFD_RELOC_AVR_HH8_LDI_PM
- This is a 16 bit reloc for the AVR that stores 8 bit value (most
- high 8 bit of command address) into 8 bit immediate value of LDI
- insn.
-
- -- : BFD_RELOC_AVR_LO8_LDI_PM_NEG
- This is a 16 bit reloc for the AVR that stores negated 8 bit value
- (usually command address) into 8 bit immediate value of SUBI insn.
-
- -- : BFD_RELOC_AVR_HI8_LDI_PM_NEG
- This is a 16 bit reloc for the AVR that stores negated 8 bit value
- (high 8 bit of 16 bit command address) into 8 bit immediate value
- of SUBI insn.
-
- -- : BFD_RELOC_AVR_HH8_LDI_PM_NEG
- This is a 16 bit reloc for the AVR that stores negated 8 bit value
- (high 6 bit of 22 bit command address) into 8 bit immediate value
- of SUBI insn.
-
- -- : BFD_RELOC_AVR_CALL
- This is a 32 bit reloc for the AVR that stores 23 bit value into
- 22 bits.
-
- -- : BFD_RELOC_AVR_LDI
- This is a 16 bit reloc for the AVR that stores all needed bits for
- absolute addressing with ldi with overflow check to linktime
-
- -- : BFD_RELOC_AVR_6
- This is a 6 bit reloc for the AVR that stores offset for ldd/std
- instructions
-
- -- : BFD_RELOC_AVR_6_ADIW
- This is a 6 bit reloc for the AVR that stores offset for adiw/sbiw
- instructions
-
- -- : BFD_RELOC_390_12
- Direct 12 bit.
-
- -- : BFD_RELOC_390_GOT12
- 12 bit GOT offset.
-
- -- : BFD_RELOC_390_PLT32
- 32 bit PC relative PLT address.
-
- -- : BFD_RELOC_390_COPY
- Copy symbol at runtime.
-
- -- : BFD_RELOC_390_GLOB_DAT
- Create GOT entry.
-
- -- : BFD_RELOC_390_JMP_SLOT
- Create PLT entry.
-
- -- : BFD_RELOC_390_RELATIVE
- Adjust by program base.
-
- -- : BFD_RELOC_390_GOTPC
- 32 bit PC relative offset to GOT.
-
- -- : BFD_RELOC_390_GOT16
- 16 bit GOT offset.
-
- -- : BFD_RELOC_390_PC16DBL
- PC relative 16 bit shifted by 1.
-
- -- : BFD_RELOC_390_PLT16DBL
- 16 bit PC rel. PLT shifted by 1.
-
- -- : BFD_RELOC_390_PC32DBL
- PC relative 32 bit shifted by 1.
-
- -- : BFD_RELOC_390_PLT32DBL
- 32 bit PC rel. PLT shifted by 1.
-
- -- : BFD_RELOC_390_GOTPCDBL
- 32 bit PC rel. GOT shifted by 1.
-
- -- : BFD_RELOC_390_GOT64
- 64 bit GOT offset.
-
- -- : BFD_RELOC_390_PLT64
- 64 bit PC relative PLT address.
-
- -- : BFD_RELOC_390_GOTENT
- 32 bit rel. offset to GOT entry.
-
- -- : BFD_RELOC_390_GOTOFF64
- 64 bit offset to GOT.
-
- -- : BFD_RELOC_390_GOTPLT12
- 12-bit offset to symbol-entry within GOT, with PLT handling.
-
- -- : BFD_RELOC_390_GOTPLT16
- 16-bit offset to symbol-entry within GOT, with PLT handling.
-
- -- : BFD_RELOC_390_GOTPLT32
- 32-bit offset to symbol-entry within GOT, with PLT handling.
-
- -- : BFD_RELOC_390_GOTPLT64
- 64-bit offset to symbol-entry within GOT, with PLT handling.
-
- -- : BFD_RELOC_390_GOTPLTENT
- 32-bit rel. offset to symbol-entry within GOT, with PLT handling.
-
- -- : BFD_RELOC_390_PLTOFF16
- 16-bit rel. offset from the GOT to a PLT entry.
-
- -- : BFD_RELOC_390_PLTOFF32
- 32-bit rel. offset from the GOT to a PLT entry.
-
- -- : BFD_RELOC_390_PLTOFF64
- 64-bit rel. offset from the GOT to a PLT entry.
-
- -- : 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
- s390 tls relocations.
-
- -- : BFD_RELOC_390_20
- -- : BFD_RELOC_390_GOT20
- -- : BFD_RELOC_390_GOTPLT20
- -- : BFD_RELOC_390_TLS_GOTIE20
- Long displacement extension.
-
- -- : BFD_RELOC_IP2K_FR9
- Scenix IP2K - 9-bit register number / data address
-
- -- : BFD_RELOC_IP2K_BANK
- Scenix IP2K - 4-bit register/data bank number
-
- -- : BFD_RELOC_IP2K_ADDR16CJP
- Scenix IP2K - low 13 bits of instruction word address
-
- -- : BFD_RELOC_IP2K_PAGE3
- Scenix IP2K - high 3 bits of instruction word address
-
- -- : BFD_RELOC_IP2K_LO8DATA
- -- : BFD_RELOC_IP2K_HI8DATA
- -- : BFD_RELOC_IP2K_EX8DATA
- Scenix IP2K - ext/low/high 8 bits of data address
-
- -- : BFD_RELOC_IP2K_LO8INSN
- -- : BFD_RELOC_IP2K_HI8INSN
- Scenix IP2K - low/high 8 bits of instruction word address
-
- -- : BFD_RELOC_IP2K_PC_SKIP
- Scenix IP2K - even/odd PC modifier to modify snb pcl.0
-
- -- : BFD_RELOC_IP2K_TEXT
- Scenix IP2K - 16 bit word address in text section.
-
- -- : BFD_RELOC_IP2K_FR_OFFSET
- Scenix IP2K - 7-bit sp or dp offset
-
- -- : BFD_RELOC_VPE4KMATH_DATA
- -- : BFD_RELOC_VPE4KMATH_INSN
- Scenix VPE4K coprocessor - data/insn-space addressing
-
- -- : BFD_RELOC_VTABLE_INHERIT
- -- : BFD_RELOC_VTABLE_ENTRY
- These two relocations are used by the linker to determine which of
- the entries in a C++ virtual function table are actually used.
- When the -gc-sections option is given, the linker will zero out
- the entries that are not used, so that the code for those
- functions need not be included in the output.
-
- VTABLE_INHERIT is a zero-space relocation used to describe to the
- linker the inheritance tree of a C++ virtual function table. The
- relocation's symbol should be the parent class' vtable, and the
- relocation should be located at the child vtable.
-
- VTABLE_ENTRY is a zero-space relocation that describes the use of a
- virtual function table entry. The reloc's symbol should refer to
- the table of the class mentioned in the code. Off of that base,
- an offset describes the entry that is being used. For Rela hosts,
- this offset is stored in the reloc's addend. For Rel hosts, we
- are forced to put this offset in the reloc's section offset.
-
- -- : BFD_RELOC_IA64_IMM14
- -- : BFD_RELOC_IA64_IMM22
- -- : BFD_RELOC_IA64_IMM64
- -- : BFD_RELOC_IA64_DIR32MSB
- -- : BFD_RELOC_IA64_DIR32LSB
- -- : BFD_RELOC_IA64_DIR64MSB
- -- : BFD_RELOC_IA64_DIR64LSB
- -- : BFD_RELOC_IA64_GPREL22
- -- : BFD_RELOC_IA64_GPREL64I
- -- : BFD_RELOC_IA64_GPREL32MSB
- -- : BFD_RELOC_IA64_GPREL32LSB
- -- : BFD_RELOC_IA64_GPREL64MSB
- -- : BFD_RELOC_IA64_GPREL64LSB
- -- : BFD_RELOC_IA64_LTOFF22
- -- : BFD_RELOC_IA64_LTOFF64I
- -- : BFD_RELOC_IA64_PLTOFF22
- -- : BFD_RELOC_IA64_PLTOFF64I
- -- : BFD_RELOC_IA64_PLTOFF64MSB
- -- : BFD_RELOC_IA64_PLTOFF64LSB
- -- : BFD_RELOC_IA64_FPTR64I
- -- : BFD_RELOC_IA64_FPTR32MSB
- -- : BFD_RELOC_IA64_FPTR32LSB
- -- : BFD_RELOC_IA64_FPTR64MSB
- -- : BFD_RELOC_IA64_FPTR64LSB
- -- : BFD_RELOC_IA64_PCREL21B
- -- : BFD_RELOC_IA64_PCREL21BI
- -- : BFD_RELOC_IA64_PCREL21M
- -- : BFD_RELOC_IA64_PCREL21F
- -- : BFD_RELOC_IA64_PCREL22
- -- : BFD_RELOC_IA64_PCREL60B
- -- : BFD_RELOC_IA64_PCREL64I
- -- : BFD_RELOC_IA64_PCREL32MSB
- -- : BFD_RELOC_IA64_PCREL32LSB
- -- : BFD_RELOC_IA64_PCREL64MSB
- -- : BFD_RELOC_IA64_PCREL64LSB
- -- : BFD_RELOC_IA64_LTOFF_FPTR22
- -- : BFD_RELOC_IA64_LTOFF_FPTR64I
- -- : BFD_RELOC_IA64_LTOFF_FPTR32MSB
- -- : BFD_RELOC_IA64_LTOFF_FPTR32LSB
- -- : BFD_RELOC_IA64_LTOFF_FPTR64MSB
- -- : BFD_RELOC_IA64_LTOFF_FPTR64LSB
- -- : BFD_RELOC_IA64_SEGREL32MSB
- -- : BFD_RELOC_IA64_SEGREL32LSB
- -- : BFD_RELOC_IA64_SEGREL64MSB
- -- : BFD_RELOC_IA64_SEGREL64LSB
- -- : BFD_RELOC_IA64_SECREL32MSB
- -- : BFD_RELOC_IA64_SECREL32LSB
- -- : BFD_RELOC_IA64_SECREL64MSB
- -- : BFD_RELOC_IA64_SECREL64LSB
- -- : BFD_RELOC_IA64_REL32MSB
- -- : BFD_RELOC_IA64_REL32LSB
- -- : BFD_RELOC_IA64_REL64MSB
- -- : BFD_RELOC_IA64_REL64LSB
- -- : BFD_RELOC_IA64_LTV32MSB
- -- : BFD_RELOC_IA64_LTV32LSB
- -- : BFD_RELOC_IA64_LTV64MSB
- -- : BFD_RELOC_IA64_LTV64LSB
- -- : BFD_RELOC_IA64_IPLTMSB
- -- : BFD_RELOC_IA64_IPLTLSB
- -- : BFD_RELOC_IA64_COPY
- -- : BFD_RELOC_IA64_LTOFF22X
- -- : BFD_RELOC_IA64_LDXMOV
- -- : BFD_RELOC_IA64_TPREL14
- -- : BFD_RELOC_IA64_TPREL22
- -- : BFD_RELOC_IA64_TPREL64I
- -- : BFD_RELOC_IA64_TPREL64MSB
- -- : BFD_RELOC_IA64_TPREL64LSB
- -- : BFD_RELOC_IA64_LTOFF_TPREL22
- -- : BFD_RELOC_IA64_DTPMOD64MSB
- -- : BFD_RELOC_IA64_DTPMOD64LSB
- -- : BFD_RELOC_IA64_LTOFF_DTPMOD22
- -- : BFD_RELOC_IA64_DTPREL14
- -- : BFD_RELOC_IA64_DTPREL22
- -- : BFD_RELOC_IA64_DTPREL64I
- -- : BFD_RELOC_IA64_DTPREL32MSB
- -- : BFD_RELOC_IA64_DTPREL32LSB
- -- : BFD_RELOC_IA64_DTPREL64MSB
- -- : BFD_RELOC_IA64_DTPREL64LSB
- -- : BFD_RELOC_IA64_LTOFF_DTPREL22
- Intel IA64 Relocations.
-
- -- : BFD_RELOC_M68HC11_HI8
- Motorola 68HC11 reloc. This is the 8 bit high part of an absolute
- address.
-
- -- : BFD_RELOC_M68HC11_LO8
- Motorola 68HC11 reloc. This is the 8 bit low part of an absolute
- address.
-
- -- : BFD_RELOC_M68HC11_3B
- Motorola 68HC11 reloc. This is the 3 bit of a value.
-
- -- : 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.
-
- -- : 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.
-
- -- : 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).
-
- -- : 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.
-
- -- : 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).
-
- -- : BFD_RELOC_M68HC12_5B
- Motorola 68HC12 reloc. This is the 5 bits of a value.
-
- -- : BFD_RELOC_16C_NUM08
- -- : BFD_RELOC_16C_NUM08_C
- -- : BFD_RELOC_16C_NUM16
- -- : BFD_RELOC_16C_NUM16_C
- -- : BFD_RELOC_16C_NUM32
- -- : BFD_RELOC_16C_NUM32_C
- -- : BFD_RELOC_16C_DISP04
- -- : BFD_RELOC_16C_DISP04_C
- -- : BFD_RELOC_16C_DISP08
- -- : BFD_RELOC_16C_DISP08_C
- -- : BFD_RELOC_16C_DISP16
- -- : BFD_RELOC_16C_DISP16_C
- -- : BFD_RELOC_16C_DISP24
- -- : BFD_RELOC_16C_DISP24_C
- -- : BFD_RELOC_16C_DISP24a
- -- : BFD_RELOC_16C_DISP24a_C
- -- : BFD_RELOC_16C_REG04
- -- : BFD_RELOC_16C_REG04_C
- -- : BFD_RELOC_16C_REG04a
- -- : BFD_RELOC_16C_REG04a_C
- -- : BFD_RELOC_16C_REG14
- -- : BFD_RELOC_16C_REG14_C
- -- : BFD_RELOC_16C_REG16
- -- : BFD_RELOC_16C_REG16_C
- -- : BFD_RELOC_16C_REG20
- -- : BFD_RELOC_16C_REG20_C
- -- : BFD_RELOC_16C_ABS20
- -- : BFD_RELOC_16C_ABS20_C
- -- : BFD_RELOC_16C_ABS24
- -- : BFD_RELOC_16C_ABS24_C
- -- : BFD_RELOC_16C_IMM04
- -- : BFD_RELOC_16C_IMM04_C
- -- : BFD_RELOC_16C_IMM16
- -- : BFD_RELOC_16C_IMM16_C
- -- : BFD_RELOC_16C_IMM20
- -- : BFD_RELOC_16C_IMM20_C
- -- : BFD_RELOC_16C_IMM24
- -- : BFD_RELOC_16C_IMM24_C
- -- : BFD_RELOC_16C_IMM32
- -- : BFD_RELOC_16C_IMM32_C
- NS CR16C Relocations.
-
- -- : BFD_RELOC_CRX_REL4
- -- : BFD_RELOC_CRX_REL8
- -- : BFD_RELOC_CRX_REL8_CMP
- -- : BFD_RELOC_CRX_REL16
- -- : BFD_RELOC_CRX_REL24
- -- : BFD_RELOC_CRX_REL32
- -- : BFD_RELOC_CRX_REGREL12
- -- : BFD_RELOC_CRX_REGREL22
- -- : BFD_RELOC_CRX_REGREL28
- -- : BFD_RELOC_CRX_REGREL32
- -- : BFD_RELOC_CRX_ABS16
- -- : BFD_RELOC_CRX_ABS32
- -- : BFD_RELOC_CRX_NUM8
- -- : BFD_RELOC_CRX_NUM16
- -- : BFD_RELOC_CRX_NUM32
- -- : BFD_RELOC_CRX_IMM16
- -- : BFD_RELOC_CRX_IMM32
- -- : BFD_RELOC_CRX_SWITCH8
- -- : BFD_RELOC_CRX_SWITCH16
- -- : BFD_RELOC_CRX_SWITCH32
- NS CRX Relocations.
-
- -- : BFD_RELOC_CRIS_BDISP8
- -- : BFD_RELOC_CRIS_UNSIGNED_5
- -- : BFD_RELOC_CRIS_SIGNED_6
- -- : BFD_RELOC_CRIS_UNSIGNED_6
- -- : BFD_RELOC_CRIS_SIGNED_8
- -- : BFD_RELOC_CRIS_UNSIGNED_8
- -- : BFD_RELOC_CRIS_SIGNED_16
- -- : BFD_RELOC_CRIS_UNSIGNED_16
- -- : BFD_RELOC_CRIS_LAPCQ_OFFSET
- -- : BFD_RELOC_CRIS_UNSIGNED_4
- These relocs are only used within the CRIS assembler. They are not
- (at present) written to any object files.
-
- -- : BFD_RELOC_CRIS_COPY
- -- : BFD_RELOC_CRIS_GLOB_DAT
- -- : BFD_RELOC_CRIS_JUMP_SLOT
- -- : BFD_RELOC_CRIS_RELATIVE
- Relocs used in ELF shared libraries for CRIS.
-
- -- : BFD_RELOC_CRIS_32_GOT
- 32-bit offset to symbol-entry within GOT.
-
- -- : BFD_RELOC_CRIS_16_GOT
- 16-bit offset to symbol-entry within GOT.
-
- -- : BFD_RELOC_CRIS_32_GOTPLT
- 32-bit offset to symbol-entry within GOT, with PLT handling.
-
- -- : BFD_RELOC_CRIS_16_GOTPLT
- 16-bit offset to symbol-entry within GOT, with PLT handling.
-
- -- : BFD_RELOC_CRIS_32_GOTREL
- 32-bit offset to symbol, relative to GOT.
-
- -- : BFD_RELOC_CRIS_32_PLT_GOTREL
- 32-bit offset to symbol with PLT entry, relative to GOT.
-
- -- : BFD_RELOC_CRIS_32_PLT_PCREL
- 32-bit offset to symbol with PLT entry, relative to this
- relocation.
-
- -- : BFD_RELOC_860_COPY
- -- : BFD_RELOC_860_GLOB_DAT
- -- : BFD_RELOC_860_JUMP_SLOT
- -- : BFD_RELOC_860_RELATIVE
- -- : BFD_RELOC_860_PC26
- -- : BFD_RELOC_860_PLT26
- -- : BFD_RELOC_860_PC16
- -- : BFD_RELOC_860_LOW0
- -- : BFD_RELOC_860_SPLIT0
- -- : BFD_RELOC_860_LOW1
- -- : BFD_RELOC_860_SPLIT1
- -- : BFD_RELOC_860_LOW2
- -- : BFD_RELOC_860_SPLIT2
- -- : BFD_RELOC_860_LOW3
- -- : BFD_RELOC_860_LOGOT0
- -- : BFD_RELOC_860_SPGOT0
- -- : BFD_RELOC_860_LOGOT1
- -- : BFD_RELOC_860_SPGOT1
- -- : BFD_RELOC_860_LOGOTOFF0
- -- : BFD_RELOC_860_SPGOTOFF0
- -- : BFD_RELOC_860_LOGOTOFF1
- -- : BFD_RELOC_860_SPGOTOFF1
- -- : BFD_RELOC_860_LOGOTOFF2
- -- : BFD_RELOC_860_LOGOTOFF3
- -- : BFD_RELOC_860_LOPC
- -- : BFD_RELOC_860_HIGHADJ
- -- : BFD_RELOC_860_HAGOT
- -- : BFD_RELOC_860_HAGOTOFF
- -- : BFD_RELOC_860_HAPC
- -- : BFD_RELOC_860_HIGH
- -- : BFD_RELOC_860_HIGOT
- -- : BFD_RELOC_860_HIGOTOFF
- Intel i860 Relocations.
-
- -- : BFD_RELOC_OPENRISC_ABS_26
- -- : BFD_RELOC_OPENRISC_REL_26
- OpenRISC Relocations.
-
- -- : BFD_RELOC_H8_DIR16A8
- -- : BFD_RELOC_H8_DIR16R8
- -- : BFD_RELOC_H8_DIR24A8
- -- : BFD_RELOC_H8_DIR24R8
- -- : BFD_RELOC_H8_DIR32A16
- H8 elf Relocations.
-
- -- : BFD_RELOC_XSTORMY16_REL_12
- -- : BFD_RELOC_XSTORMY16_12
- -- : BFD_RELOC_XSTORMY16_24
- -- : BFD_RELOC_XSTORMY16_FPTR16
- Sony Xstormy16 Relocations.
-
- -- : BFD_RELOC_XC16X_PAG
- -- : BFD_RELOC_XC16X_POF
- -- : BFD_RELOC_XC16X_SEG
- -- : BFD_RELOC_XC16X_SOF
- Infineon Relocations.
-
- -- : BFD_RELOC_VAX_GLOB_DAT
- -- : BFD_RELOC_VAX_JMP_SLOT
- -- : BFD_RELOC_VAX_RELATIVE
- Relocations used by VAX ELF.
-
- -- : BFD_RELOC_MT_PC16
- Morpho MT - 16 bit immediate relocation.
-
- -- : BFD_RELOC_MT_HI16
- Morpho MT - Hi 16 bits of an address.
-
- -- : BFD_RELOC_MT_LO16
- Morpho MT - Low 16 bits of an address.
-
- -- : BFD_RELOC_MT_GNU_VTINHERIT
- Morpho MT - Used to tell the linker which vtable entries are used.
-
- -- : BFD_RELOC_MT_GNU_VTENTRY
- Morpho MT - Used to tell the linker which vtable entries are used.
-
- -- : BFD_RELOC_MT_PCINSN8
- Morpho MT - 8 bit immediate relocation.
-
- -- : BFD_RELOC_MSP430_10_PCREL
- -- : BFD_RELOC_MSP430_16_PCREL
- -- : BFD_RELOC_MSP430_16
- -- : BFD_RELOC_MSP430_16_PCREL_BYTE
- -- : BFD_RELOC_MSP430_16_BYTE
- -- : BFD_RELOC_MSP430_2X_PCREL
- -- : BFD_RELOC_MSP430_RL_PCREL
- msp430 specific relocation codes
-
- -- : BFD_RELOC_IQ2000_OFFSET_16
- -- : BFD_RELOC_IQ2000_OFFSET_21
- -- : BFD_RELOC_IQ2000_UHI16
- IQ2000 Relocations.
-
- -- : 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.
-
- -- : BFD_RELOC_XTENSA_GLOB_DAT
- -- : BFD_RELOC_XTENSA_JMP_SLOT
- -- : BFD_RELOC_XTENSA_RELATIVE
- Xtensa relocations for ELF shared objects.
-
- -- : 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.
-
- -- : BFD_RELOC_XTENSA_DIFF8
- -- : BFD_RELOC_XTENSA_DIFF16
- -- : BFD_RELOC_XTENSA_DIFF32
- Xtensa relocations to mark the difference of two local symbols.
- These are only needed to support linker relaxation and can be
- ignored when not relaxing. The field is set to the value of the
- difference assuming no relaxation. The relocation encodes the
- position of the first symbol so the linker can determine whether
- to adjust the field value.
-
- -- : BFD_RELOC_XTENSA_SLOT0_OP
- -- : BFD_RELOC_XTENSA_SLOT1_OP
- -- : BFD_RELOC_XTENSA_SLOT2_OP
- -- : BFD_RELOC_XTENSA_SLOT3_OP
- -- : BFD_RELOC_XTENSA_SLOT4_OP
- -- : BFD_RELOC_XTENSA_SLOT5_OP
- -- : BFD_RELOC_XTENSA_SLOT6_OP
- -- : BFD_RELOC_XTENSA_SLOT7_OP
- -- : BFD_RELOC_XTENSA_SLOT8_OP
- -- : BFD_RELOC_XTENSA_SLOT9_OP
- -- : BFD_RELOC_XTENSA_SLOT10_OP
- -- : BFD_RELOC_XTENSA_SLOT11_OP
- -- : BFD_RELOC_XTENSA_SLOT12_OP
- -- : BFD_RELOC_XTENSA_SLOT13_OP
- -- : BFD_RELOC_XTENSA_SLOT14_OP
- Generic Xtensa relocations for instruction operands. Only the slot
- number is encoded in the relocation. The relocation applies to the
- last PC-relative immediate operand, or if there are no PC-relative
- immediates, to the last immediate operand.
-
- -- : BFD_RELOC_XTENSA_SLOT0_ALT
- -- : BFD_RELOC_XTENSA_SLOT1_ALT
- -- : BFD_RELOC_XTENSA_SLOT2_ALT
- -- : BFD_RELOC_XTENSA_SLOT3_ALT
- -- : BFD_RELOC_XTENSA_SLOT4_ALT
- -- : BFD_RELOC_XTENSA_SLOT5_ALT
- -- : BFD_RELOC_XTENSA_SLOT6_ALT
- -- : BFD_RELOC_XTENSA_SLOT7_ALT
- -- : BFD_RELOC_XTENSA_SLOT8_ALT
- -- : BFD_RELOC_XTENSA_SLOT9_ALT
- -- : BFD_RELOC_XTENSA_SLOT10_ALT
- -- : BFD_RELOC_XTENSA_SLOT11_ALT
- -- : BFD_RELOC_XTENSA_SLOT12_ALT
- -- : BFD_RELOC_XTENSA_SLOT13_ALT
- -- : BFD_RELOC_XTENSA_SLOT14_ALT
- Alternate Xtensa relocations. Only the slot is encoded in the
- relocation. The meaning of these relocations is opcode-specific.
-
- -- : BFD_RELOC_XTENSA_OP0
- -- : BFD_RELOC_XTENSA_OP1
- -- : BFD_RELOC_XTENSA_OP2
- Xtensa relocations for backward compatibility. These have all been
- replaced by BFD_RELOC_XTENSA_SLOT0_OP.
-
- -- : 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.
-
- -- : 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.
-
- -- : BFD_RELOC_Z80_DISP8
- 8 bit signed offset in (ix+d) or (iy+d).
-
- -- : BFD_RELOC_Z8K_DISP7
- DJNZ offset.
-
- -- : BFD_RELOC_Z8K_CALLR
- CALR offset.
-
- -- : BFD_RELOC_Z8K_IMM4L
- 4 bit value.
-
-
- typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
-
-2.10.2.2 `bfd_reloc_type_lookup'
-................................
-
-*Synopsis*
- reloc_howto_type *bfd_reloc_type_lookup
- (bfd *abfd, bfd_reloc_code_real_type code);
- *Description*
-Return a pointer to a howto structure which, when invoked, will perform
-the relocation CODE on data from the architecture noted.
-
-2.10.2.3 `bfd_default_reloc_type_lookup'
-........................................
-
-*Synopsis*
- reloc_howto_type *bfd_default_reloc_type_lookup
- (bfd *abfd, bfd_reloc_code_real_type code);
- *Description*
-Provides a default relocation lookup routine for any architecture.
-
-2.10.2.4 `bfd_get_reloc_code_name'
-..................................
-
-*Synopsis*
- const char *bfd_get_reloc_code_name (bfd_reloc_code_real_type code);
- *Description*
-Provides a printable name for the supplied relocation code. Useful
-mainly for printing error messages.
-
-2.10.2.5 `bfd_generic_relax_section'
-....................................
-
-*Synopsis*
- bfd_boolean bfd_generic_relax_section
- (bfd *abfd,
- asection *section,
- struct bfd_link_info *,
- bfd_boolean *);
- *Description*
-Provides default handling for relaxing for back ends which don't do
-relaxing.
-
-2.10.2.6 `bfd_generic_gc_sections'
-..................................
-
-*Synopsis*
- bfd_boolean bfd_generic_gc_sections
- (bfd *, struct bfd_link_info *);
- *Description*
-Provides default handling for relaxing for back ends which don't do
-section gc - i.e., does nothing.
-
-2.10.2.7 `bfd_generic_merge_sections'
-.....................................
-
-*Synopsis*
- bfd_boolean bfd_generic_merge_sections
- (bfd *, struct bfd_link_info *);
- *Description*
-Provides default handling for SEC_MERGE section merging for back ends
-which don't have SEC_MERGE support - i.e., does nothing.
-
-2.10.2.8 `bfd_generic_get_relocated_section_contents'
-.....................................................
-
-*Synopsis*
- bfd_byte *bfd_generic_get_relocated_section_contents
- (bfd *abfd,
- struct bfd_link_info *link_info,
- struct bfd_link_order *link_order,
- bfd_byte *data,
- bfd_boolean relocatable,
- asymbol **symbols);
- *Description*
-Provides default handling of relocation effort for back ends which
-can't be bothered to do it efficiently.
-
-
-File: bfd.info, Node: Core Files, Next: Targets, Prev: Relocations, Up: BFD front end
-
-2.11 Core files
-===============
-
-2.11.1 Core file functions
---------------------------
-
-*Description*
-These are functions pertaining to core files.
-
-2.11.1.1 `bfd_core_file_failing_command'
-........................................
-
-*Synopsis*
- const char *bfd_core_file_failing_command (bfd *abfd);
- *Description*
-Return a read-only string explaining which program was running when it
-failed and produced the core file ABFD.
-
-2.11.1.2 `bfd_core_file_failing_signal'
-.......................................
-
-*Synopsis*
- int bfd_core_file_failing_signal (bfd *abfd);
- *Description*
-Returns the signal number which caused the core dump which generated
-the file the BFD ABFD is attached to.
-
-2.11.1.3 `core_file_matches_executable_p'
-.........................................
-
-*Synopsis*
- bfd_boolean core_file_matches_executable_p
- (bfd *core_bfd, bfd *exec_bfd);
- *Description*
-Return `TRUE' if the core file attached to CORE_BFD was generated by a
-run of the executable file attached to EXEC_BFD, `FALSE' otherwise.
-
-2.11.1.4 `generic_core_file_matches_executable_p'
-.................................................
-
-*Synopsis*
- bfd_boolean generic_core_file_matches_executable_p
- (bfd *core_bfd, bfd *exec_bfd);
- *Description*
-Return TRUE if the core file attached to CORE_BFD was generated by a
-run of the executable file attached to EXEC_BFD. The match is based on
-executable basenames only.
-
- Note: When not able to determine the core file failing command or
-the executable name, we still return TRUE even though we're not sure
-that core file and executable match. This is to avoid generating a
-false warning in situations where we really don't know whether they
-match or not.
-
-
-File: bfd.info, Node: Targets, Next: Architectures, Prev: Core Files, Up: BFD front end
-
-2.12 Targets
-============
-
-*Description*
-Each port of BFD to a different machine requires the creation of a
-target back end. All the back end provides to the root part of BFD is a
-structure containing pointers to functions which perform certain low
-level operations on files. BFD translates the applications's requests
-through a pointer into calls to the back end routines.
-
- When a file is opened with `bfd_openr', its format and target are
-unknown. BFD uses various mechanisms to determine how to interpret the
-file. The operations performed are:
-
- * Create a BFD by calling the internal routine `_bfd_new_bfd', then
- call `bfd_find_target' with the target string supplied to
- `bfd_openr' and the new BFD pointer.
-
- * If a null target string was provided to `bfd_find_target', look up
- the environment variable `GNUTARGET' and use that as the target
- string.
-
- * If the target string is still `NULL', or the target string is
- `default', then use the first item in the target vector as the
- target type, and set `target_defaulted' in the BFD to cause
- `bfd_check_format' to loop through all the targets. *Note
- bfd_target::. *Note Formats::.
-
- * Otherwise, inspect the elements in the target vector one by one,
- until a match on target name is found. When found, use it.
-
- * Otherwise return the error `bfd_error_invalid_target' to
- `bfd_openr'.
-
- * `bfd_openr' attempts to open the file using `bfd_open_file', and
- returns the BFD.
- Once the BFD has been opened and the target selected, the file
-format may be determined. This is done by calling `bfd_check_format' on
-the BFD with a suggested format. If `target_defaulted' has been set,
-each possible target type is tried to see if it recognizes the
-specified format. `bfd_check_format' returns `TRUE' when the caller
-guesses right.
-
-* Menu:
-
-* bfd_target::
-
-
-File: bfd.info, Node: bfd_target, Prev: Targets, Up: Targets
-
-2.12.1 bfd_target
------------------
-
-*Description*
-This structure contains everything that BFD knows about a target. It
-includes things like its byte order, name, and which routines to call
-to do various operations.
-
- Every BFD points to a target structure with its `xvec' member.
-
- The macros below are used to dispatch to functions through the
-`bfd_target' vector. They are used in a number of macros further down
-in `bfd.h', and are also used when calling various routines by hand
-inside the BFD implementation. The ARGLIST argument must be
-parenthesized; it contains all the arguments to the called function.
-
- They make the documentation (more) unpleasant to read, so if someone
-wants to fix this and not break the above, please do.
- #define BFD_SEND(bfd, message, arglist) \
- ((*((bfd)->xvec->message)) arglist)
-
- #ifdef DEBUG_BFD_SEND
- #undef BFD_SEND
- #define BFD_SEND(bfd, message, arglist) \
- (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
- ((*((bfd)->xvec->message)) arglist) : \
- (bfd_assert (__FILE__,__LINE__), NULL))
- #endif
- For operations which index on the BFD format:
- #define BFD_SEND_FMT(bfd, message, arglist) \
- (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist)
-
- #ifdef DEBUG_BFD_SEND
- #undef BFD_SEND_FMT
- #define BFD_SEND_FMT(bfd, message, arglist) \
- (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
- (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) : \
- (bfd_assert (__FILE__,__LINE__), NULL))
- #endif
- This is the structure which defines the type of BFD this is. The
-`xvec' member of the struct `bfd' itself points here. Each module that
-implements access to a different target under BFD, defines one of these.
-
- FIXME, these names should be rationalised with the names of the
-entry points which call them. Too bad we can't have one macro to define
-them both!
- enum bfd_flavour
- {
- bfd_target_unknown_flavour,
- bfd_target_aout_flavour,
- bfd_target_coff_flavour,
- bfd_target_ecoff_flavour,
- bfd_target_xcoff_flavour,
- bfd_target_elf_flavour,
- bfd_target_ieee_flavour,
- bfd_target_nlm_flavour,
- bfd_target_oasys_flavour,
- bfd_target_tekhex_flavour,
- bfd_target_srec_flavour,
- bfd_target_ihex_flavour,
- bfd_target_som_flavour,
- bfd_target_os9k_flavour,
- bfd_target_versados_flavour,
- bfd_target_msdos_flavour,
- bfd_target_ovax_flavour,
- bfd_target_evax_flavour,
- bfd_target_mmo_flavour,
- bfd_target_mach_o_flavour,
- bfd_target_pef_flavour,
- bfd_target_pef_xlib_flavour,
- bfd_target_sym_flavour
- };
-
- enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
-
- /* Forward declaration. */
- typedef struct bfd_link_info _bfd_link_info;
-
- typedef struct bfd_target
- {
- /* Identifies the kind of target, e.g., SunOS4, Ultrix, etc. */
- char *name;
-
- /* The "flavour" of a back end is a general indication about
- the contents of a file. */
- enum bfd_flavour flavour;
-
- /* The order of bytes within the data area of a file. */
- enum bfd_endian byteorder;
-
- /* The order of bytes within the header parts of a file. */
- enum bfd_endian header_byteorder;
-
- /* A mask of all the flags which an executable may have set -
- from the set `BFD_NO_FLAGS', `HAS_RELOC', ...`D_PAGED'. */
- flagword object_flags;
-
- /* A mask of all the flags which a section may have set - from
- the set `SEC_NO_FLAGS', `SEC_ALLOC', ...`SET_NEVER_LOAD'. */
- flagword section_flags;
-
- /* The character normally found at the front of a symbol.
- (if any), perhaps `_'. */
- char symbol_leading_char;
-
- /* The pad character for file names within an archive header. */
- char ar_pad_char;
-
- /* The maximum number of characters in an archive header. */
- unsigned short ar_max_namelen;
-
- /* Entries for byte swapping for data. These are different from the
- other entry points, since they don't take a BFD as the first argument.
- Certain other handlers could do the same. */
- bfd_uint64_t (*bfd_getx64) (const void *);
- bfd_int64_t (*bfd_getx_signed_64) (const void *);
- void (*bfd_putx64) (bfd_uint64_t, void *);
- bfd_vma (*bfd_getx32) (const void *);
- bfd_signed_vma (*bfd_getx_signed_32) (const void *);
- void (*bfd_putx32) (bfd_vma, void *);
- bfd_vma (*bfd_getx16) (const void *);
- bfd_signed_vma (*bfd_getx_signed_16) (const void *);
- void (*bfd_putx16) (bfd_vma, void *);
-
- /* Byte swapping for the headers. */
- bfd_uint64_t (*bfd_h_getx64) (const void *);
- bfd_int64_t (*bfd_h_getx_signed_64) (const void *);
- void (*bfd_h_putx64) (bfd_uint64_t, void *);
- bfd_vma (*bfd_h_getx32) (const void *);
- bfd_signed_vma (*bfd_h_getx_signed_32) (const void *);
- void (*bfd_h_putx32) (bfd_vma, void *);
- bfd_vma (*bfd_h_getx16) (const void *);
- bfd_signed_vma (*bfd_h_getx_signed_16) (const void *);
- void (*bfd_h_putx16) (bfd_vma, void *);
-
- /* Format dependent routines: these are vectors of entry points
- within the target vector structure, one for each format to check. */
-
- /* Check the format of a file being read. Return a `bfd_target *' or zero. */
- const struct bfd_target *(*_bfd_check_format[bfd_type_end]) (bfd *);
-
- /* Set the format of a file being written. */
- bfd_boolean (*_bfd_set_format[bfd_type_end]) (bfd *);
-
- /* Write cached information into a file being written, at `bfd_close'. */
- bfd_boolean (*_bfd_write_contents[bfd_type_end]) (bfd *);
- The general target vector. These vectors are initialized using the
-BFD_JUMP_TABLE macros.
-
- /* Generic entry points. */
- #define BFD_JUMP_TABLE_GENERIC(NAME) \
- NAME##_close_and_cleanup, \
- NAME##_bfd_free_cached_info, \
- NAME##_new_section_hook, \
- NAME##_get_section_contents, \
- NAME##_get_section_contents_in_window
-
- /* Called when the BFD is being closed to do any necessary cleanup. */
- bfd_boolean (*_close_and_cleanup) (bfd *);
- /* Ask the BFD to free all cached information. */
- bfd_boolean (*_bfd_free_cached_info) (bfd *);
- /* Called when a new section is created. */
- bfd_boolean (*_new_section_hook) (bfd *, sec_ptr);
- /* Read the contents of a section. */
- bfd_boolean (*_bfd_get_section_contents)
- (bfd *, sec_ptr, void *, file_ptr, bfd_size_type);
- bfd_boolean (*_bfd_get_section_contents_in_window)
- (bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type);
-
- /* Entry points to copy private data. */
- #define BFD_JUMP_TABLE_COPY(NAME) \
- NAME##_bfd_copy_private_bfd_data, \
- NAME##_bfd_merge_private_bfd_data, \
- _bfd_generic_init_private_section_data, \
- NAME##_bfd_copy_private_section_data, \
- NAME##_bfd_copy_private_symbol_data, \
- NAME##_bfd_copy_private_header_data, \
- NAME##_bfd_set_private_flags, \
- NAME##_bfd_print_private_bfd_data
-
- /* Called to copy BFD general private data from one object file
- to another. */
- bfd_boolean (*_bfd_copy_private_bfd_data) (bfd *, bfd *);
- /* Called to merge BFD general private data from one object file
- to a common output file when linking. */
- bfd_boolean (*_bfd_merge_private_bfd_data) (bfd *, bfd *);
- /* Called to initialize BFD private section data from one object file
- to another. */
- #define bfd_init_private_section_data(ibfd, isec, obfd, osec, link_info) \
- BFD_SEND (obfd, _bfd_init_private_section_data, (ibfd, isec, obfd, osec, link_info))
- bfd_boolean (*_bfd_init_private_section_data)
- (bfd *, sec_ptr, bfd *, sec_ptr, struct bfd_link_info *);
- /* Called to copy BFD private section data from one object file
- to another. */
- bfd_boolean (*_bfd_copy_private_section_data)
- (bfd *, sec_ptr, bfd *, sec_ptr);
- /* Called to copy BFD private symbol data from one symbol
- to another. */
- bfd_boolean (*_bfd_copy_private_symbol_data)
- (bfd *, asymbol *, bfd *, asymbol *);
- /* Called to copy BFD private header data from one object file
- to another. */
- bfd_boolean (*_bfd_copy_private_header_data)
- (bfd *, bfd *);
- /* Called to set private backend flags. */
- bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword);
-
- /* Called to print private BFD data. */
- bfd_boolean (*_bfd_print_private_bfd_data) (bfd *, void *);
-
- /* Core file entry points. */
- #define BFD_JUMP_TABLE_CORE(NAME) \
- NAME##_core_file_failing_command, \
- NAME##_core_file_failing_signal, \
- NAME##_core_file_matches_executable_p
-
- char * (*_core_file_failing_command) (bfd *);
- int (*_core_file_failing_signal) (bfd *);
- bfd_boolean (*_core_file_matches_executable_p) (bfd *, bfd *);
-
- /* Archive entry points. */
- #define BFD_JUMP_TABLE_ARCHIVE(NAME) \
- NAME##_slurp_armap, \
- NAME##_slurp_extended_name_table, \
- NAME##_construct_extended_name_table, \
- NAME##_truncate_arname, \
- NAME##_write_armap, \
- NAME##_read_ar_hdr, \
- NAME##_openr_next_archived_file, \
- NAME##_get_elt_at_index, \
- NAME##_generic_stat_arch_elt, \
- NAME##_update_armap_timestamp
-
- bfd_boolean (*_bfd_slurp_armap) (bfd *);
- bfd_boolean (*_bfd_slurp_extended_name_table) (bfd *);
- bfd_boolean (*_bfd_construct_extended_name_table)
- (bfd *, char **, bfd_size_type *, const char **);
- void (*_bfd_truncate_arname) (bfd *, const char *, char *);
- bfd_boolean (*write_armap)
- (bfd *, unsigned int, struct orl *, unsigned int, int);
- void * (*_bfd_read_ar_hdr_fn) (bfd *);
- bfd * (*openr_next_archived_file) (bfd *, bfd *);
- #define bfd_get_elt_at_index(b,i) BFD_SEND (b, _bfd_get_elt_at_index, (b,i))
- bfd * (*_bfd_get_elt_at_index) (bfd *, symindex);
- int (*_bfd_stat_arch_elt) (bfd *, struct stat *);
- bfd_boolean (*_bfd_update_armap_timestamp) (bfd *);
-
- /* Entry points used for symbols. */
- #define BFD_JUMP_TABLE_SYMBOLS(NAME) \
- NAME##_get_symtab_upper_bound, \
- NAME##_canonicalize_symtab, \
- NAME##_make_empty_symbol, \
- NAME##_print_symbol, \
- NAME##_get_symbol_info, \
- NAME##_bfd_is_local_label_name, \
- NAME##_bfd_is_target_special_symbol, \
- NAME##_get_lineno, \
- NAME##_find_nearest_line, \
- _bfd_generic_find_line, \
- NAME##_find_inliner_info, \
- NAME##_bfd_make_debug_symbol, \
- NAME##_read_minisymbols, \
- NAME##_minisymbol_to_symbol
-
- 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 *);
- bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *);
- alent * (*_get_lineno) (bfd *, struct bfd_symbol *);
- bfd_boolean (*_bfd_find_nearest_line)
- (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma,
- const char **, const char **, unsigned int *);
- bfd_boolean (*_bfd_find_line)
- (bfd *, struct bfd_symbol **, struct bfd_symbol *,
- const char **, unsigned int *);
- bfd_boolean (*_bfd_find_inliner_info)
- (bfd *, const char **, const char **, unsigned int *);
- /* Back-door to allow format-aware applications to create debug symbols
- while using BFD for everything else. Currently used by the assembler
- when creating COFF files. */
- asymbol * (*_bfd_make_debug_symbol)
- (bfd *, void *, unsigned long size);
- #define bfd_read_minisymbols(b, d, m, s) \
- BFD_SEND (b, _read_minisymbols, (b, d, m, s))
- long (*_read_minisymbols)
- (bfd *, bfd_boolean, void **, unsigned int *);
- #define bfd_minisymbol_to_symbol(b, d, m, f) \
- BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f))
- asymbol * (*_minisymbol_to_symbol)
- (bfd *, bfd_boolean, const void *, asymbol *);
-
- /* Routines for relocs. */
- #define BFD_JUMP_TABLE_RELOCS(NAME) \
- NAME##_get_reloc_upper_bound, \
- NAME##_canonicalize_reloc, \
- NAME##_bfd_reloc_type_lookup
-
- long (*_get_reloc_upper_bound) (bfd *, sec_ptr);
- long (*_bfd_canonicalize_reloc)
- (bfd *, sec_ptr, arelent **, struct bfd_symbol **);
- /* See documentation on reloc types. */
- reloc_howto_type *
- (*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
-
- /* Routines used when writing an object file. */
- #define BFD_JUMP_TABLE_WRITE(NAME) \
- NAME##_set_arch_mach, \
- NAME##_set_section_contents
-
- bfd_boolean (*_bfd_set_arch_mach)
- (bfd *, enum bfd_architecture, unsigned long);
- bfd_boolean (*_bfd_set_section_contents)
- (bfd *, sec_ptr, const void *, file_ptr, bfd_size_type);
-
- /* Routines used by the linker. */
- #define BFD_JUMP_TABLE_LINK(NAME) \
- NAME##_sizeof_headers, \
- NAME##_bfd_get_relocated_section_contents, \
- NAME##_bfd_relax_section, \
- NAME##_bfd_link_hash_table_create, \
- NAME##_bfd_link_hash_table_free, \
- NAME##_bfd_link_add_symbols, \
- NAME##_bfd_link_just_syms, \
- NAME##_bfd_final_link, \
- NAME##_bfd_link_split_section, \
- NAME##_bfd_gc_sections, \
- NAME##_bfd_merge_sections, \
- NAME##_bfd_is_group_section, \
- NAME##_bfd_discard_group, \
- NAME##_section_already_linked \
-
- int (*_bfd_sizeof_headers) (bfd *, bfd_boolean);
- bfd_byte * (*_bfd_get_relocated_section_contents)
- (bfd *, struct bfd_link_info *, struct bfd_link_order *,
- bfd_byte *, bfd_boolean, struct bfd_symbol **);
-
- bfd_boolean (*_bfd_relax_section)
- (bfd *, struct bfd_section *, struct bfd_link_info *, bfd_boolean *);
-
- /* Create a hash table for the linker. Different backends store
- different information in this table. */
- struct bfd_link_hash_table *
- (*_bfd_link_hash_table_create) (bfd *);
-
- /* Release the memory associated with the linker hash table. */
- void (*_bfd_link_hash_table_free) (struct bfd_link_hash_table *);
-
- /* Add symbols from this object file into the hash table. */
- bfd_boolean (*_bfd_link_add_symbols) (bfd *, struct bfd_link_info *);
-
- /* Indicate that we are only retrieving symbol values from this section. */
- void (*_bfd_link_just_syms) (asection *, struct bfd_link_info *);
-
- /* Do a link based on the link_order structures attached to each
- section of the BFD. */
- bfd_boolean (*_bfd_final_link) (bfd *, struct bfd_link_info *);
-
- /* Should this section be split up into smaller pieces during linking. */
- bfd_boolean (*_bfd_link_split_section) (bfd *, struct bfd_section *);
-
- /* Remove sections that are not referenced from the output. */
- bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *);
-
- /* Attempt to merge SEC_MERGE sections. */
- bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *);
-
- /* Is this section a member of a group? */
- bfd_boolean (*_bfd_is_group_section) (bfd *, const struct bfd_section *);
-
- /* Discard members of a group. */
- bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *);
-
- /* Check if SEC has been already linked during a reloceatable or
- final link. */
- void (*_section_already_linked) (bfd *, struct bfd_section *);
-
- /* Routines to handle dynamic symbols and relocs. */
- #define BFD_JUMP_TABLE_DYNAMIC(NAME) \
- NAME##_get_dynamic_symtab_upper_bound, \
- NAME##_canonicalize_dynamic_symtab, \
- NAME##_get_synthetic_symtab, \
- NAME##_get_dynamic_reloc_upper_bound, \
- NAME##_canonicalize_dynamic_reloc
-
- /* Get the amount of memory required to hold the dynamic symbols. */
- long (*_bfd_get_dynamic_symtab_upper_bound) (bfd *);
- /* Read in the dynamic symbols. */
- long (*_bfd_canonicalize_dynamic_symtab)
- (bfd *, struct bfd_symbol **);
- /* Create synthetized symbols. */
- long (*_bfd_get_synthetic_symtab)
- (bfd *, long, struct bfd_symbol **, long, struct bfd_symbol **,
- struct bfd_symbol **);
- /* Get the amount of memory required to hold the dynamic relocs. */
- long (*_bfd_get_dynamic_reloc_upper_bound) (bfd *);
- /* Read in the dynamic relocs. */
- long (*_bfd_canonicalize_dynamic_reloc)
- (bfd *, arelent **, struct bfd_symbol **);
- A pointer to an alternative bfd_target in case the current one is not
-satisfactory. This can happen when the target cpu supports both big
-and little endian code, and target chosen by the linker has the wrong
-endianness. The function open_output() in ld/ldlang.c uses this field
-to find an alternative output format that is suitable.
- /* Opposite endian version of this target. */
- const struct bfd_target * alternative_target;
-
- /* Data for use by back-end routines, which isn't
- generic enough to belong in this structure. */
- const void *backend_data;
-
- } bfd_target;
-
-2.12.1.1 `bfd_set_default_target'
-.................................
-
-*Synopsis*
- bfd_boolean bfd_set_default_target (const char *name);
- *Description*
-Set the default target vector to use when recognizing a BFD. This
-takes the name of the target, which may be a BFD target name or a
-configuration triplet.
-
-2.12.1.2 `bfd_find_target'
-..........................
-
-*Synopsis*
- const bfd_target *bfd_find_target (const char *target_name, bfd *abfd);
- *Description*
-Return a pointer to the transfer vector for the object target named
-TARGET_NAME. If TARGET_NAME is `NULL', choose the one in the
-environment variable `GNUTARGET'; if that is null or not defined, then
-choose the first entry in the target list. Passing in the string
-"default" or setting the environment variable to "default" will cause
-the first entry in the target list to be returned, and
-"target_defaulted" will be set in the BFD. This causes
-`bfd_check_format' to loop over all the targets to find the one that
-matches the file being read.
-
-2.12.1.3 `bfd_target_list'
-..........................
-
-*Synopsis*
- const char ** bfd_target_list (void);
- *Description*
-Return a freshly malloced NULL-terminated vector of the names of all
-the valid BFD targets. Do not modify the names.
-
-2.12.1.4 `bfd_seach_for_target'
-...............................
-
-*Synopsis*
- const bfd_target *bfd_search_for_target
- (int (*search_func) (const bfd_target *, void *),
- void *);
- *Description*
-Return a pointer to the first transfer vector in the list of transfer
-vectors maintained by BFD that produces a non-zero result when passed
-to the function SEARCH_FUNC. The parameter DATA is passed, unexamined,
-to the search function.
-
-
-File: bfd.info, Node: Architectures, Next: Opening and Closing, Prev: Targets, Up: BFD front end
-
-2.13 Architectures
-==================
-
-BFD keeps one atom in a BFD describing the architecture of the data
-attached to the BFD: a pointer to a `bfd_arch_info_type'.
-
- Pointers to structures can be requested independently of a BFD so
-that an architecture's information can be interrogated without access
-to an open BFD.
-
- The architecture information is provided by each architecture
-package. The set of default architectures is selected by the macro
-`SELECT_ARCHITECTURES'. This is normally set up in the
-`config/TARGET.mt' file of your choice. If the name is not defined,
-then all the architectures supported are included.
-
- When BFD starts up, all the architectures are called with an
-initialize method. It is up to the architecture back end to insert as
-many items into the list of architectures as it wants to; generally
-this would be one for each machine and one for the default case (an
-item with a machine field of 0).
-
- BFD's idea of an architecture is implemented in `archures.c'.
-
-2.13.1 bfd_architecture
------------------------
-
-*Description*
-This enum gives the object file's CPU architecture, in a global
-sense--i.e., what processor family does it belong to? Another field
-indicates which processor within the family is in use. The machine
-gives a number which distinguishes different versions of the
-architecture, containing, for example, 2 and 3 for Intel i960 KA and
-i960 KB, and 68020 and 68030 for Motorola 68020 and 68030.
- enum bfd_architecture
- {
- bfd_arch_unknown, /* File arch not known. */
- bfd_arch_obscure, /* Arch known, not one of these. */
- bfd_arch_m68k, /* Motorola 68xxx */
- #define bfd_mach_m68000 1
- #define bfd_mach_m68008 2
- #define bfd_mach_m68010 3
- #define bfd_mach_m68020 4
- #define bfd_mach_m68030 5
- #define bfd_mach_m68040 6
- #define bfd_mach_m68060 7
- #define bfd_mach_cpu32 8
- #define bfd_mach_mcf_isa_a_nodiv 9
- #define bfd_mach_mcf_isa_a 10
- #define bfd_mach_mcf_isa_a_mac 11
- #define bfd_mach_mcf_isa_a_emac 12
- #define bfd_mach_mcf_isa_aplus 13
- #define bfd_mach_mcf_isa_aplus_mac 14
- #define bfd_mach_mcf_isa_aplus_emac 15
- #define bfd_mach_mcf_isa_b_nousp 16
- #define bfd_mach_mcf_isa_b_nousp_mac 17
- #define bfd_mach_mcf_isa_b_nousp_emac 18
- #define bfd_mach_mcf_isa_b 19
- #define bfd_mach_mcf_isa_b_mac 20
- #define bfd_mach_mcf_isa_b_emac 21
- #define bfd_mach_mcf_isa_b_float 22
- #define bfd_mach_mcf_isa_b_float_mac 23
- #define bfd_mach_mcf_isa_b_float_emac 24
- bfd_arch_vax, /* DEC Vax */
- bfd_arch_i960, /* Intel 960 */
- /* The order of the following is important.
- lower number indicates a machine type that
- only accepts a subset of the instructions
- available to machines with higher numbers.
- The exception is the "ca", which is
- incompatible with all other machines except
- "core". */
-
- #define bfd_mach_i960_core 1
- #define bfd_mach_i960_ka_sa 2
- #define bfd_mach_i960_kb_sb 3
- #define bfd_mach_i960_mc 4
- #define bfd_mach_i960_xa 5
- #define bfd_mach_i960_ca 6
- #define bfd_mach_i960_jx 7
- #define bfd_mach_i960_hx 8
-
- bfd_arch_or32, /* OpenRISC 32 */
-
- bfd_arch_sparc, /* SPARC */
- #define bfd_mach_sparc 1
- /* The difference between v8plus and v9 is that v9 is a true 64 bit env. */
- #define bfd_mach_sparc_sparclet 2
- #define bfd_mach_sparc_sparclite 3
- #define bfd_mach_sparc_v8plus 4
- #define bfd_mach_sparc_v8plusa 5 /* with ultrasparc add'ns. */
- #define bfd_mach_sparc_sparclite_le 6
- #define bfd_mach_sparc_v9 7
- #define bfd_mach_sparc_v9a 8 /* with ultrasparc add'ns. */
- #define bfd_mach_sparc_v8plusb 9 /* with cheetah add'ns. */
- #define bfd_mach_sparc_v9b 10 /* with cheetah add'ns. */
- /* Nonzero if MACH has the v9 instruction set. */
- #define bfd_mach_sparc_v9_p(mach) \
- ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \
- && (mach) != bfd_mach_sparc_sparclite_le)
- /* Nonzero if MACH is a 64 bit sparc architecture. */
- #define bfd_mach_sparc_64bit_p(mach) \
- ((mach) >= bfd_mach_sparc_v9 && (mach) != bfd_mach_sparc_v8plusb)
- bfd_arch_mips, /* MIPS Rxxxx */
- #define bfd_mach_mips3000 3000
- #define bfd_mach_mips3900 3900
- #define bfd_mach_mips4000 4000
- #define bfd_mach_mips4010 4010
- #define bfd_mach_mips4100 4100
- #define bfd_mach_mips4111 4111
- #define bfd_mach_mips4120 4120
- #define bfd_mach_mips4300 4300
- #define bfd_mach_mips4400 4400
- #define bfd_mach_mips4600 4600
- #define bfd_mach_mips4650 4650
- #define bfd_mach_mips5000 5000
- #define bfd_mach_mips5400 5400
- #define bfd_mach_mips5500 5500
- #define bfd_mach_mips6000 6000
- #define bfd_mach_mips7000 7000
- #define bfd_mach_mips8000 8000
- #define bfd_mach_mips9000 9000
- #define bfd_mach_mips10000 10000
- #define bfd_mach_mips12000 12000
- #define bfd_mach_mips16 16
- #define bfd_mach_mips5 5
- #define bfd_mach_mips_sb1 12310201 /* octal 'SB', 01 */
- #define bfd_mach_mipsisa32 32
- #define bfd_mach_mipsisa32r2 33
- #define bfd_mach_mipsisa64 64
- #define bfd_mach_mipsisa64r2 65
- bfd_arch_i386, /* Intel 386 */
- #define bfd_mach_i386_i386 1
- #define bfd_mach_i386_i8086 2
- #define bfd_mach_i386_i386_intel_syntax 3
- #define bfd_mach_x86_64 64
- #define bfd_mach_x86_64_intel_syntax 65
- bfd_arch_we32k, /* AT&T WE32xxx */
- bfd_arch_tahoe, /* CCI/Harris Tahoe */
- bfd_arch_i860, /* Intel 860 */
- bfd_arch_i370, /* IBM 360/370 Mainframes */
- bfd_arch_romp, /* IBM ROMP PC/RT */
- bfd_arch_convex, /* Convex */
- bfd_arch_m88k, /* Motorola 88xxx */
- bfd_arch_m98k, /* Motorola 98xxx */
- bfd_arch_pyramid, /* Pyramid Technology */
- bfd_arch_h8300, /* Renesas H8/300 (formerly Hitachi H8/300) */
- #define bfd_mach_h8300 1
- #define bfd_mach_h8300h 2
- #define bfd_mach_h8300s 3
- #define bfd_mach_h8300hn 4
- #define bfd_mach_h8300sn 5
- #define bfd_mach_h8300sx 6
- #define bfd_mach_h8300sxn 7
- bfd_arch_pdp11, /* DEC PDP-11 */
- bfd_arch_powerpc, /* PowerPC */
- #define bfd_mach_ppc 32
- #define bfd_mach_ppc64 64
- #define bfd_mach_ppc_403 403
- #define bfd_mach_ppc_403gc 4030
- #define bfd_mach_ppc_505 505
- #define bfd_mach_ppc_601 601
- #define bfd_mach_ppc_602 602
- #define bfd_mach_ppc_603 603
- #define bfd_mach_ppc_ec603e 6031
- #define bfd_mach_ppc_604 604
- #define bfd_mach_ppc_620 620
- #define bfd_mach_ppc_630 630
- #define bfd_mach_ppc_750 750
- #define bfd_mach_ppc_860 860
- #define bfd_mach_ppc_a35 35
- #define bfd_mach_ppc_rs64ii 642
- #define bfd_mach_ppc_rs64iii 643
- #define bfd_mach_ppc_7400 7400
- #define bfd_mach_ppc_e500 500
- bfd_arch_rs6000, /* IBM RS/6000 */
- #define bfd_mach_rs6k 6000
- #define bfd_mach_rs6k_rs1 6001
- #define bfd_mach_rs6k_rsc 6003
- #define bfd_mach_rs6k_rs2 6002
- bfd_arch_hppa, /* HP PA RISC */
- #define bfd_mach_hppa10 10
- #define bfd_mach_hppa11 11
- #define bfd_mach_hppa20 20
- #define bfd_mach_hppa20w 25
- bfd_arch_d10v, /* Mitsubishi D10V */
- #define bfd_mach_d10v 1
- #define bfd_mach_d10v_ts2 2
- #define bfd_mach_d10v_ts3 3
- bfd_arch_d30v, /* Mitsubishi D30V */
- bfd_arch_dlx, /* DLX */
- bfd_arch_m68hc11, /* Motorola 68HC11 */
- bfd_arch_m68hc12, /* Motorola 68HC12 */
- #define bfd_mach_m6812_default 0
- #define bfd_mach_m6812 1
- #define bfd_mach_m6812s 2
- bfd_arch_z8k, /* Zilog Z8000 */
- #define bfd_mach_z8001 1
- #define bfd_mach_z8002 2
- bfd_arch_h8500, /* Renesas H8/500 (formerly Hitachi H8/500) */
- bfd_arch_sh, /* Renesas / SuperH SH (formerly Hitachi SH) */
- #define bfd_mach_sh 1
- #define bfd_mach_sh2 0x20
- #define bfd_mach_sh_dsp 0x2d
- #define bfd_mach_sh2a 0x2a
- #define bfd_mach_sh2a_nofpu 0x2b
- #define bfd_mach_sh2a_nofpu_or_sh4_nommu_nofpu 0x2a1
- #define bfd_mach_sh2a_nofpu_or_sh3_nommu 0x2a2
- #define bfd_mach_sh2a_or_sh4 0x2a3
- #define bfd_mach_sh2a_or_sh3e 0x2a4
- #define bfd_mach_sh2e 0x2e
- #define bfd_mach_sh3 0x30
- #define bfd_mach_sh3_nommu 0x31
- #define bfd_mach_sh3_dsp 0x3d
- #define bfd_mach_sh3e 0x3e
- #define bfd_mach_sh4 0x40
- #define bfd_mach_sh4_nofpu 0x41
- #define bfd_mach_sh4_nommu_nofpu 0x42
- #define bfd_mach_sh4a 0x4a
- #define bfd_mach_sh4a_nofpu 0x4b
- #define bfd_mach_sh4al_dsp 0x4d
- #define bfd_mach_sh5 0x50
- bfd_arch_alpha, /* Dec Alpha */
- #define bfd_mach_alpha_ev4 0x10
- #define bfd_mach_alpha_ev5 0x20
- #define bfd_mach_alpha_ev6 0x30
- bfd_arch_arm, /* Advanced Risc Machines ARM. */
- #define bfd_mach_arm_unknown 0
- #define bfd_mach_arm_2 1
- #define bfd_mach_arm_2a 2
- #define bfd_mach_arm_3 3
- #define bfd_mach_arm_3M 4
- #define bfd_mach_arm_4 5
- #define bfd_mach_arm_4T 6
- #define bfd_mach_arm_5 7
- #define bfd_mach_arm_5T 8
- #define bfd_mach_arm_5TE 9
- #define bfd_mach_arm_XScale 10
- #define bfd_mach_arm_ep9312 11
- #define bfd_mach_arm_iWMMXt 12
- bfd_arch_ns32k, /* National Semiconductors ns32000 */
- bfd_arch_w65, /* WDC 65816 */
- bfd_arch_tic30, /* Texas Instruments TMS320C30 */
- bfd_arch_tic4x, /* Texas Instruments TMS320C3X/4X */
- #define bfd_mach_tic3x 30
- #define bfd_mach_tic4x 40
- bfd_arch_tic54x, /* Texas Instruments TMS320C54X */
- bfd_arch_tic80, /* TI TMS320c80 (MVP) */
- bfd_arch_v850, /* NEC V850 */
- #define bfd_mach_v850 1
- #define bfd_mach_v850e 'E'
- #define bfd_mach_v850e1 '1'
- bfd_arch_arc, /* ARC Cores */
- #define bfd_mach_arc_5 5
- #define bfd_mach_arc_6 6
- #define bfd_mach_arc_7 7
- #define bfd_mach_arc_8 8
- bfd_arch_m32c, /* Renesas M16C/M32C. */
- #define bfd_mach_m16c 0x75
- #define bfd_mach_m32c 0x78
- bfd_arch_m32r, /* Renesas M32R (formerly Mitsubishi M32R/D) */
- #define bfd_mach_m32r 1 /* For backwards compatibility. */
- #define bfd_mach_m32rx 'x'
- #define bfd_mach_m32r2 '2'
- bfd_arch_mn10200, /* Matsushita MN10200 */
- bfd_arch_mn10300, /* Matsushita MN10300 */
- #define bfd_mach_mn10300 300
- #define bfd_mach_am33 330
- #define bfd_mach_am33_2 332
- bfd_arch_fr30,
- #define bfd_mach_fr30 0x46523330
- bfd_arch_frv,
- #define bfd_mach_frv 1
- #define bfd_mach_frvsimple 2
- #define bfd_mach_fr300 300
- #define bfd_mach_fr400 400
- #define bfd_mach_fr450 450
- #define bfd_mach_frvtomcat 499 /* fr500 prototype */
- #define bfd_mach_fr500 500
- #define bfd_mach_fr550 550
- bfd_arch_mcore,
- bfd_arch_ia64, /* HP/Intel ia64 */
- #define bfd_mach_ia64_elf64 64
- #define bfd_mach_ia64_elf32 32
- bfd_arch_ip2k, /* Ubicom IP2K microcontrollers. */
- #define bfd_mach_ip2022 1
- #define bfd_mach_ip2022ext 2
- bfd_arch_iq2000, /* Vitesse IQ2000. */
- #define bfd_mach_iq2000 1
- #define bfd_mach_iq10 2
- bfd_arch_mt,
- #define bfd_mach_ms1 1
- #define bfd_mach_mrisc2 2
- #define bfd_mach_ms2 3
- bfd_arch_pj,
- bfd_arch_avr, /* Atmel AVR microcontrollers. */
- #define bfd_mach_avr1 1
- #define bfd_mach_avr2 2
- #define bfd_mach_avr3 3
- #define bfd_mach_avr4 4
- #define bfd_mach_avr5 5
- bfd_arch_bfin, /* ADI Blackfin */
- #define bfd_mach_bfin 1
- bfd_arch_cr16c, /* National Semiconductor CompactRISC. */
- #define bfd_mach_cr16c 1
- bfd_arch_crx, /* National Semiconductor CRX. */
- #define bfd_mach_crx 1
- bfd_arch_cris, /* Axis CRIS */
- #define bfd_mach_cris_v0_v10 255
- #define bfd_mach_cris_v32 32
- #define bfd_mach_cris_v10_v32 1032
- bfd_arch_s390, /* IBM s390 */
- #define bfd_mach_s390_31 31
- #define bfd_mach_s390_64 64
- bfd_arch_openrisc, /* OpenRISC */
- bfd_arch_mmix, /* Donald Knuth's educational processor. */
- bfd_arch_xstormy16,
- #define bfd_mach_xstormy16 1
- bfd_arch_msp430, /* Texas Instruments MSP430 architecture. */
- #define bfd_mach_msp11 11
- #define bfd_mach_msp110 110
- #define bfd_mach_msp12 12
- #define bfd_mach_msp13 13
- #define bfd_mach_msp14 14
- #define bfd_mach_msp15 15
- #define bfd_mach_msp16 16
- #define bfd_mach_msp21 21
- #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_xc16x, /* Infineon's XC16X Series. */
- #define bfd_mach_xc16x 1
- #define bfd_mach_xc16xl 2
- #define bfd_mach_xc16xs 3
- bfd_arch_xtensa, /* Tensilica's Xtensa cores. */
- #define bfd_mach_xtensa 1
- bfd_arch_maxq, /* Dallas MAXQ 10/20 */
- #define bfd_mach_maxq10 10
- #define bfd_mach_maxq20 20
- bfd_arch_z80,
- #define bfd_mach_z80strict 1 /* No undocumented opcodes. */
- #define bfd_mach_z80 3 /* With ixl, ixh, iyl, and iyh. */
- #define bfd_mach_z80full 7 /* All undocumented instructions. */
- #define bfd_mach_r800 11 /* R800: successor with multiplication. */
- bfd_arch_last
- };
-
-2.13.2 bfd_arch_info
---------------------
-
-*Description*
-This structure contains information on architectures for use within BFD.
-
- typedef struct bfd_arch_info
- {
- int bits_per_word;
- int bits_per_address;
- int bits_per_byte;
- enum bfd_architecture arch;
- unsigned long mach;
- const char *arch_name;
- const char *printable_name;
- unsigned int section_align_power;
- /* TRUE if this is the default machine for the architecture.
- The default arch should be the first entry for an arch so that
- all the entries for that arch can be accessed via `next'. */
- bfd_boolean the_default;
- const struct bfd_arch_info * (*compatible)
- (const struct bfd_arch_info *a, const struct bfd_arch_info *b);
-
- bfd_boolean (*scan) (const struct bfd_arch_info *, const char *);
-
- const struct bfd_arch_info *next;
- }
- bfd_arch_info_type;
-
-2.13.2.1 `bfd_printable_name'
-.............................
-
-*Synopsis*
- const char *bfd_printable_name (bfd *abfd);
- *Description*
-Return a printable string representing the architecture and machine
-from the pointer to the architecture info structure.
-
-2.13.2.2 `bfd_scan_arch'
-........................
-
-*Synopsis*
- const bfd_arch_info_type *bfd_scan_arch (const char *string);
- *Description*
-Figure out if BFD supports any cpu which could be described with the
-name STRING. Return a pointer to an `arch_info' structure if a machine
-is found, otherwise NULL.
-
-2.13.2.3 `bfd_arch_list'
-........................
-
-*Synopsis*
- const char **bfd_arch_list (void);
- *Description*
-Return a freshly malloced NULL-terminated vector of the names of all
-the valid BFD architectures. Do not modify the names.
-
-2.13.2.4 `bfd_arch_get_compatible'
-..................................
-
-*Synopsis*
- const bfd_arch_info_type *bfd_arch_get_compatible
- (const bfd *abfd, const bfd *bbfd, bfd_boolean accept_unknowns);
- *Description*
-Determine whether two BFDs' architectures and machine types are
-compatible. Calculates the lowest common denominator between the two
-architectures and machine types implied by the BFDs and returns a
-pointer to an `arch_info' structure describing the compatible machine.
-
-2.13.2.5 `bfd_default_arch_struct'
-..................................
-
-*Description*
-The `bfd_default_arch_struct' is an item of `bfd_arch_info_type' which
-has been initialized to a fairly generic state. A BFD starts life by
-pointing to this structure, until the correct back end has determined
-the real architecture of the file.
- extern const bfd_arch_info_type bfd_default_arch_struct;
-
-2.13.2.6 `bfd_set_arch_info'
-............................
-
-*Synopsis*
- void bfd_set_arch_info (bfd *abfd, const bfd_arch_info_type *arg);
- *Description*
-Set the architecture info of ABFD to ARG.
-
-2.13.2.7 `bfd_default_set_arch_mach'
-....................................
-
-*Synopsis*
- bfd_boolean bfd_default_set_arch_mach
- (bfd *abfd, enum bfd_architecture arch, unsigned long mach);
- *Description*
-Set the architecture and machine type in BFD ABFD to ARCH and MACH.
-Find the correct pointer to a structure and insert it into the
-`arch_info' pointer.
-
-2.13.2.8 `bfd_get_arch'
-.......................
-
-*Synopsis*
- enum bfd_architecture bfd_get_arch (bfd *abfd);
- *Description*
-Return the enumerated type which describes the BFD ABFD's architecture.
-
-2.13.2.9 `bfd_get_mach'
-.......................
-
-*Synopsis*
- unsigned long bfd_get_mach (bfd *abfd);
- *Description*
-Return the long type which describes the BFD ABFD's machine.
-
-2.13.2.10 `bfd_arch_bits_per_byte'
-..................................
-
-*Synopsis*
- unsigned int bfd_arch_bits_per_byte (bfd *abfd);
- *Description*
-Return the number of bits in one of the BFD ABFD's architecture's bytes.
-
-2.13.2.11 `bfd_arch_bits_per_address'
-.....................................
-
-*Synopsis*
- unsigned int bfd_arch_bits_per_address (bfd *abfd);
- *Description*
-Return the number of bits in one of the BFD ABFD's architecture's
-addresses.
-
-2.13.2.12 `bfd_default_compatible'
-..................................
-
-*Synopsis*
- const bfd_arch_info_type *bfd_default_compatible
- (const bfd_arch_info_type *a, const bfd_arch_info_type *b);
- *Description*
-The default function for testing for compatibility.
-
-2.13.2.13 `bfd_default_scan'
-............................
-
-*Synopsis*
- bfd_boolean bfd_default_scan
- (const struct bfd_arch_info *info, const char *string);
- *Description*
-The default function for working out whether this is an architecture
-hit and a machine hit.
-
-2.13.2.14 `bfd_get_arch_info'
-.............................
-
-*Synopsis*
- const bfd_arch_info_type *bfd_get_arch_info (bfd *abfd);
- *Description*
-Return the architecture info struct in ABFD.
-
-2.13.2.15 `bfd_lookup_arch'
-...........................
-
-*Synopsis*
- const bfd_arch_info_type *bfd_lookup_arch
- (enum bfd_architecture arch, unsigned long machine);
- *Description*
-Look for the architecture info structure which matches the arguments
-ARCH and MACHINE. A machine of 0 matches the machine/architecture
-structure which marks itself as the default.
-
-2.13.2.16 `bfd_printable_arch_mach'
-...................................
-
-*Synopsis*
- const char *bfd_printable_arch_mach
- (enum bfd_architecture arch, unsigned long machine);
- *Description*
-Return a printable string representing the architecture and machine
-type.
-
- This routine is depreciated.
-
-2.13.2.17 `bfd_octets_per_byte'
-...............................
-
-*Synopsis*
- unsigned int bfd_octets_per_byte (bfd *abfd);
- *Description*
-Return the number of octets (8-bit quantities) per target byte (minimum
-addressable unit). In most cases, this will be one, but some DSP
-targets have 16, 32, or even 48 bits per byte.
-
-2.13.2.18 `bfd_arch_mach_octets_per_byte'
-.........................................
-
-*Synopsis*
- unsigned int bfd_arch_mach_octets_per_byte
- (enum bfd_architecture arch, unsigned long machine);
- *Description*
-See bfd_octets_per_byte.
-
- This routine is provided for those cases where a bfd * is not
-available
-
-
-File: bfd.info, Node: Opening and Closing, Next: Internal, Prev: Architectures, Up: BFD front end
-
-2.14 Opening and closing BFDs
-=============================
-
-2.14.1 Functions for opening and closing
-----------------------------------------
-
-2.14.1.1 `bfd_fopen'
-....................
-
-*Synopsis*
- bfd *bfd_fopen (const char *filename, const char *target,
- const char *mode, int fd);
- *Description*
-Open the file FILENAME with the target TARGET. Return a pointer to the
-created BFD. If FD is not -1, then `fdopen' is used to open the file;
-otherwise, `fopen' is used. MODE is passed directly to `fopen' or
-`fdopen'.
-
- Calls `bfd_find_target', so TARGET is interpreted as by that
-function.
-
- The new BFD is marked as cacheable iff FD is -1.
-
- If `NULL' is returned then an error has occured. Possible errors
-are `bfd_error_no_memory', `bfd_error_invalid_target' or `system_call'
-error.
-
-2.14.1.2 `bfd_openr'
-....................
-
-*Synopsis*
- bfd *bfd_openr (const char *filename, const char *target);
- *Description*
-Open the file FILENAME (using `fopen') with the target TARGET. Return
-a pointer to the created BFD.
-
- Calls `bfd_find_target', so TARGET is interpreted as by that
-function.
-
- If `NULL' is returned then an error has occured. Possible errors
-are `bfd_error_no_memory', `bfd_error_invalid_target' or `system_call'
-error.
-
-2.14.1.3 `bfd_fdopenr'
-......................
-
-*Synopsis*
- bfd *bfd_fdopenr (const char *filename, const char *target, int fd);
- *Description*
-`bfd_fdopenr' is to `bfd_fopenr' much like `fdopen' is to `fopen'. It
-opens a BFD on a file already described by the 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 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'.
-
-2.14.1.4 `bfd_openstreamr'
-..........................
-
-*Synopsis*
- bfd *bfd_openstreamr (const char *, const char *, void *);
- *Description*
-Open a BFD for read access on an existing stdio stream. When the BFD
-is passed to `bfd_close', the stream will be closed.
-
-2.14.1.5 `bfd_openr_iovec'
-..........................
-
-*Synopsis*
- bfd *bfd_openr_iovec (const char *filename, const char *target,
- void *(*open) (struct bfd *nbfd,
- void *open_closure),
- void *open_closure,
- file_ptr (*pread) (struct bfd *nbfd,
- void *stream,
- void *buf,
- file_ptr nbytes,
- file_ptr offset),
- int (*close) (struct bfd *nbfd,
- void *stream));
- *Description*
-Create and return a BFD backed by a read-only STREAM. The STREAM is
-created using OPEN, accessed using PREAD and destroyed using CLOSE.
-
- Calls `bfd_find_target', so TARGET is interpreted as by that
-function.
-
- Calls OPEN (which can call `bfd_zalloc' and `bfd_get_filename') to
-obtain the read-only stream backing the BFD. OPEN either succeeds
-returning the non-`NULL' STREAM, or fails returning `NULL' (setting
-`bfd_error').
-
- Calls PREAD to request NBYTES of data from STREAM starting at OFFSET
-(e.g., via a call to `bfd_read'). PREAD either succeeds returning the
-number of bytes read (which can be less than NBYTES when end-of-file),
-or fails returning -1 (setting `bfd_error').
-
- Calls CLOSE when the BFD is later closed using `bfd_close'. CLOSE
-either succeeds returning 0, or fails returning -1 (setting
-`bfd_error').
-
- If `bfd_openr_iovec' returns `NULL' then an error has occurred.
-Possible errors are `bfd_error_no_memory', `bfd_error_invalid_target'
-and `bfd_error_system_call'.
-
-2.14.1.6 `bfd_openw'
-....................
-
-*Synopsis*
- bfd *bfd_openw (const char *filename, const char *target);
- *Description*
-Create a BFD, associated with file FILENAME, using the file format
-TARGET, and return a pointer to it.
-
- Possible errors are `bfd_error_system_call', `bfd_error_no_memory',
-`bfd_error_invalid_target'.
-
-2.14.1.7 `bfd_close'
-....................
-
-*Synopsis*
- bfd_boolean bfd_close (bfd *abfd);
- *Description*
-Close a BFD. If the BFD was open for writing, then pending operations
-are completed and the file written out and closed. If the created file
-is executable, then `chmod' is called to mark it as such.
-
- All memory attached to the BFD is released.
-
- The file descriptor associated with the BFD is closed (even if it
-was passed in to BFD by `bfd_fdopenr').
-
- *Returns*
-`TRUE' is returned if all is ok, otherwise `FALSE'.
-
-2.14.1.8 `bfd_close_all_done'
-.............................
-
-*Synopsis*
- bfd_boolean bfd_close_all_done (bfd *);
- *Description*
-Close a BFD. Differs from `bfd_close' since it does not complete any
-pending operations. This routine would be used if the application had
-just used BFD for swapping and didn't want to use any of the writing
-code.
-
- If the created file is executable, then `chmod' is called to mark it
-as such.
-
- All memory attached to the BFD is released.
-
- *Returns*
-`TRUE' is returned if all is ok, otherwise `FALSE'.
-
-2.14.1.9 `bfd_create'
-.....................
-
-*Synopsis*
- bfd *bfd_create (const char *filename, bfd *templ);
- *Description*
-Create a new BFD in the manner of `bfd_openw', but without opening a
-file. The new BFD takes the target from the target used by TEMPLATE.
-The format is always set to `bfd_object'.
-
-2.14.1.10 `bfd_make_writable'
-.............................
-
-*Synopsis*
- bfd_boolean bfd_make_writable (bfd *abfd);
- *Description*
-Takes a BFD as created by `bfd_create' and converts it into one like as
-returned by `bfd_openw'. It does this by converting the BFD to
-BFD_IN_MEMORY. It's assumed that you will call `bfd_make_readable' on
-this bfd later.
-
- *Returns*
-`TRUE' is returned if all is ok, otherwise `FALSE'.
-
-2.14.1.11 `bfd_make_readable'
-.............................
-
-*Synopsis*
- bfd_boolean bfd_make_readable (bfd *abfd);
- *Description*
-Takes a BFD as created by `bfd_create' and `bfd_make_writable' and
-converts it into one like as returned by `bfd_openr'. It does this by
-writing the contents out to the memory buffer, then reversing the
-direction.
-
- *Returns*
-`TRUE' is returned if all is ok, otherwise `FALSE'.
-
-2.14.1.12 `bfd_alloc'
-.....................
-
-*Synopsis*
- void *bfd_alloc (bfd *abfd, bfd_size_type wanted);
- *Description*
-Allocate a block of WANTED bytes of memory attached to `abfd' and
-return a pointer to it.
-
-2.14.1.13 `bfd_alloc2'
-......................
-
-*Synopsis*
- void *bfd_alloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size);
- *Description*
-Allocate a block of NMEMB elements of SIZE bytes each of memory
-attached to `abfd' and return a pointer to it.
-
-2.14.1.14 `bfd_zalloc'
-......................
-
-*Synopsis*
- void *bfd_zalloc (bfd *abfd, bfd_size_type wanted);
- *Description*
-Allocate a block of WANTED bytes of zeroed memory attached to `abfd'
-and return a pointer to it.
-
-2.14.1.15 `bfd_zalloc2'
-.......................
-
-*Synopsis*
- void *bfd_zalloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size);
- *Description*
-Allocate a block of NMEMB elements of SIZE bytes each of zeroed memory
-attached to `abfd' and return a pointer to it.
-
-2.14.1.16 `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 CRC value by computing and adding in the crc32
-for LEN bytes of BUF.
-
- *Returns*
-Return the updated CRC32 value.
-
-2.14.1.17 `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 ABFD. Return NULL if no such info found, otherwise
-return filename and update CRC32_OUT.
-
-2.14.1.18 `separate_debug_file_exists'
-......................................
-
-*Synopsis*
- bfd_boolean separate_debug_file_exists
- (char *name, unsigned long crc32);
- *Description*
-Checks to see if NAME is a file and if its contents match CRC32.
-
-2.14.1.19 `find_separate_debug_file'
-....................................
-
-*Synopsis*
- char *find_separate_debug_file (bfd *abfd);
- *Description*
-Searches ABFD for a reference to separate debugging information, scans
-various locations in the filesystem, including the file tree rooted at
-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.
-
-2.14.1.20 `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 DIR, and if found
-returns the full filename.
-
- If 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.
-
-2.14.1.21 `bfd_create_gnu_debuglink_section'
-............................................
-
-*Synopsis*
- struct bfd_section *bfd_create_gnu_debuglink_section
- (bfd *abfd, const char *filename);
- *Description*
-Takes a BFD and adds a .gnu_debuglink section to it. The section is
-sized to be big enough to contain a link to the specified FILENAME.
-
- *Returns*
-A pointer to the new section is returned if all is ok. Otherwise
-`NULL' is returned and bfd_error is set.
-
-2.14.1.22 `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 BFD and containing a .gnu_debuglink section SECT and fills in
-the contents of the section to contain a link to the specified
-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.
-
-
-File: bfd.info, Node: Internal, Next: File Caching, Prev: Opening and Closing, Up: BFD front end
-
-2.15 Implementation details
-===========================
-
-2.15.1 Internal functions
--------------------------
-
-*Description*
-These routines are used within BFD. They are not intended for export,
-but are documented here for completeness.
-
-2.15.1.1 `bfd_write_bigendian_4byte_int'
-........................................
-
-*Synopsis*
- bfd_boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int);
- *Description*
-Write a 4 byte integer I to the output BFD ABFD, in big endian order
-regardless of what else is going on. This is useful in archives.
-
-2.15.1.2 `bfd_put_size'
-.......................
-
-2.15.1.3 `bfd_get_size'
-.......................
-
-*Description*
-These macros as used for reading and writing raw data in sections; each
-access (except for bytes) is vectored through the target format of the
-BFD and mangled accordingly. The mangling performs any necessary endian
-translations and removes alignment restrictions. Note that types
-accepted and returned by these macros are identical so they can be
-swapped around in macros--for example, `libaout.h' defines `GET_WORD'
-to either `bfd_get_32' or `bfd_get_64'.
-
- In the put routines, VAL must be a `bfd_vma'. If we are on a system
-without prototypes, the caller is responsible for making sure that is
-true, with a cast if necessary. We don't cast them in the macro
-definitions because that would prevent `lint' or `gcc -Wall' from
-detecting sins such as passing a pointer. To detect calling these with
-less than a `bfd_vma', use `gcc -Wconversion' on a host with 64 bit
-`bfd_vma''s.
-
- /* Byte swapping macros for user section data. */
-
- #define bfd_put_8(abfd, val, ptr) \
- ((void) (*((unsigned char *) (ptr)) = (val) & 0xff))
- #define bfd_put_signed_8 \
- bfd_put_8
- #define bfd_get_8(abfd, ptr) \
- (*(unsigned char *) (ptr) & 0xff)
- #define bfd_get_signed_8(abfd, ptr) \
- (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80)
-
- #define bfd_put_16(abfd, val, ptr) \
- BFD_SEND (abfd, bfd_putx16, ((val),(ptr)))
- #define bfd_put_signed_16 \
- bfd_put_16
- #define bfd_get_16(abfd, ptr) \
- BFD_SEND (abfd, bfd_getx16, (ptr))
- #define bfd_get_signed_16(abfd, ptr) \
- BFD_SEND (abfd, bfd_getx_signed_16, (ptr))
-
- #define bfd_put_32(abfd, val, ptr) \
- BFD_SEND (abfd, bfd_putx32, ((val),(ptr)))
- #define bfd_put_signed_32 \
- bfd_put_32
- #define bfd_get_32(abfd, ptr) \
- BFD_SEND (abfd, bfd_getx32, (ptr))
- #define bfd_get_signed_32(abfd, ptr) \
- BFD_SEND (abfd, bfd_getx_signed_32, (ptr))
-
- #define bfd_put_64(abfd, val, ptr) \
- BFD_SEND (abfd, bfd_putx64, ((val), (ptr)))
- #define bfd_put_signed_64 \
- bfd_put_64
- #define bfd_get_64(abfd, ptr) \
- BFD_SEND (abfd, bfd_getx64, (ptr))
- #define bfd_get_signed_64(abfd, ptr) \
- BFD_SEND (abfd, bfd_getx_signed_64, (ptr))
-
- #define bfd_get(bits, abfd, ptr) \
- ((bits) == 8 ? (bfd_vma) bfd_get_8 (abfd, ptr) \
- : (bits) == 16 ? bfd_get_16 (abfd, ptr) \
- : (bits) == 32 ? bfd_get_32 (abfd, ptr) \
- : (bits) == 64 ? bfd_get_64 (abfd, ptr) \
- : (abort (), (bfd_vma) - 1))
-
- #define bfd_put(bits, abfd, val, ptr) \
- ((bits) == 8 ? bfd_put_8 (abfd, val, ptr) \
- : (bits) == 16 ? bfd_put_16 (abfd, val, ptr) \
- : (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \
- : (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \
- : (abort (), (void) 0))
-
-2.15.1.4 `bfd_h_put_size'
-.........................
-
-*Description*
-These macros have the same function as their `bfd_get_x' brethren,
-except that they are used for removing information for the header
-records of object files. Believe it or not, some object files keep
-their header records in big endian order and their data in little
-endian order.
-
- /* Byte swapping macros for file header data. */
-
- #define bfd_h_put_8(abfd, val, ptr) \
- bfd_put_8 (abfd, val, ptr)
- #define bfd_h_put_signed_8(abfd, val, ptr) \
- bfd_put_8 (abfd, val, ptr)
- #define bfd_h_get_8(abfd, ptr) \
- bfd_get_8 (abfd, ptr)
- #define bfd_h_get_signed_8(abfd, ptr) \
- bfd_get_signed_8 (abfd, ptr)
-
- #define bfd_h_put_16(abfd, val, ptr) \
- BFD_SEND (abfd, bfd_h_putx16, (val, ptr))
- #define bfd_h_put_signed_16 \
- bfd_h_put_16
- #define bfd_h_get_16(abfd, ptr) \
- BFD_SEND (abfd, bfd_h_getx16, (ptr))
- #define bfd_h_get_signed_16(abfd, ptr) \
- BFD_SEND (abfd, bfd_h_getx_signed_16, (ptr))
-
- #define bfd_h_put_32(abfd, val, ptr) \
- BFD_SEND (abfd, bfd_h_putx32, (val, ptr))
- #define bfd_h_put_signed_32 \
- bfd_h_put_32
- #define bfd_h_get_32(abfd, ptr) \
- BFD_SEND (abfd, bfd_h_getx32, (ptr))
- #define bfd_h_get_signed_32(abfd, ptr) \
- BFD_SEND (abfd, bfd_h_getx_signed_32, (ptr))
-
- #define bfd_h_put_64(abfd, val, ptr) \
- BFD_SEND (abfd, bfd_h_putx64, (val, ptr))
- #define bfd_h_put_signed_64 \
- bfd_h_put_64
- #define bfd_h_get_64(abfd, ptr) \
- BFD_SEND (abfd, bfd_h_getx64, (ptr))
- #define bfd_h_get_signed_64(abfd, ptr) \
- BFD_SEND (abfd, bfd_h_getx_signed_64, (ptr))
-
- /* Aliases for the above, which should eventually go away. */
-
- #define H_PUT_64 bfd_h_put_64
- #define H_PUT_32 bfd_h_put_32
- #define H_PUT_16 bfd_h_put_16
- #define H_PUT_8 bfd_h_put_8
- #define H_PUT_S64 bfd_h_put_signed_64
- #define H_PUT_S32 bfd_h_put_signed_32
- #define H_PUT_S16 bfd_h_put_signed_16
- #define H_PUT_S8 bfd_h_put_signed_8
- #define H_GET_64 bfd_h_get_64
- #define H_GET_32 bfd_h_get_32
- #define H_GET_16 bfd_h_get_16
- #define H_GET_8 bfd_h_get_8
- #define H_GET_S64 bfd_h_get_signed_64
- #define H_GET_S32 bfd_h_get_signed_32
- #define H_GET_S16 bfd_h_get_signed_16
- #define H_GET_S8 bfd_h_get_signed_8
-
-2.15.1.5 `bfd_log2'
-...................
-
-*Synopsis*
- unsigned int bfd_log2 (bfd_vma x);
- *Description*
-Return the log base 2 of the value supplied, rounded up. E.g., an X of
-1025 returns 11. A X of 0 returns 0.
-
-
-File: bfd.info, Node: File Caching, Next: Linker Functions, Prev: Internal, Up: BFD front end
-
-2.16 File caching
-=================
-
-The file caching mechanism is embedded within BFD and allows the
-application to open as many BFDs as it wants without regard to the
-underlying operating system's file descriptor limit (often as low as 20
-open files). The module in `cache.c' maintains a least recently used
-list of `BFD_CACHE_MAX_OPEN' files, and exports the name
-`bfd_cache_lookup', which runs around and makes sure that the required
-BFD is open. If not, then it chooses a file to close, closes it and
-opens the one wanted, returning its file handle.
-
-2.16.1 Caching functions
-------------------------
-
-2.16.1.1 `bfd_cache_init'
-.........................
-
-*Synopsis*
- bfd_boolean bfd_cache_init (bfd *abfd);
- *Description*
-Add a newly opened BFD to the cache.
-
-2.16.1.2 `bfd_cache_close'
-..........................
-
-*Synopsis*
- bfd_boolean bfd_cache_close (bfd *abfd);
- *Description*
-Remove the BFD ABFD from the cache. If the attached file is open, then
-close it too.
-
- *Returns*
-`FALSE' is returned if closing the file fails, `TRUE' is returned if
-all is well.
-
-2.16.1.3 `bfd_cache_close_all'
-..............................
-
-*Synopsis*
- bfd_boolean bfd_cache_close_all (void);
- *Description*
-Remove all BFDs from the cache. If the attached file is open, then
-close it too.
-
- *Returns*
-`FALSE' is returned if closing one of the file fails, `TRUE' is
-returned if all is well.
-
-2.16.1.4 `bfd_open_file'
-........................
-
-*Synopsis*
- FILE* bfd_open_file (bfd *abfd);
- *Description*
-Call the OS to open a file for ABFD. Return the `FILE *' (possibly
-`NULL') that results from this operation. Set up the BFD so that
-future accesses know the file is open. If the `FILE *' returned is
-`NULL', then it won't have been put in the cache, so it won't have to
-be removed from it.
-
-
-File: bfd.info, Node: Linker Functions, Next: Hash Tables, Prev: File Caching, Up: BFD front end
-
-2.17 Linker Functions
-=====================
-
-The linker uses three special entry points in the BFD target vector.
-It is not necessary to write special routines for these entry points
-when creating a new BFD back end, since generic versions are provided.
-However, writing them can speed up linking and make it use
-significantly less runtime memory.
-
- The first routine creates a hash table used by the other routines.
-The second routine adds the symbols from an object file to the hash
-table. The third routine takes all the object files and links them
-together to create the output file. These routines are designed so
-that the linker proper does not need to know anything about the symbols
-in the object files that it is linking. The linker merely arranges the
-sections as directed by the linker script and lets BFD handle the
-details of symbols and relocs.
-
- The second routine and third routines are passed a pointer to a
-`struct bfd_link_info' structure (defined in `bfdlink.h') which holds
-information relevant to the link, including the linker hash table
-(which was created by the first routine) and a set of callback
-functions to the linker proper.
-
- The generic linker routines are in `linker.c', and use the header
-file `genlink.h'. As of this writing, the only back ends which have
-implemented versions of these routines are a.out (in `aoutx.h') and
-ECOFF (in `ecoff.c'). The a.out routines are used as examples
-throughout this section.
-
-* Menu:
-
-* Creating a Linker Hash Table::
-* Adding Symbols to the Hash Table::
-* Performing the Final Link::
-
-
-File: bfd.info, Node: Creating a Linker Hash Table, Next: Adding Symbols to the Hash Table, Prev: Linker Functions, Up: Linker Functions
-
-2.17.1 Creating a linker hash table
------------------------------------
-
-The linker routines must create a hash table, which must be derived
-from `struct bfd_link_hash_table' described in `bfdlink.c'. *Note Hash
-Tables::, for information on how to create a derived hash table. This
-entry point is called using the target vector of the linker output file.
-
- The `_bfd_link_hash_table_create' entry point must allocate and
-initialize an instance of the desired hash table. If the back end does
-not require any additional information to be stored with the entries in
-the hash table, the entry point may simply create a `struct
-bfd_link_hash_table'. Most likely, however, some additional
-information will be needed.
-
- For example, with each entry in the hash table the a.out linker
-keeps the index the symbol has in the final output file (this index
-number is used so that when doing a relocatable link the symbol index
-used in the output file can be quickly filled in when copying over a
-reloc). The a.out linker code defines the required structures and
-functions for a hash table derived from `struct bfd_link_hash_table'.
-The a.out linker hash table is created by the function
-`NAME(aout,link_hash_table_create)'; it simply allocates space for the
-hash table, initializes it, and returns a pointer to it.
-
- When writing the linker routines for a new back end, you will
-generally not know exactly which fields will be required until you have
-finished. You should simply create a new hash table which defines no
-additional fields, and then simply add fields as they become necessary.
-
-
-File: bfd.info, Node: Adding Symbols to the Hash Table, Next: Performing the Final Link, Prev: Creating a Linker Hash Table, Up: Linker Functions
-
-2.17.2 Adding symbols to the hash table
----------------------------------------
-
-The linker proper will call the `_bfd_link_add_symbols' entry point for
-each object file or archive which is to be linked (typically these are
-the files named on the command line, but some may also come from the
-linker script). The entry point is responsible for examining the file.
-For an object file, BFD must add any relevant symbol information to
-the hash table. For an archive, BFD must determine which elements of
-the archive should be used and adding them to the link.
-
- The a.out version of this entry point is
-`NAME(aout,link_add_symbols)'.
-
-* Menu:
-
-* Differing file formats::
-* Adding symbols from an object file::
-* Adding symbols from an archive::
-
-
-File: bfd.info, Node: Differing file formats, Next: Adding symbols from an object file, Prev: Adding Symbols to the Hash Table, Up: Adding Symbols to the Hash Table
-
-2.17.2.1 Differing file formats
-...............................
-
-Normally all the files involved in a link will be of the same format,
-but it is also possible to link together different format object files,
-and the back end must support that. The `_bfd_link_add_symbols' entry
-point is called via the target vector of the file to be added. This
-has an important consequence: the function may not assume that the hash
-table is the type created by the corresponding
-`_bfd_link_hash_table_create' vector. All the `_bfd_link_add_symbols'
-function can assume about the hash table is that it is derived from
-`struct bfd_link_hash_table'.
-
- Sometimes the `_bfd_link_add_symbols' function must store some
-information in the hash table entry to be used by the `_bfd_final_link'
-function. In such a case the `creator' field of the hash table must be
-checked to make sure that the hash table was created by an object file
-of the same format.
-
- The `_bfd_final_link' routine must be prepared to handle a hash
-entry without any extra information added by the
-`_bfd_link_add_symbols' function. A hash entry without extra
-information will also occur when the linker script directs the linker
-to create a symbol. Note that, regardless of how a hash table entry is
-added, all the fields will be initialized to some sort of null value by
-the hash table entry initialization function.
-
- See `ecoff_link_add_externals' for an example of how to check the
-`creator' field before saving information (in this case, the ECOFF
-external symbol debugging information) in a hash table entry.
-
-
-File: bfd.info, Node: Adding symbols from an object file, Next: Adding symbols from an archive, Prev: Differing file formats, Up: Adding Symbols to the Hash Table
-
-2.17.2.2 Adding symbols from an object file
-...........................................
-
-When the `_bfd_link_add_symbols' routine is passed an object file, it
-must add all externally visible symbols in that object file to the hash
-table. The actual work of adding the symbol to the hash table is
-normally handled by the function `_bfd_generic_link_add_one_symbol'.
-The `_bfd_link_add_symbols' routine is responsible for reading all the
-symbols from the object file and passing the correct information to
-`_bfd_generic_link_add_one_symbol'.
-
- The `_bfd_link_add_symbols' routine should not use
-`bfd_canonicalize_symtab' to read the symbols. The point of providing
-this routine is to avoid the overhead of converting the symbols into
-generic `asymbol' structures.
-
- `_bfd_generic_link_add_one_symbol' handles the details of combining
-common symbols, warning about multiple definitions, and so forth. It
-takes arguments which describe the symbol to add, notably symbol flags,
-a section, and an offset. The symbol flags include such things as
-`BSF_WEAK' or `BSF_INDIRECT'. The section is a section in the object
-file, or something like `bfd_und_section_ptr' for an undefined symbol
-or `bfd_com_section_ptr' for a common symbol.
-
- If the `_bfd_final_link' routine is also going to need to read the
-symbol information, the `_bfd_link_add_symbols' routine should save it
-somewhere attached to the object file BFD. However, the information
-should only be saved if the `keep_memory' field of the `info' argument
-is TRUE, so that the `-no-keep-memory' linker switch is effective.
-
- The a.out function which adds symbols from an object file is
-`aout_link_add_object_symbols', and most of the interesting work is in
-`aout_link_add_symbols'. The latter saves pointers to the hash tables
-entries created by `_bfd_generic_link_add_one_symbol' indexed by symbol
-number, so that the `_bfd_final_link' routine does not have to call the
-hash table lookup routine to locate the entry.
-
-
-File: bfd.info, Node: Adding symbols from an archive, Prev: Adding symbols from an object file, Up: Adding Symbols to the Hash Table
-
-2.17.2.3 Adding symbols from an archive
-.......................................
-
-When the `_bfd_link_add_symbols' routine is passed an archive, it must
-look through the symbols defined by the archive and decide which
-elements of the archive should be included in the link. For each such
-element it must call the `add_archive_element' linker callback, and it
-must add the symbols from the object file to the linker hash table.
-
- In most cases the work of looking through the symbols in the archive
-should be done by the `_bfd_generic_link_add_archive_symbols' function.
-This function builds a hash table from the archive symbol table and
-looks through the list of undefined symbols to see which elements
-should be included. `_bfd_generic_link_add_archive_symbols' is passed
-a function to call to make the final decision about adding an archive
-element to the link and to do the actual work of adding the symbols to
-the linker hash table.
-
- The function passed to `_bfd_generic_link_add_archive_symbols' must
-read the symbols of the archive element and decide whether the archive
-element should be included in the link. If the element is to be
-included, the `add_archive_element' linker callback routine must be
-called with the element as an argument, and the elements symbols must
-be added to the linker hash table just as though the element had itself
-been passed to the `_bfd_link_add_symbols' function.
-
- When the a.out `_bfd_link_add_symbols' function receives an archive,
-it calls `_bfd_generic_link_add_archive_symbols' passing
-`aout_link_check_archive_element' as the function argument.
-`aout_link_check_archive_element' calls `aout_link_check_ar_symbols'.
-If the latter decides to add the element (an element is only added if
-it provides a real, non-common, definition for a previously undefined
-or common symbol) it calls the `add_archive_element' callback and then
-`aout_link_check_archive_element' calls `aout_link_add_symbols' to
-actually add the symbols to the linker hash table.
-
- The ECOFF back end is unusual in that it does not normally call
-`_bfd_generic_link_add_archive_symbols', because ECOFF archives already
-contain a hash table of symbols. The ECOFF back end searches the
-archive itself to avoid the overhead of creating a new hash table.
-
-
-File: bfd.info, Node: Performing the Final Link, Prev: Adding Symbols to the Hash Table, Up: Linker Functions
-
-2.17.3 Performing the final link
---------------------------------
-
-When all the input files have been processed, the linker calls the
-`_bfd_final_link' entry point of the output BFD. This routine is
-responsible for producing the final output file, which has several
-aspects. It must relocate the contents of the input sections and copy
-the data into the output sections. It must build an output symbol
-table including any local symbols from the input files and the global
-symbols from the hash table. When producing relocatable output, it must
-modify the input relocs and write them into the output file. There may
-also be object format dependent work to be done.
-
- The linker will also call the `write_object_contents' entry point
-when the BFD is closed. The two entry points must work together in
-order to produce the correct output file.
-
- The details of how this works are inevitably dependent upon the
-specific object file format. The a.out `_bfd_final_link' routine is
-`NAME(aout,final_link)'.
-
-* Menu:
-
-* Information provided by the linker::
-* Relocating the section contents::
-* Writing the symbol table::
-
-
-File: bfd.info, Node: Information provided by the linker, Next: Relocating the section contents, Prev: Performing the Final Link, Up: Performing the Final Link
-
-2.17.3.1 Information provided by the linker
-...........................................
-
-Before the linker calls the `_bfd_final_link' entry point, it sets up
-some data structures for the function to use.
-
- The `input_bfds' field of the `bfd_link_info' structure will point
-to a list of all the input files included in the link. These files are
-linked through the `link_next' field of the `bfd' structure.
-
- Each section in the output file will have a list of `link_order'
-structures attached to the `map_head.link_order' field (the
-`link_order' structure is defined in `bfdlink.h'). These structures
-describe how to create the contents of the output section in terms of
-the contents of various input sections, fill constants, and,
-eventually, other types of information. They also describe relocs that
-must be created by the BFD backend, but do not correspond to any input
-file; this is used to support -Ur, which builds constructors while
-generating a relocatable object file.
-
-
-File: bfd.info, Node: Relocating the section contents, Next: Writing the symbol table, Prev: Information provided by the linker, Up: Performing the Final Link
-
-2.17.3.2 Relocating the section contents
-........................................
-
-The `_bfd_final_link' function should look through the `link_order'
-structures attached to each section of the output file. Each
-`link_order' structure should either be handled specially, or it should
-be passed to the function `_bfd_default_link_order' which will do the
-right thing (`_bfd_default_link_order' is defined in `linker.c').
-
- For efficiency, a `link_order' of type `bfd_indirect_link_order'
-whose associated section belongs to a BFD of the same format as the
-output BFD must be handled specially. This type of `link_order'
-describes part of an output section in terms of a section belonging to
-one of the input files. The `_bfd_final_link' function should read the
-contents of the section and any associated relocs, apply the relocs to
-the section contents, and write out the modified section contents. If
-performing a relocatable link, the relocs themselves must also be
-modified and written out.
-
- The functions `_bfd_relocate_contents' and
-`_bfd_final_link_relocate' provide some general support for performing
-the actual relocations, notably overflow checking. Their arguments
-include information about the symbol the relocation is against and a
-`reloc_howto_type' argument which describes the relocation to perform.
-These functions are defined in `reloc.c'.
-
- The a.out function which handles reading, relocating, and writing
-section contents is `aout_link_input_section'. The actual relocation
-is done in `aout_link_input_section_std' and
-`aout_link_input_section_ext'.
-
-
-File: bfd.info, Node: Writing the symbol table, Prev: Relocating the section contents, Up: Performing the Final Link
-
-2.17.3.3 Writing the symbol table
-.................................
-
-The `_bfd_final_link' function must gather all the symbols in the input
-files and write them out. It must also write out all the symbols in
-the global hash table. This must be controlled by the `strip' and
-`discard' fields of the `bfd_link_info' structure.
-
- The local symbols of the input files will not have been entered into
-the linker hash table. The `_bfd_final_link' routine must consider
-each input file and include the symbols in the output file. It may be
-convenient to do this when looking through the `link_order' structures,
-or it may be done by stepping through the `input_bfds' list.
-
- The `_bfd_final_link' routine must also traverse the global hash
-table to gather all the externally visible symbols. It is possible
-that most of the externally visible symbols may be written out when
-considering the symbols of each input file, but it is still necessary
-to traverse the hash table since the linker script may have defined
-some symbols that are not in any of the input files.
-
- The `strip' field of the `bfd_link_info' structure controls which
-symbols are written out. The possible values are listed in
-`bfdlink.h'. If the value is `strip_some', then the `keep_hash' field
-of the `bfd_link_info' structure is a hash table of symbols to keep;
-each symbol should be looked up in this hash table, and only symbols
-which are present should be included in the output file.
-
- If the `strip' field of the `bfd_link_info' structure permits local
-symbols to be written out, the `discard' field is used to further
-controls which local symbols are included in the output file. If the
-value is `discard_l', then all local symbols which begin with a certain
-prefix are discarded; this is controlled by the
-`bfd_is_local_label_name' entry point.
-
- The a.out backend handles symbols by calling
-`aout_link_write_symbols' on each input BFD and then traversing the
-global hash table with the function `aout_link_write_other_symbol'. It
-builds a string table while writing out the symbols, which is written
-to the output file at the end of `NAME(aout,final_link)'.
-
-2.17.3.4 `bfd_link_split_section'
-.................................
-
-*Synopsis*
- bfd_boolean bfd_link_split_section (bfd *abfd, asection *sec);
- *Description*
-Return nonzero if SEC should be split during a reloceatable or final
-link.
- #define bfd_link_split_section(abfd, sec) \
- BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec))
-
-2.17.3.5 `bfd_section_already_linked'
-.....................................
-
-*Synopsis*
- void bfd_section_already_linked (bfd *abfd, asection *sec);
- *Description*
-Check if SEC has been already linked during a reloceatable or final
-link.
- #define bfd_section_already_linked(abfd, sec) \
- BFD_SEND (abfd, _section_already_linked, (abfd, sec))
-
-
-File: bfd.info, Node: Hash Tables, Prev: Linker Functions, Up: BFD front end
-
-2.18 Hash Tables
-================
-
-BFD provides a simple set of hash table functions. Routines are
-provided to initialize a hash table, to free a hash table, to look up a
-string in a hash table and optionally create an entry for it, and to
-traverse a hash table. There is currently no routine to delete an
-string from a hash table.
-
- The basic hash table does not permit any data to be stored with a
-string. However, a hash table is designed to present a base class from
-which other types of hash tables may be derived. These derived types
-may store additional information with the string. Hash tables were
-implemented in this way, rather than simply providing a data pointer in
-a hash table entry, because they were designed for use by the linker
-back ends. The linker may create thousands of hash table entries, and
-the overhead of allocating private data and storing and following
-pointers becomes noticeable.
-
- The basic hash table code is in `hash.c'.
-
-* Menu:
-
-* Creating and Freeing a Hash Table::
-* Looking Up or Entering a String::
-* Traversing a Hash Table::
-* Deriving a New Hash Table Type::
-
-
-File: bfd.info, Node: Creating and Freeing a Hash Table, Next: Looking Up or Entering a String, Prev: Hash Tables, Up: Hash Tables
-
-2.18.1 Creating and freeing a hash table
-----------------------------------------
-
-To create a hash table, create an instance of a `struct bfd_hash_table'
-(defined in `bfd.h') and call `bfd_hash_table_init' (if you know
-approximately how many entries you will need, the function
-`bfd_hash_table_init_n', which takes a SIZE argument, may be used).
-`bfd_hash_table_init' returns `FALSE' if some sort of error occurs.
-
- The function `bfd_hash_table_init' take as an argument a function to
-use to create new entries. For a basic hash table, use the function
-`bfd_hash_newfunc'. *Note Deriving a New Hash Table Type::, for why
-you would want to use a different value for this argument.
-
- `bfd_hash_table_init' will create an objalloc which will be used to
-allocate new entries. You may allocate memory on this objalloc using
-`bfd_hash_allocate'.
-
- Use `bfd_hash_table_free' to free up all the memory that has been
-allocated for a hash table. This will not free up the `struct
-bfd_hash_table' itself, which you must provide.
-
- Use `bfd_hash_set_default_size' to set the default size of hash
-table to use.
-
-
-File: bfd.info, Node: Looking Up or Entering a String, Next: Traversing a Hash Table, Prev: Creating and Freeing a Hash Table, Up: Hash Tables
-
-2.18.2 Looking up or entering a string
---------------------------------------
-
-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 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 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 CREATE argument is `TRUE', and a new entry is created, the
-COPY argument is used to decide whether to copy the string onto the
-hash table objalloc or not. If COPY is passed as `FALSE', you must be
-careful not to deallocate or modify the string as long as the hash table
-exists.
-
-
-File: bfd.info, Node: Traversing a Hash Table, Next: Deriving a New Hash Table Type, Prev: Looking Up or Entering a String, Up: Hash Tables
-
-2.18.3 Traversing a hash table
-------------------------------
-
-The function `bfd_hash_traverse' may be used to traverse a hash table,
-calling a function on each element. The traversal is done in a random
-order.
-
- `bfd_hash_traverse' takes as arguments a function and a generic
-`void *' pointer. The function is called with a hash table entry (a
-`struct bfd_hash_entry *') and the generic pointer passed to
-`bfd_hash_traverse'. The function must return a `boolean' value, which
-indicates whether to continue traversing the hash table. If the
-function returns `FALSE', `bfd_hash_traverse' will stop the traversal
-and return immediately.
-
-
-File: bfd.info, Node: Deriving a New Hash Table Type, Prev: Traversing a Hash Table, Up: Hash Tables
-
-2.18.4 Deriving a new hash table type
--------------------------------------
-
-Many uses of hash tables want to store additional information which
-each entry in the hash table. Some also find it convenient to store
-additional information with the hash table itself. This may be done
-using a derived hash table.
-
- Since C is not an object oriented language, creating a derived hash
-table requires sticking together some boilerplate routines with a few
-differences specific to the type of hash table you want to create.
-
- An example of a derived hash table is the linker hash table. The
-structures for this are defined in `bfdlink.h'. The functions are in
-`linker.c'.
-
- You may also derive a hash table from an already derived hash table.
-For example, the a.out linker backend code uses a hash table derived
-from the linker hash table.
-
-* Menu:
-
-* Define the Derived Structures::
-* Write the Derived Creation Routine::
-* Write Other Derived Routines::
-
-
-File: bfd.info, Node: Define the Derived Structures, Next: Write the Derived Creation Routine, Prev: Deriving a New Hash Table Type, Up: Deriving a New Hash Table Type
-
-2.18.4.1 Define the derived structures
-......................................
-
-You must define a structure for an entry in the hash table, and a
-structure for the hash table itself.
-
- The first field in the structure for an entry in the hash table must
-be of the type used for an entry in the hash table you are deriving
-from. If you are deriving from a basic hash table this is `struct
-bfd_hash_entry', which is defined in `bfd.h'. The first field in the
-structure for the hash table itself must be of the type of the hash
-table you are deriving from itself. If you are deriving from a basic
-hash table, this is `struct bfd_hash_table'.
-
- For example, the linker hash table defines `struct
-bfd_link_hash_entry' (in `bfdlink.h'). The first field, `root', is of
-type `struct bfd_hash_entry'. Similarly, the first field in `struct
-bfd_link_hash_table', `table', is of type `struct bfd_hash_table'.
-
-
-File: bfd.info, Node: Write the Derived Creation Routine, Next: Write Other Derived Routines, Prev: Define the Derived Structures, Up: Deriving a New Hash Table Type
-
-2.18.4.2 Write the derived creation routine
-...........................................
-
-You must write a routine which will create and initialize an entry in
-the hash table. This routine is passed as the function argument to
-`bfd_hash_table_init'.
-
- In order to permit other hash tables to be derived from the hash
-table you are creating, this routine must be written in a standard way.
-
- The first argument to the creation routine is a pointer to a hash
-table entry. This may be `NULL', in which case the routine should
-allocate the right amount of space. Otherwise the space has already
-been allocated by a hash table type derived from this one.
-
- After allocating space, the creation routine must call the creation
-routine of the hash table type it is derived from, passing in a pointer
-to the space it just allocated. This will initialize any fields used
-by the base hash table.
-
- Finally the creation routine must initialize any local fields for
-the new hash table type.
-
- Here is a boilerplate example of a creation routine. FUNCTION_NAME
-is the name of the routine. ENTRY_TYPE is the type of an entry in the
-hash table you are creating. BASE_NEWFUNC is the name of the creation
-routine of the hash table type your hash table is derived from.
-
- struct bfd_hash_entry *
- FUNCTION_NAME (struct bfd_hash_entry *entry,
- struct bfd_hash_table *table,
- const char *string)
- {
- struct ENTRY_TYPE *ret = (ENTRY_TYPE *) entry;
-
- /* Allocate the structure if it has not already been allocated by a
- derived class. */
- if (ret == NULL)
- {
- ret = bfd_hash_allocate (table, sizeof (* ret));
- if (ret == NULL)
- return NULL;
- }
-
- /* Call the allocation method of the base class. */
- ret = ((ENTRY_TYPE *)
- BASE_NEWFUNC ((struct bfd_hash_entry *) ret, table, string));
-
- /* Initialize the local fields here. */
-
- return (struct bfd_hash_entry *) ret;
- }
- *Description*
-The creation routine for the linker hash table, which is in `linker.c',
-looks just like this example. FUNCTION_NAME is
-`_bfd_link_hash_newfunc'. ENTRY_TYPE is `struct bfd_link_hash_entry'.
-BASE_NEWFUNC is `bfd_hash_newfunc', the creation routine for a basic
-hash table.
-
- `_bfd_link_hash_newfunc' also initializes the local fields in a
-linker hash table entry: `type', `written' and `next'.
-
-
-File: bfd.info, Node: Write Other Derived Routines, Prev: Write the Derived Creation Routine, Up: Deriving a New Hash Table Type
-
-2.18.4.3 Write other derived routines
-.....................................
-
-You will want to write other routines for your new hash table, as well.
-
- You will want an initialization routine which calls the
-initialization routine of the hash table you are deriving from and
-initializes any other local fields. For the linker hash table, this is
-`_bfd_link_hash_table_init' in `linker.c'.
-
- You will want a lookup routine which calls the lookup routine of the
-hash table you are deriving from and casts the result. The linker hash
-table uses `bfd_link_hash_lookup' in `linker.c' (this actually takes an
-additional argument which it uses to decide how to return the looked up
-value).
-
- You may want a traversal routine. This should just call the
-traversal routine of the hash table you are deriving from with
-appropriate casts. The linker hash table uses `bfd_link_hash_traverse'
-in `linker.c'.
-
- These routines may simply be defined as macros. For example, the
-a.out backend linker hash table, which is derived from the linker hash
-table, uses macros for the lookup and traversal routines. These are
-`aout_link_hash_lookup' and `aout_link_hash_traverse' in aoutx.h.
-
-
-File: bfd.info, Node: BFD back ends, Next: GNU Free Documentation License, Prev: BFD front end, Up: Top
-
-3 BFD back ends
-***************
-
-* Menu:
-
-* What to Put Where::
-* aout :: a.out backends
-* coff :: coff backends
-* elf :: elf backends
-* mmo :: mmo backend
-
-
-File: bfd.info, Node: What to Put Where, Next: aout, Prev: BFD back ends, Up: BFD back ends
-
- All of BFD lives in one directory.
-
-
-File: bfd.info, Node: aout, Next: coff, Prev: What to Put Where, Up: BFD back ends
-
-3.1 a.out backends
-==================
-
-*Description*
-BFD supports a number of different flavours of a.out format, though the
-major differences are only the sizes of the structures on disk, and the
-shape of the relocation information.
-
- The support is split into a basic support file `aoutx.h' and other
-files which derive functions from the base. One derivation file is
-`aoutf1.h' (for a.out flavour 1), and adds to the basic a.out functions
-support for sun3, sun4, 386 and 29k a.out files, to create a target
-jump vector for a specific target.
-
- This information is further split out into more specific files for
-each machine, including `sunos.c' for sun3 and sun4, `newsos3.c' for
-the Sony NEWS, and `demo64.c' for a demonstration of a 64 bit a.out
-format.
-
- The base file `aoutx.h' defines general mechanisms for reading and
-writing records to and from disk and various other methods which BFD
-requires. It is included by `aout32.c' and `aout64.c' to form the names
-`aout_32_swap_exec_header_in', `aout_64_swap_exec_header_in', etc.
-
- As an example, this is what goes on to make the back end for a sun4,
-from `aout32.c':
-
- #define ARCH_SIZE 32
- #include "aoutx.h"
-
- Which exports names:
-
- ...
- aout_32_canonicalize_reloc
- aout_32_find_nearest_line
- aout_32_get_lineno
- aout_32_get_reloc_upper_bound
- ...
-
- from `sunos.c':
-
- #define TARGET_NAME "a.out-sunos-big"
- #define VECNAME sunos_big_vec
- #include "aoutf1.h"
-
- requires all the names from `aout32.c', and produces the jump vector
-
- sunos_big_vec
-
- The file `host-aout.c' is a special case. It is for a large set of
-hosts that use "more or less standard" a.out files, and for which
-cross-debugging is not interesting. It uses the standard 32-bit a.out
-support routines, but determines the file offsets and addresses of the
-text, data, and BSS sections, the machine architecture and machine
-type, and the entry point address, in a host-dependent manner. Once
-these values have been determined, generic code is used to handle the
-object file.
-
- When porting it to run on a new system, you must supply:
-
- HOST_PAGE_SIZE
- HOST_SEGMENT_SIZE
- HOST_MACHINE_ARCH (optional)
- HOST_MACHINE_MACHINE (optional)
- HOST_TEXT_START_ADDR
- HOST_STACK_END_ADDR
-
- in the file `../include/sys/h-XXX.h' (for your host). These values,
-plus the structures and macros defined in `a.out.h' on your host
-system, will produce a BFD target that will access ordinary a.out files
-on your host. To configure a new machine to use `host-aout.c', specify:
-
- TDEFAULTS = -DDEFAULT_VECTOR=host_aout_big_vec
- TDEPFILES= host-aout.o trad-core.o
-
- in the `config/XXX.mt' file, and modify `configure.in' to use the
-`XXX.mt' file (by setting "`bfd_target=XXX'") when your configuration
-is selected.
-
-3.1.1 Relocations
------------------
-
-*Description*
-The file `aoutx.h' provides for both the _standard_ and _extended_
-forms of a.out relocation records.
-
- The standard records contain only an address, a symbol index, and a
-type field. The extended records (used on 29ks and sparcs) also have a
-full integer for an addend.
-
-3.1.2 Internal entry points
----------------------------
-
-*Description*
-`aoutx.h' exports several routines for accessing the contents of an
-a.out file, which are gathered and exported in turn by various format
-specific files (eg sunos.c).
-
-3.1.2.1 `aout_SIZE_swap_exec_header_in'
-.......................................
-
-*Synopsis*
- void aout_SIZE_swap_exec_header_in,
- (bfd *abfd,
- struct external_exec *bytes,
- struct internal_exec *execp);
- *Description*
-Swap the information in an executable header RAW_BYTES taken from a raw
-byte stream memory image into the internal exec header structure EXECP.
-
-3.1.2.2 `aout_SIZE_swap_exec_header_out'
-........................................
-
-*Synopsis*
- void aout_SIZE_swap_exec_header_out
- (bfd *abfd,
- struct internal_exec *execp,
- struct external_exec *raw_bytes);
- *Description*
-Swap the information in an internal exec header structure EXECP into
-the buffer RAW_BYTES ready for writing to disk.
-
-3.1.2.3 `aout_SIZE_some_aout_object_p'
-......................................
-
-*Synopsis*
- const bfd_target *aout_SIZE_some_aout_object_p
- (bfd *abfd,
- struct internal_exec *execp,
- const bfd_target *(*callback_to_real_object_p) (bfd *));
- *Description*
-Some a.out variant thinks that the file open in ABFD checking is an
-a.out file. Do some more checking, and set up for access if it really
-is. Call back to the calling environment's "finish up" function just
-before returning, to handle any last-minute setup.
-
-3.1.2.4 `aout_SIZE_mkobject'
-............................
-
-*Synopsis*
- bfd_boolean aout_SIZE_mkobject, (bfd *abfd);
- *Description*
-Initialize BFD ABFD for use with a.out files.
-
-3.1.2.5 `aout_SIZE_machine_type'
-................................
-
-*Synopsis*
- enum machine_type aout_SIZE_machine_type
- (enum bfd_architecture arch,
- unsigned long machine,
- bfd_boolean *unknown);
- *Description*
-Keep track of machine architecture and machine type for a.out's. Return
-the `machine_type' for a particular architecture and machine, or
-`M_UNKNOWN' if that exact architecture and machine can't be represented
-in a.out format.
-
- If the architecture is understood, machine type 0 (default) is
-always understood.
-
-3.1.2.6 `aout_SIZE_set_arch_mach'
-.................................
-
-*Synopsis*
- bfd_boolean aout_SIZE_set_arch_mach,
- (bfd *,
- enum bfd_architecture arch,
- unsigned long machine);
- *Description*
-Set the architecture and the machine of the BFD ABFD to the values ARCH
-and MACHINE. Verify that ABFD's format can support the architecture
-required.
-
-3.1.2.7 `aout_SIZE_new_section_hook'
-....................................
-
-*Synopsis*
- bfd_boolean aout_SIZE_new_section_hook,
- (bfd *abfd,
- asection *newsect);
- *Description*
-Called by the BFD in response to a `bfd_make_section' request.
-
-
-File: bfd.info, Node: coff, Next: elf, Prev: aout, Up: BFD back ends
-
-3.2 coff backends
-=================
-
-BFD supports a number of different flavours of coff format. The major
-differences between formats are the sizes and alignments of fields in
-structures on disk, and the occasional extra field.
-
- Coff in all its varieties is implemented with a few common files and
-a number of implementation specific files. For example, The 88k bcs
-coff format is implemented in the file `coff-m88k.c'. This file
-`#include's `coff/m88k.h' which defines the external structure of the
-coff format for the 88k, and `coff/internal.h' which defines the
-internal structure. `coff-m88k.c' also defines the relocations used by
-the 88k format *Note Relocations::.
-
- The Intel i960 processor version of coff is implemented in
-`coff-i960.c'. This file has the same structure as `coff-m88k.c',
-except that it includes `coff/i960.h' rather than `coff-m88k.h'.
-
-3.2.1 Porting to a new version of coff
---------------------------------------
-
-The recommended method is to select from the existing implementations
-the version of coff which is most like the one you want to use. For
-example, we'll say that i386 coff is the one you select, and that your
-coff flavour is called foo. Copy `i386coff.c' to `foocoff.c', copy
-`../include/coff/i386.h' to `../include/coff/foo.h', and add the lines
-to `targets.c' and `Makefile.in' so that your new back end is used.
-Alter the shapes of the structures in `../include/coff/foo.h' so that
-they match what you need. You will probably also have to add `#ifdef's
-to the code in `coff/internal.h' and `coffcode.h' if your version of
-coff is too wild.
-
- You can verify that your new BFD backend works quite simply by
-building `objdump' from the `binutils' directory, and making sure that
-its version of what's going on and your host system's idea (assuming it
-has the pretty standard coff dump utility, usually called `att-dump' or
-just `dump') are the same. Then clean up your code, and send what
-you've done to Cygnus. Then your stuff will be in the next release, and
-you won't have to keep integrating it.
-
-3.2.2 How the coff backend works
---------------------------------
-
-3.2.2.1 File layout
-...................
-
-The Coff backend is split into generic routines that are applicable to
-any Coff target and routines that are specific to a particular target.
-The target-specific routines are further split into ones which are
-basically the same for all Coff targets except that they use the
-external symbol format or use different values for certain constants.
-
- The generic routines are in `coffgen.c'. These routines work for
-any Coff target. They use some hooks into the target specific code;
-the hooks are in a `bfd_coff_backend_data' structure, one of which
-exists for each target.
-
- The essentially similar target-specific routines are in
-`coffcode.h'. This header file includes executable C code. The
-various Coff targets first include the appropriate Coff header file,
-make any special defines that are needed, and then include `coffcode.h'.
-
- Some of the Coff targets then also have additional routines in the
-target source file itself.
-
- For example, `coff-i960.c' includes `coff/internal.h' and
-`coff/i960.h'. It then defines a few constants, such as `I960', and
-includes `coffcode.h'. Since the i960 has complex relocation types,
-`coff-i960.c' also includes some code to manipulate the i960 relocs.
-This code is not in `coffcode.h' because it would not be used by any
-other target.
-
-3.2.2.2 Bit twiddling
-.....................
-
-Each flavour of coff supported in BFD has its own header file
-describing the external layout of the structures. There is also an
-internal description of the coff layout, in `coff/internal.h'. A major
-function of the coff backend is swapping the bytes and twiddling the
-bits to translate the external form of the structures into the normal
-internal form. This is all performed in the `bfd_swap'_thing_direction
-routines. Some elements are different sizes between different versions
-of coff; it is the duty of the coff version specific include file to
-override the definitions of various packing routines in `coffcode.h'.
-E.g., the size of line number entry in coff is sometimes 16 bits, and
-sometimes 32 bits. `#define'ing `PUT_LNSZ_LNNO' and `GET_LNSZ_LNNO'
-will select the correct one. No doubt, some day someone will find a
-version of coff which has a varying field size not catered to at the
-moment. To port BFD, that person will have to add more `#defines'.
-Three of the bit twiddling routines are exported to `gdb';
-`coff_swap_aux_in', `coff_swap_sym_in' and `coff_swap_lineno_in'. `GDB'
-reads the symbol table on its own, but uses BFD to fix things up. More
-of the bit twiddlers are exported for `gas'; `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'. `Gas' currently keeps track of all the symbol
-table and reloc drudgery itself, thereby saving the internal BFD
-overhead, but uses BFD to swap things on the way out, making cross
-ports much safer. Doing so also allows BFD (and thus the linker) to
-use the same header files as `gas', which makes one avenue to disaster
-disappear.
-
-3.2.2.3 Symbol reading
-......................
-
-The simple canonical form for symbols used by BFD is not rich enough to
-keep all the information available in a coff symbol table. The back end
-gets around this problem by keeping the original symbol table around,
-"behind the scenes".
-
- When a symbol table is requested (through a call to
-`bfd_canonicalize_symtab'), a request gets through to
-`coff_get_normalized_symtab'. This reads the symbol table from the coff
-file and swaps all the structures inside into the internal form. It
-also fixes up all the pointers in the table (represented in the file by
-offsets from the first symbol in the table) into physical pointers to
-elements in the new internal table. This involves some work since the
-meanings of fields change depending upon context: a field that is a
-pointer to another structure in the symbol table at one moment may be
-the size in bytes of a structure at the next. Another pass is made
-over the table. All symbols which mark file names (`C_FILE' symbols)
-are modified so that the internal string points to the value in the
-auxent (the real filename) rather than the normal text associated with
-the symbol (`".file"').
-
- At this time the symbol names are moved around. Coff stores all
-symbols less than nine characters long physically within the symbol
-table; longer strings are kept at the end of the file in the string
-table. This pass moves all strings into memory and replaces them with
-pointers to the strings.
-
- The symbol table is massaged once again, this time to create the
-canonical table used by the BFD application. Each symbol is inspected
-in turn, and a decision made (using the `sclass' field) about the
-various flags to set in the `asymbol'. *Note Symbols::. The generated
-canonical table shares strings with the hidden internal symbol table.
-
- Any linenumbers are read from the coff file too, and attached to the
-symbols which own the functions the linenumbers belong to.
-
-3.2.2.4 Symbol writing
-......................
-
-Writing a symbol to a coff file which didn't come from a coff file will
-lose any debugging information. The `asymbol' structure remembers the
-BFD from which the symbol was taken, and on output the back end makes
-sure that the same destination target as source target is present.
-
- When the symbols have come from a coff file then all the debugging
-information is preserved.
-
- Symbol tables are provided for writing to the back end in a vector
-of pointers to pointers. This allows applications like the linker to
-accumulate and output large symbol tables without having to do too much
-byte copying.
-
- This function runs through the provided symbol table and patches
-each symbol marked as a file place holder (`C_FILE') to point to the
-next file place holder in the list. It also marks each `offset' field
-in the list with the offset from the first symbol of the current symbol.
-
- Another function of this procedure is to turn the canonical value
-form of BFD into the form used by coff. Internally, BFD expects symbol
-values to be offsets from a section base; so a symbol physically at
-0x120, but in a section starting at 0x100, would have the value 0x20.
-Coff expects symbols to contain their final value, so symbols have
-their values changed at this point to reflect their sum with their
-owning section. This transformation uses the `output_section' field of
-the `asymbol''s `asection' *Note Sections::.
-
- * `coff_mangle_symbols'
- This routine runs though the provided symbol table and uses the
-offsets generated by the previous pass and the pointers generated when
-the symbol table was read in to create the structured hierarchy
-required by coff. It changes each pointer to a symbol into the index
-into the symbol table of the asymbol.
-
- * `coff_write_symbols'
- This routine runs through the symbol table and patches up the
-symbols from their internal form into the coff way, calls the bit
-twiddlers, and writes out the table to the file.
-
-3.2.2.5 `coff_symbol_type'
-..........................
-
-*Description*
-The hidden information for an `asymbol' is described in a
-`combined_entry_type':
-
-
- typedef struct coff_ptr_struct
- {
- /* Remembers the offset from the first symbol in the file for
- this symbol. Generated by coff_renumber_symbols. */
- unsigned int offset;
-
- /* Should the value of this symbol be renumbered. Used for
- XCOFF C_BSTAT symbols. Set by coff_slurp_symbol_table. */
- unsigned int fix_value : 1;
-
- /* Should the tag field of this symbol be renumbered.
- Created by coff_pointerize_aux. */
- unsigned int fix_tag : 1;
-
- /* Should the endidx field of this symbol be renumbered.
- Created by coff_pointerize_aux. */
- unsigned int fix_end : 1;
-
- /* Should the x_csect.x_scnlen field be renumbered.
- Created by coff_pointerize_aux. */
- unsigned int fix_scnlen : 1;
-
- /* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the
- index into the line number entries. Set by coff_slurp_symbol_table. */
- unsigned int fix_line : 1;
-
- /* The container for the symbol structure as read and translated
- from the file. */
- union
- {
- union internal_auxent auxent;
- struct internal_syment syment;
- } u;
- } combined_entry_type;
-
-
- /* Each canonical asymbol really looks like this: */
-
- typedef struct coff_symbol_struct
- {
- /* The actual symbol which the rest of BFD works with */
- asymbol symbol;
-
- /* A pointer to the hidden information for this symbol */
- combined_entry_type *native;
-
- /* A pointer to the linenumber information for this symbol */
- struct lineno_cache_entry *lineno;
-
- /* Have the line numbers been relocated yet ? */
- bfd_boolean done_lineno;
- } coff_symbol_type;
-
-3.2.2.6 `bfd_coff_backend_data'
-...............................
-
- /* COFF symbol classifications. */
-
- enum coff_symbol_classification
- {
- /* Global symbol. */
- COFF_SYMBOL_GLOBAL,
- /* Common symbol. */
- COFF_SYMBOL_COMMON,
- /* Undefined symbol. */
- COFF_SYMBOL_UNDEFINED,
- /* Local symbol. */
- COFF_SYMBOL_LOCAL,
- /* PE section symbol. */
- COFF_SYMBOL_PE_SECTION
- };
-Special entry points for gdb to swap in coff symbol table parts:
- typedef struct
- {
- void (*_bfd_coff_swap_aux_in)
- (bfd *, void *, int, int, int, int, void *);
-
- void (*_bfd_coff_swap_sym_in)
- (bfd *, void *, void *);
-
- void (*_bfd_coff_swap_lineno_in)
- (bfd *, void *, void *);
-
- unsigned int (*_bfd_coff_swap_aux_out)
- (bfd *, void *, int, int, int, int, void *);
-
- unsigned int (*_bfd_coff_swap_sym_out)
- (bfd *, void *, void *);
-
- unsigned int (*_bfd_coff_swap_lineno_out)
- (bfd *, void *, void *);
-
- unsigned int (*_bfd_coff_swap_reloc_out)
- (bfd *, void *, void *);
-
- unsigned int (*_bfd_coff_swap_filehdr_out)
- (bfd *, void *, void *);
-
- unsigned int (*_bfd_coff_swap_aouthdr_out)
- (bfd *, void *, void *);
-
- unsigned int (*_bfd_coff_swap_scnhdr_out)
- (bfd *, void *, void *);
-
- unsigned int _bfd_filhsz;
- unsigned int _bfd_aoutsz;
- unsigned int _bfd_scnhsz;
- unsigned int _bfd_symesz;
- unsigned int _bfd_auxesz;
- unsigned int _bfd_relsz;
- unsigned int _bfd_linesz;
- unsigned int _bfd_filnmlen;
- bfd_boolean _bfd_coff_long_filenames;
- bfd_boolean _bfd_coff_long_section_names;
- unsigned int _bfd_coff_default_section_alignment_power;
- bfd_boolean _bfd_coff_force_symnames_in_strings;
- unsigned int _bfd_coff_debug_string_prefix_length;
-
- void (*_bfd_coff_swap_filehdr_in)
- (bfd *, void *, void *);
-
- void (*_bfd_coff_swap_aouthdr_in)
- (bfd *, void *, void *);
-
- void (*_bfd_coff_swap_scnhdr_in)
- (bfd *, void *, void *);
-
- void (*_bfd_coff_swap_reloc_in)
- (bfd *abfd, void *, void *);
-
- bfd_boolean (*_bfd_coff_bad_format_hook)
- (bfd *, void *);
-
- bfd_boolean (*_bfd_coff_set_arch_mach_hook)
- (bfd *, void *);
-
- void * (*_bfd_coff_mkobject_hook)
- (bfd *, void *, void *);
-
- bfd_boolean (*_bfd_styp_to_sec_flags_hook)
- (bfd *, void *, const char *, asection *, flagword *);
-
- void (*_bfd_set_alignment_hook)
- (bfd *, asection *, void *);
-
- bfd_boolean (*_bfd_coff_slurp_symbol_table)
- (bfd *);
-
- bfd_boolean (*_bfd_coff_symname_in_debug)
- (bfd *, struct internal_syment *);
-
- bfd_boolean (*_bfd_coff_pointerize_aux_hook)
- (bfd *, combined_entry_type *, combined_entry_type *,
- unsigned int, combined_entry_type *);
-
- bfd_boolean (*_bfd_coff_print_aux)
- (bfd *, FILE *, combined_entry_type *, combined_entry_type *,
- combined_entry_type *, unsigned int);
-
- void (*_bfd_coff_reloc16_extra_cases)
- (bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *,
- bfd_byte *, unsigned int *, unsigned int *);
-
- int (*_bfd_coff_reloc16_estimate)
- (bfd *, asection *, arelent *, unsigned int,
- struct bfd_link_info *);
-
- enum coff_symbol_classification (*_bfd_coff_classify_symbol)
- (bfd *, struct internal_syment *);
-
- bfd_boolean (*_bfd_coff_compute_section_file_positions)
- (bfd *);
-
- bfd_boolean (*_bfd_coff_start_final_link)
- (bfd *, struct bfd_link_info *);
-
- bfd_boolean (*_bfd_coff_relocate_section)
- (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- struct internal_reloc *, struct internal_syment *, asection **);
-
- reloc_howto_type *(*_bfd_coff_rtype_to_howto)
- (bfd *, asection *, struct internal_reloc *,
- struct coff_link_hash_entry *, struct internal_syment *,
- bfd_vma *);
-
- bfd_boolean (*_bfd_coff_adjust_symndx)
- (bfd *, struct bfd_link_info *, bfd *, asection *,
- struct internal_reloc *, bfd_boolean *);
-
- bfd_boolean (*_bfd_coff_link_add_one_symbol)
- (struct bfd_link_info *, bfd *, const char *, flagword,
- asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean,
- struct bfd_link_hash_entry **);
-
- bfd_boolean (*_bfd_coff_link_output_has_begun)
- (bfd *, struct coff_final_link_info *);
-
- bfd_boolean (*_bfd_coff_final_link_postscript)
- (bfd *, struct coff_final_link_info *);
-
- } bfd_coff_backend_data;
-
- #define coff_backend_info(abfd) \
- ((bfd_coff_backend_data *) (abfd)->xvec->backend_data)
-
- #define bfd_coff_swap_aux_in(a,e,t,c,ind,num,i) \
- ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i))
-
- #define bfd_coff_swap_sym_in(a,e,i) \
- ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i))
-
- #define bfd_coff_swap_lineno_in(a,e,i) \
- ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i))
-
- #define bfd_coff_swap_reloc_out(abfd, i, o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o))
-
- #define bfd_coff_swap_lineno_out(abfd, i, o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o))
-
- #define bfd_coff_swap_aux_out(a,i,t,c,ind,num,o) \
- ((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o))
-
- #define bfd_coff_swap_sym_out(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o))
-
- #define bfd_coff_swap_scnhdr_out(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o))
-
- #define bfd_coff_swap_filehdr_out(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o))
-
- #define bfd_coff_swap_aouthdr_out(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o))
-
- #define bfd_coff_filhsz(abfd) (coff_backend_info (abfd)->_bfd_filhsz)
- #define bfd_coff_aoutsz(abfd) (coff_backend_info (abfd)->_bfd_aoutsz)
- #define bfd_coff_scnhsz(abfd) (coff_backend_info (abfd)->_bfd_scnhsz)
- #define bfd_coff_symesz(abfd) (coff_backend_info (abfd)->_bfd_symesz)
- #define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz)
- #define bfd_coff_relsz(abfd) (coff_backend_info (abfd)->_bfd_relsz)
- #define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz)
- #define bfd_coff_filnmlen(abfd) (coff_backend_info (abfd)->_bfd_filnmlen)
- #define bfd_coff_long_filenames(abfd) \
- (coff_backend_info (abfd)->_bfd_coff_long_filenames)
- #define bfd_coff_long_section_names(abfd) \
- (coff_backend_info (abfd)->_bfd_coff_long_section_names)
- #define bfd_coff_default_section_alignment_power(abfd) \
- (coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power)
- #define bfd_coff_swap_filehdr_in(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o))
-
- #define bfd_coff_swap_aouthdr_in(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o))
-
- #define bfd_coff_swap_scnhdr_in(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o))
-
- #define bfd_coff_swap_reloc_in(abfd, i, o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o))
-
- #define bfd_coff_bad_format_hook(abfd, filehdr) \
- ((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr))
-
- #define bfd_coff_set_arch_mach_hook(abfd, filehdr)\
- ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr))
- #define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\
- ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook)\
- (abfd, filehdr, aouthdr))
-
- #define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name, section, flags_ptr)\
- ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\
- (abfd, scnhdr, name, section, flags_ptr))
-
- #define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\
- ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr))
-
- #define bfd_coff_slurp_symbol_table(abfd)\
- ((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd))
-
- #define bfd_coff_symname_in_debug(abfd, sym)\
- ((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym))
-
- #define bfd_coff_force_symnames_in_strings(abfd)\
- (coff_backend_info (abfd)->_bfd_coff_force_symnames_in_strings)
-
- #define bfd_coff_debug_string_prefix_length(abfd)\
- (coff_backend_info (abfd)->_bfd_coff_debug_string_prefix_length)
-
- #define bfd_coff_print_aux(abfd, file, base, symbol, aux, indaux)\
- ((coff_backend_info (abfd)->_bfd_coff_print_aux)\
- (abfd, file, base, symbol, aux, indaux))
-
- #define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order,\
- reloc, data, src_ptr, dst_ptr)\
- ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\
- (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr))
-
- #define bfd_coff_reloc16_estimate(abfd, section, reloc, shrink, link_info)\
- ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\
- (abfd, section, reloc, shrink, link_info))
-
- #define bfd_coff_classify_symbol(abfd, sym)\
- ((coff_backend_info (abfd)->_bfd_coff_classify_symbol)\
- (abfd, sym))
-
- #define bfd_coff_compute_section_file_positions(abfd)\
- ((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\
- (abfd))
-
- #define bfd_coff_start_final_link(obfd, info)\
- ((coff_backend_info (obfd)->_bfd_coff_start_final_link)\
- (obfd, info))
- #define bfd_coff_relocate_section(obfd,info,ibfd,o,con,rel,isyms,secs)\
- ((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\
- (obfd, info, ibfd, o, con, rel, isyms, secs))
- #define bfd_coff_rtype_to_howto(abfd, sec, rel, h, sym, addendp)\
- ((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\
- (abfd, sec, rel, h, sym, addendp))
- #define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\
- ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\
- (obfd, info, ibfd, sec, rel, adjustedp))
- #define bfd_coff_link_add_one_symbol(info, abfd, name, flags, section,\
- value, string, cp, coll, hashp)\
- ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\
- (info, abfd, name, flags, section, value, string, cp, coll, hashp))
-
- #define bfd_coff_link_output_has_begun(a,p) \
- ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a, p))
- #define bfd_coff_final_link_postscript(a,p) \
- ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a, p))
-
-3.2.2.7 Writing relocations
-...........................
-
-To write relocations, the back end steps though the canonical
-relocation table and create an `internal_reloc'. The symbol index to
-use is removed from the `offset' field in the symbol table supplied.
-The address comes directly from the sum of the section base address and
-the relocation offset; the type is dug directly from the howto field.
-Then the `internal_reloc' is swapped into the shape of an
-`external_reloc' and written out to disk.
-
-3.2.2.8 Reading linenumbers
-...........................
-
-Creating the linenumber table is done by reading in the entire coff
-linenumber table, and creating another table for internal use.
-
- A coff linenumber table is structured so that each function is
-marked as having a line number of 0. Each line within the function is
-an offset from the first line in the function. The base of the line
-number information for the table is stored in the symbol associated
-with the function.
-
- Note: The PE format uses line number 0 for a flag indicating a new
-source file.
-
- The information is copied from the external to the internal table,
-and each symbol which marks a function is marked by pointing its...
-
- How does this work ?
-
-3.2.2.9 Reading relocations
-...........................
-
-Coff relocations are easily transformed into the internal BFD form
-(`arelent').
-
- Reading a coff relocation table is done in the following stages:
-
- * Read the entire coff relocation table into memory.
-
- * Process each relocation in turn; first swap it from the external
- to the internal form.
-
- * Turn the symbol referenced in the relocation's symbol index into a
- pointer into the canonical symbol table. This table is the same
- as the one returned by a call to `bfd_canonicalize_symtab'. The
- back end will call that routine and save the result if a
- canonicalization hasn't been done.
-
- * The reloc index is turned into a pointer to a howto structure, in
- a back end specific way. For instance, the 386 and 960 use the
- `r_type' to directly produce an index into a howto table vector;
- the 88k subtracts a number from the `r_type' field and creates an
- addend field.
-
-
-File: bfd.info, Node: elf, Next: mmo, Prev: coff, Up: BFD back ends
-
-3.3 ELF backends
-================
-
-BFD support for ELF formats is being worked on. Currently, the best
-supported back ends are for sparc and i386 (running svr4 or Solaris 2).
-
- Documentation of the internals of the support code still needs to be
-written. The code is changing quickly enough that we haven't bothered
-yet.
-
-3.3.0.1 `bfd_elf_find_section'
-..............................
-
-*Synopsis*
- struct elf_internal_shdr *bfd_elf_find_section (bfd *abfd, char *name);
- *Description*
-Helper functions for GDB to locate the string tables. Since BFD hides
-string tables from callers, GDB needs to use an internal hook to find
-them. Sun's .stabstr, in particular, isn't even pointed to by the
-.stab section, so ordinary mechanisms wouldn't work to find it, even if
-we had some.
-
-
-File: bfd.info, Node: mmo, Prev: elf, Up: BFD back ends
-
-3.4 mmo backend
-===============
-
-The mmo object format is used exclusively together with Professor
-Donald E. Knuth's educational 64-bit processor MMIX. The simulator
-`mmix' which is available at
-`http://www-cs-faculty.stanford.edu/~knuth/programs/mmix.tar.gz'
-understands this format. That package also includes a combined
-assembler and linker called `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
-`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.
-
-* Menu:
-
-* File layout::
-* Symbol-table::
-* mmo section mapping::
-
-
-File: bfd.info, Node: File layout, Next: Symbol-table, Prev: mmo, Up: mmo
-
-3.4.1 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 `0x0000...00' to `0x01ff...ff'
-is executable, so it is used for code (and constants) and the area
-`0x2000...00' to `0x20ff...ff' is used for writable data. *Note mmo
-section mapping::.
-
- There is provision for specifying "special data" of 65536 different
-types. We use type 80 (decimal), arbitrarily chosen the same as the
-ELF `e_machine' number for MMIX, filling it with section information
-normally found in ELF objects. *Note 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 `0x98' forms
-a command called a `lopcode', where the next byte distinguished between
-the thirteen lopcodes. The two remaining bytes, called the `Y' and `Z'
-fields, or the `YZ' field (a 16-bit big-endian number), are used for
-various purposes different for each lopcode. As documented in
-`http://www-cs-faculty.stanford.edu/~knuth/mmixal-intro.ps.gz', the
-lopcodes are:
-
-`lop_quote'
- 0x98000001. The next word is contents, regardless of whether it
- starts with 0x98 or not.
-
-`lop_loc'
- 0x9801YYZZ, where `Z' is 1 or 2. This is a location directive,
- setting the location for the next data to the next 32-bit word
- (for Z = 1) or 64-bit word (for Z = 2), plus Y * 2^56. Normally
- `Y' is 0 for the text segment and 2 for the data segment.
-
-`lop_skip'
- 0x9802YYZZ. Increase the current location by `YZ' bytes.
-
-`lop_fixo'
- 0x9803YYZZ, where `Z' is 1 or 2. Store the current location as 64
- bits into the location pointed to by the next 32-bit (Z = 1) or
- 64-bit (Z = 2) word, plus Y * 2^56.
-
-`lop_fixr'
- 0x9804YYZZ. `YZ' is stored into the current location plus 2 - 4 *
- YZ.
-
-`lop_fixrx'
- 0x980500ZZ. `Z' is 16 or 24. A value `L' derived from the
- following 32-bit word are used in a manner similar to `YZ' in
- lop_fixr: it is xor:ed into the current location minus 4 * L. The
- first byte of the word is 0 or 1. If it is 1, then L = (LOWEST 24
- BITS OF WORD) - 2^Z, if 0, then L = (LOWEST 24 BITS OF WORD).
-
-`lop_file'
- 0x9806YYZZ. `Y' is the file number, `Z' is count of 32-bit words.
- Set the file number to `Y' and the line counter to 0. The next Z
- * 4 bytes contain the file name, padded with zeros if the count is
- not a multiple of four. The same `Y' may occur multiple times,
- but `Z' must be 0 for all but the first occurrence.
-
-`lop_line'
- 0x9807YYZZ. `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.
-
-`lop_spec'
- 0x9808YYZZ. `YZ' is the type number. Data until the next lopcode
- other than lop_quote forms special data of type `YZ'. *Note mmo
- section mapping::.
-
- Other types than 80, (or type 80 with a content that does not
- parse) is stored in sections named `.MMIX.spec_data.N' where N is
- the `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 N is concatenated to the data of the previous
- lop_spec Ns. The location in data or code at which the lop_spec
- occurred is lost.
-
-`lop_pre'
- 0x980901ZZ. The first lopcode in a file. The `Z' field forms the
- length of header information in 32-bit words, where the first word
- tells the time in seconds since `00:00:00 GMT Jan 1 1970'.
-
-`lop_post'
- 0x980a00ZZ. Z > 32. This lopcode follows after all
- content-generating lopcodes in a program. The `Z' field denotes
- the value of `rG' at the beginning of the program. The following
- 256 - Z big-endian 64-bit words are loaded into global registers
- `$G' ... `$255'.
-
-`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 (*note
- Symbol-table::).
-
-`lop_end'
- 0x980cYYZZ. The last lopcode in a program. It must follow the
- lop_stab lopcode and its data. The `YZ' field contains the number
- of 32-bit words of symbol table information after the preceding
- lop_stab lopcode.
-
- Note that the lopcode "fixups"; `lop_fixr', `lop_fixrx' and
-`lop_fixo' are not generated by BFD, but are handled. They are
-generated by `mmixal'.
-
- This trivial one-label, one-instruction file:
-
- :Main TRAP 1,2,3
-
- can be represented this way in mmo:
-
- 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 *Note Symbol-table::.
- 0x10404020
- 0x4d206120
- 0x69016e00
- 0x81000000
- 0x980c0005 - lop_end; symbol table contained five 32-bit words.
-
-
-File: bfd.info, Node: Symbol-table, Next: mmo section mapping, Prev: File layout, Up: mmo
-
-3.4.2 Symbol table format
--------------------------
-
-From mmixal.w (or really, the generated mmixal.tex) in
-`http://www-cs-faculty.stanford.edu/~knuth/programs/mmix.tar.gz'):
-"Symbols are stored and retrieved by means of a `ternary search trie',
-following ideas of Bentley and Sedgewick. (See ACM-SIAM Symp. on
-Discrete Algorithms `8' (1997), 360-369; R.Sedgewick, `Algorithms in C'
-(Reading, Mass. Addison-Wesley, 1998), `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 `m'. If any of the listed bits in `m'
-is nonzero, we execute what stands at the right, in the listed order:
-
- (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 `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.)
-
- Let's look again at the `lop_stab' for the trivial file (*note File
-layout::).
-
- 0x980b0000 - lop_stab for ":Main" = 0, serial 1.
- 0x203a4040
- 0x10404020
- 0x4d206120
- 0x69016e00
- 0x81000000
-
- This forms the trivial trie (note that the path between ":" and "M"
-is redundant):
-
- 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.
-
-
-File: bfd.info, Node: mmo section mapping, Prev: Symbol-table, Up: mmo
-
-3.4.3 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
-`0x0000...00' to `0x01ff...ff' and `0x2000...00' to `0x20ff...ff' are
-entered in sections named `.text' and `.data' respectively. If an area
-is not otherwise described, but would together with a neighboring lower
-area be less than `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 `.MMIX.sec.N'. Here, N is a number, a running count
-through the mmo file, starting at 0.
-
- A loadable section specified as:
-
- .section secname,"ax"
- TETRA 1,2,3,4,-1,-2009
- BYTE 80
-
- and linked to address `0x4', is represented by the sequence:
-
- 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.
-
- Note that the lop_spec wrapping does not include the section
-contents. Compare this to a non-loaded section specified as:
-
- .section thirdsec
- TETRA 200001,100002
- BYTE 38,40
-
- This, when linked to address `0x200000000000001c', is represented by:
-
- 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
-
- 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.
-
-
-File: bfd.info, Node: GNU Free Documentation License, Next: Index, Prev: BFD back ends, Up: Top
-
-Appendix A GNU Free Documentation License
-*****************************************
-
- Version 1.1, March 2000
-
- Copyright (C) 2000, 2003 Free Software Foundation, Inc.
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
- 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:
-
- 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."
-
- 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.
-
-
-File: bfd.info, Node: Index, Prev: GNU Free Documentation License, Up: Top
-
-Index
-*****
-
-
-* Menu:
-
-* _bfd_final_link_relocate: Relocating the section contents.
- (line 22)
-* _bfd_generic_link_add_archive_symbols: Adding symbols from an archive.
- (line 12)
-* _bfd_generic_link_add_one_symbol: Adding symbols from an object file.
- (line 19)
-* _bfd_generic_make_empty_symbol: symbol handling functions.
- (line 92)
-* _bfd_link_add_symbols in target vector: Adding Symbols to the Hash Table.
- (line 6)
-* _bfd_link_final_link in target vector: Performing the Final Link.
- (line 6)
-* _bfd_link_hash_table_create in target vector: Creating a Linker Hash Table.
- (line 6)
-* _bfd_relocate_contents: Relocating the section contents.
- (line 22)
-* aout_SIZE_machine_type: aout. (line 147)
-* aout_SIZE_mkobject: aout. (line 139)
-* aout_SIZE_new_section_hook: aout. (line 177)
-* aout_SIZE_set_arch_mach: aout. (line 164)
-* aout_SIZE_some_aout_object_p: aout. (line 125)
-* aout_SIZE_swap_exec_header_in: aout. (line 101)
-* aout_SIZE_swap_exec_header_out: aout. (line 113)
-* arelent_chain: typedef arelent. (line 339)
-* BFD: Overview. (line 6)
-* BFD canonical format: Canonical format. (line 11)
-* bfd_alloc: Opening and Closing.
- (line 203)
-* bfd_alloc2: Opening and Closing.
- (line 212)
-* bfd_alt_mach_code: BFD front end. (line 599)
-* bfd_arch_bits_per_address: Architectures. (line 476)
-* bfd_arch_bits_per_byte: Architectures. (line 468)
-* bfd_arch_get_compatible: Architectures. (line 411)
-* bfd_arch_list: Architectures. (line 402)
-* bfd_arch_mach_octets_per_byte: Architectures. (line 545)
-* BFD_ARELOC_BFIN_ADD: howto manager. (line 887)
-* BFD_ARELOC_BFIN_ADDR: howto manager. (line 938)
-* BFD_ARELOC_BFIN_AND: howto manager. (line 908)
-* BFD_ARELOC_BFIN_COMP: howto manager. (line 929)
-* BFD_ARELOC_BFIN_CONST: howto manager. (line 884)
-* BFD_ARELOC_BFIN_DIV: howto manager. (line 896)
-* BFD_ARELOC_BFIN_HWPAGE: howto manager. (line 935)
-* BFD_ARELOC_BFIN_LAND: howto manager. (line 917)
-* BFD_ARELOC_BFIN_LEN: howto manager. (line 923)
-* BFD_ARELOC_BFIN_LOR: howto manager. (line 920)
-* BFD_ARELOC_BFIN_LSHIFT: howto manager. (line 902)
-* BFD_ARELOC_BFIN_MOD: howto manager. (line 899)
-* BFD_ARELOC_BFIN_MULT: howto manager. (line 893)
-* BFD_ARELOC_BFIN_NEG: howto manager. (line 926)
-* BFD_ARELOC_BFIN_OR: howto manager. (line 911)
-* BFD_ARELOC_BFIN_PAGE: howto manager. (line 932)
-* BFD_ARELOC_BFIN_PUSH: howto manager. (line 881)
-* BFD_ARELOC_BFIN_RSHIFT: howto manager. (line 905)
-* BFD_ARELOC_BFIN_SUB: howto manager. (line 890)
-* BFD_ARELOC_BFIN_XOR: howto manager. (line 914)
-* bfd_cache_close: File Caching. (line 26)
-* bfd_cache_close_all: File Caching. (line 39)
-* bfd_cache_init: File Caching. (line 18)
-* bfd_calc_gnu_debuglink_crc32: Opening and Closing.
- (line 239)
-* bfd_canonicalize_reloc: BFD front end. (line 318)
-* bfd_canonicalize_symtab: symbol handling functions.
- (line 50)
-* bfd_check_format: Formats. (line 21)
-* bfd_check_format_matches: Formats. (line 52)
-* bfd_check_overflow: typedef arelent. (line 351)
-* bfd_close: Opening and Closing.
- (line 128)
-* bfd_close_all_done: Opening and Closing.
- (line 146)
-* bfd_coff_backend_data: coff. (line 246)
-* bfd_copy_private_bfd_data: BFD front end. (line 457)
-* bfd_copy_private_header_data: BFD front end. (line 439)
-* bfd_copy_private_section_data: section prototypes. (line 255)
-* bfd_copy_private_symbol_data: symbol handling functions.
- (line 140)
-* bfd_core_file_failing_command: Core Files. (line 12)
-* bfd_core_file_failing_signal: Core Files. (line 21)
-* bfd_create: Opening and Closing.
- (line 165)
-* bfd_create_gnu_debuglink_section: Opening and Closing.
- (line 305)
-* bfd_decode_symclass: symbol handling functions.
- (line 111)
-* bfd_default_arch_struct: Architectures. (line 423)
-* bfd_default_compatible: Architectures. (line 485)
-* bfd_default_reloc_type_lookup: howto manager. (line 1931)
-* bfd_default_scan: Architectures. (line 494)
-* bfd_default_set_arch_mach: Architectures. (line 441)
-* bfd_elf_find_section: elf. (line 13)
-* bfd_errmsg: BFD front end. (line 243)
-* bfd_fdopenr: Opening and Closing.
- (line 46)
-* bfd_fill_in_gnu_debuglink_section: Opening and Closing.
- (line 319)
-* bfd_find_target: bfd_target. (line 434)
-* bfd_follow_gnu_debuglink: Opening and Closing.
- (line 284)
-* bfd_fopen: Opening and Closing.
- (line 9)
-* bfd_format_string: Formats. (line 79)
-* bfd_generic_discard_group: section prototypes. (line 281)
-* bfd_generic_gc_sections: howto manager. (line 1962)
-* bfd_generic_get_relocated_section_contents: howto manager. (line 1982)
-* bfd_generic_is_group_section: section prototypes. (line 273)
-* bfd_generic_merge_sections: howto manager. (line 1972)
-* bfd_generic_relax_section: howto manager. (line 1949)
-* bfd_get_arch: Architectures. (line 452)
-* bfd_get_arch_info: Architectures. (line 504)
-* bfd_get_arch_size: BFD front end. (line 362)
-* bfd_get_error: BFD front end. (line 226)
-* bfd_get_error_handler: BFD front end. (line 294)
-* bfd_get_gp_size: BFD front end. (line 403)
-* bfd_get_mach: Architectures. (line 460)
-* bfd_get_mtime: BFD front end. (line 687)
-* bfd_get_next_mapent: Archives. (line 52)
-* bfd_get_reloc_code_name: howto manager. (line 1940)
-* bfd_get_reloc_size: typedef arelent. (line 330)
-* bfd_get_reloc_upper_bound: BFD front end. (line 308)
-* bfd_get_section_by_name: section prototypes. (line 17)
-* bfd_get_section_by_name_if: section prototypes. (line 31)
-* bfd_get_section_contents: section prototypes. (line 228)
-* bfd_get_sign_extend_vma: BFD front end. (line 375)
-* bfd_get_size <1>: Internal. (line 25)
-* bfd_get_size: BFD front end. (line 696)
-* bfd_get_symtab_upper_bound: symbol handling functions.
- (line 6)
-* bfd_get_unique_section_name: section prototypes. (line 50)
-* bfd_h_put_size: Internal. (line 97)
-* bfd_hash_allocate: Creating and Freeing a Hash Table.
- (line 17)
-* bfd_hash_lookup: Looking Up or Entering a String.
- (line 6)
-* bfd_hash_newfunc: Creating and Freeing a Hash Table.
- (line 12)
-* bfd_hash_set_default_size: Creating and Freeing a Hash Table.
- (line 25)
-* bfd_hash_table_free: Creating and Freeing a Hash Table.
- (line 21)
-* bfd_hash_table_init: Creating and Freeing a Hash Table.
- (line 6)
-* bfd_hash_table_init_n: Creating and Freeing a Hash Table.
- (line 6)
-* bfd_hash_traverse: Traversing a Hash Table.
- (line 6)
-* bfd_init: Initialization. (line 11)
-* bfd_install_relocation: typedef arelent. (line 392)
-* bfd_is_local_label: symbol handling functions.
- (line 17)
-* bfd_is_local_label_name: symbol handling functions.
- (line 26)
-* bfd_is_target_special_symbol: symbol handling functions.
- (line 38)
-* bfd_is_undefined_symclass: symbol handling functions.
- (line 120)
-* bfd_link_split_section: Writing the symbol table.
- (line 44)
-* bfd_log2: Internal. (line 164)
-* bfd_lookup_arch: Architectures. (line 512)
-* bfd_make_debug_symbol: symbol handling functions.
- (line 102)
-* bfd_make_empty_symbol: symbol handling functions.
- (line 78)
-* bfd_make_readable: Opening and Closing.
- (line 189)
-* bfd_make_section: section prototypes. (line 129)
-* bfd_make_section_anyway: section prototypes. (line 100)
-* bfd_make_section_anyway_with_flags: section prototypes. (line 82)
-* bfd_make_section_old_way: section prototypes. (line 62)
-* bfd_make_section_with_flags: section prototypes. (line 116)
-* bfd_make_writable: Opening and Closing.
- (line 175)
-* bfd_malloc_and_get_section: section prototypes. (line 245)
-* bfd_map_over_sections: section prototypes. (line 155)
-* bfd_merge_private_bfd_data: BFD front end. (line 473)
-* bfd_octets_per_byte: Architectures. (line 535)
-* bfd_open_file: File Caching. (line 52)
-* bfd_openr: Opening and Closing.
- (line 30)
-* bfd_openr_iovec: Opening and Closing.
- (line 76)
-* bfd_openr_next_archived_file: Archives. (line 78)
-* bfd_openstreamr: Opening and Closing.
- (line 67)
-* bfd_openw: Opening and Closing.
- (line 116)
-* bfd_perform_relocation: typedef arelent. (line 367)
-* bfd_perror: BFD front end. (line 252)
-* bfd_preserve_finish: BFD front end. (line 647)
-* bfd_preserve_restore: BFD front end. (line 637)
-* bfd_preserve_save: BFD front end. (line 621)
-* bfd_print_symbol_vandf: symbol handling functions.
- (line 70)
-* bfd_printable_arch_mach: Architectures. (line 523)
-* bfd_printable_name: Architectures. (line 383)
-* bfd_put_size: Internal. (line 22)
-* BFD_RELOC_12_PCREL: howto manager. (line 39)
-* BFD_RELOC_14: howto manager. (line 31)
-* BFD_RELOC_16: howto manager. (line 30)
-* BFD_RELOC_16_BASEREL: howto manager. (line 80)
-* BFD_RELOC_16_GOT_PCREL: howto manager. (line 52)
-* BFD_RELOC_16_GOTOFF: howto manager. (line 55)
-* BFD_RELOC_16_PCREL: howto manager. (line 38)
-* BFD_RELOC_16_PCREL_S2: howto manager. (line 92)
-* BFD_RELOC_16_PLT_PCREL: howto manager. (line 63)
-* BFD_RELOC_16_PLTOFF: howto manager. (line 67)
-* BFD_RELOC_16C_ABS20: howto manager. (line 1655)
-* BFD_RELOC_16C_ABS20_C: howto manager. (line 1656)
-* BFD_RELOC_16C_ABS24: howto manager. (line 1657)
-* BFD_RELOC_16C_ABS24_C: howto manager. (line 1658)
-* BFD_RELOC_16C_DISP04: howto manager. (line 1635)
-* BFD_RELOC_16C_DISP04_C: howto manager. (line 1636)
-* BFD_RELOC_16C_DISP08: howto manager. (line 1637)
-* BFD_RELOC_16C_DISP08_C: howto manager. (line 1638)
-* BFD_RELOC_16C_DISP16: howto manager. (line 1639)
-* BFD_RELOC_16C_DISP16_C: howto manager. (line 1640)
-* BFD_RELOC_16C_DISP24: howto manager. (line 1641)
-* BFD_RELOC_16C_DISP24_C: howto manager. (line 1642)
-* BFD_RELOC_16C_DISP24a: howto manager. (line 1643)
-* BFD_RELOC_16C_DISP24a_C: howto manager. (line 1644)
-* BFD_RELOC_16C_IMM04: howto manager. (line 1659)
-* BFD_RELOC_16C_IMM04_C: howto manager. (line 1660)
-* BFD_RELOC_16C_IMM16: howto manager. (line 1661)
-* BFD_RELOC_16C_IMM16_C: howto manager. (line 1662)
-* BFD_RELOC_16C_IMM20: howto manager. (line 1663)
-* BFD_RELOC_16C_IMM20_C: howto manager. (line 1664)
-* BFD_RELOC_16C_IMM24: howto manager. (line 1665)
-* BFD_RELOC_16C_IMM24_C: howto manager. (line 1666)
-* BFD_RELOC_16C_IMM32: howto manager. (line 1667)
-* BFD_RELOC_16C_IMM32_C: howto manager. (line 1668)
-* BFD_RELOC_16C_NUM08: howto manager. (line 1629)
-* BFD_RELOC_16C_NUM08_C: howto manager. (line 1630)
-* BFD_RELOC_16C_NUM16: howto manager. (line 1631)
-* BFD_RELOC_16C_NUM16_C: howto manager. (line 1632)
-* BFD_RELOC_16C_NUM32: howto manager. (line 1633)
-* BFD_RELOC_16C_NUM32_C: howto manager. (line 1634)
-* BFD_RELOC_16C_REG04: howto manager. (line 1645)
-* BFD_RELOC_16C_REG04_C: howto manager. (line 1646)
-* BFD_RELOC_16C_REG04a: howto manager. (line 1647)
-* BFD_RELOC_16C_REG04a_C: howto manager. (line 1648)
-* BFD_RELOC_16C_REG14: howto manager. (line 1649)
-* BFD_RELOC_16C_REG14_C: howto manager. (line 1650)
-* BFD_RELOC_16C_REG16: howto manager. (line 1651)
-* BFD_RELOC_16C_REG16_C: howto manager. (line 1652)
-* BFD_RELOC_16C_REG20: howto manager. (line 1653)
-* BFD_RELOC_16C_REG20_C: howto manager. (line 1654)
-* BFD_RELOC_23_PCREL_S2: howto manager. (line 93)
-* BFD_RELOC_24: howto manager. (line 29)
-* BFD_RELOC_24_PCREL: howto manager. (line 37)
-* BFD_RELOC_24_PLT_PCREL: howto manager. (line 62)
-* BFD_RELOC_26: howto manager. (line 28)
-* BFD_RELOC_32: howto manager. (line 27)
-* BFD_RELOC_32_BASEREL: howto manager. (line 79)
-* BFD_RELOC_32_GOT_PCREL: howto manager. (line 51)
-* BFD_RELOC_32_GOTOFF: howto manager. (line 54)
-* BFD_RELOC_32_PCREL: howto manager. (line 36)
-* BFD_RELOC_32_PCREL_S2: howto manager. (line 91)
-* BFD_RELOC_32_PLT_PCREL: howto manager. (line 61)
-* BFD_RELOC_32_PLTOFF: howto manager. (line 66)
-* BFD_RELOC_32_SECREL: howto manager. (line 48)
-* BFD_RELOC_386_COPY: howto manager. (line 435)
-* BFD_RELOC_386_GLOB_DAT: howto manager. (line 436)
-* BFD_RELOC_386_GOT32: howto manager. (line 433)
-* BFD_RELOC_386_GOTOFF: howto manager. (line 439)
-* BFD_RELOC_386_GOTPC: howto manager. (line 440)
-* BFD_RELOC_386_JUMP_SLOT: howto manager. (line 437)
-* BFD_RELOC_386_PLT32: howto manager. (line 434)
-* BFD_RELOC_386_RELATIVE: howto manager. (line 438)
-* BFD_RELOC_386_TLS_DESC: howto manager. (line 455)
-* BFD_RELOC_386_TLS_DESC_CALL: howto manager. (line 454)
-* BFD_RELOC_386_TLS_DTPMOD32: howto manager. (line 450)
-* BFD_RELOC_386_TLS_DTPOFF32: howto manager. (line 451)
-* BFD_RELOC_386_TLS_GD: howto manager. (line 445)
-* BFD_RELOC_386_TLS_GOTDESC: howto manager. (line 453)
-* BFD_RELOC_386_TLS_GOTIE: howto manager. (line 443)
-* BFD_RELOC_386_TLS_IE: howto manager. (line 442)
-* BFD_RELOC_386_TLS_IE_32: howto manager. (line 448)
-* BFD_RELOC_386_TLS_LDM: howto manager. (line 446)
-* BFD_RELOC_386_TLS_LDO_32: howto manager. (line 447)
-* BFD_RELOC_386_TLS_LE: howto manager. (line 444)
-* BFD_RELOC_386_TLS_LE_32: howto manager. (line 449)
-* BFD_RELOC_386_TLS_TPOFF: howto manager. (line 441)
-* BFD_RELOC_386_TLS_TPOFF32: howto manager. (line 452)
-* BFD_RELOC_390_12: howto manager. (line 1346)
-* BFD_RELOC_390_20: howto manager. (line 1446)
-* BFD_RELOC_390_COPY: howto manager. (line 1355)
-* BFD_RELOC_390_GLOB_DAT: howto manager. (line 1358)
-* BFD_RELOC_390_GOT12: howto manager. (line 1349)
-* BFD_RELOC_390_GOT16: howto manager. (line 1370)
-* BFD_RELOC_390_GOT20: howto manager. (line 1447)
-* BFD_RELOC_390_GOT64: howto manager. (line 1388)
-* BFD_RELOC_390_GOTENT: howto manager. (line 1394)
-* BFD_RELOC_390_GOTOFF64: howto manager. (line 1397)
-* BFD_RELOC_390_GOTPC: howto manager. (line 1367)
-* BFD_RELOC_390_GOTPCDBL: howto manager. (line 1385)
-* BFD_RELOC_390_GOTPLT12: howto manager. (line 1400)
-* BFD_RELOC_390_GOTPLT16: howto manager. (line 1403)
-* BFD_RELOC_390_GOTPLT20: howto manager. (line 1448)
-* BFD_RELOC_390_GOTPLT32: howto manager. (line 1406)
-* BFD_RELOC_390_GOTPLT64: howto manager. (line 1409)
-* BFD_RELOC_390_GOTPLTENT: howto manager. (line 1412)
-* BFD_RELOC_390_JMP_SLOT: howto manager. (line 1361)
-* BFD_RELOC_390_PC16DBL: howto manager. (line 1373)
-* BFD_RELOC_390_PC32DBL: howto manager. (line 1379)
-* BFD_RELOC_390_PLT16DBL: howto manager. (line 1376)
-* BFD_RELOC_390_PLT32: howto manager. (line 1352)
-* BFD_RELOC_390_PLT32DBL: howto manager. (line 1382)
-* BFD_RELOC_390_PLT64: howto manager. (line 1391)
-* BFD_RELOC_390_PLTOFF16: howto manager. (line 1415)
-* BFD_RELOC_390_PLTOFF32: howto manager. (line 1418)
-* BFD_RELOC_390_PLTOFF64: howto manager. (line 1421)
-* BFD_RELOC_390_RELATIVE: howto manager. (line 1364)
-* BFD_RELOC_390_TLS_DTPMOD: howto manager. (line 1441)
-* BFD_RELOC_390_TLS_DTPOFF: howto manager. (line 1442)
-* BFD_RELOC_390_TLS_GD32: howto manager. (line 1427)
-* BFD_RELOC_390_TLS_GD64: howto manager. (line 1428)
-* BFD_RELOC_390_TLS_GDCALL: howto manager. (line 1425)
-* BFD_RELOC_390_TLS_GOTIE12: howto manager. (line 1429)
-* BFD_RELOC_390_TLS_GOTIE20: howto manager. (line 1449)
-* BFD_RELOC_390_TLS_GOTIE32: howto manager. (line 1430)
-* BFD_RELOC_390_TLS_GOTIE64: howto manager. (line 1431)
-* BFD_RELOC_390_TLS_IE32: howto manager. (line 1434)
-* BFD_RELOC_390_TLS_IE64: howto manager. (line 1435)
-* BFD_RELOC_390_TLS_IEENT: howto manager. (line 1436)
-* BFD_RELOC_390_TLS_LDCALL: howto manager. (line 1426)
-* BFD_RELOC_390_TLS_LDM32: howto manager. (line 1432)
-* BFD_RELOC_390_TLS_LDM64: howto manager. (line 1433)
-* BFD_RELOC_390_TLS_LDO32: howto manager. (line 1439)
-* BFD_RELOC_390_TLS_LDO64: howto manager. (line 1440)
-* BFD_RELOC_390_TLS_LE32: howto manager. (line 1437)
-* BFD_RELOC_390_TLS_LE64: howto manager. (line 1438)
-* BFD_RELOC_390_TLS_LOAD: howto manager. (line 1424)
-* BFD_RELOC_390_TLS_TPOFF: howto manager. (line 1443)
-* BFD_RELOC_64: howto manager. (line 26)
-* BFD_RELOC_64_PCREL: howto manager. (line 35)
-* BFD_RELOC_64_PLT_PCREL: howto manager. (line 60)
-* BFD_RELOC_64_PLTOFF: howto manager. (line 65)
-* BFD_RELOC_68K_GLOB_DAT: howto manager. (line 74)
-* BFD_RELOC_68K_JMP_SLOT: howto manager. (line 75)
-* BFD_RELOC_68K_RELATIVE: howto manager. (line 76)
-* BFD_RELOC_8: howto manager. (line 32)
-* BFD_RELOC_860_COPY: howto manager. (line 1734)
-* BFD_RELOC_860_GLOB_DAT: howto manager. (line 1735)
-* BFD_RELOC_860_HAGOT: howto manager. (line 1760)
-* BFD_RELOC_860_HAGOTOFF: howto manager. (line 1761)
-* BFD_RELOC_860_HAPC: howto manager. (line 1762)
-* BFD_RELOC_860_HIGH: howto manager. (line 1763)
-* BFD_RELOC_860_HIGHADJ: howto manager. (line 1759)
-* BFD_RELOC_860_HIGOT: howto manager. (line 1764)
-* BFD_RELOC_860_HIGOTOFF: howto manager. (line 1765)
-* BFD_RELOC_860_JUMP_SLOT: howto manager. (line 1736)
-* BFD_RELOC_860_LOGOT0: howto manager. (line 1748)
-* BFD_RELOC_860_LOGOT1: howto manager. (line 1750)
-* BFD_RELOC_860_LOGOTOFF0: howto manager. (line 1752)
-* BFD_RELOC_860_LOGOTOFF1: howto manager. (line 1754)
-* BFD_RELOC_860_LOGOTOFF2: howto manager. (line 1756)
-* BFD_RELOC_860_LOGOTOFF3: howto manager. (line 1757)
-* BFD_RELOC_860_LOPC: howto manager. (line 1758)
-* BFD_RELOC_860_LOW0: howto manager. (line 1741)
-* BFD_RELOC_860_LOW1: howto manager. (line 1743)
-* BFD_RELOC_860_LOW2: howto manager. (line 1745)
-* BFD_RELOC_860_LOW3: howto manager. (line 1747)
-* BFD_RELOC_860_PC16: howto manager. (line 1740)
-* BFD_RELOC_860_PC26: howto manager. (line 1738)
-* BFD_RELOC_860_PLT26: howto manager. (line 1739)
-* BFD_RELOC_860_RELATIVE: howto manager. (line 1737)
-* BFD_RELOC_860_SPGOT0: howto manager. (line 1749)
-* BFD_RELOC_860_SPGOT1: howto manager. (line 1751)
-* BFD_RELOC_860_SPGOTOFF0: howto manager. (line 1753)
-* BFD_RELOC_860_SPGOTOFF1: howto manager. (line 1755)
-* BFD_RELOC_860_SPLIT0: howto manager. (line 1742)
-* BFD_RELOC_860_SPLIT1: howto manager. (line 1744)
-* BFD_RELOC_860_SPLIT2: howto manager. (line 1746)
-* BFD_RELOC_8_BASEREL: howto manager. (line 84)
-* BFD_RELOC_8_FFnn: howto manager. (line 88)
-* BFD_RELOC_8_GOT_PCREL: howto manager. (line 53)
-* BFD_RELOC_8_GOTOFF: howto manager. (line 59)
-* BFD_RELOC_8_PCREL: howto manager. (line 40)
-* BFD_RELOC_8_PLT_PCREL: howto manager. (line 64)
-* BFD_RELOC_8_PLTOFF: howto manager. (line 71)
-* BFD_RELOC_ALPHA_BRSGP: howto manager. (line 259)
-* BFD_RELOC_ALPHA_CODEADDR: howto manager. (line 250)
-* BFD_RELOC_ALPHA_DTPMOD64: howto manager. (line 266)
-* BFD_RELOC_ALPHA_DTPREL16: howto manager. (line 271)
-* BFD_RELOC_ALPHA_DTPREL64: howto manager. (line 268)
-* BFD_RELOC_ALPHA_DTPREL_HI16: howto manager. (line 269)
-* BFD_RELOC_ALPHA_DTPREL_LO16: howto manager. (line 270)
-* BFD_RELOC_ALPHA_ELF_LITERAL: howto manager. (line 215)
-* BFD_RELOC_ALPHA_GOTDTPREL16: howto manager. (line 267)
-* BFD_RELOC_ALPHA_GOTTPREL16: howto manager. (line 272)
-* BFD_RELOC_ALPHA_GPDISP: howto manager. (line 209)
-* BFD_RELOC_ALPHA_GPDISP_HI16: howto manager. (line 195)
-* BFD_RELOC_ALPHA_GPDISP_LO16: howto manager. (line 203)
-* BFD_RELOC_ALPHA_GPREL_HI16: howto manager. (line 254)
-* BFD_RELOC_ALPHA_GPREL_LO16: howto manager. (line 255)
-* BFD_RELOC_ALPHA_HINT: howto manager. (line 241)
-* BFD_RELOC_ALPHA_LINKAGE: howto manager. (line 246)
-* BFD_RELOC_ALPHA_LITERAL: howto manager. (line 214)
-* BFD_RELOC_ALPHA_LITUSE: howto manager. (line 216)
-* BFD_RELOC_ALPHA_TLSGD: howto manager. (line 264)
-* BFD_RELOC_ALPHA_TLSLDM: howto manager. (line 265)
-* BFD_RELOC_ALPHA_TPREL16: howto manager. (line 276)
-* BFD_RELOC_ALPHA_TPREL64: howto manager. (line 273)
-* BFD_RELOC_ALPHA_TPREL_HI16: howto manager. (line 274)
-* BFD_RELOC_ALPHA_TPREL_LO16: howto manager. (line 275)
-* BFD_RELOC_ARC_B22_PCREL: howto manager. (line 816)
-* BFD_RELOC_ARC_B26: howto manager. (line 821)
-* BFD_RELOC_ARM_ADR_IMM: howto manager. (line 709)
-* BFD_RELOC_ARM_ADRL_IMMEDIATE: howto manager. (line 697)
-* BFD_RELOC_ARM_CP_OFF_IMM: howto manager. (line 705)
-* BFD_RELOC_ARM_CP_OFF_IMM_S2: howto manager. (line 706)
-* BFD_RELOC_ARM_GLOB_DAT: howto manager. (line 678)
-* BFD_RELOC_ARM_GOT32: howto manager. (line 679)
-* BFD_RELOC_ARM_GOTOFF: howto manager. (line 682)
-* BFD_RELOC_ARM_GOTPC: howto manager. (line 683)
-* BFD_RELOC_ARM_HWLITERAL: howto manager. (line 716)
-* BFD_RELOC_ARM_IMMEDIATE: howto manager. (line 696)
-* BFD_RELOC_ARM_IN_POOL: howto manager. (line 712)
-* BFD_RELOC_ARM_JUMP_SLOT: howto manager. (line 677)
-* BFD_RELOC_ARM_LDR_IMM: howto manager. (line 710)
-* BFD_RELOC_ARM_LITERAL: howto manager. (line 711)
-* BFD_RELOC_ARM_MULTI: howto manager. (line 704)
-* BFD_RELOC_ARM_OFFSET_IMM: howto manager. (line 651)
-* BFD_RELOC_ARM_OFFSET_IMM8: howto manager. (line 713)
-* BFD_RELOC_ARM_PCREL_BLX: howto manager. (line 622)
-* BFD_RELOC_ARM_PCREL_BRANCH: howto manager. (line 618)
-* BFD_RELOC_ARM_PCREL_CALL: howto manager. (line 632)
-* BFD_RELOC_ARM_PCREL_JUMP: howto manager. (line 636)
-* BFD_RELOC_ARM_PLT32: howto manager. (line 680)
-* BFD_RELOC_ARM_PREL31: howto manager. (line 674)
-* BFD_RELOC_ARM_RELATIVE: howto manager. (line 681)
-* BFD_RELOC_ARM_ROSEGREL32: howto manager. (line 663)
-* BFD_RELOC_ARM_SBREL32: howto manager. (line 666)
-* BFD_RELOC_ARM_SHIFT_IMM: howto manager. (line 701)
-* BFD_RELOC_ARM_SMC: howto manager. (line 702)
-* BFD_RELOC_ARM_SWI: howto manager. (line 703)
-* BFD_RELOC_ARM_T32_ADD_PC12: howto manager. (line 700)
-* BFD_RELOC_ARM_T32_CP_OFF_IMM: howto manager. (line 707)
-* BFD_RELOC_ARM_T32_CP_OFF_IMM_S2: howto manager. (line 708)
-* BFD_RELOC_ARM_T32_IMM12: howto manager. (line 699)
-* BFD_RELOC_ARM_T32_IMMEDIATE: howto manager. (line 698)
-* BFD_RELOC_ARM_T32_OFFSET_IMM: howto manager. (line 715)
-* BFD_RELOC_ARM_T32_OFFSET_U8: howto manager. (line 714)
-* BFD_RELOC_ARM_TARGET1: howto manager. (line 659)
-* BFD_RELOC_ARM_TARGET2: howto manager. (line 669)
-* BFD_RELOC_ARM_THUMB_ADD: howto manager. (line 717)
-* BFD_RELOC_ARM_THUMB_IMM: howto manager. (line 718)
-* BFD_RELOC_ARM_THUMB_OFFSET: howto manager. (line 655)
-* BFD_RELOC_ARM_THUMB_SHIFT: howto manager. (line 719)
-* BFD_RELOC_ARM_TLS_DTPMOD32: howto manager. (line 690)
-* BFD_RELOC_ARM_TLS_DTPOFF32: howto manager. (line 689)
-* BFD_RELOC_ARM_TLS_GD32: howto manager. (line 686)
-* BFD_RELOC_ARM_TLS_IE32: howto manager. (line 692)
-* BFD_RELOC_ARM_TLS_LDM32: howto manager. (line 688)
-* BFD_RELOC_ARM_TLS_LDO32: howto manager. (line 687)
-* BFD_RELOC_ARM_TLS_LE32: howto manager. (line 693)
-* BFD_RELOC_ARM_TLS_TPOFF32: howto manager. (line 691)
-* BFD_RELOC_AVR_13_PCREL: howto manager. (line 1259)
-* BFD_RELOC_AVR_16_PM: howto manager. (line 1263)
-* BFD_RELOC_AVR_6: howto manager. (line 1338)
-* BFD_RELOC_AVR_6_ADIW: howto manager. (line 1342)
-* BFD_RELOC_AVR_7_PCREL: howto manager. (line 1255)
-* BFD_RELOC_AVR_CALL: howto manager. (line 1330)
-* BFD_RELOC_AVR_HH8_LDI: howto manager. (line 1275)
-* BFD_RELOC_AVR_HH8_LDI_NEG: howto manager. (line 1294)
-* BFD_RELOC_AVR_HH8_LDI_PM: howto manager. (line 1311)
-* BFD_RELOC_AVR_HH8_LDI_PM_NEG: howto manager. (line 1325)
-* BFD_RELOC_AVR_HI8_LDI: howto manager. (line 1271)
-* BFD_RELOC_AVR_HI8_LDI_NEG: howto manager. (line 1289)
-* BFD_RELOC_AVR_HI8_LDI_PM: howto manager. (line 1307)
-* BFD_RELOC_AVR_HI8_LDI_PM_NEG: howto manager. (line 1320)
-* BFD_RELOC_AVR_LDI: howto manager. (line 1334)
-* BFD_RELOC_AVR_LO8_LDI: howto manager. (line 1267)
-* BFD_RELOC_AVR_LO8_LDI_NEG: howto manager. (line 1284)
-* BFD_RELOC_AVR_LO8_LDI_PM: howto manager. (line 1303)
-* BFD_RELOC_AVR_LO8_LDI_PM_NEG: howto manager. (line 1316)
-* BFD_RELOC_AVR_MS8_LDI: howto manager. (line 1280)
-* BFD_RELOC_AVR_MS8_LDI_NEG: howto manager. (line 1299)
-* BFD_RELOC_BFIN_10_PCREL: howto manager. (line 841)
-* BFD_RELOC_BFIN_11_PCREL: howto manager. (line 844)
-* BFD_RELOC_BFIN_12_PCREL_JUMP: howto manager. (line 847)
-* BFD_RELOC_BFIN_12_PCREL_JUMP_S: howto manager. (line 850)
-* BFD_RELOC_BFIN_16_HIGH: howto manager. (line 829)
-* BFD_RELOC_BFIN_16_IMM: howto manager. (line 826)
-* BFD_RELOC_BFIN_16_LOW: howto manager. (line 838)
-* BFD_RELOC_BFIN_24_PCREL_CALL_X: howto manager. (line 853)
-* BFD_RELOC_BFIN_24_PCREL_JUMP_L: howto manager. (line 856)
-* BFD_RELOC_BFIN_4_PCREL: howto manager. (line 832)
-* BFD_RELOC_BFIN_5_PCREL: howto manager. (line 835)
-* BFD_RELOC_BFIN_FUNCDESC: howto manager. (line 862)
-* BFD_RELOC_BFIN_FUNCDESC_GOT17M4: howto manager. (line 863)
-* BFD_RELOC_BFIN_FUNCDESC_GOTHI: howto manager. (line 864)
-* BFD_RELOC_BFIN_FUNCDESC_GOTLO: howto manager. (line 865)
-* BFD_RELOC_BFIN_FUNCDESC_GOTOFF17M4: howto manager. (line 867)
-* BFD_RELOC_BFIN_FUNCDESC_GOTOFFHI: howto manager. (line 868)
-* BFD_RELOC_BFIN_FUNCDESC_GOTOFFLO: howto manager. (line 869)
-* BFD_RELOC_BFIN_FUNCDESC_VALUE: howto manager. (line 866)
-* BFD_RELOC_BFIN_GOT: howto manager. (line 875)
-* BFD_RELOC_BFIN_GOT17M4: howto manager. (line 859)
-* BFD_RELOC_BFIN_GOTHI: howto manager. (line 860)
-* BFD_RELOC_BFIN_GOTLO: howto manager. (line 861)
-* BFD_RELOC_BFIN_GOTOFF17M4: howto manager. (line 870)
-* BFD_RELOC_BFIN_GOTOFFHI: howto manager. (line 871)
-* BFD_RELOC_BFIN_GOTOFFLO: howto manager. (line 872)
-* BFD_RELOC_BFIN_PLTPC: howto manager. (line 878)
-* bfd_reloc_code_type: howto manager. (line 10)
-* BFD_RELOC_CRIS_16_GOT: howto manager. (line 1715)
-* BFD_RELOC_CRIS_16_GOTPLT: howto manager. (line 1721)
-* BFD_RELOC_CRIS_32_GOT: howto manager. (line 1712)
-* BFD_RELOC_CRIS_32_GOTPLT: howto manager. (line 1718)
-* BFD_RELOC_CRIS_32_GOTREL: howto manager. (line 1724)
-* BFD_RELOC_CRIS_32_PLT_GOTREL: howto manager. (line 1727)
-* BFD_RELOC_CRIS_32_PLT_PCREL: howto manager. (line 1730)
-* BFD_RELOC_CRIS_BDISP8: howto manager. (line 1693)
-* BFD_RELOC_CRIS_COPY: howto manager. (line 1706)
-* BFD_RELOC_CRIS_GLOB_DAT: howto manager. (line 1707)
-* BFD_RELOC_CRIS_JUMP_SLOT: howto manager. (line 1708)
-* BFD_RELOC_CRIS_LAPCQ_OFFSET: howto manager. (line 1701)
-* BFD_RELOC_CRIS_RELATIVE: howto manager. (line 1709)
-* BFD_RELOC_CRIS_SIGNED_16: howto manager. (line 1699)
-* BFD_RELOC_CRIS_SIGNED_6: howto manager. (line 1695)
-* BFD_RELOC_CRIS_SIGNED_8: howto manager. (line 1697)
-* BFD_RELOC_CRIS_UNSIGNED_16: howto manager. (line 1700)
-* BFD_RELOC_CRIS_UNSIGNED_4: howto manager. (line 1702)
-* BFD_RELOC_CRIS_UNSIGNED_5: howto manager. (line 1694)
-* BFD_RELOC_CRIS_UNSIGNED_6: howto manager. (line 1696)
-* BFD_RELOC_CRIS_UNSIGNED_8: howto manager. (line 1698)
-* BFD_RELOC_CRX_ABS16: howto manager. (line 1681)
-* BFD_RELOC_CRX_ABS32: howto manager. (line 1682)
-* BFD_RELOC_CRX_IMM16: howto manager. (line 1686)
-* BFD_RELOC_CRX_IMM32: howto manager. (line 1687)
-* BFD_RELOC_CRX_NUM16: howto manager. (line 1684)
-* BFD_RELOC_CRX_NUM32: howto manager. (line 1685)
-* BFD_RELOC_CRX_NUM8: howto manager. (line 1683)
-* BFD_RELOC_CRX_REGREL12: howto manager. (line 1677)
-* BFD_RELOC_CRX_REGREL22: howto manager. (line 1678)
-* BFD_RELOC_CRX_REGREL28: howto manager. (line 1679)
-* BFD_RELOC_CRX_REGREL32: howto manager. (line 1680)
-* BFD_RELOC_CRX_REL16: howto manager. (line 1674)
-* BFD_RELOC_CRX_REL24: howto manager. (line 1675)
-* BFD_RELOC_CRX_REL32: howto manager. (line 1676)
-* BFD_RELOC_CRX_REL4: howto manager. (line 1671)
-* BFD_RELOC_CRX_REL8: howto manager. (line 1672)
-* BFD_RELOC_CRX_REL8_CMP: howto manager. (line 1673)
-* BFD_RELOC_CRX_SWITCH16: howto manager. (line 1689)
-* BFD_RELOC_CRX_SWITCH32: howto manager. (line 1690)
-* BFD_RELOC_CRX_SWITCH8: howto manager. (line 1688)
-* BFD_RELOC_CTOR: howto manager. (line 612)
-* BFD_RELOC_D10V_10_PCREL_L: howto manager. (line 945)
-* BFD_RELOC_D10V_10_PCREL_R: howto manager. (line 941)
-* BFD_RELOC_D10V_18: howto manager. (line 950)
-* BFD_RELOC_D10V_18_PCREL: howto manager. (line 953)
-* BFD_RELOC_D30V_15: howto manager. (line 968)
-* BFD_RELOC_D30V_15_PCREL: howto manager. (line 972)
-* BFD_RELOC_D30V_15_PCREL_R: howto manager. (line 976)
-* BFD_RELOC_D30V_21: howto manager. (line 981)
-* BFD_RELOC_D30V_21_PCREL: howto manager. (line 985)
-* BFD_RELOC_D30V_21_PCREL_R: howto manager. (line 989)
-* BFD_RELOC_D30V_32: howto manager. (line 994)
-* BFD_RELOC_D30V_32_PCREL: howto manager. (line 997)
-* BFD_RELOC_D30V_6: howto manager. (line 956)
-* BFD_RELOC_D30V_9_PCREL: howto manager. (line 959)
-* BFD_RELOC_D30V_9_PCREL_R: howto manager. (line 963)
-* BFD_RELOC_DLX_HI16_S: howto manager. (line 1000)
-* BFD_RELOC_DLX_JMP26: howto manager. (line 1006)
-* BFD_RELOC_DLX_LO16: howto manager. (line 1003)
-* BFD_RELOC_FR30_10_IN_8: howto manager. (line 1185)
-* BFD_RELOC_FR30_12_PCREL: howto manager. (line 1193)
-* BFD_RELOC_FR30_20: howto manager. (line 1169)
-* BFD_RELOC_FR30_48: howto manager. (line 1166)
-* BFD_RELOC_FR30_6_IN_4: howto manager. (line 1173)
-* BFD_RELOC_FR30_8_IN_8: howto manager. (line 1177)
-* BFD_RELOC_FR30_9_IN_8: howto manager. (line 1181)
-* BFD_RELOC_FR30_9_PCREL: howto manager. (line 1189)
-* BFD_RELOC_FRV_FUNCDESC: howto manager. (line 377)
-* BFD_RELOC_FRV_FUNCDESC_GOT12: howto manager. (line 378)
-* BFD_RELOC_FRV_FUNCDESC_GOTHI: howto manager. (line 379)
-* BFD_RELOC_FRV_FUNCDESC_GOTLO: howto manager. (line 380)
-* BFD_RELOC_FRV_FUNCDESC_GOTOFF12: howto manager. (line 382)
-* BFD_RELOC_FRV_FUNCDESC_GOTOFFHI: howto manager. (line 383)
-* BFD_RELOC_FRV_FUNCDESC_GOTOFFLO: howto manager. (line 384)
-* BFD_RELOC_FRV_FUNCDESC_VALUE: howto manager. (line 381)
-* BFD_RELOC_FRV_GETTLSOFF: howto manager. (line 388)
-* BFD_RELOC_FRV_GETTLSOFF_RELAX: howto manager. (line 401)
-* BFD_RELOC_FRV_GOT12: howto manager. (line 374)
-* BFD_RELOC_FRV_GOTHI: howto manager. (line 375)
-* BFD_RELOC_FRV_GOTLO: howto manager. (line 376)
-* BFD_RELOC_FRV_GOTOFF12: howto manager. (line 385)
-* BFD_RELOC_FRV_GOTOFFHI: howto manager. (line 386)
-* BFD_RELOC_FRV_GOTOFFLO: howto manager. (line 387)
-* BFD_RELOC_FRV_GOTTLSDESC12: howto manager. (line 390)
-* BFD_RELOC_FRV_GOTTLSDESCHI: howto manager. (line 391)
-* BFD_RELOC_FRV_GOTTLSDESCLO: howto manager. (line 392)
-* BFD_RELOC_FRV_GOTTLSOFF12: howto manager. (line 396)
-* BFD_RELOC_FRV_GOTTLSOFFHI: howto manager. (line 397)
-* BFD_RELOC_FRV_GOTTLSOFFLO: howto manager. (line 398)
-* BFD_RELOC_FRV_GPREL12: howto manager. (line 369)
-* BFD_RELOC_FRV_GPREL32: howto manager. (line 371)
-* BFD_RELOC_FRV_GPRELHI: howto manager. (line 372)
-* BFD_RELOC_FRV_GPRELLO: howto manager. (line 373)
-* BFD_RELOC_FRV_GPRELU12: howto manager. (line 370)
-* BFD_RELOC_FRV_HI16: howto manager. (line 368)
-* BFD_RELOC_FRV_LABEL16: howto manager. (line 365)
-* BFD_RELOC_FRV_LABEL24: howto manager. (line 366)
-* BFD_RELOC_FRV_LO16: howto manager. (line 367)
-* BFD_RELOC_FRV_TLSDESC_RELAX: howto manager. (line 400)
-* BFD_RELOC_FRV_TLSDESC_VALUE: howto manager. (line 389)
-* BFD_RELOC_FRV_TLSMOFF: howto manager. (line 403)
-* BFD_RELOC_FRV_TLSMOFF12: howto manager. (line 393)
-* BFD_RELOC_FRV_TLSMOFFHI: howto manager. (line 394)
-* BFD_RELOC_FRV_TLSMOFFLO: howto manager. (line 395)
-* BFD_RELOC_FRV_TLSOFF: howto manager. (line 399)
-* BFD_RELOC_FRV_TLSOFF_RELAX: howto manager. (line 402)
-* BFD_RELOC_GPREL16: howto manager. (line 106)
-* BFD_RELOC_GPREL32: howto manager. (line 107)
-* BFD_RELOC_H8_DIR16A8: howto manager. (line 1772)
-* BFD_RELOC_H8_DIR16R8: howto manager. (line 1773)
-* BFD_RELOC_H8_DIR24A8: howto manager. (line 1774)
-* BFD_RELOC_H8_DIR24R8: howto manager. (line 1775)
-* BFD_RELOC_H8_DIR32A16: howto manager. (line 1776)
-* BFD_RELOC_HI16: howto manager. (line 289)
-* BFD_RELOC_HI16_BASEREL: howto manager. (line 82)
-* BFD_RELOC_HI16_GOTOFF: howto manager. (line 57)
-* BFD_RELOC_HI16_PCREL: howto manager. (line 301)
-* BFD_RELOC_HI16_PLTOFF: howto manager. (line 69)
-* BFD_RELOC_HI16_S: howto manager. (line 292)
-* BFD_RELOC_HI16_S_BASEREL: howto manager. (line 83)
-* BFD_RELOC_HI16_S_GOTOFF: howto manager. (line 58)
-* BFD_RELOC_HI16_S_PCREL: howto manager. (line 304)
-* BFD_RELOC_HI16_S_PLTOFF: howto manager. (line 70)
-* BFD_RELOC_HI22: howto manager. (line 101)
-* BFD_RELOC_I370_D12: howto manager. (line 609)
-* BFD_RELOC_I960_CALLJ: howto manager. (line 113)
-* BFD_RELOC_IA64_COPY: howto manager. (line 1565)
-* BFD_RELOC_IA64_DIR32LSB: howto manager. (line 1510)
-* BFD_RELOC_IA64_DIR32MSB: howto manager. (line 1509)
-* BFD_RELOC_IA64_DIR64LSB: howto manager. (line 1512)
-* BFD_RELOC_IA64_DIR64MSB: howto manager. (line 1511)
-* BFD_RELOC_IA64_DTPMOD64LSB: howto manager. (line 1575)
-* BFD_RELOC_IA64_DTPMOD64MSB: howto manager. (line 1574)
-* BFD_RELOC_IA64_DTPREL14: howto manager. (line 1577)
-* BFD_RELOC_IA64_DTPREL22: howto manager. (line 1578)
-* BFD_RELOC_IA64_DTPREL32LSB: howto manager. (line 1581)
-* BFD_RELOC_IA64_DTPREL32MSB: howto manager. (line 1580)
-* BFD_RELOC_IA64_DTPREL64I: howto manager. (line 1579)
-* BFD_RELOC_IA64_DTPREL64LSB: howto manager. (line 1583)
-* BFD_RELOC_IA64_DTPREL64MSB: howto manager. (line 1582)
-* BFD_RELOC_IA64_FPTR32LSB: howto manager. (line 1527)
-* BFD_RELOC_IA64_FPTR32MSB: howto manager. (line 1526)
-* BFD_RELOC_IA64_FPTR64I: howto manager. (line 1525)
-* BFD_RELOC_IA64_FPTR64LSB: howto manager. (line 1529)
-* BFD_RELOC_IA64_FPTR64MSB: howto manager. (line 1528)
-* BFD_RELOC_IA64_GPREL22: howto manager. (line 1513)
-* BFD_RELOC_IA64_GPREL32LSB: howto manager. (line 1516)
-* BFD_RELOC_IA64_GPREL32MSB: howto manager. (line 1515)
-* BFD_RELOC_IA64_GPREL64I: howto manager. (line 1514)
-* BFD_RELOC_IA64_GPREL64LSB: howto manager. (line 1518)
-* BFD_RELOC_IA64_GPREL64MSB: howto manager. (line 1517)
-* BFD_RELOC_IA64_IMM14: howto manager. (line 1506)
-* BFD_RELOC_IA64_IMM22: howto manager. (line 1507)
-* BFD_RELOC_IA64_IMM64: howto manager. (line 1508)
-* BFD_RELOC_IA64_IPLTLSB: howto manager. (line 1564)
-* BFD_RELOC_IA64_IPLTMSB: howto manager. (line 1563)
-* BFD_RELOC_IA64_LDXMOV: howto manager. (line 1567)
-* BFD_RELOC_IA64_LTOFF22: howto manager. (line 1519)
-* BFD_RELOC_IA64_LTOFF22X: howto manager. (line 1566)
-* BFD_RELOC_IA64_LTOFF64I: howto manager. (line 1520)
-* BFD_RELOC_IA64_LTOFF_DTPMOD22: howto manager. (line 1576)
-* BFD_RELOC_IA64_LTOFF_DTPREL22: howto manager. (line 1584)
-* BFD_RELOC_IA64_LTOFF_FPTR22: howto manager. (line 1541)
-* BFD_RELOC_IA64_LTOFF_FPTR32LSB: howto manager. (line 1544)
-* BFD_RELOC_IA64_LTOFF_FPTR32MSB: howto manager. (line 1543)
-* BFD_RELOC_IA64_LTOFF_FPTR64I: howto manager. (line 1542)
-* BFD_RELOC_IA64_LTOFF_FPTR64LSB: howto manager. (line 1546)
-* BFD_RELOC_IA64_LTOFF_FPTR64MSB: howto manager. (line 1545)
-* BFD_RELOC_IA64_LTOFF_TPREL22: howto manager. (line 1573)
-* BFD_RELOC_IA64_LTV32LSB: howto manager. (line 1560)
-* BFD_RELOC_IA64_LTV32MSB: howto manager. (line 1559)
-* BFD_RELOC_IA64_LTV64LSB: howto manager. (line 1562)
-* BFD_RELOC_IA64_LTV64MSB: howto manager. (line 1561)
-* BFD_RELOC_IA64_PCREL21B: howto manager. (line 1530)
-* BFD_RELOC_IA64_PCREL21BI: howto manager. (line 1531)
-* BFD_RELOC_IA64_PCREL21F: howto manager. (line 1533)
-* BFD_RELOC_IA64_PCREL21M: howto manager. (line 1532)
-* BFD_RELOC_IA64_PCREL22: howto manager. (line 1534)
-* BFD_RELOC_IA64_PCREL32LSB: howto manager. (line 1538)
-* BFD_RELOC_IA64_PCREL32MSB: howto manager. (line 1537)
-* BFD_RELOC_IA64_PCREL60B: howto manager. (line 1535)
-* BFD_RELOC_IA64_PCREL64I: howto manager. (line 1536)
-* BFD_RELOC_IA64_PCREL64LSB: howto manager. (line 1540)
-* BFD_RELOC_IA64_PCREL64MSB: howto manager. (line 1539)
-* BFD_RELOC_IA64_PLTOFF22: howto manager. (line 1521)
-* BFD_RELOC_IA64_PLTOFF64I: howto manager. (line 1522)
-* BFD_RELOC_IA64_PLTOFF64LSB: howto manager. (line 1524)
-* BFD_RELOC_IA64_PLTOFF64MSB: howto manager. (line 1523)
-* BFD_RELOC_IA64_REL32LSB: howto manager. (line 1556)
-* BFD_RELOC_IA64_REL32MSB: howto manager. (line 1555)
-* BFD_RELOC_IA64_REL64LSB: howto manager. (line 1558)
-* BFD_RELOC_IA64_REL64MSB: howto manager. (line 1557)
-* BFD_RELOC_IA64_SECREL32LSB: howto manager. (line 1552)
-* BFD_RELOC_IA64_SECREL32MSB: howto manager. (line 1551)
-* BFD_RELOC_IA64_SECREL64LSB: howto manager. (line 1554)
-* BFD_RELOC_IA64_SECREL64MSB: howto manager. (line 1553)
-* BFD_RELOC_IA64_SEGREL32LSB: howto manager. (line 1548)
-* BFD_RELOC_IA64_SEGREL32MSB: howto manager. (line 1547)
-* BFD_RELOC_IA64_SEGREL64LSB: howto manager. (line 1550)
-* BFD_RELOC_IA64_SEGREL64MSB: howto manager. (line 1549)
-* BFD_RELOC_IA64_TPREL14: howto manager. (line 1568)
-* BFD_RELOC_IA64_TPREL22: howto manager. (line 1569)
-* BFD_RELOC_IA64_TPREL64I: howto manager. (line 1570)
-* BFD_RELOC_IA64_TPREL64LSB: howto manager. (line 1572)
-* BFD_RELOC_IA64_TPREL64MSB: howto manager. (line 1571)
-* BFD_RELOC_IP2K_ADDR16CJP: howto manager. (line 1458)
-* BFD_RELOC_IP2K_BANK: howto manager. (line 1455)
-* BFD_RELOC_IP2K_EX8DATA: howto manager. (line 1466)
-* BFD_RELOC_IP2K_FR9: howto manager. (line 1452)
-* BFD_RELOC_IP2K_FR_OFFSET: howto manager. (line 1479)
-* BFD_RELOC_IP2K_HI8DATA: howto manager. (line 1465)
-* BFD_RELOC_IP2K_HI8INSN: howto manager. (line 1470)
-* BFD_RELOC_IP2K_LO8DATA: howto manager. (line 1464)
-* BFD_RELOC_IP2K_LO8INSN: howto manager. (line 1469)
-* BFD_RELOC_IP2K_PAGE3: howto manager. (line 1461)
-* BFD_RELOC_IP2K_PC_SKIP: howto manager. (line 1473)
-* BFD_RELOC_IP2K_TEXT: howto manager. (line 1476)
-* BFD_RELOC_IQ2000_OFFSET_16: howto manager. (line 1823)
-* BFD_RELOC_IQ2000_OFFSET_21: howto manager. (line 1824)
-* BFD_RELOC_IQ2000_UHI16: howto manager. (line 1825)
-* BFD_RELOC_LO10: howto manager. (line 102)
-* BFD_RELOC_LO16: howto manager. (line 298)
-* BFD_RELOC_LO16_BASEREL: howto manager. (line 81)
-* BFD_RELOC_LO16_GOTOFF: howto manager. (line 56)
-* BFD_RELOC_LO16_PCREL: howto manager. (line 307)
-* BFD_RELOC_LO16_PLTOFF: howto manager. (line 68)
-* BFD_RELOC_M32C_HI8: howto manager. (line 1009)
-* BFD_RELOC_M32C_RL_1ADDR: howto manager. (line 1011)
-* BFD_RELOC_M32C_RL_2ADDR: howto manager. (line 1012)
-* BFD_RELOC_M32C_RL_JUMP: howto manager. (line 1010)
-* BFD_RELOC_M32R_10_PCREL: howto manager. (line 1019)
-* BFD_RELOC_M32R_18_PCREL: howto manager. (line 1023)
-* BFD_RELOC_M32R_24: howto manager. (line 1015)
-* BFD_RELOC_M32R_26_PCREL: howto manager. (line 1026)
-* BFD_RELOC_M32R_26_PLTREL: howto manager. (line 1045)
-* BFD_RELOC_M32R_COPY: howto manager. (line 1046)
-* BFD_RELOC_M32R_GLOB_DAT: howto manager. (line 1047)
-* BFD_RELOC_M32R_GOT16_HI_SLO: howto manager. (line 1056)
-* BFD_RELOC_M32R_GOT16_HI_ULO: howto manager. (line 1055)
-* BFD_RELOC_M32R_GOT16_LO: howto manager. (line 1057)
-* BFD_RELOC_M32R_GOT24: howto manager. (line 1044)
-* BFD_RELOC_M32R_GOTOFF: howto manager. (line 1050)
-* BFD_RELOC_M32R_GOTOFF_HI_SLO: howto manager. (line 1052)
-* BFD_RELOC_M32R_GOTOFF_HI_ULO: howto manager. (line 1051)
-* BFD_RELOC_M32R_GOTOFF_LO: howto manager. (line 1053)
-* BFD_RELOC_M32R_GOTPC24: howto manager. (line 1054)
-* BFD_RELOC_M32R_GOTPC_HI_SLO: howto manager. (line 1059)
-* BFD_RELOC_M32R_GOTPC_HI_ULO: howto manager. (line 1058)
-* BFD_RELOC_M32R_GOTPC_LO: howto manager. (line 1060)
-* BFD_RELOC_M32R_HI16_SLO: howto manager. (line 1033)
-* BFD_RELOC_M32R_HI16_ULO: howto manager. (line 1029)
-* BFD_RELOC_M32R_JMP_SLOT: howto manager. (line 1048)
-* BFD_RELOC_M32R_LO16: howto manager. (line 1037)
-* BFD_RELOC_M32R_RELATIVE: howto manager. (line 1049)
-* BFD_RELOC_M32R_SDA16: howto manager. (line 1040)
-* BFD_RELOC_M68HC11_24: howto manager. (line 1620)
-* BFD_RELOC_M68HC11_3B: howto manager. (line 1595)
-* BFD_RELOC_M68HC11_HI8: howto manager. (line 1587)
-* BFD_RELOC_M68HC11_LO16: howto manager. (line 1609)
-* BFD_RELOC_M68HC11_LO8: howto manager. (line 1591)
-* BFD_RELOC_M68HC11_PAGE: howto manager. (line 1615)
-* BFD_RELOC_M68HC11_RL_GROUP: howto manager. (line 1604)
-* BFD_RELOC_M68HC11_RL_JUMP: howto manager. (line 1598)
-* BFD_RELOC_M68HC12_5B: howto manager. (line 1626)
-* BFD_RELOC_MCORE_PCREL_32: howto manager. (line 1200)
-* BFD_RELOC_MCORE_PCREL_IMM11BY2: howto manager. (line 1198)
-* BFD_RELOC_MCORE_PCREL_IMM4BY2: howto manager. (line 1199)
-* BFD_RELOC_MCORE_PCREL_IMM8BY4: howto manager. (line 1197)
-* BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2: howto manager. (line 1201)
-* BFD_RELOC_MCORE_RVA: howto manager. (line 1202)
-* BFD_RELOC_MIPS16_GPREL: howto manager. (line 286)
-* BFD_RELOC_MIPS16_HI16: howto manager. (line 310)
-* BFD_RELOC_MIPS16_HI16_S: howto manager. (line 313)
-* BFD_RELOC_MIPS16_JMP: howto manager. (line 283)
-* BFD_RELOC_MIPS16_LO16: howto manager. (line 319)
-* BFD_RELOC_MIPS_CALL16: howto manager. (line 326)
-* BFD_RELOC_MIPS_CALL_HI16: howto manager. (line 329)
-* BFD_RELOC_MIPS_CALL_LO16: howto manager. (line 330)
-* BFD_RELOC_MIPS_COPY: howto manager. (line 361)
-* BFD_RELOC_MIPS_DELETE: howto manager. (line 339)
-* BFD_RELOC_MIPS_GOT16: howto manager. (line 325)
-* BFD_RELOC_MIPS_GOT_DISP: howto manager. (line 334)
-* BFD_RELOC_MIPS_GOT_HI16: howto manager. (line 327)
-* BFD_RELOC_MIPS_GOT_LO16: howto manager. (line 328)
-* BFD_RELOC_MIPS_GOT_OFST: howto manager. (line 333)
-* BFD_RELOC_MIPS_GOT_PAGE: howto manager. (line 332)
-* BFD_RELOC_MIPS_HIGHER: howto manager. (line 341)
-* BFD_RELOC_MIPS_HIGHEST: howto manager. (line 340)
-* BFD_RELOC_MIPS_INSERT_A: howto manager. (line 337)
-* BFD_RELOC_MIPS_INSERT_B: howto manager. (line 338)
-* BFD_RELOC_MIPS_JALR: howto manager. (line 345)
-* BFD_RELOC_MIPS_JMP: howto manager. (line 279)
-* BFD_RELOC_MIPS_JUMP_SLOT: howto manager. (line 362)
-* BFD_RELOC_MIPS_LITERAL: howto manager. (line 322)
-* BFD_RELOC_MIPS_REL16: howto manager. (line 343)
-* BFD_RELOC_MIPS_RELGOT: howto manager. (line 344)
-* BFD_RELOC_MIPS_SCN_DISP: howto manager. (line 342)
-* BFD_RELOC_MIPS_SHIFT5: howto manager. (line 335)
-* BFD_RELOC_MIPS_SHIFT6: howto manager. (line 336)
-* BFD_RELOC_MIPS_SUB: howto manager. (line 331)
-* BFD_RELOC_MIPS_TLS_DTPMOD32: howto manager. (line 346)
-* BFD_RELOC_MIPS_TLS_DTPMOD64: howto manager. (line 348)
-* BFD_RELOC_MIPS_TLS_DTPREL32: howto manager. (line 347)
-* BFD_RELOC_MIPS_TLS_DTPREL64: howto manager. (line 349)
-* BFD_RELOC_MIPS_TLS_DTPREL_HI16: howto manager. (line 352)
-* BFD_RELOC_MIPS_TLS_DTPREL_LO16: howto manager. (line 353)
-* BFD_RELOC_MIPS_TLS_GD: howto manager. (line 350)
-* BFD_RELOC_MIPS_TLS_GOTTPREL: howto manager. (line 354)
-* BFD_RELOC_MIPS_TLS_LDM: howto manager. (line 351)
-* BFD_RELOC_MIPS_TLS_TPREL32: howto manager. (line 355)
-* BFD_RELOC_MIPS_TLS_TPREL64: howto manager. (line 356)
-* BFD_RELOC_MIPS_TLS_TPREL_HI16: howto manager. (line 357)
-* BFD_RELOC_MIPS_TLS_TPREL_LO16: howto manager. (line 358)
-* BFD_RELOC_MMIX_ADDR19: howto manager. (line 1231)
-* BFD_RELOC_MMIX_ADDR27: howto manager. (line 1235)
-* BFD_RELOC_MMIX_BASE_PLUS_OFFSET: howto manager. (line 1247)
-* BFD_RELOC_MMIX_CBRANCH: howto manager. (line 1211)
-* BFD_RELOC_MMIX_CBRANCH_1: howto manager. (line 1213)
-* BFD_RELOC_MMIX_CBRANCH_2: howto manager. (line 1214)
-* BFD_RELOC_MMIX_CBRANCH_3: howto manager. (line 1215)
-* BFD_RELOC_MMIX_CBRANCH_J: howto manager. (line 1212)
-* BFD_RELOC_MMIX_GETA: howto manager. (line 1205)
-* BFD_RELOC_MMIX_GETA_1: howto manager. (line 1206)
-* BFD_RELOC_MMIX_GETA_2: howto manager. (line 1207)
-* BFD_RELOC_MMIX_GETA_3: howto manager. (line 1208)
-* BFD_RELOC_MMIX_JMP: howto manager. (line 1225)
-* BFD_RELOC_MMIX_JMP_1: howto manager. (line 1226)
-* BFD_RELOC_MMIX_JMP_2: howto manager. (line 1227)
-* BFD_RELOC_MMIX_JMP_3: howto manager. (line 1228)
-* BFD_RELOC_MMIX_LOCAL: howto manager. (line 1251)
-* BFD_RELOC_MMIX_PUSHJ: howto manager. (line 1218)
-* BFD_RELOC_MMIX_PUSHJ_1: howto manager. (line 1219)
-* BFD_RELOC_MMIX_PUSHJ_2: howto manager. (line 1220)
-* BFD_RELOC_MMIX_PUSHJ_3: howto manager. (line 1221)
-* BFD_RELOC_MMIX_PUSHJ_STUBBABLE: howto manager. (line 1222)
-* BFD_RELOC_MMIX_REG: howto manager. (line 1243)
-* BFD_RELOC_MMIX_REG_OR_BYTE: howto manager. (line 1239)
-* BFD_RELOC_MN10300_16_PCREL: howto manager. (line 1135)
-* BFD_RELOC_MN10300_32_PCREL: howto manager. (line 1131)
-* BFD_RELOC_MN10300_COPY: howto manager. (line 421)
-* BFD_RELOC_MN10300_GLOB_DAT: howto manager. (line 424)
-* BFD_RELOC_MN10300_GOT16: howto manager. (line 417)
-* BFD_RELOC_MN10300_GOT24: howto manager. (line 413)
-* BFD_RELOC_MN10300_GOT32: howto manager. (line 409)
-* BFD_RELOC_MN10300_GOTOFF24: howto manager. (line 406)
-* BFD_RELOC_MN10300_JMP_SLOT: howto manager. (line 427)
-* BFD_RELOC_MN10300_RELATIVE: howto manager. (line 430)
-* BFD_RELOC_MSP430_10_PCREL: howto manager. (line 1814)
-* BFD_RELOC_MSP430_16: howto manager. (line 1816)
-* BFD_RELOC_MSP430_16_BYTE: howto manager. (line 1818)
-* BFD_RELOC_MSP430_16_PCREL: howto manager. (line 1815)
-* BFD_RELOC_MSP430_16_PCREL_BYTE: howto manager. (line 1817)
-* BFD_RELOC_MSP430_2X_PCREL: howto manager. (line 1819)
-* BFD_RELOC_MSP430_RL_PCREL: howto manager. (line 1820)
-* BFD_RELOC_MT_GNU_VTENTRY: howto manager. (line 1808)
-* BFD_RELOC_MT_GNU_VTINHERIT: howto manager. (line 1805)
-* BFD_RELOC_MT_HI16: howto manager. (line 1799)
-* BFD_RELOC_MT_LO16: howto manager. (line 1802)
-* BFD_RELOC_MT_PC16: howto manager. (line 1796)
-* BFD_RELOC_MT_PCINSN8: howto manager. (line 1811)
-* BFD_RELOC_NONE: howto manager. (line 116)
-* BFD_RELOC_NS32K_DISP_16: howto manager. (line 493)
-* BFD_RELOC_NS32K_DISP_16_PCREL: howto manager. (line 496)
-* BFD_RELOC_NS32K_DISP_32: howto manager. (line 494)
-* BFD_RELOC_NS32K_DISP_32_PCREL: howto manager. (line 497)
-* BFD_RELOC_NS32K_DISP_8: howto manager. (line 492)
-* BFD_RELOC_NS32K_DISP_8_PCREL: howto manager. (line 495)
-* BFD_RELOC_NS32K_IMM_16: howto manager. (line 487)
-* BFD_RELOC_NS32K_IMM_16_PCREL: howto manager. (line 490)
-* BFD_RELOC_NS32K_IMM_32: howto manager. (line 488)
-* BFD_RELOC_NS32K_IMM_32_PCREL: howto manager. (line 491)
-* BFD_RELOC_NS32K_IMM_8: howto manager. (line 486)
-* BFD_RELOC_NS32K_IMM_8_PCREL: howto manager. (line 489)
-* BFD_RELOC_OPENRISC_ABS_26: howto manager. (line 1768)
-* BFD_RELOC_OPENRISC_REL_26: howto manager. (line 1769)
-* BFD_RELOC_PDP11_DISP_6_PCREL: howto manager. (line 501)
-* BFD_RELOC_PDP11_DISP_8_PCREL: howto manager. (line 500)
-* BFD_RELOC_PJ_CODE_DIR16: howto manager. (line 506)
-* BFD_RELOC_PJ_CODE_DIR32: howto manager. (line 507)
-* BFD_RELOC_PJ_CODE_HI16: howto manager. (line 504)
-* BFD_RELOC_PJ_CODE_LO16: howto manager. (line 505)
-* BFD_RELOC_PJ_CODE_REL16: howto manager. (line 508)
-* BFD_RELOC_PJ_CODE_REL32: howto manager. (line 509)
-* BFD_RELOC_PPC64_ADDR16_DS: howto manager. (line 554)
-* BFD_RELOC_PPC64_ADDR16_LO_DS: howto manager. (line 555)
-* BFD_RELOC_PPC64_DTPREL16_DS: howto manager. (line 601)
-* BFD_RELOC_PPC64_DTPREL16_HIGHER: howto manager. (line 603)
-* BFD_RELOC_PPC64_DTPREL16_HIGHERA: howto manager. (line 604)
-* BFD_RELOC_PPC64_DTPREL16_HIGHEST: howto manager. (line 605)
-* BFD_RELOC_PPC64_DTPREL16_HIGHESTA: howto manager. (line 606)
-* BFD_RELOC_PPC64_DTPREL16_LO_DS: howto manager. (line 602)
-* BFD_RELOC_PPC64_GOT16_DS: howto manager. (line 556)
-* BFD_RELOC_PPC64_GOT16_LO_DS: howto manager. (line 557)
-* BFD_RELOC_PPC64_HIGHER: howto manager. (line 542)
-* BFD_RELOC_PPC64_HIGHER_S: howto manager. (line 543)
-* BFD_RELOC_PPC64_HIGHEST: howto manager. (line 544)
-* BFD_RELOC_PPC64_HIGHEST_S: howto manager. (line 545)
-* BFD_RELOC_PPC64_PLT16_LO_DS: howto manager. (line 558)
-* BFD_RELOC_PPC64_PLTGOT16: howto manager. (line 550)
-* BFD_RELOC_PPC64_PLTGOT16_DS: howto manager. (line 563)
-* BFD_RELOC_PPC64_PLTGOT16_HA: howto manager. (line 553)
-* BFD_RELOC_PPC64_PLTGOT16_HI: howto manager. (line 552)
-* BFD_RELOC_PPC64_PLTGOT16_LO: howto manager. (line 551)
-* BFD_RELOC_PPC64_PLTGOT16_LO_DS: howto manager. (line 564)
-* BFD_RELOC_PPC64_SECTOFF_DS: howto manager. (line 559)
-* BFD_RELOC_PPC64_SECTOFF_LO_DS: howto manager. (line 560)
-* BFD_RELOC_PPC64_TOC: howto manager. (line 549)
-* BFD_RELOC_PPC64_TOC16_DS: howto manager. (line 561)
-* BFD_RELOC_PPC64_TOC16_HA: howto manager. (line 548)
-* BFD_RELOC_PPC64_TOC16_HI: howto manager. (line 547)
-* BFD_RELOC_PPC64_TOC16_LO: howto manager. (line 546)
-* BFD_RELOC_PPC64_TOC16_LO_DS: howto manager. (line 562)
-* BFD_RELOC_PPC64_TPREL16_DS: howto manager. (line 595)
-* BFD_RELOC_PPC64_TPREL16_HIGHER: howto manager. (line 597)
-* BFD_RELOC_PPC64_TPREL16_HIGHERA: howto manager. (line 598)
-* BFD_RELOC_PPC64_TPREL16_HIGHEST: howto manager. (line 599)
-* BFD_RELOC_PPC64_TPREL16_HIGHESTA: howto manager. (line 600)
-* BFD_RELOC_PPC64_TPREL16_LO_DS: howto manager. (line 596)
-* BFD_RELOC_PPC_B16: howto manager. (line 515)
-* BFD_RELOC_PPC_B16_BRNTAKEN: howto manager. (line 517)
-* BFD_RELOC_PPC_B16_BRTAKEN: howto manager. (line 516)
-* BFD_RELOC_PPC_B26: howto manager. (line 512)
-* BFD_RELOC_PPC_BA16: howto manager. (line 518)
-* BFD_RELOC_PPC_BA16_BRNTAKEN: howto manager. (line 520)
-* BFD_RELOC_PPC_BA16_BRTAKEN: howto manager. (line 519)
-* BFD_RELOC_PPC_BA26: howto manager. (line 513)
-* BFD_RELOC_PPC_COPY: howto manager. (line 521)
-* BFD_RELOC_PPC_DTPMOD: howto manager. (line 568)
-* BFD_RELOC_PPC_DTPREL: howto manager. (line 578)
-* BFD_RELOC_PPC_DTPREL16: howto manager. (line 574)
-* BFD_RELOC_PPC_DTPREL16_HA: howto manager. (line 577)
-* BFD_RELOC_PPC_DTPREL16_HI: howto manager. (line 576)
-* BFD_RELOC_PPC_DTPREL16_LO: howto manager. (line 575)
-* BFD_RELOC_PPC_EMB_BIT_FLD: howto manager. (line 540)
-* BFD_RELOC_PPC_EMB_MRKREF: howto manager. (line 535)
-* BFD_RELOC_PPC_EMB_NADDR16: howto manager. (line 527)
-* BFD_RELOC_PPC_EMB_NADDR16_HA: howto manager. (line 530)
-* BFD_RELOC_PPC_EMB_NADDR16_HI: howto manager. (line 529)
-* BFD_RELOC_PPC_EMB_NADDR16_LO: howto manager. (line 528)
-* BFD_RELOC_PPC_EMB_NADDR32: howto manager. (line 526)
-* BFD_RELOC_PPC_EMB_RELSDA: howto manager. (line 541)
-* BFD_RELOC_PPC_EMB_RELSEC16: howto manager. (line 536)
-* BFD_RELOC_PPC_EMB_RELST_HA: howto manager. (line 539)
-* BFD_RELOC_PPC_EMB_RELST_HI: howto manager. (line 538)
-* BFD_RELOC_PPC_EMB_RELST_LO: howto manager. (line 537)
-* BFD_RELOC_PPC_EMB_SDA21: howto manager. (line 534)
-* BFD_RELOC_PPC_EMB_SDA2I16: howto manager. (line 532)
-* BFD_RELOC_PPC_EMB_SDA2REL: howto manager. (line 533)
-* BFD_RELOC_PPC_EMB_SDAI16: howto manager. (line 531)
-* BFD_RELOC_PPC_GLOB_DAT: howto manager. (line 522)
-* BFD_RELOC_PPC_GOT_DTPREL16: howto manager. (line 591)
-* BFD_RELOC_PPC_GOT_DTPREL16_HA: howto manager. (line 594)
-* BFD_RELOC_PPC_GOT_DTPREL16_HI: howto manager. (line 593)
-* BFD_RELOC_PPC_GOT_DTPREL16_LO: howto manager. (line 592)
-* BFD_RELOC_PPC_GOT_TLSGD16: howto manager. (line 579)
-* BFD_RELOC_PPC_GOT_TLSGD16_HA: howto manager. (line 582)
-* BFD_RELOC_PPC_GOT_TLSGD16_HI: howto manager. (line 581)
-* BFD_RELOC_PPC_GOT_TLSGD16_LO: howto manager. (line 580)
-* BFD_RELOC_PPC_GOT_TLSLD16: howto manager. (line 583)
-* BFD_RELOC_PPC_GOT_TLSLD16_HA: howto manager. (line 586)
-* BFD_RELOC_PPC_GOT_TLSLD16_HI: howto manager. (line 585)
-* BFD_RELOC_PPC_GOT_TLSLD16_LO: howto manager. (line 584)
-* BFD_RELOC_PPC_GOT_TPREL16: howto manager. (line 587)
-* BFD_RELOC_PPC_GOT_TPREL16_HA: howto manager. (line 590)
-* BFD_RELOC_PPC_GOT_TPREL16_HI: howto manager. (line 589)
-* BFD_RELOC_PPC_GOT_TPREL16_LO: howto manager. (line 588)
-* BFD_RELOC_PPC_JMP_SLOT: howto manager. (line 523)
-* BFD_RELOC_PPC_LOCAL24PC: howto manager. (line 525)
-* BFD_RELOC_PPC_RELATIVE: howto manager. (line 524)
-* BFD_RELOC_PPC_TLS: howto manager. (line 567)
-* BFD_RELOC_PPC_TOC16: howto manager. (line 514)
-* BFD_RELOC_PPC_TPREL: howto manager. (line 573)
-* BFD_RELOC_PPC_TPREL16: howto manager. (line 569)
-* BFD_RELOC_PPC_TPREL16_HA: howto manager. (line 572)
-* BFD_RELOC_PPC_TPREL16_HI: howto manager. (line 571)
-* BFD_RELOC_PPC_TPREL16_LO: howto manager. (line 570)
-* BFD_RELOC_RVA: howto manager. (line 85)
-* BFD_RELOC_SH_ALIGN: howto manager. (line 745)
-* BFD_RELOC_SH_CODE: howto manager. (line 746)
-* BFD_RELOC_SH_COPY: howto manager. (line 751)
-* BFD_RELOC_SH_COPY64: howto manager. (line 776)
-* BFD_RELOC_SH_COUNT: howto manager. (line 744)
-* BFD_RELOC_SH_DATA: howto manager. (line 747)
-* BFD_RELOC_SH_DISP12: howto manager. (line 727)
-* BFD_RELOC_SH_DISP12BY2: howto manager. (line 728)
-* BFD_RELOC_SH_DISP12BY4: howto manager. (line 729)
-* BFD_RELOC_SH_DISP12BY8: howto manager. (line 730)
-* BFD_RELOC_SH_DISP20: howto manager. (line 731)
-* BFD_RELOC_SH_DISP20BY8: howto manager. (line 732)
-* BFD_RELOC_SH_GLOB_DAT: howto manager. (line 752)
-* BFD_RELOC_SH_GLOB_DAT64: howto manager. (line 777)
-* BFD_RELOC_SH_GOT10BY4: howto manager. (line 780)
-* BFD_RELOC_SH_GOT10BY8: howto manager. (line 781)
-* BFD_RELOC_SH_GOT_HI16: howto manager. (line 759)
-* BFD_RELOC_SH_GOT_LOW16: howto manager. (line 756)
-* BFD_RELOC_SH_GOT_MEDHI16: howto manager. (line 758)
-* BFD_RELOC_SH_GOT_MEDLOW16: howto manager. (line 757)
-* BFD_RELOC_SH_GOTOFF_HI16: howto manager. (line 771)
-* BFD_RELOC_SH_GOTOFF_LOW16: howto manager. (line 768)
-* BFD_RELOC_SH_GOTOFF_MEDHI16: howto manager. (line 770)
-* BFD_RELOC_SH_GOTOFF_MEDLOW16: howto manager. (line 769)
-* BFD_RELOC_SH_GOTPC: howto manager. (line 755)
-* BFD_RELOC_SH_GOTPC_HI16: howto manager. (line 775)
-* BFD_RELOC_SH_GOTPC_LOW16: howto manager. (line 772)
-* BFD_RELOC_SH_GOTPC_MEDHI16: howto manager. (line 774)
-* BFD_RELOC_SH_GOTPC_MEDLOW16: howto manager. (line 773)
-* BFD_RELOC_SH_GOTPLT10BY4: howto manager. (line 782)
-* BFD_RELOC_SH_GOTPLT10BY8: howto manager. (line 783)
-* BFD_RELOC_SH_GOTPLT32: howto manager. (line 784)
-* BFD_RELOC_SH_GOTPLT_HI16: howto manager. (line 763)
-* BFD_RELOC_SH_GOTPLT_LOW16: howto manager. (line 760)
-* BFD_RELOC_SH_GOTPLT_MEDHI16: howto manager. (line 762)
-* BFD_RELOC_SH_GOTPLT_MEDLOW16: howto manager. (line 761)
-* BFD_RELOC_SH_IMM3: howto manager. (line 725)
-* BFD_RELOC_SH_IMM3U: howto manager. (line 726)
-* BFD_RELOC_SH_IMM4: howto manager. (line 733)
-* BFD_RELOC_SH_IMM4BY2: howto manager. (line 734)
-* BFD_RELOC_SH_IMM4BY4: howto manager. (line 735)
-* BFD_RELOC_SH_IMM8: howto manager. (line 736)
-* BFD_RELOC_SH_IMM8BY2: howto manager. (line 737)
-* BFD_RELOC_SH_IMM8BY4: howto manager. (line 738)
-* BFD_RELOC_SH_IMM_HI16: howto manager. (line 802)
-* BFD_RELOC_SH_IMM_HI16_PCREL: howto manager. (line 803)
-* BFD_RELOC_SH_IMM_LOW16: howto manager. (line 796)
-* BFD_RELOC_SH_IMM_LOW16_PCREL: howto manager. (line 797)
-* BFD_RELOC_SH_IMM_MEDHI16: howto manager. (line 800)
-* BFD_RELOC_SH_IMM_MEDHI16_PCREL: howto manager. (line 801)
-* BFD_RELOC_SH_IMM_MEDLOW16: howto manager. (line 798)
-* BFD_RELOC_SH_IMM_MEDLOW16_PCREL: howto manager. (line 799)
-* BFD_RELOC_SH_IMMS10: howto manager. (line 790)
-* BFD_RELOC_SH_IMMS10BY2: howto manager. (line 791)
-* BFD_RELOC_SH_IMMS10BY4: howto manager. (line 792)
-* BFD_RELOC_SH_IMMS10BY8: howto manager. (line 793)
-* BFD_RELOC_SH_IMMS16: howto manager. (line 794)
-* BFD_RELOC_SH_IMMS6: howto manager. (line 787)
-* BFD_RELOC_SH_IMMS6BY32: howto manager. (line 788)
-* BFD_RELOC_SH_IMMU16: howto manager. (line 795)
-* BFD_RELOC_SH_IMMU5: howto manager. (line 786)
-* BFD_RELOC_SH_IMMU6: howto manager. (line 789)
-* BFD_RELOC_SH_JMP_SLOT: howto manager. (line 753)
-* BFD_RELOC_SH_JMP_SLOT64: howto manager. (line 778)
-* BFD_RELOC_SH_LABEL: howto manager. (line 748)
-* BFD_RELOC_SH_LOOP_END: howto manager. (line 750)
-* BFD_RELOC_SH_LOOP_START: howto manager. (line 749)
-* BFD_RELOC_SH_PCDISP12BY2: howto manager. (line 724)
-* BFD_RELOC_SH_PCDISP8BY2: howto manager. (line 723)
-* BFD_RELOC_SH_PCRELIMM8BY2: howto manager. (line 739)
-* BFD_RELOC_SH_PCRELIMM8BY4: howto manager. (line 740)
-* BFD_RELOC_SH_PLT_HI16: howto manager. (line 767)
-* BFD_RELOC_SH_PLT_LOW16: howto manager. (line 764)
-* BFD_RELOC_SH_PLT_MEDHI16: howto manager. (line 766)
-* BFD_RELOC_SH_PLT_MEDLOW16: howto manager. (line 765)
-* BFD_RELOC_SH_PT_16: howto manager. (line 804)
-* BFD_RELOC_SH_RELATIVE: howto manager. (line 754)
-* BFD_RELOC_SH_RELATIVE64: howto manager. (line 779)
-* BFD_RELOC_SH_SHMEDIA_CODE: howto manager. (line 785)
-* BFD_RELOC_SH_SWITCH16: howto manager. (line 741)
-* BFD_RELOC_SH_SWITCH32: howto manager. (line 742)
-* BFD_RELOC_SH_TLS_DTPMOD32: howto manager. (line 810)
-* BFD_RELOC_SH_TLS_DTPOFF32: howto manager. (line 811)
-* BFD_RELOC_SH_TLS_GD_32: howto manager. (line 805)
-* BFD_RELOC_SH_TLS_IE_32: howto manager. (line 808)
-* BFD_RELOC_SH_TLS_LD_32: howto manager. (line 806)
-* BFD_RELOC_SH_TLS_LDO_32: howto manager. (line 807)
-* BFD_RELOC_SH_TLS_LE_32: howto manager. (line 809)
-* BFD_RELOC_SH_TLS_TPOFF32: howto manager. (line 812)
-* BFD_RELOC_SH_USES: howto manager. (line 743)
-* BFD_RELOC_SPARC13: howto manager. (line 119)
-* BFD_RELOC_SPARC22: howto manager. (line 118)
-* BFD_RELOC_SPARC_10: howto manager. (line 141)
-* BFD_RELOC_SPARC_11: howto manager. (line 142)
-* BFD_RELOC_SPARC_5: howto manager. (line 154)
-* BFD_RELOC_SPARC_6: howto manager. (line 153)
-* BFD_RELOC_SPARC_64: howto manager. (line 140)
-* BFD_RELOC_SPARC_7: howto manager. (line 152)
-* BFD_RELOC_SPARC_BASE13: howto manager. (line 136)
-* BFD_RELOC_SPARC_BASE22: howto manager. (line 137)
-* BFD_RELOC_SPARC_COPY: howto manager. (line 126)
-* BFD_RELOC_SPARC_DISP64: howto manager. (line 155)
-* BFD_RELOC_SPARC_GLOB_DAT: howto manager. (line 127)
-* BFD_RELOC_SPARC_GOT10: howto manager. (line 120)
-* BFD_RELOC_SPARC_GOT13: howto manager. (line 121)
-* BFD_RELOC_SPARC_GOT22: howto manager. (line 122)
-* BFD_RELOC_SPARC_H44: howto manager. (line 160)
-* BFD_RELOC_SPARC_HH22: howto manager. (line 144)
-* BFD_RELOC_SPARC_HIX22: howto manager. (line 158)
-* BFD_RELOC_SPARC_HM10: howto manager. (line 145)
-* BFD_RELOC_SPARC_JMP_SLOT: howto manager. (line 128)
-* BFD_RELOC_SPARC_L44: howto manager. (line 162)
-* BFD_RELOC_SPARC_LM22: howto manager. (line 146)
-* BFD_RELOC_SPARC_LOX10: howto manager. (line 159)
-* BFD_RELOC_SPARC_M44: howto manager. (line 161)
-* BFD_RELOC_SPARC_OLO10: howto manager. (line 143)
-* BFD_RELOC_SPARC_PC10: howto manager. (line 123)
-* BFD_RELOC_SPARC_PC22: howto manager. (line 124)
-* BFD_RELOC_SPARC_PC_HH22: howto manager. (line 147)
-* BFD_RELOC_SPARC_PC_HM10: howto manager. (line 148)
-* BFD_RELOC_SPARC_PC_LM22: howto manager. (line 149)
-* BFD_RELOC_SPARC_PLT32: howto manager. (line 156)
-* BFD_RELOC_SPARC_PLT64: howto manager. (line 157)
-* BFD_RELOC_SPARC_REGISTER: howto manager. (line 163)
-* BFD_RELOC_SPARC_RELATIVE: howto manager. (line 129)
-* BFD_RELOC_SPARC_REV32: howto manager. (line 166)
-* BFD_RELOC_SPARC_TLS_DTPMOD32: howto manager. (line 187)
-* BFD_RELOC_SPARC_TLS_DTPMOD64: howto manager. (line 188)
-* BFD_RELOC_SPARC_TLS_DTPOFF32: howto manager. (line 189)
-* BFD_RELOC_SPARC_TLS_DTPOFF64: howto manager. (line 190)
-* BFD_RELOC_SPARC_TLS_GD_ADD: howto manager. (line 171)
-* BFD_RELOC_SPARC_TLS_GD_CALL: howto manager. (line 172)
-* BFD_RELOC_SPARC_TLS_GD_HI22: howto manager. (line 169)
-* BFD_RELOC_SPARC_TLS_GD_LO10: howto manager. (line 170)
-* BFD_RELOC_SPARC_TLS_IE_ADD: howto manager. (line 184)
-* BFD_RELOC_SPARC_TLS_IE_HI22: howto manager. (line 180)
-* BFD_RELOC_SPARC_TLS_IE_LD: howto manager. (line 182)
-* BFD_RELOC_SPARC_TLS_IE_LDX: howto manager. (line 183)
-* BFD_RELOC_SPARC_TLS_IE_LO10: howto manager. (line 181)
-* BFD_RELOC_SPARC_TLS_LDM_ADD: howto manager. (line 175)
-* BFD_RELOC_SPARC_TLS_LDM_CALL: howto manager. (line 176)
-* BFD_RELOC_SPARC_TLS_LDM_HI22: howto manager. (line 173)
-* BFD_RELOC_SPARC_TLS_LDM_LO10: howto manager. (line 174)
-* BFD_RELOC_SPARC_TLS_LDO_ADD: howto manager. (line 179)
-* BFD_RELOC_SPARC_TLS_LDO_HIX22: howto manager. (line 177)
-* BFD_RELOC_SPARC_TLS_LDO_LOX10: howto manager. (line 178)
-* BFD_RELOC_SPARC_TLS_LE_HIX22: howto manager. (line 185)
-* BFD_RELOC_SPARC_TLS_LE_LOX10: howto manager. (line 186)
-* BFD_RELOC_SPARC_TLS_TPOFF32: howto manager. (line 191)
-* BFD_RELOC_SPARC_TLS_TPOFF64: howto manager. (line 192)
-* BFD_RELOC_SPARC_UA16: howto manager. (line 130)
-* BFD_RELOC_SPARC_UA32: howto manager. (line 131)
-* BFD_RELOC_SPARC_UA64: howto manager. (line 132)
-* BFD_RELOC_SPARC_WDISP16: howto manager. (line 150)
-* BFD_RELOC_SPARC_WDISP19: howto manager. (line 151)
-* BFD_RELOC_SPARC_WDISP22: howto manager. (line 117)
-* BFD_RELOC_SPARC_WPLT30: howto manager. (line 125)
-* BFD_RELOC_THUMB_PCREL_BLX: howto manager. (line 627)
-* BFD_RELOC_THUMB_PCREL_BRANCH12: howto manager. (line 641)
-* BFD_RELOC_THUMB_PCREL_BRANCH20: howto manager. (line 642)
-* BFD_RELOC_THUMB_PCREL_BRANCH23: howto manager. (line 643)
-* BFD_RELOC_THUMB_PCREL_BRANCH25: howto manager. (line 644)
-* BFD_RELOC_THUMB_PCREL_BRANCH7: howto manager. (line 639)
-* BFD_RELOC_THUMB_PCREL_BRANCH9: howto manager. (line 640)
-* BFD_RELOC_TIC30_LDP: howto manager. (line 1139)
-* BFD_RELOC_TIC54X_16_OF_23: howto manager. (line 1157)
-* BFD_RELOC_TIC54X_23: howto manager. (line 1154)
-* BFD_RELOC_TIC54X_MS7_OF_23: howto manager. (line 1162)
-* BFD_RELOC_TIC54X_PARTLS7: howto manager. (line 1144)
-* BFD_RELOC_TIC54X_PARTMS9: howto manager. (line 1149)
-* bfd_reloc_type_lookup: howto manager. (line 1920)
-* BFD_RELOC_V850_22_PCREL: howto manager. (line 1066)
-* BFD_RELOC_V850_9_PCREL: howto manager. (line 1063)
-* BFD_RELOC_V850_ALIGN: howto manager. (line 1124)
-* BFD_RELOC_V850_CALLT_16_16_OFFSET: howto manager. (line 1115)
-* BFD_RELOC_V850_CALLT_6_7_OFFSET: howto manager. (line 1112)
-* BFD_RELOC_V850_LO16_SPLIT_OFFSET: howto manager. (line 1127)
-* BFD_RELOC_V850_LONGCALL: howto manager. (line 1118)
-* BFD_RELOC_V850_LONGJUMP: howto manager. (line 1121)
-* BFD_RELOC_V850_SDA_15_16_OFFSET: howto manager. (line 1072)
-* BFD_RELOC_V850_SDA_16_16_OFFSET: howto manager. (line 1069)
-* BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET: howto manager. (line 1104)
-* BFD_RELOC_V850_TDA_16_16_OFFSET: howto manager. (line 1094)
-* BFD_RELOC_V850_TDA_4_4_OFFSET: howto manager. (line 1101)
-* BFD_RELOC_V850_TDA_4_5_OFFSET: howto manager. (line 1097)
-* BFD_RELOC_V850_TDA_6_8_OFFSET: howto manager. (line 1083)
-* BFD_RELOC_V850_TDA_7_7_OFFSET: howto manager. (line 1091)
-* BFD_RELOC_V850_TDA_7_8_OFFSET: howto manager. (line 1087)
-* BFD_RELOC_V850_ZDA_15_16_OFFSET: howto manager. (line 1079)
-* BFD_RELOC_V850_ZDA_16_16_OFFSET: howto manager. (line 1076)
-* BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET: howto manager. (line 1108)
-* BFD_RELOC_VAX_GLOB_DAT: howto manager. (line 1791)
-* BFD_RELOC_VAX_JMP_SLOT: howto manager. (line 1792)
-* BFD_RELOC_VAX_RELATIVE: howto manager. (line 1793)
-* BFD_RELOC_VPE4KMATH_DATA: howto manager. (line 1482)
-* BFD_RELOC_VPE4KMATH_INSN: howto manager. (line 1483)
-* BFD_RELOC_VTABLE_ENTRY: howto manager. (line 1487)
-* BFD_RELOC_VTABLE_INHERIT: howto manager. (line 1486)
-* BFD_RELOC_X86_64_32S: howto manager. (line 465)
-* BFD_RELOC_X86_64_COPY: howto manager. (line 460)
-* BFD_RELOC_X86_64_DTPMOD64: howto manager. (line 466)
-* BFD_RELOC_X86_64_DTPOFF32: howto manager. (line 471)
-* BFD_RELOC_X86_64_DTPOFF64: howto manager. (line 467)
-* BFD_RELOC_X86_64_GLOB_DAT: howto manager. (line 461)
-* BFD_RELOC_X86_64_GOT32: howto manager. (line 458)
-* BFD_RELOC_X86_64_GOT64: howto manager. (line 476)
-* BFD_RELOC_X86_64_GOTOFF64: howto manager. (line 474)
-* BFD_RELOC_X86_64_GOTPC32: howto manager. (line 475)
-* BFD_RELOC_X86_64_GOTPC32_TLSDESC: howto manager. (line 481)
-* BFD_RELOC_X86_64_GOTPC64: howto manager. (line 478)
-* BFD_RELOC_X86_64_GOTPCREL: howto manager. (line 464)
-* BFD_RELOC_X86_64_GOTPCREL64: howto manager. (line 477)
-* BFD_RELOC_X86_64_GOTPLT64: howto manager. (line 479)
-* BFD_RELOC_X86_64_GOTTPOFF: howto manager. (line 472)
-* BFD_RELOC_X86_64_JUMP_SLOT: howto manager. (line 462)
-* BFD_RELOC_X86_64_PLT32: howto manager. (line 459)
-* BFD_RELOC_X86_64_PLTOFF64: howto manager. (line 480)
-* BFD_RELOC_X86_64_RELATIVE: howto manager. (line 463)
-* BFD_RELOC_X86_64_TLSDESC: howto manager. (line 483)
-* BFD_RELOC_X86_64_TLSDESC_CALL: howto manager. (line 482)
-* BFD_RELOC_X86_64_TLSGD: howto manager. (line 469)
-* BFD_RELOC_X86_64_TLSLD: howto manager. (line 470)
-* BFD_RELOC_X86_64_TPOFF32: howto manager. (line 473)
-* BFD_RELOC_X86_64_TPOFF64: howto manager. (line 468)
-* BFD_RELOC_XC16X_PAG: howto manager. (line 1785)
-* BFD_RELOC_XC16X_POF: howto manager. (line 1786)
-* BFD_RELOC_XC16X_SEG: howto manager. (line 1787)
-* BFD_RELOC_XC16X_SOF: howto manager. (line 1788)
-* BFD_RELOC_XSTORMY16_12: howto manager. (line 1780)
-* BFD_RELOC_XSTORMY16_24: howto manager. (line 1781)
-* BFD_RELOC_XSTORMY16_FPTR16: howto manager. (line 1782)
-* BFD_RELOC_XSTORMY16_REL_12: howto manager. (line 1779)
-* BFD_RELOC_XTENSA_ASM_EXPAND: howto manager. (line 1897)
-* BFD_RELOC_XTENSA_ASM_SIMPLIFY: howto manager. (line 1902)
-* BFD_RELOC_XTENSA_DIFF16: howto manager. (line 1844)
-* BFD_RELOC_XTENSA_DIFF32: howto manager. (line 1845)
-* BFD_RELOC_XTENSA_DIFF8: howto manager. (line 1843)
-* BFD_RELOC_XTENSA_GLOB_DAT: howto manager. (line 1833)
-* BFD_RELOC_XTENSA_JMP_SLOT: howto manager. (line 1834)
-* BFD_RELOC_XTENSA_OP0: howto manager. (line 1891)
-* BFD_RELOC_XTENSA_OP1: howto manager. (line 1892)
-* BFD_RELOC_XTENSA_OP2: howto manager. (line 1893)
-* BFD_RELOC_XTENSA_PLT: howto manager. (line 1838)
-* BFD_RELOC_XTENSA_RELATIVE: howto manager. (line 1835)
-* BFD_RELOC_XTENSA_RTLD: howto manager. (line 1828)
-* BFD_RELOC_XTENSA_SLOT0_ALT: howto manager. (line 1873)
-* BFD_RELOC_XTENSA_SLOT0_OP: howto manager. (line 1853)
-* BFD_RELOC_XTENSA_SLOT10_ALT: howto manager. (line 1883)
-* BFD_RELOC_XTENSA_SLOT10_OP: howto manager. (line 1863)
-* BFD_RELOC_XTENSA_SLOT11_ALT: howto manager. (line 1884)
-* BFD_RELOC_XTENSA_SLOT11_OP: howto manager. (line 1864)
-* BFD_RELOC_XTENSA_SLOT12_ALT: howto manager. (line 1885)
-* BFD_RELOC_XTENSA_SLOT12_OP: howto manager. (line 1865)
-* BFD_RELOC_XTENSA_SLOT13_ALT: howto manager. (line 1886)
-* BFD_RELOC_XTENSA_SLOT13_OP: howto manager. (line 1866)
-* BFD_RELOC_XTENSA_SLOT14_ALT: howto manager. (line 1887)
-* BFD_RELOC_XTENSA_SLOT14_OP: howto manager. (line 1867)
-* BFD_RELOC_XTENSA_SLOT1_ALT: howto manager. (line 1874)
-* BFD_RELOC_XTENSA_SLOT1_OP: howto manager. (line 1854)
-* BFD_RELOC_XTENSA_SLOT2_ALT: howto manager. (line 1875)
-* BFD_RELOC_XTENSA_SLOT2_OP: howto manager. (line 1855)
-* BFD_RELOC_XTENSA_SLOT3_ALT: howto manager. (line 1876)
-* BFD_RELOC_XTENSA_SLOT3_OP: howto manager. (line 1856)
-* BFD_RELOC_XTENSA_SLOT4_ALT: howto manager. (line 1877)
-* BFD_RELOC_XTENSA_SLOT4_OP: howto manager. (line 1857)
-* BFD_RELOC_XTENSA_SLOT5_ALT: howto manager. (line 1878)
-* BFD_RELOC_XTENSA_SLOT5_OP: howto manager. (line 1858)
-* BFD_RELOC_XTENSA_SLOT6_ALT: howto manager. (line 1879)
-* BFD_RELOC_XTENSA_SLOT6_OP: howto manager. (line 1859)
-* BFD_RELOC_XTENSA_SLOT7_ALT: howto manager. (line 1880)
-* BFD_RELOC_XTENSA_SLOT7_OP: howto manager. (line 1860)
-* BFD_RELOC_XTENSA_SLOT8_ALT: howto manager. (line 1881)
-* BFD_RELOC_XTENSA_SLOT8_OP: howto manager. (line 1861)
-* BFD_RELOC_XTENSA_SLOT9_ALT: howto manager. (line 1882)
-* BFD_RELOC_XTENSA_SLOT9_OP: howto manager. (line 1862)
-* BFD_RELOC_Z80_DISP8: howto manager. (line 1907)
-* BFD_RELOC_Z8K_CALLR: howto manager. (line 1913)
-* BFD_RELOC_Z8K_DISP7: howto manager. (line 1910)
-* BFD_RELOC_Z8K_IMM4L: howto manager. (line 1916)
-* bfd_scan_arch: Architectures. (line 392)
-* bfd_scan_vma: BFD front end. (line 423)
-* bfd_seach_for_target: bfd_target. (line 459)
-* bfd_section_already_linked: Writing the symbol table.
- (line 55)
-* bfd_section_list_clear: section prototypes. (line 8)
-* bfd_sections_find_if: section prototypes. (line 176)
-* bfd_set_arch_info: Architectures. (line 433)
-* bfd_set_archive_head: Archives. (line 69)
-* bfd_set_default_target: bfd_target. (line 424)
-* bfd_set_error: BFD front end. (line 235)
-* bfd_set_error_handler: BFD front end. (line 275)
-* bfd_set_error_program_name: BFD front end. (line 284)
-* bfd_set_file_flags: BFD front end. (line 343)
-* bfd_set_format: Formats. (line 68)
-* bfd_set_gp_size: BFD front end. (line 413)
-* bfd_set_private_flags: BFD front end. (line 490)
-* bfd_set_reloc: BFD front end. (line 333)
-* bfd_set_section_contents: section prototypes. (line 207)
-* bfd_set_section_flags: section prototypes. (line 140)
-* bfd_set_section_size: section prototypes. (line 193)
-* bfd_set_start_address: BFD front end. (line 392)
-* bfd_set_symtab: symbol handling functions.
- (line 60)
-* bfd_symbol_info: symbol handling functions.
- (line 130)
-* bfd_target_list: bfd_target. (line 450)
-* bfd_write_bigendian_4byte_int: Internal. (line 13)
-* bfd_zalloc: Opening and Closing.
- (line 221)
-* bfd_zalloc2: Opening and Closing.
- (line 230)
-* coff_symbol_type: coff. (line 186)
-* core_file_matches_executable_p: Core Files. (line 30)
-* find_separate_debug_file: Opening and Closing.
- (line 272)
-* generic_core_file_matches_executable_p: Core Files. (line 40)
-* get_debug_link_info: Opening and Closing.
- (line 253)
-* Hash tables: Hash Tables. (line 6)
-* internal object-file format: Canonical format. (line 11)
-* Linker: Linker Functions. (line 6)
-* Other functions: BFD front end. (line 505)
-* separate_debug_file_exists: Opening and Closing.
- (line 263)
-* struct bfd_iovec: BFD front end. (line 657)
-* target vector (_bfd_final_link): Performing the Final Link.
- (line 6)
-* target vector (_bfd_link_add_symbols): Adding Symbols to the Hash Table.
- (line 6)
-* target vector (_bfd_link_hash_table_create): Creating a Linker Hash Table.
- (line 6)
-* The HOWTO Macro: typedef arelent. (line 291)
-* what is it?: Overview. (line 6)
-
-
-
-Tag Table:
-Node: Top724
-Node: Overview1056
-Node: History2107
-Node: How It Works3053
-Node: What BFD Version 2 Can Do4595
-Node: BFD information loss5910
-Node: Canonical format8442
-Node: BFD front end12814
-Node: Memory Usage38428
-Node: Initialization39656
-Node: Sections40115
-Node: Section Input40598
-Node: Section Output41963
-Node: typedef asection44449
-Node: section prototypes69406
-Node: Symbols79086
-Node: Reading Symbols80681
-Node: Writing Symbols81788
-Node: Mini Symbols83497
-Node: typedef asymbol84471
-Node: symbol handling functions89389
-Node: Archives94731
-Node: Formats98457
-Node: Relocations101405
-Node: typedef arelent102132
-Node: howto manager117943
-Node: Core Files180223
-Node: Targets182040
-Node: bfd_target184010
-Node: Architectures204090
-Node: Opening and Closing225522
-Node: Internal236524
-Node: File Caching242857
-Node: Linker Functions244771
-Node: Creating a Linker Hash Table246444
-Node: Adding Symbols to the Hash Table248182
-Node: Differing file formats249082
-Node: Adding symbols from an object file250830
-Node: Adding symbols from an archive252981
-Node: Performing the Final Link255395
-Node: Information provided by the linker256637
-Node: Relocating the section contents257791
-Node: Writing the symbol table259542
-Node: Hash Tables262535
-Node: Creating and Freeing a Hash Table263733
-Node: Looking Up or Entering a String264983
-Node: Traversing a Hash Table266236
-Node: Deriving a New Hash Table Type267025
-Node: Define the Derived Structures268091
-Node: Write the Derived Creation Routine269172
-Node: Write Other Derived Routines271796
-Node: BFD back ends273111
-Node: What to Put Where273381
-Node: aout273519
-Node: coff279837
-Node: elf304314
-Node: mmo305177
-Node: File layout306105
-Node: Symbol-table311752
-Node: mmo section mapping315521
-Node: GNU Free Documentation License319173
-Node: Index338898
-
-End Tag Table
diff --git a/bfd/doc/bfd.texinfo b/bfd/doc/bfd.texinfo
index 432e05264491..04b4266e651f 100644
--- a/bfd/doc/bfd.texinfo
+++ b/bfd/doc/bfd.texinfo
@@ -1,7 +1,7 @@
\input texinfo.tex
@setfilename bfd.info
@c Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1997, 2000,
-@c 2001, 2002, 2003
+@c 2001, 2002, 2003, 2006, 2007
@c Free Software Foundation, Inc.
@c
@synindex fn cp
@@ -14,26 +14,29 @@ END-INFO-DIR-ENTRY
@end format
@end ifinfo
-@ifinfo
+@copying
This file documents the BFD library.
-Copyright (C) 1991, 2000, 2001, 2003 Free Software Foundation, Inc.
+Copyright @copyright{} 1991, 2000, 2001, 2003, 2006, 2007 Free Software Foundation, Inc.
- Permission is granted to copy, distribute and/or modify this document
- under the terms of the GNU Free Documentation License, Version 1.1
- or any later version published by the Free Software Foundation;
- with no Invariant Sections, with no Front-Cover Texts, and with no
- Back-Cover Texts. A copy of the license is included in the
- section entitled ``GNU Free Documentation License''.
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.1 or
+any later version published by the Free Software Foundation; with the
+Invariant Sections being ``GNU General Public License'' and ``Funding
+Free Software'', the Front-Cover texts being (a) (see below), and with
+the Back-Cover Texts being (b) (see below). A copy of the license is
+included in the section entitled ``GNU Free Documentation License''.
-@ignore
-Permission is granted to process this file through Tex and print the
-results, provided the printed document carries copying permission
-notice identical to this one except for the removal of this paragraph
-(this paragraph not being relevant to the printed manual).
+(a) The FSF's Front-Cover Text is:
-@end ignore
-@end ifinfo
+ A GNU Manual
+
+(b) The FSF's Back-Cover Text is:
+
+ You have freedom to copy and modify this GNU Manual, like GNU
+ software. Copies published by the Free Software Foundation raise
+ funds for GNU development.
+@end copying
@iftex
@c@finalout
@setchapternewpage on
@@ -43,7 +46,7 @@ notice identical to this one except for the removal of this paragraph
@title{libbfd}
@subtitle{The Binary File Descriptor Library}
@sp 1
-@subtitle First Edition---BFD version < 3.0 % Since no product is stable berfore version 3.0 :-)
+@subtitle First Edition---BFD version < 3.0 % Since no product is stable before version 3.0 :-)
@subtitle Original Document Created: April 1991
@author {Steve Chamberlain}
@author {Cygnus Support}
@@ -62,7 +65,7 @@ notice identical to this one except for the removal of this paragraph
@end tex
@vskip 0pt plus 1filll
-Copyright @copyright{} 1991, 2001, 2003 Free Software Foundation, Inc.
+Copyright @copyright{} 1991, 2001, 2003, 2006 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1
@@ -73,6 +76,7 @@ Copyright @copyright{} 1991, 2001, 2003 Free Software Foundation, Inc.
@end titlepage
@end iftex
+@contents
@node Top, Overview, (dir), (dir)
@ifinfo
@@ -84,7 +88,7 @@ This file documents the binary file descriptor library libbfd.
* BFD front end:: BFD front end
* BFD back ends:: BFD back ends
* GNU Free Documentation License:: GNU Free Documentation License
-* Index:: Index
+* BFD Index:: BFD Index
@end menu
@node Overview, BFD front end, Top, Top
@@ -144,7 +148,7 @@ To use the library, include @file{bfd.h} and link with @file{libbfd.a}.
BFD provides a common interface to the parts of an object file
for a calling application.
-When an application sucessfully opens a target file (object, archive, or
+When an application successfully opens a target file (object, archive, or
whatever), a pointer to an internal structure is returned. This pointer
points to a structure called @code{bfd}, described in
@file{bfd.h}. Our convention is to call this pointer a BFD, and
@@ -294,6 +298,7 @@ structures.
@end ignore
@end menu
@node What to Put Where, aout, BFD back ends, BFD back ends
+@section What to Put Where
All of BFD lives in one directory.
@node aout, coff, What to Put Where, BFD back ends
@@ -310,11 +315,11 @@ All of BFD lives in one directory.
@node mmo, , elf, BFD back ends
@include mmo.texi
-@node GNU Free Documentation License, Index, BFD back ends, Top
+@node GNU Free Documentation License, BFD Index, BFD back ends, Top
@include fdl.texi
-@node Index, , GNU Free Documentation License, Top
-@unnumbered Index
+@node BFD Index, , GNU Free Documentation License, Top
+@unnumbered BFD Index
@printindex cp
@tex
@@ -332,5 +337,4 @@ All of BFD lives in one directory.
% Blame: doc@cygnus.com, 28mar91.
@end tex
-@contents
@bye
diff --git a/bfd/doc/bfdint.texi b/bfd/doc/bfdint.texi
index 98826fd52062..b7e7c548e6ad 100644
--- a/bfd/doc/bfdint.texi
+++ b/bfd/doc/bfdint.texi
@@ -1,6 +1,6 @@
\input texinfo
@c Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998,
-@c 2000, 2001, 2002, 2003, 2004
+@c 2000, 2001, 2002, 2003, 2004, 2006, 2007
@c Free Software Foundation, Inc.
@setfilename bfdint.info
@@ -13,6 +13,33 @@
@page
@end iftex
+@copying
+This file documents the internals of the BFD library.
+
+Copyright @copyright{} 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
+1996, 1998, 2000, 2001, 2002, 2003, 2004, 2006, 2007
+Free Software Foundation, Inc.
+Contributed by Cygnus Support.
+
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.1 or
+any later version published by the Free Software Foundation; with the
+Invariant Sections being ``GNU General Public License'' and ``Funding
+Free Software'', the Front-Cover texts being (a) (see below), and with
+the Back-Cover Texts being (b) (see below). A copy of the license is
+included in the section entitled ``GNU Free Documentation License''.
+
+(a) The FSF's Front-Cover Text is:
+
+ A GNU Manual
+
+(b) The FSF's Back-Cover Text is:
+
+ You have freedom to copy and modify this GNU Manual, like GNU
+ software. Copies published by the Free Software Foundation raise
+ funds for GNU development.
+@end copying
+
@node Top
@top BFD Internals
@raisesections
@@ -189,7 +216,7 @@ and handle it using the special hooks.
In some cases there is also implicit information which BFD can not
represent. For example, the MIPS processor distinguishes small and
-large symbols, and requires that all small symbls be within 32K of the
+large symbols, and requires that all small symbols be within 32K of the
GP register. This means that the MIPS assembler must be able to mark
variables as either small or large, and the MIPS linker must know to put
small symbols within range of the GP register. Since BFD can not
@@ -230,7 +257,7 @@ Follow the GNU coding standards.
Avoid global variables. We ideally want BFD to be fully reentrant, so
that it can be used in multiple threads. All uses of global or static
variables interfere with that. Initialized constant variables are OK,
-and they should be explicitly marked with const. Instead of global
+and they should be explicitly marked with @samp{const}. Instead of global
variables, use data attached to a BFD or to a linker hash table.
@item
@@ -1391,7 +1418,7 @@ constants used by the generic support.
@subsection ELF sections and segments
The ELF ABI permits a file to have either sections or segments or both.
-Relocateable object files conventionally have only sections.
+Relocatable object files conventionally have only sections.
Executables conventionally have both. Core files conventionally have
only program segments.
@@ -1744,23 +1771,6 @@ support.
The processor function hooks and constants are ad hoc and need better
documentation.
-When a linker script uses @samp{SIZEOF_HEADERS}, the ELF backend must
-guess at the number of program segments which will be required, in
-@samp{get_program_header_size}. This is because the linker calls
-@samp{bfd_sizeof_headers} before it knows all the section addresses and
-sizes. The ELF backend may later discover, when creating program
-segments, that more program segments are required. This is currently
-reported as an error in @samp{assign_file_positions_for_segments}.
-
-In practice this makes it difficult to use @samp{SIZEOF_HEADERS} except
-with a carefully defined linker script. Unfortunately,
-@samp{SIZEOF_HEADERS} is required for fast program loading on a native
-system, since it permits the initial code section to appear on the same
-page as the program segments, saving a page read when the program starts
-running. Fortunately, native systems permit careful definition of the
-linker script. Still, ideally it would be possible to use relaxation to
-compute the number of program segments.
-
@node BFD glossary
@section BFD glossary
@cindex glossary for bfd
diff --git a/bfd/doc/bfdio.texi b/bfd/doc/bfdio.texi
deleted file mode 100644
index eb7e31df9d08..000000000000
--- a/bfd/doc/bfdio.texi
+++ /dev/null
@@ -1,72 +0,0 @@
-@findex struct bfd_iovec
-@subsubsection @code{struct bfd_iovec}
-@strong{Description}@*
-The @code{struct bfd_iovec} contains the internal file I/O class.
-Each @code{BFD} has an instance of this class and all file I/O is
-routed through it (it is assumed that the instance implements
-all methods listed below).
-@example
-struct bfd_iovec
-@{
- /* To avoid problems with macros, a "b" rather than "f"
- prefix is prepended to each method name. */
- /* Attempt to read/write NBYTES on ABFD's IOSTREAM storing/fetching
- bytes starting at PTR. Return the number of bytes actually
- transfered (a read past end-of-file returns less than NBYTES),
- or -1 (setting @code{bfd_error}) if an error occurs. */
- file_ptr (*bread) (struct bfd *abfd, void *ptr, file_ptr nbytes);
- file_ptr (*bwrite) (struct bfd *abfd, const void *ptr,
- file_ptr nbytes);
- /* Return the current IOSTREAM file offset, or -1 (setting @code{bfd_error}
- if an error occurs. */
- file_ptr (*btell) (struct bfd *abfd);
- /* For the following, on successful completion a value of 0 is returned.
- Otherwise, a value of -1 is returned (and @code{bfd_error} is set). */
- int (*bseek) (struct bfd *abfd, file_ptr offset, int whence);
- int (*bclose) (struct bfd *abfd);
- int (*bflush) (struct bfd *abfd);
- int (*bstat) (struct bfd *abfd, struct stat *sb);
-@};
-@end example
-
-@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/bfd/doc/bfdt.texi b/bfd/doc/bfdt.texi
deleted file mode 100644
index a22fe3861d96..000000000000
--- a/bfd/doc/bfdt.texi
+++ /dev/null
@@ -1,721 +0,0 @@
-@section @code{typedef bfd}
-A BFD has type @code{bfd}; objects of this type are the
-cornerstone of any application using BFD. Using BFD
-consists of making references though the BFD and to data in the BFD.
-
-Here is the structure that defines the type @code{bfd}. It
-contains the major data about the file and pointers
-to the rest of the data.
-
-
-@example
-
-struct bfd
-@{
- /* A unique identifier of the BFD */
- unsigned int id;
-
- /* The filename the application opened the BFD with. */
- const char *filename;
-
- /* A pointer to the target jump table. */
- const struct bfd_target *xvec;
-
- /* The IOSTREAM, and corresponding IO vector that provide access
- to the file backing the BFD. */
- void *iostream;
- const struct bfd_iovec *iovec;
-
- /* Is the file descriptor being cached? That is, can it be closed as
- needed, and re-opened when accessed later? */
- bfd_boolean cacheable;
-
- /* Marks whether there was a default target specified when the
- BFD was opened. This is used to select which matching algorithm
- to use to choose the back end. */
- bfd_boolean target_defaulted;
-
- /* The caching routines use these to maintain a
- least-recently-used list of BFDs. */
- struct bfd *lru_prev, *lru_next;
-
- /* When a file is closed by the caching routines, BFD retains
- state information on the file here... */
- ufile_ptr where;
-
- /* ... and here: (``once'' means at least once). */
- bfd_boolean opened_once;
-
- /* Set if we have a locally maintained mtime value, rather than
- getting it from the file each time. */
- bfd_boolean mtime_set;
-
- /* File modified time, if mtime_set is TRUE. */
- long mtime;
-
- /* Reserved for an unimplemented file locking extension. */
- int ifd;
-
- /* The format which belongs to the BFD. (object, core, etc.) */
- bfd_format format;
-
- /* The direction with which the BFD was opened. */
- enum bfd_direction
- @{
- no_direction = 0,
- read_direction = 1,
- write_direction = 2,
- both_direction = 3
- @}
- direction;
-
- /* Format_specific flags. */
- flagword flags;
-
- /* Currently my_archive is tested before adding origin to
- anything. I believe that this can become always an add of
- origin, with origin set to 0 for non archive files. */
- ufile_ptr origin;
-
- /* Remember when output has begun, to stop strange things
- from happening. */
- bfd_boolean output_has_begun;
-
- /* A hash table for section names. */
- struct bfd_hash_table section_htab;
-
- /* Pointer to linked list of sections. */
- struct bfd_section *sections;
-
- /* The last section on the section list. */
- struct bfd_section *section_last;
-
- /* The number of sections. */
- unsigned int section_count;
-
- /* Stuff only useful for object files:
- The start address. */
- bfd_vma start_address;
-
- /* Used for input and output. */
- unsigned int symcount;
-
- /* Symbol table for output BFD (with symcount entries). */
- struct bfd_symbol **outsymbols;
-
- /* Used for slurped dynamic symbol tables. */
- unsigned int dynsymcount;
-
- /* Pointer to structure which contains architecture information. */
- const struct bfd_arch_info *arch_info;
-
- /* Flag set if symbols from this BFD should not be exported. */
- bfd_boolean no_export;
-
- /* Stuff only useful for archives. */
- void *arelt_data;
- struct bfd *my_archive; /* The containing archive BFD. */
- struct bfd *next; /* The next BFD in the archive. */
- struct bfd *archive_head; /* The first BFD in the archive. */
- bfd_boolean has_armap;
-
- /* A chain of BFD structures involved in a link. */
- struct bfd *link_next;
-
- /* A field used by _bfd_generic_link_add_archive_symbols. This will
- be used only for archive elements. */
- int archive_pass;
-
- /* Used by the back end to hold private data. */
- union
- @{
- struct aout_data_struct *aout_data;
- struct artdata *aout_ar_data;
- struct _oasys_data *oasys_obj_data;
- struct _oasys_ar_data *oasys_ar_data;
- struct coff_tdata *coff_obj_data;
- struct pe_tdata *pe_obj_data;
- struct xcoff_tdata *xcoff_obj_data;
- struct ecoff_tdata *ecoff_obj_data;
- struct ieee_data_struct *ieee_data;
- struct ieee_ar_data_struct *ieee_ar_data;
- struct srec_data_struct *srec_data;
- struct ihex_data_struct *ihex_data;
- struct tekhex_data_struct *tekhex_data;
- struct elf_obj_tdata *elf_obj_data;
- struct nlm_obj_tdata *nlm_obj_data;
- struct bout_data_struct *bout_data;
- struct mmo_data_struct *mmo_data;
- struct sun_core_struct *sun_core_data;
- struct sco5_core_struct *sco5_core_data;
- struct trad_core_struct *trad_core_data;
- struct som_data_struct *som_data;
- struct hpux_core_struct *hpux_core_data;
- struct hppabsd_core_struct *hppabsd_core_data;
- struct sgi_core_struct *sgi_core_data;
- struct lynx_core_struct *lynx_core_data;
- struct osf_core_struct *osf_core_data;
- struct cisco_core_struct *cisco_core_data;
- struct versados_data_struct *versados_data;
- struct netbsd_core_struct *netbsd_core_data;
- struct mach_o_data_struct *mach_o_data;
- struct mach_o_fat_data_struct *mach_o_fat_data;
- struct bfd_pef_data_struct *pef_data;
- struct bfd_pef_xlib_data_struct *pef_xlib_data;
- struct bfd_sym_data_struct *sym_data;
- void *any;
- @}
- tdata;
-
- /* Used by the application to hold private data. */
- void *usrdata;
-
- /* Where all the allocated stuff under this BFD goes. This is a
- struct objalloc *, but we use void * to avoid requiring the inclusion
- of objalloc.h. */
- void *memory;
-@};
-
-@end example
-@section Error reporting
-Most BFD functions return nonzero on success (check their
-individual documentation for precise semantics). On an error,
-they call @code{bfd_set_error} to set an error condition that callers
-can check by calling @code{bfd_get_error}.
-If that returns @code{bfd_error_system_call}, then check
-@code{errno}.
-
-The easiest way to report a BFD error to the user is to
-use @code{bfd_perror}.
-
-@subsection Type @code{bfd_error_type}
-The values returned by @code{bfd_get_error} are defined by the
-enumerated type @code{bfd_error_type}.
-
-
-@example
-
-typedef enum bfd_error
-@{
- bfd_error_no_error = 0,
- bfd_error_system_call,
- bfd_error_invalid_target,
- bfd_error_wrong_format,
- bfd_error_wrong_object_format,
- bfd_error_invalid_operation,
- bfd_error_no_memory,
- bfd_error_no_symbols,
- bfd_error_no_armap,
- bfd_error_no_more_archived_files,
- bfd_error_malformed_archive,
- bfd_error_file_not_recognized,
- bfd_error_file_ambiguously_recognized,
- bfd_error_no_contents,
- bfd_error_nonrepresentable_section,
- bfd_error_no_debug_section,
- bfd_error_bad_value,
- bfd_error_file_truncated,
- bfd_error_file_too_big,
- bfd_error_invalid_error_code
-@}
-bfd_error_type;
-
-@end example
-@findex bfd_get_error
-@subsubsection @code{bfd_get_error}
-@strong{Synopsis}
-@example
-bfd_error_type bfd_get_error (void);
-@end example
-@strong{Description}@*
-Return the current BFD error condition.
-
-@findex bfd_set_error
-@subsubsection @code{bfd_set_error}
-@strong{Synopsis}
-@example
-void bfd_set_error (bfd_error_type error_tag);
-@end example
-@strong{Description}@*
-Set the BFD error condition to be @var{error_tag}.
-
-@findex bfd_errmsg
-@subsubsection @code{bfd_errmsg}
-@strong{Synopsis}
-@example
-const char *bfd_errmsg (bfd_error_type error_tag);
-@end example
-@strong{Description}@*
-Return a string describing the error @var{error_tag}, or
-the system error if @var{error_tag} is @code{bfd_error_system_call}.
-
-@findex bfd_perror
-@subsubsection @code{bfd_perror}
-@strong{Synopsis}
-@example
-void bfd_perror (const char *message);
-@end example
-@strong{Description}@*
-Print to the standard error stream a string describing the
-last BFD error that occurred, or the last system error if
-the last BFD error was a system call failure. If @var{message}
-is non-NULL and non-empty, the error string printed is preceded
-by @var{message}, a colon, and a space. It is followed by a newline.
-
-@subsection BFD error handler
-Some BFD functions want to print messages describing the
-problem. They call a BFD error handler function. This
-function may be overridden by the program.
-
-The BFD error handler acts like printf.
-
-
-@example
-
-typedef void (*bfd_error_handler_type) (const char *, ...);
-
-@end example
-@findex bfd_set_error_handler
-@subsubsection @code{bfd_set_error_handler}
-@strong{Synopsis}
-@example
-bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type);
-@end example
-@strong{Description}@*
-Set the BFD error handler function. Returns the previous
-function.
-
-@findex bfd_set_error_program_name
-@subsubsection @code{bfd_set_error_program_name}
-@strong{Synopsis}
-@example
-void bfd_set_error_program_name (const char *);
-@end example
-@strong{Description}@*
-Set the program name to use when printing a BFD error. This
-is printed before the error message followed by a colon and
-space. The string must not be changed after it is passed to
-this function.
-
-@findex bfd_get_error_handler
-@subsubsection @code{bfd_get_error_handler}
-@strong{Synopsis}
-@example
-bfd_error_handler_type bfd_get_error_handler (void);
-@end example
-@strong{Description}@*
-Return the BFD error handler function.
-
-@section Miscellaneous
-
-
-@subsection Miscellaneous functions
-
-
-@findex bfd_get_reloc_upper_bound
-@subsubsection @code{bfd_get_reloc_upper_bound}
-@strong{Synopsis}
-@example
-long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect);
-@end example
-@strong{Description}@*
-Return the number of bytes required to store the
-relocation information associated with section @var{sect}
-attached to bfd @var{abfd}. If an error occurs, return -1.
-
-@findex bfd_canonicalize_reloc
-@subsubsection @code{bfd_canonicalize_reloc}
-@strong{Synopsis}
-@example
-long bfd_canonicalize_reloc
- (bfd *abfd, asection *sec, arelent **loc, asymbol **syms);
-@end example
-@strong{Description}@*
-Call the back end associated with the open BFD
-@var{abfd} and translate the external form of the relocation
-information attached to @var{sec} into the internal canonical
-form. Place the table into memory at @var{loc}, which has
-been preallocated, usually by a call to
-@code{bfd_get_reloc_upper_bound}. Returns the number of relocs, or
--1 on error.
-
-The @var{syms} table is also needed for horrible internal magic
-reasons.
-
-@findex bfd_set_reloc
-@subsubsection @code{bfd_set_reloc}
-@strong{Synopsis}
-@example
-void bfd_set_reloc
- (bfd *abfd, asection *sec, arelent **rel, unsigned int count);
-@end example
-@strong{Description}@*
-Set the relocation pointer and count within
-section @var{sec} to the values @var{rel} and @var{count}.
-The argument @var{abfd} is ignored.
-
-@findex bfd_set_file_flags
-@subsubsection @code{bfd_set_file_flags}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_set_file_flags (bfd *abfd, flagword flags);
-@end example
-@strong{Description}@*
-Set the flag word in the BFD @var{abfd} to the value @var{flags}.
-
-Possible errors are:
-@itemize @bullet
-
-@item
-@code{bfd_error_wrong_format} - The target bfd was not of object format.
-@item
-@code{bfd_error_invalid_operation} - The target bfd was open for reading.
-@item
-@code{bfd_error_invalid_operation} -
-The flag word contained a bit which was not applicable to the
-type of file. E.g., an attempt was made to set the @code{D_PAGED} bit
-on a BFD format which does not support demand paging.
-@end itemize
-
-@findex bfd_get_arch_size
-@subsubsection @code{bfd_get_arch_size}
-@strong{Synopsis}
-@example
-int bfd_get_arch_size (bfd *abfd);
-@end example
-@strong{Description}@*
-Returns the architecture address size, in bits, as determined
-by the object file's format. For ELF, this information is
-included in the header.
-
-@strong{Returns}@*
-Returns the arch size in bits if known, @code{-1} otherwise.
-
-@findex bfd_get_sign_extend_vma
-@subsubsection @code{bfd_get_sign_extend_vma}
-@strong{Synopsis}
-@example
-int bfd_get_sign_extend_vma (bfd *abfd);
-@end example
-@strong{Description}@*
-Indicates if the target architecture "naturally" sign extends
-an address. Some architectures implicitly sign extend address
-values when they are converted to types larger than the size
-of an address. For instance, bfd_get_start_address() will
-return an address sign extended to fill a bfd_vma when this is
-the case.
-
-@strong{Returns}@*
-Returns @code{1} if the target architecture is known to sign
-extend addresses, @code{0} if the target architecture is known to
-not sign extend addresses, and @code{-1} otherwise.
-
-@findex bfd_set_start_address
-@subsubsection @code{bfd_set_start_address}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_set_start_address (bfd *abfd, bfd_vma vma);
-@end example
-@strong{Description}@*
-Make @var{vma} the entry point of output BFD @var{abfd}.
-
-@strong{Returns}@*
-Returns @code{TRUE} on success, @code{FALSE} otherwise.
-
-@findex bfd_get_gp_size
-@subsubsection @code{bfd_get_gp_size}
-@strong{Synopsis}
-@example
-unsigned int bfd_get_gp_size (bfd *abfd);
-@end example
-@strong{Description}@*
-Return the maximum size of objects to be optimized using the GP
-register under MIPS ECOFF. This is typically set by the @code{-G}
-argument to the compiler, assembler or linker.
-
-@findex bfd_set_gp_size
-@subsubsection @code{bfd_set_gp_size}
-@strong{Synopsis}
-@example
-void bfd_set_gp_size (bfd *abfd, unsigned int i);
-@end example
-@strong{Description}@*
-Set the maximum size of objects to be optimized using the GP
-register under ECOFF or MIPS ELF. This is typically set by
-the @code{-G} argument to the compiler, assembler or linker.
-
-@findex bfd_scan_vma
-@subsubsection @code{bfd_scan_vma}
-@strong{Synopsis}
-@example
-bfd_vma bfd_scan_vma (const char *string, const char **end, int base);
-@end example
-@strong{Description}@*
-Convert, like @code{strtoul}, a numerical expression
-@var{string} into a @code{bfd_vma} integer, and return that integer.
-(Though without as many bells and whistles as @code{strtoul}.)
-The expression is assumed to be unsigned (i.e., positive).
-If given a @var{base}, it is used as the base for conversion.
-A base of 0 causes the function to interpret the string
-in hex if a leading "0x" or "0X" is found, otherwise
-in octal if a leading zero is found, otherwise in decimal.
-
-If the value would overflow, the maximum @code{bfd_vma} value is
-returned.
-
-@findex bfd_copy_private_header_data
-@subsubsection @code{bfd_copy_private_header_data}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_copy_private_header_data (bfd *ibfd, bfd *obfd);
-@end example
-@strong{Description}@*
-Copy private BFD header information from the BFD @var{ibfd} to the
-the BFD @var{obfd}. This copies information that may require
-sections to exist, but does not require symbol tables. Return
-@code{true} on success, @code{false} on error.
-Possible error returns are:
-
-@itemize @bullet
-
-@item
-@code{bfd_error_no_memory} -
-Not enough memory exists to create private data for @var{obfd}.
-@end itemize
-@example
-#define bfd_copy_private_header_data(ibfd, obfd) \
- BFD_SEND (obfd, _bfd_copy_private_header_data, \
- (ibfd, obfd))
-@end example
-
-@findex bfd_copy_private_bfd_data
-@subsubsection @code{bfd_copy_private_bfd_data}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd);
-@end example
-@strong{Description}@*
-Copy private BFD information from the BFD @var{ibfd} to the
-the BFD @var{obfd}. Return @code{TRUE} on success, @code{FALSE} on error.
-Possible error returns are:
-
-@itemize @bullet
-
-@item
-@code{bfd_error_no_memory} -
-Not enough memory exists to create private data for @var{obfd}.
-@end itemize
-@example
-#define bfd_copy_private_bfd_data(ibfd, obfd) \
- BFD_SEND (obfd, _bfd_copy_private_bfd_data, \
- (ibfd, obfd))
-@end example
-
-@findex bfd_merge_private_bfd_data
-@subsubsection @code{bfd_merge_private_bfd_data}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_merge_private_bfd_data (bfd *ibfd, bfd *obfd);
-@end example
-@strong{Description}@*
-Merge private BFD information from the BFD @var{ibfd} to the
-the output file BFD @var{obfd} when linking. Return @code{TRUE}
-on success, @code{FALSE} on error. Possible error returns are:
-
-@itemize @bullet
-
-@item
-@code{bfd_error_no_memory} -
-Not enough memory exists to create private data for @var{obfd}.
-@end itemize
-@example
-#define bfd_merge_private_bfd_data(ibfd, obfd) \
- BFD_SEND (obfd, _bfd_merge_private_bfd_data, \
- (ibfd, obfd))
-@end example
-
-@findex bfd_set_private_flags
-@subsubsection @code{bfd_set_private_flags}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags);
-@end example
-@strong{Description}@*
-Set private BFD flag information in the BFD @var{abfd}.
-Return @code{TRUE} on success, @code{FALSE} on error. Possible error
-returns are:
-
-@itemize @bullet
-
-@item
-@code{bfd_error_no_memory} -
-Not enough memory exists to create private data for @var{obfd}.
-@end itemize
-@example
-#define bfd_set_private_flags(abfd, flags) \
- BFD_SEND (abfd, _bfd_set_private_flags, (abfd, flags))
-@end example
-
-@findex Other functions
-@subsubsection @code{Other functions}
-@strong{Description}@*
-The following functions exist but have not yet been documented.
-@example
-#define bfd_sizeof_headers(abfd, reloc) \
- BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc))
-
-#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
- BFD_SEND (abfd, _bfd_find_nearest_line, \
- (abfd, sec, syms, off, file, func, line))
-
-#define bfd_find_line(abfd, syms, sym, file, line) \
- BFD_SEND (abfd, _bfd_find_line, \
- (abfd, syms, sym, file, line))
-
-#define bfd_find_inliner_info(abfd, file, func, line) \
- BFD_SEND (abfd, _bfd_find_inliner_info, \
- (abfd, file, func, line))
-
-#define bfd_debug_info_start(abfd) \
- BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
-
-#define bfd_debug_info_end(abfd) \
- BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
-
-#define bfd_debug_info_accumulate(abfd, section) \
- BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
-
-#define bfd_stat_arch_elt(abfd, stat) \
- BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
-
-#define bfd_update_armap_timestamp(abfd) \
- BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
-
-#define bfd_set_arch_mach(abfd, arch, mach)\
- BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
-
-#define bfd_relax_section(abfd, section, link_info, again) \
- BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
-
-#define bfd_gc_sections(abfd, link_info) \
- BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info))
-
-#define bfd_merge_sections(abfd, link_info) \
- BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
-
-#define bfd_is_group_section(abfd, sec) \
- BFD_SEND (abfd, _bfd_is_group_section, (abfd, sec))
-
-#define bfd_discard_group(abfd, sec) \
- BFD_SEND (abfd, _bfd_discard_group, (abfd, sec))
-
-#define bfd_link_hash_table_create(abfd) \
- BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
-
-#define bfd_link_hash_table_free(abfd, hash) \
- BFD_SEND (abfd, _bfd_link_hash_table_free, (hash))
-
-#define bfd_link_add_symbols(abfd, info) \
- BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
-
-#define bfd_link_just_syms(abfd, sec, info) \
- BFD_SEND (abfd, _bfd_link_just_syms, (sec, info))
-
-#define bfd_final_link(abfd, info) \
- BFD_SEND (abfd, _bfd_final_link, (abfd, info))
-
-#define bfd_free_cached_info(abfd) \
- BFD_SEND (abfd, _bfd_free_cached_info, (abfd))
-
-#define bfd_get_dynamic_symtab_upper_bound(abfd) \
- BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd))
-
-#define bfd_print_private_bfd_data(abfd, file)\
- BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file))
-
-#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \
- BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols))
-
-#define bfd_get_synthetic_symtab(abfd, count, syms, dyncount, dynsyms, ret) \
- BFD_SEND (abfd, _bfd_get_synthetic_symtab, (abfd, count, syms, \
- dyncount, dynsyms, ret))
-
-#define bfd_get_dynamic_reloc_upper_bound(abfd) \
- BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd))
-
-#define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \
- BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms))
-
-extern bfd_byte *bfd_get_relocated_section_contents
- (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *,
- bfd_boolean, asymbol **);
-
-@end example
-
-@findex bfd_alt_mach_code
-@subsubsection @code{bfd_alt_mach_code}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_alt_mach_code (bfd *abfd, int alternative);
-@end example
-@strong{Description}@*
-When more than one machine code number is available for the
-same machine type, this function can be used to switch between
-the preferred one (alternative == 0) and any others. Currently,
-only ELF supports this feature, with up to two alternate
-machine codes.
-
-
-@example
-struct bfd_preserve
-@{
- void *marker;
- void *tdata;
- flagword flags;
- const struct bfd_arch_info *arch_info;
- struct bfd_section *sections;
- struct bfd_section *section_last;
- 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/bfd/doc/bfdwin.texi b/bfd/doc/bfdwin.texi
deleted file mode 100644
index b1fd7d5bed69..000000000000
--- a/bfd/doc/bfdwin.texi
+++ /dev/null
@@ -1,2 +0,0 @@
-@findex
-@subsubsection @code{}
diff --git a/bfd/doc/cache.texi b/bfd/doc/cache.texi
deleted file mode 100644
index 5820a2a6a1d3..000000000000
--- a/bfd/doc/cache.texi
+++ /dev/null
@@ -1,65 +0,0 @@
-@section File caching
-The file caching mechanism is embedded within BFD and allows
-the application to open as many BFDs as it wants without
-regard to the underlying operating system's file descriptor
-limit (often as low as 20 open files). The module in
-@code{cache.c} maintains a least recently used list of
-@code{BFD_CACHE_MAX_OPEN} files, and exports the name
-@code{bfd_cache_lookup}, which runs around and makes sure that
-the required BFD is open. If not, then it chooses a file to
-close, closes it and opens the one wanted, returning its file
-handle.
-
-@subsection Caching functions
-
-
-@findex bfd_cache_init
-@subsubsection @code{bfd_cache_init}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_cache_init (bfd *abfd);
-@end example
-@strong{Description}@*
-Add a newly opened BFD to the cache.
-
-@findex bfd_cache_close
-@subsubsection @code{bfd_cache_close}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_cache_close (bfd *abfd);
-@end example
-@strong{Description}@*
-Remove the BFD @var{abfd} from the cache. If the attached file is open,
-then close it too.
-
-@strong{Returns}@*
-@code{FALSE} is returned if closing the file fails, @code{TRUE} is
-returned if all is well.
-
-@findex bfd_cache_close_all
-@subsubsection @code{bfd_cache_close_all}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_cache_close_all (void);
-@end example
-@strong{Description}@*
-Remove all BFDs from the cache. If the attached file is open,
-then close it too.
-
-@strong{Returns}@*
-@code{FALSE} is returned if closing one of the file fails, @code{TRUE} is
-returned if all is well.
-
-@findex bfd_open_file
-@subsubsection @code{bfd_open_file}
-@strong{Synopsis}
-@example
-FILE* bfd_open_file (bfd *abfd);
-@end example
-@strong{Description}@*
-Call the OS to open a file for @var{abfd}. Return the @code{FILE *}
-(possibly @code{NULL}) that results from this operation. Set up the
-BFD so that future accesses know the file is open. If the @code{FILE *}
-returned is @code{NULL}, then it won't have been put in the
-cache, so it won't have to be removed from it.
-
diff --git a/bfd/doc/coffcode.texi b/bfd/doc/coffcode.texi
deleted file mode 100644
index 6689009c0817..000000000000
--- a/bfd/doc/coffcode.texi
+++ /dev/null
@@ -1,608 +0,0 @@
-@section coff backends
-BFD supports a number of different flavours of coff format.
-The major differences between formats are the sizes and
-alignments of fields in structures on disk, and the occasional
-extra field.
-
-Coff in all its varieties is implemented with a few common
-files and a number of implementation specific files. For
-example, The 88k bcs coff format is implemented in the file
-@file{coff-m88k.c}. This file @code{#include}s
-@file{coff/m88k.h} which defines the external structure of the
-coff format for the 88k, and @file{coff/internal.h} which
-defines the internal structure. @file{coff-m88k.c} also
-defines the relocations used by the 88k format
-@xref{Relocations}.
-
-The Intel i960 processor version of coff is implemented in
-@file{coff-i960.c}. This file has the same structure as
-@file{coff-m88k.c}, except that it includes @file{coff/i960.h}
-rather than @file{coff-m88k.h}.
-
-@subsection Porting to a new version of coff
-The recommended method is to select from the existing
-implementations the version of coff which is most like the one
-you want to use. For example, we'll say that i386 coff is
-the one you select, and that your coff flavour is called foo.
-Copy @file{i386coff.c} to @file{foocoff.c}, copy
-@file{../include/coff/i386.h} to @file{../include/coff/foo.h},
-and add the lines to @file{targets.c} and @file{Makefile.in}
-so that your new back end is used. Alter the shapes of the
-structures in @file{../include/coff/foo.h} so that they match
-what you need. You will probably also have to add
-@code{#ifdef}s to the code in @file{coff/internal.h} and
-@file{coffcode.h} if your version of coff is too wild.
-
-You can verify that your new BFD backend works quite simply by
-building @file{objdump} from the @file{binutils} directory,
-and making sure that its version of what's going on and your
-host system's idea (assuming it has the pretty standard coff
-dump utility, usually called @code{att-dump} or just
-@code{dump}) are the same. Then clean up your code, and send
-what you've done to Cygnus. Then your stuff will be in the
-next release, and you won't have to keep integrating it.
-
-@subsection How the coff backend works
-
-
-@subsubsection File layout
-The Coff backend is split into generic routines that are
-applicable to any Coff target and routines that are specific
-to a particular target. The target-specific routines are
-further split into ones which are basically the same for all
-Coff targets except that they use the external symbol format
-or use different values for certain constants.
-
-The generic routines are in @file{coffgen.c}. These routines
-work for any Coff target. They use some hooks into the target
-specific code; the hooks are in a @code{bfd_coff_backend_data}
-structure, one of which exists for each target.
-
-The essentially similar target-specific routines are in
-@file{coffcode.h}. This header file includes executable C code.
-The various Coff targets first include the appropriate Coff
-header file, make any special defines that are needed, and
-then include @file{coffcode.h}.
-
-Some of the Coff targets then also have additional routines in
-the target source file itself.
-
-For example, @file{coff-i960.c} includes
-@file{coff/internal.h} and @file{coff/i960.h}. It then
-defines a few constants, such as @code{I960}, and includes
-@file{coffcode.h}. Since the i960 has complex relocation
-types, @file{coff-i960.c} also includes some code to
-manipulate the i960 relocs. This code is not in
-@file{coffcode.h} because it would not be used by any other
-target.
-
-@subsubsection Bit twiddling
-Each flavour of coff supported in BFD has its own header file
-describing the external layout of the structures. There is also
-an internal description of the coff layout, in
-@file{coff/internal.h}. A major function of the
-coff backend is swapping the bytes and twiddling the bits to
-translate the external form of the structures into the normal
-internal form. This is all performed in the
-@code{bfd_swap}_@i{thing}_@i{direction} routines. Some
-elements are different sizes between different versions of
-coff; it is the duty of the coff version specific include file
-to override the definitions of various packing routines in
-@file{coffcode.h}. E.g., the size of line number entry in coff is
-sometimes 16 bits, and sometimes 32 bits. @code{#define}ing
-@code{PUT_LNSZ_LNNO} and @code{GET_LNSZ_LNNO} will select the
-correct one. No doubt, some day someone will find a version of
-coff which has a varying field size not catered to at the
-moment. To port BFD, that person will have to add more @code{#defines}.
-Three of the bit twiddling routines are exported to
-@code{gdb}; @code{coff_swap_aux_in}, @code{coff_swap_sym_in}
-and @code{coff_swap_lineno_in}. @code{GDB} reads the symbol
-table on its own, but uses BFD to fix things up. More of the
-bit twiddlers are exported for @code{gas};
-@code{coff_swap_aux_out}, @code{coff_swap_sym_out},
-@code{coff_swap_lineno_out}, @code{coff_swap_reloc_out},
-@code{coff_swap_filehdr_out}, @code{coff_swap_aouthdr_out},
-@code{coff_swap_scnhdr_out}. @code{Gas} currently keeps track
-of all the symbol table and reloc drudgery itself, thereby
-saving the internal BFD overhead, but uses BFD to swap things
-on the way out, making cross ports much safer. Doing so also
-allows BFD (and thus the linker) to use the same header files
-as @code{gas}, which makes one avenue to disaster disappear.
-
-@subsubsection Symbol reading
-The simple canonical form for symbols used by BFD is not rich
-enough to keep all the information available in a coff symbol
-table. The back end gets around this problem by keeping the original
-symbol table around, "behind the scenes".
-
-When a symbol table is requested (through a call to
-@code{bfd_canonicalize_symtab}), a request gets through to
-@code{coff_get_normalized_symtab}. This reads the symbol table from
-the coff file and swaps all the structures inside into the
-internal form. It also fixes up all the pointers in the table
-(represented in the file by offsets from the first symbol in
-the table) into physical pointers to elements in the new
-internal table. This involves some work since the meanings of
-fields change depending upon context: a field that is a
-pointer to another structure in the symbol table at one moment
-may be the size in bytes of a structure at the next. Another
-pass is made over the table. All symbols which mark file names
-(@code{C_FILE} symbols) are modified so that the internal
-string points to the value in the auxent (the real filename)
-rather than the normal text associated with the symbol
-(@code{".file"}).
-
-At this time the symbol names are moved around. Coff stores
-all symbols less than nine characters long physically
-within the symbol table; longer strings are kept at the end of
-the file in the string table. This pass moves all strings
-into memory and replaces them with pointers to the strings.
-
-The symbol table is massaged once again, this time to create
-the canonical table used by the BFD application. Each symbol
-is inspected in turn, and a decision made (using the
-@code{sclass} field) about the various flags to set in the
-@code{asymbol}. @xref{Symbols}. The generated canonical table
-shares strings with the hidden internal symbol table.
-
-Any linenumbers are read from the coff file too, and attached
-to the symbols which own the functions the linenumbers belong to.
-
-@subsubsection Symbol writing
-Writing a symbol to a coff file which didn't come from a coff
-file will lose any debugging information. The @code{asymbol}
-structure remembers the BFD from which the symbol was taken, and on
-output the back end makes sure that the same destination target as
-source target is present.
-
-When the symbols have come from a coff file then all the
-debugging information is preserved.
-
-Symbol tables are provided for writing to the back end in a
-vector of pointers to pointers. This allows applications like
-the linker to accumulate and output large symbol tables
-without having to do too much byte copying.
-
-This function runs through the provided symbol table and
-patches each symbol marked as a file place holder
-(@code{C_FILE}) to point to the next file place holder in the
-list. It also marks each @code{offset} field in the list with
-the offset from the first symbol of the current symbol.
-
-Another function of this procedure is to turn the canonical
-value form of BFD into the form used by coff. Internally, BFD
-expects symbol values to be offsets from a section base; so a
-symbol physically at 0x120, but in a section starting at
-0x100, would have the value 0x20. Coff expects symbols to
-contain their final value, so symbols have their values
-changed at this point to reflect their sum with their owning
-section. This transformation uses the
-@code{output_section} field of the @code{asymbol}'s
-@code{asection} @xref{Sections}.
-
-@itemize @bullet
-
-@item
-@code{coff_mangle_symbols}
-@end itemize
-This routine runs though the provided symbol table and uses
-the offsets generated by the previous pass and the pointers
-generated when the symbol table was read in to create the
-structured hierarchy required by coff. It changes each pointer
-to a symbol into the index into the symbol table of the asymbol.
-
-@itemize @bullet
-
-@item
-@code{coff_write_symbols}
-@end itemize
-This routine runs through the symbol table and patches up the
-symbols from their internal form into the coff way, calls the
-bit twiddlers, and writes out the table to the file.
-
-@findex coff_symbol_type
-@subsubsection @code{coff_symbol_type}
-@strong{Description}@*
-The hidden information for an @code{asymbol} is described in a
-@code{combined_entry_type}:
-
-
-@example
-
-typedef struct coff_ptr_struct
-@{
- /* Remembers the offset from the first symbol in the file for
- this symbol. Generated by coff_renumber_symbols. */
- unsigned int offset;
-
- /* Should the value of this symbol be renumbered. Used for
- XCOFF C_BSTAT symbols. Set by coff_slurp_symbol_table. */
- unsigned int fix_value : 1;
-
- /* Should the tag field of this symbol be renumbered.
- Created by coff_pointerize_aux. */
- unsigned int fix_tag : 1;
-
- /* Should the endidx field of this symbol be renumbered.
- Created by coff_pointerize_aux. */
- unsigned int fix_end : 1;
-
- /* Should the x_csect.x_scnlen field be renumbered.
- Created by coff_pointerize_aux. */
- unsigned int fix_scnlen : 1;
-
- /* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the
- index into the line number entries. Set by coff_slurp_symbol_table. */
- unsigned int fix_line : 1;
-
- /* The container for the symbol structure as read and translated
- from the file. */
- union
- @{
- union internal_auxent auxent;
- struct internal_syment syment;
- @} u;
-@} combined_entry_type;
-
-
-/* Each canonical asymbol really looks like this: */
-
-typedef struct coff_symbol_struct
-@{
- /* The actual symbol which the rest of BFD works with */
- asymbol symbol;
-
- /* A pointer to the hidden information for this symbol */
- combined_entry_type *native;
-
- /* A pointer to the linenumber information for this symbol */
- struct lineno_cache_entry *lineno;
-
- /* Have the line numbers been relocated yet ? */
- bfd_boolean done_lineno;
-@} coff_symbol_type;
-@end example
-@findex bfd_coff_backend_data
-@subsubsection @code{bfd_coff_backend_data}
-
-@example
-/* COFF symbol classifications. */
-
-enum coff_symbol_classification
-@{
- /* Global symbol. */
- COFF_SYMBOL_GLOBAL,
- /* Common symbol. */
- COFF_SYMBOL_COMMON,
- /* Undefined symbol. */
- COFF_SYMBOL_UNDEFINED,
- /* Local symbol. */
- COFF_SYMBOL_LOCAL,
- /* PE section symbol. */
- COFF_SYMBOL_PE_SECTION
-@};
-
-@end example
-Special entry points for gdb to swap in coff symbol table parts:
-@example
-typedef struct
-@{
- void (*_bfd_coff_swap_aux_in)
- (bfd *, void *, int, int, int, int, void *);
-
- void (*_bfd_coff_swap_sym_in)
- (bfd *, void *, void *);
-
- void (*_bfd_coff_swap_lineno_in)
- (bfd *, void *, void *);
-
- unsigned int (*_bfd_coff_swap_aux_out)
- (bfd *, void *, int, int, int, int, void *);
-
- unsigned int (*_bfd_coff_swap_sym_out)
- (bfd *, void *, void *);
-
- unsigned int (*_bfd_coff_swap_lineno_out)
- (bfd *, void *, void *);
-
- unsigned int (*_bfd_coff_swap_reloc_out)
- (bfd *, void *, void *);
-
- unsigned int (*_bfd_coff_swap_filehdr_out)
- (bfd *, void *, void *);
-
- unsigned int (*_bfd_coff_swap_aouthdr_out)
- (bfd *, void *, void *);
-
- unsigned int (*_bfd_coff_swap_scnhdr_out)
- (bfd *, void *, void *);
-
- unsigned int _bfd_filhsz;
- unsigned int _bfd_aoutsz;
- unsigned int _bfd_scnhsz;
- unsigned int _bfd_symesz;
- unsigned int _bfd_auxesz;
- unsigned int _bfd_relsz;
- unsigned int _bfd_linesz;
- unsigned int _bfd_filnmlen;
- bfd_boolean _bfd_coff_long_filenames;
- bfd_boolean _bfd_coff_long_section_names;
- unsigned int _bfd_coff_default_section_alignment_power;
- bfd_boolean _bfd_coff_force_symnames_in_strings;
- unsigned int _bfd_coff_debug_string_prefix_length;
-
- void (*_bfd_coff_swap_filehdr_in)
- (bfd *, void *, void *);
-
- void (*_bfd_coff_swap_aouthdr_in)
- (bfd *, void *, void *);
-
- void (*_bfd_coff_swap_scnhdr_in)
- (bfd *, void *, void *);
-
- void (*_bfd_coff_swap_reloc_in)
- (bfd *abfd, void *, void *);
-
- bfd_boolean (*_bfd_coff_bad_format_hook)
- (bfd *, void *);
-
- bfd_boolean (*_bfd_coff_set_arch_mach_hook)
- (bfd *, void *);
-
- void * (*_bfd_coff_mkobject_hook)
- (bfd *, void *, void *);
-
- bfd_boolean (*_bfd_styp_to_sec_flags_hook)
- (bfd *, void *, const char *, asection *, flagword *);
-
- void (*_bfd_set_alignment_hook)
- (bfd *, asection *, void *);
-
- bfd_boolean (*_bfd_coff_slurp_symbol_table)
- (bfd *);
-
- bfd_boolean (*_bfd_coff_symname_in_debug)
- (bfd *, struct internal_syment *);
-
- bfd_boolean (*_bfd_coff_pointerize_aux_hook)
- (bfd *, combined_entry_type *, combined_entry_type *,
- unsigned int, combined_entry_type *);
-
- bfd_boolean (*_bfd_coff_print_aux)
- (bfd *, FILE *, combined_entry_type *, combined_entry_type *,
- combined_entry_type *, unsigned int);
-
- void (*_bfd_coff_reloc16_extra_cases)
- (bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *,
- bfd_byte *, unsigned int *, unsigned int *);
-
- int (*_bfd_coff_reloc16_estimate)
- (bfd *, asection *, arelent *, unsigned int,
- struct bfd_link_info *);
-
- enum coff_symbol_classification (*_bfd_coff_classify_symbol)
- (bfd *, struct internal_syment *);
-
- bfd_boolean (*_bfd_coff_compute_section_file_positions)
- (bfd *);
-
- bfd_boolean (*_bfd_coff_start_final_link)
- (bfd *, struct bfd_link_info *);
-
- bfd_boolean (*_bfd_coff_relocate_section)
- (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- struct internal_reloc *, struct internal_syment *, asection **);
-
- reloc_howto_type *(*_bfd_coff_rtype_to_howto)
- (bfd *, asection *, struct internal_reloc *,
- struct coff_link_hash_entry *, struct internal_syment *,
- bfd_vma *);
-
- bfd_boolean (*_bfd_coff_adjust_symndx)
- (bfd *, struct bfd_link_info *, bfd *, asection *,
- struct internal_reloc *, bfd_boolean *);
-
- bfd_boolean (*_bfd_coff_link_add_one_symbol)
- (struct bfd_link_info *, bfd *, const char *, flagword,
- asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean,
- struct bfd_link_hash_entry **);
-
- bfd_boolean (*_bfd_coff_link_output_has_begun)
- (bfd *, struct coff_final_link_info *);
-
- bfd_boolean (*_bfd_coff_final_link_postscript)
- (bfd *, struct coff_final_link_info *);
-
-@} bfd_coff_backend_data;
-
-#define coff_backend_info(abfd) \
- ((bfd_coff_backend_data *) (abfd)->xvec->backend_data)
-
-#define bfd_coff_swap_aux_in(a,e,t,c,ind,num,i) \
- ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i))
-
-#define bfd_coff_swap_sym_in(a,e,i) \
- ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i))
-
-#define bfd_coff_swap_lineno_in(a,e,i) \
- ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i))
-
-#define bfd_coff_swap_reloc_out(abfd, i, o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o))
-
-#define bfd_coff_swap_lineno_out(abfd, i, o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o))
-
-#define bfd_coff_swap_aux_out(a,i,t,c,ind,num,o) \
- ((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o))
-
-#define bfd_coff_swap_sym_out(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o))
-
-#define bfd_coff_swap_scnhdr_out(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o))
-
-#define bfd_coff_swap_filehdr_out(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o))
-
-#define bfd_coff_swap_aouthdr_out(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o))
-
-#define bfd_coff_filhsz(abfd) (coff_backend_info (abfd)->_bfd_filhsz)
-#define bfd_coff_aoutsz(abfd) (coff_backend_info (abfd)->_bfd_aoutsz)
-#define bfd_coff_scnhsz(abfd) (coff_backend_info (abfd)->_bfd_scnhsz)
-#define bfd_coff_symesz(abfd) (coff_backend_info (abfd)->_bfd_symesz)
-#define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz)
-#define bfd_coff_relsz(abfd) (coff_backend_info (abfd)->_bfd_relsz)
-#define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz)
-#define bfd_coff_filnmlen(abfd) (coff_backend_info (abfd)->_bfd_filnmlen)
-#define bfd_coff_long_filenames(abfd) \
- (coff_backend_info (abfd)->_bfd_coff_long_filenames)
-#define bfd_coff_long_section_names(abfd) \
- (coff_backend_info (abfd)->_bfd_coff_long_section_names)
-#define bfd_coff_default_section_alignment_power(abfd) \
- (coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power)
-#define bfd_coff_swap_filehdr_in(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o))
-
-#define bfd_coff_swap_aouthdr_in(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o))
-
-#define bfd_coff_swap_scnhdr_in(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o))
-
-#define bfd_coff_swap_reloc_in(abfd, i, o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o))
-
-#define bfd_coff_bad_format_hook(abfd, filehdr) \
- ((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr))
-
-#define bfd_coff_set_arch_mach_hook(abfd, filehdr)\
- ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr))
-#define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\
- ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook)\
- (abfd, filehdr, aouthdr))
-
-#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name, section, flags_ptr)\
- ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\
- (abfd, scnhdr, name, section, flags_ptr))
-
-#define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\
- ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr))
-
-#define bfd_coff_slurp_symbol_table(abfd)\
- ((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd))
-
-#define bfd_coff_symname_in_debug(abfd, sym)\
- ((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym))
-
-#define bfd_coff_force_symnames_in_strings(abfd)\
- (coff_backend_info (abfd)->_bfd_coff_force_symnames_in_strings)
-
-#define bfd_coff_debug_string_prefix_length(abfd)\
- (coff_backend_info (abfd)->_bfd_coff_debug_string_prefix_length)
-
-#define bfd_coff_print_aux(abfd, file, base, symbol, aux, indaux)\
- ((coff_backend_info (abfd)->_bfd_coff_print_aux)\
- (abfd, file, base, symbol, aux, indaux))
-
-#define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order,\
- reloc, data, src_ptr, dst_ptr)\
- ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\
- (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr))
-
-#define bfd_coff_reloc16_estimate(abfd, section, reloc, shrink, link_info)\
- ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\
- (abfd, section, reloc, shrink, link_info))
-
-#define bfd_coff_classify_symbol(abfd, sym)\
- ((coff_backend_info (abfd)->_bfd_coff_classify_symbol)\
- (abfd, sym))
-
-#define bfd_coff_compute_section_file_positions(abfd)\
- ((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\
- (abfd))
-
-#define bfd_coff_start_final_link(obfd, info)\
- ((coff_backend_info (obfd)->_bfd_coff_start_final_link)\
- (obfd, info))
-#define bfd_coff_relocate_section(obfd,info,ibfd,o,con,rel,isyms,secs)\
- ((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\
- (obfd, info, ibfd, o, con, rel, isyms, secs))
-#define bfd_coff_rtype_to_howto(abfd, sec, rel, h, sym, addendp)\
- ((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\
- (abfd, sec, rel, h, sym, addendp))
-#define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\
- ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\
- (obfd, info, ibfd, sec, rel, adjustedp))
-#define bfd_coff_link_add_one_symbol(info, abfd, name, flags, section,\
- value, string, cp, coll, hashp)\
- ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\
- (info, abfd, name, flags, section, value, string, cp, coll, hashp))
-
-#define bfd_coff_link_output_has_begun(a,p) \
- ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a, p))
-#define bfd_coff_final_link_postscript(a,p) \
- ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a, p))
-
-@end example
-@subsubsection Writing relocations
-To write relocations, the back end steps though the
-canonical relocation table and create an
-@code{internal_reloc}. The symbol index to use is removed from
-the @code{offset} field in the symbol table supplied. The
-address comes directly from the sum of the section base
-address and the relocation offset; the type is dug directly
-from the howto field. Then the @code{internal_reloc} is
-swapped into the shape of an @code{external_reloc} and written
-out to disk.
-
-@subsubsection Reading linenumbers
-Creating the linenumber table is done by reading in the entire
-coff linenumber table, and creating another table for internal use.
-
-A coff linenumber table is structured so that each function
-is marked as having a line number of 0. Each line within the
-function is an offset from the first line in the function. The
-base of the line number information for the table is stored in
-the symbol associated with the function.
-
-Note: The PE format uses line number 0 for a flag indicating a
-new source file.
-
-The information is copied from the external to the internal
-table, and each symbol which marks a function is marked by
-pointing its...
-
-How does this work ?
-
-@subsubsection Reading relocations
-Coff relocations are easily transformed into the internal BFD form
-(@code{arelent}).
-
-Reading a coff relocation table is done in the following stages:
-
-@itemize @bullet
-
-@item
-Read the entire coff relocation table into memory.
-
-@item
-Process each relocation in turn; first swap it from the
-external to the internal form.
-
-@item
-Turn the symbol referenced in the relocation's symbol index
-into a pointer into the canonical symbol table.
-This table is the same as the one returned by a call to
-@code{bfd_canonicalize_symtab}. The back end will call that
-routine and save the result if a canonicalization hasn't been done.
-
-@item
-The reloc index is turned into a pointer to a howto
-structure, in a back end specific way. For instance, the 386
-and 960 use the @code{r_type} to directly produce an index
-into a howto table vector; the 88k subtracts a number from the
-@code{r_type} field and creates an addend field.
-@end itemize
-
diff --git a/bfd/doc/core.texi b/bfd/doc/core.texi
deleted file mode 100644
index 1f09445ef76d..000000000000
--- a/bfd/doc/core.texi
+++ /dev/null
@@ -1,60 +0,0 @@
-@section Core files
-
-
-@subsection Core file functions
-
-
-@strong{Description}@*
-These are functions pertaining to core files.
-
-@findex bfd_core_file_failing_command
-@subsubsection @code{bfd_core_file_failing_command}
-@strong{Synopsis}
-@example
-const char *bfd_core_file_failing_command (bfd *abfd);
-@end example
-@strong{Description}@*
-Return a read-only string explaining which program was running
-when it failed and produced the core file @var{abfd}.
-
-@findex bfd_core_file_failing_signal
-@subsubsection @code{bfd_core_file_failing_signal}
-@strong{Synopsis}
-@example
-int bfd_core_file_failing_signal (bfd *abfd);
-@end example
-@strong{Description}@*
-Returns the signal number which caused the core dump which
-generated the file the BFD @var{abfd} is attached to.
-
-@findex core_file_matches_executable_p
-@subsubsection @code{core_file_matches_executable_p}
-@strong{Synopsis}
-@example
-bfd_boolean core_file_matches_executable_p
- (bfd *core_bfd, bfd *exec_bfd);
-@end example
-@strong{Description}@*
-Return @code{TRUE} if the core file attached to @var{core_bfd}
-was generated by a run of the executable file attached to
-@var{exec_bfd}, @code{FALSE} otherwise.
-
-@findex generic_core_file_matches_executable_p
-@subsubsection @code{generic_core_file_matches_executable_p}
-@strong{Synopsis}
-@example
-bfd_boolean generic_core_file_matches_executable_p
- (bfd *core_bfd, bfd *exec_bfd);
-@end example
-@strong{Description}@*
-Return TRUE if the core file attached to @var{core_bfd}
-was generated by a run of the executable file attached
-to @var{exec_bfd}. The match is based on executable
-basenames only.
-
-Note: When not able to determine the core file failing
-command or the executable name, we still return TRUE even
-though we're not sure that core file and executable match.
-This is to avoid generating a false warning in situations
-where we really don't know whether they match or not.
-
diff --git a/bfd/doc/elf.texi b/bfd/doc/elf.texi
deleted file mode 100644
index 4f9434cf69d4..000000000000
--- a/bfd/doc/elf.texi
+++ /dev/null
@@ -1,22 +0,0 @@
-@section ELF backends
-BFD support for ELF formats is being worked on.
-Currently, the best supported back ends are for sparc and i386
-(running svr4 or Solaris 2).
-
-Documentation of the internals of the support code still needs
-to be written. The code is changing quickly enough that we
-haven't bothered yet.
-
-@findex bfd_elf_find_section
-@subsubsection @code{bfd_elf_find_section}
-@strong{Synopsis}
-@example
-struct elf_internal_shdr *bfd_elf_find_section (bfd *abfd, char *name);
-@end example
-@strong{Description}@*
-Helper functions for GDB to locate the string tables.
-Since BFD hides string tables from callers, GDB needs to use an
-internal hook to find them. Sun's .stabstr, in particular,
-isn't even pointed to by the .stab section, so ordinary
-mechanisms wouldn't work to find it, even if we had some.
-
diff --git a/bfd/doc/elfcode.texi b/bfd/doc/elfcode.texi
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/bfd/doc/elfcode.texi
+++ /dev/null
diff --git a/bfd/doc/format.texi b/bfd/doc/format.texi
deleted file mode 100644
index 9674acff440b..000000000000
--- a/bfd/doc/format.texi
+++ /dev/null
@@ -1,112 +0,0 @@
-@section File formats
-A format is a BFD concept of high level file contents type. The
-formats supported by BFD are:
-
-@itemize @bullet
-
-@item
-@code{bfd_object}
-@end itemize
-The BFD may contain data, symbols, relocations and debug info.
-
-@itemize @bullet
-
-@item
-@code{bfd_archive}
-@end itemize
-The BFD contains other BFDs and an optional index.
-
-@itemize @bullet
-
-@item
-@code{bfd_core}
-@end itemize
-The BFD contains the result of an executable core dump.
-
-@subsection File format functions
-
-
-@findex bfd_check_format
-@subsubsection @code{bfd_check_format}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_check_format (bfd *abfd, bfd_format format);
-@end example
-@strong{Description}@*
-Verify if the file attached to the BFD @var{abfd} is compatible
-with the format @var{format} (i.e., one of @code{bfd_object},
-@code{bfd_archive} or @code{bfd_core}).
-
-If the BFD has been set to a specific target before the
-call, only the named target and format combination is
-checked. If the target has not been set, or has been set to
-@code{default}, then all the known target backends is
-interrogated to determine a match. If the default target
-matches, it is used. If not, exactly one target must recognize
-the file, or an error results.
-
-The function returns @code{TRUE} on success, otherwise @code{FALSE}
-with one of the following error codes:
-
-@itemize @bullet
-
-@item
-@code{bfd_error_invalid_operation} -
-if @code{format} is not one of @code{bfd_object}, @code{bfd_archive} or
-@code{bfd_core}.
-
-@item
-@code{bfd_error_system_call} -
-if an error occured during a read - even some file mismatches
-can cause bfd_error_system_calls.
-
-@item
-@code{file_not_recognised} -
-none of the backends recognised the file format.
-
-@item
-@code{bfd_error_file_ambiguously_recognized} -
-more than one backend recognised the file format.
-@end itemize
-
-@findex bfd_check_format_matches
-@subsubsection @code{bfd_check_format_matches}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_check_format_matches
- (bfd *abfd, bfd_format format, char ***matching);
-@end example
-@strong{Description}@*
-Like @code{bfd_check_format}, except when it returns FALSE with
-@code{bfd_errno} set to @code{bfd_error_file_ambiguously_recognized}. In that
-case, if @var{matching} is not NULL, it will be filled in with
-a NULL-terminated list of the names of the formats that matched,
-allocated with @code{malloc}.
-Then the user may choose a format and try again.
-
-When done with the list that @var{matching} points to, the caller
-should free it.
-
-@findex bfd_set_format
-@subsubsection @code{bfd_set_format}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_set_format (bfd *abfd, bfd_format format);
-@end example
-@strong{Description}@*
-This function sets the file format of the BFD @var{abfd} to the
-format @var{format}. If the target set in the BFD does not
-support the format requested, the format is invalid, or the BFD
-is not open for writing, then an error occurs.
-
-@findex bfd_format_string
-@subsubsection @code{bfd_format_string}
-@strong{Synopsis}
-@example
-const char *bfd_format_string (bfd_format format);
-@end example
-@strong{Description}@*
-Return a pointer to a const string
-@code{invalid}, @code{object}, @code{archive}, @code{core}, or @code{unknown},
-depending upon the value of @var{format}.
-
diff --git a/bfd/doc/hash.texi b/bfd/doc/hash.texi
deleted file mode 100644
index 88d9585cc405..000000000000
--- a/bfd/doc/hash.texi
+++ /dev/null
@@ -1,247 +0,0 @@
-@section Hash Tables
-@cindex Hash tables
-BFD provides a simple set of hash table functions. Routines
-are provided to initialize a hash table, to free a hash table,
-to look up a string in a hash table and optionally create an
-entry for it, and to traverse a hash table. There is
-currently no routine to delete an string from a hash table.
-
-The basic hash table does not permit any data to be stored
-with a string. However, a hash table is designed to present a
-base class from which other types of hash tables may be
-derived. These derived types may store additional information
-with the string. Hash tables were implemented in this way,
-rather than simply providing a data pointer in a hash table
-entry, because they were designed for use by the linker back
-ends. The linker may create thousands of hash table entries,
-and the overhead of allocating private data and storing and
-following pointers becomes noticeable.
-
-The basic hash table code is in @code{hash.c}.
-
-@menu
-* Creating and Freeing a Hash Table::
-* Looking Up or Entering a String::
-* Traversing a Hash Table::
-* Deriving a New Hash Table Type::
-@end menu
-
-@node Creating and Freeing a Hash Table, Looking Up or Entering a String, Hash Tables, Hash Tables
-@subsection Creating and freeing a hash table
-@findex bfd_hash_table_init
-@findex bfd_hash_table_init_n
-To create a hash table, create an instance of a @code{struct
-bfd_hash_table} (defined in @code{bfd.h}) and call
-@code{bfd_hash_table_init} (if you know approximately how many
-entries you will need, the function @code{bfd_hash_table_init_n},
-which takes a @var{size} argument, may be used).
-@code{bfd_hash_table_init} returns @code{FALSE} if some sort of
-error occurs.
-
-@findex bfd_hash_newfunc
-The function @code{bfd_hash_table_init} take as an argument a
-function to use to create new entries. For a basic hash
-table, use the function @code{bfd_hash_newfunc}. @xref{Deriving
-a New Hash Table Type}, for why you would want to use a
-different value for this argument.
-
-@findex bfd_hash_allocate
-@code{bfd_hash_table_init} will create an objalloc which will be
-used to allocate new entries. You may allocate memory on this
-objalloc using @code{bfd_hash_allocate}.
-
-@findex bfd_hash_table_free
-Use @code{bfd_hash_table_free} to free up all the memory that has
-been allocated for a hash table. This will not free up the
-@code{struct bfd_hash_table} itself, which you must provide.
-
-@findex bfd_hash_set_default_size
-Use @code{bfd_hash_set_default_size} to set the default size of
-hash table to use.
-
-@node Looking Up or Entering a String, Traversing a Hash Table, Creating and Freeing a Hash Table, Hash Tables
-@subsection Looking up or entering a string
-@findex bfd_hash_lookup
-The function @code{bfd_hash_lookup} is used both to look up a
-string in the hash table and to create a new entry.
-
-If the @var{create} argument is @code{FALSE}, @code{bfd_hash_lookup}
-will look up a string. If the string is found, it will
-returns a pointer to a @code{struct bfd_hash_entry}. If the
-string is not found in the table @code{bfd_hash_lookup} will
-return @code{NULL}. You should not modify any of the fields in
-the returns @code{struct bfd_hash_entry}.
-
-If the @var{create} argument is @code{TRUE}, the string will be
-entered into the hash table if it is not already there.
-Either way a pointer to a @code{struct bfd_hash_entry} will be
-returned, either to the existing structure or to a newly
-created one. In this case, a @code{NULL} return means that an
-error occurred.
-
-If the @var{create} argument is @code{TRUE}, and a new entry is
-created, the @var{copy} argument is used to decide whether to
-copy the string onto the hash table objalloc or not. If
-@var{copy} is passed as @code{FALSE}, you must be careful not to
-deallocate or modify the string as long as the hash table
-exists.
-
-@node Traversing a Hash Table, Deriving a New Hash Table Type, Looking Up or Entering a String, Hash Tables
-@subsection Traversing a hash table
-@findex bfd_hash_traverse
-The function @code{bfd_hash_traverse} may be used to traverse a
-hash table, calling a function on each element. The traversal
-is done in a random order.
-
-@code{bfd_hash_traverse} takes as arguments a function and a
-generic @code{void *} pointer. The function is called with a
-hash table entry (a @code{struct bfd_hash_entry *}) and the
-generic pointer passed to @code{bfd_hash_traverse}. The function
-must return a @code{boolean} value, which indicates whether to
-continue traversing the hash table. If the function returns
-@code{FALSE}, @code{bfd_hash_traverse} will stop the traversal and
-return immediately.
-
-@node Deriving a New Hash Table Type, , Traversing a Hash Table, Hash Tables
-@subsection Deriving a new hash table type
-Many uses of hash tables want to store additional information
-which each entry in the hash table. Some also find it
-convenient to store additional information with the hash table
-itself. This may be done using a derived hash table.
-
-Since C is not an object oriented language, creating a derived
-hash table requires sticking together some boilerplate
-routines with a few differences specific to the type of hash
-table you want to create.
-
-An example of a derived hash table is the linker hash table.
-The structures for this are defined in @code{bfdlink.h}. The
-functions are in @code{linker.c}.
-
-You may also derive a hash table from an already derived hash
-table. For example, the a.out linker backend code uses a hash
-table derived from the linker hash table.
-
-@menu
-* Define the Derived Structures::
-* Write the Derived Creation Routine::
-* Write Other Derived Routines::
-@end menu
-
-@node Define the Derived Structures, Write the Derived Creation Routine, Deriving a New Hash Table Type, Deriving a New Hash Table Type
-@subsubsection Define the derived structures
-You must define a structure for an entry in the hash table,
-and a structure for the hash table itself.
-
-The first field in the structure for an entry in the hash
-table must be of the type used for an entry in the hash table
-you are deriving from. If you are deriving from a basic hash
-table this is @code{struct bfd_hash_entry}, which is defined in
-@code{bfd.h}. The first field in the structure for the hash
-table itself must be of the type of the hash table you are
-deriving from itself. If you are deriving from a basic hash
-table, this is @code{struct bfd_hash_table}.
-
-For example, the linker hash table defines @code{struct
-bfd_link_hash_entry} (in @code{bfdlink.h}). The first field,
-@code{root}, is of type @code{struct bfd_hash_entry}. Similarly,
-the first field in @code{struct bfd_link_hash_table}, @code{table},
-is of type @code{struct bfd_hash_table}.
-
-@node Write the Derived Creation Routine, Write Other Derived Routines, Define the Derived Structures, Deriving a New Hash Table Type
-@subsubsection Write the derived creation routine
-You must write a routine which will create and initialize an
-entry in the hash table. This routine is passed as the
-function argument to @code{bfd_hash_table_init}.
-
-In order to permit other hash tables to be derived from the
-hash table you are creating, this routine must be written in a
-standard way.
-
-The first argument to the creation routine is a pointer to a
-hash table entry. This may be @code{NULL}, in which case the
-routine should allocate the right amount of space. Otherwise
-the space has already been allocated by a hash table type
-derived from this one.
-
-After allocating space, the creation routine must call the
-creation routine of the hash table type it is derived from,
-passing in a pointer to the space it just allocated. This
-will initialize any fields used by the base hash table.
-
-Finally the creation routine must initialize any local fields
-for the new hash table type.
-
-Here is a boilerplate example of a creation routine.
-@var{function_name} is the name of the routine.
-@var{entry_type} is the type of an entry in the hash table you
-are creating. @var{base_newfunc} is the name of the creation
-routine of the hash table type your hash table is derived
-from.
-
-
-@example
-struct bfd_hash_entry *
-@var{function_name} (struct bfd_hash_entry *entry,
- struct bfd_hash_table *table,
- const char *string)
-@{
- struct @var{entry_type} *ret = (@var{entry_type} *) entry;
-
- /* Allocate the structure if it has not already been allocated by a
- derived class. */
- if (ret == NULL)
- @{
- ret = bfd_hash_allocate (table, sizeof (* ret));
- if (ret == NULL)
- return NULL;
- @}
-
- /* Call the allocation method of the base class. */
- ret = ((@var{entry_type} *)
- @var{base_newfunc} ((struct bfd_hash_entry *) ret, table, string));
-
- /* Initialize the local fields here. */
-
- return (struct bfd_hash_entry *) ret;
-@}
-@end example
-@strong{Description}@*
-The creation routine for the linker hash table, which is in
-@code{linker.c}, looks just like this example.
-@var{function_name} is @code{_bfd_link_hash_newfunc}.
-@var{entry_type} is @code{struct bfd_link_hash_entry}.
-@var{base_newfunc} is @code{bfd_hash_newfunc}, the creation
-routine for a basic hash table.
-
-@code{_bfd_link_hash_newfunc} also initializes the local fields
-in a linker hash table entry: @code{type}, @code{written} and
-@code{next}.
-
-@node Write Other Derived Routines, , Write the Derived Creation Routine, Deriving a New Hash Table Type
-@subsubsection Write other derived routines
-You will want to write other routines for your new hash table,
-as well.
-
-You will want an initialization routine which calls the
-initialization routine of the hash table you are deriving from
-and initializes any other local fields. For the linker hash
-table, this is @code{_bfd_link_hash_table_init} in @code{linker.c}.
-
-You will want a lookup routine which calls the lookup routine
-of the hash table you are deriving from and casts the result.
-The linker hash table uses @code{bfd_link_hash_lookup} in
-@code{linker.c} (this actually takes an additional argument which
-it uses to decide how to return the looked up value).
-
-You may want a traversal routine. This should just call the
-traversal routine of the hash table you are deriving from with
-appropriate casts. The linker hash table uses
-@code{bfd_link_hash_traverse} in @code{linker.c}.
-
-These routines may simply be defined as macros. For example,
-the a.out backend linker hash table, which is derived from the
-linker hash table, uses macros for the lookup and traversal
-routines. These are @code{aout_link_hash_lookup} and
-@code{aout_link_hash_traverse} in aoutx.h.
-
diff --git a/bfd/doc/init.texi b/bfd/doc/init.texi
deleted file mode 100644
index ab735f8e986c..000000000000
--- a/bfd/doc/init.texi
+++ /dev/null
@@ -1,16 +0,0 @@
-@section Initialization
-
-
-@subsection Initialization functions
-These are the functions that handle initializing a BFD.
-
-@findex bfd_init
-@subsubsection @code{bfd_init}
-@strong{Synopsis}
-@example
-void bfd_init (void);
-@end example
-@strong{Description}@*
-This routine must be called before any other BFD function to
-initialize magical internal data structures.
-
diff --git a/bfd/doc/libbfd.texi b/bfd/doc/libbfd.texi
deleted file mode 100644
index fef6e0e842ec..000000000000
--- a/bfd/doc/libbfd.texi
+++ /dev/null
@@ -1,179 +0,0 @@
-@section Implementation details
-
-
-@subsection Internal functions
-
-
-@strong{Description}@*
-These routines are used within BFD.
-They are not intended for export, but are documented here for
-completeness.
-
-@findex bfd_write_bigendian_4byte_int
-@subsubsection @code{bfd_write_bigendian_4byte_int}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int);
-@end example
-@strong{Description}@*
-Write a 4 byte integer @var{i} to the output BFD @var{abfd}, in big
-endian order regardless of what else is going on. This is useful in
-archives.
-
-@findex bfd_put_size
-@subsubsection @code{bfd_put_size}
-@findex bfd_get_size
-@subsubsection @code{bfd_get_size}
-@strong{Description}@*
-These macros as used for reading and writing raw data in
-sections; each access (except for bytes) is vectored through
-the target format of the BFD and mangled accordingly. The
-mangling performs any necessary endian translations and
-removes alignment restrictions. Note that types accepted and
-returned by these macros are identical so they can be swapped
-around in macros---for example, @file{libaout.h} defines @code{GET_WORD}
-to either @code{bfd_get_32} or @code{bfd_get_64}.
-
-In the put routines, @var{val} must be a @code{bfd_vma}. If we are on a
-system without prototypes, the caller is responsible for making
-sure that is true, with a cast if necessary. We don't cast
-them in the macro definitions because that would prevent @code{lint}
-or @code{gcc -Wall} from detecting sins such as passing a pointer.
-To detect calling these with less than a @code{bfd_vma}, use
-@code{gcc -Wconversion} on a host with 64 bit @code{bfd_vma}'s.
-@example
-
-/* Byte swapping macros for user section data. */
-
-#define bfd_put_8(abfd, val, ptr) \
- ((void) (*((unsigned char *) (ptr)) = (val) & 0xff))
-#define bfd_put_signed_8 \
- bfd_put_8
-#define bfd_get_8(abfd, ptr) \
- (*(unsigned char *) (ptr) & 0xff)
-#define bfd_get_signed_8(abfd, ptr) \
- (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80)
-
-#define bfd_put_16(abfd, val, ptr) \
- BFD_SEND (abfd, bfd_putx16, ((val),(ptr)))
-#define bfd_put_signed_16 \
- bfd_put_16
-#define bfd_get_16(abfd, ptr) \
- BFD_SEND (abfd, bfd_getx16, (ptr))
-#define bfd_get_signed_16(abfd, ptr) \
- BFD_SEND (abfd, bfd_getx_signed_16, (ptr))
-
-#define bfd_put_32(abfd, val, ptr) \
- BFD_SEND (abfd, bfd_putx32, ((val),(ptr)))
-#define bfd_put_signed_32 \
- bfd_put_32
-#define bfd_get_32(abfd, ptr) \
- BFD_SEND (abfd, bfd_getx32, (ptr))
-#define bfd_get_signed_32(abfd, ptr) \
- BFD_SEND (abfd, bfd_getx_signed_32, (ptr))
-
-#define bfd_put_64(abfd, val, ptr) \
- BFD_SEND (abfd, bfd_putx64, ((val), (ptr)))
-#define bfd_put_signed_64 \
- bfd_put_64
-#define bfd_get_64(abfd, ptr) \
- BFD_SEND (abfd, bfd_getx64, (ptr))
-#define bfd_get_signed_64(abfd, ptr) \
- BFD_SEND (abfd, bfd_getx_signed_64, (ptr))
-
-#define bfd_get(bits, abfd, ptr) \
- ((bits) == 8 ? (bfd_vma) bfd_get_8 (abfd, ptr) \
- : (bits) == 16 ? bfd_get_16 (abfd, ptr) \
- : (bits) == 32 ? bfd_get_32 (abfd, ptr) \
- : (bits) == 64 ? bfd_get_64 (abfd, ptr) \
- : (abort (), (bfd_vma) - 1))
-
-#define bfd_put(bits, abfd, val, ptr) \
- ((bits) == 8 ? bfd_put_8 (abfd, val, ptr) \
- : (bits) == 16 ? bfd_put_16 (abfd, val, ptr) \
- : (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \
- : (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \
- : (abort (), (void) 0))
-
-@end example
-
-@findex bfd_h_put_size
-@subsubsection @code{bfd_h_put_size}
-@strong{Description}@*
-These macros have the same function as their @code{bfd_get_x}
-brethren, except that they are used for removing information
-for the header records of object files. Believe it or not,
-some object files keep their header records in big endian
-order and their data in little endian order.
-@example
-
-/* Byte swapping macros for file header data. */
-
-#define bfd_h_put_8(abfd, val, ptr) \
- bfd_put_8 (abfd, val, ptr)
-#define bfd_h_put_signed_8(abfd, val, ptr) \
- bfd_put_8 (abfd, val, ptr)
-#define bfd_h_get_8(abfd, ptr) \
- bfd_get_8 (abfd, ptr)
-#define bfd_h_get_signed_8(abfd, ptr) \
- bfd_get_signed_8 (abfd, ptr)
-
-#define bfd_h_put_16(abfd, val, ptr) \
- BFD_SEND (abfd, bfd_h_putx16, (val, ptr))
-#define bfd_h_put_signed_16 \
- bfd_h_put_16
-#define bfd_h_get_16(abfd, ptr) \
- BFD_SEND (abfd, bfd_h_getx16, (ptr))
-#define bfd_h_get_signed_16(abfd, ptr) \
- BFD_SEND (abfd, bfd_h_getx_signed_16, (ptr))
-
-#define bfd_h_put_32(abfd, val, ptr) \
- BFD_SEND (abfd, bfd_h_putx32, (val, ptr))
-#define bfd_h_put_signed_32 \
- bfd_h_put_32
-#define bfd_h_get_32(abfd, ptr) \
- BFD_SEND (abfd, bfd_h_getx32, (ptr))
-#define bfd_h_get_signed_32(abfd, ptr) \
- BFD_SEND (abfd, bfd_h_getx_signed_32, (ptr))
-
-#define bfd_h_put_64(abfd, val, ptr) \
- BFD_SEND (abfd, bfd_h_putx64, (val, ptr))
-#define bfd_h_put_signed_64 \
- bfd_h_put_64
-#define bfd_h_get_64(abfd, ptr) \
- BFD_SEND (abfd, bfd_h_getx64, (ptr))
-#define bfd_h_get_signed_64(abfd, ptr) \
- BFD_SEND (abfd, bfd_h_getx_signed_64, (ptr))
-
-/* Aliases for the above, which should eventually go away. */
-
-#define H_PUT_64 bfd_h_put_64
-#define H_PUT_32 bfd_h_put_32
-#define H_PUT_16 bfd_h_put_16
-#define H_PUT_8 bfd_h_put_8
-#define H_PUT_S64 bfd_h_put_signed_64
-#define H_PUT_S32 bfd_h_put_signed_32
-#define H_PUT_S16 bfd_h_put_signed_16
-#define H_PUT_S8 bfd_h_put_signed_8
-#define H_GET_64 bfd_h_get_64
-#define H_GET_32 bfd_h_get_32
-#define H_GET_16 bfd_h_get_16
-#define H_GET_8 bfd_h_get_8
-#define H_GET_S64 bfd_h_get_signed_64
-#define H_GET_S32 bfd_h_get_signed_32
-#define H_GET_S16 bfd_h_get_signed_16
-#define H_GET_S8 bfd_h_get_signed_8
-
-
-@end example
-
-@findex bfd_log2
-@subsubsection @code{bfd_log2}
-@strong{Synopsis}
-@example
-unsigned int bfd_log2 (bfd_vma x);
-@end example
-@strong{Description}@*
-Return the log base 2 of the value supplied, rounded up. E.g., an
-@var{x} of 1025 returns 11. A @var{x} of 0 returns 0.
-
diff --git a/bfd/doc/linker.texi b/bfd/doc/linker.texi
deleted file mode 100644
index 8a55006a187c..000000000000
--- a/bfd/doc/linker.texi
+++ /dev/null
@@ -1,380 +0,0 @@
-@section Linker Functions
-@cindex Linker
-The linker uses three special entry points in the BFD target
-vector. It is not necessary to write special routines for
-these entry points when creating a new BFD back end, since
-generic versions are provided. However, writing them can
-speed up linking and make it use significantly less runtime
-memory.
-
-The first routine creates a hash table used by the other
-routines. The second routine adds the symbols from an object
-file to the hash table. The third routine takes all the
-object files and links them together to create the output
-file. These routines are designed so that the linker proper
-does not need to know anything about the symbols in the object
-files that it is linking. The linker merely arranges the
-sections as directed by the linker script and lets BFD handle
-the details of symbols and relocs.
-
-The second routine and third routines are passed a pointer to
-a @code{struct bfd_link_info} structure (defined in
-@code{bfdlink.h}) which holds information relevant to the link,
-including the linker hash table (which was created by the
-first routine) and a set of callback functions to the linker
-proper.
-
-The generic linker routines are in @code{linker.c}, and use the
-header file @code{genlink.h}. As of this writing, the only back
-ends which have implemented versions of these routines are
-a.out (in @code{aoutx.h}) and ECOFF (in @code{ecoff.c}). The a.out
-routines are used as examples throughout this section.
-
-@menu
-* Creating a Linker Hash Table::
-* Adding Symbols to the Hash Table::
-* Performing the Final Link::
-@end menu
-
-@node Creating a Linker Hash Table, Adding Symbols to the Hash Table, Linker Functions, Linker Functions
-@subsection Creating a linker hash table
-@cindex _bfd_link_hash_table_create in target vector
-@cindex target vector (_bfd_link_hash_table_create)
-The linker routines must create a hash table, which must be
-derived from @code{struct bfd_link_hash_table} described in
-@code{bfdlink.c}. @xref{Hash Tables}, for information on how to
-create a derived hash table. This entry point is called using
-the target vector of the linker output file.
-
-The @code{_bfd_link_hash_table_create} entry point must allocate
-and initialize an instance of the desired hash table. If the
-back end does not require any additional information to be
-stored with the entries in the hash table, the entry point may
-simply create a @code{struct bfd_link_hash_table}. Most likely,
-however, some additional information will be needed.
-
-For example, with each entry in the hash table the a.out
-linker keeps the index the symbol has in the final output file
-(this index number is used so that when doing a relocatable
-link the symbol index used in the output file can be quickly
-filled in when copying over a reloc). The a.out linker code
-defines the required structures and functions for a hash table
-derived from @code{struct bfd_link_hash_table}. The a.out linker
-hash table is created by the function
-@code{NAME(aout,link_hash_table_create)}; it simply allocates
-space for the hash table, initializes it, and returns a
-pointer to it.
-
-When writing the linker routines for a new back end, you will
-generally not know exactly which fields will be required until
-you have finished. You should simply create a new hash table
-which defines no additional fields, and then simply add fields
-as they become necessary.
-
-@node Adding Symbols to the Hash Table, Performing the Final Link, Creating a Linker Hash Table, Linker Functions
-@subsection Adding symbols to the hash table
-@cindex _bfd_link_add_symbols in target vector
-@cindex target vector (_bfd_link_add_symbols)
-The linker proper will call the @code{_bfd_link_add_symbols}
-entry point for each object file or archive which is to be
-linked (typically these are the files named on the command
-line, but some may also come from the linker script). The
-entry point is responsible for examining the file. For an
-object file, BFD must add any relevant symbol information to
-the hash table. For an archive, BFD must determine which
-elements of the archive should be used and adding them to the
-link.
-
-The a.out version of this entry point is
-@code{NAME(aout,link_add_symbols)}.
-
-@menu
-* Differing file formats::
-* Adding symbols from an object file::
-* Adding symbols from an archive::
-@end menu
-
-@node Differing file formats, Adding symbols from an object file, Adding Symbols to the Hash Table, Adding Symbols to the Hash Table
-@subsubsection Differing file formats
-Normally all the files involved in a link will be of the same
-format, but it is also possible to link together different
-format object files, and the back end must support that. The
-@code{_bfd_link_add_symbols} entry point is called via the target
-vector of the file to be added. This has an important
-consequence: the function may not assume that the hash table
-is the type created by the corresponding
-@code{_bfd_link_hash_table_create} vector. All the
-@code{_bfd_link_add_symbols} function can assume about the hash
-table is that it is derived from @code{struct
-bfd_link_hash_table}.
-
-Sometimes the @code{_bfd_link_add_symbols} function must store
-some information in the hash table entry to be used by the
-@code{_bfd_final_link} function. In such a case the @code{creator}
-field of the hash table must be checked to make sure that the
-hash table was created by an object file of the same format.
-
-The @code{_bfd_final_link} routine must be prepared to handle a
-hash entry without any extra information added by the
-@code{_bfd_link_add_symbols} function. A hash entry without
-extra information will also occur when the linker script
-directs the linker to create a symbol. Note that, regardless
-of how a hash table entry is added, all the fields will be
-initialized to some sort of null value by the hash table entry
-initialization function.
-
-See @code{ecoff_link_add_externals} for an example of how to
-check the @code{creator} field before saving information (in this
-case, the ECOFF external symbol debugging information) in a
-hash table entry.
-
-@node Adding symbols from an object file, Adding symbols from an archive, Differing file formats, Adding Symbols to the Hash Table
-@subsubsection Adding symbols from an object file
-When the @code{_bfd_link_add_symbols} routine is passed an object
-file, it must add all externally visible symbols in that
-object file to the hash table. The actual work of adding the
-symbol to the hash table is normally handled by the function
-@code{_bfd_generic_link_add_one_symbol}. The
-@code{_bfd_link_add_symbols} routine is responsible for reading
-all the symbols from the object file and passing the correct
-information to @code{_bfd_generic_link_add_one_symbol}.
-
-The @code{_bfd_link_add_symbols} routine should not use
-@code{bfd_canonicalize_symtab} to read the symbols. The point of
-providing this routine is to avoid the overhead of converting
-the symbols into generic @code{asymbol} structures.
-
-@findex _bfd_generic_link_add_one_symbol
-@code{_bfd_generic_link_add_one_symbol} handles the details of
-combining common symbols, warning about multiple definitions,
-and so forth. It takes arguments which describe the symbol to
-add, notably symbol flags, a section, and an offset. The
-symbol flags include such things as @code{BSF_WEAK} or
-@code{BSF_INDIRECT}. The section is a section in the object
-file, or something like @code{bfd_und_section_ptr} for an undefined
-symbol or @code{bfd_com_section_ptr} for a common symbol.
-
-If the @code{_bfd_final_link} routine is also going to need to
-read the symbol information, the @code{_bfd_link_add_symbols}
-routine should save it somewhere attached to the object file
-BFD. However, the information should only be saved if the
-@code{keep_memory} field of the @code{info} argument is TRUE, so
-that the @code{-no-keep-memory} linker switch is effective.
-
-The a.out function which adds symbols from an object file is
-@code{aout_link_add_object_symbols}, and most of the interesting
-work is in @code{aout_link_add_symbols}. The latter saves
-pointers to the hash tables entries created by
-@code{_bfd_generic_link_add_one_symbol} indexed by symbol number,
-so that the @code{_bfd_final_link} routine does not have to call
-the hash table lookup routine to locate the entry.
-
-@node Adding symbols from an archive, , Adding symbols from an object file, Adding Symbols to the Hash Table
-@subsubsection Adding symbols from an archive
-When the @code{_bfd_link_add_symbols} routine is passed an
-archive, it must look through the symbols defined by the
-archive and decide which elements of the archive should be
-included in the link. For each such element it must call the
-@code{add_archive_element} linker callback, and it must add the
-symbols from the object file to the linker hash table.
-
-@findex _bfd_generic_link_add_archive_symbols
-In most cases the work of looking through the symbols in the
-archive should be done by the
-@code{_bfd_generic_link_add_archive_symbols} function. This
-function builds a hash table from the archive symbol table and
-looks through the list of undefined symbols to see which
-elements should be included.
-@code{_bfd_generic_link_add_archive_symbols} is passed a function
-to call to make the final decision about adding an archive
-element to the link and to do the actual work of adding the
-symbols to the linker hash table.
-
-The function passed to
-@code{_bfd_generic_link_add_archive_symbols} must read the
-symbols of the archive element and decide whether the archive
-element should be included in the link. If the element is to
-be included, the @code{add_archive_element} linker callback
-routine must be called with the element as an argument, and
-the elements symbols must be added to the linker hash table
-just as though the element had itself been passed to the
-@code{_bfd_link_add_symbols} function.
-
-When the a.out @code{_bfd_link_add_symbols} function receives an
-archive, it calls @code{_bfd_generic_link_add_archive_symbols}
-passing @code{aout_link_check_archive_element} as the function
-argument. @code{aout_link_check_archive_element} calls
-@code{aout_link_check_ar_symbols}. If the latter decides to add
-the element (an element is only added if it provides a real,
-non-common, definition for a previously undefined or common
-symbol) it calls the @code{add_archive_element} callback and then
-@code{aout_link_check_archive_element} calls
-@code{aout_link_add_symbols} to actually add the symbols to the
-linker hash table.
-
-The ECOFF back end is unusual in that it does not normally
-call @code{_bfd_generic_link_add_archive_symbols}, because ECOFF
-archives already contain a hash table of symbols. The ECOFF
-back end searches the archive itself to avoid the overhead of
-creating a new hash table.
-
-@node Performing the Final Link, , Adding Symbols to the Hash Table, Linker Functions
-@subsection Performing the final link
-@cindex _bfd_link_final_link in target vector
-@cindex target vector (_bfd_final_link)
-When all the input files have been processed, the linker calls
-the @code{_bfd_final_link} entry point of the output BFD. This
-routine is responsible for producing the final output file,
-which has several aspects. It must relocate the contents of
-the input sections and copy the data into the output sections.
-It must build an output symbol table including any local
-symbols from the input files and the global symbols from the
-hash table. When producing relocatable output, it must
-modify the input relocs and write them into the output file.
-There may also be object format dependent work to be done.
-
-The linker will also call the @code{write_object_contents} entry
-point when the BFD is closed. The two entry points must work
-together in order to produce the correct output file.
-
-The details of how this works are inevitably dependent upon
-the specific object file format. The a.out
-@code{_bfd_final_link} routine is @code{NAME(aout,final_link)}.
-
-@menu
-* Information provided by the linker::
-* Relocating the section contents::
-* Writing the symbol table::
-@end menu
-
-@node Information provided by the linker, Relocating the section contents, Performing the Final Link, Performing the Final Link
-@subsubsection Information provided by the linker
-Before the linker calls the @code{_bfd_final_link} entry point,
-it sets up some data structures for the function to use.
-
-The @code{input_bfds} field of the @code{bfd_link_info} structure
-will point to a list of all the input files included in the
-link. These files are linked through the @code{link_next} field
-of the @code{bfd} structure.
-
-Each section in the output file will have a list of
-@code{link_order} structures attached to the @code{map_head.link_order}
-field (the @code{link_order} structure is defined in
-@code{bfdlink.h}). These structures describe how to create the
-contents of the output section in terms of the contents of
-various input sections, fill constants, and, eventually, other
-types of information. They also describe relocs that must be
-created by the BFD backend, but do not correspond to any input
-file; this is used to support -Ur, which builds constructors
-while generating a relocatable object file.
-
-@node Relocating the section contents, Writing the symbol table, Information provided by the linker, Performing the Final Link
-@subsubsection Relocating the section contents
-The @code{_bfd_final_link} function should look through the
-@code{link_order} structures attached to each section of the
-output file. Each @code{link_order} structure should either be
-handled specially, or it should be passed to the function
-@code{_bfd_default_link_order} which will do the right thing
-(@code{_bfd_default_link_order} is defined in @code{linker.c}).
-
-For efficiency, a @code{link_order} of type
-@code{bfd_indirect_link_order} whose associated section belongs
-to a BFD of the same format as the output BFD must be handled
-specially. This type of @code{link_order} describes part of an
-output section in terms of a section belonging to one of the
-input files. The @code{_bfd_final_link} function should read the
-contents of the section and any associated relocs, apply the
-relocs to the section contents, and write out the modified
-section contents. If performing a relocatable link, the
-relocs themselves must also be modified and written out.
-
-@findex _bfd_relocate_contents
-@findex _bfd_final_link_relocate
-The functions @code{_bfd_relocate_contents} and
-@code{_bfd_final_link_relocate} provide some general support for
-performing the actual relocations, notably overflow checking.
-Their arguments include information about the symbol the
-relocation is against and a @code{reloc_howto_type} argument
-which describes the relocation to perform. These functions
-are defined in @code{reloc.c}.
-
-The a.out function which handles reading, relocating, and
-writing section contents is @code{aout_link_input_section}. The
-actual relocation is done in @code{aout_link_input_section_std}
-and @code{aout_link_input_section_ext}.
-
-@node Writing the symbol table, , Relocating the section contents, Performing the Final Link
-@subsubsection Writing the symbol table
-The @code{_bfd_final_link} function must gather all the symbols
-in the input files and write them out. It must also write out
-all the symbols in the global hash table. This must be
-controlled by the @code{strip} and @code{discard} fields of the
-@code{bfd_link_info} structure.
-
-The local symbols of the input files will not have been
-entered into the linker hash table. The @code{_bfd_final_link}
-routine must consider each input file and include the symbols
-in the output file. It may be convenient to do this when
-looking through the @code{link_order} structures, or it may be
-done by stepping through the @code{input_bfds} list.
-
-The @code{_bfd_final_link} routine must also traverse the global
-hash table to gather all the externally visible symbols. It
-is possible that most of the externally visible symbols may be
-written out when considering the symbols of each input file,
-but it is still necessary to traverse the hash table since the
-linker script may have defined some symbols that are not in
-any of the input files.
-
-The @code{strip} field of the @code{bfd_link_info} structure
-controls which symbols are written out. The possible values
-are listed in @code{bfdlink.h}. If the value is @code{strip_some},
-then the @code{keep_hash} field of the @code{bfd_link_info}
-structure is a hash table of symbols to keep; each symbol
-should be looked up in this hash table, and only symbols which
-are present should be included in the output file.
-
-If the @code{strip} field of the @code{bfd_link_info} structure
-permits local symbols to be written out, the @code{discard} field
-is used to further controls which local symbols are included
-in the output file. If the value is @code{discard_l}, then all
-local symbols which begin with a certain prefix are discarded;
-this is controlled by the @code{bfd_is_local_label_name} entry point.
-
-The a.out backend handles symbols by calling
-@code{aout_link_write_symbols} on each input BFD and then
-traversing the global hash table with the function
-@code{aout_link_write_other_symbol}. It builds a string table
-while writing out the symbols, which is written to the output
-file at the end of @code{NAME(aout,final_link)}.
-
-@findex bfd_link_split_section
-@subsubsection @code{bfd_link_split_section}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_link_split_section (bfd *abfd, asection *sec);
-@end example
-@strong{Description}@*
-Return nonzero if @var{sec} should be split during a
-reloceatable or final link.
-@example
-#define bfd_link_split_section(abfd, sec) \
- BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec))
-
-@end example
-
-@findex bfd_section_already_linked
-@subsubsection @code{bfd_section_already_linked}
-@strong{Synopsis}
-@example
-void bfd_section_already_linked (bfd *abfd, asection *sec);
-@end example
-@strong{Description}@*
-Check if @var{sec} has been already linked during a reloceatable
-or final link.
-@example
-#define bfd_section_already_linked(abfd, sec) \
- BFD_SEND (abfd, _section_already_linked, (abfd, sec))
-
-@end example
-
diff --git a/bfd/doc/mmo.texi b/bfd/doc/mmo.texi
deleted file mode 100644
index b0d726aad9c1..000000000000
--- a/bfd/doc/mmo.texi
+++ /dev/null
@@ -1,365 +0,0 @@
-@section mmo backend
-The mmo object format is used exclusively together with Professor
-Donald E.@: Knuth's educational 64-bit processor MMIX. The simulator
-@command{mmix} which is available at
-@url{http://www-cs-faculty.stanford.edu/~knuth/programs/mmix.tar.gz}
-understands this format. That package also includes a combined
-assembler and linker called @command{mmixal}. The mmo format has
-no advantages feature-wise compared to e.g. ELF. It is a simple
-non-relocatable object format with no support for archives or
-debugging information, except for symbol value information and
-line numbers (which is not yet implemented in BFD). See
-@url{http://www-cs-faculty.stanford.edu/~knuth/mmix.html} for more
-information about MMIX. The ELF format is used for intermediate
-object files in the BFD implementation.
-
-@c We want to xref the symbol table node. A feature in "chew"
-@c requires that "commands" do not contain spaces in the
-@c arguments. Hence the hyphen in "Symbol-table".
-@menu
-* File layout::
-* Symbol-table::
-* mmo section mapping::
-@end menu
-
-@node File layout, Symbol-table, mmo, mmo
-@subsection File layout
-The mmo file contents is not partitioned into named sections as
-with e.g.@: ELF. Memory areas is formed by specifying the
-location of the data that follows. Only the memory area
-@samp{0x0000@dots{}00} to @samp{0x01ff@dots{}ff} is executable, so
-it is used for code (and constants) and the area
-@samp{0x2000@dots{}00} to @samp{0x20ff@dots{}ff} is used for
-writable data. @xref{mmo section mapping}.
-
-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}.
-
-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:
-
-@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/bfd/doc/opncls.texi b/bfd/doc/opncls.texi
deleted file mode 100644
index 6b47adfbb45d..000000000000
--- a/bfd/doc/opncls.texi
+++ /dev/null
@@ -1,365 +0,0 @@
-@section Opening and closing BFDs
-
-
-@subsection Functions for opening and closing
-
-
-@findex bfd_fopen
-@subsubsection @code{bfd_fopen}
-@strong{Synopsis}
-@example
-bfd *bfd_fopen (const char *filename, const char *target,
- const char *mode, int fd);
-@end example
-@strong{Description}@*
-Open the file @var{filename} with the target @var{target}.
-Return a pointer to the created BFD. If @var{fd} is not -1,
-then @code{fdopen} is used to open the file; otherwise, @code{fopen}
-is used. @var{mode} is passed directly to @code{fopen} or
-@code{fdopen}.
-
-Calls @code{bfd_find_target}, so @var{target} is interpreted as by
-that function.
-
-The new BFD is marked as cacheable iff @var{fd} is -1.
-
-If @code{NULL} is returned then an error has occured. Possible errors
-are @code{bfd_error_no_memory}, @code{bfd_error_invalid_target} or
-@code{system_call} error.
-
-@findex bfd_openr
-@subsubsection @code{bfd_openr}
-@strong{Synopsis}
-@example
-bfd *bfd_openr (const char *filename, const char *target);
-@end example
-@strong{Description}@*
-Open the file @var{filename} (using @code{fopen}) with the target
-@var{target}. Return a pointer to the created BFD.
-
-Calls @code{bfd_find_target}, so @var{target} is interpreted as by
-that function.
-
-If @code{NULL} is returned then an error has occured. Possible errors
-are @code{bfd_error_no_memory}, @code{bfd_error_invalid_target} or
-@code{system_call} error.
-
-@findex bfd_fdopenr
-@subsubsection @code{bfd_fdopenr}
-@strong{Synopsis}
-@example
-bfd *bfd_fdopenr (const char *filename, const char *target, int fd);
-@end example
-@strong{Description}@*
-@code{bfd_fdopenr} is to @code{bfd_fopenr} much like @code{fdopen} is to
-@code{fopen}. It opens a BFD on a file already described by the
-@var{fd} supplied.
-
-When the file is later @code{bfd_close}d, the file descriptor will
-be closed. If the caller desires that this file descriptor be
-cached by BFD (opened as needed, closed as needed to free
-descriptors for other opens), with the supplied @var{fd} used as
-an initial file descriptor (but subject to closure at any time),
-call bfd_set_cacheable(bfd, 1) on the returned BFD. The default
-is to assume no caching; the file descriptor will remain open
-until @code{bfd_close}, and will not be affected by BFD operations
-on other files.
-
-Possible errors are @code{bfd_error_no_memory},
-@code{bfd_error_invalid_target} and @code{bfd_error_system_call}.
-
-@findex bfd_openstreamr
-@subsubsection @code{bfd_openstreamr}
-@strong{Synopsis}
-@example
-bfd *bfd_openstreamr (const char *, const char *, void *);
-@end example
-@strong{Description}@*
-Open a BFD for read access on an existing stdio stream. When
-the BFD is passed to @code{bfd_close}, the stream will be closed.
-
-@findex bfd_openr_iovec
-@subsubsection @code{bfd_openr_iovec}
-@strong{Synopsis}
-@example
-bfd *bfd_openr_iovec (const char *filename, const char *target,
- void *(*open) (struct bfd *nbfd,
- void *open_closure),
- void *open_closure,
- file_ptr (*pread) (struct bfd *nbfd,
- void *stream,
- void *buf,
- file_ptr nbytes,
- file_ptr offset),
- int (*close) (struct bfd *nbfd,
- void *stream));
-@end example
-@strong{Description}@*
-Create and return a BFD backed by a read-only @var{stream}.
-The @var{stream} is created using @var{open}, accessed using
-@var{pread} and destroyed using @var{close}.
-
-Calls @code{bfd_find_target}, so @var{target} is interpreted as by
-that function.
-
-Calls @var{open} (which can call @code{bfd_zalloc} and
-@code{bfd_get_filename}) to obtain the read-only stream backing
-the BFD. @var{open} either succeeds returning the
-non-@code{NULL} @var{stream}, or fails returning @code{NULL}
-(setting @code{bfd_error}).
-
-Calls @var{pread} to request @var{nbytes} of data from
-@var{stream} starting at @var{offset} (e.g., via a call to
-@code{bfd_read}). @var{pread} either succeeds returning the
-number of bytes read (which can be less than @var{nbytes} when
-end-of-file), or fails returning -1 (setting @code{bfd_error}).
-
-Calls @var{close} when the BFD is later closed using
-@code{bfd_close}. @var{close} either succeeds returning 0, or
-fails returning -1 (setting @code{bfd_error}).
-
-If @code{bfd_openr_iovec} returns @code{NULL} then an error has
-occurred. Possible errors are @code{bfd_error_no_memory},
-@code{bfd_error_invalid_target} and @code{bfd_error_system_call}.
-
-@findex bfd_openw
-@subsubsection @code{bfd_openw}
-@strong{Synopsis}
-@example
-bfd *bfd_openw (const char *filename, const char *target);
-@end example
-@strong{Description}@*
-Create a BFD, associated with file @var{filename}, using the
-file format @var{target}, and return a pointer to it.
-
-Possible errors are @code{bfd_error_system_call}, @code{bfd_error_no_memory},
-@code{bfd_error_invalid_target}.
-
-@findex bfd_close
-@subsubsection @code{bfd_close}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_close (bfd *abfd);
-@end example
-@strong{Description}@*
-Close a BFD. If the BFD was open for writing, then pending
-operations are completed and the file written out and closed.
-If the created file is executable, then @code{chmod} is called
-to mark it as such.
-
-All memory attached to the BFD is released.
-
-The file descriptor associated with the BFD is closed (even
-if it was passed in to BFD by @code{bfd_fdopenr}).
-
-@strong{Returns}@*
-@code{TRUE} is returned if all is ok, otherwise @code{FALSE}.
-
-@findex bfd_close_all_done
-@subsubsection @code{bfd_close_all_done}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_close_all_done (bfd *);
-@end example
-@strong{Description}@*
-Close a BFD. Differs from @code{bfd_close} since it does not
-complete any pending operations. This routine would be used
-if the application had just used BFD for swapping and didn't
-want to use any of the writing code.
-
-If the created file is executable, then @code{chmod} is called
-to mark it as such.
-
-All memory attached to the BFD is released.
-
-@strong{Returns}@*
-@code{TRUE} is returned if all is ok, otherwise @code{FALSE}.
-
-@findex bfd_create
-@subsubsection @code{bfd_create}
-@strong{Synopsis}
-@example
-bfd *bfd_create (const char *filename, bfd *templ);
-@end example
-@strong{Description}@*
-Create a new BFD in the manner of @code{bfd_openw}, but without
-opening a file. The new BFD takes the target from the target
-used by @var{template}. The format is always set to @code{bfd_object}.
-
-@findex bfd_make_writable
-@subsubsection @code{bfd_make_writable}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_make_writable (bfd *abfd);
-@end example
-@strong{Description}@*
-Takes a BFD as created by @code{bfd_create} and converts it
-into one like as returned by @code{bfd_openw}. It does this
-by converting the BFD to BFD_IN_MEMORY. It's assumed that
-you will call @code{bfd_make_readable} on this bfd later.
-
-@strong{Returns}@*
-@code{TRUE} is returned if all is ok, otherwise @code{FALSE}.
-
-@findex bfd_make_readable
-@subsubsection @code{bfd_make_readable}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_make_readable (bfd *abfd);
-@end example
-@strong{Description}@*
-Takes a BFD as created by @code{bfd_create} and
-@code{bfd_make_writable} and converts it into one like as
-returned by @code{bfd_openr}. It does this by writing the
-contents out to the memory buffer, then reversing the
-direction.
-
-@strong{Returns}@*
-@code{TRUE} is returned if all is ok, otherwise @code{FALSE}.
-
-@findex bfd_alloc
-@subsubsection @code{bfd_alloc}
-@strong{Synopsis}
-@example
-void *bfd_alloc (bfd *abfd, bfd_size_type 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_alloc2
-@subsubsection @code{bfd_alloc2}
-@strong{Synopsis}
-@example
-void *bfd_alloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size);
-@end example
-@strong{Description}@*
-Allocate a block of @var{nmemb} elements of @var{size} bytes each
-of memory attached to @code{abfd} and return a pointer to it.
-
-@findex bfd_zalloc
-@subsubsection @code{bfd_zalloc}
-@strong{Synopsis}
-@example
-void *bfd_zalloc (bfd *abfd, bfd_size_type wanted);
-@end example
-@strong{Description}@*
-Allocate a block of @var{wanted} bytes of zeroed memory
-attached to @code{abfd} and return a pointer to it.
-
-@findex bfd_zalloc2
-@subsubsection @code{bfd_zalloc2}
-@strong{Synopsis}
-@example
-void *bfd_zalloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size);
-@end example
-@strong{Description}@*
-Allocate a block of @var{nmemb} elements of @var{size} bytes each
-of zeroed 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/bfd/doc/reloc.texi b/bfd/doc/reloc.texi
deleted file mode 100644
index 0540be862551..000000000000
--- a/bfd/doc/reloc.texi
+++ /dev/null
@@ -1,2494 +0,0 @@
-@section Relocations
-BFD maintains relocations in much the same way it maintains
-symbols: they are left alone until required, then read in
-en-masse and translated into an internal form. A common
-routine @code{bfd_perform_relocation} acts upon the
-canonical form to do the fixup.
-
-Relocations are maintained on a per section basis,
-while symbols are maintained on a per BFD basis.
-
-All that a back end has to do to fit the BFD interface is to create
-a @code{struct reloc_cache_entry} for each relocation
-in a particular section, and fill in the right bits of the structures.
-
-@menu
-* typedef arelent::
-* howto manager::
-@end menu
-
-
-@node typedef arelent, howto manager, Relocations, Relocations
-@subsection typedef arelent
-This is the structure of a relocation entry:
-
-
-@example
-
-typedef enum bfd_reloc_status
-@{
- /* No errors detected. */
- bfd_reloc_ok,
-
- /* The relocation was performed, but there was an overflow. */
- bfd_reloc_overflow,
-
- /* The address to relocate was not within the section supplied. */
- bfd_reloc_outofrange,
-
- /* Used by special functions. */
- bfd_reloc_continue,
-
- /* Unsupported relocation size requested. */
- bfd_reloc_notsupported,
-
- /* Unused. */
- bfd_reloc_other,
-
- /* The symbol to relocate against was undefined. */
- bfd_reloc_undefined,
-
- /* The relocation was performed, but may not be ok - presently
- generated only when linking i960 coff files with i960 b.out
- symbols. If this type is returned, the error_message argument
- to bfd_perform_relocation will be set. */
- bfd_reloc_dangerous
- @}
- bfd_reloc_status_type;
-
-
-typedef struct reloc_cache_entry
-@{
- /* A pointer into the canonical table of pointers. */
- struct bfd_symbol **sym_ptr_ptr;
-
- /* offset in section. */
- bfd_size_type address;
-
- /* addend for relocation value. */
- bfd_vma addend;
-
- /* Pointer to how to perform the required relocation. */
- reloc_howto_type *howto;
-
-@}
-arelent;
-
-@end example
-@strong{Description}@*
-Here is a description of each of the fields within an @code{arelent}:
-
-@itemize @bullet
-
-@item
-@code{sym_ptr_ptr}
-@end itemize
-The symbol table pointer points to a pointer to the symbol
-associated with the relocation request. It is the pointer
-into the table returned by the back end's
-@code{canonicalize_symtab} action. @xref{Symbols}. The symbol is
-referenced through a pointer to a pointer so that tools like
-the linker can fix up all the symbols of the same name by
-modifying only one pointer. The relocation routine looks in
-the symbol and uses the base of the section the symbol is
-attached to and the value of the symbol as the initial
-relocation offset. If the symbol pointer is zero, then the
-section provided is looked up.
-
-@itemize @bullet
-
-@item
-@code{address}
-@end itemize
-The @code{address} field gives the offset in bytes from the base of
-the section data which owns the relocation record to the first
-byte of relocatable information. The actual data relocated
-will be relative to this point; for example, a relocation
-type which modifies the bottom two bytes of a four byte word
-would not touch the first byte pointed to in a big endian
-world.
-
-@itemize @bullet
-
-@item
-@code{addend}
-@end itemize
-The @code{addend} is a value provided by the back end to be added (!)
-to the relocation offset. Its interpretation is dependent upon
-the howto. For example, on the 68k the code:
-
-@example
- char foo[];
- main()
- @{
- return foo[0x12345678];
- @}
-@end example
-
-Could be compiled into:
-
-@example
- linkw fp,#-4
- moveb @@#12345678,d0
- extbl d0
- unlk fp
- rts
-@end example
-
-This could create a reloc pointing to @code{foo}, but leave the
-offset in the data, something like:
-
-@example
-RELOCATION RECORDS FOR [.text]:
-offset type value
-00000006 32 _foo
-
-00000000 4e56 fffc ; linkw fp,#-4
-00000004 1039 1234 5678 ; moveb @@#12345678,d0
-0000000a 49c0 ; extbl d0
-0000000c 4e5e ; unlk fp
-0000000e 4e75 ; rts
-@end example
-
-Using coff and an 88k, some instructions don't have enough
-space in them to represent the full address range, and
-pointers have to be loaded in two parts. So you'd get something like:
-
-@example
- or.u r13,r0,hi16(_foo+0x12345678)
- ld.b r2,r13,lo16(_foo+0x12345678)
- jmp r1
-@end example
-
-This should create two relocs, both pointing to @code{_foo}, and with
-0x12340000 in their addend field. The data would consist of:
-
-@example
-RELOCATION RECORDS FOR [.text]:
-offset type value
-00000002 HVRT16 _foo+0x12340000
-00000006 LVRT16 _foo+0x12340000
-
-00000000 5da05678 ; or.u r13,r0,0x5678
-00000004 1c4d5678 ; ld.b r2,r13,0x5678
-00000008 f400c001 ; jmp r1
-@end example
-
-The relocation routine digs out the value from the data, adds
-it to the addend to get the original offset, and then adds the
-value of @code{_foo}. Note that all 32 bits have to be kept around
-somewhere, to cope with carry from bit 15 to bit 16.
-
-One further example is the sparc and the a.out format. The
-sparc has a similar problem to the 88k, in that some
-instructions don't have room for an entire offset, but on the
-sparc the parts are created in odd sized lumps. The designers of
-the a.out format chose to not use the data within the section
-for storing part of the offset; all the offset is kept within
-the reloc. Anything in the data should be ignored.
-
-@example
- save %sp,-112,%sp
- sethi %hi(_foo+0x12345678),%g2
- ldsb [%g2+%lo(_foo+0x12345678)],%i0
- ret
- restore
-@end example
-
-Both relocs contain a pointer to @code{foo}, and the offsets
-contain junk.
-
-@example
-RELOCATION RECORDS FOR [.text]:
-offset type value
-00000004 HI22 _foo+0x12345678
-00000008 LO10 _foo+0x12345678
-
-00000000 9de3bf90 ; save %sp,-112,%sp
-00000004 05000000 ; sethi %hi(_foo+0),%g2
-00000008 f048a000 ; ldsb [%g2+%lo(_foo+0)],%i0
-0000000c 81c7e008 ; ret
-00000010 81e80000 ; restore
-@end example
-
-@itemize @bullet
-
-@item
-@code{howto}
-@end itemize
-The @code{howto} field can be imagined as a
-relocation instruction. It is a pointer to a structure which
-contains information on what to do with all of the other
-information in the reloc record and data section. A back end
-would normally have a relocation instruction set and turn
-relocations into pointers to the correct structure on input -
-but it would be possible to create each howto field on demand.
-
-@subsubsection @code{enum complain_overflow}
-Indicates what sort of overflow checking should be done when
-performing a relocation.
-
-
-@example
-
-enum complain_overflow
-@{
- /* Do not complain on overflow. */
- complain_overflow_dont,
-
- /* Complain if the value overflows when considered as a signed
- number one bit larger than the field. ie. A bitfield of N bits
- is allowed to represent -2**n to 2**n-1. */
- complain_overflow_bitfield,
-
- /* Complain if the value overflows when considered as a signed
- number. */
- complain_overflow_signed,
-
- /* Complain if the value overflows when considered as an
- unsigned number. */
- complain_overflow_unsigned
-@};
-@end example
-@subsubsection @code{reloc_howto_type}
-The @code{reloc_howto_type} is a structure which contains all the
-information that libbfd needs to know to tie up a back end's data.
-
-
-@example
-struct bfd_symbol; /* Forward declaration. */
-
-struct reloc_howto_struct
-@{
- /* The type field has mainly a documentary use - the back end can
- do what it wants with it, though normally the back end's
- external idea of what a reloc number is stored
- in this field. For example, a PC relative word relocation
- in a coff environment has the type 023 - because that's
- what the outside world calls a R_PCRWORD reloc. */
- unsigned int type;
-
- /* The value the final relocation is shifted right by. This drops
- unwanted data from the relocation. */
- unsigned int rightshift;
-
- /* The size of the item to be relocated. This is *not* a
- power-of-two measure. To get the number of bytes operated
- on by a type of relocation, use bfd_get_reloc_size. */
- int size;
-
- /* The number of bits in the item to be relocated. This is used
- when doing overflow checking. */
- unsigned int bitsize;
-
- /* Notes that the relocation is relative to the location in the
- data section of the addend. The relocation function will
- subtract from the relocation value the address of the location
- being relocated. */
- bfd_boolean pc_relative;
-
- /* The bit position of the reloc value in the destination.
- The relocated value is left shifted by this amount. */
- unsigned int bitpos;
-
- /* What type of overflow error should be checked for when
- relocating. */
- enum complain_overflow complain_on_overflow;
-
- /* If this field is non null, then the supplied function is
- called rather than the normal function. This allows really
- strange relocation methods to be accommodated (e.g., i960 callj
- instructions). */
- bfd_reloc_status_type (*special_function)
- (bfd *, arelent *, struct bfd_symbol *, void *, asection *,
- bfd *, char **);
-
- /* The textual name of the relocation type. */
- char *name;
-
- /* Some formats record a relocation addend in the section contents
- rather than with the relocation. For ELF formats this is the
- distinction between USE_REL and USE_RELA (though the code checks
- for USE_REL == 1/0). The value of this field is TRUE if the
- addend is recorded with the section contents; when performing a
- partial link (ld -r) the section contents (the data) will be
- modified. The value of this field is FALSE if addends are
- recorded with the relocation (in arelent.addend); when performing
- a partial link the relocation will be modified.
- All relocations for all ELF USE_RELA targets should set this field
- to FALSE (values of TRUE should be looked on with suspicion).
- However, the converse is not true: not all relocations of all ELF
- USE_REL targets set this field to TRUE. Why this is so is peculiar
- to each particular target. For relocs that aren't used in partial
- links (e.g. GOT stuff) it doesn't matter what this is set to. */
- bfd_boolean partial_inplace;
-
- /* src_mask selects the part of the instruction (or data) to be used
- in the relocation sum. If the target relocations don't have an
- addend in the reloc, eg. ELF USE_REL, src_mask will normally equal
- dst_mask to extract the addend from the section contents. If
- relocations do have an addend in the reloc, eg. ELF USE_RELA, this
- field should be zero. Non-zero values for ELF USE_RELA targets are
- bogus as in those cases the value in the dst_mask part of the
- section contents should be treated as garbage. */
- bfd_vma src_mask;
-
- /* dst_mask selects which parts of the instruction (or data) are
- replaced with a relocated value. */
- bfd_vma dst_mask;
-
- /* When some formats create PC relative instructions, they leave
- the value of the pc of the place being relocated in the offset
- slot of the instruction, so that a PC relative relocation can
- be made just by adding in an ordinary offset (e.g., sun3 a.out).
- Some formats leave the displacement part of an instruction
- empty (e.g., m88k bcs); this flag signals the fact. */
- bfd_boolean pcrel_offset;
-@};
-
-@end example
-@findex The HOWTO Macro
-@subsubsection @code{The HOWTO Macro}
-@strong{Description}@*
-The HOWTO define is horrible and will go away.
-@example
-#define HOWTO(C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \
- @{ (unsigned) C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC @}
-@end example
-
-@strong{Description}@*
-And will be replaced with the totally magic way. But for the
-moment, we are compatible, so do it this way.
-@example
-#define NEWHOWTO(FUNCTION, NAME, SIZE, REL, IN) \
- HOWTO (0, 0, SIZE, 0, REL, 0, complain_overflow_dont, FUNCTION, \
- NAME, FALSE, 0, 0, IN)
-
-@end example
-
-@strong{Description}@*
-This is used to fill in an empty howto entry in an array.
-@example
-#define EMPTY_HOWTO(C) \
- HOWTO ((C), 0, 0, 0, FALSE, 0, complain_overflow_dont, NULL, \
- NULL, FALSE, 0, 0, FALSE)
-
-@end example
-
-@strong{Description}@*
-Helper routine to turn a symbol into a relocation value.
-@example
-#define HOWTO_PREPARE(relocation, symbol) \
- @{ \
- if (symbol != NULL) \
- @{ \
- if (bfd_is_com_section (symbol->section)) \
- @{ \
- relocation = 0; \
- @} \
- else \
- @{ \
- relocation = symbol->value; \
- @} \
- @} \
- @}
-
-@end example
-
-@findex bfd_get_reloc_size
-@subsubsection @code{bfd_get_reloc_size}
-@strong{Synopsis}
-@example
-unsigned int bfd_get_reloc_size (reloc_howto_type *);
-@end example
-@strong{Description}@*
-For a reloc_howto_type that operates on a fixed number of bytes,
-this returns the number of bytes operated on.
-
-@findex arelent_chain
-@subsubsection @code{arelent_chain}
-@strong{Description}@*
-How relocs are tied together in an @code{asection}:
-@example
-typedef struct relent_chain
-@{
- arelent relent;
- struct relent_chain *next;
-@}
-arelent_chain;
-
-@end example
-
-@findex bfd_check_overflow
-@subsubsection @code{bfd_check_overflow}
-@strong{Synopsis}
-@example
-bfd_reloc_status_type bfd_check_overflow
- (enum complain_overflow how,
- unsigned int bitsize,
- unsigned int rightshift,
- unsigned int addrsize,
- bfd_vma relocation);
-@end example
-@strong{Description}@*
-Perform overflow checking on @var{relocation} which has
-@var{bitsize} significant bits and will be shifted right by
-@var{rightshift} bits, on a machine with addresses containing
-@var{addrsize} significant bits. The result is either of
-@code{bfd_reloc_ok} or @code{bfd_reloc_overflow}.
-
-@findex bfd_perform_relocation
-@subsubsection @code{bfd_perform_relocation}
-@strong{Synopsis}
-@example
-bfd_reloc_status_type bfd_perform_relocation
- (bfd *abfd,
- arelent *reloc_entry,
- void *data,
- asection *input_section,
- bfd *output_bfd,
- char **error_message);
-@end example
-@strong{Description}@*
-If @var{output_bfd} is supplied to this function, the
-generated image will be relocatable; the relocations are
-copied to the output file after they have been changed to
-reflect the new state of the world. There are two ways of
-reflecting the results of partial linkage in an output file:
-by modifying the output data in place, and by modifying the
-relocation record. Some native formats (e.g., basic a.out and
-basic coff) have no way of specifying an addend in the
-relocation type, so the addend has to go in the output data.
-This is no big deal since in these formats the output data
-slot will always be big enough for the addend. Complex reloc
-types with addends were invented to solve just this problem.
-The @var{error_message} argument is set to an error message if
-this return @code{bfd_reloc_dangerous}.
-
-@findex bfd_install_relocation
-@subsubsection @code{bfd_install_relocation}
-@strong{Synopsis}
-@example
-bfd_reloc_status_type bfd_install_relocation
- (bfd *abfd,
- arelent *reloc_entry,
- void *data, bfd_vma data_start,
- asection *input_section,
- char **error_message);
-@end example
-@strong{Description}@*
-This looks remarkably like @code{bfd_perform_relocation}, except it
-does not expect that the section contents have been filled in.
-I.e., it's suitable for use when creating, rather than applying
-a relocation.
-
-For now, this function should be considered reserved for the
-assembler.
-
-
-@node howto manager, , typedef arelent, Relocations
-@subsection The howto manager
-When an application wants to create a relocation, but doesn't
-know what the target machine might call it, it can find out by
-using this bit of code.
-
-@findex bfd_reloc_code_type
-@subsubsection @code{bfd_reloc_code_type}
-@strong{Description}@*
-The insides of a reloc code. The idea is that, eventually, there
-will be one enumerator for every type of relocation we ever do.
-Pass one of these values to @code{bfd_reloc_type_lookup}, and it'll
-return a howto pointer.
-
-This does mean that the application must determine the correct
-enumerator value; you can't get a howto pointer from a random set
-of attributes.
-
-Here are the possible values for @code{enum bfd_reloc_code_real}:
-
-@deffn {} BFD_RELOC_64
-@deffnx {} BFD_RELOC_32
-@deffnx {} BFD_RELOC_26
-@deffnx {} BFD_RELOC_24
-@deffnx {} BFD_RELOC_16
-@deffnx {} BFD_RELOC_14
-@deffnx {} BFD_RELOC_8
-Basic absolute relocations of N bits.
-@end deffn
-@deffn {} BFD_RELOC_64_PCREL
-@deffnx {} BFD_RELOC_32_PCREL
-@deffnx {} BFD_RELOC_24_PCREL
-@deffnx {} BFD_RELOC_16_PCREL
-@deffnx {} BFD_RELOC_12_PCREL
-@deffnx {} BFD_RELOC_8_PCREL
-PC-relative relocations. Sometimes these are relative to the address
-of the relocation itself; sometimes they are relative to the start of
-the section containing the relocation. It depends on the specific target.
-
-The 24-bit relocation is used in some Intel 960 configurations.
-@end deffn
-@deffn {} BFD_RELOC_32_SECREL
-Section relative relocations. Some targets need this for DWARF2.
-@end deffn
-@deffn {} BFD_RELOC_32_GOT_PCREL
-@deffnx {} BFD_RELOC_16_GOT_PCREL
-@deffnx {} BFD_RELOC_8_GOT_PCREL
-@deffnx {} BFD_RELOC_32_GOTOFF
-@deffnx {} BFD_RELOC_16_GOTOFF
-@deffnx {} BFD_RELOC_LO16_GOTOFF
-@deffnx {} BFD_RELOC_HI16_GOTOFF
-@deffnx {} BFD_RELOC_HI16_S_GOTOFF
-@deffnx {} BFD_RELOC_8_GOTOFF
-@deffnx {} BFD_RELOC_64_PLT_PCREL
-@deffnx {} BFD_RELOC_32_PLT_PCREL
-@deffnx {} BFD_RELOC_24_PLT_PCREL
-@deffnx {} BFD_RELOC_16_PLT_PCREL
-@deffnx {} BFD_RELOC_8_PLT_PCREL
-@deffnx {} BFD_RELOC_64_PLTOFF
-@deffnx {} BFD_RELOC_32_PLTOFF
-@deffnx {} BFD_RELOC_16_PLTOFF
-@deffnx {} BFD_RELOC_LO16_PLTOFF
-@deffnx {} BFD_RELOC_HI16_PLTOFF
-@deffnx {} BFD_RELOC_HI16_S_PLTOFF
-@deffnx {} BFD_RELOC_8_PLTOFF
-For ELF.
-@end deffn
-@deffn {} BFD_RELOC_68K_GLOB_DAT
-@deffnx {} BFD_RELOC_68K_JMP_SLOT
-@deffnx {} BFD_RELOC_68K_RELATIVE
-Relocations used by 68K ELF.
-@end deffn
-@deffn {} BFD_RELOC_32_BASEREL
-@deffnx {} BFD_RELOC_16_BASEREL
-@deffnx {} BFD_RELOC_LO16_BASEREL
-@deffnx {} BFD_RELOC_HI16_BASEREL
-@deffnx {} BFD_RELOC_HI16_S_BASEREL
-@deffnx {} BFD_RELOC_8_BASEREL
-@deffnx {} BFD_RELOC_RVA
-Linkage-table relative.
-@end deffn
-@deffn {} BFD_RELOC_8_FFnn
-Absolute 8-bit relocation, but used to form an address like 0xFFnn.
-@end deffn
-@deffn {} BFD_RELOC_32_PCREL_S2
-@deffnx {} BFD_RELOC_16_PCREL_S2
-@deffnx {} BFD_RELOC_23_PCREL_S2
-These PC-relative relocations are stored as word displacements --
-i.e., byte displacements shifted right two bits. The 30-bit word
-displacement (<<32_PCREL_S2>> -- 32 bits, shifted 2) is used on the
-SPARC. (SPARC tools generally refer to this as <<WDISP30>>.) The
-signed 16-bit displacement is used on the MIPS, and the 23-bit
-displacement is used on the Alpha.
-@end deffn
-@deffn {} BFD_RELOC_HI22
-@deffnx {} BFD_RELOC_LO10
-High 22 bits and low 10 bits of 32-bit value, placed into lower bits of
-the target word. These are used on the SPARC.
-@end deffn
-@deffn {} BFD_RELOC_GPREL16
-@deffnx {} BFD_RELOC_GPREL32
-For systems that allocate a Global Pointer register, these are
-displacements off that register. These relocation types are
-handled specially, because the value the register will have is
-decided relatively late.
-@end deffn
-@deffn {} BFD_RELOC_I960_CALLJ
-Reloc types used for i960/b.out.
-@end deffn
-@deffn {} BFD_RELOC_NONE
-@deffnx {} BFD_RELOC_SPARC_WDISP22
-@deffnx {} BFD_RELOC_SPARC22
-@deffnx {} BFD_RELOC_SPARC13
-@deffnx {} BFD_RELOC_SPARC_GOT10
-@deffnx {} BFD_RELOC_SPARC_GOT13
-@deffnx {} BFD_RELOC_SPARC_GOT22
-@deffnx {} BFD_RELOC_SPARC_PC10
-@deffnx {} BFD_RELOC_SPARC_PC22
-@deffnx {} BFD_RELOC_SPARC_WPLT30
-@deffnx {} BFD_RELOC_SPARC_COPY
-@deffnx {} BFD_RELOC_SPARC_GLOB_DAT
-@deffnx {} BFD_RELOC_SPARC_JMP_SLOT
-@deffnx {} BFD_RELOC_SPARC_RELATIVE
-@deffnx {} BFD_RELOC_SPARC_UA16
-@deffnx {} BFD_RELOC_SPARC_UA32
-@deffnx {} BFD_RELOC_SPARC_UA64
-SPARC ELF relocations. There is probably some overlap with other
-relocation types already defined.
-@end deffn
-@deffn {} BFD_RELOC_SPARC_BASE13
-@deffnx {} BFD_RELOC_SPARC_BASE22
-I think these are specific to SPARC a.out (e.g., Sun 4).
-@end deffn
-@deffn {} BFD_RELOC_SPARC_64
-@deffnx {} BFD_RELOC_SPARC_10
-@deffnx {} BFD_RELOC_SPARC_11
-@deffnx {} BFD_RELOC_SPARC_OLO10
-@deffnx {} BFD_RELOC_SPARC_HH22
-@deffnx {} BFD_RELOC_SPARC_HM10
-@deffnx {} BFD_RELOC_SPARC_LM22
-@deffnx {} BFD_RELOC_SPARC_PC_HH22
-@deffnx {} BFD_RELOC_SPARC_PC_HM10
-@deffnx {} BFD_RELOC_SPARC_PC_LM22
-@deffnx {} BFD_RELOC_SPARC_WDISP16
-@deffnx {} BFD_RELOC_SPARC_WDISP19
-@deffnx {} BFD_RELOC_SPARC_7
-@deffnx {} BFD_RELOC_SPARC_6
-@deffnx {} BFD_RELOC_SPARC_5
-@deffnx {} BFD_RELOC_SPARC_DISP64
-@deffnx {} BFD_RELOC_SPARC_PLT32
-@deffnx {} BFD_RELOC_SPARC_PLT64
-@deffnx {} BFD_RELOC_SPARC_HIX22
-@deffnx {} BFD_RELOC_SPARC_LOX10
-@deffnx {} BFD_RELOC_SPARC_H44
-@deffnx {} BFD_RELOC_SPARC_M44
-@deffnx {} BFD_RELOC_SPARC_L44
-@deffnx {} BFD_RELOC_SPARC_REGISTER
-SPARC64 relocations
-@end deffn
-@deffn {} BFD_RELOC_SPARC_REV32
-SPARC little endian relocation
-@end deffn
-@deffn {} BFD_RELOC_SPARC_TLS_GD_HI22
-@deffnx {} BFD_RELOC_SPARC_TLS_GD_LO10
-@deffnx {} BFD_RELOC_SPARC_TLS_GD_ADD
-@deffnx {} BFD_RELOC_SPARC_TLS_GD_CALL
-@deffnx {} BFD_RELOC_SPARC_TLS_LDM_HI22
-@deffnx {} BFD_RELOC_SPARC_TLS_LDM_LO10
-@deffnx {} BFD_RELOC_SPARC_TLS_LDM_ADD
-@deffnx {} BFD_RELOC_SPARC_TLS_LDM_CALL
-@deffnx {} BFD_RELOC_SPARC_TLS_LDO_HIX22
-@deffnx {} BFD_RELOC_SPARC_TLS_LDO_LOX10
-@deffnx {} BFD_RELOC_SPARC_TLS_LDO_ADD
-@deffnx {} BFD_RELOC_SPARC_TLS_IE_HI22
-@deffnx {} BFD_RELOC_SPARC_TLS_IE_LO10
-@deffnx {} BFD_RELOC_SPARC_TLS_IE_LD
-@deffnx {} BFD_RELOC_SPARC_TLS_IE_LDX
-@deffnx {} BFD_RELOC_SPARC_TLS_IE_ADD
-@deffnx {} BFD_RELOC_SPARC_TLS_LE_HIX22
-@deffnx {} BFD_RELOC_SPARC_TLS_LE_LOX10
-@deffnx {} BFD_RELOC_SPARC_TLS_DTPMOD32
-@deffnx {} BFD_RELOC_SPARC_TLS_DTPMOD64
-@deffnx {} BFD_RELOC_SPARC_TLS_DTPOFF32
-@deffnx {} BFD_RELOC_SPARC_TLS_DTPOFF64
-@deffnx {} BFD_RELOC_SPARC_TLS_TPOFF32
-@deffnx {} BFD_RELOC_SPARC_TLS_TPOFF64
-SPARC TLS relocations
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_GPDISP_HI16
-Alpha ECOFF and ELF relocations. Some of these treat the symbol or
-"addend" in some special way.
-For GPDISP_HI16 ("gpdisp") relocations, the symbol is ignored when
-writing; when reading, it will be the absolute section symbol. The
-addend is the displacement in bytes of the "lda" instruction from
-the "ldah" instruction (which is at the address of this reloc).
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_GPDISP_LO16
-For GPDISP_LO16 ("ignore") relocations, the symbol is handled as
-with GPDISP_HI16 relocs. The addend is ignored when writing the
-relocations out, and is filled in with the file's GP value on
-reading, for convenience.
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_GPDISP
-The ELF GPDISP relocation is exactly the same as the GPDISP_HI16
-relocation except that there is no accompanying GPDISP_LO16
-relocation.
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_LITERAL
-@deffnx {} BFD_RELOC_ALPHA_ELF_LITERAL
-@deffnx {} BFD_RELOC_ALPHA_LITUSE
-The Alpha LITERAL/LITUSE relocs are produced by a symbol reference;
-the assembler turns it into a LDQ instruction to load the address of
-the symbol, and then fills in a register in the real instruction.
-
-The LITERAL reloc, at the LDQ instruction, refers to the .lita
-section symbol. The addend is ignored when writing, but is filled
-in with the file's GP value on reading, for convenience, as with the
-GPDISP_LO16 reloc.
-
-The ELF_LITERAL reloc is somewhere between 16_GOTOFF and GPDISP_LO16.
-It should refer to the symbol to be referenced, as with 16_GOTOFF,
-but it generates output not based on the position within the .got
-section, but relative to the GP value chosen for the file during the
-final link stage.
-
-The LITUSE reloc, on the instruction using the loaded address, gives
-information to the linker that it might be able to use to optimize
-away some literal section references. The symbol is ignored (read
-as the absolute section symbol), and the "addend" indicates the type
-of instruction using the register:
-1 - "memory" fmt insn
-2 - byte-manipulation (byte offset reg)
-3 - jsr (target of branch)
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_HINT
-The HINT relocation indicates a value that should be filled into the
-"hint" field of a jmp/jsr/ret instruction, for possible branch-
-prediction logic which may be provided on some processors.
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_LINKAGE
-The LINKAGE relocation outputs a linkage pair in the object file,
-which is filled by the linker.
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_CODEADDR
-The CODEADDR relocation outputs a STO_CA in the object file,
-which is filled by the linker.
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_GPREL_HI16
-@deffnx {} BFD_RELOC_ALPHA_GPREL_LO16
-The GPREL_HI/LO relocations together form a 32-bit offset from the
-GP register.
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_BRSGP
-Like BFD_RELOC_23_PCREL_S2, except that the source and target must
-share a common GP, and the target address is adjusted for
-STO_ALPHA_STD_GPLOAD.
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_TLSGD
-@deffnx {} BFD_RELOC_ALPHA_TLSLDM
-@deffnx {} BFD_RELOC_ALPHA_DTPMOD64
-@deffnx {} BFD_RELOC_ALPHA_GOTDTPREL16
-@deffnx {} BFD_RELOC_ALPHA_DTPREL64
-@deffnx {} BFD_RELOC_ALPHA_DTPREL_HI16
-@deffnx {} BFD_RELOC_ALPHA_DTPREL_LO16
-@deffnx {} BFD_RELOC_ALPHA_DTPREL16
-@deffnx {} BFD_RELOC_ALPHA_GOTTPREL16
-@deffnx {} BFD_RELOC_ALPHA_TPREL64
-@deffnx {} BFD_RELOC_ALPHA_TPREL_HI16
-@deffnx {} BFD_RELOC_ALPHA_TPREL_LO16
-@deffnx {} BFD_RELOC_ALPHA_TPREL16
-Alpha thread-local storage relocations.
-@end deffn
-@deffn {} BFD_RELOC_MIPS_JMP
-Bits 27..2 of the relocation address shifted right 2 bits;
-simple reloc otherwise.
-@end deffn
-@deffn {} BFD_RELOC_MIPS16_JMP
-The MIPS16 jump instruction.
-@end deffn
-@deffn {} BFD_RELOC_MIPS16_GPREL
-MIPS16 GP relative reloc.
-@end deffn
-@deffn {} BFD_RELOC_HI16
-High 16 bits of 32-bit value; simple reloc.
-@end deffn
-@deffn {} BFD_RELOC_HI16_S
-High 16 bits of 32-bit value but the low 16 bits will be sign
-extended and added to form the final result. If the low 16
-bits form a negative number, we need to add one to the high value
-to compensate for the borrow when the low bits are added.
-@end deffn
-@deffn {} BFD_RELOC_LO16
-Low 16 bits.
-@end deffn
-@deffn {} BFD_RELOC_HI16_PCREL
-High 16 bits of 32-bit pc-relative value
-@end deffn
-@deffn {} BFD_RELOC_HI16_S_PCREL
-High 16 bits of 32-bit pc-relative value, adjusted
-@end deffn
-@deffn {} BFD_RELOC_LO16_PCREL
-Low 16 bits of pc-relative value
-@end deffn
-@deffn {} BFD_RELOC_MIPS16_HI16
-MIPS16 high 16 bits of 32-bit value.
-@end deffn
-@deffn {} BFD_RELOC_MIPS16_HI16_S
-MIPS16 high 16 bits of 32-bit value but the low 16 bits will be sign
-extended and added to form the final result. If the low 16
-bits form a negative number, we need to add one to the high value
-to compensate for the borrow when the low bits are added.
-@end deffn
-@deffn {} BFD_RELOC_MIPS16_LO16
-MIPS16 low 16 bits.
-@end deffn
-@deffn {} BFD_RELOC_MIPS_LITERAL
-Relocation against a MIPS literal section.
-@end deffn
-@deffn {} BFD_RELOC_MIPS_GOT16
-@deffnx {} BFD_RELOC_MIPS_CALL16
-@deffnx {} BFD_RELOC_MIPS_GOT_HI16
-@deffnx {} BFD_RELOC_MIPS_GOT_LO16
-@deffnx {} BFD_RELOC_MIPS_CALL_HI16
-@deffnx {} BFD_RELOC_MIPS_CALL_LO16
-@deffnx {} BFD_RELOC_MIPS_SUB
-@deffnx {} BFD_RELOC_MIPS_GOT_PAGE
-@deffnx {} BFD_RELOC_MIPS_GOT_OFST
-@deffnx {} BFD_RELOC_MIPS_GOT_DISP
-@deffnx {} BFD_RELOC_MIPS_SHIFT5
-@deffnx {} BFD_RELOC_MIPS_SHIFT6
-@deffnx {} BFD_RELOC_MIPS_INSERT_A
-@deffnx {} BFD_RELOC_MIPS_INSERT_B
-@deffnx {} BFD_RELOC_MIPS_DELETE
-@deffnx {} BFD_RELOC_MIPS_HIGHEST
-@deffnx {} BFD_RELOC_MIPS_HIGHER
-@deffnx {} BFD_RELOC_MIPS_SCN_DISP
-@deffnx {} BFD_RELOC_MIPS_REL16
-@deffnx {} BFD_RELOC_MIPS_RELGOT
-@deffnx {} BFD_RELOC_MIPS_JALR
-@deffnx {} BFD_RELOC_MIPS_TLS_DTPMOD32
-@deffnx {} BFD_RELOC_MIPS_TLS_DTPREL32
-@deffnx {} BFD_RELOC_MIPS_TLS_DTPMOD64
-@deffnx {} BFD_RELOC_MIPS_TLS_DTPREL64
-@deffnx {} BFD_RELOC_MIPS_TLS_GD
-@deffnx {} BFD_RELOC_MIPS_TLS_LDM
-@deffnx {} BFD_RELOC_MIPS_TLS_DTPREL_HI16
-@deffnx {} BFD_RELOC_MIPS_TLS_DTPREL_LO16
-@deffnx {} BFD_RELOC_MIPS_TLS_GOTTPREL
-@deffnx {} BFD_RELOC_MIPS_TLS_TPREL32
-@deffnx {} BFD_RELOC_MIPS_TLS_TPREL64
-@deffnx {} BFD_RELOC_MIPS_TLS_TPREL_HI16
-@deffnx {} BFD_RELOC_MIPS_TLS_TPREL_LO16
-MIPS ELF relocations.
-@end deffn
-@deffn {} BFD_RELOC_MIPS_COPY
-@deffnx {} BFD_RELOC_MIPS_JUMP_SLOT
-MIPS ELF relocations (VxWorks extensions).
-@end deffn
-@deffn {} BFD_RELOC_FRV_LABEL16
-@deffnx {} BFD_RELOC_FRV_LABEL24
-@deffnx {} BFD_RELOC_FRV_LO16
-@deffnx {} BFD_RELOC_FRV_HI16
-@deffnx {} BFD_RELOC_FRV_GPREL12
-@deffnx {} BFD_RELOC_FRV_GPRELU12
-@deffnx {} BFD_RELOC_FRV_GPREL32
-@deffnx {} BFD_RELOC_FRV_GPRELHI
-@deffnx {} BFD_RELOC_FRV_GPRELLO
-@deffnx {} BFD_RELOC_FRV_GOT12
-@deffnx {} BFD_RELOC_FRV_GOTHI
-@deffnx {} BFD_RELOC_FRV_GOTLO
-@deffnx {} BFD_RELOC_FRV_FUNCDESC
-@deffnx {} BFD_RELOC_FRV_FUNCDESC_GOT12
-@deffnx {} BFD_RELOC_FRV_FUNCDESC_GOTHI
-@deffnx {} BFD_RELOC_FRV_FUNCDESC_GOTLO
-@deffnx {} BFD_RELOC_FRV_FUNCDESC_VALUE
-@deffnx {} BFD_RELOC_FRV_FUNCDESC_GOTOFF12
-@deffnx {} BFD_RELOC_FRV_FUNCDESC_GOTOFFHI
-@deffnx {} BFD_RELOC_FRV_FUNCDESC_GOTOFFLO
-@deffnx {} BFD_RELOC_FRV_GOTOFF12
-@deffnx {} BFD_RELOC_FRV_GOTOFFHI
-@deffnx {} BFD_RELOC_FRV_GOTOFFLO
-@deffnx {} BFD_RELOC_FRV_GETTLSOFF
-@deffnx {} BFD_RELOC_FRV_TLSDESC_VALUE
-@deffnx {} BFD_RELOC_FRV_GOTTLSDESC12
-@deffnx {} BFD_RELOC_FRV_GOTTLSDESCHI
-@deffnx {} BFD_RELOC_FRV_GOTTLSDESCLO
-@deffnx {} BFD_RELOC_FRV_TLSMOFF12
-@deffnx {} BFD_RELOC_FRV_TLSMOFFHI
-@deffnx {} BFD_RELOC_FRV_TLSMOFFLO
-@deffnx {} BFD_RELOC_FRV_GOTTLSOFF12
-@deffnx {} BFD_RELOC_FRV_GOTTLSOFFHI
-@deffnx {} BFD_RELOC_FRV_GOTTLSOFFLO
-@deffnx {} BFD_RELOC_FRV_TLSOFF
-@deffnx {} BFD_RELOC_FRV_TLSDESC_RELAX
-@deffnx {} BFD_RELOC_FRV_GETTLSOFF_RELAX
-@deffnx {} BFD_RELOC_FRV_TLSOFF_RELAX
-@deffnx {} BFD_RELOC_FRV_TLSMOFF
-Fujitsu Frv Relocations.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_GOTOFF24
-This is a 24bit GOT-relative reloc for the mn10300.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_GOT32
-This is a 32bit GOT-relative reloc for the mn10300, offset by two bytes
-in the instruction.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_GOT24
-This is a 24bit GOT-relative reloc for the mn10300, offset by two bytes
-in the instruction.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_GOT16
-This is a 16bit GOT-relative reloc for the mn10300, offset by two bytes
-in the instruction.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_COPY
-Copy symbol at runtime.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_GLOB_DAT
-Create GOT entry.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_JMP_SLOT
-Create PLT entry.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_RELATIVE
-Adjust by program base.
-@end deffn
-@deffn {} BFD_RELOC_386_GOT32
-@deffnx {} BFD_RELOC_386_PLT32
-@deffnx {} BFD_RELOC_386_COPY
-@deffnx {} BFD_RELOC_386_GLOB_DAT
-@deffnx {} BFD_RELOC_386_JUMP_SLOT
-@deffnx {} BFD_RELOC_386_RELATIVE
-@deffnx {} BFD_RELOC_386_GOTOFF
-@deffnx {} BFD_RELOC_386_GOTPC
-@deffnx {} BFD_RELOC_386_TLS_TPOFF
-@deffnx {} BFD_RELOC_386_TLS_IE
-@deffnx {} BFD_RELOC_386_TLS_GOTIE
-@deffnx {} BFD_RELOC_386_TLS_LE
-@deffnx {} BFD_RELOC_386_TLS_GD
-@deffnx {} BFD_RELOC_386_TLS_LDM
-@deffnx {} BFD_RELOC_386_TLS_LDO_32
-@deffnx {} BFD_RELOC_386_TLS_IE_32
-@deffnx {} BFD_RELOC_386_TLS_LE_32
-@deffnx {} BFD_RELOC_386_TLS_DTPMOD32
-@deffnx {} BFD_RELOC_386_TLS_DTPOFF32
-@deffnx {} BFD_RELOC_386_TLS_TPOFF32
-@deffnx {} BFD_RELOC_386_TLS_GOTDESC
-@deffnx {} BFD_RELOC_386_TLS_DESC_CALL
-@deffnx {} BFD_RELOC_386_TLS_DESC
-i386/elf relocations
-@end deffn
-@deffn {} BFD_RELOC_X86_64_GOT32
-@deffnx {} BFD_RELOC_X86_64_PLT32
-@deffnx {} BFD_RELOC_X86_64_COPY
-@deffnx {} BFD_RELOC_X86_64_GLOB_DAT
-@deffnx {} BFD_RELOC_X86_64_JUMP_SLOT
-@deffnx {} BFD_RELOC_X86_64_RELATIVE
-@deffnx {} BFD_RELOC_X86_64_GOTPCREL
-@deffnx {} BFD_RELOC_X86_64_32S
-@deffnx {} BFD_RELOC_X86_64_DTPMOD64
-@deffnx {} BFD_RELOC_X86_64_DTPOFF64
-@deffnx {} BFD_RELOC_X86_64_TPOFF64
-@deffnx {} BFD_RELOC_X86_64_TLSGD
-@deffnx {} BFD_RELOC_X86_64_TLSLD
-@deffnx {} BFD_RELOC_X86_64_DTPOFF32
-@deffnx {} BFD_RELOC_X86_64_GOTTPOFF
-@deffnx {} BFD_RELOC_X86_64_TPOFF32
-@deffnx {} BFD_RELOC_X86_64_GOTOFF64
-@deffnx {} BFD_RELOC_X86_64_GOTPC32
-@deffnx {} BFD_RELOC_X86_64_GOT64
-@deffnx {} BFD_RELOC_X86_64_GOTPCREL64
-@deffnx {} BFD_RELOC_X86_64_GOTPC64
-@deffnx {} BFD_RELOC_X86_64_GOTPLT64
-@deffnx {} BFD_RELOC_X86_64_PLTOFF64
-@deffnx {} BFD_RELOC_X86_64_GOTPC32_TLSDESC
-@deffnx {} BFD_RELOC_X86_64_TLSDESC_CALL
-@deffnx {} BFD_RELOC_X86_64_TLSDESC
-x86-64/elf relocations
-@end deffn
-@deffn {} BFD_RELOC_NS32K_IMM_8
-@deffnx {} BFD_RELOC_NS32K_IMM_16
-@deffnx {} BFD_RELOC_NS32K_IMM_32
-@deffnx {} BFD_RELOC_NS32K_IMM_8_PCREL
-@deffnx {} BFD_RELOC_NS32K_IMM_16_PCREL
-@deffnx {} BFD_RELOC_NS32K_IMM_32_PCREL
-@deffnx {} BFD_RELOC_NS32K_DISP_8
-@deffnx {} BFD_RELOC_NS32K_DISP_16
-@deffnx {} BFD_RELOC_NS32K_DISP_32
-@deffnx {} BFD_RELOC_NS32K_DISP_8_PCREL
-@deffnx {} BFD_RELOC_NS32K_DISP_16_PCREL
-@deffnx {} BFD_RELOC_NS32K_DISP_32_PCREL
-ns32k relocations
-@end deffn
-@deffn {} BFD_RELOC_PDP11_DISP_8_PCREL
-@deffnx {} BFD_RELOC_PDP11_DISP_6_PCREL
-PDP11 relocations
-@end deffn
-@deffn {} BFD_RELOC_PJ_CODE_HI16
-@deffnx {} BFD_RELOC_PJ_CODE_LO16
-@deffnx {} BFD_RELOC_PJ_CODE_DIR16
-@deffnx {} BFD_RELOC_PJ_CODE_DIR32
-@deffnx {} BFD_RELOC_PJ_CODE_REL16
-@deffnx {} BFD_RELOC_PJ_CODE_REL32
-Picojava relocs. Not all of these appear in object files.
-@end deffn
-@deffn {} BFD_RELOC_PPC_B26
-@deffnx {} BFD_RELOC_PPC_BA26
-@deffnx {} BFD_RELOC_PPC_TOC16
-@deffnx {} BFD_RELOC_PPC_B16
-@deffnx {} BFD_RELOC_PPC_B16_BRTAKEN
-@deffnx {} BFD_RELOC_PPC_B16_BRNTAKEN
-@deffnx {} BFD_RELOC_PPC_BA16
-@deffnx {} BFD_RELOC_PPC_BA16_BRTAKEN
-@deffnx {} BFD_RELOC_PPC_BA16_BRNTAKEN
-@deffnx {} BFD_RELOC_PPC_COPY
-@deffnx {} BFD_RELOC_PPC_GLOB_DAT
-@deffnx {} BFD_RELOC_PPC_JMP_SLOT
-@deffnx {} BFD_RELOC_PPC_RELATIVE
-@deffnx {} BFD_RELOC_PPC_LOCAL24PC
-@deffnx {} BFD_RELOC_PPC_EMB_NADDR32
-@deffnx {} BFD_RELOC_PPC_EMB_NADDR16
-@deffnx {} BFD_RELOC_PPC_EMB_NADDR16_LO
-@deffnx {} BFD_RELOC_PPC_EMB_NADDR16_HI
-@deffnx {} BFD_RELOC_PPC_EMB_NADDR16_HA
-@deffnx {} BFD_RELOC_PPC_EMB_SDAI16
-@deffnx {} BFD_RELOC_PPC_EMB_SDA2I16
-@deffnx {} BFD_RELOC_PPC_EMB_SDA2REL
-@deffnx {} BFD_RELOC_PPC_EMB_SDA21
-@deffnx {} BFD_RELOC_PPC_EMB_MRKREF
-@deffnx {} BFD_RELOC_PPC_EMB_RELSEC16
-@deffnx {} BFD_RELOC_PPC_EMB_RELST_LO
-@deffnx {} BFD_RELOC_PPC_EMB_RELST_HI
-@deffnx {} BFD_RELOC_PPC_EMB_RELST_HA
-@deffnx {} BFD_RELOC_PPC_EMB_BIT_FLD
-@deffnx {} BFD_RELOC_PPC_EMB_RELSDA
-@deffnx {} BFD_RELOC_PPC64_HIGHER
-@deffnx {} BFD_RELOC_PPC64_HIGHER_S
-@deffnx {} BFD_RELOC_PPC64_HIGHEST
-@deffnx {} BFD_RELOC_PPC64_HIGHEST_S
-@deffnx {} BFD_RELOC_PPC64_TOC16_LO
-@deffnx {} BFD_RELOC_PPC64_TOC16_HI
-@deffnx {} BFD_RELOC_PPC64_TOC16_HA
-@deffnx {} BFD_RELOC_PPC64_TOC
-@deffnx {} BFD_RELOC_PPC64_PLTGOT16
-@deffnx {} BFD_RELOC_PPC64_PLTGOT16_LO
-@deffnx {} BFD_RELOC_PPC64_PLTGOT16_HI
-@deffnx {} BFD_RELOC_PPC64_PLTGOT16_HA
-@deffnx {} BFD_RELOC_PPC64_ADDR16_DS
-@deffnx {} BFD_RELOC_PPC64_ADDR16_LO_DS
-@deffnx {} BFD_RELOC_PPC64_GOT16_DS
-@deffnx {} BFD_RELOC_PPC64_GOT16_LO_DS
-@deffnx {} BFD_RELOC_PPC64_PLT16_LO_DS
-@deffnx {} BFD_RELOC_PPC64_SECTOFF_DS
-@deffnx {} BFD_RELOC_PPC64_SECTOFF_LO_DS
-@deffnx {} BFD_RELOC_PPC64_TOC16_DS
-@deffnx {} BFD_RELOC_PPC64_TOC16_LO_DS
-@deffnx {} BFD_RELOC_PPC64_PLTGOT16_DS
-@deffnx {} BFD_RELOC_PPC64_PLTGOT16_LO_DS
-Power(rs6000) and PowerPC relocations.
-@end deffn
-@deffn {} BFD_RELOC_PPC_TLS
-@deffnx {} BFD_RELOC_PPC_DTPMOD
-@deffnx {} BFD_RELOC_PPC_TPREL16
-@deffnx {} BFD_RELOC_PPC_TPREL16_LO
-@deffnx {} BFD_RELOC_PPC_TPREL16_HI
-@deffnx {} BFD_RELOC_PPC_TPREL16_HA
-@deffnx {} BFD_RELOC_PPC_TPREL
-@deffnx {} BFD_RELOC_PPC_DTPREL16
-@deffnx {} BFD_RELOC_PPC_DTPREL16_LO
-@deffnx {} BFD_RELOC_PPC_DTPREL16_HI
-@deffnx {} BFD_RELOC_PPC_DTPREL16_HA
-@deffnx {} BFD_RELOC_PPC_DTPREL
-@deffnx {} BFD_RELOC_PPC_GOT_TLSGD16
-@deffnx {} BFD_RELOC_PPC_GOT_TLSGD16_LO
-@deffnx {} BFD_RELOC_PPC_GOT_TLSGD16_HI
-@deffnx {} BFD_RELOC_PPC_GOT_TLSGD16_HA
-@deffnx {} BFD_RELOC_PPC_GOT_TLSLD16
-@deffnx {} BFD_RELOC_PPC_GOT_TLSLD16_LO
-@deffnx {} BFD_RELOC_PPC_GOT_TLSLD16_HI
-@deffnx {} BFD_RELOC_PPC_GOT_TLSLD16_HA
-@deffnx {} BFD_RELOC_PPC_GOT_TPREL16
-@deffnx {} BFD_RELOC_PPC_GOT_TPREL16_LO
-@deffnx {} BFD_RELOC_PPC_GOT_TPREL16_HI
-@deffnx {} BFD_RELOC_PPC_GOT_TPREL16_HA
-@deffnx {} BFD_RELOC_PPC_GOT_DTPREL16
-@deffnx {} BFD_RELOC_PPC_GOT_DTPREL16_LO
-@deffnx {} BFD_RELOC_PPC_GOT_DTPREL16_HI
-@deffnx {} BFD_RELOC_PPC_GOT_DTPREL16_HA
-@deffnx {} BFD_RELOC_PPC64_TPREL16_DS
-@deffnx {} BFD_RELOC_PPC64_TPREL16_LO_DS
-@deffnx {} BFD_RELOC_PPC64_TPREL16_HIGHER
-@deffnx {} BFD_RELOC_PPC64_TPREL16_HIGHERA
-@deffnx {} BFD_RELOC_PPC64_TPREL16_HIGHEST
-@deffnx {} BFD_RELOC_PPC64_TPREL16_HIGHESTA
-@deffnx {} BFD_RELOC_PPC64_DTPREL16_DS
-@deffnx {} BFD_RELOC_PPC64_DTPREL16_LO_DS
-@deffnx {} BFD_RELOC_PPC64_DTPREL16_HIGHER
-@deffnx {} BFD_RELOC_PPC64_DTPREL16_HIGHERA
-@deffnx {} BFD_RELOC_PPC64_DTPREL16_HIGHEST
-@deffnx {} BFD_RELOC_PPC64_DTPREL16_HIGHESTA
-PowerPC and PowerPC64 thread-local storage relocations.
-@end deffn
-@deffn {} BFD_RELOC_I370_D12
-IBM 370/390 relocations
-@end deffn
-@deffn {} BFD_RELOC_CTOR
-The type of reloc used to build a constructor table - at the moment
-probably a 32 bit wide absolute relocation, but the target can choose.
-It generally does map to one of the other relocation types.
-@end deffn
-@deffn {} BFD_RELOC_ARM_PCREL_BRANCH
-ARM 26 bit pc-relative branch. The lowest two bits must be zero and are
-not stored in the instruction.
-@end deffn
-@deffn {} BFD_RELOC_ARM_PCREL_BLX
-ARM 26 bit pc-relative branch. The lowest bit must be zero and is
-not stored in the instruction. The 2nd lowest bit comes from a 1 bit
-field in the instruction.
-@end deffn
-@deffn {} BFD_RELOC_THUMB_PCREL_BLX
-Thumb 22 bit pc-relative branch. The lowest bit must be zero and is
-not stored in the instruction. The 2nd lowest bit comes from a 1 bit
-field in the instruction.
-@end deffn
-@deffn {} BFD_RELOC_ARM_PCREL_CALL
-ARM 26-bit pc-relative branch for an unconditional BL or BLX instruction.
-@end deffn
-@deffn {} BFD_RELOC_ARM_PCREL_JUMP
-ARM 26-bit pc-relative branch for B or conditional BL instruction.
-@end deffn
-@deffn {} BFD_RELOC_THUMB_PCREL_BRANCH7
-@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH9
-@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH12
-@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH20
-@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH23
-@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH25
-Thumb 7-, 9-, 12-, 20-, 23-, and 25-bit pc-relative branches.
-The lowest bit must be zero and is not stored in the instruction.
-Note that the corresponding ELF R_ARM_THM_JUMPnn constant has an
-"nn" one smaller in all cases. Note further that BRANCH23
-corresponds to R_ARM_THM_CALL.
-@end deffn
-@deffn {} BFD_RELOC_ARM_OFFSET_IMM
-12-bit immediate offset, used in ARM-format ldr and str instructions.
-@end deffn
-@deffn {} BFD_RELOC_ARM_THUMB_OFFSET
-5-bit immediate offset, used in Thumb-format ldr and str instructions.
-@end deffn
-@deffn {} BFD_RELOC_ARM_TARGET1
-Pc-relative or absolute relocation depending on target. Used for
-entries in .init_array sections.
-@end deffn
-@deffn {} BFD_RELOC_ARM_ROSEGREL32
-Read-only segment base relative address.
-@end deffn
-@deffn {} BFD_RELOC_ARM_SBREL32
-Data segment base relative address.
-@end deffn
-@deffn {} BFD_RELOC_ARM_TARGET2
-This reloc is used for references to RTTI data from exception handling
-tables. The actual definition depends on the target. It may be a
-pc-relative or some form of GOT-indirect relocation.
-@end deffn
-@deffn {} BFD_RELOC_ARM_PREL31
-31-bit PC relative address.
-@end deffn
-@deffn {} BFD_RELOC_ARM_JUMP_SLOT
-@deffnx {} BFD_RELOC_ARM_GLOB_DAT
-@deffnx {} BFD_RELOC_ARM_GOT32
-@deffnx {} BFD_RELOC_ARM_PLT32
-@deffnx {} BFD_RELOC_ARM_RELATIVE
-@deffnx {} BFD_RELOC_ARM_GOTOFF
-@deffnx {} BFD_RELOC_ARM_GOTPC
-Relocations for setting up GOTs and PLTs for shared libraries.
-@end deffn
-@deffn {} BFD_RELOC_ARM_TLS_GD32
-@deffnx {} BFD_RELOC_ARM_TLS_LDO32
-@deffnx {} BFD_RELOC_ARM_TLS_LDM32
-@deffnx {} BFD_RELOC_ARM_TLS_DTPOFF32
-@deffnx {} BFD_RELOC_ARM_TLS_DTPMOD32
-@deffnx {} BFD_RELOC_ARM_TLS_TPOFF32
-@deffnx {} BFD_RELOC_ARM_TLS_IE32
-@deffnx {} BFD_RELOC_ARM_TLS_LE32
-ARM thread-local storage relocations.
-@end deffn
-@deffn {} BFD_RELOC_ARM_IMMEDIATE
-@deffnx {} BFD_RELOC_ARM_ADRL_IMMEDIATE
-@deffnx {} BFD_RELOC_ARM_T32_IMMEDIATE
-@deffnx {} BFD_RELOC_ARM_T32_IMM12
-@deffnx {} BFD_RELOC_ARM_T32_ADD_PC12
-@deffnx {} BFD_RELOC_ARM_SHIFT_IMM
-@deffnx {} BFD_RELOC_ARM_SMC
-@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_T32_CP_OFF_IMM
-@deffnx {} BFD_RELOC_ARM_T32_CP_OFF_IMM_S2
-@deffnx {} BFD_RELOC_ARM_ADR_IMM
-@deffnx {} BFD_RELOC_ARM_LDR_IMM
-@deffnx {} BFD_RELOC_ARM_LITERAL
-@deffnx {} BFD_RELOC_ARM_IN_POOL
-@deffnx {} BFD_RELOC_ARM_OFFSET_IMM8
-@deffnx {} BFD_RELOC_ARM_T32_OFFSET_U8
-@deffnx {} BFD_RELOC_ARM_T32_OFFSET_IMM
-@deffnx {} BFD_RELOC_ARM_HWLITERAL
-@deffnx {} BFD_RELOC_ARM_THUMB_ADD
-@deffnx {} BFD_RELOC_ARM_THUMB_IMM
-@deffnx {} BFD_RELOC_ARM_THUMB_SHIFT
-These relocs are only used within the ARM assembler. They are not
-(at present) written to any object files.
-@end deffn
-@deffn {} BFD_RELOC_SH_PCDISP8BY2
-@deffnx {} BFD_RELOC_SH_PCDISP12BY2
-@deffnx {} BFD_RELOC_SH_IMM3
-@deffnx {} BFD_RELOC_SH_IMM3U
-@deffnx {} BFD_RELOC_SH_DISP12
-@deffnx {} BFD_RELOC_SH_DISP12BY2
-@deffnx {} BFD_RELOC_SH_DISP12BY4
-@deffnx {} BFD_RELOC_SH_DISP12BY8
-@deffnx {} BFD_RELOC_SH_DISP20
-@deffnx {} BFD_RELOC_SH_DISP20BY8
-@deffnx {} BFD_RELOC_SH_IMM4
-@deffnx {} BFD_RELOC_SH_IMM4BY2
-@deffnx {} BFD_RELOC_SH_IMM4BY4
-@deffnx {} BFD_RELOC_SH_IMM8
-@deffnx {} BFD_RELOC_SH_IMM8BY2
-@deffnx {} BFD_RELOC_SH_IMM8BY4
-@deffnx {} BFD_RELOC_SH_PCRELIMM8BY2
-@deffnx {} BFD_RELOC_SH_PCRELIMM8BY4
-@deffnx {} BFD_RELOC_SH_SWITCH16
-@deffnx {} BFD_RELOC_SH_SWITCH32
-@deffnx {} BFD_RELOC_SH_USES
-@deffnx {} BFD_RELOC_SH_COUNT
-@deffnx {} BFD_RELOC_SH_ALIGN
-@deffnx {} BFD_RELOC_SH_CODE
-@deffnx {} BFD_RELOC_SH_DATA
-@deffnx {} BFD_RELOC_SH_LABEL
-@deffnx {} BFD_RELOC_SH_LOOP_START
-@deffnx {} BFD_RELOC_SH_LOOP_END
-@deffnx {} BFD_RELOC_SH_COPY
-@deffnx {} BFD_RELOC_SH_GLOB_DAT
-@deffnx {} BFD_RELOC_SH_JMP_SLOT
-@deffnx {} BFD_RELOC_SH_RELATIVE
-@deffnx {} BFD_RELOC_SH_GOTPC
-@deffnx {} BFD_RELOC_SH_GOT_LOW16
-@deffnx {} BFD_RELOC_SH_GOT_MEDLOW16
-@deffnx {} BFD_RELOC_SH_GOT_MEDHI16
-@deffnx {} BFD_RELOC_SH_GOT_HI16
-@deffnx {} BFD_RELOC_SH_GOTPLT_LOW16
-@deffnx {} BFD_RELOC_SH_GOTPLT_MEDLOW16
-@deffnx {} BFD_RELOC_SH_GOTPLT_MEDHI16
-@deffnx {} BFD_RELOC_SH_GOTPLT_HI16
-@deffnx {} BFD_RELOC_SH_PLT_LOW16
-@deffnx {} BFD_RELOC_SH_PLT_MEDLOW16
-@deffnx {} BFD_RELOC_SH_PLT_MEDHI16
-@deffnx {} BFD_RELOC_SH_PLT_HI16
-@deffnx {} BFD_RELOC_SH_GOTOFF_LOW16
-@deffnx {} BFD_RELOC_SH_GOTOFF_MEDLOW16
-@deffnx {} BFD_RELOC_SH_GOTOFF_MEDHI16
-@deffnx {} BFD_RELOC_SH_GOTOFF_HI16
-@deffnx {} BFD_RELOC_SH_GOTPC_LOW16
-@deffnx {} BFD_RELOC_SH_GOTPC_MEDLOW16
-@deffnx {} BFD_RELOC_SH_GOTPC_MEDHI16
-@deffnx {} BFD_RELOC_SH_GOTPC_HI16
-@deffnx {} BFD_RELOC_SH_COPY64
-@deffnx {} BFD_RELOC_SH_GLOB_DAT64
-@deffnx {} BFD_RELOC_SH_JMP_SLOT64
-@deffnx {} BFD_RELOC_SH_RELATIVE64
-@deffnx {} BFD_RELOC_SH_GOT10BY4
-@deffnx {} BFD_RELOC_SH_GOT10BY8
-@deffnx {} BFD_RELOC_SH_GOTPLT10BY4
-@deffnx {} BFD_RELOC_SH_GOTPLT10BY8
-@deffnx {} BFD_RELOC_SH_GOTPLT32
-@deffnx {} BFD_RELOC_SH_SHMEDIA_CODE
-@deffnx {} BFD_RELOC_SH_IMMU5
-@deffnx {} BFD_RELOC_SH_IMMS6
-@deffnx {} BFD_RELOC_SH_IMMS6BY32
-@deffnx {} BFD_RELOC_SH_IMMU6
-@deffnx {} BFD_RELOC_SH_IMMS10
-@deffnx {} BFD_RELOC_SH_IMMS10BY2
-@deffnx {} BFD_RELOC_SH_IMMS10BY4
-@deffnx {} BFD_RELOC_SH_IMMS10BY8
-@deffnx {} BFD_RELOC_SH_IMMS16
-@deffnx {} BFD_RELOC_SH_IMMU16
-@deffnx {} BFD_RELOC_SH_IMM_LOW16
-@deffnx {} BFD_RELOC_SH_IMM_LOW16_PCREL
-@deffnx {} BFD_RELOC_SH_IMM_MEDLOW16
-@deffnx {} BFD_RELOC_SH_IMM_MEDLOW16_PCREL
-@deffnx {} BFD_RELOC_SH_IMM_MEDHI16
-@deffnx {} BFD_RELOC_SH_IMM_MEDHI16_PCREL
-@deffnx {} BFD_RELOC_SH_IMM_HI16
-@deffnx {} BFD_RELOC_SH_IMM_HI16_PCREL
-@deffnx {} BFD_RELOC_SH_PT_16
-@deffnx {} BFD_RELOC_SH_TLS_GD_32
-@deffnx {} BFD_RELOC_SH_TLS_LD_32
-@deffnx {} BFD_RELOC_SH_TLS_LDO_32
-@deffnx {} BFD_RELOC_SH_TLS_IE_32
-@deffnx {} BFD_RELOC_SH_TLS_LE_32
-@deffnx {} BFD_RELOC_SH_TLS_DTPMOD32
-@deffnx {} BFD_RELOC_SH_TLS_DTPOFF32
-@deffnx {} BFD_RELOC_SH_TLS_TPOFF32
-Renesas / SuperH SH relocs. Not all of these appear in object files.
-@end deffn
-@deffn {} BFD_RELOC_ARC_B22_PCREL
-ARC Cores relocs.
-ARC 22 bit pc-relative branch. The lowest two bits must be zero and are
-not stored in the instruction. The high 20 bits are installed in bits 26
-through 7 of the instruction.
-@end deffn
-@deffn {} BFD_RELOC_ARC_B26
-ARC 26 bit absolute branch. The lowest two bits must be zero and are not
-stored in the instruction. The high 24 bits are installed in bits 23
-through 0.
-@end deffn
-@deffn {} BFD_RELOC_BFIN_16_IMM
-ADI Blackfin 16 bit immediate absolute reloc.
-@end deffn
-@deffn {} BFD_RELOC_BFIN_16_HIGH
-ADI Blackfin 16 bit immediate absolute reloc higher 16 bits.
-@end deffn
-@deffn {} BFD_RELOC_BFIN_4_PCREL
-ADI Blackfin 'a' part of LSETUP.
-@end deffn
-@deffn {} BFD_RELOC_BFIN_5_PCREL
-ADI Blackfin.
-@end deffn
-@deffn {} BFD_RELOC_BFIN_16_LOW
-ADI Blackfin 16 bit immediate absolute reloc lower 16 bits.
-@end deffn
-@deffn {} BFD_RELOC_BFIN_10_PCREL
-ADI Blackfin.
-@end deffn
-@deffn {} BFD_RELOC_BFIN_11_PCREL
-ADI Blackfin 'b' part of LSETUP.
-@end deffn
-@deffn {} BFD_RELOC_BFIN_12_PCREL_JUMP
-ADI Blackfin.
-@end deffn
-@deffn {} BFD_RELOC_BFIN_12_PCREL_JUMP_S
-ADI Blackfin Short jump, pcrel.
-@end deffn
-@deffn {} BFD_RELOC_BFIN_24_PCREL_CALL_X
-ADI Blackfin Call.x not implemented.
-@end deffn
-@deffn {} BFD_RELOC_BFIN_24_PCREL_JUMP_L
-ADI Blackfin Long Jump pcrel.
-@end deffn
-@deffn {} BFD_RELOC_BFIN_GOT17M4
-@deffnx {} BFD_RELOC_BFIN_GOTHI
-@deffnx {} BFD_RELOC_BFIN_GOTLO
-@deffnx {} BFD_RELOC_BFIN_FUNCDESC
-@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOT17M4
-@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOTHI
-@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOTLO
-@deffnx {} BFD_RELOC_BFIN_FUNCDESC_VALUE
-@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOTOFF17M4
-@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOTOFFHI
-@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOTOFFLO
-@deffnx {} BFD_RELOC_BFIN_GOTOFF17M4
-@deffnx {} BFD_RELOC_BFIN_GOTOFFHI
-@deffnx {} BFD_RELOC_BFIN_GOTOFFLO
-ADI Blackfin FD-PIC relocations.
-@end deffn
-@deffn {} BFD_RELOC_BFIN_GOT
-ADI Blackfin GOT relocation.
-@end deffn
-@deffn {} BFD_RELOC_BFIN_PLTPC
-ADI Blackfin PLTPC relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_PUSH
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_CONST
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_ADD
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_SUB
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_MULT
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_DIV
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_MOD
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_LSHIFT
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_RSHIFT
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_AND
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_OR
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_XOR
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_LAND
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_LOR
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_LEN
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_NEG
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_COMP
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_PAGE
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_HWPAGE
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_ADDR
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_RELOC_D10V_10_PCREL_R
-Mitsubishi D10V relocs.
-This is a 10-bit reloc with the right 2 bits
-assumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_D10V_10_PCREL_L
-Mitsubishi D10V relocs.
-This is a 10-bit reloc with the right 2 bits
-assumed to be 0. This is the same as the previous reloc
-except it is in the left container, i.e.,
-shifted left 15 bits.
-@end deffn
-@deffn {} BFD_RELOC_D10V_18
-This is an 18-bit reloc with the right 2 bits
-assumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_D10V_18_PCREL
-This is an 18-bit reloc with the right 2 bits
-assumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_D30V_6
-Mitsubishi D30V relocs.
-This is a 6-bit absolute reloc.
-@end deffn
-@deffn {} BFD_RELOC_D30V_9_PCREL
-This is a 6-bit pc-relative reloc with
-the right 3 bits assumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_D30V_9_PCREL_R
-This is a 6-bit pc-relative reloc with
-the right 3 bits assumed to be 0. Same
-as the previous reloc but on the right side
-of the container.
-@end deffn
-@deffn {} BFD_RELOC_D30V_15
-This is a 12-bit absolute reloc with the
-right 3 bitsassumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_D30V_15_PCREL
-This is a 12-bit pc-relative reloc with
-the right 3 bits assumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_D30V_15_PCREL_R
-This is a 12-bit pc-relative reloc with
-the right 3 bits assumed to be 0. Same
-as the previous reloc but on the right side
-of the container.
-@end deffn
-@deffn {} BFD_RELOC_D30V_21
-This is an 18-bit absolute reloc with
-the right 3 bits assumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_D30V_21_PCREL
-This is an 18-bit pc-relative reloc with
-the right 3 bits assumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_D30V_21_PCREL_R
-This is an 18-bit pc-relative reloc with
-the right 3 bits assumed to be 0. Same
-as the previous reloc but on the right side
-of the container.
-@end deffn
-@deffn {} BFD_RELOC_D30V_32
-This is a 32-bit absolute reloc.
-@end deffn
-@deffn {} BFD_RELOC_D30V_32_PCREL
-This is a 32-bit pc-relative reloc.
-@end deffn
-@deffn {} BFD_RELOC_DLX_HI16_S
-DLX relocs
-@end deffn
-@deffn {} BFD_RELOC_DLX_LO16
-DLX relocs
-@end deffn
-@deffn {} BFD_RELOC_DLX_JMP26
-DLX relocs
-@end deffn
-@deffn {} BFD_RELOC_M32C_HI8
-@deffnx {} BFD_RELOC_M32C_RL_JUMP
-@deffnx {} BFD_RELOC_M32C_RL_1ADDR
-@deffnx {} BFD_RELOC_M32C_RL_2ADDR
-Renesas M16C/M32C Relocations.
-@end deffn
-@deffn {} BFD_RELOC_M32R_24
-Renesas M32R (formerly Mitsubishi M32R) relocs.
-This is a 24 bit absolute address.
-@end deffn
-@deffn {} BFD_RELOC_M32R_10_PCREL
-This is a 10-bit pc-relative reloc with the right 2 bits assumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_M32R_18_PCREL
-This is an 18-bit reloc with the right 2 bits assumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_M32R_26_PCREL
-This is a 26-bit reloc with the right 2 bits assumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_M32R_HI16_ULO
-This is a 16-bit reloc containing the high 16 bits of an address
-used when the lower 16 bits are treated as unsigned.
-@end deffn
-@deffn {} BFD_RELOC_M32R_HI16_SLO
-This is a 16-bit reloc containing the high 16 bits of an address
-used when the lower 16 bits are treated as signed.
-@end deffn
-@deffn {} BFD_RELOC_M32R_LO16
-This is a 16-bit reloc containing the lower 16 bits of an address.
-@end deffn
-@deffn {} BFD_RELOC_M32R_SDA16
-This is a 16-bit reloc containing the small data area offset for use in
-add3, load, and store instructions.
-@end deffn
-@deffn {} BFD_RELOC_M32R_GOT24
-@deffnx {} BFD_RELOC_M32R_26_PLTREL
-@deffnx {} BFD_RELOC_M32R_COPY
-@deffnx {} BFD_RELOC_M32R_GLOB_DAT
-@deffnx {} BFD_RELOC_M32R_JMP_SLOT
-@deffnx {} BFD_RELOC_M32R_RELATIVE
-@deffnx {} BFD_RELOC_M32R_GOTOFF
-@deffnx {} BFD_RELOC_M32R_GOTOFF_HI_ULO
-@deffnx {} BFD_RELOC_M32R_GOTOFF_HI_SLO
-@deffnx {} BFD_RELOC_M32R_GOTOFF_LO
-@deffnx {} BFD_RELOC_M32R_GOTPC24
-@deffnx {} BFD_RELOC_M32R_GOT16_HI_ULO
-@deffnx {} BFD_RELOC_M32R_GOT16_HI_SLO
-@deffnx {} BFD_RELOC_M32R_GOT16_LO
-@deffnx {} BFD_RELOC_M32R_GOTPC_HI_ULO
-@deffnx {} BFD_RELOC_M32R_GOTPC_HI_SLO
-@deffnx {} BFD_RELOC_M32R_GOTPC_LO
-For PIC.
-@end deffn
-@deffn {} BFD_RELOC_V850_9_PCREL
-This is a 9-bit reloc
-@end deffn
-@deffn {} BFD_RELOC_V850_22_PCREL
-This is a 22-bit reloc
-@end deffn
-@deffn {} BFD_RELOC_V850_SDA_16_16_OFFSET
-This is a 16 bit offset from the short data area pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_SDA_15_16_OFFSET
-This is a 16 bit offset (of which only 15 bits are used) from the
-short data area pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_ZDA_16_16_OFFSET
-This is a 16 bit offset from the zero data area pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_ZDA_15_16_OFFSET
-This is a 16 bit offset (of which only 15 bits are used) from the
-zero data area pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_TDA_6_8_OFFSET
-This is an 8 bit offset (of which only 6 bits are used) from the
-tiny data area pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_TDA_7_8_OFFSET
-This is an 8bit offset (of which only 7 bits are used) from the tiny
-data area pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_TDA_7_7_OFFSET
-This is a 7 bit offset from the tiny data area pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_TDA_16_16_OFFSET
-This is a 16 bit offset from the tiny data area pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_TDA_4_5_OFFSET
-This is a 5 bit offset (of which only 4 bits are used) from the tiny
-data area pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_TDA_4_4_OFFSET
-This is a 4 bit offset from the tiny data area pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET
-This is a 16 bit offset from the short data area pointer, with the
-bits placed non-contiguously in the instruction.
-@end deffn
-@deffn {} BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET
-This is a 16 bit offset from the zero data area pointer, with the
-bits placed non-contiguously in the instruction.
-@end deffn
-@deffn {} BFD_RELOC_V850_CALLT_6_7_OFFSET
-This is a 6 bit offset from the call table base pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_CALLT_16_16_OFFSET
-This is a 16 bit offset from the call table base pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_LONGCALL
-Used for relaxing indirect function calls.
-@end deffn
-@deffn {} BFD_RELOC_V850_LONGJUMP
-Used for relaxing indirect jumps.
-@end deffn
-@deffn {} BFD_RELOC_V850_ALIGN
-Used to maintain alignment whilst relaxing.
-@end deffn
-@deffn {} BFD_RELOC_V850_LO16_SPLIT_OFFSET
-This is a variation of BFD_RELOC_LO16 that can be used in v850e ld.bu
-instructions.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_32_PCREL
-This is a 32bit pcrel reloc for the mn10300, offset by two bytes in the
-instruction.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_16_PCREL
-This is a 16bit pcrel reloc for the mn10300, offset by two bytes in the
-instruction.
-@end deffn
-@deffn {} BFD_RELOC_TIC30_LDP
-This is a 8bit DP reloc for the tms320c30, where the most
-significant 8 bits of a 24 bit word are placed into the least
-significant 8 bits of the opcode.
-@end deffn
-@deffn {} BFD_RELOC_TIC54X_PARTLS7
-This is a 7bit reloc for the tms320c54x, where the least
-significant 7 bits of a 16 bit word are placed into the least
-significant 7 bits of the opcode.
-@end deffn
-@deffn {} BFD_RELOC_TIC54X_PARTMS9
-This is a 9bit DP reloc for the tms320c54x, where the most
-significant 9 bits of a 16 bit word are placed into the least
-significant 9 bits of the opcode.
-@end deffn
-@deffn {} BFD_RELOC_TIC54X_23
-This is an extended address 23-bit reloc for the tms320c54x.
-@end deffn
-@deffn {} BFD_RELOC_TIC54X_16_OF_23
-This is a 16-bit reloc for the tms320c54x, where the least
-significant 16 bits of a 23-bit extended address are placed into
-the opcode.
-@end deffn
-@deffn {} BFD_RELOC_TIC54X_MS7_OF_23
-This is a reloc for the tms320c54x, where the most
-significant 7 bits of a 23-bit extended address are placed into
-the opcode.
-@end deffn
-@deffn {} BFD_RELOC_FR30_48
-This is a 48 bit reloc for the FR30 that stores 32 bits.
-@end deffn
-@deffn {} BFD_RELOC_FR30_20
-This is a 32 bit reloc for the FR30 that stores 20 bits split up into
-two sections.
-@end deffn
-@deffn {} BFD_RELOC_FR30_6_IN_4
-This is a 16 bit reloc for the FR30 that stores a 6 bit word offset in
-4 bits.
-@end deffn
-@deffn {} BFD_RELOC_FR30_8_IN_8
-This is a 16 bit reloc for the FR30 that stores an 8 bit byte offset
-into 8 bits.
-@end deffn
-@deffn {} BFD_RELOC_FR30_9_IN_8
-This is a 16 bit reloc for the FR30 that stores a 9 bit short offset
-into 8 bits.
-@end deffn
-@deffn {} BFD_RELOC_FR30_10_IN_8
-This is a 16 bit reloc for the FR30 that stores a 10 bit word offset
-into 8 bits.
-@end deffn
-@deffn {} BFD_RELOC_FR30_9_PCREL
-This is a 16 bit reloc for the FR30 that stores a 9 bit pc relative
-short offset into 8 bits.
-@end deffn
-@deffn {} BFD_RELOC_FR30_12_PCREL
-This is a 16 bit reloc for the FR30 that stores a 12 bit pc relative
-short offset into 11 bits.
-@end deffn
-@deffn {} BFD_RELOC_MCORE_PCREL_IMM8BY4
-@deffnx {} BFD_RELOC_MCORE_PCREL_IMM11BY2
-@deffnx {} BFD_RELOC_MCORE_PCREL_IMM4BY2
-@deffnx {} BFD_RELOC_MCORE_PCREL_32
-@deffnx {} BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2
-@deffnx {} BFD_RELOC_MCORE_RVA
-Motorola Mcore relocations.
-@end deffn
-@deffn {} BFD_RELOC_MMIX_GETA
-@deffnx {} BFD_RELOC_MMIX_GETA_1
-@deffnx {} BFD_RELOC_MMIX_GETA_2
-@deffnx {} BFD_RELOC_MMIX_GETA_3
-These are relocations for the GETA instruction.
-@end deffn
-@deffn {} BFD_RELOC_MMIX_CBRANCH
-@deffnx {} BFD_RELOC_MMIX_CBRANCH_J
-@deffnx {} BFD_RELOC_MMIX_CBRANCH_1
-@deffnx {} BFD_RELOC_MMIX_CBRANCH_2
-@deffnx {} BFD_RELOC_MMIX_CBRANCH_3
-These are relocations for a conditional branch instruction.
-@end deffn
-@deffn {} BFD_RELOC_MMIX_PUSHJ
-@deffnx {} BFD_RELOC_MMIX_PUSHJ_1
-@deffnx {} BFD_RELOC_MMIX_PUSHJ_2
-@deffnx {} BFD_RELOC_MMIX_PUSHJ_3
-@deffnx {} BFD_RELOC_MMIX_PUSHJ_STUBBABLE
-These are relocations for the PUSHJ instruction.
-@end deffn
-@deffn {} BFD_RELOC_MMIX_JMP
-@deffnx {} BFD_RELOC_MMIX_JMP_1
-@deffnx {} BFD_RELOC_MMIX_JMP_2
-@deffnx {} BFD_RELOC_MMIX_JMP_3
-These are relocations for the JMP instruction.
-@end deffn
-@deffn {} BFD_RELOC_MMIX_ADDR19
-This is a relocation for a relative address as in a GETA instruction or
-a branch.
-@end deffn
-@deffn {} BFD_RELOC_MMIX_ADDR27
-This is a relocation for a relative address as in a JMP instruction.
-@end deffn
-@deffn {} BFD_RELOC_MMIX_REG_OR_BYTE
-This is a relocation for an instruction field that may be a general
-register or a value 0..255.
-@end deffn
-@deffn {} BFD_RELOC_MMIX_REG
-This is a relocation for an instruction field that may be a general
-register.
-@end deffn
-@deffn {} BFD_RELOC_MMIX_BASE_PLUS_OFFSET
-This is a relocation for two instruction fields holding a register and
-an offset, the equivalent of the relocation.
-@end deffn
-@deffn {} BFD_RELOC_MMIX_LOCAL
-This relocation is an assertion that the expression is not allocated as
-a global register. It does not modify contents.
-@end deffn
-@deffn {} BFD_RELOC_AVR_7_PCREL
-This is a 16 bit reloc for the AVR that stores 8 bit pc relative
-short offset into 7 bits.
-@end deffn
-@deffn {} BFD_RELOC_AVR_13_PCREL
-This is a 16 bit reloc for the AVR that stores 13 bit pc relative
-short offset into 12 bits.
-@end deffn
-@deffn {} BFD_RELOC_AVR_16_PM
-This is a 16 bit reloc for the AVR that stores 17 bit value (usually
-program memory address) into 16 bits.
-@end deffn
-@deffn {} BFD_RELOC_AVR_LO8_LDI
-This is a 16 bit reloc for the AVR that stores 8 bit value (usually
-data memory address) into 8 bit immediate value of LDI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_HI8_LDI
-This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
-of data memory address) into 8 bit immediate value of LDI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_HH8_LDI
-This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
-of program memory address) into 8 bit immediate value of LDI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_MS8_LDI
-This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
-of 32 bit value) into 8 bit immediate value of LDI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_LO8_LDI_NEG
-This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(usually data memory address) into 8 bit immediate value of SUBI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_HI8_LDI_NEG
-This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(high 8 bit of data memory address) into 8 bit immediate value of
-SUBI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_HH8_LDI_NEG
-This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(most high 8 bit of program memory address) into 8 bit immediate value
-of LDI or SUBI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_MS8_LDI_NEG
-This is a 16 bit reloc for the AVR that stores negated 8 bit value (msb
-of 32 bit value) into 8 bit immediate value of LDI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_LO8_LDI_PM
-This is a 16 bit reloc for the AVR that stores 8 bit value (usually
-command address) into 8 bit immediate value of LDI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_HI8_LDI_PM
-This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
-of command address) into 8 bit immediate value of LDI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_HH8_LDI_PM
-This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
-of command address) into 8 bit immediate value of LDI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_LO8_LDI_PM_NEG
-This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(usually command address) into 8 bit immediate value of SUBI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_HI8_LDI_PM_NEG
-This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(high 8 bit of 16 bit command address) into 8 bit immediate value
-of SUBI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_HH8_LDI_PM_NEG
-This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(high 6 bit of 22 bit command address) into 8 bit immediate
-value of SUBI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_CALL
-This is a 32 bit reloc for the AVR that stores 23 bit value
-into 22 bits.
-@end deffn
-@deffn {} BFD_RELOC_AVR_LDI
-This is a 16 bit reloc for the AVR that stores all needed bits
-for absolute addressing with ldi with overflow check to linktime
-@end deffn
-@deffn {} BFD_RELOC_AVR_6
-This is a 6 bit reloc for the AVR that stores offset for ldd/std
-instructions
-@end deffn
-@deffn {} BFD_RELOC_AVR_6_ADIW
-This is a 6 bit reloc for the AVR that stores offset for adiw/sbiw
-instructions
-@end deffn
-@deffn {} BFD_RELOC_390_12
-Direct 12 bit.
-@end deffn
-@deffn {} BFD_RELOC_390_GOT12
-12 bit GOT offset.
-@end deffn
-@deffn {} BFD_RELOC_390_PLT32
-32 bit PC relative PLT address.
-@end deffn
-@deffn {} BFD_RELOC_390_COPY
-Copy symbol at runtime.
-@end deffn
-@deffn {} BFD_RELOC_390_GLOB_DAT
-Create GOT entry.
-@end deffn
-@deffn {} BFD_RELOC_390_JMP_SLOT
-Create PLT entry.
-@end deffn
-@deffn {} BFD_RELOC_390_RELATIVE
-Adjust by program base.
-@end deffn
-@deffn {} BFD_RELOC_390_GOTPC
-32 bit PC relative offset to GOT.
-@end deffn
-@deffn {} BFD_RELOC_390_GOT16
-16 bit GOT offset.
-@end deffn
-@deffn {} BFD_RELOC_390_PC16DBL
-PC relative 16 bit shifted by 1.
-@end deffn
-@deffn {} BFD_RELOC_390_PLT16DBL
-16 bit PC rel. PLT shifted by 1.
-@end deffn
-@deffn {} BFD_RELOC_390_PC32DBL
-PC relative 32 bit shifted by 1.
-@end deffn
-@deffn {} BFD_RELOC_390_PLT32DBL
-32 bit PC rel. PLT shifted by 1.
-@end deffn
-@deffn {} BFD_RELOC_390_GOTPCDBL
-32 bit PC rel. GOT shifted by 1.
-@end deffn
-@deffn {} BFD_RELOC_390_GOT64
-64 bit GOT offset.
-@end deffn
-@deffn {} BFD_RELOC_390_PLT64
-64 bit PC relative PLT address.
-@end deffn
-@deffn {} BFD_RELOC_390_GOTENT
-32 bit rel. offset to GOT entry.
-@end deffn
-@deffn {} BFD_RELOC_390_GOTOFF64
-64 bit offset to GOT.
-@end deffn
-@deffn {} BFD_RELOC_390_GOTPLT12
-12-bit offset to symbol-entry within GOT, with PLT handling.
-@end deffn
-@deffn {} BFD_RELOC_390_GOTPLT16
-16-bit offset to symbol-entry within GOT, with PLT handling.
-@end deffn
-@deffn {} BFD_RELOC_390_GOTPLT32
-32-bit offset to symbol-entry within GOT, with PLT handling.
-@end deffn
-@deffn {} BFD_RELOC_390_GOTPLT64
-64-bit offset to symbol-entry within GOT, with PLT handling.
-@end deffn
-@deffn {} BFD_RELOC_390_GOTPLTENT
-32-bit rel. offset to symbol-entry within GOT, with PLT handling.
-@end deffn
-@deffn {} BFD_RELOC_390_PLTOFF16
-16-bit rel. offset from the GOT to a PLT entry.
-@end deffn
-@deffn {} BFD_RELOC_390_PLTOFF32
-32-bit rel. offset from the GOT to a PLT entry.
-@end deffn
-@deffn {} BFD_RELOC_390_PLTOFF64
-64-bit rel. offset from the GOT to a PLT entry.
-@end deffn
-@deffn {} BFD_RELOC_390_TLS_LOAD
-@deffnx {} BFD_RELOC_390_TLS_GDCALL
-@deffnx {} BFD_RELOC_390_TLS_LDCALL
-@deffnx {} BFD_RELOC_390_TLS_GD32
-@deffnx {} BFD_RELOC_390_TLS_GD64
-@deffnx {} BFD_RELOC_390_TLS_GOTIE12
-@deffnx {} BFD_RELOC_390_TLS_GOTIE32
-@deffnx {} BFD_RELOC_390_TLS_GOTIE64
-@deffnx {} BFD_RELOC_390_TLS_LDM32
-@deffnx {} BFD_RELOC_390_TLS_LDM64
-@deffnx {} BFD_RELOC_390_TLS_IE32
-@deffnx {} BFD_RELOC_390_TLS_IE64
-@deffnx {} BFD_RELOC_390_TLS_IEENT
-@deffnx {} BFD_RELOC_390_TLS_LE32
-@deffnx {} BFD_RELOC_390_TLS_LE64
-@deffnx {} BFD_RELOC_390_TLS_LDO32
-@deffnx {} BFD_RELOC_390_TLS_LDO64
-@deffnx {} BFD_RELOC_390_TLS_DTPMOD
-@deffnx {} BFD_RELOC_390_TLS_DTPOFF
-@deffnx {} BFD_RELOC_390_TLS_TPOFF
-s390 tls relocations.
-@end deffn
-@deffn {} BFD_RELOC_390_20
-@deffnx {} BFD_RELOC_390_GOT20
-@deffnx {} BFD_RELOC_390_GOTPLT20
-@deffnx {} BFD_RELOC_390_TLS_GOTIE20
-Long displacement extension.
-@end deffn
-@deffn {} BFD_RELOC_IP2K_FR9
-Scenix IP2K - 9-bit register number / data address
-@end deffn
-@deffn {} BFD_RELOC_IP2K_BANK
-Scenix IP2K - 4-bit register/data bank number
-@end deffn
-@deffn {} BFD_RELOC_IP2K_ADDR16CJP
-Scenix IP2K - low 13 bits of instruction word address
-@end deffn
-@deffn {} BFD_RELOC_IP2K_PAGE3
-Scenix IP2K - high 3 bits of instruction word address
-@end deffn
-@deffn {} BFD_RELOC_IP2K_LO8DATA
-@deffnx {} BFD_RELOC_IP2K_HI8DATA
-@deffnx {} BFD_RELOC_IP2K_EX8DATA
-Scenix IP2K - ext/low/high 8 bits of data address
-@end deffn
-@deffn {} BFD_RELOC_IP2K_LO8INSN
-@deffnx {} BFD_RELOC_IP2K_HI8INSN
-Scenix IP2K - low/high 8 bits of instruction word address
-@end deffn
-@deffn {} BFD_RELOC_IP2K_PC_SKIP
-Scenix IP2K - even/odd PC modifier to modify snb pcl.0
-@end deffn
-@deffn {} BFD_RELOC_IP2K_TEXT
-Scenix IP2K - 16 bit word address in text section.
-@end deffn
-@deffn {} BFD_RELOC_IP2K_FR_OFFSET
-Scenix IP2K - 7-bit sp or dp offset
-@end deffn
-@deffn {} BFD_RELOC_VPE4KMATH_DATA
-@deffnx {} BFD_RELOC_VPE4KMATH_INSN
-Scenix VPE4K coprocessor - data/insn-space addressing
-@end deffn
-@deffn {} BFD_RELOC_VTABLE_INHERIT
-@deffnx {} BFD_RELOC_VTABLE_ENTRY
-These two relocations are used by the linker to determine which of
-the entries in a C++ virtual function table are actually used. When
-the --gc-sections option is given, the linker will zero out the entries
-that are not used, so that the code for those functions need not be
-included in the output.
-
-VTABLE_INHERIT is a zero-space relocation used to describe to the
-linker the inheritance tree of a C++ virtual function table. The
-relocation's symbol should be the parent class' vtable, and the
-relocation should be located at the child vtable.
-
-VTABLE_ENTRY is a zero-space relocation that describes the use of a
-virtual function table entry. The reloc's symbol should refer to the
-table of the class mentioned in the code. Off of that base, an offset
-describes the entry that is being used. For Rela hosts, this offset
-is stored in the reloc's addend. For Rel hosts, we are forced to put
-this offset in the reloc's section offset.
-@end deffn
-@deffn {} BFD_RELOC_IA64_IMM14
-@deffnx {} BFD_RELOC_IA64_IMM22
-@deffnx {} BFD_RELOC_IA64_IMM64
-@deffnx {} BFD_RELOC_IA64_DIR32MSB
-@deffnx {} BFD_RELOC_IA64_DIR32LSB
-@deffnx {} BFD_RELOC_IA64_DIR64MSB
-@deffnx {} BFD_RELOC_IA64_DIR64LSB
-@deffnx {} BFD_RELOC_IA64_GPREL22
-@deffnx {} BFD_RELOC_IA64_GPREL64I
-@deffnx {} BFD_RELOC_IA64_GPREL32MSB
-@deffnx {} BFD_RELOC_IA64_GPREL32LSB
-@deffnx {} BFD_RELOC_IA64_GPREL64MSB
-@deffnx {} BFD_RELOC_IA64_GPREL64LSB
-@deffnx {} BFD_RELOC_IA64_LTOFF22
-@deffnx {} BFD_RELOC_IA64_LTOFF64I
-@deffnx {} BFD_RELOC_IA64_PLTOFF22
-@deffnx {} BFD_RELOC_IA64_PLTOFF64I
-@deffnx {} BFD_RELOC_IA64_PLTOFF64MSB
-@deffnx {} BFD_RELOC_IA64_PLTOFF64LSB
-@deffnx {} BFD_RELOC_IA64_FPTR64I
-@deffnx {} BFD_RELOC_IA64_FPTR32MSB
-@deffnx {} BFD_RELOC_IA64_FPTR32LSB
-@deffnx {} BFD_RELOC_IA64_FPTR64MSB
-@deffnx {} BFD_RELOC_IA64_FPTR64LSB
-@deffnx {} BFD_RELOC_IA64_PCREL21B
-@deffnx {} BFD_RELOC_IA64_PCREL21BI
-@deffnx {} BFD_RELOC_IA64_PCREL21M
-@deffnx {} BFD_RELOC_IA64_PCREL21F
-@deffnx {} BFD_RELOC_IA64_PCREL22
-@deffnx {} BFD_RELOC_IA64_PCREL60B
-@deffnx {} BFD_RELOC_IA64_PCREL64I
-@deffnx {} BFD_RELOC_IA64_PCREL32MSB
-@deffnx {} BFD_RELOC_IA64_PCREL32LSB
-@deffnx {} BFD_RELOC_IA64_PCREL64MSB
-@deffnx {} BFD_RELOC_IA64_PCREL64LSB
-@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR22
-@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR64I
-@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR32MSB
-@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR32LSB
-@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR64MSB
-@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR64LSB
-@deffnx {} BFD_RELOC_IA64_SEGREL32MSB
-@deffnx {} BFD_RELOC_IA64_SEGREL32LSB
-@deffnx {} BFD_RELOC_IA64_SEGREL64MSB
-@deffnx {} BFD_RELOC_IA64_SEGREL64LSB
-@deffnx {} BFD_RELOC_IA64_SECREL32MSB
-@deffnx {} BFD_RELOC_IA64_SECREL32LSB
-@deffnx {} BFD_RELOC_IA64_SECREL64MSB
-@deffnx {} BFD_RELOC_IA64_SECREL64LSB
-@deffnx {} BFD_RELOC_IA64_REL32MSB
-@deffnx {} BFD_RELOC_IA64_REL32LSB
-@deffnx {} BFD_RELOC_IA64_REL64MSB
-@deffnx {} BFD_RELOC_IA64_REL64LSB
-@deffnx {} BFD_RELOC_IA64_LTV32MSB
-@deffnx {} BFD_RELOC_IA64_LTV32LSB
-@deffnx {} BFD_RELOC_IA64_LTV64MSB
-@deffnx {} BFD_RELOC_IA64_LTV64LSB
-@deffnx {} BFD_RELOC_IA64_IPLTMSB
-@deffnx {} BFD_RELOC_IA64_IPLTLSB
-@deffnx {} BFD_RELOC_IA64_COPY
-@deffnx {} BFD_RELOC_IA64_LTOFF22X
-@deffnx {} BFD_RELOC_IA64_LDXMOV
-@deffnx {} BFD_RELOC_IA64_TPREL14
-@deffnx {} BFD_RELOC_IA64_TPREL22
-@deffnx {} BFD_RELOC_IA64_TPREL64I
-@deffnx {} BFD_RELOC_IA64_TPREL64MSB
-@deffnx {} BFD_RELOC_IA64_TPREL64LSB
-@deffnx {} BFD_RELOC_IA64_LTOFF_TPREL22
-@deffnx {} BFD_RELOC_IA64_DTPMOD64MSB
-@deffnx {} BFD_RELOC_IA64_DTPMOD64LSB
-@deffnx {} BFD_RELOC_IA64_LTOFF_DTPMOD22
-@deffnx {} BFD_RELOC_IA64_DTPREL14
-@deffnx {} BFD_RELOC_IA64_DTPREL22
-@deffnx {} BFD_RELOC_IA64_DTPREL64I
-@deffnx {} BFD_RELOC_IA64_DTPREL32MSB
-@deffnx {} BFD_RELOC_IA64_DTPREL32LSB
-@deffnx {} BFD_RELOC_IA64_DTPREL64MSB
-@deffnx {} BFD_RELOC_IA64_DTPREL64LSB
-@deffnx {} BFD_RELOC_IA64_LTOFF_DTPREL22
-Intel IA64 Relocations.
-@end deffn
-@deffn {} BFD_RELOC_M68HC11_HI8
-Motorola 68HC11 reloc.
-This is the 8 bit high part of an absolute address.
-@end deffn
-@deffn {} BFD_RELOC_M68HC11_LO8
-Motorola 68HC11 reloc.
-This is the 8 bit low part of an absolute address.
-@end deffn
-@deffn {} BFD_RELOC_M68HC11_3B
-Motorola 68HC11 reloc.
-This is the 3 bit of a value.
-@end deffn
-@deffn {} BFD_RELOC_M68HC11_RL_JUMP
-Motorola 68HC11 reloc.
-This reloc marks the beginning of a jump/call instruction.
-It is used for linker relaxation to correctly identify beginning
-of instruction and change some branches to use PC-relative
-addressing mode.
-@end deffn
-@deffn {} BFD_RELOC_M68HC11_RL_GROUP
-Motorola 68HC11 reloc.
-This reloc marks a group of several instructions that gcc generates
-and for which the linker relaxation pass can modify and/or remove
-some of them.
-@end deffn
-@deffn {} BFD_RELOC_M68HC11_LO16
-Motorola 68HC11 reloc.
-This is the 16-bit lower part of an address. It is used for 'call'
-instruction to specify the symbol address without any special
-transformation (due to memory bank window).
-@end deffn
-@deffn {} BFD_RELOC_M68HC11_PAGE
-Motorola 68HC11 reloc.
-This is a 8-bit reloc that specifies the page number of an address.
-It is used by 'call' instruction to specify the page number of
-the symbol.
-@end deffn
-@deffn {} BFD_RELOC_M68HC11_24
-Motorola 68HC11 reloc.
-This is a 24-bit reloc that represents the address with a 16-bit
-value and a 8-bit page number. The symbol address is transformed
-to follow the 16K memory bank of 68HC12 (seen as mapped in the window).
-@end deffn
-@deffn {} BFD_RELOC_M68HC12_5B
-Motorola 68HC12 reloc.
-This is the 5 bits of a value.
-@end deffn
-@deffn {} BFD_RELOC_16C_NUM08
-@deffnx {} BFD_RELOC_16C_NUM08_C
-@deffnx {} BFD_RELOC_16C_NUM16
-@deffnx {} BFD_RELOC_16C_NUM16_C
-@deffnx {} BFD_RELOC_16C_NUM32
-@deffnx {} BFD_RELOC_16C_NUM32_C
-@deffnx {} BFD_RELOC_16C_DISP04
-@deffnx {} BFD_RELOC_16C_DISP04_C
-@deffnx {} BFD_RELOC_16C_DISP08
-@deffnx {} BFD_RELOC_16C_DISP08_C
-@deffnx {} BFD_RELOC_16C_DISP16
-@deffnx {} BFD_RELOC_16C_DISP16_C
-@deffnx {} BFD_RELOC_16C_DISP24
-@deffnx {} BFD_RELOC_16C_DISP24_C
-@deffnx {} BFD_RELOC_16C_DISP24a
-@deffnx {} BFD_RELOC_16C_DISP24a_C
-@deffnx {} BFD_RELOC_16C_REG04
-@deffnx {} BFD_RELOC_16C_REG04_C
-@deffnx {} BFD_RELOC_16C_REG04a
-@deffnx {} BFD_RELOC_16C_REG04a_C
-@deffnx {} BFD_RELOC_16C_REG14
-@deffnx {} BFD_RELOC_16C_REG14_C
-@deffnx {} BFD_RELOC_16C_REG16
-@deffnx {} BFD_RELOC_16C_REG16_C
-@deffnx {} BFD_RELOC_16C_REG20
-@deffnx {} BFD_RELOC_16C_REG20_C
-@deffnx {} BFD_RELOC_16C_ABS20
-@deffnx {} BFD_RELOC_16C_ABS20_C
-@deffnx {} BFD_RELOC_16C_ABS24
-@deffnx {} BFD_RELOC_16C_ABS24_C
-@deffnx {} BFD_RELOC_16C_IMM04
-@deffnx {} BFD_RELOC_16C_IMM04_C
-@deffnx {} BFD_RELOC_16C_IMM16
-@deffnx {} BFD_RELOC_16C_IMM16_C
-@deffnx {} BFD_RELOC_16C_IMM20
-@deffnx {} BFD_RELOC_16C_IMM20_C
-@deffnx {} BFD_RELOC_16C_IMM24
-@deffnx {} BFD_RELOC_16C_IMM24_C
-@deffnx {} BFD_RELOC_16C_IMM32
-@deffnx {} BFD_RELOC_16C_IMM32_C
-NS CR16C Relocations.
-@end deffn
-@deffn {} BFD_RELOC_CRX_REL4
-@deffnx {} BFD_RELOC_CRX_REL8
-@deffnx {} BFD_RELOC_CRX_REL8_CMP
-@deffnx {} BFD_RELOC_CRX_REL16
-@deffnx {} BFD_RELOC_CRX_REL24
-@deffnx {} BFD_RELOC_CRX_REL32
-@deffnx {} BFD_RELOC_CRX_REGREL12
-@deffnx {} BFD_RELOC_CRX_REGREL22
-@deffnx {} BFD_RELOC_CRX_REGREL28
-@deffnx {} BFD_RELOC_CRX_REGREL32
-@deffnx {} BFD_RELOC_CRX_ABS16
-@deffnx {} BFD_RELOC_CRX_ABS32
-@deffnx {} BFD_RELOC_CRX_NUM8
-@deffnx {} BFD_RELOC_CRX_NUM16
-@deffnx {} BFD_RELOC_CRX_NUM32
-@deffnx {} BFD_RELOC_CRX_IMM16
-@deffnx {} BFD_RELOC_CRX_IMM32
-@deffnx {} BFD_RELOC_CRX_SWITCH8
-@deffnx {} BFD_RELOC_CRX_SWITCH16
-@deffnx {} BFD_RELOC_CRX_SWITCH32
-NS CRX Relocations.
-@end deffn
-@deffn {} BFD_RELOC_CRIS_BDISP8
-@deffnx {} BFD_RELOC_CRIS_UNSIGNED_5
-@deffnx {} BFD_RELOC_CRIS_SIGNED_6
-@deffnx {} BFD_RELOC_CRIS_UNSIGNED_6
-@deffnx {} BFD_RELOC_CRIS_SIGNED_8
-@deffnx {} BFD_RELOC_CRIS_UNSIGNED_8
-@deffnx {} BFD_RELOC_CRIS_SIGNED_16
-@deffnx {} BFD_RELOC_CRIS_UNSIGNED_16
-@deffnx {} BFD_RELOC_CRIS_LAPCQ_OFFSET
-@deffnx {} BFD_RELOC_CRIS_UNSIGNED_4
-These relocs are only used within the CRIS assembler. They are not
-(at present) written to any object files.
-@end deffn
-@deffn {} BFD_RELOC_CRIS_COPY
-@deffnx {} BFD_RELOC_CRIS_GLOB_DAT
-@deffnx {} BFD_RELOC_CRIS_JUMP_SLOT
-@deffnx {} BFD_RELOC_CRIS_RELATIVE
-Relocs used in ELF shared libraries for CRIS.
-@end deffn
-@deffn {} BFD_RELOC_CRIS_32_GOT
-32-bit offset to symbol-entry within GOT.
-@end deffn
-@deffn {} BFD_RELOC_CRIS_16_GOT
-16-bit offset to symbol-entry within GOT.
-@end deffn
-@deffn {} BFD_RELOC_CRIS_32_GOTPLT
-32-bit offset to symbol-entry within GOT, with PLT handling.
-@end deffn
-@deffn {} BFD_RELOC_CRIS_16_GOTPLT
-16-bit offset to symbol-entry within GOT, with PLT handling.
-@end deffn
-@deffn {} BFD_RELOC_CRIS_32_GOTREL
-32-bit offset to symbol, relative to GOT.
-@end deffn
-@deffn {} BFD_RELOC_CRIS_32_PLT_GOTREL
-32-bit offset to symbol with PLT entry, relative to GOT.
-@end deffn
-@deffn {} BFD_RELOC_CRIS_32_PLT_PCREL
-32-bit offset to symbol with PLT entry, relative to this relocation.
-@end deffn
-@deffn {} BFD_RELOC_860_COPY
-@deffnx {} BFD_RELOC_860_GLOB_DAT
-@deffnx {} BFD_RELOC_860_JUMP_SLOT
-@deffnx {} BFD_RELOC_860_RELATIVE
-@deffnx {} BFD_RELOC_860_PC26
-@deffnx {} BFD_RELOC_860_PLT26
-@deffnx {} BFD_RELOC_860_PC16
-@deffnx {} BFD_RELOC_860_LOW0
-@deffnx {} BFD_RELOC_860_SPLIT0
-@deffnx {} BFD_RELOC_860_LOW1
-@deffnx {} BFD_RELOC_860_SPLIT1
-@deffnx {} BFD_RELOC_860_LOW2
-@deffnx {} BFD_RELOC_860_SPLIT2
-@deffnx {} BFD_RELOC_860_LOW3
-@deffnx {} BFD_RELOC_860_LOGOT0
-@deffnx {} BFD_RELOC_860_SPGOT0
-@deffnx {} BFD_RELOC_860_LOGOT1
-@deffnx {} BFD_RELOC_860_SPGOT1
-@deffnx {} BFD_RELOC_860_LOGOTOFF0
-@deffnx {} BFD_RELOC_860_SPGOTOFF0
-@deffnx {} BFD_RELOC_860_LOGOTOFF1
-@deffnx {} BFD_RELOC_860_SPGOTOFF1
-@deffnx {} BFD_RELOC_860_LOGOTOFF2
-@deffnx {} BFD_RELOC_860_LOGOTOFF3
-@deffnx {} BFD_RELOC_860_LOPC
-@deffnx {} BFD_RELOC_860_HIGHADJ
-@deffnx {} BFD_RELOC_860_HAGOT
-@deffnx {} BFD_RELOC_860_HAGOTOFF
-@deffnx {} BFD_RELOC_860_HAPC
-@deffnx {} BFD_RELOC_860_HIGH
-@deffnx {} BFD_RELOC_860_HIGOT
-@deffnx {} BFD_RELOC_860_HIGOTOFF
-Intel i860 Relocations.
-@end deffn
-@deffn {} BFD_RELOC_OPENRISC_ABS_26
-@deffnx {} BFD_RELOC_OPENRISC_REL_26
-OpenRISC Relocations.
-@end deffn
-@deffn {} BFD_RELOC_H8_DIR16A8
-@deffnx {} BFD_RELOC_H8_DIR16R8
-@deffnx {} BFD_RELOC_H8_DIR24A8
-@deffnx {} BFD_RELOC_H8_DIR24R8
-@deffnx {} BFD_RELOC_H8_DIR32A16
-H8 elf Relocations.
-@end deffn
-@deffn {} BFD_RELOC_XSTORMY16_REL_12
-@deffnx {} BFD_RELOC_XSTORMY16_12
-@deffnx {} BFD_RELOC_XSTORMY16_24
-@deffnx {} BFD_RELOC_XSTORMY16_FPTR16
-Sony Xstormy16 Relocations.
-@end deffn
-@deffn {} BFD_RELOC_XC16X_PAG
-@deffnx {} BFD_RELOC_XC16X_POF
-@deffnx {} BFD_RELOC_XC16X_SEG
-@deffnx {} BFD_RELOC_XC16X_SOF
-Infineon Relocations.
-@end deffn
-@deffn {} BFD_RELOC_VAX_GLOB_DAT
-@deffnx {} BFD_RELOC_VAX_JMP_SLOT
-@deffnx {} BFD_RELOC_VAX_RELATIVE
-Relocations used by VAX ELF.
-@end deffn
-@deffn {} BFD_RELOC_MT_PC16
-Morpho MT - 16 bit immediate relocation.
-@end deffn
-@deffn {} BFD_RELOC_MT_HI16
-Morpho MT - Hi 16 bits of an address.
-@end deffn
-@deffn {} BFD_RELOC_MT_LO16
-Morpho MT - Low 16 bits of an address.
-@end deffn
-@deffn {} BFD_RELOC_MT_GNU_VTINHERIT
-Morpho MT - Used to tell the linker which vtable entries are used.
-@end deffn
-@deffn {} BFD_RELOC_MT_GNU_VTENTRY
-Morpho MT - Used to tell the linker which vtable entries are used.
-@end deffn
-@deffn {} BFD_RELOC_MT_PCINSN8
-Morpho MT - 8 bit immediate relocation.
-@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
-@deffnx {} BFD_RELOC_MSP430_2X_PCREL
-@deffnx {} BFD_RELOC_MSP430_RL_PCREL
-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_DIFF8
-@deffnx {} BFD_RELOC_XTENSA_DIFF16
-@deffnx {} BFD_RELOC_XTENSA_DIFF32
-Xtensa relocations to mark the difference of two local symbols.
-These are only needed to support linker relaxation and can be ignored
-when not relaxing. The field is set to the value of the difference
-assuming no relaxation. The relocation encodes the position of the
-first symbol so the linker can determine whether to adjust the field
-value.
-@end deffn
-@deffn {} BFD_RELOC_XTENSA_SLOT0_OP
-@deffnx {} BFD_RELOC_XTENSA_SLOT1_OP
-@deffnx {} BFD_RELOC_XTENSA_SLOT2_OP
-@deffnx {} BFD_RELOC_XTENSA_SLOT3_OP
-@deffnx {} BFD_RELOC_XTENSA_SLOT4_OP
-@deffnx {} BFD_RELOC_XTENSA_SLOT5_OP
-@deffnx {} BFD_RELOC_XTENSA_SLOT6_OP
-@deffnx {} BFD_RELOC_XTENSA_SLOT7_OP
-@deffnx {} BFD_RELOC_XTENSA_SLOT8_OP
-@deffnx {} BFD_RELOC_XTENSA_SLOT9_OP
-@deffnx {} BFD_RELOC_XTENSA_SLOT10_OP
-@deffnx {} BFD_RELOC_XTENSA_SLOT11_OP
-@deffnx {} BFD_RELOC_XTENSA_SLOT12_OP
-@deffnx {} BFD_RELOC_XTENSA_SLOT13_OP
-@deffnx {} BFD_RELOC_XTENSA_SLOT14_OP
-Generic Xtensa relocations for instruction operands. Only the slot
-number is encoded in the relocation. The relocation applies to the
-last PC-relative immediate operand, or if there are no PC-relative
-immediates, to the last immediate operand.
-@end deffn
-@deffn {} BFD_RELOC_XTENSA_SLOT0_ALT
-@deffnx {} BFD_RELOC_XTENSA_SLOT1_ALT
-@deffnx {} BFD_RELOC_XTENSA_SLOT2_ALT
-@deffnx {} BFD_RELOC_XTENSA_SLOT3_ALT
-@deffnx {} BFD_RELOC_XTENSA_SLOT4_ALT
-@deffnx {} BFD_RELOC_XTENSA_SLOT5_ALT
-@deffnx {} BFD_RELOC_XTENSA_SLOT6_ALT
-@deffnx {} BFD_RELOC_XTENSA_SLOT7_ALT
-@deffnx {} BFD_RELOC_XTENSA_SLOT8_ALT
-@deffnx {} BFD_RELOC_XTENSA_SLOT9_ALT
-@deffnx {} BFD_RELOC_XTENSA_SLOT10_ALT
-@deffnx {} BFD_RELOC_XTENSA_SLOT11_ALT
-@deffnx {} BFD_RELOC_XTENSA_SLOT12_ALT
-@deffnx {} BFD_RELOC_XTENSA_SLOT13_ALT
-@deffnx {} BFD_RELOC_XTENSA_SLOT14_ALT
-Alternate Xtensa relocations. Only the slot is encoded in the
-relocation. The meaning of these relocations is opcode-specific.
-@end deffn
-@deffn {} BFD_RELOC_XTENSA_OP0
-@deffnx {} BFD_RELOC_XTENSA_OP1
-@deffnx {} BFD_RELOC_XTENSA_OP2
-Xtensa relocations for backward compatibility. These have all been
-replaced by BFD_RELOC_XTENSA_SLOT0_OP.
-@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
-@deffn {} BFD_RELOC_Z80_DISP8
-8 bit signed offset in (ix+d) or (iy+d).
-@end deffn
-@deffn {} BFD_RELOC_Z8K_DISP7
-DJNZ offset.
-@end deffn
-@deffn {} BFD_RELOC_Z8K_CALLR
-CALR offset.
-@end deffn
-@deffn {} BFD_RELOC_Z8K_IMM4L
-4 bit value.
-@end deffn
-
-@example
-
-typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
-@end example
-@findex bfd_reloc_type_lookup
-@subsubsection @code{bfd_reloc_type_lookup}
-@strong{Synopsis}
-@example
-reloc_howto_type *bfd_reloc_type_lookup
- (bfd *abfd, bfd_reloc_code_real_type code);
-@end example
-@strong{Description}@*
-Return a pointer to a howto structure which, when
-invoked, will perform the relocation @var{code} on data from the
-architecture noted.
-
-@findex bfd_default_reloc_type_lookup
-@subsubsection @code{bfd_default_reloc_type_lookup}
-@strong{Synopsis}
-@example
-reloc_howto_type *bfd_default_reloc_type_lookup
- (bfd *abfd, bfd_reloc_code_real_type code);
-@end example
-@strong{Description}@*
-Provides a default relocation lookup routine for any architecture.
-
-@findex bfd_get_reloc_code_name
-@subsubsection @code{bfd_get_reloc_code_name}
-@strong{Synopsis}
-@example
-const char *bfd_get_reloc_code_name (bfd_reloc_code_real_type code);
-@end example
-@strong{Description}@*
-Provides a printable name for the supplied relocation code.
-Useful mainly for printing error messages.
-
-@findex bfd_generic_relax_section
-@subsubsection @code{bfd_generic_relax_section}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_generic_relax_section
- (bfd *abfd,
- asection *section,
- struct bfd_link_info *,
- bfd_boolean *);
-@end example
-@strong{Description}@*
-Provides default handling for relaxing for back ends which
-don't do relaxing.
-
-@findex bfd_generic_gc_sections
-@subsubsection @code{bfd_generic_gc_sections}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_generic_gc_sections
- (bfd *, struct bfd_link_info *);
-@end example
-@strong{Description}@*
-Provides default handling for relaxing for back ends which
-don't do section gc -- i.e., does nothing.
-
-@findex bfd_generic_merge_sections
-@subsubsection @code{bfd_generic_merge_sections}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_generic_merge_sections
- (bfd *, struct bfd_link_info *);
-@end example
-@strong{Description}@*
-Provides default handling for SEC_MERGE section merging for back ends
-which don't have SEC_MERGE support -- i.e., does nothing.
-
-@findex bfd_generic_get_relocated_section_contents
-@subsubsection @code{bfd_generic_get_relocated_section_contents}
-@strong{Synopsis}
-@example
-bfd_byte *bfd_generic_get_relocated_section_contents
- (bfd *abfd,
- struct bfd_link_info *link_info,
- struct bfd_link_order *link_order,
- bfd_byte *data,
- bfd_boolean relocatable,
- asymbol **symbols);
-@end example
-@strong{Description}@*
-Provides default handling of relocation effort for back ends
-which can't be bothered to do it efficiently.
-
diff --git a/bfd/doc/section.texi b/bfd/doc/section.texi
deleted file mode 100644
index 4347679ef49c..000000000000
--- a/bfd/doc/section.texi
+++ /dev/null
@@ -1,989 +0,0 @@
-@section Sections
-The raw data contained within a BFD is maintained through the
-section abstraction. A single BFD may have any number of
-sections. It keeps hold of them by pointing to the first;
-each one points to the next in the list.
-
-Sections are supported in BFD in @code{section.c}.
-
-@menu
-* Section Input::
-* Section Output::
-* typedef asection::
-* section prototypes::
-@end menu
-
-@node Section Input, Section Output, Sections, Sections
-@subsection Section input
-When a BFD is opened for reading, the section structures are
-created and attached to the BFD.
-
-Each section has a name which describes the section in the
-outside world---for example, @code{a.out} would contain at least
-three sections, called @code{.text}, @code{.data} and @code{.bss}.
-
-Names need not be unique; for example a COFF file may have several
-sections named @code{.data}.
-
-Sometimes a BFD will contain more than the ``natural'' number of
-sections. A back end may attach other sections containing
-constructor data, or an application may add a section (using
-@code{bfd_make_section}) to the sections attached to an already open
-BFD. For example, the linker creates an extra section
-@code{COMMON} for each input file's BFD to hold information about
-common storage.
-
-The raw data is not necessarily read in when
-the section descriptor is created. Some targets may leave the
-data in place until a @code{bfd_get_section_contents} call is
-made. Other back ends may read in all the data at once. For
-example, an S-record file has to be read once to determine the
-size of the data. An IEEE-695 file doesn't contain raw data in
-sections, but data and relocation expressions intermixed, so
-the data area has to be parsed to get out the data and
-relocations.
-
-@node Section Output, typedef asection, Section Input, Sections
-@subsection Section output
-To write a new object style BFD, the various sections to be
-written have to be created. They are attached to the BFD in
-the same way as input sections; data is written to the
-sections using @code{bfd_set_section_contents}.
-
-Any program that creates or combines sections (e.g., the assembler
-and linker) must use the @code{asection} fields @code{output_section} and
-@code{output_offset} to indicate the file sections to which each
-section must be written. (If the section is being created from
-scratch, @code{output_section} should probably point to the section
-itself and @code{output_offset} should probably be zero.)
-
-The data to be written comes from input sections attached
-(via @code{output_section} pointers) to
-the output sections. The output section structure can be
-considered a filter for the input section: the output section
-determines the vma of the output data and the name, but the
-input section determines the offset into the output section of
-the data to be written.
-
-E.g., to create a section "O", starting at 0x100, 0x123 long,
-containing two subsections, "A" at offset 0x0 (i.e., at vma
-0x100) and "B" at offset 0x20 (i.e., at vma 0x120) the @code{asection}
-structures would look like:
-
-@example
- section name "A"
- output_offset 0x00
- size 0x20
- output_section -----------> section name "O"
- | vma 0x100
- section name "B" | size 0x123
- output_offset 0x20 |
- size 0x103 |
- output_section --------|
-@end example
-
-@subsection Link orders
-The data within a section is stored in a @dfn{link_order}.
-These are much like the fixups in @code{gas}. The link_order
-abstraction allows a section to grow and shrink within itself.
-
-A link_order knows how big it is, and which is the next
-link_order and where the raw data for it is; it also points to
-a list of relocations which apply to it.
-
-The link_order is used by the linker to perform relaxing on
-final code. The compiler creates code which is as big as
-necessary to make it work without relaxing, and the user can
-select whether to relax. Sometimes relaxing takes a lot of
-time. The linker runs around the relocations to see if any
-are attached to data which can be shrunk, if so it does it on
-a link_order by link_order basis.
-
-
-@node typedef asection, section prototypes, Section Output, Sections
-@subsection typedef asection
-Here is the section structure:
-
-
-@example
-
-typedef struct bfd_section
-@{
- /* The name of the section; the name isn't a copy, the pointer is
- the same as that passed to bfd_make_section. */
- const char *name;
-
- /* A unique sequence number. */
- int id;
-
- /* Which section in the bfd; 0..n-1 as sections are created in a bfd. */
- int index;
-
- /* The next section in the list belonging to the BFD, or NULL. */
- struct bfd_section *next;
-
- /* The previous section in the list belonging to the BFD, or NULL. */
- struct bfd_section *prev;
-
- /* The field flags contains attributes of the section. Some
- flags are read in from the object file, and some are
- synthesized from other information. */
- flagword flags;
-
-#define SEC_NO_FLAGS 0x000
-
- /* Tells the OS to allocate space for this section when loading.
- This is clear for a section containing debug information only. */
-#define SEC_ALLOC 0x001
-
- /* Tells the OS to load the section from the file when loading.
- This is clear for a .bss section. */
-#define SEC_LOAD 0x002
-
- /* The section contains data still to be relocated, so there is
- some relocation information too. */
-#define SEC_RELOC 0x004
-
- /* A signal to the OS that the section contains read only data. */
-#define SEC_READONLY 0x008
-
- /* The section contains code only. */
-#define SEC_CODE 0x010
-
- /* The section contains data only. */
-#define SEC_DATA 0x020
-
- /* The section will reside in ROM. */
-#define SEC_ROM 0x040
-
- /* The section contains constructor information. This section
- type is used by the linker to create lists of constructors and
- destructors used by @code{g++}. When a back end sees a symbol
- which should be used in a constructor list, it creates a new
- section for the type of name (e.g., @code{__CTOR_LIST__}), attaches
- the symbol to it, and builds a relocation. To build the lists
- of constructors, all the linker has to do is catenate all the
- sections called @code{__CTOR_LIST__} and relocate the data
- contained within - exactly the operations it would peform on
- standard data. */
-#define SEC_CONSTRUCTOR 0x080
-
- /* The section has contents - a data section could be
- @code{SEC_ALLOC} | @code{SEC_HAS_CONTENTS}; a debug section could be
- @code{SEC_HAS_CONTENTS} */
-#define SEC_HAS_CONTENTS 0x100
-
- /* An instruction to the linker to not output the section
- even if it has information which would normally be written. */
-#define SEC_NEVER_LOAD 0x200
-
- /* The section contains thread local data. */
-#define SEC_THREAD_LOCAL 0x400
-
- /* The section has GOT references. This flag is only for the
- linker, and is currently only used by the elf32-hppa back end.
- It will be set if global offset table references were detected
- in this section, which indicate to the linker that the section
- contains PIC code, and must be handled specially when doing a
- static link. */
-#define SEC_HAS_GOT_REF 0x800
-
- /* The section contains common symbols (symbols may be defined
- multiple times, the value of a symbol is the amount of
- space it requires, and the largest symbol value is the one
- used). Most targets have exactly one of these (which we
- translate to bfd_com_section_ptr), but ECOFF has two. */
-#define SEC_IS_COMMON 0x1000
-
- /* The section contains only debugging information. For
- example, this is set for ELF .debug and .stab sections.
- strip tests this flag to see if a section can be
- discarded. */
-#define SEC_DEBUGGING 0x2000
-
- /* The contents of this section are held in memory pointed to
- by the contents field. This is checked by bfd_get_section_contents,
- and the data is retrieved from memory if appropriate. */
-#define SEC_IN_MEMORY 0x4000
-
- /* The contents of this section are to be excluded by the
- linker for executable and shared objects unless those
- objects are to be further relocated. */
-#define SEC_EXCLUDE 0x8000
-
- /* The contents of this section are to be sorted based on the sum of
- the symbol and addend values specified by the associated relocation
- entries. Entries without associated relocation entries will be
- appended to the end of the section in an unspecified order. */
-#define SEC_SORT_ENTRIES 0x10000
-
- /* When linking, duplicate sections of the same name should be
- discarded, rather than being combined into a single section as
- is usually done. This is similar to how common symbols are
- handled. See SEC_LINK_DUPLICATES below. */
-#define SEC_LINK_ONCE 0x20000
-
- /* If SEC_LINK_ONCE is set, this bitfield describes how the linker
- should handle duplicate sections. */
-#define SEC_LINK_DUPLICATES 0x40000
-
- /* This value for SEC_LINK_DUPLICATES means that duplicate
- sections with the same name should simply be discarded. */
-#define SEC_LINK_DUPLICATES_DISCARD 0x0
-
- /* This value for SEC_LINK_DUPLICATES means that the linker
- should warn if there are any duplicate sections, although
- it should still only link one copy. */
-#define SEC_LINK_DUPLICATES_ONE_ONLY 0x80000
-
- /* This value for SEC_LINK_DUPLICATES means that the linker
- should warn if any duplicate sections are a different size. */
-#define SEC_LINK_DUPLICATES_SAME_SIZE 0x100000
-
- /* This value for SEC_LINK_DUPLICATES means that the linker
- should warn if any duplicate sections contain different
- contents. */
-#define SEC_LINK_DUPLICATES_SAME_CONTENTS \
- (SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE)
-
- /* This section was created by the linker as part of dynamic
- relocation or other arcane processing. It is skipped when
- going through the first-pass output, trusting that someone
- else up the line will take care of it later. */
-#define SEC_LINKER_CREATED 0x200000
-
- /* This section should not be subject to garbage collection. */
-#define SEC_KEEP 0x400000
-
- /* This section contains "short" data, and should be placed
- "near" the GP. */
-#define SEC_SMALL_DATA 0x800000
-
- /* Attempt to merge identical entities in the section.
- Entity size is given in the entsize field. */
-#define SEC_MERGE 0x1000000
-
- /* If given with SEC_MERGE, entities to merge are zero terminated
- strings where entsize specifies character size instead of fixed
- size entries. */
-#define SEC_STRINGS 0x2000000
-
- /* This section contains data about section groups. */
-#define SEC_GROUP 0x4000000
-
- /* The section is a COFF shared library section. This flag is
- only for the linker. If this type of section appears in
- the input file, the linker must copy it to the output file
- without changing the vma or size. FIXME: Although this
- was originally intended to be general, it really is COFF
- specific (and the flag was renamed to indicate this). It
- might be cleaner to have some more general mechanism to
- allow the back end to control what the linker does with
- sections. */
-#define SEC_COFF_SHARED_LIBRARY 0x10000000
-
- /* This section contains data which may be shared with other
- executables or shared objects. This is for COFF only. */
-#define SEC_COFF_SHARED 0x20000000
-
- /* When a section with this flag is being linked, then if the size of
- the input section is less than a page, it should not cross a page
- boundary. If the size of the input section is one page or more,
- it should be aligned on a page boundary. This is for TI
- TMS320C54X only. */
-#define SEC_TIC54X_BLOCK 0x40000000
-
- /* Conditionally link this section; do not link if there are no
- references found to any symbol in the section. This is for TI
- TMS320C54X only. */
-#define SEC_TIC54X_CLINK 0x80000000
-
- /* End of section flags. */
-
- /* Some internal packed boolean fields. */
-
- /* See the vma field. */
- unsigned int user_set_vma : 1;
-
- /* A mark flag used by some of the linker backends. */
- unsigned int linker_mark : 1;
-
- /* Another mark flag used by some of the linker backends. Set for
- output sections that have an input section. */
- unsigned int linker_has_input : 1;
-
- /* Mark flags used by some linker backends for garbage collection. */
- unsigned int gc_mark : 1;
- unsigned int gc_mark_from_eh : 1;
-
- /* The following flags are used by the ELF linker. */
-
- /* 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. The generic code doesn't touch
- these fields. */
-
- /* Nonzero if this section has TLS related relocations. */
- unsigned int has_tls_reloc:1;
-
- /* Nonzero if this section has a gp reloc. */
- unsigned int has_gp_reloc:1;
-
- /* Nonzero if this section needs the relax finalize pass. */
- unsigned int need_finalize_relax:1;
-
- /* Whether relocations have been processed. */
- unsigned int reloc_done : 1;
-
- /* End of internal packed boolean fields. */
-
- /* The virtual memory address of the section - where it will be
- at run time. The symbols are relocated against this. The
- user_set_vma flag is maintained by bfd; if it's not set, the
- backend can assign addresses (for example, in @code{a.out}, where
- the default address for @code{.data} is dependent on the specific
- target and various flags). */
- bfd_vma vma;
-
- /* The load address of the section - where it would be in a
- rom image; really only used for writing section header
- information. */
- bfd_vma lma;
-
- /* The size of the section in octets, as it will be output.
- Contains a value even if the section has no contents (e.g., the
- size of @code{.bss}). */
- bfd_size_type size;
-
- /* For input sections, the original size on disk of the section, in
- octets. This field is used by the linker relaxation code. It is
- currently only set for sections where the linker relaxation scheme
- doesn't cache altered section and reloc contents (stabs, eh_frame,
- SEC_MERGE, some coff relaxing targets), and thus the original size
- needs to be kept to read the section multiple times.
- For output sections, rawsize holds the section size calculated on
- a previous linker relaxation pass. */
- bfd_size_type rawsize;
-
- /* If this section is going to be output, then this value is the
- offset in *bytes* into the output section of the first byte in the
- input section (byte ==> smallest addressable unit on the
- target). In most cases, if this was going to start at the
- 100th octet (8-bit quantity) in the output section, this value
- would be 100. However, if the target byte size is 16 bits
- (bfd_octets_per_byte is "2"), this value would be 50. */
- bfd_vma output_offset;
-
- /* The output section through which to map on output. */
- struct bfd_section *output_section;
-
- /* The alignment requirement of the section, as an exponent of 2 -
- e.g., 3 aligns to 2^3 (or 8). */
- unsigned int alignment_power;
-
- /* If an input section, a pointer to a vector of relocation
- records for the data in this section. */
- struct reloc_cache_entry *relocation;
-
- /* If an output section, a pointer to a vector of pointers to
- relocation records for the data in this section. */
- struct reloc_cache_entry **orelocation;
-
- /* The number of relocation records in one of the above. */
- unsigned reloc_count;
-
- /* Information below is back end specific - and not always used
- or updated. */
-
- /* File position of section data. */
- file_ptr filepos;
-
- /* File position of relocation info. */
- file_ptr rel_filepos;
-
- /* File position of line data. */
- file_ptr line_filepos;
-
- /* Pointer to data for applications. */
- void *userdata;
-
- /* If the SEC_IN_MEMORY flag is set, this points to the actual
- contents. */
- unsigned char *contents;
-
- /* Attached line number information. */
- alent *lineno;
-
- /* Number of line number records. */
- unsigned int lineno_count;
-
- /* Entity size for merging purposes. */
- unsigned int entsize;
-
- /* Points to the kept section if this section is a link-once section,
- and is discarded. */
- struct bfd_section *kept_section;
-
- /* When a section is being output, this value changes as more
- linenumbers are written out. */
- file_ptr moving_line_filepos;
-
- /* What the section number is in the target world. */
- int target_index;
-
- void *used_by_bfd;
-
- /* If this is a constructor section then here is a list of the
- relocations created to relocate items within it. */
- struct relent_chain *constructor_chain;
-
- /* The BFD which owns the section. */
- bfd *owner;
-
- /* A symbol which points at this section only. */
- struct bfd_symbol *symbol;
- struct bfd_symbol **symbol_ptr_ptr;
-
- /* Early in the link process, map_head and map_tail are used to build
- a list of input sections attached to an output section. Later,
- output sections use these fields for a list of bfd_link_order
- structs. */
- union @{
- struct bfd_link_order *link_order;
- struct bfd_section *s;
- @} map_head, map_tail;
-@} asection;
-
-/* These sections are global, and are managed by BFD. The application
- and target back end are not permitted to change the values in
- these sections. New code should use the section_ptr macros rather
- than referring directly to the const sections. The const sections
- may eventually vanish. */
-#define BFD_ABS_SECTION_NAME "*ABS*"
-#define BFD_UND_SECTION_NAME "*UND*"
-#define BFD_COM_SECTION_NAME "*COM*"
-#define BFD_IND_SECTION_NAME "*IND*"
-
-/* The absolute section. */
-extern asection bfd_abs_section;
-#define bfd_abs_section_ptr ((asection *) &bfd_abs_section)
-#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
-/* Pointer to the undefined section. */
-extern asection bfd_und_section;
-#define bfd_und_section_ptr ((asection *) &bfd_und_section)
-#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
-/* Pointer to the common section. */
-extern asection bfd_com_section;
-#define bfd_com_section_ptr ((asection *) &bfd_com_section)
-/* Pointer to the indirect section. */
-extern asection bfd_ind_section;
-#define bfd_ind_section_ptr ((asection *) &bfd_ind_section)
-#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr)
-
-#define bfd_is_const_section(SEC) \
- ( ((SEC) == bfd_abs_section_ptr) \
- || ((SEC) == bfd_und_section_ptr) \
- || ((SEC) == bfd_com_section_ptr) \
- || ((SEC) == bfd_ind_section_ptr))
-
-extern const struct bfd_symbol * const bfd_abs_symbol;
-extern const struct bfd_symbol * const bfd_com_symbol;
-extern const struct bfd_symbol * const bfd_und_symbol;
-extern const struct bfd_symbol * const bfd_ind_symbol;
-
-/* Macros to handle insertion and deletion of a bfd's sections. These
- only handle the list pointers, ie. do not adjust section_count,
- target_index etc. */
-#define bfd_section_list_remove(ABFD, S) \
- do \
- @{ \
- asection *_s = S; \
- asection *_next = _s->next; \
- asection *_prev = _s->prev; \
- if (_prev) \
- _prev->next = _next; \
- else \
- (ABFD)->sections = _next; \
- if (_next) \
- _next->prev = _prev; \
- else \
- (ABFD)->section_last = _prev; \
- @} \
- while (0)
-#define bfd_section_list_append(ABFD, S) \
- do \
- @{ \
- asection *_s = S; \
- bfd *_abfd = ABFD; \
- _s->next = NULL; \
- if (_abfd->section_last) \
- @{ \
- _s->prev = _abfd->section_last; \
- _abfd->section_last->next = _s; \
- @} \
- else \
- @{ \
- _s->prev = NULL; \
- _abfd->sections = _s; \
- @} \
- _abfd->section_last = _s; \
- @} \
- while (0)
-#define bfd_section_list_prepend(ABFD, S) \
- do \
- @{ \
- asection *_s = S; \
- bfd *_abfd = ABFD; \
- _s->prev = NULL; \
- if (_abfd->sections) \
- @{ \
- _s->next = _abfd->sections; \
- _abfd->sections->prev = _s; \
- @} \
- else \
- @{ \
- _s->next = NULL; \
- _abfd->section_last = _s; \
- @} \
- _abfd->sections = _s; \
- @} \
- while (0)
-#define bfd_section_list_insert_after(ABFD, A, S) \
- do \
- @{ \
- asection *_a = A; \
- asection *_s = S; \
- asection *_next = _a->next; \
- _s->next = _next; \
- _s->prev = _a; \
- _a->next = _s; \
- if (_next) \
- _next->prev = _s; \
- else \
- (ABFD)->section_last = _s; \
- @} \
- while (0)
-#define bfd_section_list_insert_before(ABFD, B, S) \
- do \
- @{ \
- asection *_b = B; \
- asection *_s = S; \
- asection *_prev = _b->prev; \
- _s->prev = _prev; \
- _s->next = _b; \
- _b->prev = _s; \
- if (_prev) \
- _prev->next = _s; \
- else \
- (ABFD)->sections = _s; \
- @} \
- while (0)
-#define bfd_section_removed_from_list(ABFD, S) \
- ((S)->next == NULL ? (ABFD)->section_last != (S) : (S)->next->prev != (S))
-
-#define BFD_FAKE_SECTION(SEC, FLAGS, SYM, SYM_PTR, NAME, IDX) \
- /* name, id, index, next, prev, flags, user_set_vma, */ \
- @{ NAME, IDX, 0, NULL, NULL, FLAGS, 0, \
- \
- /* linker_mark, linker_has_input, gc_mark, gc_mark_from_eh, */ \
- 0, 0, 1, 0, \
- \
- /* segment_mark, sec_info_type, use_rela_p, has_tls_reloc, */ \
- 0, 0, 0, 0, \
- \
- /* has_gp_reloc, need_finalize_relax, reloc_done, */ \
- 0, 0, 0, \
- \
- /* vma, lma, size, rawsize */ \
- 0, 0, 0, 0, \
- \
- /* output_offset, output_section, alignment_power, */ \
- 0, (struct bfd_section *) &SEC, 0, \
- \
- /* relocation, orelocation, reloc_count, filepos, rel_filepos, */ \
- NULL, NULL, 0, 0, 0, \
- \
- /* line_filepos, userdata, contents, lineno, lineno_count, */ \
- 0, NULL, NULL, NULL, 0, \
- \
- /* entsize, kept_section, moving_line_filepos, */ \
- 0, NULL, 0, \
- \
- /* target_index, used_by_bfd, constructor_chain, owner, */ \
- 0, NULL, NULL, NULL, \
- \
- /* symbol, */ \
- (struct bfd_symbol *) SYM, \
- \
- /* symbol_ptr_ptr, */ \
- (struct bfd_symbol **) SYM_PTR, \
- \
- /* map_head, map_tail */ \
- @{ NULL @}, @{ NULL @} \
- @}
-
-@end example
-
-@node section prototypes, , typedef asection, Sections
-@subsection Section prototypes
-These are the functions exported by the section handling part of BFD.
-
-@findex bfd_section_list_clear
-@subsubsection @code{bfd_section_list_clear}
-@strong{Synopsis}
-@example
-void bfd_section_list_clear (bfd *);
-@end example
-@strong{Description}@*
-Clears the section list, and also resets the section count and
-hash table entries.
-
-@findex bfd_get_section_by_name
-@subsubsection @code{bfd_get_section_by_name}
-@strong{Synopsis}
-@example
-asection *bfd_get_section_by_name (bfd *abfd, const char *name);
-@end example
-@strong{Description}@*
-Run through @var{abfd} and return the one of the
-@code{asection}s whose name matches @var{name}, otherwise @code{NULL}.
-@xref{Sections}, for more information.
-
-This should only be used in special cases; the normal way to process
-all sections of a given name is to use @code{bfd_map_over_sections} and
-@code{strcmp} on the name (or better yet, base it on the section flags
-or something else) for each section.
-
-@findex bfd_get_section_by_name_if
-@subsubsection @code{bfd_get_section_by_name_if}
-@strong{Synopsis}
-@example
-asection *bfd_get_section_by_name_if
- (bfd *abfd,
- const char *name,
- bfd_boolean (*func) (bfd *abfd, asection *sect, void *obj),
- void *obj);
-@end example
-@strong{Description}@*
-Call the provided function @var{func} for each section
-attached to the BFD @var{abfd} whose name matches @var{name},
-passing @var{obj} as an argument. The function will be called
-as if by
-
-@example
- func (abfd, the_section, obj);
-@end example
-
-It returns the first section for which @var{func} returns true,
-otherwise @code{NULL}.
-
-@findex bfd_get_unique_section_name
-@subsubsection @code{bfd_get_unique_section_name}
-@strong{Synopsis}
-@example
-char *bfd_get_unique_section_name
- (bfd *abfd, const char *templat, int *count);
-@end example
-@strong{Description}@*
-Invent a section name that is unique in @var{abfd} by tacking
-a dot and a digit suffix onto the original @var{templat}. If
-@var{count} is non-NULL, then it specifies the first number
-tried as a suffix to generate a unique name. The value
-pointed to by @var{count} will be incremented in this case.
-
-@findex bfd_make_section_old_way
-@subsubsection @code{bfd_make_section_old_way}
-@strong{Synopsis}
-@example
-asection *bfd_make_section_old_way (bfd *abfd, const char *name);
-@end example
-@strong{Description}@*
-Create a new empty section called @var{name}
-and attach it to the end of the chain of sections for the
-BFD @var{abfd}. An attempt to create a section with a name which
-is already in use returns its pointer without changing the
-section chain.
-
-It has the funny name since this is the way it used to be
-before it was rewritten....
-
-Possible errors are:
-@itemize @bullet
-
-@item
-@code{bfd_error_invalid_operation} -
-If output has already started for this BFD.
-@item
-@code{bfd_error_no_memory} -
-If memory allocation fails.
-@end itemize
-
-@findex bfd_make_section_anyway_with_flags
-@subsubsection @code{bfd_make_section_anyway_with_flags}
-@strong{Synopsis}
-@example
-asection *bfd_make_section_anyway_with_flags
- (bfd *abfd, const char *name, flagword flags);
-@end example
-@strong{Description}@*
-Create a new empty section called @var{name} and attach it to the end of
-the chain of sections for @var{abfd}. Create a new section even if there
-is already a section with that name. Also set the attributes of the
-new section to the value @var{flags}.
-
-Return @code{NULL} and set @code{bfd_error} on error; possible errors are:
-@itemize @bullet
-
-@item
-@code{bfd_error_invalid_operation} - If output has already started for @var{abfd}.
-@item
-@code{bfd_error_no_memory} - If memory allocation fails.
-@end itemize
-
-@findex bfd_make_section_anyway
-@subsubsection @code{bfd_make_section_anyway}
-@strong{Synopsis}
-@example
-asection *bfd_make_section_anyway (bfd *abfd, const char *name);
-@end example
-@strong{Description}@*
-Create a new empty section called @var{name} and attach it to the end of
-the chain of sections for @var{abfd}. Create a new section even if there
-is already a section with that name.
-
-Return @code{NULL} and set @code{bfd_error} on error; possible errors are:
-@itemize @bullet
-
-@item
-@code{bfd_error_invalid_operation} - If output has already started for @var{abfd}.
-@item
-@code{bfd_error_no_memory} - If memory allocation fails.
-@end itemize
-
-@findex bfd_make_section_with_flags
-@subsubsection @code{bfd_make_section_with_flags}
-@strong{Synopsis}
-@example
-asection *bfd_make_section_with_flags
- (bfd *, const char *name, flagword flags);
-@end example
-@strong{Description}@*
-Like @code{bfd_make_section_anyway}, but return @code{NULL} (without calling
-bfd_set_error ()) without changing the section chain if there is already a
-section named @var{name}. Also set the attributes of the new section to
-the value @var{flags}. If there is an error, return @code{NULL} and set
-@code{bfd_error}.
-
-@findex bfd_make_section
-@subsubsection @code{bfd_make_section}
-@strong{Synopsis}
-@example
-asection *bfd_make_section (bfd *, const char *name);
-@end example
-@strong{Description}@*
-Like @code{bfd_make_section_anyway}, but return @code{NULL} (without calling
-bfd_set_error ()) without changing the section chain if there is already a
-section named @var{name}. If there is an error, return @code{NULL} and set
-@code{bfd_error}.
-
-@findex bfd_set_section_flags
-@subsubsection @code{bfd_set_section_flags}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_set_section_flags
- (bfd *abfd, asection *sec, flagword flags);
-@end example
-@strong{Description}@*
-Set the attributes of the section @var{sec} in the BFD
-@var{abfd} to the value @var{flags}. Return @code{TRUE} on success,
-@code{FALSE} on error. Possible error returns are:
-
-@itemize @bullet
-
-@item
-@code{bfd_error_invalid_operation} -
-The section cannot have one or more of the attributes
-requested. For example, a .bss section in @code{a.out} may not
-have the @code{SEC_HAS_CONTENTS} field set.
-@end itemize
-
-@findex bfd_map_over_sections
-@subsubsection @code{bfd_map_over_sections}
-@strong{Synopsis}
-@example
-void bfd_map_over_sections
- (bfd *abfd,
- void (*func) (bfd *abfd, asection *sect, void *obj),
- void *obj);
-@end example
-@strong{Description}@*
-Call the provided function @var{func} for each section
-attached to the BFD @var{abfd}, passing @var{obj} as an
-argument. The function will be called as if by
-
-@example
- func (abfd, the_section, obj);
-@end example
-
-This is the preferred method for iterating over sections; an
-alternative would be to use a loop:
-
-@example
- section *p;
- for (p = abfd->sections; p != NULL; p = p->next)
- func (abfd, p, ...)
-@end example
-
-@findex bfd_sections_find_if
-@subsubsection @code{bfd_sections_find_if}
-@strong{Synopsis}
-@example
-asection *bfd_sections_find_if
- (bfd *abfd,
- bfd_boolean (*operation) (bfd *abfd, asection *sect, void *obj),
- void *obj);
-@end example
-@strong{Description}@*
-Call the provided function @var{operation} for each section
-attached to the BFD @var{abfd}, passing @var{obj} as an
-argument. The function will be called as if by
-
-@example
- operation (abfd, the_section, obj);
-@end example
-
-It returns the first section for which @var{operation} returns true.
-
-@findex bfd_set_section_size
-@subsubsection @code{bfd_set_section_size}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_set_section_size
- (bfd *abfd, asection *sec, bfd_size_type val);
-@end example
-@strong{Description}@*
-Set @var{sec} to the size @var{val}. If the operation is
-ok, then @code{TRUE} is returned, else @code{FALSE}.
-
-Possible error returns:
-@itemize @bullet
-
-@item
-@code{bfd_error_invalid_operation} -
-Writing has started to the BFD, so setting the size is invalid.
-@end itemize
-
-@findex bfd_set_section_contents
-@subsubsection @code{bfd_set_section_contents}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_set_section_contents
- (bfd *abfd, asection *section, const void *data,
- file_ptr offset, bfd_size_type count);
-@end example
-@strong{Description}@*
-Sets the contents of the section @var{section} in BFD
-@var{abfd} to the data starting in memory at @var{data}. The
-data is written to the output section starting at offset
-@var{offset} for @var{count} octets.
-
-Normally @code{TRUE} is returned, else @code{FALSE}. Possible error
-returns are:
-@itemize @bullet
-
-@item
-@code{bfd_error_no_contents} -
-The output section does not have the @code{SEC_HAS_CONTENTS}
-attribute, so nothing can be written to it.
-@item
-and some more too
-@end itemize
-This routine is front end to the back end function
-@code{_bfd_set_section_contents}.
-
-@findex bfd_get_section_contents
-@subsubsection @code{bfd_get_section_contents}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_get_section_contents
- (bfd *abfd, asection *section, void *location, file_ptr offset,
- bfd_size_type count);
-@end example
-@strong{Description}@*
-Read data from @var{section} in BFD @var{abfd}
-into memory starting at @var{location}. The data is read at an
-offset of @var{offset} from the start of the input section,
-and is read for @var{count} bytes.
-
-If the contents of a constructor with the @code{SEC_CONSTRUCTOR}
-flag set are requested or if the section does not have the
-@code{SEC_HAS_CONTENTS} flag set, then the @var{location} is filled
-with zeroes. If no errors occur, @code{TRUE} is returned, else
-@code{FALSE}.
-
-@findex bfd_malloc_and_get_section
-@subsubsection @code{bfd_malloc_and_get_section}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_malloc_and_get_section
- (bfd *abfd, asection *section, bfd_byte **buf);
-@end example
-@strong{Description}@*
-Read all data from @var{section} in BFD @var{abfd}
-into a buffer, *@var{buf}, malloc'd by this function.
-
-@findex bfd_copy_private_section_data
-@subsubsection @code{bfd_copy_private_section_data}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_copy_private_section_data
- (bfd *ibfd, asection *isec, bfd *obfd, asection *osec);
-@end example
-@strong{Description}@*
-Copy private section information from @var{isec} in the BFD
-@var{ibfd} to the section @var{osec} in the BFD @var{obfd}.
-Return @code{TRUE} on success, @code{FALSE} on error. Possible error
-returns are:
-
-@itemize @bullet
-
-@item
-@code{bfd_error_no_memory} -
-Not enough memory exists to create private data for @var{osec}.
-@end itemize
-@example
-#define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \
- BFD_SEND (obfd, _bfd_copy_private_section_data, \
- (ibfd, isection, obfd, osection))
-@end example
-
-@findex bfd_generic_is_group_section
-@subsubsection @code{bfd_generic_is_group_section}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_generic_is_group_section (bfd *, const asection *sec);
-@end example
-@strong{Description}@*
-Returns TRUE if @var{sec} is a member of a group.
-
-@findex bfd_generic_discard_group
-@subsubsection @code{bfd_generic_discard_group}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_generic_discard_group (bfd *abfd, asection *group);
-@end example
-@strong{Description}@*
-Remove all members of @var{group} from the output.
-
diff --git a/bfd/doc/syms.texi b/bfd/doc/syms.texi
deleted file mode 100644
index dc56bbc7e1b5..000000000000
--- a/bfd/doc/syms.texi
+++ /dev/null
@@ -1,461 +0,0 @@
-@section Symbols
-BFD tries to maintain as much symbol information as it can when
-it moves information from file to file. BFD passes information
-to applications though the @code{asymbol} structure. When the
-application requests the symbol table, BFD reads the table in
-the native form and translates parts of it into the internal
-format. To maintain more than the information passed to
-applications, some targets keep some information ``behind the
-scenes'' in a structure only the particular back end knows
-about. For example, the coff back end keeps the original
-symbol table structure as well as the canonical structure when
-a BFD is read in. On output, the coff back end can reconstruct
-the output symbol table so that no information is lost, even
-information unique to coff which BFD doesn't know or
-understand. If a coff symbol table were read, but were written
-through an a.out back end, all the coff specific information
-would be lost. The symbol table of a BFD
-is not necessarily read in until a canonicalize request is
-made. Then the BFD back end fills in a table provided by the
-application with pointers to the canonical information. To
-output symbols, the application provides BFD with a table of
-pointers to pointers to @code{asymbol}s. This allows applications
-like the linker to output a symbol as it was read, since the ``behind
-the scenes'' information will be still available.
-@menu
-* Reading Symbols::
-* Writing Symbols::
-* Mini Symbols::
-* typedef asymbol::
-* symbol handling functions::
-@end menu
-
-@node Reading Symbols, Writing Symbols, Symbols, Symbols
-@subsection Reading symbols
-There are two stages to reading a symbol table from a BFD:
-allocating storage, and the actual reading process. This is an
-excerpt from an application which reads the symbol table:
-
-@example
- long storage_needed;
- asymbol **symbol_table;
- long number_of_symbols;
- long i;
-
- storage_needed = bfd_get_symtab_upper_bound (abfd);
-
- if (storage_needed < 0)
- FAIL
-
- if (storage_needed == 0)
- return;
-
- symbol_table = xmalloc (storage_needed);
- ...
- number_of_symbols =
- bfd_canonicalize_symtab (abfd, symbol_table);
-
- if (number_of_symbols < 0)
- FAIL
-
- for (i = 0; i < number_of_symbols; i++)
- process_symbol (symbol_table[i]);
-@end example
-
-All storage for the symbols themselves is in an objalloc
-connected to the BFD; it is freed when the BFD is closed.
-
-@node Writing Symbols, Mini Symbols, Reading Symbols, Symbols
-@subsection Writing symbols
-Writing of a symbol table is automatic when a BFD open for
-writing is closed. The application attaches a vector of
-pointers to pointers to symbols to the BFD being written, and
-fills in the symbol count. The close and cleanup code reads
-through the table provided and performs all the necessary
-operations. The BFD output code must always be provided with an
-``owned'' symbol: one which has come from another BFD, or one
-which has been created using @code{bfd_make_empty_symbol}. Here is an
-example showing the creation of a symbol table with only one element:
-
-@example
- #include "bfd.h"
- int main (void)
- @{
- bfd *abfd;
- asymbol *ptrs[2];
- asymbol *new;
-
- abfd = bfd_openw ("foo","a.out-sunos-big");
- bfd_set_format (abfd, bfd_object);
- new = bfd_make_empty_symbol (abfd);
- new->name = "dummy_symbol";
- new->section = bfd_make_section_old_way (abfd, ".text");
- new->flags = BSF_GLOBAL;
- new->value = 0x12345;
-
- ptrs[0] = new;
- ptrs[1] = 0;
-
- bfd_set_symtab (abfd, ptrs, 1);
- bfd_close (abfd);
- return 0;
- @}
-
- ./makesym
- nm foo
- 00012345 A dummy_symbol
-@end example
-
-Many formats cannot represent arbitrary symbol information; for
-instance, the @code{a.out} object format does not allow an
-arbitrary number of sections. A symbol pointing to a section
-which is not one of @code{.text}, @code{.data} or @code{.bss} cannot
-be described.
-
-@node Mini Symbols, typedef asymbol, Writing Symbols, Symbols
-@subsection Mini Symbols
-Mini symbols provide read-only access to the symbol table.
-They use less memory space, but require more time to access.
-They can be useful for tools like nm or objdump, which may
-have to handle symbol tables of extremely large executables.
-
-The @code{bfd_read_minisymbols} function will read the symbols
-into memory in an internal form. It will return a @code{void *}
-pointer to a block of memory, a symbol count, and the size of
-each symbol. The pointer is allocated using @code{malloc}, and
-should be freed by the caller when it is no longer needed.
-
-The function @code{bfd_minisymbol_to_symbol} will take a pointer
-to a minisymbol, and a pointer to a structure returned by
-@code{bfd_make_empty_symbol}, and return a @code{asymbol} structure.
-The return value may or may not be the same as the value from
-@code{bfd_make_empty_symbol} which was passed in.
-
-
-@node typedef asymbol, symbol handling functions, Mini Symbols, Symbols
-@subsection typedef asymbol
-An @code{asymbol} has the form:
-
-
-@example
-
-typedef struct bfd_symbol
-@{
- /* A pointer to the BFD which owns the symbol. This information
- is necessary so that a back end can work out what additional
- information (invisible to the application writer) is carried
- with the symbol.
-
- This field is *almost* redundant, since you can use section->owner
- instead, except that some symbols point to the global sections
- bfd_@{abs,com,und@}_section. This could be fixed by making
- these globals be per-bfd (or per-target-flavor). FIXME. */
- struct bfd *the_bfd; /* Use bfd_asymbol_bfd(sym) to access this field. */
-
- /* The text of the symbol. The name is left alone, and not copied; the
- application may not alter it. */
- const char *name;
-
- /* The value of the symbol. This really should be a union of a
- numeric value with a pointer, since some flags indicate that
- a pointer to another symbol is stored here. */
- symvalue value;
-
- /* Attributes of a symbol. */
-#define BSF_NO_FLAGS 0x00
-
- /* The symbol has local scope; @code{static} in @code{C}. The value
- is the offset into the section of the data. */
-#define BSF_LOCAL 0x01
-
- /* The symbol has global scope; initialized data in @code{C}. The
- value is the offset into the section of the data. */
-#define BSF_GLOBAL 0x02
-
- /* The symbol has global scope and is exported. The value is
- the offset into the section of the data. */
-#define BSF_EXPORT BSF_GLOBAL /* No real difference. */
-
- /* A normal C symbol would be one of:
- @code{BSF_LOCAL}, @code{BSF_FORT_COMM}, @code{BSF_UNDEFINED} or
- @code{BSF_GLOBAL}. */
-
- /* The symbol is a debugging record. The value has an arbitrary
- meaning, unless BSF_DEBUGGING_RELOC is also set. */
-#define BSF_DEBUGGING 0x08
-
- /* The symbol denotes a function entry point. Used in ELF,
- perhaps others someday. */
-#define BSF_FUNCTION 0x10
-
- /* Used by the linker. */
-#define BSF_KEEP 0x20
-#define BSF_KEEP_G 0x40
-
- /* A weak global symbol, overridable without warnings by
- a regular global symbol of the same name. */
-#define BSF_WEAK 0x80
-
- /* This symbol was created to point to a section, e.g. ELF's
- STT_SECTION symbols. */
-#define BSF_SECTION_SYM 0x100
-
- /* The symbol used to be a common symbol, but now it is
- allocated. */
-#define BSF_OLD_COMMON 0x200
-
- /* The default value for common data. */
-#define BFD_FORT_COMM_DEFAULT_VALUE 0
-
- /* In some files the type of a symbol sometimes alters its
- location in an output file - ie in coff a @code{ISFCN} symbol
- which is also @code{C_EXT} symbol appears where it was
- declared and not at the end of a section. This bit is set
- by the target BFD part to convey this information. */
-#define BSF_NOT_AT_END 0x400
-
- /* Signal that the symbol is the label of constructor section. */
-#define BSF_CONSTRUCTOR 0x800
-
- /* Signal that the symbol is a warning symbol. The name is a
- warning. The name of the next symbol is the one to warn about;
- if a reference is made to a symbol with the same name as the next
- symbol, a warning is issued by the linker. */
-#define BSF_WARNING 0x1000
-
- /* Signal that the symbol is indirect. This symbol is an indirect
- pointer to the symbol with the same name as the next symbol. */
-#define BSF_INDIRECT 0x2000
-
- /* BSF_FILE marks symbols that contain a file name. This is used
- for ELF STT_FILE symbols. */
-#define BSF_FILE 0x4000
-
- /* Symbol is from dynamic linking information. */
-#define BSF_DYNAMIC 0x8000
-
- /* The symbol denotes a data object. Used in ELF, and perhaps
- others someday. */
-#define BSF_OBJECT 0x10000
-
- /* This symbol is a debugging symbol. The value is the offset
- into the section of the data. BSF_DEBUGGING should be set
- as well. */
-#define BSF_DEBUGGING_RELOC 0x20000
-
- /* This symbol is thread local. Used in ELF. */
-#define BSF_THREAD_LOCAL 0x40000
-
- flagword flags;
-
- /* A pointer to the section to which this symbol is
- relative. This will always be non NULL, there are special
- sections for undefined and absolute symbols. */
- struct bfd_section *section;
-
- /* Back end special data. */
- union
- @{
- void *p;
- bfd_vma i;
- @}
- udata;
-@}
-asymbol;
-
-@end example
-
-@node symbol handling functions, , typedef asymbol, Symbols
-@subsection Symbol handling functions
-
-
-@findex bfd_get_symtab_upper_bound
-@subsubsection @code{bfd_get_symtab_upper_bound}
-@strong{Description}@*
-Return the number of bytes required to store a vector of pointers
-to @code{asymbols} for all the symbols in the BFD @var{abfd},
-including a terminal NULL pointer. If there are no symbols in
-the BFD, then return 0. If an error occurs, return -1.
-@example
-#define bfd_get_symtab_upper_bound(abfd) \
- BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd))
-
-@end example
-
-@findex bfd_is_local_label
-@subsubsection @code{bfd_is_local_label}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_is_local_label (bfd *abfd, asymbol *sym);
-@end example
-@strong{Description}@*
-Return TRUE if the given symbol @var{sym} in the BFD @var{abfd} is
-a compiler generated local label, else return FALSE.
-
-@findex bfd_is_local_label_name
-@subsubsection @code{bfd_is_local_label_name}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_is_local_label_name (bfd *abfd, const char *name);
-@end example
-@strong{Description}@*
-Return TRUE if a symbol with the name @var{name} in the BFD
-@var{abfd} is a compiler generated local label, else return
-FALSE. This just checks whether the name has the form of a
-local label.
-@example
-#define bfd_is_local_label_name(abfd, name) \
- BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name))
-
-@end example
-
-@findex bfd_is_target_special_symbol
-@subsubsection @code{bfd_is_target_special_symbol}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_is_target_special_symbol (bfd *abfd, asymbol *sym);
-@end example
-@strong{Description}@*
-Return TRUE iff a symbol @var{sym} in the BFD @var{abfd} is something
-special to the particular target represented by the BFD. Such symbols
-should normally not be mentioned to the user.
-@example
-#define bfd_is_target_special_symbol(abfd, sym) \
- BFD_SEND (abfd, _bfd_is_target_special_symbol, (abfd, sym))
-
-@end example
-
-@findex bfd_canonicalize_symtab
-@subsubsection @code{bfd_canonicalize_symtab}
-@strong{Description}@*
-Read the symbols from the BFD @var{abfd}, and fills in
-the vector @var{location} with pointers to the symbols and
-a trailing NULL.
-Return the actual number of symbol pointers, not
-including the NULL.
-@example
-#define bfd_canonicalize_symtab(abfd, location) \
- BFD_SEND (abfd, _bfd_canonicalize_symtab, (abfd, location))
-
-@end example
-
-@findex bfd_set_symtab
-@subsubsection @code{bfd_set_symtab}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_set_symtab
- (bfd *abfd, asymbol **location, unsigned int count);
-@end example
-@strong{Description}@*
-Arrange that when the output BFD @var{abfd} is closed,
-the table @var{location} of @var{count} pointers to symbols
-will be written.
-
-@findex bfd_print_symbol_vandf
-@subsubsection @code{bfd_print_symbol_vandf}
-@strong{Synopsis}
-@example
-void bfd_print_symbol_vandf (bfd *abfd, void *file, asymbol *symbol);
-@end example
-@strong{Description}@*
-Print the value and flags of the @var{symbol} supplied to the
-stream @var{file}.
-
-@findex bfd_make_empty_symbol
-@subsubsection @code{bfd_make_empty_symbol}
-@strong{Description}@*
-Create a new @code{asymbol} structure for the BFD @var{abfd}
-and return a pointer to it.
-
-This routine is necessary because each back end has private
-information surrounding the @code{asymbol}. Building your own
-@code{asymbol} and pointing to it will not create the private
-information, and will cause problems later on.
-@example
-#define bfd_make_empty_symbol(abfd) \
- BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
-
-@end example
-
-@findex _bfd_generic_make_empty_symbol
-@subsubsection @code{_bfd_generic_make_empty_symbol}
-@strong{Synopsis}
-@example
-asymbol *_bfd_generic_make_empty_symbol (bfd *);
-@end example
-@strong{Description}@*
-Create a new @code{asymbol} structure for the BFD @var{abfd}
-and return a pointer to it. Used by core file routines,
-binary back-end and anywhere else where no private info
-is needed.
-
-@findex bfd_make_debug_symbol
-@subsubsection @code{bfd_make_debug_symbol}
-@strong{Description}@*
-Create a new @code{asymbol} structure for the BFD @var{abfd},
-to be used as a debugging symbol. Further details of its use have
-yet to be worked out.
-@example
-#define bfd_make_debug_symbol(abfd,ptr,size) \
- BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size))
-
-@end example
-
-@findex bfd_decode_symclass
-@subsubsection @code{bfd_decode_symclass}
-@strong{Description}@*
-Return a character corresponding to the symbol
-class of @var{symbol}, or '?' for an unknown class.
-
-@strong{Synopsis}
-@example
-int bfd_decode_symclass (asymbol *symbol);
-@end example
-@findex bfd_is_undefined_symclass
-@subsubsection @code{bfd_is_undefined_symclass}
-@strong{Description}@*
-Returns non-zero if the class symbol returned by
-bfd_decode_symclass represents an undefined symbol.
-Returns zero otherwise.
-
-@strong{Synopsis}
-@example
-bfd_boolean bfd_is_undefined_symclass (int symclass);
-@end example
-@findex bfd_symbol_info
-@subsubsection @code{bfd_symbol_info}
-@strong{Description}@*
-Fill in the basic info about symbol that nm needs.
-Additional info may be added by the back-ends after
-calling this function.
-
-@strong{Synopsis}
-@example
-void bfd_symbol_info (asymbol *symbol, symbol_info *ret);
-@end example
-@findex bfd_copy_private_symbol_data
-@subsubsection @code{bfd_copy_private_symbol_data}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_copy_private_symbol_data
- (bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym);
-@end example
-@strong{Description}@*
-Copy private symbol information from @var{isym} in the BFD
-@var{ibfd} to the symbol @var{osym} in the BFD @var{obfd}.
-Return @code{TRUE} on success, @code{FALSE} on error. Possible error
-returns are:
-
-@itemize @bullet
-
-@item
-@code{bfd_error_no_memory} -
-Not enough memory exists to create private data for @var{osec}.
-@end itemize
-@example
-#define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \
- BFD_SEND (obfd, _bfd_copy_private_symbol_data, \
- (ibfd, isymbol, obfd, osymbol))
-
-@end example
-
diff --git a/bfd/doc/targets.texi b/bfd/doc/targets.texi
deleted file mode 100644
index a85c84911080..000000000000
--- a/bfd/doc/targets.texi
+++ /dev/null
@@ -1,551 +0,0 @@
-@section Targets
-
-
-@strong{Description}@*
-Each port of BFD to a different machine requires the creation
-of a target back end. All the back end provides to the root
-part of BFD is a structure containing pointers to functions
-which perform certain low level operations on files. BFD
-translates the applications's requests through a pointer into
-calls to the back end routines.
-
-When a file is opened with @code{bfd_openr}, its format and
-target are unknown. BFD uses various mechanisms to determine
-how to interpret the file. The operations performed are:
-
-@itemize @bullet
-
-@item
-Create a BFD by calling the internal routine
-@code{_bfd_new_bfd}, then call @code{bfd_find_target} with the
-target string supplied to @code{bfd_openr} and the new BFD pointer.
-
-@item
-If a null target string was provided to @code{bfd_find_target},
-look up the environment variable @code{GNUTARGET} and use
-that as the target string.
-
-@item
-If the target string is still @code{NULL}, or the target string is
-@code{default}, then use the first item in the target vector
-as the target type, and set @code{target_defaulted} in the BFD to
-cause @code{bfd_check_format} to loop through all the targets.
-@xref{bfd_target}. @xref{Formats}.
-
-@item
-Otherwise, inspect the elements in the target vector
-one by one, until a match on target name is found. When found,
-use it.
-
-@item
-Otherwise return the error @code{bfd_error_invalid_target} to
-@code{bfd_openr}.
-
-@item
-@code{bfd_openr} attempts to open the file using
-@code{bfd_open_file}, and returns the BFD.
-@end itemize
-Once the BFD has been opened and the target selected, the file
-format may be determined. This is done by calling
-@code{bfd_check_format} on the BFD with a suggested format.
-If @code{target_defaulted} has been set, each possible target
-type is tried to see if it recognizes the specified format.
-@code{bfd_check_format} returns @code{TRUE} when the caller guesses right.
-@menu
-* bfd_target::
-@end menu
-
-@node bfd_target, , Targets, Targets
-
-@subsection bfd_target
-
-
-@strong{Description}@*
-This structure contains everything that BFD knows about a
-target. It includes things like its byte order, name, and which
-routines to call to do various operations.
-
-Every BFD points to a target structure with its @code{xvec}
-member.
-
-The macros below are used to dispatch to functions through the
-@code{bfd_target} vector. They are used in a number of macros further
-down in @file{bfd.h}, and are also used when calling various
-routines by hand inside the BFD implementation. The @var{arglist}
-argument must be parenthesized; it contains all the arguments
-to the called function.
-
-They make the documentation (more) unpleasant to read, so if
-someone wants to fix this and not break the above, please do.
-@example
-#define BFD_SEND(bfd, message, arglist) \
- ((*((bfd)->xvec->message)) arglist)
-
-#ifdef DEBUG_BFD_SEND
-#undef BFD_SEND
-#define BFD_SEND(bfd, message, arglist) \
- (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
- ((*((bfd)->xvec->message)) arglist) : \
- (bfd_assert (__FILE__,__LINE__), NULL))
-#endif
-@end example
-For operations which index on the BFD format:
-@example
-#define BFD_SEND_FMT(bfd, message, arglist) \
- (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist)
-
-#ifdef DEBUG_BFD_SEND
-#undef BFD_SEND_FMT
-#define BFD_SEND_FMT(bfd, message, arglist) \
- (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
- (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) : \
- (bfd_assert (__FILE__,__LINE__), NULL))
-#endif
-
-@end example
-This is the structure which defines the type of BFD this is. The
-@code{xvec} member of the struct @code{bfd} itself points here. Each
-module that implements access to a different target under BFD,
-defines one of these.
-
-FIXME, these names should be rationalised with the names of
-the entry points which call them. Too bad we can't have one
-macro to define them both!
-@example
-enum bfd_flavour
-@{
- bfd_target_unknown_flavour,
- bfd_target_aout_flavour,
- bfd_target_coff_flavour,
- bfd_target_ecoff_flavour,
- bfd_target_xcoff_flavour,
- bfd_target_elf_flavour,
- bfd_target_ieee_flavour,
- bfd_target_nlm_flavour,
- bfd_target_oasys_flavour,
- bfd_target_tekhex_flavour,
- bfd_target_srec_flavour,
- bfd_target_ihex_flavour,
- bfd_target_som_flavour,
- bfd_target_os9k_flavour,
- bfd_target_versados_flavour,
- bfd_target_msdos_flavour,
- bfd_target_ovax_flavour,
- bfd_target_evax_flavour,
- bfd_target_mmo_flavour,
- bfd_target_mach_o_flavour,
- bfd_target_pef_flavour,
- bfd_target_pef_xlib_flavour,
- bfd_target_sym_flavour
-@};
-
-enum bfd_endian @{ BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN @};
-
-/* Forward declaration. */
-typedef struct bfd_link_info _bfd_link_info;
-
-typedef struct bfd_target
-@{
- /* Identifies the kind of target, e.g., SunOS4, Ultrix, etc. */
- char *name;
-
- /* The "flavour" of a back end is a general indication about
- the contents of a file. */
- enum bfd_flavour flavour;
-
- /* The order of bytes within the data area of a file. */
- enum bfd_endian byteorder;
-
- /* The order of bytes within the header parts of a file. */
- enum bfd_endian header_byteorder;
-
- /* A mask of all the flags which an executable may have set -
- from the set @code{BFD_NO_FLAGS}, @code{HAS_RELOC}, ...@code{D_PAGED}. */
- flagword object_flags;
-
- /* A mask of all the flags which a section may have set - from
- the set @code{SEC_NO_FLAGS}, @code{SEC_ALLOC}, ...@code{SET_NEVER_LOAD}. */
- flagword section_flags;
-
- /* The character normally found at the front of a symbol.
- (if any), perhaps `_'. */
- char symbol_leading_char;
-
- /* The pad character for file names within an archive header. */
- char ar_pad_char;
-
- /* The maximum number of characters in an archive header. */
- unsigned short ar_max_namelen;
-
- /* Entries for byte swapping for data. These are different from the
- other entry points, since they don't take a BFD as the first argument.
- Certain other handlers could do the same. */
- bfd_uint64_t (*bfd_getx64) (const void *);
- bfd_int64_t (*bfd_getx_signed_64) (const void *);
- void (*bfd_putx64) (bfd_uint64_t, void *);
- bfd_vma (*bfd_getx32) (const void *);
- bfd_signed_vma (*bfd_getx_signed_32) (const void *);
- void (*bfd_putx32) (bfd_vma, void *);
- bfd_vma (*bfd_getx16) (const void *);
- bfd_signed_vma (*bfd_getx_signed_16) (const void *);
- void (*bfd_putx16) (bfd_vma, void *);
-
- /* Byte swapping for the headers. */
- bfd_uint64_t (*bfd_h_getx64) (const void *);
- bfd_int64_t (*bfd_h_getx_signed_64) (const void *);
- void (*bfd_h_putx64) (bfd_uint64_t, void *);
- bfd_vma (*bfd_h_getx32) (const void *);
- bfd_signed_vma (*bfd_h_getx_signed_32) (const void *);
- void (*bfd_h_putx32) (bfd_vma, void *);
- bfd_vma (*bfd_h_getx16) (const void *);
- bfd_signed_vma (*bfd_h_getx_signed_16) (const void *);
- void (*bfd_h_putx16) (bfd_vma, void *);
-
- /* Format dependent routines: these are vectors of entry points
- within the target vector structure, one for each format to check. */
-
- /* Check the format of a file being read. Return a @code{bfd_target *} or zero. */
- const struct bfd_target *(*_bfd_check_format[bfd_type_end]) (bfd *);
-
- /* Set the format of a file being written. */
- bfd_boolean (*_bfd_set_format[bfd_type_end]) (bfd *);
-
- /* Write cached information into a file being written, at @code{bfd_close}. */
- bfd_boolean (*_bfd_write_contents[bfd_type_end]) (bfd *);
-
-@end example
-The general target vector. These vectors are initialized using the
-BFD_JUMP_TABLE macros.
-@example
-
- /* Generic entry points. */
-#define BFD_JUMP_TABLE_GENERIC(NAME) \
- NAME##_close_and_cleanup, \
- NAME##_bfd_free_cached_info, \
- NAME##_new_section_hook, \
- NAME##_get_section_contents, \
- NAME##_get_section_contents_in_window
-
- /* Called when the BFD is being closed to do any necessary cleanup. */
- bfd_boolean (*_close_and_cleanup) (bfd *);
- /* Ask the BFD to free all cached information. */
- bfd_boolean (*_bfd_free_cached_info) (bfd *);
- /* Called when a new section is created. */
- bfd_boolean (*_new_section_hook) (bfd *, sec_ptr);
- /* Read the contents of a section. */
- bfd_boolean (*_bfd_get_section_contents)
- (bfd *, sec_ptr, void *, file_ptr, bfd_size_type);
- bfd_boolean (*_bfd_get_section_contents_in_window)
- (bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type);
-
- /* Entry points to copy private data. */
-#define BFD_JUMP_TABLE_COPY(NAME) \
- NAME##_bfd_copy_private_bfd_data, \
- NAME##_bfd_merge_private_bfd_data, \
- _bfd_generic_init_private_section_data, \
- NAME##_bfd_copy_private_section_data, \
- NAME##_bfd_copy_private_symbol_data, \
- NAME##_bfd_copy_private_header_data, \
- NAME##_bfd_set_private_flags, \
- NAME##_bfd_print_private_bfd_data
-
- /* Called to copy BFD general private data from one object file
- to another. */
- bfd_boolean (*_bfd_copy_private_bfd_data) (bfd *, bfd *);
- /* Called to merge BFD general private data from one object file
- to a common output file when linking. */
- bfd_boolean (*_bfd_merge_private_bfd_data) (bfd *, bfd *);
- /* Called to initialize BFD private section data from one object file
- to another. */
-#define bfd_init_private_section_data(ibfd, isec, obfd, osec, link_info) \
- BFD_SEND (obfd, _bfd_init_private_section_data, (ibfd, isec, obfd, osec, link_info))
- bfd_boolean (*_bfd_init_private_section_data)
- (bfd *, sec_ptr, bfd *, sec_ptr, struct bfd_link_info *);
- /* Called to copy BFD private section data from one object file
- to another. */
- bfd_boolean (*_bfd_copy_private_section_data)
- (bfd *, sec_ptr, bfd *, sec_ptr);
- /* Called to copy BFD private symbol data from one symbol
- to another. */
- bfd_boolean (*_bfd_copy_private_symbol_data)
- (bfd *, asymbol *, bfd *, asymbol *);
- /* Called to copy BFD private header data from one object file
- to another. */
- bfd_boolean (*_bfd_copy_private_header_data)
- (bfd *, bfd *);
- /* Called to set private backend flags. */
- bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword);
-
- /* Called to print private BFD data. */
- bfd_boolean (*_bfd_print_private_bfd_data) (bfd *, void *);
-
- /* Core file entry points. */
-#define BFD_JUMP_TABLE_CORE(NAME) \
- NAME##_core_file_failing_command, \
- NAME##_core_file_failing_signal, \
- NAME##_core_file_matches_executable_p
-
- char * (*_core_file_failing_command) (bfd *);
- int (*_core_file_failing_signal) (bfd *);
- bfd_boolean (*_core_file_matches_executable_p) (bfd *, bfd *);
-
- /* Archive entry points. */
-#define BFD_JUMP_TABLE_ARCHIVE(NAME) \
- NAME##_slurp_armap, \
- NAME##_slurp_extended_name_table, \
- NAME##_construct_extended_name_table, \
- NAME##_truncate_arname, \
- NAME##_write_armap, \
- NAME##_read_ar_hdr, \
- NAME##_openr_next_archived_file, \
- NAME##_get_elt_at_index, \
- NAME##_generic_stat_arch_elt, \
- NAME##_update_armap_timestamp
-
- bfd_boolean (*_bfd_slurp_armap) (bfd *);
- bfd_boolean (*_bfd_slurp_extended_name_table) (bfd *);
- bfd_boolean (*_bfd_construct_extended_name_table)
- (bfd *, char **, bfd_size_type *, const char **);
- void (*_bfd_truncate_arname) (bfd *, const char *, char *);
- bfd_boolean (*write_armap)
- (bfd *, unsigned int, struct orl *, unsigned int, int);
- void * (*_bfd_read_ar_hdr_fn) (bfd *);
- bfd * (*openr_next_archived_file) (bfd *, bfd *);
-#define bfd_get_elt_at_index(b,i) BFD_SEND (b, _bfd_get_elt_at_index, (b,i))
- bfd * (*_bfd_get_elt_at_index) (bfd *, symindex);
- int (*_bfd_stat_arch_elt) (bfd *, struct stat *);
- bfd_boolean (*_bfd_update_armap_timestamp) (bfd *);
-
- /* Entry points used for symbols. */
-#define BFD_JUMP_TABLE_SYMBOLS(NAME) \
- NAME##_get_symtab_upper_bound, \
- NAME##_canonicalize_symtab, \
- NAME##_make_empty_symbol, \
- NAME##_print_symbol, \
- NAME##_get_symbol_info, \
- NAME##_bfd_is_local_label_name, \
- NAME##_bfd_is_target_special_symbol, \
- NAME##_get_lineno, \
- NAME##_find_nearest_line, \
- _bfd_generic_find_line, \
- NAME##_find_inliner_info, \
- NAME##_bfd_make_debug_symbol, \
- NAME##_read_minisymbols, \
- NAME##_minisymbol_to_symbol
-
- 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 *);
- bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *);
- alent * (*_get_lineno) (bfd *, struct bfd_symbol *);
- bfd_boolean (*_bfd_find_nearest_line)
- (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma,
- const char **, const char **, unsigned int *);
- bfd_boolean (*_bfd_find_line)
- (bfd *, struct bfd_symbol **, struct bfd_symbol *,
- const char **, unsigned int *);
- bfd_boolean (*_bfd_find_inliner_info)
- (bfd *, const char **, const char **, unsigned int *);
- /* Back-door to allow format-aware applications to create debug symbols
- while using BFD for everything else. Currently used by the assembler
- when creating COFF files. */
- asymbol * (*_bfd_make_debug_symbol)
- (bfd *, void *, unsigned long size);
-#define bfd_read_minisymbols(b, d, m, s) \
- BFD_SEND (b, _read_minisymbols, (b, d, m, s))
- long (*_read_minisymbols)
- (bfd *, bfd_boolean, void **, unsigned int *);
-#define bfd_minisymbol_to_symbol(b, d, m, f) \
- BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f))
- asymbol * (*_minisymbol_to_symbol)
- (bfd *, bfd_boolean, const void *, asymbol *);
-
- /* Routines for relocs. */
-#define BFD_JUMP_TABLE_RELOCS(NAME) \
- NAME##_get_reloc_upper_bound, \
- NAME##_canonicalize_reloc, \
- NAME##_bfd_reloc_type_lookup
-
- long (*_get_reloc_upper_bound) (bfd *, sec_ptr);
- long (*_bfd_canonicalize_reloc)
- (bfd *, sec_ptr, arelent **, struct bfd_symbol **);
- /* See documentation on reloc types. */
- reloc_howto_type *
- (*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
-
- /* Routines used when writing an object file. */
-#define BFD_JUMP_TABLE_WRITE(NAME) \
- NAME##_set_arch_mach, \
- NAME##_set_section_contents
-
- bfd_boolean (*_bfd_set_arch_mach)
- (bfd *, enum bfd_architecture, unsigned long);
- bfd_boolean (*_bfd_set_section_contents)
- (bfd *, sec_ptr, const void *, file_ptr, bfd_size_type);
-
- /* Routines used by the linker. */
-#define BFD_JUMP_TABLE_LINK(NAME) \
- NAME##_sizeof_headers, \
- NAME##_bfd_get_relocated_section_contents, \
- NAME##_bfd_relax_section, \
- NAME##_bfd_link_hash_table_create, \
- NAME##_bfd_link_hash_table_free, \
- NAME##_bfd_link_add_symbols, \
- NAME##_bfd_link_just_syms, \
- NAME##_bfd_final_link, \
- NAME##_bfd_link_split_section, \
- NAME##_bfd_gc_sections, \
- NAME##_bfd_merge_sections, \
- NAME##_bfd_is_group_section, \
- NAME##_bfd_discard_group, \
- NAME##_section_already_linked \
-
- int (*_bfd_sizeof_headers) (bfd *, bfd_boolean);
- bfd_byte * (*_bfd_get_relocated_section_contents)
- (bfd *, struct bfd_link_info *, struct bfd_link_order *,
- bfd_byte *, bfd_boolean, struct bfd_symbol **);
-
- bfd_boolean (*_bfd_relax_section)
- (bfd *, struct bfd_section *, struct bfd_link_info *, bfd_boolean *);
-
- /* Create a hash table for the linker. Different backends store
- different information in this table. */
- struct bfd_link_hash_table *
- (*_bfd_link_hash_table_create) (bfd *);
-
- /* Release the memory associated with the linker hash table. */
- void (*_bfd_link_hash_table_free) (struct bfd_link_hash_table *);
-
- /* Add symbols from this object file into the hash table. */
- bfd_boolean (*_bfd_link_add_symbols) (bfd *, struct bfd_link_info *);
-
- /* Indicate that we are only retrieving symbol values from this section. */
- void (*_bfd_link_just_syms) (asection *, struct bfd_link_info *);
-
- /* Do a link based on the link_order structures attached to each
- section of the BFD. */
- bfd_boolean (*_bfd_final_link) (bfd *, struct bfd_link_info *);
-
- /* Should this section be split up into smaller pieces during linking. */
- bfd_boolean (*_bfd_link_split_section) (bfd *, struct bfd_section *);
-
- /* Remove sections that are not referenced from the output. */
- bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *);
-
- /* Attempt to merge SEC_MERGE sections. */
- bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *);
-
- /* Is this section a member of a group? */
- bfd_boolean (*_bfd_is_group_section) (bfd *, const struct bfd_section *);
-
- /* Discard members of a group. */
- bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *);
-
- /* Check if SEC has been already linked during a reloceatable or
- final link. */
- void (*_section_already_linked) (bfd *, struct bfd_section *);
-
- /* Routines to handle dynamic symbols and relocs. */
-#define BFD_JUMP_TABLE_DYNAMIC(NAME) \
- NAME##_get_dynamic_symtab_upper_bound, \
- NAME##_canonicalize_dynamic_symtab, \
- NAME##_get_synthetic_symtab, \
- NAME##_get_dynamic_reloc_upper_bound, \
- NAME##_canonicalize_dynamic_reloc
-
- /* Get the amount of memory required to hold the dynamic symbols. */
- long (*_bfd_get_dynamic_symtab_upper_bound) (bfd *);
- /* Read in the dynamic symbols. */
- long (*_bfd_canonicalize_dynamic_symtab)
- (bfd *, struct bfd_symbol **);
- /* Create synthetized symbols. */
- long (*_bfd_get_synthetic_symtab)
- (bfd *, long, struct bfd_symbol **, long, struct bfd_symbol **,
- struct bfd_symbol **);
- /* Get the amount of memory required to hold the dynamic relocs. */
- long (*_bfd_get_dynamic_reloc_upper_bound) (bfd *);
- /* Read in the dynamic relocs. */
- long (*_bfd_canonicalize_dynamic_reloc)
- (bfd *, arelent **, struct bfd_symbol **);
-
-@end example
-A pointer to an alternative bfd_target in case the current one is not
-satisfactory. This can happen when the target cpu supports both big
-and little endian code, and target chosen by the linker has the wrong
-endianness. The function open_output() in ld/ldlang.c uses this field
-to find an alternative output format that is suitable.
-@example
- /* Opposite endian version of this target. */
- const struct bfd_target * alternative_target;
-
- /* Data for use by back-end routines, which isn't
- generic enough to belong in this structure. */
- const void *backend_data;
-
-@} bfd_target;
-
-@end example
-
-@findex bfd_set_default_target
-@subsubsection @code{bfd_set_default_target}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_set_default_target (const char *name);
-@end example
-@strong{Description}@*
-Set the default target vector to use when recognizing a BFD.
-This takes the name of the target, which may be a BFD target
-name or a configuration triplet.
-
-@findex bfd_find_target
-@subsubsection @code{bfd_find_target}
-@strong{Synopsis}
-@example
-const bfd_target *bfd_find_target (const char *target_name, bfd *abfd);
-@end example
-@strong{Description}@*
-Return a pointer to the transfer vector for the object target
-named @var{target_name}. If @var{target_name} is @code{NULL}, choose the
-one in the environment variable @code{GNUTARGET}; if that is null or not
-defined, then choose the first entry in the target list.
-Passing in the string "default" or setting the environment
-variable to "default" will cause the first entry in the target
-list to be returned, and "target_defaulted" will be set in the
-BFD. This causes @code{bfd_check_format} to loop over all the
-targets to find the one that matches the file being read.
-
-@findex bfd_target_list
-@subsubsection @code{bfd_target_list}
-@strong{Synopsis}
-@example
-const char ** bfd_target_list (void);
-@end example
-@strong{Description}@*
-Return a freshly malloced NULL-terminated
-vector of the names of all the valid BFD targets. Do not
-modify the names.
-
-@findex bfd_seach_for_target
-@subsubsection @code{bfd_seach_for_target}
-@strong{Synopsis}
-@example
-const bfd_target *bfd_search_for_target
- (int (*search_func) (const bfd_target *, void *),
- void *);
-@end example
-@strong{Description}@*
-Return a pointer to the first transfer vector in the list of
-transfer vectors maintained by BFD that produces a non-zero
-result when passed to the function @var{search_func}. The
-parameter @var{data} is passed, unexamined, to the search
-function.
-
diff --git a/bfd/dwarf1.c b/bfd/dwarf1.c
index 5d6c1e359e51..d722df37152e 100644
--- a/bfd/dwarf1.c
+++ b/bfd/dwarf1.c
@@ -1,5 +1,5 @@
/* DWARF 1 find nearest line (_bfd_dwarf1_find_nearest_line).
- Copyright 1998, 1999, 2000, 2001, 2002, 2004, 2005
+ Copyright 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2007
Free Software Foundation, Inc.
Written by Gavin Romig-Koch of Cygnus Solutions (gavin@cygnus.com).
@@ -20,8 +20,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libiberty.h"
#include "libbfd.h"
#include "elf-bfd.h"
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index ae68d1886818..411a7154b5eb 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -1,6 +1,6 @@
/* DWARF 2 support.
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005, 2006 Free Software Foundation, Inc.
+ 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Adapted from gdb/dwarf2read.c by Gavin Koch of Cygnus Solutions
(gavin@cygnus.com).
@@ -29,8 +29,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libiberty.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -93,8 +93,10 @@ struct dwarf2_debug
/* Pointer to the end of the .debug_info section memory buffer. */
bfd_byte *info_ptr_end;
- /* Pointer to the section and address of the beginning of the
- section. */
+ /* Pointer to the bfd, section and address of the beginning of the
+ section. The bfd might be different than expected because of
+ gnu_debuglink sections. */
+ bfd * bfd;
asection *sec;
bfd_byte *sec_info_ptr;
@@ -874,24 +876,45 @@ concat_filename (struct line_info_table *table, unsigned int file)
filename = table->files[file - 1].name;
- if (! IS_ABSOLUTE_PATH (filename))
+ if (!IS_ABSOLUTE_PATH (filename))
{
- char *dirname = (table->files[file - 1].dir
- ? table->dirs[table->files[file - 1].dir - 1]
- : table->comp_dir);
+ char *dirname = NULL;
+ char *subdirname = NULL;
+ char *name;
+ size_t len;
+
+ if (table->files[file - 1].dir)
+ subdirname = table->dirs[table->files[file - 1].dir - 1];
+
+ if (!subdirname || !IS_ABSOLUTE_PATH (subdirname))
+ dirname = table->comp_dir;
- /* Not all tools set DW_AT_comp_dir, so dirname may be unknown.
- The best we can do is return the filename part. */
- if (dirname != NULL)
+ if (!dirname)
{
- unsigned int len = strlen (dirname) + strlen (filename) + 2;
- char * name;
+ dirname = subdirname;
+ subdirname = NULL;
+ }
+
+ if (!dirname)
+ return strdup (filename);
+ len = strlen (dirname) + strlen (filename) + 2;
+
+ if (subdirname)
+ {
+ len += strlen (subdirname) + 1;
+ name = bfd_malloc (len);
+ if (name)
+ sprintf (name, "%s/%s/%s", dirname, subdirname, filename);
+ }
+ else
+ {
name = bfd_malloc (len);
if (name)
sprintf (name, "%s/%s", dirname, filename);
- return name;
}
+
+ return name;
}
return strdup (filename);
@@ -1117,7 +1140,6 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
unsigned int line = 1;
unsigned int column = 0;
int is_stmt = lh.default_is_stmt;
- int basic_block = 0;
int end_sequence = 0;
/* eraxxon@alumni.rice.edu: Against the DWARF2 specs, some
compilers generate address sequences that are wildly out of
@@ -1142,7 +1164,6 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
line += lh.line_base + (adj_opcode % lh.line_range);
/* Append row to matrix using current values. */
add_line_info (table, address, filename, line, column, 0);
- basic_block = 1;
if (address < low_pc)
low_pc = address;
if (address > high_pc)
@@ -1214,7 +1235,6 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
break;
case DW_LNS_copy:
add_line_info (table, address, filename, line, column, 0);
- basic_block = 0;
if (address < low_pc)
low_pc = address;
if (address > high_pc)
@@ -1250,7 +1270,6 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
is_stmt = (!is_stmt);
break;
case DW_LNS_set_basic_block:
- basic_block = 1;
break;
case DW_LNS_const_add_pc:
address += lh.minimum_instruction_length
@@ -1625,7 +1644,7 @@ read_rangelist (struct comp_unit *unit, struct arange *arange, bfd_uint64_t offs
if (low_pc == -1UL && high_pc != -1UL)
base_address = high_pc;
else
- arange_add (unit->abfd, arange, base_address + low_pc, base_address + high_pc);
+ arange_add (unit->abfd, arange, base_address + low_pc, base_address + high_pc);
}
}
@@ -1871,8 +1890,7 @@ scan_unit_for_symbols (struct comp_unit *unit)
to get to the line number information for the compilation unit. */
static struct comp_unit *
-parse_comp_unit (bfd *abfd,
- struct dwarf2_debug *stash,
+parse_comp_unit (struct dwarf2_debug *stash,
bfd_vma unit_length,
bfd_byte *info_ptr_unit,
unsigned int offset_size)
@@ -1890,6 +1908,7 @@ parse_comp_unit (bfd *abfd,
bfd_size_type amt;
bfd_vma low_pc = 0;
bfd_vma high_pc = 0;
+ bfd *abfd = stash->bfd;
version = read_2_bytes (abfd, info_ptr);
info_ptr += 2;
@@ -2175,17 +2194,14 @@ find_debug_info (bfd *abfd, asection *after_sec)
{
asection * msec;
- if (after_sec)
- msec = after_sec->next;
- else
- msec = abfd->sections;
+ msec = after_sec != NULL ? after_sec->next : abfd->sections;
while (msec)
{
if (strcmp (msec->name, DWARF2_DEBUG_INFO) == 0)
return msec;
- if (strncmp (msec->name, GNU_LINKONCE_INFO, strlen (GNU_LINKONCE_INFO)) == 0)
+ if (CONST_STRNEQ (msec->name, GNU_LINKONCE_INFO))
return msec;
msec = msec->next;
@@ -2285,22 +2301,28 @@ place_sections (bfd *abfd, struct dwarf2_debug *stash)
return TRUE;
}
-/* 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. */
+/* Find the source code location of SYMBOL. If SYMBOL is NULL
+ then find the nearest source code location corresponding to
+ the address SECTION + OFFSET.
+ Returns TRUE if the line is found without error and fills in
+ FILENAME_PTR and LINENUMBER_PTR. In the case where SYMBOL was
+ NULL the FUNCTIONNAME_PTR is also filled in.
+ SYMBOLS contains the symbol table for ABFD.
+ ADDR_SIZE is the number of bytes in the initial .debug_info length
+ field and in the abbreviation offset, or zero to indicate that the
+ default value should be used. */
-bfd_boolean
-_bfd_dwarf2_find_nearest_line (bfd *abfd,
- asection *section,
- asymbol **symbols,
- bfd_vma offset,
- const char **filename_ptr,
- const char **functionname_ptr,
- unsigned int *linenumber_ptr,
- unsigned int addr_size,
- void **pinfo)
+static bfd_boolean
+find_line (bfd *abfd,
+ asection *section,
+ bfd_vma offset,
+ asymbol *symbol,
+ asymbol **symbols,
+ const char **filename_ptr,
+ const char **functionname_ptr,
+ unsigned int *linenumber_ptr,
+ unsigned int addr_size,
+ void **pinfo)
{
/* Read each compilation unit from the section .debug_info, and check
to see if it contains the address we are searching for. If yes,
@@ -2311,13 +2333,11 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd,
a pointer to the next un-read compilation unit. Check the
previously read units before reading more. */
struct dwarf2_debug *stash;
-
/* What address are we looking for? */
bfd_vma addr;
-
struct comp_unit* each;
-
bfd_vma found = FALSE;
+ bfd_boolean do_line;
stash = *pinfo;
@@ -2338,7 +2358,22 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd,
return FALSE;
}
- addr = offset;
+ do_line = (section == NULL
+ && offset == 0
+ && functionname_ptr == NULL
+ && symbol != NULL);
+ if (do_line)
+ {
+ addr = symbol->value;
+ section = bfd_get_section (symbol);
+ }
+ else if (section != NULL
+ && functionname_ptr != NULL
+ && symbol == NULL)
+ addr = offset;
+ else
+ abort ();
+
if (section->output_section)
addr += section->output_section->vma + section->output_offset;
else
@@ -2347,260 +2382,57 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd,
*functionname_ptr = NULL;
*linenumber_ptr = 0;
- /* The DWARF2 spec says that the initial length field, and the
- offset of the abbreviation table, should both be 4-byte values.
- However, some compilers do things differently. */
- if (addr_size == 0)
- addr_size = 4;
- BFD_ASSERT (addr_size == 4 || addr_size == 8);
-
if (! *pinfo)
{
+ bfd *debug_bfd;
bfd_size_type total_size;
asection *msec;
*pinfo = stash;
msec = find_debug_info (abfd, NULL);
- if (! msec)
- /* No dwarf2 info. Note that at this point the stash
- has been allocated, but contains zeros, this lets
- future calls to this function fail quicker. */
- goto done;
-
- /* There can be more than one DWARF2 info section in a BFD these days.
- Read them all in and produce one large stash. We do this in two
- passes - in the first pass we just accumulate the section sizes.
- In the second pass we read in the section's contents. The allows
- us to avoid reallocing the data as we add sections to the stash. */
- for (total_size = 0; msec; msec = find_debug_info (abfd, msec))
- total_size += msec->size;
-
- stash->info_ptr = bfd_alloc (abfd, total_size);
- if (stash->info_ptr == NULL)
- goto done;
-
- stash->info_ptr_end = stash->info_ptr;
-
- for (msec = find_debug_info (abfd, NULL);
- msec;
- msec = find_debug_info (abfd, msec))
- {
- bfd_size_type size;
- bfd_size_type start;
-
- size = msec->size;
- if (size == 0)
- continue;
-
- start = stash->info_ptr_end - stash->info_ptr;
-
- if ((bfd_simple_get_relocated_section_contents
- (abfd, msec, stash->info_ptr + start, symbols)) == NULL)
- continue;
-
- stash->info_ptr_end = stash->info_ptr + start + size;
- }
-
- BFD_ASSERT (stash->info_ptr_end == stash->info_ptr + total_size);
-
- stash->sec = find_debug_info (abfd, NULL);
- stash->sec_info_ptr = stash->info_ptr;
- stash->syms = symbols;
- }
-
- /* A null info_ptr indicates that there is no dwarf2 info
- (or that an error occured while setting up the stash). */
- if (! stash->info_ptr)
- goto done;
-
- stash->inliner_chain = NULL;
-
- /* Check the previously read comp. units first. */
- for (each = stash->all_comp_units; each; each = each->next_unit)
- if (comp_unit_contains_address (each, addr)
- && comp_unit_find_nearest_line (each, addr, filename_ptr,
- functionname_ptr,
- linenumber_ptr, stash))
- {
- found = TRUE;
- goto done;
- }
-
- /* Read each remaining comp. units checking each as they are read. */
- while (stash->info_ptr < stash->info_ptr_end)
- {
- bfd_vma length;
- unsigned int offset_size = addr_size;
- bfd_byte *info_ptr_unit = stash->info_ptr;
-
- length = read_4_bytes (abfd, stash->info_ptr);
- /* A 0xffffff length is the DWARF3 way of indicating we use
- 64-bit offsets, instead of 32-bit offsets. */
- if (length == 0xffffffff)
- {
- offset_size = 8;
- length = read_8_bytes (abfd, stash->info_ptr + 4);
- stash->info_ptr += 12;
- }
- /* A zero length is the IRIX way of indicating 64-bit offsets,
- mostly because the 64-bit length will generally fit in 32
- bits, and the endianness helps. */
- else if (length == 0)
+ if (msec == NULL)
{
- offset_size = 8;
- length = read_4_bytes (abfd, stash->info_ptr + 4);
- stash->info_ptr += 8;
- }
- /* In the absence of the hints above, we assume addr_size-sized
- offsets, for backward-compatibility with pre-DWARF3 64-bit
- platforms. */
- else if (addr_size == 8)
- {
- length = read_8_bytes (abfd, stash->info_ptr);
- stash->info_ptr += 8;
- }
- else
- stash->info_ptr += 4;
-
- if (length > 0)
- {
- each = parse_comp_unit (abfd, stash, length, info_ptr_unit,
- offset_size);
- stash->info_ptr += length;
-
- if ((bfd_vma) (stash->info_ptr - stash->sec_info_ptr)
- == stash->sec->size)
+ char * debug_filename = bfd_follow_gnu_debuglink (abfd, DEBUGDIR);
+
+ if (debug_filename == NULL)
+ /* No dwarf2 info, and no gnu_debuglink to follow.
+ Note that at this point the stash has been allocated, but
+ contains zeros. This lets future calls to this function
+ fail more quickly. */
+ goto done;
+
+ if ((debug_bfd = bfd_openr (debug_filename, NULL)) == NULL
+ || ! bfd_check_format (debug_bfd, bfd_object)
+ || (msec = find_debug_info (debug_bfd, NULL)) == NULL)
{
- stash->sec = find_debug_info (abfd, stash->sec);
- stash->sec_info_ptr = stash->info_ptr;
- }
-
- if (each)
- {
- each->next_unit = stash->all_comp_units;
- stash->all_comp_units = each;
-
- /* DW_AT_low_pc and DW_AT_high_pc are optional for
- compilation units. If we don't have them (i.e.,
- unit->high == 0), we need to consult the line info
- table to see if a compilation unit contains the given
- address. */
- if ((each->arange.high == 0
- || comp_unit_contains_address (each, addr))
- && comp_unit_find_nearest_line (each, addr,
- filename_ptr,
- functionname_ptr,
- linenumber_ptr,
- stash))
- {
- found = TRUE;
- goto done;
- }
+ if (debug_bfd)
+ bfd_close (debug_bfd);
+ /* FIXME: Should we report our failure to follow the debuglink ? */
+ free (debug_filename);
+ goto done;
}
}
- }
-
-done:
- if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
- unset_sections (stash);
-
- return found;
-}
-
-/* The DWARF2 version of find_line. Return TRUE if the line is found
- without error. */
-
-bfd_boolean
-_bfd_dwarf2_find_line (bfd *abfd,
- asymbol **symbols,
- asymbol *symbol,
- const char **filename_ptr,
- unsigned int *linenumber_ptr,
- unsigned int addr_size,
- void **pinfo)
-{
- /* Read each compilation unit from the section .debug_info, and check
- to see if it contains the address we are searching for. If yes,
- lookup the address, and return the line number info. If no, go
- on to the next compilation unit.
-
- We keep a list of all the previously read compilation units, and
- a pointer to the next un-read compilation unit. Check the
- previously read units before reading more. */
- struct dwarf2_debug *stash;
-
- /* What address are we looking for? */
- bfd_vma addr;
-
- struct comp_unit* each;
-
- asection *section;
-
- bfd_boolean found = FALSE;
-
- section = bfd_get_section (symbol);
-
- stash = *pinfo;
-
- if (! stash)
- {
- bfd_size_type amt = sizeof (struct dwarf2_debug);
-
- stash = bfd_zalloc (abfd, amt);
- if (! stash)
- return FALSE;
- }
-
- /* In a relocatable file, 2 functions may have the same address.
- We change the section vma so that they won't overlap. */
- if (!stash && (abfd->flags & (EXEC_P | DYNAMIC)) == 0)
- {
- if (! place_sections (abfd, stash))
- return FALSE;
- }
-
- addr = symbol->value;
- if (section->output_section)
- addr += section->output_section->vma + section->output_offset;
- else
- addr += section->vma;
-
- *filename_ptr = NULL;
- *filename_ptr = NULL;
- *linenumber_ptr = 0;
-
- if (! *pinfo)
- {
- bfd_size_type total_size;
- asection *msec;
-
- *pinfo = stash;
-
- msec = find_debug_info (abfd, NULL);
- if (! msec)
- /* No dwarf2 info. Note that at this point the stash
- has been allocated, but contains zeros, this lets
- future calls to this function fail quicker. */
- goto done;
+ else
+ debug_bfd = abfd;
/* There can be more than one DWARF2 info section in a BFD these days.
Read them all in and produce one large stash. We do this in two
passes - in the first pass we just accumulate the section sizes.
In the second pass we read in the section's contents. The allows
us to avoid reallocing the data as we add sections to the stash. */
- for (total_size = 0; msec; msec = find_debug_info (abfd, msec))
+ for (total_size = 0; msec; msec = find_debug_info (debug_bfd, msec))
total_size += msec->size;
- stash->info_ptr = bfd_alloc (abfd, total_size);
+ stash->info_ptr = bfd_alloc (debug_bfd, total_size);
if (stash->info_ptr == NULL)
goto done;
stash->info_ptr_end = stash->info_ptr;
- for (msec = find_debug_info (abfd, NULL);
+ for (msec = find_debug_info (debug_bfd, NULL);
msec;
- msec = find_debug_info (abfd, msec))
+ msec = find_debug_info (debug_bfd, msec))
{
bfd_size_type size;
bfd_size_type start;
@@ -2612,7 +2444,7 @@ _bfd_dwarf2_find_line (bfd *abfd,
start = stash->info_ptr_end - stash->info_ptr;
if ((bfd_simple_get_relocated_section_contents
- (abfd, msec, stash->info_ptr + start, symbols)) == NULL)
+ (debug_bfd, msec, stash->info_ptr + start, symbols)) == NULL)
continue;
stash->info_ptr_end = stash->info_ptr + start + size;
@@ -2620,9 +2452,10 @@ _bfd_dwarf2_find_line (bfd *abfd,
BFD_ASSERT (stash->info_ptr_end == stash->info_ptr + total_size);
- stash->sec = find_debug_info (abfd, NULL);
+ stash->sec = find_debug_info (debug_bfd, NULL);
stash->sec_info_ptr = stash->info_ptr;
stash->syms = symbols;
+ stash->bfd = debug_bfd;
}
/* A null info_ptr indicates that there is no dwarf2 info
@@ -2634,14 +2467,23 @@ _bfd_dwarf2_find_line (bfd *abfd,
/* Check the previously read comp. units first. */
for (each = stash->all_comp_units; each; each = each->next_unit)
- if ((symbol->flags & BSF_FUNCTION) == 0
- || comp_unit_contains_address (each, addr))
- {
- found = comp_unit_find_line (each, symbol, addr, filename_ptr,
- linenumber_ptr, stash);
- if (found)
- goto done;
- }
+ {
+ if (do_line)
+ found = (((symbol->flags & BSF_FUNCTION) == 0
+ || comp_unit_contains_address (each, addr))
+ && comp_unit_find_line (each, symbol, addr,
+ filename_ptr, linenumber_ptr,
+ stash));
+ else
+ found = (comp_unit_contains_address (each, addr)
+ && comp_unit_find_nearest_line (each, addr,
+ filename_ptr,
+ functionname_ptr,
+ linenumber_ptr,
+ stash));
+ if (found)
+ goto done;
+ }
/* The DWARF2 spec says that the initial length field, and the
offset of the abbreviation table, should both be 4-byte values.
@@ -2657,13 +2499,13 @@ _bfd_dwarf2_find_line (bfd *abfd,
unsigned int offset_size = addr_size;
bfd_byte *info_ptr_unit = stash->info_ptr;
- length = read_4_bytes (abfd, stash->info_ptr);
- /* A 0xffffff length is the DWARF3 way of indicating we use
- 64-bit offsets, instead of 32-bit offsets. */
+ length = read_4_bytes (stash->bfd, stash->info_ptr);
+ /* A 0xffffff length is the DWARF3 way of indicating
+ we use 64-bit offsets, instead of 32-bit offsets. */
if (length == 0xffffffff)
{
offset_size = 8;
- length = read_8_bytes (abfd, stash->info_ptr + 4);
+ length = read_8_bytes (stash->bfd, stash->info_ptr + 4);
stash->info_ptr += 12;
}
/* A zero length is the IRIX way of indicating 64-bit offsets,
@@ -2672,30 +2514,36 @@ _bfd_dwarf2_find_line (bfd *abfd,
else if (length == 0)
{
offset_size = 8;
- length = read_4_bytes (abfd, stash->info_ptr + 4);
+ length = read_4_bytes (stash->bfd, stash->info_ptr + 4);
stash->info_ptr += 8;
}
- /* In the absence of the hints above, we assume addr_size-sized
- offsets, for backward-compatibility with pre-DWARF3 64-bit
- platforms. */
+ /* In the absence of the hints above, we assume 32-bit DWARF2
+ offsets even for targets with 64-bit addresses, because:
+ a) most of the time these targets will not have generated
+ more than 2Gb of debug info and so will not need 64-bit
+ offsets,
+ and
+ b) if they do use 64-bit offsets but they are not using
+ the size hints that are tested for above then they are
+ not conforming to the DWARF3 standard anyway. */
else if (addr_size == 8)
{
- length = read_8_bytes (abfd, stash->info_ptr);
- stash->info_ptr += 8;
+ offset_size = 4;
+ stash->info_ptr += 4;
}
else
stash->info_ptr += 4;
if (length > 0)
{
- each = parse_comp_unit (abfd, stash, length, info_ptr_unit,
+ each = parse_comp_unit (stash, length, info_ptr_unit,
offset_size);
stash->info_ptr += length;
if ((bfd_vma) (stash->info_ptr - stash->sec_info_ptr)
== stash->sec->size)
{
- stash->sec = find_debug_info (abfd, stash->sec);
+ stash->sec = find_debug_info (stash->bfd, stash->sec);
stash->sec_info_ptr = stash->info_ptr;
}
@@ -2709,13 +2557,22 @@ _bfd_dwarf2_find_line (bfd *abfd,
unit->high == 0), we need to consult the line info
table to see if a compilation unit contains the given
address. */
- found = (((symbol->flags & BSF_FUNCTION) == 0
- || each->arange.high <= 0
- || comp_unit_contains_address (each, addr))
- && comp_unit_find_line (each, symbol, addr,
- filename_ptr,
- linenumber_ptr,
- stash));
+ if (do_line)
+ found = (((symbol->flags & BSF_FUNCTION) == 0
+ || each->arange.high == 0
+ || comp_unit_contains_address (each, addr))
+ && comp_unit_find_line (each, symbol, addr,
+ filename_ptr,
+ linenumber_ptr,
+ stash));
+ else
+ found = ((each->arange.high == 0
+ || comp_unit_contains_address (each, addr))
+ && comp_unit_find_nearest_line (each, addr,
+ filename_ptr,
+ functionname_ptr,
+ linenumber_ptr,
+ stash));
if (found)
goto done;
}
@@ -2729,6 +2586,42 @@ done:
return found;
}
+/* The DWARF2 version of find_nearest_line.
+ Return TRUE if the line is found without error. */
+
+bfd_boolean
+_bfd_dwarf2_find_nearest_line (bfd *abfd,
+ asection *section,
+ asymbol **symbols,
+ bfd_vma offset,
+ const char **filename_ptr,
+ const char **functionname_ptr,
+ unsigned int *linenumber_ptr,
+ unsigned int addr_size,
+ void **pinfo)
+{
+ return find_line (abfd, section, offset, NULL, symbols, filename_ptr,
+ functionname_ptr, linenumber_ptr, addr_size,
+ pinfo);
+}
+
+/* The DWARF2 version of find_line.
+ Return TRUE if the line is found without error. */
+
+bfd_boolean
+_bfd_dwarf2_find_line (bfd *abfd,
+ asymbol **symbols,
+ asymbol *symbol,
+ const char **filename_ptr,
+ unsigned int *linenumber_ptr,
+ unsigned int addr_size,
+ void **pinfo)
+{
+ return find_line (abfd, NULL, 0, symbol, symbols, filename_ptr,
+ NULL, linenumber_ptr, addr_size,
+ pinfo);
+}
+
bfd_boolean
_bfd_dwarf2_find_inliner_info (bfd *abfd ATTRIBUTE_UNUSED,
const char **filename_ptr,
@@ -2742,17 +2635,18 @@ _bfd_dwarf2_find_inliner_info (bfd *abfd ATTRIBUTE_UNUSED,
if (stash)
{
struct funcinfo *func = stash->inliner_chain;
+
if (func && func->caller_func)
{
*filename_ptr = func->caller_file;
*functionname_ptr = func->caller_func->name;
*linenumber_ptr = func->caller_line;
stash->inliner_chain = func->caller_func;
- return (TRUE);
+ return TRUE;
}
}
- return (FALSE);
+ return FALSE;
}
void
diff --git a/bfd/ecoff.c b/bfd/ecoff.c
index 75e1cc2a398d..45cdb1ddb43f 100644
--- a/bfd/ecoff.c
+++ b/bfd/ecoff.c
@@ -1,6 +1,6 @@
/* Generic ECOFF (Extended-COFF) routines.
Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Original version by Per Bothner.
Full support added by Ian Lance Taylor, ian@cygnus.com.
@@ -20,8 +20,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "aout/ar.h"
@@ -140,8 +140,7 @@ _bfd_ecoff_mkobject_hook (bfd *abfd, void * filehdr, void * aouthdr)
/* Initialize a new section. */
bfd_boolean
-_bfd_ecoff_new_section_hook (bfd *abfd ATTRIBUTE_UNUSED,
- asection *section)
+_bfd_ecoff_new_section_hook (bfd *abfd, asection *section)
{
unsigned int i;
static struct
@@ -181,7 +180,7 @@ _bfd_ecoff_new_section_hook (bfd *abfd ATTRIBUTE_UNUSED,
uncertain about .init on some systems and I don't know how shared
libraries work. */
- return TRUE;
+ return _bfd_generic_new_section_hook (abfd, section);
}
/* Determine the machine architecture and type. This is called from
@@ -1863,7 +1862,8 @@ _bfd_ecoff_set_arch_mach (bfd *abfd,
/* Get the size of the section headers. */
int
-_bfd_ecoff_sizeof_headers (bfd *abfd, bfd_boolean reloc ATTRIBUTE_UNUSED)
+_bfd_ecoff_sizeof_headers (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
asection *current;
int c;
@@ -1937,7 +1937,7 @@ ecoff_compute_section_file_positions (bfd *abfd)
const bfd_vma round = ecoff_backend (abfd)->round;
bfd_size_type amt;
- sofar = _bfd_ecoff_sizeof_headers (abfd, FALSE);
+ sofar = _bfd_ecoff_sizeof_headers (abfd, NULL);
file_sofar = sofar;
/* Sort the sections by VMA. */
@@ -2358,7 +2358,7 @@ _bfd_ecoff_write_object_contents (bfd *abfd)
}
if ((abfd->flags & D_PAGED) != 0)
- text_size = _bfd_ecoff_sizeof_headers (abfd, FALSE);
+ text_size = _bfd_ecoff_sizeof_headers (abfd, NULL);
else
text_size = 0;
text_start = 0;
@@ -2861,7 +2861,7 @@ _bfd_ecoff_slurp_armap (bfd *abfd)
bfd_slurp_armap, but that seems inappropriate since no other
target uses this format. Instead, we check directly for a COFF
armap. */
- if (strneq (nextname, "/ ", 16))
+ if (CONST_STRNEQ (nextname, "/ "))
return bfd_slurp_armap (abfd);
/* See if the first element is an armap. */
@@ -3087,7 +3087,7 @@ _bfd_ecoff_write_armap (bfd *abfd,
last_elt = current;
for (i = 0; i < orl_count; i++)
{
- unsigned int hash, rehash;
+ unsigned int hash, rehash = 0;
/* Advance firstreal to the file position of this archive
element. */
@@ -3097,7 +3097,7 @@ _bfd_ecoff_write_armap (bfd *abfd,
{
firstreal += arelt_size (current) + sizeof (struct ar_hdr);
firstreal += firstreal % 2;
- current = current->next;
+ current = current->archive_next;
}
while (current != map[i].u.abfd);
}
@@ -3757,7 +3757,7 @@ ecoff_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info)
while (*pundef != NULL)
{
struct bfd_link_hash_entry *h;
- unsigned int hash, rehash;
+ unsigned int hash, rehash = 0;
unsigned int file_offset;
const char *name;
bfd *element;
diff --git a/bfd/ecofflink.c b/bfd/ecofflink.c
index 4246e94f3937..8ee68e066258 100644
--- a/bfd/ecofflink.c
+++ b/bfd/ecofflink.c
@@ -1,6 +1,6 @@
/* Routines to link ECOFF debugging information.
Copyright 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005, 2006 Free Software Foundation, Inc.
+ 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>.
This file is part of BFD, the Binary File Descriptor library.
@@ -19,8 +19,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "objalloc.h"
@@ -782,7 +782,6 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
fdr_ptr += fdr_add, i++)
{
FDR fdr;
- bfd_vma fdr_adr;
bfd_byte *sym_out;
bfd_byte *lraw_src;
bfd_byte *lraw_end;
@@ -799,8 +798,6 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
else
(*input_swap->swap_fdr_in) (input_bfd, (PTR) fdr_ptr, &fdr);
- fdr_adr = fdr.adr;
-
/* FIXME: It is conceivable that this FDR points to the .init or
.fini section, in which case this will not do the right
thing. */
diff --git a/bfd/efi-app-ia32.c b/bfd/efi-app-ia32.c
index b186f907ce68..06ed80598709 100644
--- a/bfd/efi-app-ia32.c
+++ b/bfd/efi-app-ia32.c
@@ -1,5 +1,5 @@
/* BFD back-end for Intel IA-32 EFI application files.
- Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002, 2007 Free Software Foundation, Inc.
Contributed by David Mosberger <davidm@hpl.hp.com>
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#define TARGET_SYM bfd_efi_app_ia32_vec
#define TARGET_NAME "efi-app-ia32"
diff --git a/bfd/efi-app-ia64.c b/bfd/efi-app-ia64.c
index c2a77aca55b2..b60ca738eda6 100644
--- a/bfd/efi-app-ia64.c
+++ b/bfd/efi-app-ia64.c
@@ -1,5 +1,5 @@
/* BFD back-end for HP/Intel IA-64 EFI application files.
- Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002, 2007 Free Software Foundation, Inc.
Contributed by David Mosberger <davidm@hpl.hp.com>
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#define TARGET_SYM bfd_efi_app_ia64_vec
#define TARGET_NAME "efi-app-ia64"
diff --git a/bfd/efi-app-x86_64.c b/bfd/efi-app-x86_64.c
new file mode 100644
index 000000000000..130ba5409970
--- /dev/null
+++ b/bfd/efi-app-x86_64.c
@@ -0,0 +1,34 @@
+/* BFD back-end for Intel64 UEFI application files.
+ Copyright 2007 Free Software Foundation, Inc.
+
+This file is part of BFD, the Binary File Descriptor library.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "sysdep.h"
+#include "bfd.h"
+
+#define TARGET_SYM bfd_efi_app_x86_64_vec
+#define TARGET_NAME "efi-app-x86_64"
+#define COFF_IMAGE_WITH_PE
+#define COFF_WITH_PE
+#define COFF_WITH_pep
+#define PCRELOFFSET TRUE
+#define TARGET_UNDERSCORE '_'
+#define COFF_LONG_SECTION_NAMES
+#define PEI_TARGET_SUBSYSTEM IMAGE_SUBSYSTEM_EFI_APPLICATION
+#define PEI_FORCE_MINIMUM_ALIGNMENT
+
+#include "coff-x86_64.c"
diff --git a/bfd/elf-attrs.c b/bfd/elf-attrs.c
new file mode 100644
index 000000000000..d1a64f4bed93
--- /dev/null
+++ b/bfd/elf-attrs.c
@@ -0,0 +1,628 @@
+/* ELF attributes support (based on ARM EABI attributes).
+ Copyright 2005, 2006, 2007
+ Free Software Foundation, Inc.
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "libiberty.h"
+#include "libbfd.h"
+#include "elf-bfd.h"
+
+/* Return the number of bytes needed by I in uleb128 format. */
+static int
+uleb128_size (unsigned int i)
+{
+ int size;
+ size = 1;
+ while (i >= 0x80)
+ {
+ i >>= 7;
+ size++;
+ }
+ return size;
+}
+
+/* Return TRUE if the attribute has the default value (0/""). */
+static bfd_boolean
+is_default_attr (obj_attribute *attr)
+{
+ if ((attr->type & 1) && attr->i != 0)
+ return FALSE;
+ if ((attr->type & 2) && attr->s && *attr->s)
+ return FALSE;
+
+ return TRUE;
+}
+
+/* Return the size of a single attribute. */
+static bfd_vma
+obj_attr_size (int tag, obj_attribute *attr)
+{
+ bfd_vma size;
+
+ if (is_default_attr (attr))
+ return 0;
+
+ size = uleb128_size (tag);
+ if (attr->type & 1)
+ size += uleb128_size (attr->i);
+ if (attr->type & 2)
+ size += strlen ((char *)attr->s) + 1;
+ return size;
+}
+
+/* Return the vendor name for a given object attributes section. */
+static const char *
+vendor_obj_attr_name (bfd *abfd, int vendor)
+{
+ return (vendor == OBJ_ATTR_PROC
+ ? get_elf_backend_data (abfd)->obj_attrs_vendor
+ : "gnu");
+}
+
+/* Return the size of the object attributes section for VENDOR
+ (OBJ_ATTR_PROC or OBJ_ATTR_GNU), or 0 if there are no attributes
+ for that vendor to record and the vendor is OBJ_ATTR_GNU. */
+static bfd_vma
+vendor_obj_attr_size (bfd *abfd, int vendor)
+{
+ bfd_vma size;
+ obj_attribute *attr;
+ obj_attribute_list *list;
+ int i;
+ const char *vendor_name = vendor_obj_attr_name (abfd, vendor);
+
+ if (!vendor_name)
+ return 0;
+
+ attr = elf_known_obj_attributes (abfd)[vendor];
+ size = 0;
+ for (i = 4; i < NUM_KNOWN_OBJ_ATTRIBUTES; i++)
+ size += obj_attr_size (i, &attr[i]);
+
+ for (list = elf_other_obj_attributes (abfd)[vendor];
+ list;
+ list = list->next)
+ size += obj_attr_size (list->tag, &list->attr);
+
+ /* <size> <vendor_name> NUL 0x1 <size> */
+ return ((size || vendor == OBJ_ATTR_PROC)
+ ? size + 10 + strlen (vendor_name)
+ : 0);
+}
+
+/* Return the size of the object attributes section. */
+bfd_vma
+bfd_elf_obj_attr_size (bfd *abfd)
+{
+ bfd_vma size;
+
+ size = vendor_obj_attr_size (abfd, OBJ_ATTR_PROC);
+ size += vendor_obj_attr_size (abfd, OBJ_ATTR_GNU);
+
+ /* 'A' <sections for each vendor> */
+ return (size ? size + 1 : 0);
+}
+
+/* Write VAL in uleb128 format to P, returning a pointer to the
+ following byte. */
+static bfd_byte *
+write_uleb128 (bfd_byte *p, unsigned int val)
+{
+ bfd_byte c;
+ do
+ {
+ c = val & 0x7f;
+ val >>= 7;
+ if (val)
+ c |= 0x80;
+ *(p++) = c;
+ }
+ while (val);
+ return p;
+}
+
+/* Write attribute ATTR to butter P, and return a pointer to the following
+ byte. */
+static bfd_byte *
+write_obj_attribute (bfd_byte *p, int tag, obj_attribute *attr)
+{
+ /* Suppress default entries. */
+ if (is_default_attr (attr))
+ return p;
+
+ p = write_uleb128 (p, tag);
+ if (attr->type & 1)
+ p = write_uleb128 (p, attr->i);
+ if (attr->type & 2)
+ {
+ int len;
+
+ len = strlen (attr->s) + 1;
+ memcpy (p, attr->s, len);
+ p += len;
+ }
+
+ return p;
+}
+
+/* Write the contents of the object attributes section (length SIZE)
+ for VENDOR to CONTENTS. */
+static void
+vendor_set_obj_attr_contents (bfd *abfd, bfd_byte *contents, bfd_vma size,
+ int vendor)
+{
+ bfd_byte *p;
+ obj_attribute *attr;
+ obj_attribute_list *list;
+ int i;
+ const char *vendor_name = vendor_obj_attr_name (abfd, vendor);
+ size_t vendor_length = strlen (vendor_name) + 1;
+
+ p = contents;
+ bfd_put_32 (abfd, size, p);
+ p += 4;
+ memcpy (p, vendor_name, vendor_length);
+ p += vendor_length;
+ *(p++) = Tag_File;
+ bfd_put_32 (abfd, size - 4 - vendor_length, p);
+ p += 4;
+
+ attr = elf_known_obj_attributes (abfd)[vendor];
+ for (i = 4; i < NUM_KNOWN_OBJ_ATTRIBUTES; i++)
+ p = write_obj_attribute (p, i, &attr[i]);
+
+ for (list = elf_other_obj_attributes (abfd)[vendor];
+ list;
+ list = list->next)
+ p = write_obj_attribute (p, list->tag, &list->attr);
+}
+
+/* Write the contents of the object attributes section to CONTENTS. */
+void
+bfd_elf_set_obj_attr_contents (bfd *abfd, bfd_byte *contents, bfd_vma size)
+{
+ bfd_byte *p;
+ int vendor;
+ bfd_vma my_size;
+
+ p = contents;
+ *(p++) = 'A';
+ my_size = 1;
+ for (vendor = OBJ_ATTR_FIRST; vendor <= OBJ_ATTR_LAST; vendor++)
+ {
+ bfd_vma vendor_size = vendor_obj_attr_size (abfd, vendor);
+ if (vendor_size)
+ vendor_set_obj_attr_contents (abfd, p, vendor_size, vendor);
+ p += vendor_size;
+ my_size += vendor_size;
+ }
+
+ if (size != my_size)
+ abort ();
+}
+
+/* Allocate/find an object attribute. */
+static obj_attribute *
+elf_new_obj_attr (bfd *abfd, int vendor, int tag)
+{
+ obj_attribute *attr;
+ obj_attribute_list *list;
+ obj_attribute_list *p;
+ obj_attribute_list **lastp;
+
+
+ if (tag < NUM_KNOWN_OBJ_ATTRIBUTES)
+ {
+ /* Knwon tags are preallocated. */
+ attr = &elf_known_obj_attributes (abfd)[vendor][tag];
+ }
+ else
+ {
+ /* Create a new tag. */
+ list = (obj_attribute_list *)
+ bfd_alloc (abfd, sizeof (obj_attribute_list));
+ memset (list, 0, sizeof (obj_attribute_list));
+ list->tag = tag;
+ /* Keep the tag list in order. */
+ lastp = &elf_other_obj_attributes (abfd)[vendor];
+ for (p = *lastp; p; p = p->next)
+ {
+ if (tag < p->tag)
+ break;
+ lastp = &p->next;
+ }
+ list->next = *lastp;
+ *lastp = list;
+ attr = &list->attr;
+ }
+
+ return attr;
+}
+
+/* Return the value of an integer object attribute. */
+int
+bfd_elf_get_obj_attr_int (bfd *abfd, int vendor, int tag)
+{
+ obj_attribute_list *p;
+
+ if (tag < NUM_KNOWN_OBJ_ATTRIBUTES)
+ {
+ /* Knwon tags are preallocated. */
+ return elf_known_obj_attributes (abfd)[vendor][tag].i;
+ }
+ else
+ {
+ for (p = elf_other_obj_attributes (abfd)[vendor];
+ p;
+ p = p->next)
+ {
+ if (tag == p->tag)
+ return p->attr.i;
+ if (tag < p->tag)
+ break;
+ }
+ return 0;
+ }
+}
+
+/* Add an integer object attribute. */
+void
+bfd_elf_add_obj_attr_int (bfd *abfd, int vendor, int tag, unsigned int i)
+{
+ obj_attribute *attr;
+
+ attr = elf_new_obj_attr (abfd, vendor, tag);
+ attr->type = 1;
+ attr->i = i;
+}
+
+/* Duplicate an object attribute string value. */
+char *
+_bfd_elf_attr_strdup (bfd *abfd, const char * s)
+{
+ char * p;
+ int len;
+
+ len = strlen (s) + 1;
+ p = (char *) bfd_alloc (abfd, len);
+ return memcpy (p, s, len);
+}
+
+/* Add a string object attribute. */
+void
+bfd_elf_add_obj_attr_string (bfd *abfd, int vendor, int tag, const char *s)
+{
+ obj_attribute *attr;
+
+ attr = elf_new_obj_attr (abfd, vendor, tag);
+ attr->type = 2;
+ attr->s = _bfd_elf_attr_strdup (abfd, s);
+}
+
+/* Add a Tag_compatibility object attribute. */
+void
+bfd_elf_add_obj_attr_compat (bfd *abfd, int vendor, unsigned int i,
+ const char *s)
+{
+ obj_attribute_list *list;
+ obj_attribute_list *p;
+ obj_attribute_list **lastp;
+
+ list = (obj_attribute_list *)
+ bfd_alloc (abfd, sizeof (obj_attribute_list));
+ memset (list, 0, sizeof (obj_attribute_list));
+ list->tag = Tag_compatibility;
+ list->attr.type = 3;
+ list->attr.i = i;
+ list->attr.s = _bfd_elf_attr_strdup (abfd, s);
+
+ lastp = &elf_other_obj_attributes (abfd)[vendor];
+ for (p = *lastp; p; p = p->next)
+ {
+ int cmp;
+ if (p->tag != Tag_compatibility)
+ break;
+ cmp = strcmp(s, p->attr.s);
+ if (cmp < 0 || (cmp == 0 && i < p->attr.i))
+ break;
+ lastp = &p->next;
+ }
+ list->next = *lastp;
+ *lastp = list;
+}
+
+/* Copy the object attributes from IBFD to OBFD. */
+void
+_bfd_elf_copy_obj_attributes (bfd *ibfd, bfd *obfd)
+{
+ obj_attribute *in_attr;
+ obj_attribute *out_attr;
+ obj_attribute_list *list;
+ int i;
+ int vendor;
+
+ for (vendor = OBJ_ATTR_FIRST; vendor <= OBJ_ATTR_LAST; vendor++)
+ {
+ in_attr = &elf_known_obj_attributes (ibfd)[vendor][4];
+ out_attr = &elf_known_obj_attributes (obfd)[vendor][4];
+ for (i = 4; i < NUM_KNOWN_OBJ_ATTRIBUTES; i++)
+ {
+ out_attr->type = in_attr->type;
+ out_attr->i = in_attr->i;
+ if (in_attr->s && *in_attr->s)
+ out_attr->s = _bfd_elf_attr_strdup (obfd, in_attr->s);
+ in_attr++;
+ out_attr++;
+ }
+
+ for (list = elf_other_obj_attributes (ibfd)[vendor];
+ list;
+ list = list->next)
+ {
+ in_attr = &list->attr;
+ switch (in_attr->type)
+ {
+ case 1:
+ bfd_elf_add_obj_attr_int (obfd, vendor, list->tag, in_attr->i);
+ break;
+ case 2:
+ bfd_elf_add_obj_attr_string (obfd, vendor, list->tag,
+ in_attr->s);
+ break;
+ case 3:
+ bfd_elf_add_obj_attr_compat (obfd, vendor, in_attr->i,
+ in_attr->s);
+ break;
+ default:
+ abort ();
+ }
+ }
+ }
+}
+
+/* Determine whether a GNU object attribute tag takes an integer, a
+ string or both. */
+static int
+gnu_obj_attrs_arg_type (int tag)
+{
+ /* Except for Tag_compatibility, for GNU attributes we follow the
+ same rule ARM ones > 32 follow: odd-numbered tags take strings
+ and even-numbered tags take integers. In addition, tag & 2 is
+ nonzero for architecture-independent tags and zero for
+ architecture-dependent ones. */
+ if (tag == Tag_compatibility)
+ return 3;
+ else
+ return (tag & 1) != 0 ? 2 : 1;
+}
+
+/* Determine what arguments an attribute tag takes. */
+int
+_bfd_elf_obj_attrs_arg_type (bfd *abfd, int vendor, int tag)
+{
+ switch (vendor)
+ {
+ case OBJ_ATTR_PROC:
+ return get_elf_backend_data (abfd)->obj_attrs_arg_type (tag);
+ break;
+ case OBJ_ATTR_GNU:
+ return gnu_obj_attrs_arg_type (tag);
+ break;
+ default:
+ abort ();
+ }
+}
+
+/* Parse an object attributes section. */
+void
+_bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr)
+{
+ bfd_byte *contents;
+ bfd_byte *p;
+ bfd_vma len;
+ const char *std_section;
+
+ contents = bfd_malloc (hdr->sh_size);
+ if (!contents)
+ return;
+ if (!bfd_get_section_contents (abfd, hdr->bfd_section, contents, 0,
+ hdr->sh_size))
+ {
+ free (contents);
+ return;
+ }
+ p = contents;
+ std_section = get_elf_backend_data (abfd)->obj_attrs_vendor;
+ if (*(p++) == 'A')
+ {
+ len = hdr->sh_size - 1;
+ while (len > 0)
+ {
+ int namelen;
+ bfd_vma section_len;
+ int vendor;
+
+ section_len = bfd_get_32 (abfd, p);
+ p += 4;
+ if (section_len > len)
+ section_len = len;
+ len -= section_len;
+ namelen = strlen ((char *)p) + 1;
+ section_len -= namelen + 4;
+ if (std_section && strcmp ((char *)p, std_section) == 0)
+ vendor = OBJ_ATTR_PROC;
+ else if (strcmp ((char *)p, "gnu") == 0)
+ vendor = OBJ_ATTR_GNU;
+ else
+ {
+ /* Other vendor section. Ignore it. */
+ p += namelen + section_len;
+ continue;
+ }
+
+ p += namelen;
+ while (section_len > 0)
+ {
+ int tag;
+ unsigned int n;
+ unsigned int val;
+ bfd_vma subsection_len;
+ bfd_byte *end;
+
+ tag = read_unsigned_leb128 (abfd, p, &n);
+ p += n;
+ subsection_len = bfd_get_32 (abfd, p);
+ p += 4;
+ if (subsection_len > section_len)
+ subsection_len = section_len;
+ section_len -= subsection_len;
+ subsection_len -= n + 4;
+ end = p + subsection_len;
+ switch (tag)
+ {
+ case Tag_File:
+ while (p < end)
+ {
+ int type;
+
+ tag = read_unsigned_leb128 (abfd, p, &n);
+ p += n;
+ type = _bfd_elf_obj_attrs_arg_type (abfd, vendor, tag);
+ switch (type)
+ {
+ case 3:
+ val = read_unsigned_leb128 (abfd, p, &n);
+ p += n;
+ bfd_elf_add_obj_attr_compat (abfd, vendor, val,
+ (char *)p);
+ p += strlen ((char *)p) + 1;
+ break;
+ case 2:
+ bfd_elf_add_obj_attr_string (abfd, vendor, tag,
+ (char *)p);
+ p += strlen ((char *)p) + 1;
+ break;
+ case 1:
+ val = read_unsigned_leb128 (abfd, p, &n);
+ p += n;
+ bfd_elf_add_obj_attr_int (abfd, vendor, tag, val);
+ break;
+ default:
+ abort ();
+ }
+ }
+ break;
+ case Tag_Section:
+ case Tag_Symbol:
+ /* Don't have anywhere convenient to attach these.
+ Fall through for now. */
+ default:
+ /* Ignore things we don't kow about. */
+ p += subsection_len;
+ subsection_len = 0;
+ break;
+ }
+ }
+ }
+ }
+ free (contents);
+}
+
+/* Merge common object attributes from IBFD into OBFD. Raise an error
+ if there are conflicting attributes. Any processor-specific
+ attributes have already been merged. This must be called from the
+ bfd_elfNN_bfd_merge_private_bfd_data hook for each individual
+ target, along with any target-specific merging. Because there are
+ no common attributes other than Tag_compatibility at present, and
+ non-"gnu" Tag_compatibility is not expected in "gnu" sections, this
+ is not presently called for targets without their own
+ attributes. */
+
+bfd_boolean
+_bfd_elf_merge_object_attributes (bfd *ibfd, bfd *obfd)
+{
+ obj_attribute *in_attr;
+ obj_attribute *out_attr;
+ obj_attribute_list *in_list;
+ obj_attribute_list *out_list;
+ int vendor;
+
+ /* The only common attribute is currently Tag_compatibility,
+ accepted in both processor and "gnu" sections. */
+ for (vendor = OBJ_ATTR_FIRST; vendor <= OBJ_ATTR_LAST; vendor++)
+ {
+ in_list = elf_other_obj_attributes (ibfd)[vendor];
+ out_list = elf_other_obj_attributes (ibfd)[vendor];
+ while (in_list && in_list->tag == Tag_compatibility)
+ {
+ in_attr = &in_list->attr;
+ if (in_attr->i == 0)
+ continue;
+ if (in_attr->i == 1 && strcmp (in_attr->s, "gnu") != 0)
+ {
+ _bfd_error_handler
+ (_("ERROR: %B: Must be processed by '%s' toolchain"),
+ ibfd, in_attr->s);
+ return FALSE;
+ }
+ if (!out_list || out_list->tag != Tag_compatibility
+ || strcmp (in_attr->s, out_list->attr.s) != 0)
+ {
+ /* Add this compatibility tag to the output. */
+ bfd_elf_add_proc_attr_compat (obfd, in_attr->i, in_attr->s);
+ continue;
+ }
+ out_attr = &out_list->attr;
+ /* Check all the input tags with the same identifier. */
+ for (;;)
+ {
+ if (out_list->tag != Tag_compatibility
+ || in_attr->i != out_attr->i
+ || strcmp (in_attr->s, out_attr->s) != 0)
+ {
+ _bfd_error_handler
+ (_("ERROR: %B: Incompatible object tag '%s':%d"),
+ ibfd, in_attr->s, in_attr->i);
+ return FALSE;
+ }
+ in_list = in_list->next;
+ if (in_list->tag != Tag_compatibility
+ || strcmp (in_attr->s, in_list->attr.s) != 0)
+ break;
+ in_attr = &in_list->attr;
+ out_list = out_list->next;
+ if (out_list)
+ out_attr = &out_list->attr;
+ }
+
+ /* Check the output doesn't have extra tags with this identifier. */
+ if (out_list && out_list->tag == Tag_compatibility
+ && strcmp (in_attr->s, out_list->attr.s) == 0)
+ {
+ _bfd_error_handler
+ (_("ERROR: %B: Incompatible object tag '%s':%d"),
+ ibfd, in_attr->s, out_list->attr.i);
+ return FALSE;
+ }
+ }
+ }
+
+ return TRUE;
+}
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 3fba1c228f0a..f4c3a0a3203b 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -1,6 +1,6 @@
/* BFD back-end data structures for ELF files.
Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -155,6 +155,8 @@ struct elf_link_hash_entry
unsigned int hidden : 1;
/* Symbol was forced to local scope due to a version script file. */
unsigned int forced_local : 1;
+ /* Symbol was forced to be dynamic due to a version script file. */
+ unsigned int dynamic : 1;
/* Symbol was marked during garbage collection. */
unsigned int mark : 1;
/* Symbol is referenced by a non-GOT/non-PLT relocation. This is
@@ -259,31 +261,6 @@ struct elf_link_loaded_list
};
/* Structures used by the eh_frame optimization code. */
-struct cie_header
-{
- unsigned int length;
- unsigned int id;
-};
-
-struct cie
-{
- struct cie_header hdr;
- unsigned char version;
- char augmentation[20];
- bfd_vma code_align;
- bfd_signed_vma data_align;
- bfd_vma ra_column;
- bfd_vma 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
{
/* For FDEs, this points to the CIE used. */
@@ -302,12 +279,12 @@ struct eh_cie_fde
unsigned int make_lsda_relative : 1;
unsigned int need_lsda_relative : 1;
unsigned int per_encoding_relative : 1;
+ unsigned int *set_loc;
};
struct eh_frame_sec_info
{
unsigned int count;
- unsigned int alloced;
struct eh_cie_fde entry[1];
};
@@ -317,11 +294,11 @@ struct eh_frame_array_ent
bfd_vma fde;
};
+struct htab;
+
struct eh_frame_hdr_info
{
- struct cie last_cie;
- asection *last_cie_sec;
- struct eh_cie_fde *last_cie_inf;
+ struct htab *cies;
asection *hdr_sec;
unsigned int fde_count, array_count;
struct eh_frame_array_ent *array;
@@ -342,6 +319,10 @@ struct elf_link_hash_table
when linking against or generating a shared object. */
bfd_boolean dynamic_sections_created;
+ /* True if this target has relocatable executables, so needs dynamic
+ section symbols. */
+ bfd_boolean is_relocatable_executable;
+
/* The BFD used to hold special sections created by the linker.
This will be the first BFD found which requires these sections to
be created. */
@@ -375,6 +356,12 @@ struct elf_link_hash_table
included in the link. */
struct bfd_link_needed_list *needed;
+ /* Sections in the output bfd that provides a section symbol
+ to be used by relocations emitted against local symbols.
+ Most targets will not use data_index_section. */
+ asection *text_index_section;
+ asection *data_index_section;
+
/* The _GLOBAL_OFFSET_TABLE_ symbol. */
struct elf_link_hash_entry *hgot;
@@ -403,10 +390,6 @@ struct elf_link_hash_table
/* A linked list of BFD's loaded in the link. */
struct elf_link_loaded_list *loaded;
-
- /* True if this target has relocatable executables, so needs dynamic
- section symbols. */
- bfd_boolean is_relocatable_executable;
};
/* Look up an entry in an ELF linker hash table. */
@@ -466,7 +449,7 @@ struct elf_size_info {
(*write_shdrs_and_ehdr) (bfd *);
void (*write_relocs)
(bfd *, asection *, void *);
- void (*swap_symbol_in)
+ bfd_boolean (*swap_symbol_in)
(bfd *, const void *, const void *, Elf_Internal_Sym *);
void (*swap_symbol_out)
(bfd *, const Elf_Internal_Sym *, void *, void *);
@@ -555,6 +538,10 @@ enum action_discarded
PRETEND = 2
};
+typedef asection * (*elf_gc_mark_hook_fn)
+ (asection *, struct bfd_link_info *, Elf_Internal_Rela *,
+ struct elf_link_hash_entry *, Elf_Internal_Sym *);
+
struct elf_backend_data
{
/* The architecture for this backend. */
@@ -563,6 +550,9 @@ struct elf_backend_data
/* The ELF machine code (EM_xxxx) for this backend. */
int elf_machine_code;
+ /* EI_OSABI. */
+ int elf_osabi;
+
/* The maximum page size for this backend. */
bfd_vma maxpagesize;
@@ -571,6 +561,9 @@ struct elf_backend_data
pages at least this large. May be smaller than maxpagesize. */
bfd_vma minpagesize;
+ /* The common page size for this backend. */
+ bfd_vma commonpagesize;
+
/* The BFD flags applied to sections created for dynamic linking. */
flagword dynamic_sec_flags;
@@ -725,6 +718,13 @@ struct elf_backend_data
bfd_boolean (*check_directives)
(bfd *abfd, struct bfd_link_info *info);
+ /* The AS_NEEDED_CLEANUP function is called once per --as-needed
+ input file that was not needed by the add_symbols phase of the
+ ELF backend linker. The function must undo any target specific
+ changes in the symbol hash table. */
+ bfd_boolean (*as_needed_cleanup)
+ (bfd *abfd, struct bfd_link_info *info);
+
/* The ADJUST_DYNAMIC_SYMBOL function is called by the ELF backend
linker for every symbol which is defined by a dynamic object and
referenced by a regular object. This is called after all the
@@ -760,6 +760,11 @@ struct elf_backend_data
bfd_boolean (*elf_backend_size_dynamic_sections)
(bfd *output_bfd, struct bfd_link_info *info);
+ /* Set TEXT_INDEX_SECTION and DATA_INDEX_SECTION, the output sections
+ we keep to use as a base for relocs and symbols. */
+ void (*elf_backend_init_index_section)
+ (bfd *output_bfd, struct bfd_link_info *info);
+
/* The RELOCATE_SECTION function is called by the ELF backend linker
to handle the relocations for a section.
@@ -787,8 +792,11 @@ struct elf_backend_data
STB_LOCAL/STT_SECTION symbols specially. The output symbol is
going to be the section symbol corresponding to the output
section, which means that the addend must be adjusted
- accordingly. */
- bfd_boolean (*elf_backend_relocate_section)
+ accordingly.
+
+ Returns FALSE on error, TRUE on success, 2 if successful and
+ relocations should be written for this section. */
+ int (*elf_backend_relocate_section)
(bfd *output_bfd, struct bfd_link_info *info, bfd *input_bfd,
asection *input_section, bfd_byte *contents, Elf_Internal_Rela *relocs,
Elf_Internal_Sym *local_syms, asection **local_sections);
@@ -826,13 +834,18 @@ struct elf_backend_data
return the number of additional program segments which this BFD
will need. It should return -1 on error. */
int (*elf_backend_additional_program_headers)
- (bfd *);
+ (bfd *, struct bfd_link_info *);
/* This function is called to modify an existing segment map in a
backend specific fashion. */
bfd_boolean (*elf_backend_modify_segment_map)
(bfd *, struct bfd_link_info *);
+ /* This function is called to modify program headers just before
+ they are written. */
+ bfd_boolean (*elf_backend_modify_program_headers)
+ (bfd *, struct bfd_link_info *);
+
/* This function is called during section garbage collection to
mark sections that define global symbols. */
bfd_boolean (*gc_mark_dynamic_ref)
@@ -840,9 +853,12 @@ struct elf_backend_data
/* This function is called during section gc to discover the section a
particular relocation refers to. */
- asection * (*gc_mark_hook)
- (asection *sec, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *h, Elf_Internal_Sym *);
+ elf_gc_mark_hook_fn gc_mark_hook;
+
+ /* This function, if defined, is called after the first gc marking pass
+ to allow the backend to mark additional sections. */
+ bfd_boolean (*gc_mark_extra_sections)
+ (struct bfd_link_info *info, elf_gc_mark_hook_fn gc_mark_hook);
/* This function, if defined, is called during the sweep phase of gc
in order that a backend might update any data structures it might
@@ -865,8 +881,16 @@ struct elf_backend_data
/* This function, if defined, is called after all local symbols and
global symbols converted to locals are emitted into the symtab
- section. It allows the backend to emit special global symbols
+ section. It allows the backend to emit special local symbols
not handled in the hash table. */
+ bfd_boolean (*elf_backend_output_arch_local_syms)
+ (bfd *, struct bfd_link_info *, void *,
+ bfd_boolean (*) (void *, const char *, Elf_Internal_Sym *, asection *,
+ struct elf_link_hash_entry *));
+
+ /* This function, if defined, is called after all symbols are emitted
+ into the symtab section. It allows the backend to emit special
+ global symbols not handled in the hash table. */
bfd_boolean (*elf_backend_output_arch_syms)
(bfd *, struct bfd_link_info *, void *,
bfd_boolean (*) (void *, const char *, Elf_Internal_Sym *, asection *,
@@ -913,15 +937,19 @@ struct elf_backend_data
(asection *, Elf_Internal_Rela *);
/* This function, if defined, is called when an NT_PRSTATUS note is found
- in a core file. */
+ in a core file. */
bfd_boolean (*elf_backend_grok_prstatus)
(bfd *, Elf_Internal_Note *);
/* This function, if defined, is called when an NT_PSINFO or NT_PRPSINFO
- note is found in a core file. */
+ note is found in a core file. */
bfd_boolean (*elf_backend_grok_psinfo)
(bfd *, Elf_Internal_Note *);
+ /* This function, if defined, is called to write a note to a corefile. */
+ char *(*elf_backend_write_core_note)
+ (bfd *abfd, char *buf, int *bufsiz, int note_type, ...);
+
/* Functions to print VMAs. Special code to handle 64 bit ELF files. */
void (* elf_backend_sprintf_vma)
(bfd *, char *, bfd_vma);
@@ -974,7 +1002,7 @@ struct elf_backend_data
/* This function, if defined, may write out the given section.
Returns TRUE if it did so and FALSE if the caller should. */
bfd_boolean (*elf_backend_write_section)
- (bfd *, asection *, bfd_byte *);
+ (bfd *, struct bfd_link_info *, asection *, bfd_byte *);
/* The level of IRIX compatibility we're striving for.
MIPS ELF specific function. */
@@ -1022,6 +1050,12 @@ struct elf_backend_data
bfd_boolean *, bfd_boolean *,
bfd *, asection **);
+ /* Return TRUE if symbol should be hashed in the `.gnu.hash' section. */
+ bfd_boolean (*elf_hash_symbol) (struct elf_link_hash_entry *);
+
+ /* Return TRUE if type is a function symbol type. */
+ bfd_boolean (*is_function_type) (unsigned int type);
+
/* Used to handle bad SHF_LINK_ORDER input. */
bfd_error_handler_type link_order_error_handler;
@@ -1041,6 +1075,19 @@ struct elf_backend_data
so-called reserved entries on some systems. */
bfd_vma got_header_size;
+ /* The vendor name to use for a processor-standard attributes section. */
+ const char *obj_attrs_vendor;
+
+ /* The section name to use for a processor-standard attributes section. */
+ const char *obj_attrs_section;
+
+ /* Return 1, 2 or 3 to indicate what type of arguments a
+ processor-specific tag takes. */
+ int (*obj_attrs_arg_type) (int);
+
+ /* The section type to use for an attributes section. */
+ unsigned int obj_attrs_section_type;
+
/* This is TRUE if the linker should act like collect and gather
global constructors and destructors by name. This is TRUE for
MIPS ELF because the Irix 5 tools can not handle the .init
@@ -1088,10 +1135,17 @@ struct elf_backend_data
unsigned can_refcount : 1;
unsigned want_got_sym : 1;
unsigned want_dynbss : 1;
- /* Targets which do not support physical addressing often require
- that the p_paddr field in the section header to be set to zero.
- This field indicates whether this behavior is required. */
+
+ /* Targets which do not support physical addressing often require
+ that the p_paddr field in the section header to be set to zero.
+ This field indicates whether this behavior is required. */
unsigned want_p_paddr_set_to_zero : 1;
+
+ /* True if an object file lacking a .note.GNU-stack section
+ should be assumed to be requesting exec stack. At least one
+ other file in the link needs to have a .note.GNU-stack section
+ for a PT_GNU_STACK segment to be created. */
+ unsigned default_execstack : 1;
};
/* Information stored for each BFD section in an ELF file. This
@@ -1160,12 +1214,12 @@ struct bfd_elf_section_data
struct bfd_symbol *id;
} group;
- /* Optional information about section group; NULL if it doesn't
- belongs to any section group. */
+ /* For a member of a group, points to the SHT_GROUP section.
+ NULL for the SHT_GROUP section itself and non-group sections. */
asection *sec_group;
- /* A linked list of sections in the group. Circular when used by
- the linker. */
+ /* A linked list of member sections in the group. Circular when used by
+ the linker. For the SHT_GROUP section, points at first member. */
asection *next_in_group;
/* A pointer used for various section optimizations. */
@@ -1181,15 +1235,11 @@ struct bfd_elf_section_data
#define elf_next_in_group(sec) (elf_section_data(sec)->next_in_group)
#define elf_sec_group(sec) (elf_section_data(sec)->sec_group)
-/* Return TRUE if section has been discarded. */
-#define elf_discarded_section(sec) \
- (!bfd_is_abs_section (sec) \
- && bfd_is_abs_section ((sec)->output_section) \
- && (sec)->sec_info_type != ELF_INFO_TYPE_MERGE \
- && (sec)->sec_info_type != ELF_INFO_TYPE_JUST_SYMS)
+#define xvec_get_elf_backend_data(xvec) \
+ ((struct elf_backend_data *) (xvec)->backend_data)
#define get_elf_backend_data(abfd) \
- ((const struct elf_backend_data *) (abfd)->xvec->backend_data)
+ xvec_get_elf_backend_data ((abfd)->xvec)
/* This struct is used to pass information to routines called via
elf_link_hash_traverse which must return failure. */
@@ -1231,6 +1281,46 @@ struct elf_find_verdep_info
bfd_boolean failed;
};
+/* The maximum number of known object attributes for any target. */
+#define NUM_KNOWN_OBJ_ATTRIBUTES 32
+
+/* The value of an object attribute. type & 1 indicates whether there
+ is an integer value; type & 2 indicates whether there is a string
+ value. */
+
+typedef struct obj_attribute
+{
+ int type;
+ unsigned int i;
+ char *s;
+} obj_attribute;
+
+typedef struct obj_attribute_list
+{
+ struct obj_attribute_list *next;
+ int tag;
+ obj_attribute attr;
+} obj_attribute_list;
+
+/* Object attributes may either be defined by the processor ABI, index
+ OBJ_ATTR_PROC in the *_obj_attributes arrays, or be GNU-specific
+ (and possibly also processor-specific), index OBJ_ATTR_GNU. */
+#define OBJ_ATTR_PROC 0
+#define OBJ_ATTR_GNU 1
+#define OBJ_ATTR_FIRST OBJ_ATTR_PROC
+#define OBJ_ATTR_LAST OBJ_ATTR_GNU
+
+/* The following object attribute tags are taken as generic, for all
+ targets and for "gnu" where there is no target standard. */
+enum
+{
+ Tag_NULL = 0,
+ Tag_File = 1,
+ Tag_Section = 2,
+ Tag_Symbol = 3,
+ Tag_compatibility = 32
+};
+
/* Some private data is stashed away for future use using the tdata pointer
in the bfd structure. */
@@ -1317,6 +1407,7 @@ struct elf_obj_tdata
MIPS ELF linker. FIXME: We should figure out some way to only
include this field for a MIPS ELF target. */
asection **local_stubs;
+ asection **local_call_stubs;
/* Used to determine if PT_GNU_EH_FRAME segment header should be
created. */
@@ -1368,6 +1459,12 @@ struct elf_obj_tdata
/* Used to determine if the e_flags field has been initialized */
bfd_boolean flags_init;
+
+ /* Symbol buffer. */
+ void *symbuf;
+
+ obj_attribute known_obj_attributes[2][NUM_KNOWN_OBJ_ATTRIBUTES];
+ obj_attribute_list *other_obj_attributes[2];
};
#define elf_tdata(bfd) ((bfd) -> tdata.elf_obj_data)
@@ -1397,6 +1494,12 @@ struct elf_obj_tdata
#define elf_dyn_lib_class(bfd) (elf_tdata(bfd) -> dyn_lib_class)
#define elf_bad_symtab(bfd) (elf_tdata(bfd) -> bad_symtab)
#define elf_flags_init(bfd) (elf_tdata(bfd) -> flags_init)
+#define elf_known_obj_attributes(bfd) (elf_tdata (bfd) -> known_obj_attributes)
+#define elf_other_obj_attributes(bfd) (elf_tdata (bfd) -> other_obj_attributes)
+#define elf_known_obj_attributes_proc(bfd) \
+ (elf_known_obj_attributes (bfd) [OBJ_ATTR_PROC])
+#define elf_other_obj_attributes_proc(bfd) \
+ (elf_other_obj_attributes (bfd) [OBJ_ATTR_PROC])
extern void _bfd_elf_swap_verdef_in
(bfd *, const Elf_External_Verdef *, Elf_Internal_Verdef *);
@@ -1462,6 +1565,8 @@ extern bfd_vma _bfd_elf_section_offset
extern unsigned long bfd_elf_hash
(const char *);
+extern unsigned long bfd_elf_gnu_hash
+ (const char *);
extern bfd_reloc_status_type bfd_elf_generic_reloc
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
@@ -1500,11 +1605,11 @@ extern bfd_boolean _bfd_elf_match_sections_by_type
extern bfd_boolean bfd_elf_is_group_section
(bfd *, const struct bfd_section *);
extern void _bfd_elf_section_already_linked
- (bfd *, struct bfd_section *);
+ (bfd *, struct bfd_section *, struct bfd_link_info *);
extern void bfd_elf_set_group_contents
(bfd *, asection *, void *);
extern asection *_bfd_elf_check_kept_section
- (asection *);
+ (asection *, struct bfd_link_info *);
extern void _bfd_elf_link_just_syms
(asection *, struct bfd_link_info *);
extern bfd_boolean _bfd_elf_copy_private_header_data
@@ -1562,7 +1667,7 @@ extern bfd_boolean _bfd_elf_find_inliner_info
#define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols
#define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
extern int _bfd_elf_sizeof_headers
- (bfd *, bfd_boolean);
+ (bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_elf_new_section_hook
(bfd *, asection *);
extern bfd_boolean _bfd_elf_init_reloc_shdr
@@ -1632,6 +1737,8 @@ extern bfd_boolean _bfd_elf_merge_symbol
struct elf_link_hash_entry **, bfd_boolean *,
bfd_boolean *, bfd_boolean *, bfd_boolean *);
+extern bfd_boolean _bfd_elf_hash_symbol (struct elf_link_hash_entry *);
+
extern bfd_boolean _bfd_elf_add_default_symbol
(bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
const char *, Elf_Internal_Sym *, asection **, bfd_vma *,
@@ -1668,6 +1775,10 @@ extern bfd_boolean _bfd_elf_create_got_section
(bfd *, struct bfd_link_info *);
extern struct elf_link_hash_entry *_bfd_elf_define_linkage_sym
(bfd *, struct bfd_link_info *, asection *, const char *);
+extern void _bfd_elf_init_1_index_section
+ (bfd *, struct bfd_link_info *);
+extern void _bfd_elf_init_2_index_sections
+ (bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_elfcore_make_pseudosection
(bfd *, char *, size_t, ufile_ptr);
@@ -1690,6 +1801,9 @@ extern bfd_boolean _bfd_elf_fix_symbol_flags
extern bfd_boolean _bfd_elf_adjust_dynamic_symbol
(struct elf_link_hash_entry *, void *);
+extern bfd_boolean _bfd_elf_adjust_dynamic_copy
+ (struct elf_link_hash_entry *, asection *);
+
extern bfd_boolean _bfd_elf_link_sec_merge_syms
(struct elf_link_hash_entry *, void *);
@@ -1700,11 +1814,23 @@ extern bfd_boolean _bfd_elf_symbol_refs_local_p
(struct elf_link_hash_entry *, struct bfd_link_info *, bfd_boolean);
extern bfd_boolean bfd_elf_match_symbols_in_sections
- (asection *sec1, asection *sec2);
+ (asection *, asection *, struct bfd_link_info *);
+
+extern void bfd_elf_perform_complex_relocation
+ (bfd * output_bfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info * info,
+ bfd * input_bfd,
+ asection * input_section,
+ bfd_byte * contents,
+ Elf_Internal_Rela * rel,
+ Elf_Internal_Sym * local_syms,
+ asection ** local_sections);
extern bfd_boolean _bfd_elf_setup_sections
(bfd *);
+extern void _bfd_elf_set_osabi (bfd * , struct bfd_link_info *);
+
extern const bfd_target *bfd_elf32_object_p
(bfd *);
extern const bfd_target *bfd_elf32_core_file_p
@@ -1716,7 +1842,7 @@ extern int bfd_elf32_core_file_failing_signal
extern bfd_boolean bfd_elf32_core_file_matches_executable_p
(bfd *, bfd *);
-extern void bfd_elf32_swap_symbol_in
+extern bfd_boolean bfd_elf32_swap_symbol_in
(bfd *, const void *, const void *, Elf_Internal_Sym *);
extern void bfd_elf32_swap_symbol_out
(bfd *, const Elf_Internal_Sym *, void *, void *);
@@ -1758,7 +1884,7 @@ extern int bfd_elf64_core_file_failing_signal
extern bfd_boolean bfd_elf64_core_file_matches_executable_p
(bfd *, bfd *);
-extern void bfd_elf64_swap_symbol_in
+extern bfd_boolean bfd_elf64_swap_symbol_in
(bfd *, const void *, const void *, Elf_Internal_Sym *);
extern void bfd_elf64_swap_symbol_out
(bfd *, const Elf_Internal_Sym *, void *, void *);
@@ -1802,6 +1928,10 @@ extern bfd_boolean bfd_elf_link_record_dynamic_symbol
extern int bfd_elf_link_record_local_dynamic_symbol
(struct bfd_link_info *, bfd *, long);
+extern void bfd_elf_link_mark_dynamic_symbol
+ (struct bfd_link_info *, struct elf_link_hash_entry *,
+ Elf_Internal_Sym *);
+
extern bfd_boolean _bfd_elf_close_and_cleanup
(bfd *);
@@ -1836,6 +1966,10 @@ extern bfd_boolean bfd_elf_gc_record_vtinherit
extern bfd_boolean bfd_elf_gc_record_vtentry
(bfd *, asection *, struct elf_link_hash_entry *, bfd_vma);
+extern asection *_bfd_elf_gc_mark_hook
+ (asection *, struct bfd_link_info *, Elf_Internal_Rela *,
+ struct elf_link_hash_entry *, Elf_Internal_Sym *);
+
extern bfd_boolean _bfd_elf_gc_mark
(struct bfd_link_info *, asection *,
asection * (*) (asection *, struct bfd_link_info *, Elf_Internal_Rela *,
@@ -1850,10 +1984,14 @@ extern bfd_boolean bfd_elf_gc_common_final_link
extern bfd_boolean bfd_elf_reloc_symbol_deleted_p
(bfd_vma, void *);
-extern struct elf_segment_map *
-_bfd_elf_make_dynamic_segment
+extern struct elf_segment_map * _bfd_elf_make_dynamic_segment
(bfd *, asection *);
+extern bfd_boolean _bfd_elf_map_sections_to_segments
+ (bfd *, struct bfd_link_info *);
+
+extern bfd_boolean _bfd_elf_is_function_type (unsigned int);
+
/* Exported interface for writing elf corefile notes. */
extern char *elfcore_write_note
(bfd *, char *, int *, const char *, int, const void *, int);
@@ -1877,6 +2015,26 @@ extern bfd *_bfd_elf64_bfd_from_remote_memory
(bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
int (*target_read_memory) (bfd_vma, bfd_byte *, int));
+extern bfd_vma bfd_elf_obj_attr_size (bfd *);
+extern void bfd_elf_set_obj_attr_contents (bfd *, bfd_byte *, bfd_vma);
+extern int bfd_elf_get_obj_attr_int (bfd *, int, int);
+extern void bfd_elf_add_obj_attr_int (bfd *, int, int, unsigned int);
+#define bfd_elf_add_proc_attr_int(BFD, TAG, VALUE) \
+ bfd_elf_add_obj_attr_int ((BFD), OBJ_ATTR_PROC, (TAG), (VALUE))
+extern void bfd_elf_add_obj_attr_string (bfd *, int, int, const char *);
+#define bfd_elf_add_proc_attr_string(BFD, TAG, VALUE) \
+ bfd_elf_add_obj_attr_string ((BFD), OBJ_ATTR_PROC, (TAG), (VALUE))
+extern void bfd_elf_add_obj_attr_compat (bfd *, int, unsigned int,
+ const char *);
+#define bfd_elf_add_proc_attr_compat(BFD, INTVAL, STRVAL) \
+ bfd_elf_add_obj_attr_compat ((BFD), OBJ_ATTR_PROC, (INTVAL), (STRVAL))
+
+extern char *_bfd_elf_attr_strdup (bfd *, const char *);
+extern void _bfd_elf_copy_obj_attributes (bfd *, bfd *);
+extern int _bfd_elf_obj_attrs_arg_type (bfd *, int, int);
+extern void _bfd_elf_parse_attributes (bfd *, Elf_Internal_Shdr *);
+extern bfd_boolean _bfd_elf_merge_object_attributes (bfd *, bfd *);
+
/* Large common section. */
extern asection _bfd_elf_large_com_section;
@@ -1936,7 +2094,7 @@ extern bfd_boolean _sh_elf_set_mach_from_flags
else if (info->unresolved_syms_in_objects == RM_IGNORE \
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) \
; \
- else \
+ else if (!info->relocatable) \
{ \
bfd_boolean err; \
err = (info->unresolved_syms_in_objects == RM_GENERATE_ERROR \
@@ -1952,4 +2110,9 @@ extern bfd_boolean _sh_elf_set_mach_from_flags
} \
while (0)
+/* Will a symbol be bound to the the definition within the shared
+ library, if any. */
+#define SYMBOLIC_BIND(INFO, H) \
+ ((INFO)->symbolic || ((INFO)->dynamic && !(H)->dynamic))
+
#endif /* _LIBELF_H_ */
diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
index 5100e72938d9..092c2c57ec34 100644
--- a/bfd/elf-eh-frame.c
+++ b/bfd/elf-eh-frame.c
@@ -1,5 +1,6 @@
/* .eh_frame section optimization.
- Copyright 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ Free Software Foundation, Inc.
Written by Jakub Jelinek <jakub@redhat.com>.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,14 +19,42 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/dwarf2.h"
#define EH_FRAME_HDR_SIZE 8
+struct cie
+{
+ unsigned int length;
+ unsigned int hash;
+ unsigned char version;
+ unsigned char local_personality;
+ char augmentation[20];
+ bfd_vma code_align;
+ bfd_signed_vma data_align;
+ bfd_vma ra_column;
+ bfd_vma augmentation_size;
+ union {
+ struct elf_link_hash_entry *h;
+ bfd_vma val;
+ } personality;
+ asection *output_sec;
+ struct eh_cie_fde *cie_inf;
+ unsigned char per_encoding;
+ unsigned char lsda_encoding;
+ unsigned char fde_encoding;
+ unsigned char initial_insn_length;
+ unsigned char make_relative;
+ unsigned char make_lsda_relative;
+ unsigned char initial_instructions[50];
+};
+
+
+
/* If *ITER hasn't reached END yet, read the next byte into *RESULT and
move onto the next byte. Return true on success. */
@@ -180,20 +209,27 @@ write_value (bfd *abfd, bfd_byte *buf, bfd_vma value, int width)
}
}
-/* Return zero if C1 and C2 CIEs can be merged. */
+/* Return one if C1 and C2 CIEs can be merged. */
-static
-int cie_compare (struct cie *c1, struct cie *c2)
+static int
+cie_eq (const void *e1, const void *e2)
{
- if (c1->hdr.length == c2->hdr.length
+ const struct cie *c1 = e1;
+ const struct cie *c2 = e2;
+
+ if (c1->hash == c2->hash
+ && c1->length == c2->length
&& c1->version == c2->version
+ && c1->local_personality == c2->local_personality
&& strcmp (c1->augmentation, c2->augmentation) == 0
&& strcmp (c1->augmentation, "eh") != 0
&& c1->code_align == c2->code_align
&& c1->data_align == c2->data_align
&& c1->ra_column == c2->ra_column
&& c1->augmentation_size == c2->augmentation_size
- && c1->personality == c2->personality
+ && memcmp (&c1->personality, &c2->personality,
+ sizeof (c1->personality)) == 0
+ && c1->output_sec == c2->output_sec
&& c1->per_encoding == c2->per_encoding
&& c1->lsda_encoding == c2->lsda_encoding
&& c1->fde_encoding == c2->fde_encoding
@@ -201,9 +237,38 @@ int cie_compare (struct cie *c1, struct cie *c2)
&& memcmp (c1->initial_instructions,
c2->initial_instructions,
c1->initial_insn_length) == 0)
- return 0;
+ return 1;
+
+ return 0;
+}
+
+static hashval_t
+cie_hash (const void *e)
+{
+ const struct cie *c = e;
+ return c->hash;
+}
- return 1;
+static hashval_t
+cie_compute_hash (struct cie *c)
+{
+ hashval_t h = 0;
+ h = iterative_hash_object (c->length, h);
+ h = iterative_hash_object (c->version, h);
+ h = iterative_hash (c->augmentation, strlen (c->augmentation) + 1, h);
+ h = iterative_hash_object (c->code_align, h);
+ h = iterative_hash_object (c->data_align, h);
+ h = iterative_hash_object (c->ra_column, h);
+ h = iterative_hash_object (c->augmentation_size, h);
+ h = iterative_hash_object (c->personality, h);
+ h = iterative_hash_object (c->output_sec, h);
+ h = iterative_hash_object (c->per_encoding, h);
+ h = iterative_hash_object (c->lsda_encoding, h);
+ h = iterative_hash_object (c->fde_encoding, h);
+ h = iterative_hash_object (c->initial_insn_length, h);
+ h = iterative_hash (c->initial_instructions, c->initial_insn_length, h);
+ c->hash = h;
+ return h;
}
/* Return the number of extra bytes that we'll be inserting into
@@ -273,11 +338,14 @@ skip_cfa_op (bfd_byte **iter, bfd_byte *end, unsigned int encoded_ptr_width)
if (!read_byte (iter, end, &op))
return FALSE;
- switch (op & 0x80 ? op & 0xc0 : op)
+ switch (op & 0xc0 ? op & 0xc0 : op)
{
case DW_CFA_nop:
case DW_CFA_advance_loc:
case DW_CFA_restore:
+ case DW_CFA_remember_state:
+ case DW_CFA_restore_state:
+ case DW_CFA_GNU_window_save:
/* No arguments. */
return TRUE;
@@ -292,6 +360,8 @@ skip_cfa_op (bfd_byte **iter, bfd_byte *end, unsigned int encoded_ptr_width)
/* One leb128 argument. */
return skip_leb128 (iter, end);
+ case DW_CFA_val_offset:
+ case DW_CFA_val_offset_sf:
case DW_CFA_offset_extended:
case DW_CFA_register:
case DW_CFA_def_cfa:
@@ -308,6 +378,7 @@ skip_cfa_op (bfd_byte **iter, bfd_byte *end, unsigned int encoded_ptr_width)
&& skip_bytes (iter, end, length));
case DW_CFA_expression:
+ case DW_CFA_val_expression:
/* A leb128 followed by a variable-length argument. */
return (skip_leb128 (iter, end)
&& read_uleb128 (iter, end, &length)
@@ -339,7 +410,8 @@ skip_cfa_op (bfd_byte **iter, bfd_byte *end, unsigned int encoded_ptr_width)
ENCODED_PTR_WIDTH is as for skip_cfa_op. */
static bfd_byte *
-skip_non_nops (bfd_byte *buf, bfd_byte *end, unsigned int encoded_ptr_width)
+skip_non_nops (bfd_byte *buf, bfd_byte *end, unsigned int encoded_ptr_width,
+ unsigned int *set_loc_count)
{
bfd_byte *last;
@@ -349,6 +421,8 @@ skip_non_nops (bfd_byte *buf, bfd_byte *end, unsigned int encoded_ptr_width)
buf++;
else
{
+ if (*buf == DW_CFA_set_loc)
+ ++*set_loc_count;
if (!skip_cfa_op (&buf, end, encoded_ptr_width))
return 0;
last = buf;
@@ -374,15 +448,24 @@ _bfd_elf_discard_section_eh_frame
while (0)
bfd_byte *ehbuf = NULL, *buf;
- bfd_byte *last_cie, *last_fde;
- struct eh_cie_fde *ent, *last_cie_inf, *this_inf;
- struct cie_header hdr;
- struct cie cie;
+ bfd_byte *last_fde;
+ struct eh_cie_fde *ent, *this_inf;
+ unsigned int hdr_length, hdr_id;
+ struct extended_cie
+ {
+ struct cie cie;
+ unsigned int offset;
+ unsigned int usage_count;
+ unsigned int entry;
+ } *ecies = NULL, *ecie;
+ unsigned int ecie_count = 0, ecie_alloced = 0;
+ struct cie *cie;
struct elf_link_hash_table *htab;
struct eh_frame_hdr_info *hdr_info;
struct eh_frame_sec_info *sec_info = NULL;
- unsigned int cie_usage_count, offset;
+ unsigned int offset;
unsigned int ptr_size;
+ unsigned int entry_alloced;
if (sec->size == 0)
{
@@ -390,8 +473,7 @@ _bfd_elf_discard_section_eh_frame
return FALSE;
}
- if ((sec->output_section != NULL
- && bfd_is_abs_section (sec->output_section)))
+ if (bfd_is_abs_section (sec->output_section))
{
/* At least one of the sections is being discarded from the
link, so we should just ignore them. */
@@ -401,6 +483,9 @@ _bfd_elf_discard_section_eh_frame
htab = elf_hash_table (info);
hdr_info = &htab->eh_info;
+ if (hdr_info->cies == NULL && !info->relocatable)
+ hdr_info->cies = htab_try_create (1, cie_hash, cie_eq, free);
+
/* Read the frame unwind information from abfd. */
REQUIRE (bfd_malloc_and_get_section (abfd, sec, &ehbuf));
@@ -423,15 +508,11 @@ _bfd_elf_discard_section_eh_frame
REQUIRE (ptr_size != 0);
buf = ehbuf;
- last_cie = NULL;
- last_cie_inf = NULL;
- memset (&cie, 0, sizeof (cie));
- cie_usage_count = 0;
sec_info = bfd_zmalloc (sizeof (struct eh_frame_sec_info)
+ 99 * sizeof (struct eh_cie_fde));
REQUIRE (sec_info);
- sec_info->alloced = 100;
+ entry_alloced = 100;
#define ENSURE_NO_RELOCS(buf) \
REQUIRE (!(cookie->rel < cookie->relend \
@@ -454,118 +535,84 @@ _bfd_elf_discard_section_eh_frame
for (;;)
{
char *aug;
- bfd_byte *start, *end, *insns;
+ bfd_byte *start, *end, *insns, *insns_end;
bfd_size_type length;
+ unsigned int set_loc_count;
- if (sec_info->count == sec_info->alloced)
+ if (sec_info->count == entry_alloced)
{
- struct eh_cie_fde *old_entry = sec_info->entry;
sec_info = bfd_realloc (sec_info,
sizeof (struct eh_frame_sec_info)
- + ((sec_info->alloced + 99)
+ + ((entry_alloced + 99)
* sizeof (struct eh_cie_fde)));
REQUIRE (sec_info);
- memset (&sec_info->entry[sec_info->alloced], 0,
+ memset (&sec_info->entry[entry_alloced], 0,
100 * sizeof (struct eh_cie_fde));
- sec_info->alloced += 100;
-
- /* Now fix any pointers into the array. */
- if (last_cie_inf >= old_entry
- && last_cie_inf < old_entry + sec_info->count)
- last_cie_inf = sec_info->entry + (last_cie_inf - old_entry);
+ entry_alloced += 100;
}
this_inf = sec_info->entry + sec_info->count;
last_fde = buf;
- /* If we are at the end of the section, we still need to decide
- on whether to output or discard last encountered CIE (if any). */
+
if ((bfd_size_type) (buf - ehbuf) == sec->size)
- {
- hdr.length = 0;
- hdr.id = (unsigned int) -1;
- end = buf;
- }
- else
- {
- /* Read the length of the entry. */
- REQUIRE (skip_bytes (&buf, ehbuf + sec->size, 4));
- hdr.length = bfd_get_32 (abfd, buf - 4);
+ break;
- /* 64-bit .eh_frame is not supported. */
- REQUIRE (hdr.length != 0xffffffff);
+ /* Read the length of the entry. */
+ REQUIRE (skip_bytes (&buf, ehbuf + sec->size, 4));
+ hdr_length = bfd_get_32 (abfd, buf - 4);
- /* The CIE/FDE must be fully contained in this input section. */
- REQUIRE ((bfd_size_type) (buf - ehbuf) + hdr.length <= sec->size);
- end = buf + hdr.length;
+ /* 64-bit .eh_frame is not supported. */
+ REQUIRE (hdr_length != 0xffffffff);
- this_inf->offset = last_fde - ehbuf;
- this_inf->size = 4 + hdr.length;
+ /* The CIE/FDE must be fully contained in this input section. */
+ REQUIRE ((bfd_size_type) (buf - ehbuf) + hdr_length <= sec->size);
+ end = buf + hdr_length;
- if (hdr.length == 0)
- {
- /* A zero-length CIE should only be found at the end of
- the section. */
- REQUIRE ((bfd_size_type) (buf - ehbuf) == sec->size);
- ENSURE_NO_RELOCS (buf);
- sec_info->count++;
- /* Now just finish last encountered CIE processing and break
- the loop. */
- hdr.id = (unsigned int) -1;
- }
- else
- {
- REQUIRE (skip_bytes (&buf, end, 4));
- hdr.id = bfd_get_32 (abfd, buf - 4);
- REQUIRE (hdr.id != (unsigned int) -1);
- }
+ this_inf->offset = last_fde - ehbuf;
+ this_inf->size = 4 + hdr_length;
+
+ if (hdr_length == 0)
+ {
+ /* A zero-length CIE should only be found at the end of
+ the section. */
+ REQUIRE ((bfd_size_type) (buf - ehbuf) == sec->size);
+ ENSURE_NO_RELOCS (buf);
+ sec_info->count++;
+ break;
}
- if (hdr.id == 0 || hdr.id == (unsigned int) -1)
+ REQUIRE (skip_bytes (&buf, end, 4));
+ hdr_id = bfd_get_32 (abfd, buf - 4);
+
+ if (hdr_id == 0)
{
unsigned int initial_insn_length;
/* CIE */
- if (last_cie != NULL)
+ this_inf->cie = 1;
+
+ if (ecie_count == ecie_alloced)
{
- /* Now check if this CIE is identical to the last CIE,
- in which case we can remove it provided we adjust
- all FDEs. Also, it can be removed if we have removed
- all FDEs using it. */
- if ((!info->relocatable
- && hdr_info->last_cie_sec
- && (sec->output_section
- == hdr_info->last_cie_sec->output_section)
- && cie_compare (&cie, &hdr_info->last_cie) == 0)
- || cie_usage_count == 0)
- last_cie_inf->removed = 1;
- else
- {
- hdr_info->last_cie = cie;
- hdr_info->last_cie_sec = sec;
- last_cie_inf->make_relative = cie.make_relative;
- last_cie_inf->make_lsda_relative = cie.make_lsda_relative;
- last_cie_inf->per_encoding_relative
- = (cie.per_encoding & 0x70) == DW_EH_PE_pcrel;
- }
+ ecies = bfd_realloc (ecies,
+ (ecie_alloced + 20) * sizeof (*ecies));
+ REQUIRE (ecies);
+ memset (&ecies[ecie_alloced], 0, 20 * sizeof (*ecies));
+ ecie_alloced += 20;
}
- if (hdr.id == (unsigned int) -1)
- break;
-
- last_cie_inf = this_inf;
- this_inf->cie = 1;
-
- cie_usage_count = 0;
- memset (&cie, 0, sizeof (cie));
- cie.hdr = hdr;
- REQUIRE (read_byte (&buf, end, &cie.version));
+ cie = &ecies[ecie_count].cie;
+ ecies[ecie_count].offset = this_inf->offset;
+ ecies[ecie_count++].entry = sec_info->count;
+ cie->length = hdr_length;
+ start = buf;
+ REQUIRE (read_byte (&buf, end, &cie->version));
/* Cannot handle unknown versions. */
- REQUIRE (cie.version == 1 || cie.version == 3);
- REQUIRE (strlen ((char *) buf) < sizeof (cie.augmentation));
+ REQUIRE (cie->version == 1 || cie->version == 3);
+ REQUIRE (strlen ((char *) buf) < sizeof (cie->augmentation));
- strcpy (cie.augmentation, (char *) buf);
+ strcpy (cie->augmentation, (char *) buf);
buf = (bfd_byte *) strchr ((char *) buf, '\0') + 1;
ENSURE_NO_RELOCS (buf);
if (buf[0] == 'e' && buf[1] == 'h')
@@ -577,26 +624,26 @@ _bfd_elf_discard_section_eh_frame
REQUIRE (skip_bytes (&buf, end, ptr_size));
SKIP_RELOCS (buf);
}
- REQUIRE (read_uleb128 (&buf, end, &cie.code_align));
- REQUIRE (read_sleb128 (&buf, end, &cie.data_align));
- if (cie.version == 1)
+ REQUIRE (read_uleb128 (&buf, end, &cie->code_align));
+ REQUIRE (read_sleb128 (&buf, end, &cie->data_align));
+ if (cie->version == 1)
{
REQUIRE (buf < end);
- cie.ra_column = *buf++;
+ cie->ra_column = *buf++;
}
else
- REQUIRE (read_uleb128 (&buf, end, &cie.ra_column));
+ REQUIRE (read_uleb128 (&buf, end, &cie->ra_column));
ENSURE_NO_RELOCS (buf);
- cie.lsda_encoding = DW_EH_PE_omit;
- cie.fde_encoding = DW_EH_PE_omit;
- cie.per_encoding = DW_EH_PE_omit;
- aug = cie.augmentation;
+ cie->lsda_encoding = DW_EH_PE_omit;
+ cie->fde_encoding = DW_EH_PE_omit;
+ cie->per_encoding = DW_EH_PE_omit;
+ aug = cie->augmentation;
if (aug[0] != 'e' || aug[1] != 'h')
{
if (*aug == 'z')
{
aug++;
- REQUIRE (read_uleb128 (&buf, end, &cie.augmentation_size));
+ REQUIRE (read_uleb128 (&buf, end, &cie->augmentation_size));
ENSURE_NO_RELOCS (buf);
}
@@ -604,14 +651,14 @@ _bfd_elf_discard_section_eh_frame
switch (*aug++)
{
case 'L':
- REQUIRE (read_byte (&buf, end, &cie.lsda_encoding));
+ REQUIRE (read_byte (&buf, end, &cie->lsda_encoding));
ENSURE_NO_RELOCS (buf);
- REQUIRE (get_DW_EH_PE_width (cie.lsda_encoding, ptr_size));
+ REQUIRE (get_DW_EH_PE_width (cie->lsda_encoding, ptr_size));
break;
case 'R':
- REQUIRE (read_byte (&buf, end, &cie.fde_encoding));
+ REQUIRE (read_byte (&buf, end, &cie->fde_encoding));
ENSURE_NO_RELOCS (buf);
- REQUIRE (get_DW_EH_PE_width (cie.fde_encoding, ptr_size));
+ REQUIRE (get_DW_EH_PE_width (cie->fde_encoding, ptr_size));
break;
case 'S':
break;
@@ -619,18 +666,17 @@ _bfd_elf_discard_section_eh_frame
{
int per_width;
- REQUIRE (read_byte (&buf, end, &cie.per_encoding));
- per_width = get_DW_EH_PE_width (cie.per_encoding,
+ REQUIRE (read_byte (&buf, end, &cie->per_encoding));
+ per_width = get_DW_EH_PE_width (cie->per_encoding,
ptr_size);
REQUIRE (per_width);
- if ((cie.per_encoding & 0xf0) == DW_EH_PE_aligned)
+ if ((cie->per_encoding & 0xf0) == DW_EH_PE_aligned)
{
length = -(buf - ehbuf) & (per_width - 1);
REQUIRE (skip_bytes (&buf, end, length));
}
ENSURE_NO_RELOCS (buf);
- /* Ensure we have a reloc here, against
- a global symbol. */
+ /* Ensure we have a reloc here. */
if (GET_RELOC (buf) != NULL)
{
unsigned long r_symndx;
@@ -641,7 +687,9 @@ _bfd_elf_discard_section_eh_frame
else
#endif
r_symndx = ELF32_R_SYM (cookie->rel->r_info);
- if (r_symndx >= cookie->locsymcount)
+ if (r_symndx >= cookie->locsymcount
+ || ELF_ST_BIND (cookie->locsyms[r_symndx]
+ .st_info) != STB_LOCAL)
{
struct elf_link_hash_entry *h;
@@ -653,14 +701,39 @@ _bfd_elf_discard_section_eh_frame
h = (struct elf_link_hash_entry *)
h->root.u.i.link;
- cie.personality = h;
+ cie->personality.h = h;
}
+ else
+ {
+ Elf_Internal_Sym *sym;
+ asection *sym_sec;
+ bfd_vma val;
+
+ sym = &cookie->locsyms[r_symndx];
+ sym_sec = (bfd_section_from_elf_index
+ (abfd, sym->st_shndx));
+ if (sym_sec != NULL)
+ {
+ if (sym_sec->kept_section != NULL)
+ sym_sec = sym_sec->kept_section;
+ if (sym_sec->output_section != NULL)
+ {
+ val = (sym->st_value
+ + sym_sec->output_offset
+ + sym_sec->output_section->vma);
+ cie->personality.val = val;
+ cie->local_personality = 1;
+ }
+ }
+ }
+
/* Cope with MIPS-style composite relocations. */
do
cookie->rel++;
while (GET_RELOC (buf) != NULL);
}
REQUIRE (skip_bytes (&buf, end, per_width));
+ REQUIRE (cie->local_personality || cie->personality.h);
}
break;
default:
@@ -676,18 +749,18 @@ _bfd_elf_discard_section_eh_frame
->elf_backend_can_make_relative_eh_frame
(abfd, info, sec)))
{
- if ((cie.fde_encoding & 0xf0) == DW_EH_PE_absptr)
- cie.make_relative = 1;
+ if ((cie->fde_encoding & 0xf0) == DW_EH_PE_absptr)
+ cie->make_relative = 1;
/* If the CIE doesn't already have an 'R' entry, it's fairly
easy to add one, provided that there's no aligned data
after the augmentation string. */
- else if (cie.fde_encoding == DW_EH_PE_omit
- && (cie.per_encoding & 0xf0) != DW_EH_PE_aligned)
+ else if (cie->fde_encoding == DW_EH_PE_omit
+ && (cie->per_encoding & 0xf0) != DW_EH_PE_aligned)
{
- if (*cie.augmentation == 0)
+ if (*cie->augmentation == 0)
this_inf->add_augmentation_size = 1;
this_inf->add_fde_encoding = 1;
- cie.make_relative = 1;
+ cie->make_relative = 1;
}
}
@@ -695,30 +768,36 @@ _bfd_elf_discard_section_eh_frame
&& (get_elf_backend_data (abfd)
->elf_backend_can_make_lsda_relative_eh_frame
(abfd, info, sec))
- && (cie.lsda_encoding & 0xf0) == DW_EH_PE_absptr)
- cie.make_lsda_relative = 1;
+ && (cie->lsda_encoding & 0xf0) == DW_EH_PE_absptr)
+ cie->make_lsda_relative = 1;
/* If FDE encoding was not specified, it defaults to
DW_EH_absptr. */
- if (cie.fde_encoding == DW_EH_PE_omit)
- cie.fde_encoding = DW_EH_PE_absptr;
+ if (cie->fde_encoding == DW_EH_PE_omit)
+ cie->fde_encoding = DW_EH_PE_absptr;
initial_insn_length = end - buf;
- if (initial_insn_length <= 50)
+ if (initial_insn_length <= sizeof (cie->initial_instructions))
{
- cie.initial_insn_length = initial_insn_length;
- memcpy (cie.initial_instructions, buf, initial_insn_length);
+ cie->initial_insn_length = initial_insn_length;
+ memcpy (cie->initial_instructions, buf, initial_insn_length);
}
insns = buf;
buf += initial_insn_length;
ENSURE_NO_RELOCS (buf);
- last_cie = last_fde;
}
else
{
- /* Ensure this FDE uses the last CIE encountered. */
- REQUIRE (last_cie);
- REQUIRE (hdr.id == (unsigned int) (buf - 4 - last_cie));
+ /* Find the corresponding CIE. */
+ unsigned int cie_offset = this_inf->offset + 4 - hdr_id;
+ for (ecie = ecies; ecie < ecies + ecie_count; ++ecie)
+ if (cie_offset == ecie->offset)
+ break;
+
+ /* Ensure this FDE references one of the CIEs in this input
+ section. */
+ REQUIRE (ecie != ecies + ecie_count);
+ cie = &ecie->cie;
ENSURE_NO_RELOCS (buf);
REQUIRE (GET_RELOC (buf));
@@ -730,26 +809,31 @@ _bfd_elf_discard_section_eh_frame
else
{
if (info->shared
- && (((cie.fde_encoding & 0xf0) == DW_EH_PE_absptr
- && cie.make_relative == 0)
- || (cie.fde_encoding & 0xf0) == DW_EH_PE_aligned))
+ && (((cie->fde_encoding & 0xf0) == DW_EH_PE_absptr
+ && cie->make_relative == 0)
+ || (cie->fde_encoding & 0xf0) == DW_EH_PE_aligned))
{
/* If a shared library uses absolute pointers
which we cannot turn into PC relative,
don't create the binary search table,
since it is affected by runtime relocations. */
hdr_info->table = FALSE;
+ (*info->callbacks->einfo)
+ (_("%P: fde encoding in %B(%A) prevents .eh_frame_hdr"
+ " table being created.\n"), abfd, sec);
}
- cie_usage_count++;
+ ecie->usage_count++;
hdr_info->fde_count++;
+ this_inf->cie_inf = (void *) (ecie - ecies);
}
+
/* Skip the initial location and address range. */
start = buf;
- length = get_DW_EH_PE_width (cie.fde_encoding, ptr_size);
+ length = get_DW_EH_PE_width (cie->fde_encoding, ptr_size);
REQUIRE (skip_bytes (&buf, end, 2 * length));
/* Skip the augmentation size, if present. */
- if (cie.augmentation[0] == 'z')
+ if (cie->augmentation[0] == 'z')
REQUIRE (read_uleb128 (&buf, end, &length));
else
length = 0;
@@ -757,12 +841,12 @@ _bfd_elf_discard_section_eh_frame
/* Of the supported augmentation characters above, only 'L'
adds augmentation data to the FDE. This code would need to
be adjusted if any future augmentations do the same thing. */
- if (cie.lsda_encoding != DW_EH_PE_omit)
+ if (cie->lsda_encoding != DW_EH_PE_omit)
{
this_inf->lsda_offset = buf - start;
/* If there's no 'z' augmentation, we don't know where the
CFA insns begin. Assume no padding. */
- if (cie.augmentation[0] != 'z')
+ if (cie->augmentation[0] != 'z')
length = end - buf;
}
@@ -770,57 +854,131 @@ _bfd_elf_discard_section_eh_frame
REQUIRE (skip_bytes (&buf, end, length));
insns = buf;
- buf = last_fde + 4 + hdr.length;
+ buf = last_fde + 4 + hdr_length;
SKIP_RELOCS (buf);
}
/* Try to interpret the CFA instructions and find the first
padding nop. Shrink this_inf's size so that it doesn't
- including the padding. */
- length = get_DW_EH_PE_width (cie.fde_encoding, ptr_size);
- insns = skip_non_nops (insns, end, length);
- if (insns != 0)
- this_inf->size -= end - insns;
-
- this_inf->fde_encoding = cie.fde_encoding;
- this_inf->lsda_encoding = cie.lsda_encoding;
+ include the padding. */
+ length = get_DW_EH_PE_width (cie->fde_encoding, ptr_size);
+ set_loc_count = 0;
+ insns_end = skip_non_nops (insns, end, length, &set_loc_count);
+ /* If we don't understand the CFA instructions, we can't know
+ what needs to be adjusted there. */
+ if (insns_end == NULL
+ /* For the time being we don't support DW_CFA_set_loc in
+ CIE instructions. */
+ || (set_loc_count && this_inf->cie))
+ goto free_no_table;
+ this_inf->size -= end - insns_end;
+ if (insns_end != end && this_inf->cie)
+ {
+ cie->initial_insn_length -= end - insns_end;
+ cie->length -= end - insns_end;
+ }
+ if (set_loc_count
+ && ((cie->fde_encoding & 0xf0) == DW_EH_PE_pcrel
+ || cie->make_relative))
+ {
+ unsigned int cnt;
+ bfd_byte *p;
+
+ this_inf->set_loc = bfd_malloc ((set_loc_count + 1)
+ * sizeof (unsigned int));
+ REQUIRE (this_inf->set_loc);
+ this_inf->set_loc[0] = set_loc_count;
+ p = insns;
+ cnt = 0;
+ while (p < end)
+ {
+ if (*p == DW_CFA_set_loc)
+ this_inf->set_loc[++cnt] = p + 1 - start;
+ REQUIRE (skip_cfa_op (&p, end, length));
+ }
+ }
+
+ this_inf->fde_encoding = cie->fde_encoding;
+ this_inf->lsda_encoding = cie->lsda_encoding;
sec_info->count++;
}
elf_section_data (sec)->sec_info = sec_info;
sec->sec_info_type = ELF_INFO_TYPE_EH_FRAME;
+ /* Look at all CIEs in this section and determine which can be
+ removed as unused, which can be merged with previous duplicate
+ CIEs and which need to be kept. */
+ for (ecie = ecies; ecie < ecies + ecie_count; ++ecie)
+ {
+ if (ecie->usage_count == 0)
+ {
+ sec_info->entry[ecie->entry].removed = 1;
+ continue;
+ }
+ ecie->cie.output_sec = sec->output_section;
+ ecie->cie.cie_inf = sec_info->entry + ecie->entry;
+ cie_compute_hash (&ecie->cie);
+ if (hdr_info->cies != NULL)
+ {
+ void **loc = htab_find_slot_with_hash (hdr_info->cies, &ecie->cie,
+ ecie->cie.hash, INSERT);
+ if (loc != NULL)
+ {
+ if (*loc != HTAB_EMPTY_ENTRY)
+ {
+ sec_info->entry[ecie->entry].removed = 1;
+ ecie->cie.cie_inf = ((struct cie *) *loc)->cie_inf;
+ continue;
+ }
+
+ *loc = malloc (sizeof (struct cie));
+ if (*loc == NULL)
+ *loc = HTAB_DELETED_ENTRY;
+ else
+ memcpy (*loc, &ecie->cie, sizeof (struct cie));
+ }
+ }
+ ecie->cie.cie_inf->make_relative = ecie->cie.make_relative;
+ ecie->cie.cie_inf->make_lsda_relative = ecie->cie.make_lsda_relative;
+ ecie->cie.cie_inf->per_encoding_relative
+ = (ecie->cie.per_encoding & 0x70) == DW_EH_PE_pcrel;
+ }
+
/* Ok, now we can assign new offsets. */
offset = 0;
- last_cie_inf = hdr_info->last_cie_inf;
for (ent = sec_info->entry; ent < sec_info->entry + sec_info->count; ++ent)
if (!ent->removed)
{
- if (ent->cie)
- last_cie_inf = ent;
- else
- ent->cie_inf = last_cie_inf;
+ if (!ent->cie)
+ {
+ ecie = ecies + (unsigned long) ent->cie_inf;
+ ent->cie_inf = ecie->cie.cie_inf;
+ }
ent->new_offset = offset;
offset += size_of_output_cie_fde (ent, ptr_size);
}
- hdr_info->last_cie_inf = last_cie_inf;
/* Resize the sec as needed. */
sec->rawsize = sec->size;
sec->size = offset;
- if (sec->size == 0)
- sec->flags |= SEC_EXCLUDE;
free (ehbuf);
+ if (ecies)
+ free (ecies);
return offset != sec->rawsize;
free_no_table:
+ (*info->callbacks->einfo)
+ (_("%P: error in %B(%A); no .eh_frame_hdr table will be created.\n"),
+ abfd, sec);
if (ehbuf)
free (ehbuf);
if (sec_info)
free (sec_info);
+ if (ecies)
+ free (ecies);
hdr_info->table = FALSE;
- hdr_info->last_cie.hdr.length = 0;
return FALSE;
#undef REQUIRE
@@ -839,6 +997,13 @@ _bfd_elf_discard_section_eh_frame_hdr (bfd *abfd, struct bfd_link_info *info)
htab = elf_hash_table (info);
hdr_info = &htab->eh_info;
+
+ if (hdr_info->cies != NULL)
+ {
+ htab_delete (hdr_info->cies);
+ hdr_info->cies = NULL;
+ }
+
sec = hdr_info->hdr_sec;
if (sec == NULL)
return FALSE;
@@ -847,8 +1012,6 @@ _bfd_elf_discard_section_eh_frame_hdr (bfd *abfd, struct bfd_link_info *info)
if (hdr_info->table)
sec->size += 4 + hdr_info->fde_count * 8;
- /* Request program headers to be recalculated. */
- elf_tdata (abfd)->program_header_size = 0;
elf_tdata (abfd)->eh_frame_hdr = sec;
return TRUE;
}
@@ -968,6 +1131,23 @@ _bfd_elf_eh_frame_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED,
return (bfd_vma) -2;
}
+ /* If converting to DW_EH_PE_pcrel, there will be no need for run-time
+ relocation against DW_CFA_set_loc's arguments. */
+ if (sec_info->entry[mid].set_loc
+ && (sec_info->entry[mid].cie
+ ? sec_info->entry[mid].make_relative
+ : sec_info->entry[mid].cie_inf->make_relative)
+ && (offset >= sec_info->entry[mid].offset + 8
+ + sec_info->entry[mid].set_loc[1]))
+ {
+ unsigned int cnt;
+
+ for (cnt = 1; cnt <= sec_info->entry[mid].set_loc[0]; cnt++)
+ if (offset == sec_info->entry[mid].offset + 8
+ + sec_info->entry[mid].set_loc[cnt])
+ return (bfd_vma) -2;
+ }
+
if (hdr_info->offsets_adjusted)
offset -= sec->output_offset;
/* Any new augmentation bytes go before the first relocation. */
@@ -1192,6 +1372,7 @@ _bfd_elf_write_section_eh_frame (bfd *abfd,
/* FDE */
bfd_vma value, address;
unsigned int width;
+ bfd_byte *start;
/* Skip length. */
buf += 4;
@@ -1228,6 +1409,8 @@ _bfd_elf_write_section_eh_frame (bfd *abfd,
write_value (abfd, buf, value, width);
}
+ start = buf;
+
if (hdr_info)
{
hdr_info->array[hdr_info->array_count].initial_loc = address;
@@ -1260,12 +1443,42 @@ _bfd_elf_write_section_eh_frame (bfd *abfd,
memmove (buf + 1, buf, end - buf);
*buf = 0;
}
+
+ if (ent->set_loc)
+ {
+ /* Adjust DW_CFA_set_loc. */
+ unsigned int cnt, width;
+ bfd_vma new_offset;
+
+ width = get_DW_EH_PE_width (ent->fde_encoding, ptr_size);
+ new_offset = ent->new_offset + 8
+ + extra_augmentation_string_bytes (ent)
+ + extra_augmentation_data_bytes (ent);
+
+ for (cnt = 1; cnt <= ent->set_loc[0]; cnt++)
+ {
+ bfd_vma value;
+ buf = start + ent->set_loc[cnt];
+
+ value = read_value (abfd, buf, width,
+ get_DW_EH_PE_signed (ent->fde_encoding));
+ if (!value)
+ continue;
+
+ if ((ent->fde_encoding & 0xf0) == DW_EH_PE_pcrel)
+ value += ent->offset + 8 - new_offset;
+ if (ent->cie_inf->make_relative)
+ value -= sec->output_section->vma + new_offset
+ + ent->set_loc[cnt];
+ write_value (abfd, buf, value, width);
+ }
+ }
}
}
/* We don't align the section to its section alignment since the
runtime library only expects all CIE/FDE records aligned at
- the pointer size. _bfd_elf_discard_section_eh_frame should
+ the pointer size. _bfd_elf_discard_section_eh_frame should
have padded CIE/FDE records to multiple of pointer size with
size_of_output_cie_fde. */
if ((sec->size % ptr_size) != 0)
diff --git a/bfd/elf-hppa.h b/bfd/elf-hppa.h
index c4ad5ad712e1..e676e27fef35 100644
--- a/bfd/elf-hppa.h
+++ b/bfd/elf-hppa.h
@@ -1,22 +1,22 @@
/* Common code for PA ELF implementations.
- Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#define ELF_HOWTO_TABLE_SIZE R_PARISC_UNIMPLEMENTED + 1
@@ -27,30 +27,20 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
external constraints require 32 or 64 bit specific code. We remap
the definitions/functions as necessary here. */
#if ARCH_SIZE == 64
-#define ELF_R_TYPE(X) ELF64_R_TYPE(X)
-#define ELF_R_SYM(X) ELF64_R_SYM(X)
-#define elf_hppa_reloc_final_type elf64_hppa_reloc_final_type
-#define _bfd_elf_hppa_gen_reloc_type _bfd_elf64_hppa_gen_reloc_type
-#define elf_hppa_relocate_section elf64_hppa_relocate_section
-#define elf_hppa_final_link elf64_hppa_final_link
+#define ELF_R_TYPE(X) ELF64_R_TYPE(X)
+#define ELF_R_SYM(X) ELF64_R_SYM(X)
+#define elf_hppa_reloc_final_type elf64_hppa_reloc_final_type
+#define _bfd_elf_hppa_gen_reloc_type _bfd_elf64_hppa_gen_reloc_type
+#define elf_hppa_relocate_section elf64_hppa_relocate_section
+#define elf_hppa_final_link elf64_hppa_final_link
#endif
#if ARCH_SIZE == 32
-#define ELF_R_TYPE(X) ELF32_R_TYPE(X)
-#define ELF_R_SYM(X) ELF32_R_SYM(X)
-#define elf_hppa_reloc_final_type elf32_hppa_reloc_final_type
-#define _bfd_elf_hppa_gen_reloc_type _bfd_elf32_hppa_gen_reloc_type
-#define elf_hppa_relocate_section elf32_hppa_relocate_section
-#define elf_hppa_final_link elf32_hppa_final_link
-#endif
-
-#if ARCH_SIZE == 64
-static bfd_reloc_status_type elf_hppa_final_link_relocate
- (Elf_Internal_Rela *, bfd *, bfd *, asection *, bfd_byte *, bfd_vma,
- struct bfd_link_info *, asection *, struct elf_link_hash_entry *,
- struct elf64_hppa_dyn_hash_entry *);
-
-static int elf_hppa_relocate_insn
- (int, int, unsigned int);
+#define ELF_R_TYPE(X) ELF32_R_TYPE(X)
+#define ELF_R_SYM(X) ELF32_R_SYM(X)
+#define elf_hppa_reloc_final_type elf32_hppa_reloc_final_type
+#define _bfd_elf_hppa_gen_reloc_type _bfd_elf32_hppa_gen_reloc_type
+#define elf_hppa_relocate_section elf32_hppa_relocate_section
+#define elf_hppa_final_link elf32_hppa_final_link
#endif
/* ELF/PA relocation howto entries. */
@@ -64,58 +54,58 @@ static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] =
_bfd_stab_section_find_nearest_line. */
{ R_PARISC_DIR32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_DIR32", FALSE, 0, 0xffffffff, FALSE },
- { R_PARISC_DIR21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_DIR21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_DIR21L", FALSE, 0, 0, FALSE },
- { R_PARISC_DIR17R, 0, 0, 17, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_DIR17R, 0, 2, 17, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_DIR17R", FALSE, 0, 0, FALSE },
- { R_PARISC_DIR17F, 0, 0, 17, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_DIR17F, 0, 2, 17, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_DIR17F", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
- { R_PARISC_DIR14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_DIR14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_DIR14R", FALSE, 0, 0, FALSE },
- { R_PARISC_DIR14F, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_DIR14F, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_DIR14F", FALSE, 0, 0, FALSE },
/* 8 */
- { R_PARISC_PCREL12F, 0, 0, 12, TRUE, 0, complain_overflow_bitfield,
+ { R_PARISC_PCREL12F, 0, 2, 12, TRUE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_PCREL12F", FALSE, 0, 0, FALSE },
- { R_PARISC_PCREL32, 0, 0, 32, TRUE, 0, complain_overflow_bitfield,
+ { R_PARISC_PCREL32, 0, 2, 32, TRUE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_PCREL32", FALSE, 0, 0, FALSE },
- { R_PARISC_PCREL21L, 0, 0, 21, TRUE, 0, complain_overflow_bitfield,
+ { R_PARISC_PCREL21L, 0, 2, 21, TRUE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_PCREL21L", FALSE, 0, 0, FALSE },
- { R_PARISC_PCREL17R, 0, 0, 17, TRUE, 0, complain_overflow_bitfield,
+ { R_PARISC_PCREL17R, 0, 2, 17, TRUE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_PCREL17R", FALSE, 0, 0, FALSE },
- { R_PARISC_PCREL17F, 0, 0, 17, TRUE, 0, complain_overflow_bitfield,
+ { R_PARISC_PCREL17F, 0, 2, 17, TRUE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_PCREL17F", FALSE, 0, 0, FALSE },
- { R_PARISC_PCREL17C, 0, 0, 17, TRUE, 0, complain_overflow_bitfield,
+ { R_PARISC_PCREL17C, 0, 2, 17, TRUE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_PCREL17C", FALSE, 0, 0, FALSE },
- { R_PARISC_PCREL14R, 0, 0, 14, TRUE, 0, complain_overflow_bitfield,
+ { R_PARISC_PCREL14R, 0, 2, 14, TRUE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_PCREL14R", FALSE, 0, 0, FALSE },
- { R_PARISC_PCREL14F, 0, 0, 14, TRUE, 0, complain_overflow_bitfield,
+ { R_PARISC_PCREL14F, 0, 2, 14, TRUE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_PCREL14F", FALSE, 0, 0, FALSE },
/* 16 */
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
- { R_PARISC_DPREL21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_DPREL21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_DPREL21L", FALSE, 0, 0, FALSE },
- { R_PARISC_DPREL14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_DPREL14WR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_DPREL14WR", FALSE, 0, 0, FALSE },
- { R_PARISC_DPREL14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_DPREL14DR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_DPREL14DR", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
- { R_PARISC_DPREL14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_DPREL14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_DPREL14R", FALSE, 0, 0, FALSE },
- { R_PARISC_DPREL14F, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_DPREL14F, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_DPREL14F", FALSE, 0, 0, FALSE },
/* 24 */
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
- { R_PARISC_DLTREL21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_DLTREL21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_DLTREL21L", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
@@ -123,16 +113,16 @@ static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] =
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
- { R_PARISC_DLTREL14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_DLTREL14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_DLTREL14R", FALSE, 0, 0, FALSE },
- { R_PARISC_DLTREL14F, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_DLTREL14F, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_DLTREL14F", FALSE, 0, 0, FALSE },
/* 32 */
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
- { R_PARISC_DLTIND21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_DLTIND21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_DLTIND21L", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
@@ -140,33 +130,33 @@ static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] =
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
- { R_PARISC_DLTIND14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_DLTIND14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_DLTIND14R", FALSE, 0, 0, FALSE },
- { R_PARISC_DLTIND14F, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_DLTIND14F, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_DLTIND14F", FALSE, 0, 0, FALSE },
/* 40 */
{ R_PARISC_SETBASE, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_SETBASE", FALSE, 0, 0, FALSE },
- { R_PARISC_SECREL32, 0, 0, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_PARISC_SECREL32", FALSE, 0, 0, FALSE },
- { R_PARISC_BASEREL21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_SECREL32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_PARISC_SECREL32", FALSE, 0, 0xffffffff, FALSE },
+ { R_PARISC_BASEREL21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_BASEREL21L", FALSE, 0, 0, FALSE },
- { R_PARISC_BASEREL17R, 0, 0, 17, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_BASEREL17R, 0, 2, 17, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_BASEREL17R", FALSE, 0, 0, FALSE },
- { R_PARISC_BASEREL17F, 0, 0, 17, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_BASEREL17F, 0, 2, 17, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_BASEREL17F", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
- { R_PARISC_BASEREL14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_BASEREL14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_BASEREL14R", FALSE, 0, 0, FALSE },
- { R_PARISC_BASEREL14F, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_BASEREL14F, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_BASEREL14F", FALSE, 0, 0, FALSE },
/* 48 */
{ R_PARISC_SEGBASE, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_SEGBASE", FALSE, 0, 0, FALSE },
- { R_PARISC_SEGREL32, 0, 0, 32, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_SEGREL32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_SEGREL32", FALSE, 0, 0, FALSE },
- { R_PARISC_PLTOFF21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_PLTOFF21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_PLTOFF21L", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
@@ -174,16 +164,16 @@ static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] =
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
- { R_PARISC_PLTOFF14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_PLTOFF14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_PLTOFF14R", FALSE, 0, 0, FALSE },
- { R_PARISC_PLTOFF14F, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_PLTOFF14F, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_PLTOFF14F", FALSE, 0, 0, FALSE },
/* 56 */
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
- { R_PARISC_LTOFF_FPTR32, 0, 0, 32, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_LTOFF_FPTR32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR32", FALSE, 0, 0, FALSE },
- { R_PARISC_LTOFF_FPTR21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_LTOFF_FPTR21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR21L", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
@@ -191,16 +181,16 @@ static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] =
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
- { R_PARISC_LTOFF_FPTR14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_LTOFF_FPTR14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14R", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
/* 64 */
- { R_PARISC_FPTR64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_FPTR64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_FPTR64", FALSE, 0, 0, FALSE },
- { R_PARISC_PLABEL32, 0, 0, 32, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_PLABEL32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_PLABEL32", FALSE, 0, 0, FALSE },
- { R_PARISC_PLABEL21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_PLABEL21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_PLABEL21L", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
@@ -208,86 +198,86 @@ static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] =
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
- { R_PARISC_PLABEL14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_PLABEL14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_PLABEL14R", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
/* 72 */
- { R_PARISC_PCREL64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_PCREL64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_PCREL64", FALSE, 0, 0, FALSE },
- { R_PARISC_PCREL22C, 0, 0, 22, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_PCREL22C, 0, 2, 22, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_PCREL22C", FALSE, 0, 0, FALSE },
- { R_PARISC_PCREL22F, 0, 0, 22, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_PCREL22F, 0, 2, 22, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_PCREL22F", FALSE, 0, 0, FALSE },
- { R_PARISC_PCREL14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_PCREL14WR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_PCREL14WR", FALSE, 0, 0, FALSE },
- { R_PARISC_PCREL14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_PCREL14DR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_PCREL14DR", FALSE, 0, 0, FALSE },
- { R_PARISC_PCREL16F, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_PCREL16F, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_PCREL16F", FALSE, 0, 0, FALSE },
- { R_PARISC_PCREL16WF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_PCREL16WF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_PCREL16WF", FALSE, 0, 0, FALSE },
- { R_PARISC_PCREL16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_PCREL16DF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_PCREL16DF", FALSE, 0, 0, FALSE },
/* 80 */
- { R_PARISC_DIR64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_DIR64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_DIR64", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
- { R_PARISC_DIR14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_DIR14WR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_DIR14WR", FALSE, 0, 0, FALSE },
- { R_PARISC_DIR14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_DIR14DR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_DIR14DR", FALSE, 0, 0, FALSE },
- { R_PARISC_DIR16F, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_DIR16F, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_DIR16F", FALSE, 0, 0, FALSE },
- { R_PARISC_DIR16WF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_DIR16WF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_DIR16WF", FALSE, 0, 0, FALSE },
- { R_PARISC_DIR16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_DIR16DF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_DIR16DF", FALSE, 0, 0, FALSE },
/* 88 */
- { R_PARISC_GPREL64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_GPREL64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_GPREL64", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
- { R_PARISC_DLTREL14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_DLTREL14WR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_DLTREL14WR", FALSE, 0, 0, FALSE },
- { R_PARISC_DLTREL14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_DLTREL14DR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_DLTREL14DR", FALSE, 0, 0, FALSE },
- { R_PARISC_GPREL16F, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_GPREL16F, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_GPREL16F", FALSE, 0, 0, FALSE },
- { R_PARISC_GPREL16WF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_GPREL16WF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_GPREL16WF", FALSE, 0, 0, FALSE },
- { R_PARISC_GPREL16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_GPREL16DF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_GPREL16DF", FALSE, 0, 0, FALSE },
/* 96 */
- { R_PARISC_LTOFF64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_LTOFF64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_LTOFF64", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
- { R_PARISC_DLTIND14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_DLTIND14WR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_DLTIND14WR", FALSE, 0, 0, FALSE },
- { R_PARISC_DLTIND14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_DLTIND14DR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_DLTIND14DR", FALSE, 0, 0, FALSE },
- { R_PARISC_LTOFF16F, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_LTOFF16F, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_LTOFF16F", FALSE, 0, 0, FALSE },
- { R_PARISC_LTOFF16WF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_LTOFF16WF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_LTOFF16DF", FALSE, 0, 0, FALSE },
- { R_PARISC_LTOFF16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_LTOFF16DF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_LTOFF16DF", FALSE, 0, 0, FALSE },
/* 104 */
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
- { R_PARISC_BASEREL14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_BASEREL14WR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_BASEREL14WR", FALSE, 0, 0, FALSE },
- { R_PARISC_BASEREL14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_BASEREL14DR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_BASEREL14DR", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
@@ -298,38 +288,38 @@ static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] =
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
/* 112 */
- { R_PARISC_SEGREL64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_SEGREL64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_SEGREL64", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
- { R_PARISC_PLTOFF14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_PLTOFF14WR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_PLTOFF14WR", FALSE, 0, 0, FALSE },
- { R_PARISC_PLTOFF14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_PLTOFF14DR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_PLTOFF14DR", FALSE, 0, 0, FALSE },
- { R_PARISC_PLTOFF16F, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_PLTOFF16F, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_PLTOFF16F", FALSE, 0, 0, FALSE },
- { R_PARISC_PLTOFF16WF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_PLTOFF16WF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_PLTOFF16WF", FALSE, 0, 0, FALSE },
- { R_PARISC_PLTOFF16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_PLTOFF16DF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_PLTOFF16DF", FALSE, 0, 0, FALSE },
/* 120 */
- { R_PARISC_LTOFF_FPTR64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_LTOFF_FPTR64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
- { R_PARISC_LTOFF_FPTR14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_LTOFF_FPTR14WR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14WR", FALSE, 0, 0, FALSE },
- { R_PARISC_LTOFF_FPTR14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_LTOFF_FPTR14DR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14DR", FALSE, 0, 0, FALSE },
- { R_PARISC_LTOFF_FPTR16F, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_LTOFF_FPTR16F, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR16F", FALSE, 0, 0, FALSE },
- { R_PARISC_LTOFF_FPTR16WF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_LTOFF_FPTR16WF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR16WF", FALSE, 0, 0, FALSE },
- { R_PARISC_LTOFF_FPTR16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_LTOFF_FPTR16DF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
/* 128 */
{ R_PARISC_COPY, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
@@ -385,9 +375,9 @@ static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] =
/* 152 */
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
- { R_PARISC_TPREL32, 0, 0, 32, FALSE, 0, complain_overflow_dont,
+ { R_PARISC_TPREL32, 0, 2, 32, FALSE, 0, complain_overflow_dont,
bfd_elf_generic_reloc, "R_PARISC_TPREL32", FALSE, 0, 0, FALSE },
- { R_PARISC_TPREL21L, 0, 0, 21, FALSE, 0, complain_overflow_dont,
+ { R_PARISC_TPREL21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_TPREL21L", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
@@ -395,7 +385,7 @@ static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] =
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
- { R_PARISC_TPREL14R, 0, 0, 14, FALSE, 0, complain_overflow_dont,
+ { R_PARISC_TPREL14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_TPREL14R", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
@@ -404,7 +394,7 @@ static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] =
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
- { R_PARISC_LTOFF_TP21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_LTOFF_TP21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP21L", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
@@ -412,9 +402,9 @@ static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] =
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
- { R_PARISC_LTOFF_TP14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
- { R_PARISC_LTOFF_TP14F, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_LTOFF_TP14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14R", FALSE, 0, 0, FALSE },
+ { R_PARISC_LTOFF_TP14F, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14F", FALSE, 0, 0, FALSE },
/* 168 */
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
@@ -519,44 +509,69 @@ static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] =
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
/* 216 */
- { R_PARISC_TPREL64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_TPREL64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_TPREL64", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
- { R_PARISC_TPREL14WR, 0, 0, 14, FALSE, 0, complain_overflow_dont,
+ { R_PARISC_TPREL14WR, 0, 2, 14, FALSE, 0, complain_overflow_dont,
bfd_elf_generic_reloc, "R_PARISC_TPREL14WR", FALSE, 0, 0, FALSE },
- { R_PARISC_TPREL14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_TPREL14DR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_TPREL14DR", FALSE, 0, 0, FALSE },
- { R_PARISC_TPREL16F, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_TPREL16F, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_TPREL16F", FALSE, 0, 0, FALSE },
- { R_PARISC_TPREL16WF, 0, 0, 16, FALSE, 0, complain_overflow_dont,
+ { R_PARISC_TPREL16WF, 0, 2, 16, FALSE, 0, complain_overflow_dont,
bfd_elf_generic_reloc, "R_PARISC_TPREL16WF", FALSE, 0, 0, FALSE },
- { R_PARISC_TPREL16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_TPREL16DF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_TPREL16DF", FALSE, 0, 0, FALSE },
/* 224 */
- { R_PARISC_LTOFF_TP64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_LTOFF_TP64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP64", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
{ R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE },
- { R_PARISC_LTOFF_TP14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_LTOFF_TP14WR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14WR", FALSE, 0, 0, FALSE },
- { R_PARISC_LTOFF_TP14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_LTOFF_TP14DR, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14DR", FALSE, 0, 0, FALSE },
- { R_PARISC_LTOFF_TP16F, 0, 0, 16, FALSE, 0, complain_overflow_dont,
+ { R_PARISC_LTOFF_TP16F, 0, 2, 16, FALSE, 0, complain_overflow_dont,
bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16F", FALSE, 0, 0, FALSE },
- { R_PARISC_LTOFF_TP16WF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_LTOFF_TP16WF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16WF", FALSE, 0, 0, FALSE },
- { R_PARISC_LTOFF_TP16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield,
+ { R_PARISC_LTOFF_TP16DF, 0, 2, 16, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16DF", FALSE, 0, 0, FALSE },
/* 232 */
{ R_PARISC_GNU_VTENTRY, 0, 0, 0, FALSE, 0, complain_overflow_dont,
bfd_elf_generic_reloc, "R_PARISC_GNU_VTENTRY", FALSE, 0, 0, FALSE },
{ R_PARISC_GNU_VTINHERIT, 0, 0, 0, FALSE, 0, complain_overflow_dont,
bfd_elf_generic_reloc, "R_PARISC_GNU_VTINHERIT", FALSE, 0, 0, FALSE },
+ { R_PARISC_TLS_GD21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_PARISC_TLS_GD21L", FALSE, 0, 0, FALSE },
+ { R_PARISC_TLS_GD14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_PARISC_TLS_GD14R", FALSE, 0, 0, FALSE },
+ { R_PARISC_TLS_GDCALL, 0, 0, 0, FALSE, 0, complain_overflow_dont,
+ bfd_elf_generic_reloc, "R_PARISC_TLS_GDCALL", FALSE, 0, 0, FALSE },
+ { R_PARISC_TLS_LDM21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_PARISC_TLS_LDM21L", FALSE, 0, 0, FALSE },
+ { R_PARISC_TLS_LDM14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_PARISC_TLS_LDM14R", FALSE, 0, 0, FALSE },
+ { R_PARISC_TLS_LDMCALL, 0, 0, 0, FALSE, 0, complain_overflow_dont,
+ bfd_elf_generic_reloc, "R_PARISC_TLS_LDMCALL", FALSE, 0, 0, FALSE },
+ /* 240 */
+ { R_PARISC_TLS_LDO21L, 0, 2, 21, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_PARISC_TLS_LDO21L", FALSE, 0, 0, FALSE },
+ { R_PARISC_TLS_LDO14R, 0, 2, 14, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_PARISC_TLS_LDO14R", FALSE, 0, 0, FALSE },
+ { R_PARISC_TLS_DTPMOD32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_PARISC_TLS_DTPMOD32", FALSE, 0, 0, FALSE },
+ { R_PARISC_TLS_DTPMOD64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_PARISC_TLS_DTPMOD64", FALSE, 0, 0, FALSE },
+ { R_PARISC_TLS_DTPOFF32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_PARISC_TLS_DTPOFF32", FALSE, 0, 0, FALSE },
+ { R_PARISC_TLS_DTPOFF64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_PARISC_TLS_DTPOFF64", FALSE, 0, 0, FALSE },
};
#define OFFSET_14R_FROM_21L 4
@@ -578,9 +593,9 @@ elf_hppa_reloc_final_type (bfd *abfd,
for PA ELF. */
switch (base_type)
{
- /* We have been using generic relocation types. However, that may not
- really make sense. Anyway, we need to support both R_PARISC_DIR64
- and R_PARISC_DIR32 here. */
+ /* We have been using generic relocation types. However, that may not
+ really make sense. Anyway, we need to support both R_PARISC_DIR64
+ and R_PARISC_DIR32 here. */
case R_PARISC_DIR32:
case R_PARISC_DIR64:
case R_HPPA_ABS_CALL:
@@ -701,11 +716,11 @@ elf_hppa_reloc_final_type (bfd *abfd,
case e_rsel:
case e_rrsel:
case e_rdsel:
- /* R_PARISC_DLTREL14R for elf64, R_PARISC_DPREL14R for elf32 */
+ /* R_PARISC_DLTREL14R for elf64, R_PARISC_DPREL14R for elf32. */
final_type = base_type + OFFSET_14R_FROM_21L;
break;
case e_fsel:
- /* R_PARISC_DLTREL14F for elf64, R_PARISC_DPREL14F for elf32 */
+ /* R_PARISC_DLTREL14F for elf64, R_PARISC_DPREL14F for elf32. */
final_type = base_type + OFFSET_14F_FROM_21L;
break;
default:
@@ -721,7 +736,7 @@ elf_hppa_reloc_final_type (bfd *abfd,
case e_ldsel:
case e_nlsel:
case e_nlrsel:
- /* R_PARISC_DLTREL21L for elf64, R_PARISC_DPREL21L for elf32 */
+ /* R_PARISC_DLTREL21L for elf64, R_PARISC_DPREL21L for elf32. */
final_type = base_type;
break;
default:
@@ -838,6 +853,82 @@ elf_hppa_reloc_final_type (bfd *abfd,
}
break;
+ case R_PARISC_TLS_GD21L:
+ switch (field)
+ {
+ case e_ltsel:
+ case e_lrsel:
+ final_type = R_PARISC_TLS_GD21L;
+ break;
+ case e_rtsel:
+ case e_rrsel:
+ final_type = R_PARISC_TLS_GD14R;
+ break;
+ default:
+ return R_PARISC_NONE;
+ }
+ break;
+
+ case R_PARISC_TLS_LDM21L:
+ switch (field)
+ {
+ case e_ltsel:
+ case e_lrsel:
+ final_type = R_PARISC_TLS_LDM21L;
+ break;
+ case e_rtsel:
+ case e_rrsel:
+ final_type = R_PARISC_TLS_LDM14R;
+ break;
+ default:
+ return R_PARISC_NONE;
+ }
+ break;
+
+ case R_PARISC_TLS_LDO21L:
+ switch (field)
+ {
+ case e_lrsel:
+ final_type = R_PARISC_TLS_LDO21L;
+ break;
+ case e_rrsel:
+ final_type = R_PARISC_TLS_LDO14R;
+ break;
+ default:
+ return R_PARISC_NONE;
+ }
+ break;
+
+ case R_PARISC_TLS_IE21L:
+ switch (field)
+ {
+ case e_ltsel:
+ case e_lrsel:
+ final_type = R_PARISC_TLS_IE21L;
+ break;
+ case e_rtsel:
+ case e_rrsel:
+ final_type = R_PARISC_TLS_IE14R;
+ break;
+ default:
+ return R_PARISC_NONE;
+ }
+ break;
+
+ case R_PARISC_TLS_LE21L:
+ switch (field)
+ {
+ case e_lrsel:
+ final_type = R_PARISC_TLS_LE21L;
+ break;
+ case e_rrsel:
+ final_type = R_PARISC_TLS_LE14R;
+ break;
+ default:
+ return R_PARISC_NONE;
+ }
+ break;
+
case R_PARISC_GNU_VTENTRY:
case R_PARISC_GNU_VTINHERIT:
case R_PARISC_SEGREL32:
@@ -906,7 +997,7 @@ elf_hppa_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED,
arelent *bfd_reloc,
Elf_Internal_Rela *elf_reloc)
{
- BFD_ASSERT (ELF_R_TYPE(elf_reloc->r_info)
+ BFD_ASSERT (ELF_R_TYPE (elf_reloc->r_info)
< (unsigned int) R_PARISC_UNIMPLEMENTED);
bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)];
}
@@ -926,13 +1017,29 @@ elf_hppa_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return NULL;
}
+static reloc_howto_type *
+elf_hppa_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (elf_hppa_howto_table) / sizeof (elf_hppa_howto_table[0]);
+ i++)
+ if (elf_hppa_howto_table[i].name != NULL
+ && strcasecmp (elf_hppa_howto_table[i].name, r_name) == 0)
+ return &elf_hppa_howto_table[i];
+
+ return NULL;
+}
+
/* Return TRUE if SYM represents a local label symbol. */
static bfd_boolean
elf_hppa_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED, const char *name)
{
if (name[0] == 'L' && name[1] == '$')
- return 1;
+ return TRUE;
return _bfd_elf_is_local_label_name (abfd, name);
}
@@ -950,6 +1057,7 @@ elf_hppa_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec)
{
int indx;
asection *asec;
+
#if ARCH_SIZE == 64
hdr->sh_type = SHT_LOPROC + 1;
#else
@@ -1030,7 +1138,8 @@ hppa_unwind_entry_compare (const void *a, const void *b)
return av < bv ? -1 : av > bv ? 1 : 0;
}
-static bfd_boolean elf_hppa_sort_unwind (bfd *abfd)
+static bfd_boolean
+elf_hppa_sort_unwind (bfd *abfd)
{
asection *s;
@@ -1315,208 +1424,116 @@ elf_hppa_final_link (bfd *abfd, struct bfd_link_info *info)
return retval;
}
-/* Relocate an HPPA ELF section. */
+/* Relocate the given INSN. VALUE should be the actual value we want
+ to insert into the instruction, ie by this point we should not be
+ concerned with computing an offset relative to the DLT, PC, etc.
+ Instead this routine is meant to handle the bit manipulations needed
+ to insert the relocation into the given instruction. */
-static bfd_boolean
-elf_hppa_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)
+static int
+elf_hppa_relocate_insn (int insn, int sym_value, unsigned int r_type)
{
- Elf_Internal_Shdr *symtab_hdr;
- Elf_Internal_Rela *rel;
- Elf_Internal_Rela *relend;
- struct elf64_hppa_link_hash_table *hppa_info;
-
- if (info->relocatable)
- return TRUE;
-
- hppa_info = elf64_hppa_hash_table (info);
- symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
-
- rel = relocs;
- relend = relocs + input_section->reloc_count;
- for (; rel < relend; rel++)
+ switch (r_type)
{
- int r_type;
- reloc_howto_type *howto = elf_hppa_howto_table + ELF_R_TYPE (rel->r_info);
- unsigned long r_symndx;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
- asection *sym_sec;
- bfd_vma relocation;
- bfd_reloc_status_type r;
- const char *dyn_name;
- char *dynh_buf = NULL;
- size_t dynh_buflen = 0;
- struct elf64_hppa_dyn_hash_entry *dyn_h = NULL;
-
- r_type = ELF_R_TYPE (rel->r_info);
- if (r_type < 0 || r_type >= (int) R_PARISC_UNIMPLEMENTED)
- {
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- /* This is a final link. */
- r_symndx = ELF_R_SYM (rel->r_info);
- h = NULL;
- sym = NULL;
- sym_sec = NULL;
- if (r_symndx < symtab_hdr->sh_info)
- {
- /* This is a local symbol. */
- sym = local_syms + r_symndx;
- sym_sec = local_sections[r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sym_sec, rel);
-
- /* If this symbol has an entry in the PA64 dynamic hash
- table, then get it. */
- dyn_name = get_dyn_name (input_bfd, h, rel,
- &dynh_buf, &dynh_buflen);
- dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
- dyn_name, FALSE, FALSE);
-
- }
- else
- {
- /* This is not a local symbol. */
- long indx;
+ /* This is any 22 bit branch. In PA2.0 syntax it corresponds to
+ the "B" instruction. */
+ case R_PARISC_PCREL22F:
+ case R_PARISC_PCREL22C:
+ return (insn & ~0x3ff1ffd) | re_assemble_22 (sym_value);
- 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;
- if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- {
- sym_sec = h->root.u.def.section;
+ /* This is any 12 bit branch. */
+ case R_PARISC_PCREL12F:
+ return (insn & ~0x1ffd) | re_assemble_12 (sym_value);
- /* If this symbol has an entry in the PA64 dynamic hash
- table, then get it. */
- dyn_name = get_dyn_name (input_bfd, h, rel,
- &dynh_buf, &dynh_buflen);
- dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
- dyn_name, FALSE, FALSE);
+ /* This is any 17 bit branch. In PA2.0 syntax it also corresponds
+ to the "B" instruction as well as BE. */
+ case R_PARISC_PCREL17F:
+ case R_PARISC_DIR17F:
+ case R_PARISC_DIR17R:
+ case R_PARISC_PCREL17C:
+ case R_PARISC_PCREL17R:
+ return (insn & ~0x1f1ffd) | re_assemble_17 (sym_value);
- /* If we have a relocation against a symbol defined in a
- shared library and we have not created an entry in the
- PA64 dynamic symbol hash table for it, then we lose. */
- if (sym_sec->output_section == NULL && dyn_h == NULL)
- {
- (*_bfd_error_handler)
- (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
- input_bfd,
- input_section,
- (long) rel->r_offset,
- howto->name,
- h->root.root.string);
- relocation = 0;
- }
- else if (sym_sec->output_section)
- relocation = (h->root.u.def.value
- + sym_sec->output_offset
- + sym_sec->output_section->vma);
- /* Value will be provided via one of the offsets in the
- dyn_h hash table entry. */
- else
- relocation = 0;
- }
- else if (info->unresolved_syms_in_objects == RM_IGNORE
- && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
- {
- /* If this symbol has an entry in the PA64 dynamic hash
- table, then get it. */
- dyn_name = get_dyn_name (input_bfd, h, rel,
- &dynh_buf, &dynh_buflen);
- dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
- dyn_name, FALSE, FALSE);
+ /* ADDIL or LDIL instructions. */
+ case R_PARISC_DLTREL21L:
+ case R_PARISC_DLTIND21L:
+ case R_PARISC_LTOFF_FPTR21L:
+ case R_PARISC_PCREL21L:
+ case R_PARISC_LTOFF_TP21L:
+ case R_PARISC_DPREL21L:
+ case R_PARISC_PLTOFF21L:
+ case R_PARISC_DIR21L:
+ return (insn & ~0x1fffff) | re_assemble_21 (sym_value);
- if (dyn_h == NULL)
- {
- (*_bfd_error_handler)
- (_("%B(%A): warning: unresolvable relocation against symbol `%s'"),
- input_bfd, input_section, h->root.root.string);
- }
- relocation = 0;
- }
- else if (h->root.type == bfd_link_hash_undefweak)
- {
- dyn_name = get_dyn_name (input_bfd, h, rel,
- &dynh_buf, &dynh_buflen);
- dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
- dyn_name, FALSE, FALSE);
+ /* LDO and integer loads/stores with 14 bit displacements. */
+ case R_PARISC_DLTREL14R:
+ case R_PARISC_DLTREL14F:
+ case R_PARISC_DLTIND14R:
+ case R_PARISC_DLTIND14F:
+ case R_PARISC_LTOFF_FPTR14R:
+ case R_PARISC_PCREL14R:
+ case R_PARISC_PCREL14F:
+ case R_PARISC_LTOFF_TP14R:
+ case R_PARISC_LTOFF_TP14F:
+ case R_PARISC_DPREL14R:
+ case R_PARISC_DPREL14F:
+ case R_PARISC_PLTOFF14R:
+ case R_PARISC_PLTOFF14F:
+ case R_PARISC_DIR14R:
+ case R_PARISC_DIR14F:
+ return (insn & ~0x3fff) | low_sign_unext (sym_value, 14);
- if (dyn_h == NULL)
- {
- (*_bfd_error_handler)
- (_("%B(%A): warning: unresolvable relocation against symbol `%s'"),
- input_bfd, input_section, h->root.root.string);
- }
- relocation = 0;
- }
- else
- {
- /* Ignore dynamic loader defined symbols. */
- if (elf_hppa_is_dynamic_loader_symbol (h->root.root.string))
- relocation = 0;
- else
- {
- if (!((*info->callbacks->undefined_symbol)
- (info, h->root.root.string, input_bfd,
- input_section, rel->r_offset,
- (info->unresolved_syms_in_objects == RM_GENERATE_ERROR
- || ELF_ST_VISIBILITY (h->other)))))
- return FALSE;
- break;
- }
- }
- }
+ /* PA2.0W LDO and integer loads/stores with 16 bit displacements. */
+ case R_PARISC_LTOFF_FPTR16F:
+ case R_PARISC_PCREL16F:
+ case R_PARISC_LTOFF_TP16F:
+ case R_PARISC_GPREL16F:
+ case R_PARISC_PLTOFF16F:
+ case R_PARISC_DIR16F:
+ case R_PARISC_LTOFF16F:
+ return (insn & ~0xffff) | re_assemble_16 (sym_value);
- r = elf_hppa_final_link_relocate (rel, input_bfd, output_bfd,
- input_section, contents,
- relocation, info, sym_sec,
- h, dyn_h);
+ /* Doubleword loads and stores with a 14 bit displacement. */
+ case R_PARISC_DLTREL14DR:
+ case R_PARISC_DLTIND14DR:
+ case R_PARISC_LTOFF_FPTR14DR:
+ case R_PARISC_LTOFF_FPTR16DF:
+ case R_PARISC_PCREL14DR:
+ case R_PARISC_PCREL16DF:
+ case R_PARISC_LTOFF_TP14DR:
+ case R_PARISC_LTOFF_TP16DF:
+ case R_PARISC_DPREL14DR:
+ case R_PARISC_GPREL16DF:
+ case R_PARISC_PLTOFF14DR:
+ case R_PARISC_PLTOFF16DF:
+ case R_PARISC_DIR14DR:
+ case R_PARISC_DIR16DF:
+ case R_PARISC_LTOFF16DF:
+ return (insn & ~0x3ff1) | (((sym_value & 0x2000) >> 13)
+ | ((sym_value & 0x1ff8) << 1));
- if (r != bfd_reloc_ok)
- {
- switch (r)
- {
- default:
- abort ();
- case bfd_reloc_overflow:
- {
- const char *sym_name;
-
- if (h != NULL)
- sym_name = NULL;
- else
- {
- sym_name = bfd_elf_string_from_elf_section (input_bfd,
- symtab_hdr->sh_link,
- sym->st_name);
- if (sym_name == NULL)
- return FALSE;
- if (*sym_name == '\0')
- sym_name = bfd_section_name (input_bfd, sym_sec);
- }
+ /* Floating point single word load/store instructions. */
+ case R_PARISC_DLTREL14WR:
+ case R_PARISC_DLTIND14WR:
+ case R_PARISC_LTOFF_FPTR14WR:
+ case R_PARISC_LTOFF_FPTR16WF:
+ case R_PARISC_PCREL14WR:
+ case R_PARISC_PCREL16WF:
+ case R_PARISC_LTOFF_TP14WR:
+ case R_PARISC_LTOFF_TP16WF:
+ case R_PARISC_DPREL14WR:
+ case R_PARISC_GPREL16WF:
+ case R_PARISC_PLTOFF14WR:
+ case R_PARISC_PLTOFF16WF:
+ case R_PARISC_DIR16WF:
+ case R_PARISC_DIR14WR:
+ case R_PARISC_LTOFF16WF:
+ return (insn & ~0x3ff9) | (((sym_value & 0x2000) >> 13)
+ | ((sym_value & 0x1ffc) << 1));
- if (!((*info->callbacks->reloc_overflow)
- (info, (h ? &h->root : NULL), sym_name,
- howto->name, (bfd_vma) 0, input_bfd,
- input_section, rel->r_offset)))
- return FALSE;
- }
- break;
- }
- }
+ default:
+ return insn;
}
- return TRUE;
}
/* Compute the value for a relocation (REL) during a final link stage,
@@ -1806,10 +1823,8 @@ elf_hppa_final_link_relocate (Elf_Internal_Rela *rel,
value = hppa_field_adjust (value, addend, e_rrsel);
if (r_type == R_PARISC_DIR17R || r_type == R_PARISC_DIR17F)
- {
- /* All branches are implicitly shifted by 2 places. */
- value >>= 2;
- }
+ /* All branches are implicitly shifted by 2 places. */
+ value >>= 2;
insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
break;
@@ -2081,115 +2096,212 @@ elf_hppa_final_link_relocate (Elf_Internal_Rela *rel,
return bfd_reloc_ok;
}
-/* Relocate the given INSN. VALUE should be the actual value we want
- to insert into the instruction, ie by this point we should not be
- concerned with computing an offset relative to the DLT, PC, etc.
- Instead this routine is meant to handle the bit manipulations needed
- to insert the relocation into the given instruction. */
+/* Relocate an HPPA ELF section. */
-static int
-elf_hppa_relocate_insn (int insn, int sym_value, unsigned int r_type)
+static bfd_boolean
+elf_hppa_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)
{
- switch (r_type)
+ Elf_Internal_Shdr *symtab_hdr;
+ Elf_Internal_Rela *rel;
+ Elf_Internal_Rela *relend;
+ struct elf64_hppa_link_hash_table *hppa_info;
+
+ hppa_info = elf64_hppa_hash_table (info);
+ symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+
+ rel = relocs;
+ relend = relocs + input_section->reloc_count;
+ for (; rel < relend; rel++)
{
- /* This is any 22 bit branch. In PA2.0 syntax it corresponds to
- the "B" instruction. */
- case R_PARISC_PCREL22F:
- case R_PARISC_PCREL22C:
- return (insn & ~0x3ff1ffd) | re_assemble_22 (sym_value);
+ int r_type;
+ reloc_howto_type *howto = elf_hppa_howto_table + ELF_R_TYPE (rel->r_info);
+ unsigned long r_symndx;
+ struct elf_link_hash_entry *h;
+ Elf_Internal_Sym *sym;
+ asection *sym_sec;
+ bfd_vma relocation;
+ bfd_reloc_status_type r;
+ const char *dyn_name;
+ char *dynh_buf = NULL;
+ size_t dynh_buflen = 0;
+ struct elf64_hppa_dyn_hash_entry *dyn_h = NULL;
- /* This is any 12 bit branch. */
- case R_PARISC_PCREL12F:
- return (insn & ~0x1ffd) | re_assemble_12 (sym_value);
+ r_type = ELF_R_TYPE (rel->r_info);
+ if (r_type < 0 || r_type >= (int) R_PARISC_UNIMPLEMENTED)
+ {
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
- /* This is any 17 bit branch. In PA2.0 syntax it also corresponds
- to the "B" instruction as well as BE. */
- case R_PARISC_PCREL17F:
- case R_PARISC_DIR17F:
- case R_PARISC_DIR17R:
- case R_PARISC_PCREL17C:
- case R_PARISC_PCREL17R:
- return (insn & ~0x1f1ffd) | re_assemble_17 (sym_value);
+ /* This is a final link. */
+ r_symndx = ELF_R_SYM (rel->r_info);
+ h = NULL;
+ sym = NULL;
+ sym_sec = NULL;
+ if (r_symndx < symtab_hdr->sh_info)
+ {
+ /* This is a local symbol. */
+ sym = local_syms + r_symndx;
+ sym_sec = local_sections[r_symndx];
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sym_sec, rel);
- /* ADDIL or LDIL instructions. */
- case R_PARISC_DLTREL21L:
- case R_PARISC_DLTIND21L:
- case R_PARISC_LTOFF_FPTR21L:
- case R_PARISC_PCREL21L:
- case R_PARISC_LTOFF_TP21L:
- case R_PARISC_DPREL21L:
- case R_PARISC_PLTOFF21L:
- case R_PARISC_DIR21L:
- return (insn & ~0x1fffff) | re_assemble_21 (sym_value);
+ /* If this symbol has an entry in the PA64 dynamic hash
+ table, then get it. */
+ dyn_name = get_dyn_name (input_bfd, h, rel,
+ &dynh_buf, &dynh_buflen);
+ dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
+ dyn_name, FALSE, FALSE);
- /* LDO and integer loads/stores with 14 bit displacements. */
- case R_PARISC_DLTREL14R:
- case R_PARISC_DLTREL14F:
- case R_PARISC_DLTIND14R:
- case R_PARISC_DLTIND14F:
- case R_PARISC_LTOFF_FPTR14R:
- case R_PARISC_PCREL14R:
- case R_PARISC_PCREL14F:
- case R_PARISC_LTOFF_TP14R:
- case R_PARISC_LTOFF_TP14F:
- case R_PARISC_DPREL14R:
- case R_PARISC_DPREL14F:
- case R_PARISC_PLTOFF14R:
- case R_PARISC_PLTOFF14F:
- case R_PARISC_DIR14R:
- case R_PARISC_DIR14F:
- return (insn & ~0x3fff) | low_sign_unext (sym_value, 14);
+ }
+ else
+ {
+ /* This is not a local symbol. */
+ long indx;
- /* PA2.0W LDO and integer loads/stores with 16 bit displacements. */
- case R_PARISC_LTOFF_FPTR16F:
- case R_PARISC_PCREL16F:
- case R_PARISC_LTOFF_TP16F:
- case R_PARISC_GPREL16F:
- case R_PARISC_PLTOFF16F:
- case R_PARISC_DIR16F:
- case R_PARISC_LTOFF16F:
- return (insn & ~0xffff) | re_assemble_16 (sym_value);
+ relocation = 0;
+ 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;
+ if (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ {
+ sym_sec = h->root.u.def.section;
- /* Doubleword loads and stores with a 14 bit displacement. */
- case R_PARISC_DLTREL14DR:
- case R_PARISC_DLTIND14DR:
- case R_PARISC_LTOFF_FPTR14DR:
- case R_PARISC_LTOFF_FPTR16DF:
- case R_PARISC_PCREL14DR:
- case R_PARISC_PCREL16DF:
- case R_PARISC_LTOFF_TP14DR:
- case R_PARISC_LTOFF_TP16DF:
- case R_PARISC_DPREL14DR:
- case R_PARISC_GPREL16DF:
- case R_PARISC_PLTOFF14DR:
- case R_PARISC_PLTOFF16DF:
- case R_PARISC_DIR14DR:
- case R_PARISC_DIR16DF:
- case R_PARISC_LTOFF16DF:
- return (insn & ~0x3ff1) | (((sym_value & 0x2000) >> 13)
- | ((sym_value & 0x1ff8) << 1));
+ /* If this symbol has an entry in the PA64 dynamic hash
+ table, then get it. */
+ dyn_name = get_dyn_name (input_bfd, h, rel,
+ &dynh_buf, &dynh_buflen);
+ dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
+ dyn_name, FALSE, FALSE);
- /* Floating point single word load/store instructions. */
- case R_PARISC_DLTREL14WR:
- case R_PARISC_DLTIND14WR:
- case R_PARISC_LTOFF_FPTR14WR:
- case R_PARISC_LTOFF_FPTR16WF:
- case R_PARISC_PCREL14WR:
- case R_PARISC_PCREL16WF:
- case R_PARISC_LTOFF_TP14WR:
- case R_PARISC_LTOFF_TP16WF:
- case R_PARISC_DPREL14WR:
- case R_PARISC_GPREL16WF:
- case R_PARISC_PLTOFF14WR:
- case R_PARISC_PLTOFF16WF:
- case R_PARISC_DIR16WF:
- case R_PARISC_DIR14WR:
- case R_PARISC_LTOFF16WF:
- return (insn & ~0x3ff9) | (((sym_value & 0x2000) >> 13)
- | ((sym_value & 0x1ffc) << 1));
+ /* If we have a relocation against a symbol defined in a
+ shared library and we have not created an entry in the
+ PA64 dynamic symbol hash table for it, then we lose. */
+ if (!info->relocatable
+ && sym_sec->output_section == NULL && dyn_h == NULL)
+ {
+ (*_bfd_error_handler)
+ (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
+ input_bfd,
+ input_section,
+ (long) rel->r_offset,
+ howto->name,
+ h->root.root.string);
+ }
+ else if (sym_sec->output_section)
+ relocation = (h->root.u.def.value
+ + sym_sec->output_offset
+ + sym_sec->output_section->vma);
+ }
+ else if (info->unresolved_syms_in_objects == RM_IGNORE
+ && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
+ {
+ /* If this symbol has an entry in the PA64 dynamic hash
+ table, then get it. */
+ dyn_name = get_dyn_name (input_bfd, h, rel,
+ &dynh_buf, &dynh_buflen);
+ dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
+ dyn_name, FALSE, FALSE);
- default:
- return insn;
+ if (!info->relocatable && dyn_h == NULL)
+ {
+ (*_bfd_error_handler)
+ (_("%B(%A): warning: unresolvable relocation against symbol `%s'"),
+ input_bfd, input_section, h->root.root.string);
+ }
+ }
+ else if (h->root.type == bfd_link_hash_undefweak)
+ {
+ dyn_name = get_dyn_name (input_bfd, h, rel,
+ &dynh_buf, &dynh_buflen);
+ dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
+ dyn_name, FALSE, FALSE);
+
+ if (!info->relocatable && dyn_h == NULL)
+ {
+ (*_bfd_error_handler)
+ (_("%B(%A): warning: unresolvable relocation against symbol `%s'"),
+ input_bfd, input_section, h->root.root.string);
+ }
+ }
+ else if (!info->relocatable)
+ {
+ /* Ignore dynamic loader defined symbols. */
+ if (!elf_hppa_is_dynamic_loader_symbol (h->root.root.string))
+ {
+ if (!((*info->callbacks->undefined_symbol)
+ (info, h->root.root.string, input_bfd,
+ input_section, rel->r_offset,
+ (info->unresolved_syms_in_objects == RM_GENERATE_ERROR
+ || ELF_ST_VISIBILITY (h->other)))))
+ return FALSE;
+ break;
+ }
+ }
+ }
+
+ if (sym_sec != NULL && elf_discarded_section (sym_sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
+ r = elf_hppa_final_link_relocate (rel, input_bfd, output_bfd,
+ input_section, contents,
+ relocation, info, sym_sec,
+ h, dyn_h);
+
+ if (r != bfd_reloc_ok)
+ {
+ switch (r)
+ {
+ default:
+ abort ();
+ case bfd_reloc_overflow:
+ {
+ const char *sym_name;
+
+ if (h != NULL)
+ sym_name = NULL;
+ else
+ {
+ sym_name = bfd_elf_string_from_elf_section (input_bfd,
+ symtab_hdr->sh_link,
+ sym->st_name);
+ if (sym_name == NULL)
+ return FALSE;
+ if (*sym_name == '\0')
+ sym_name = bfd_section_name (input_bfd, sym_sec);
+ }
+
+ if (!((*info->callbacks->reloc_overflow)
+ (info, (h ? &h->root : NULL), sym_name,
+ howto->name, (bfd_vma) 0, input_bfd,
+ input_section, rel->r_offset)))
+ return FALSE;
+ }
+ break;
+ }
+ }
}
+ return TRUE;
}
-#endif
+
+#endif /* ARCH_SIZE == 64 */
diff --git a/bfd/elf-m10200.c b/bfd/elf-m10200.c
index a39e4389d073..8189239f4631 100644
--- a/bfd/elf-m10200.c
+++ b/bfd/elf-m10200.c
@@ -1,5 +1,5 @@
/* Matsushita 10200 specific support for 32-bit ELF
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -207,6 +207,23 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code)
return NULL;
}
+static reloc_howto_type *
+bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (elf_mn10200_howto_table)
+ / sizeof (elf_mn10200_howto_table[0]));
+ i++)
+ if (elf_mn10200_howto_table[i].name != NULL
+ && strcasecmp (elf_mn10200_howto_table[i].name, r_name) == 0)
+ return &elf_mn10200_howto_table[i];
+
+ return NULL;
+}
+
/* Set the howto pointer for an MN10200 ELF reloc. */
static void
@@ -343,9 +360,6 @@ mn10200_elf_relocate_section (output_bfd, info, input_bfd, input_section,
struct elf_link_hash_entry **sym_hashes;
Elf_Internal_Rela *rel, *relend;
- if (info->relocatable)
- return TRUE;
-
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
@@ -385,6 +399,20 @@ mn10200_elf_relocate_section (output_bfd, info, input_bfd, input_section,
unresolved_reloc, warned);
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
r = mn10200_elf_final_link_relocate (howto, input_bfd, output_bfd,
input_section,
contents, rel->r_offset,
diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
index 509f2a102e38..992b2a4961f6 100644
--- a/bfd/elf-m10300.c
+++ b/bfd/elf-m10300.c
@@ -1,25 +1,25 @@
/* Matsushita 10300 specific support for 32-bit ELF
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- 2006 Free Software Foundation, Inc.
+ 2006, 2007 Free Software Foundation, Inc.
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/mn10300.h"
@@ -85,6 +85,9 @@ struct elf32_mn10300_link_hash_entry {
prologue deleted. */
#define MN10300_DELETED_PROLOGUE_BYTES 0x2
unsigned char flags;
+
+ /* Calculated value. */
+ bfd_vma value;
};
/* We derive a hash table from the main elf linker hash table so
@@ -131,9 +134,6 @@ static void mn10300_info_to_howto
static bfd_boolean mn10300_elf_check_relocs
PARAMS ((bfd *, struct bfd_link_info *, asection *,
const Elf_Internal_Rela *));
-static asection *mn10300_elf_gc_mark_hook
- PARAMS ((asection *, struct bfd_link_info *info, Elf_Internal_Rela *,
- struct elf_link_hash_entry *, Elf_Internal_Sym *));
static bfd_boolean mn10300_elf_relax_delete_bytes
PARAMS ((bfd *, asection *, bfd_vma, int));
static bfd_boolean mn10300_elf_symbol_address_p
@@ -637,6 +637,23 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code)
return NULL;
}
+static reloc_howto_type *
+bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (elf_mn10300_howto_table)
+ / sizeof (elf_mn10300_howto_table[0]));
+ i++)
+ if (elf_mn10300_howto_table[i].name != NULL
+ && strcasecmp (elf_mn10300_howto_table[i].name, r_name) == 0)
+ return &elf_mn10300_howto_table[i];
+
+ return NULL;
+}
+
/* Set the howto pointer for an MN10300 ELF reloc. */
static void
@@ -883,7 +900,7 @@ mn10300_elf_check_relocs (abfd, info, sec, relocs)
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (abfd, sec),
name + 5) == 0);
@@ -919,40 +936,21 @@ mn10300_elf_check_relocs (abfd, info, sec, relocs)
relocation. */
static asection *
-mn10300_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;
+mn10300_elf_gc_mark_hook (asection *sec,
+ struct bfd_link_info *info,
+ Elf_Internal_Rela *rel,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
{
if (h != NULL)
- {
- switch (ELF32_R_TYPE (rel->r_info))
- {
- case R_MN10300_GNU_VTINHERIT:
- case R_MN10300_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
+ switch (ELF32_R_TYPE (rel->r_info))
+ {
+ case R_MN10300_GNU_VTINHERIT:
+ case R_MN10300_GNU_VTENTRY:
+ return NULL;
+ }
- return NULL;
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
/* Perform a relocation as part of a final link. */
@@ -1033,7 +1031,7 @@ mn10300_elf_final_link_relocate (howto, input_bfd, output_bfd,
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (input_bfd,
input_section),
name + 5) == 0);
@@ -1381,9 +1379,6 @@ mn10300_elf_relocate_section (output_bfd, info, input_bfd, input_section,
struct elf_link_hash_entry **sym_hashes;
Elf_Internal_Rela *rel, *relend;
- if (info->relocatable)
- return TRUE;
-
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
@@ -1459,7 +1454,7 @@ mn10300_elf_relocate_section (output_bfd, info, input_bfd, input_section,
obscure cases sec->output_section will be NULL. */
relocation = 0;
- else if (unresolved_reloc)
+ else if (!info->relocatable && unresolved_reloc)
(*_bfd_error_handler)
(_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
input_bfd,
@@ -1469,6 +1464,20 @@ mn10300_elf_relocate_section (output_bfd, info, input_bfd, input_section,
h->root.root.root.string);
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
r = mn10300_elf_final_link_relocate (howto, input_bfd, output_bfd,
input_section,
contents, rel->r_offset,
@@ -1518,7 +1527,12 @@ mn10300_elf_relocate_section (output_bfd, info, input_bfd, input_section,
goto common_error;
case bfd_reloc_dangerous:
- msg = _("internal error: dangerous error");
+ if (r_type == R_MN10300_PCREL32)
+ msg = _("error: inappropriate relocation type for shared"
+ " library (did you forget -fpic?)");
+ else
+ msg = _("internal error: suspicious relocation type used"
+ " in shared library");
goto common_error;
default:
@@ -1602,6 +1616,42 @@ elf32_mn10300_finish_hash_table_entry (gen_entry, in_args)
return TRUE;
}
+/* Used to count hash table entries. */
+static bfd_boolean
+elf32_mn10300_count_hash_table_entries (struct bfd_hash_entry *gen_entry ATTRIBUTE_UNUSED,
+ PTR in_args)
+{
+ int *count = (int *)in_args;
+
+ (*count) ++;
+ return TRUE;
+}
+
+/* Used to enumerate hash table entries into a linear array. */
+static bfd_boolean
+elf32_mn10300_list_hash_table_entries (struct bfd_hash_entry *gen_entry,
+ PTR in_args)
+{
+ struct bfd_hash_entry ***ptr = (struct bfd_hash_entry ***) in_args;
+
+ **ptr = gen_entry;
+ (*ptr) ++;
+ return TRUE;
+}
+
+/* Used to sort the array created by the above. */
+static int
+sort_by_value (const void *va, const void *vb)
+{
+ struct elf32_mn10300_link_hash_entry *a
+ = *(struct elf32_mn10300_link_hash_entry **)va;
+ struct elf32_mn10300_link_hash_entry *b
+ = *(struct elf32_mn10300_link_hash_entry **)vb;
+
+ return a->value - b->value;
+}
+
+
/* This function handles relaxing for the mn10300.
There are quite a few relaxing opportunities available on the mn10300:
@@ -1697,9 +1747,10 @@ mn10300_elf_relax_section (abfd, sec, link_info, again)
char *new_name;
/* If there's nothing to do in this section, skip it. */
- if (! (((section->flags & SEC_RELOC) != 0
- && section->reloc_count != 0)
- || (section->flags & SEC_CODE) != 0))
+ if (! ((section->flags & SEC_RELOC) != 0
+ && section->reloc_count != 0))
+ continue;
+ if ((section->flags & SEC_ALLOC) == 0)
continue;
/* Get cached copy of section contents if it exists. */
@@ -1802,13 +1853,17 @@ mn10300_elf_relax_section (abfd, sec, link_info, again)
elf_sym_hashes (input_bfd)[r_index];
}
- /* If this is not a "call" instruction, then we
- should convert "call" instructions to "calls"
- instructions. */
- code = bfd_get_8 (input_bfd,
- contents + irel->r_offset - 1);
- if (code != 0xdd && code != 0xcd)
- hash->flags |= MN10300_CONVERT_CALL_TO_CALLS;
+ sym_name = hash->root.root.root.string;
+ if ((section->flags & SEC_CODE) != 0)
+ {
+ /* If this is not a "call" instruction, then we
+ should convert "call" instructions to "calls"
+ instructions. */
+ code = bfd_get_8 (input_bfd,
+ contents + irel->r_offset - 1);
+ if (code != 0xdd && code != 0xcd)
+ hash->flags |= MN10300_CONVERT_CALL_TO_CALLS;
+ }
/* If this is a jump/call, then bump the
direct_calls counter. Else force "call" to
@@ -1901,6 +1956,7 @@ mn10300_elf_relax_section (abfd, sec, link_info, again)
free (new_name);
compute_function_info (input_bfd, hash,
isym->st_value, contents);
+ hash->value = isym->st_value;
}
}
@@ -1962,6 +2018,44 @@ mn10300_elf_relax_section (abfd, sec, link_info, again)
elf32_mn10300_finish_hash_table_entry,
link_info);
+ {
+ /* This section of code collects all our local symbols, sorts
+ them by value, and looks for multiple symbols referring to
+ the same address. For those symbols, the flags are merged.
+ At this point, the only flag that can be set is
+ MN10300_CONVERT_CALL_TO_CALLS, so we simply OR the flags
+ together. */
+ int static_count = 0, i;
+ struct elf32_mn10300_link_hash_entry **entries;
+ struct elf32_mn10300_link_hash_entry **ptr;
+
+ elf32_mn10300_link_hash_traverse (hash_table->static_hash_table,
+ elf32_mn10300_count_hash_table_entries,
+ &static_count);
+
+ entries = (struct elf32_mn10300_link_hash_entry **)
+ bfd_malloc (static_count * sizeof (struct elf32_mn10300_link_hash_entry *));
+
+ ptr = entries;
+ elf32_mn10300_link_hash_traverse (hash_table->static_hash_table,
+ elf32_mn10300_list_hash_table_entries,
+ &ptr);
+
+ qsort (entries, static_count, sizeof(entries[0]), sort_by_value);
+
+ for (i=0; i<static_count-1; i++)
+ if (entries[i]->value && entries[i]->value == entries[i+1]->value)
+ {
+ int v = entries[i]->flags;
+ int j;
+ for (j=i+1; j<static_count && entries[j]->value == entries[i]->value; j++)
+ v |= entries[j]->flags;
+ for (j=i; j<static_count && entries[j]->value == entries[i]->value; j++)
+ entries[j]->flags = v;
+ i = j-1;
+ }
+ }
+
/* All entries in the hash table are fully initialized. */
hash_table->flags |= MN10300_HASH_ENTRIES_INITIALIZED;
@@ -2795,8 +2889,7 @@ mn10300_elf_relax_section (abfd, sec, link_info, again)
into a 16bit immediate, displacement or absolute address. */
if (ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_32
|| ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_GOT32
- || ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_GOTOFF32
- || ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_GOTPC32)
+ || ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_GOTOFF32)
{
bfd_vma value = symval;
@@ -3677,6 +3770,7 @@ elf32_mn10300_link_hash_newfunc (entry, table, string)
ret->movm_args = 0;
ret->movm_stack_size = 0;
ret->flags = 0;
+ ret->value = 0;
}
return (struct bfd_hash_entry *) ret;
@@ -4002,7 +4096,6 @@ _bfd_mn10300_elf_adjust_dynamic_symbol (info, h)
{
bfd * dynobj;
asection * s;
- unsigned int power_of_two;
dynobj = elf_hash_table (info)->dynobj;
@@ -4142,28 +4235,7 @@ _bfd_mn10300_elf_adjust_dynamic_symbol (info, h)
h->needs_copy = 1;
}
- /* We need to figure out the alignment required for this symbol. I
- have no idea how ELF linkers handle this. */
- power_of_two = bfd_log2 (h->size);
- if (power_of_two > 3)
- power_of_two = 3;
-
- /* Apply the required alignment. */
- s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two));
- if (power_of_two > bfd_get_section_alignment (dynobj, s))
- {
- if (! bfd_set_section_alignment (dynobj, s, power_of_two))
- return FALSE;
- }
-
- /* Define the symbol as being at this point in the section. */
- h->root.u.def.section = s;
- h->root.u.def.value = s->size;
-
- /* Increment the section size to make room for the symbol. */
- s->size += h->size;
-
- return TRUE;
+ return _bfd_elf_adjust_dynamic_copy (h, s);
}
/* Set the sizes of the dynamic sections. */
@@ -4227,7 +4299,7 @@ _bfd_mn10300_elf_size_dynamic_sections (output_bfd, info)
/* Remember whether there is a PLT. */
plt = s->size != 0;
}
- else if (strncmp (name, ".rela", 5) == 0)
+ else if (CONST_STRNEQ (name, ".rela"))
{
if (s->size != 0)
{
@@ -4260,7 +4332,7 @@ _bfd_mn10300_elf_size_dynamic_sections (output_bfd, info)
s->reloc_count = 0;
}
}
- else if (strncmp (name, ".got", 4) != 0
+ else if (! CONST_STRNEQ (name, ".got")
&& strcmp (name, ".dynbss") != 0)
/* It's not one of our sections, so don't allocate space. */
continue;
@@ -4695,6 +4767,8 @@ _bfd_mn10300_elf_reloc_type_class (const Elf_Internal_Rela *rela)
_bfd_mn10300_elf_adjust_dynamic_symbol
#define elf_backend_size_dynamic_sections \
_bfd_mn10300_elf_size_dynamic_sections
+#define elf_backend_omit_section_dynsym \
+ ((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) bfd_true)
#define elf_backend_finish_dynamic_symbol \
_bfd_mn10300_elf_finish_dynamic_symbol
#define elf_backend_finish_dynamic_sections \
diff --git a/bfd/elf-strtab.c b/bfd/elf-strtab.c
index a0ce1d79ea8e..f5d6db1c10c0 100644
--- a/bfd/elf-strtab.c
+++ b/bfd/elf-strtab.c
@@ -1,5 +1,6 @@
/* ELF strtab with GC and suffix merging support.
- Copyright 2001, 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003, 2005, 2006, 2007
+ Free Software Foundation, Inc.
Written by Jakub Jelinek <jakub@redhat.com>.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +19,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "hashtab.h"
diff --git a/bfd/elf-vxworks.c b/bfd/elf-vxworks.c
index 90e620a90559..7b0d59090973 100644
--- a/bfd/elf-vxworks.c
+++ b/bfd/elf-vxworks.c
@@ -1,5 +1,5 @@
/* VxWorks support for ELF
- Copyright 2005 Free Software Foundation, Inc.
+ Copyright 2005, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -20,15 +20,34 @@
/* This file provides routines used by all VxWorks targets. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf-vxworks.h"
+/* Return true if symbol NAME, as defined by ABFD, is one of the special
+ __GOTT_BASE__ or __GOTT_INDEX__ symbols. */
+
+static bfd_boolean
+elf_vxworks_gott_symbol_p (bfd *abfd, const char *name)
+{
+ char leading;
+
+ leading = bfd_get_symbol_leading_char (abfd);
+ if (leading)
+ {
+ if (*name != leading)
+ return FALSE;
+ name++;
+ }
+ return (strcmp (name, "__GOTT_BASE__") == 0
+ || strcmp (name, "__GOTT_INDEX__") == 0);
+}
+
/* Tweak magic VxWorks symbols as they are loaded. */
bfd_boolean
-elf_vxworks_add_symbol_hook (bfd *abfd ATTRIBUTE_UNUSED,
+elf_vxworks_add_symbol_hook (bfd *abfd,
struct bfd_link_info *info,
Elf_Internal_Sym *sym,
const char **namep,
@@ -45,8 +64,7 @@ elf_vxworks_add_symbol_hook (bfd *abfd ATTRIBUTE_UNUSED,
This transformation will be undone in
elf_i386_vxworks_link_output_symbol_hook. */
if ((info->shared || abfd->flags & DYNAMIC)
- && (strcmp (*namep, "__GOTT_INDEX__") == 0
- || strcmp (*namep, "__GOTT_BASE__") == 0))
+ && elf_vxworks_gott_symbol_p (abfd, *namep))
{
sym->st_info = ELF_ST_INFO (STB_WEAK, ELF_ST_TYPE (sym->st_info));
*flagsp |= BSF_WEAK;
@@ -114,16 +132,12 @@ elf_vxworks_link_output_symbol_hook (struct bfd_link_info *info
const char *name,
Elf_Internal_Sym *sym,
asection *input_sec ATTRIBUTE_UNUSED,
- struct elf_link_hash_entry *h
- ATTRIBUTE_UNUSED)
+ struct elf_link_hash_entry *h)
{
- /* Ignore the first dummy symbol. */
- if (!name)
- return TRUE;
-
/* Reverse the effects of the hack in elf_vxworks_add_symbol_hook. */
- if (strcmp (name, "__GOTT_INDEX__") == 0
- || strcmp (name, "__GOTT_BASE__") == 0)
+ if (h
+ && h->root.type == bfd_link_hash_undefweak
+ && elf_vxworks_gott_symbol_p (h->root.u.undef.abfd, name))
sym->st_info = ELF_ST_INFO (STB_GLOBAL, ELF_ST_TYPE (sym->st_info));
return TRUE;
@@ -156,7 +170,8 @@ elf_vxworks_emit_relocs (bfd *output_bfd,
&& *rel_hash
&& (*rel_hash)->def_dynamic
&& !(*rel_hash)->def_regular
- && (*rel_hash)->root.type == bfd_link_hash_defined
+ && ((*rel_hash)->root.type == bfd_link_hash_defined
+ || (*rel_hash)->root.type == bfd_link_hash_defweak)
&& (*rel_hash)->root.u.def.section->output_section != NULL)
{
/* This is a relocation from an executable or shared library
@@ -171,8 +186,7 @@ elf_vxworks_emit_relocs (bfd *output_bfd,
for (j = 0; j < bed->s->int_rels_per_ext_rel; j++)
{
asection *sec = (*rel_hash)->root.u.def.section;
- int this_idx =
- elf_section_data (sec->output_section)->this_idx;
+ int this_idx = sec->output_section->target_index;
irela[j].r_info = ELF32_R_INFO (this_idx,
ELF32_R_TYPE (irela[j].r_info));
diff --git a/bfd/elf.c b/bfd/elf.c
index 9e48f66e90fa..ab5c23f711a4 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1,7 +1,7 @@
/* ELF executable support for BFD.
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -33,8 +33,8 @@ SECTION
/* For sparc64-cross-sparc32. */
#define _SYSCALL32
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#define ARCH_SIZE 0
@@ -206,16 +206,32 @@ bfd_elf_hash (const char *namearg)
return h & 0xffffffff;
}
+/* DT_GNU_HASH hash function. Do not change this function; you will
+ cause invalid hash tables to be generated. */
+
+unsigned long
+bfd_elf_gnu_hash (const char *namearg)
+{
+ const unsigned char *name = (const unsigned char *) namearg;
+ unsigned long h = 5381;
+ unsigned char ch;
+
+ while ((ch = *name++) != '\0')
+ h = (h << 5) + h + ch;
+ return h & 0xffffffff;
+}
+
bfd_boolean
bfd_elf_mkobject (bfd *abfd)
{
- /* This just does initialization. */
- /* coff_mkobject zalloc's space for tdata.coff_obj_data ... */
- elf_tdata (abfd) = bfd_zalloc (abfd, sizeof (struct elf_obj_tdata));
- if (elf_tdata (abfd) == 0)
- return FALSE;
- /* Since everything is done at close time, do we need any
- initialization? */
+ if (abfd->tdata.any == NULL)
+ {
+ abfd->tdata.any = bfd_zalloc (abfd, sizeof (struct elf_obj_tdata));
+ if (abfd->tdata.any == NULL)
+ return FALSE;
+ }
+
+ elf_tdata (abfd)->program_header_size = (bfd_size_type) -1;
return TRUE;
}
@@ -236,7 +252,9 @@ bfd_elf_get_str_section (bfd *abfd, unsigned int shindex)
bfd_size_type shstrtabsize;
i_shdrp = elf_elfsections (abfd);
- if (i_shdrp == 0 || i_shdrp[shindex] == 0)
+ if (i_shdrp == 0
+ || shindex >= elf_numsections (abfd)
+ || i_shdrp[shindex] == 0)
return NULL;
shstrtab = i_shdrp[shindex]->contents;
@@ -275,6 +293,9 @@ bfd_elf_string_from_elf_section (bfd *abfd,
if (strindex == 0)
return "";
+ if (elf_elfsections (abfd) == NULL || shindex >= elf_numsections (abfd))
+ return NULL;
+
hdr = elf_elfsections (abfd)[shindex];
if (hdr->contents == NULL
@@ -384,7 +405,15 @@ bfd_elf_get_elf_syms (bfd *ibfd,
for (esym = extsym_buf, isym = intsym_buf, shndx = extshndx_buf;
isym < isymend;
esym += extsym_size, isym++, shndx = shndx != NULL ? shndx + 1 : NULL)
- (*bed->s->swap_symbol_in) (ibfd, esym, shndx, isym);
+ if (!(*bed->s->swap_symbol_in) (ibfd, esym, shndx, isym))
+ {
+ symoffset += (esym - (bfd_byte *) extsym_buf) / extsym_size;
+ (*_bfd_error_handler) (_("%B symbol number %lu references "
+ "nonexistent SHT_SYMTAB_SHNDX section"),
+ ibfd, (unsigned long) symoffset);
+ intsym_buf = NULL;
+ goto out;
+ }
out:
if (alloc_ext != NULL)
@@ -477,10 +506,18 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect)
section with just a flag word (ie. sh_size is 4), ignore it. */
shnum = elf_numsections (abfd);
num_group = 0;
+
+#define IS_VALID_GROUP_SECTION_HEADER(shdr) \
+ ( (shdr)->sh_type == SHT_GROUP \
+ && (shdr)->sh_size >= (2 * GRP_ENTRY_SIZE) \
+ && (shdr)->sh_entsize == GRP_ENTRY_SIZE \
+ && ((shdr)->sh_size % GRP_ENTRY_SIZE) == 0)
+
for (i = 0; i < shnum; i++)
{
Elf_Internal_Shdr *shdr = elf_elfsections (abfd)[i];
- if (shdr->sh_type == SHT_GROUP && shdr->sh_size >= 8)
+
+ if (IS_VALID_GROUP_SECTION_HEADER (shdr))
num_group += 1;
}
@@ -505,7 +542,8 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect)
for (i = 0; i < shnum; i++)
{
Elf_Internal_Shdr *shdr = elf_elfsections (abfd)[i];
- if (shdr->sh_type == SHT_GROUP && shdr->sh_size >= 8)
+
+ if (IS_VALID_GROUP_SECTION_HEADER (shdr))
{
unsigned char *src;
Elf_Internal_Group *dest;
@@ -519,8 +557,18 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect)
amt = shdr->sh_size * sizeof (*dest) / 4;
shdr->contents = bfd_alloc2 (abfd, shdr->sh_size,
sizeof (*dest) / 4);
- if (shdr->contents == NULL
- || bfd_seek (abfd, shdr->sh_offset, SEEK_SET) != 0
+ /* PR binutils/4110: Handle corrupt group headers. */
+ if (shdr->contents == NULL)
+ {
+ _bfd_error_handler
+ (_("%B: Corrupt size field in group section header: 0x%lx"), abfd, shdr->sh_size);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+
+ memset (shdr->contents, 0, amt);
+
+ if (bfd_seek (abfd, shdr->sh_offset, SEEK_SET) != 0
|| (bfd_bread (shdr->contents, shdr->sh_size, abfd)
!= shdr->sh_size))
return FALSE;
@@ -800,24 +848,24 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
int len;
} debug_sections [] =
{
- { "debug", 5 }, /* 'd' */
+ { STRING_COMMA_LEN ("debug") }, /* 'd' */
{ NULL, 0 }, /* 'e' */
{ NULL, 0 }, /* 'f' */
- { "gnu.linkonce.wi.", 17 }, /* 'g' */
+ { STRING_COMMA_LEN ("gnu.linkonce.wi.") }, /* 'g' */
{ NULL, 0 }, /* 'h' */
{ NULL, 0 }, /* 'i' */
{ NULL, 0 }, /* 'j' */
{ NULL, 0 }, /* 'k' */
- { "line", 4 }, /* 'l' */
+ { STRING_COMMA_LEN ("line") }, /* 'l' */
{ NULL, 0 }, /* 'm' */
{ NULL, 0 }, /* 'n' */
{ NULL, 0 }, /* 'o' */
{ NULL, 0 }, /* 'p' */
{ NULL, 0 }, /* 'q' */
{ NULL, 0 }, /* 'r' */
- { "stab", 4 } /* 's' */
+ { STRING_COMMA_LEN ("stab") } /* 's' */
};
-
+
if (name [0] == '.')
{
int i = name [1] - 'd';
@@ -836,7 +884,7 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
The symbols will be defined as weak, so that multiple definitions
are permitted. The GNU linker extension is to actually discard
all but one of the sections. */
- if (strncmp (name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) == 0
+ if (CONST_STRNEQ (name, ".gnu.linkonce")
&& elf_next_in_group (newsect) == NULL)
flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
@@ -854,8 +902,8 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
unsigned int i;
/* Look through the phdrs to see if we need to adjust the lma.
- If all the p_paddr fields are zero, we ignore them, since
- some ELF linkers produce such output. */
+ If all the p_paddr fields are zero, we ignore them, since
+ some ELF linkers produce such output. */
phdr = elf_tdata (abfd)->phdr;
for (i = 0; i < elf_elfheader (abfd)->e_phnum; i++, phdr++)
{
@@ -876,9 +924,9 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
refuse to set the LMA if it was 0. This is wrong
though, as a perfectly valid initialised segment can
have a p_paddr of zero. Some architectures, eg ARM,
- place special significance on the address 0 and
- executables need to be able to have a segment which
- covers this address. */
+ place special significance on the address 0 and
+ executables need to be able to have a segment which
+ covers this address. */
if (phdr->p_type == PT_LOAD
&& (bfd_vma) hdr->sh_offset >= phdr->p_offset
&& (hdr->sh_offset + hdr->sh_size
@@ -1065,6 +1113,10 @@ _bfd_elf_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
elf_gp (obfd) = elf_gp (ibfd);
elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
elf_flags_init (obfd) = TRUE;
+
+ /* Copy object attributes. */
+ _bfd_elf_copy_obj_attributes (ibfd, obfd);
+
return TRUE;
}
@@ -1239,6 +1291,7 @@ _bfd_elf_print_private_bfd_data (bfd *abfd, void *farg)
case DT_AUXILIARY: name = "AUXILIARY"; stringp = TRUE; break;
case DT_USED: name = "USED"; break;
case DT_FILTER: name = "FILTER"; stringp = TRUE; break;
+ case DT_GNU_HASH: name = "GNU_HASH"; break;
}
fprintf (f, " %-11s ", name);
@@ -1472,9 +1525,9 @@ _bfd_elf_link_hash_newfunc (struct bfd_hash_entry *entry,
memset (&ret->size, 0, (sizeof (struct elf_link_hash_entry)
- offsetof (struct elf_link_hash_entry, size)));
/* Assume that we have been called by a non-ELF symbol reader.
- This flag is then reset by the code which reads an ELF input
- file. This ensures that a symbol created by a non-ELF symbol
- reader will have the flag set correctly. */
+ This flag is then reset by the code which reads an ELF input
+ file. This ensures that a symbol created by a non-ELF symbol
+ reader will have the flag set correctly. */
ret->non_elf = 1;
}
@@ -1567,27 +1620,13 @@ _bfd_elf_link_hash_table_init
bfd_boolean ret;
int can_refcount = get_elf_backend_data (abfd)->can_refcount;
- table->dynamic_sections_created = FALSE;
- table->dynobj = NULL;
+ memset (table, 0, sizeof * table);
table->init_got_refcount.refcount = can_refcount - 1;
table->init_plt_refcount.refcount = can_refcount - 1;
table->init_got_offset.offset = -(bfd_vma) 1;
table->init_plt_offset.offset = -(bfd_vma) 1;
/* The first dynamic symbol is a dummy. */
table->dynsymcount = 1;
- table->dynstr = NULL;
- table->bucketcount = 0;
- table->needed = NULL;
- table->hgot = NULL;
- table->merge_info = NULL;
- memset (&table->stab_info, 0, sizeof (table->stab_info));
- memset (&table->eh_info, 0, sizeof (table->eh_info));
- table->dynlocal = NULL;
- table->runpath = NULL;
- table->tls_sec = NULL;
- table->tls_size = 0;
- table->loaded = NULL;
- table->is_relocatable_executable = FALSE;
ret = _bfd_link_hash_table_init (&table->root, abfd, newfunc, entsize);
table->root.type = bfd_link_elf_hash_table;
@@ -1642,7 +1681,7 @@ bfd_elf_get_dyn_lib_class (bfd *abfd)
}
void
-bfd_elf_set_dyn_lib_class (bfd *abfd, int lib_class)
+bfd_elf_set_dyn_lib_class (bfd *abfd, enum dynamic_lib_link_class lib_class)
{
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
&& bfd_get_format (abfd) == bfd_object)
@@ -1822,6 +1861,7 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
case SHT_FINI_ARRAY: /* .fini_array section. */
case SHT_PREINIT_ARRAY: /* .preinit_array section. */
case SHT_GNU_LIBLIST: /* .gnu.liblist section. */
+ case SHT_GNU_HASH: /* .gnu.hash section. */
return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
case SHT_DYNAMIC: /* Dynamic linking information. */
@@ -1873,11 +1913,11 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
abfd->flags |= HAS_SYMS;
/* Sometimes a shared object will map in the symbol table. If
- SHF_ALLOC is set, and this is a shared object, then we also
- treat this section as a BFD section. We can not base the
- decision purely on SHF_ALLOC, because that flag is sometimes
- set in a relocatable object file, which would confuse the
- linker. */
+ SHF_ALLOC is set, and this is a shared object, then we also
+ treat this section as a BFD section. We can not base the
+ decision purely on SHF_ALLOC, because that flag is sometimes
+ set in a relocatable object file, which would confuse the
+ linker. */
if ((hdr->sh_flags & SHF_ALLOC) != 0
&& (abfd->flags & DYNAMIC) != 0
&& ! _bfd_elf_make_section_from_shdr (abfd, hdr, name,
@@ -2099,13 +2139,11 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
abfd->flags |= HAS_RELOC;
return TRUE;
}
- break;
case SHT_GNU_verdef:
elf_dynverdef (abfd) = shindex;
elf_tdata (abfd)->dynverdef_hdr = *hdr;
return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
- break;
case SHT_GNU_versym:
if (hdr->sh_entsize != sizeof (Elf_External_Versym))
@@ -2113,13 +2151,11 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
elf_dynversym (abfd) = shindex;
elf_tdata (abfd)->dynversym_hdr = *hdr;
return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
- break;
case SHT_GNU_verneed:
elf_dynverref (abfd) = shindex;
elf_tdata (abfd)->dynverref_hdr = *hdr;
return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
- break;
case SHT_SHLIB:
return TRUE;
@@ -2128,7 +2164,7 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
/* We need a BFD section for objcopy and relocatable linking,
and it's handy to have the signature available as the section
name. */
- if (hdr->sh_entsize != GRP_ENTRY_SIZE)
+ if (! IS_VALID_GROUP_SECTION_HEADER (hdr))
return FALSE;
name = group_signature (abfd, hdr);
if (name == NULL)
@@ -2138,7 +2174,7 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
if (hdr->contents != NULL)
{
Elf_Internal_Group *idx = (Elf_Internal_Group *) hdr->contents;
- unsigned int n_elt = hdr->sh_size / 4;
+ unsigned int n_elt = hdr->sh_size / GRP_ENTRY_SIZE;
asection *s;
if (idx->flags & GRP_COMDAT)
@@ -2148,19 +2184,78 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
/* We try to keep the same section order as it comes in. */
idx += n_elt;
while (--n_elt != 0)
- if ((s = (--idx)->shdr->bfd_section) != NULL
- && elf_next_in_group (s) != NULL)
- {
- elf_next_in_group (hdr->bfd_section) = s;
- break;
- }
+ {
+ --idx;
+
+ if (idx->shdr != NULL
+ && (s = idx->shdr->bfd_section) != NULL
+ && elf_next_in_group (s) != NULL)
+ {
+ elf_next_in_group (hdr->bfd_section) = s;
+ break;
+ }
+ }
}
break;
default:
+ /* Possibly an attributes section. */
+ if (hdr->sh_type == SHT_GNU_ATTRIBUTES
+ || hdr->sh_type == bed->obj_attrs_section_type)
+ {
+ if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
+ return FALSE;
+ _bfd_elf_parse_attributes (abfd, hdr);
+ return TRUE;
+ }
+
/* Check for any processor-specific section types. */
- return bed->elf_backend_section_from_shdr (abfd, hdr, name,
- shindex);
+ if (bed->elf_backend_section_from_shdr (abfd, hdr, name, shindex))
+ return TRUE;
+
+ if (hdr->sh_type >= SHT_LOUSER && hdr->sh_type <= SHT_HIUSER)
+ {
+ if ((hdr->sh_flags & SHF_ALLOC) != 0)
+ /* FIXME: How to properly handle allocated section reserved
+ for applications? */
+ (*_bfd_error_handler)
+ (_("%B: don't know how to handle allocated, application "
+ "specific section `%s' [0x%8x]"),
+ abfd, name, hdr->sh_type);
+ else
+ /* Allow sections reserved for applications. */
+ return _bfd_elf_make_section_from_shdr (abfd, hdr, name,
+ shindex);
+ }
+ else if (hdr->sh_type >= SHT_LOPROC
+ && hdr->sh_type <= SHT_HIPROC)
+ /* FIXME: We should handle this section. */
+ (*_bfd_error_handler)
+ (_("%B: don't know how to handle processor specific section "
+ "`%s' [0x%8x]"),
+ abfd, name, hdr->sh_type);
+ else if (hdr->sh_type >= SHT_LOOS && hdr->sh_type <= SHT_HIOS)
+ {
+ /* Unrecognised OS-specific sections. */
+ if ((hdr->sh_flags & SHF_OS_NONCONFORMING) != 0)
+ /* SHF_OS_NONCONFORMING indicates that special knowledge is
+ required to correctly process the section and the file should
+ be rejected with an error message. */
+ (*_bfd_error_handler)
+ (_("%B: don't know how to handle OS specific section "
+ "`%s' [0x%8x]"),
+ abfd, name, hdr->sh_type);
+ else
+ /* Otherwise it should be processed. */
+ return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
+ }
+ else
+ /* FIXME: We should handle this section. */
+ (*_bfd_error_handler)
+ (_("%B: don't know how to handle section `%s' [0x%8x]"),
+ abfd, name, hdr->sh_type);
+
+ return FALSE;
}
return TRUE;
@@ -2220,108 +2315,111 @@ bfd_section_from_elf_index (bfd *abfd, unsigned int index)
static const struct bfd_elf_special_section special_sections_b[] =
{
- { ".bss", 4, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".bss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
+ { NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section special_sections_c[] =
{
- { ".comment", 8, 0, SHT_PROGBITS, 0 },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".comment"), 0, SHT_PROGBITS, 0 },
+ { NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section special_sections_d[] =
{
- { ".data", 5, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".data1", 6, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".debug", 6, 0, SHT_PROGBITS, 0 },
- { ".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 },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".data"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".data1"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".debug"), 0, SHT_PROGBITS, 0 },
+ { STRING_COMMA_LEN (".debug_line"), 0, SHT_PROGBITS, 0 },
+ { STRING_COMMA_LEN (".debug_info"), 0, SHT_PROGBITS, 0 },
+ { STRING_COMMA_LEN (".debug_abbrev"), 0, SHT_PROGBITS, 0 },
+ { STRING_COMMA_LEN (".debug_aranges"), 0, SHT_PROGBITS, 0 },
+ { STRING_COMMA_LEN (".dynamic"), 0, SHT_DYNAMIC, SHF_ALLOC },
+ { STRING_COMMA_LEN (".dynstr"), 0, SHT_STRTAB, SHF_ALLOC },
+ { STRING_COMMA_LEN (".dynsym"), 0, SHT_DYNSYM, SHF_ALLOC },
+ { NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section special_sections_f[] =
{
- { ".fini", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
- { ".fini_array", 11, 0, SHT_FINI_ARRAY, SHF_ALLOC + SHF_WRITE },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".fini"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
+ { STRING_COMMA_LEN (".fini_array"), 0, SHT_FINI_ARRAY, SHF_ALLOC + SHF_WRITE },
+ { NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section special_sections_g[] =
{
- { ".gnu.linkonce.b",15, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
- { ".got", 4, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".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 },
- { ".gnu.liblist", 12, 0, SHT_GNU_LIBLIST, SHF_ALLOC },
- { ".gnu.conflict", 13, 0, SHT_RELA, SHF_ALLOC },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".gnu.linkonce.b"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".got"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".gnu.version"), 0, SHT_GNU_versym, 0 },
+ { STRING_COMMA_LEN (".gnu.version_d"), 0, SHT_GNU_verdef, 0 },
+ { STRING_COMMA_LEN (".gnu.version_r"), 0, SHT_GNU_verneed, 0 },
+ { STRING_COMMA_LEN (".gnu.liblist"), 0, SHT_GNU_LIBLIST, SHF_ALLOC },
+ { STRING_COMMA_LEN (".gnu.conflict"), 0, SHT_RELA, SHF_ALLOC },
+ { STRING_COMMA_LEN (".gnu.hash"), 0, SHT_GNU_HASH, SHF_ALLOC },
+ { NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section special_sections_h[] =
{
- { ".hash", 5, 0, SHT_HASH, SHF_ALLOC },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".hash"), 0, SHT_HASH, SHF_ALLOC },
+ { NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section special_sections_i[] =
{
- { ".init", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
- { ".init_array", 11, 0, SHT_INIT_ARRAY, SHF_ALLOC + SHF_WRITE },
- { ".interp", 7, 0, SHT_PROGBITS, 0 },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".init"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
+ { STRING_COMMA_LEN (".init_array"), 0, SHT_INIT_ARRAY, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".interp"), 0, SHT_PROGBITS, 0 },
+ { NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section special_sections_l[] =
{
- { ".line", 5, 0, SHT_PROGBITS, 0 },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".line"), 0, SHT_PROGBITS, 0 },
+ { NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section special_sections_n[] =
{
- { ".note.GNU-stack",15, 0, SHT_PROGBITS, 0 },
- { ".note", 5, -1, SHT_NOTE, 0 },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".note.GNU-stack"), 0, SHT_PROGBITS, 0 },
+ { STRING_COMMA_LEN (".note"), -1, SHT_NOTE, 0 },
+ { NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section special_sections_p[] =
{
- { ".preinit_array", 14, 0, SHT_PREINIT_ARRAY, SHF_ALLOC + SHF_WRITE },
- { ".plt", 4, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".preinit_array"), 0, SHT_PREINIT_ARRAY, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".plt"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
+ { NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section special_sections_r[] =
{
- { ".rodata", 7, -2, SHT_PROGBITS, SHF_ALLOC },
- { ".rodata1", 8, 0, SHT_PROGBITS, SHF_ALLOC },
- { ".rela", 5, -1, SHT_RELA, 0 },
- { ".rel", 4, -1, SHT_REL, 0 },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".rodata"), -2, SHT_PROGBITS, SHF_ALLOC },
+ { STRING_COMMA_LEN (".rodata1"), 0, SHT_PROGBITS, SHF_ALLOC },
+ { STRING_COMMA_LEN (".rela"), -1, SHT_RELA, 0 },
+ { STRING_COMMA_LEN (".rel"), -1, SHT_REL, 0 },
+ { NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section special_sections_s[] =
{
- { ".shstrtab", 9, 0, SHT_STRTAB, 0 },
- { ".strtab", 7, 0, SHT_STRTAB, 0 },
- { ".symtab", 7, 0, SHT_SYMTAB, 0 },
- { ".stabstr", 5, 3, SHT_STRTAB, 0 },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".shstrtab"), 0, SHT_STRTAB, 0 },
+ { STRING_COMMA_LEN (".strtab"), 0, SHT_STRTAB, 0 },
+ { STRING_COMMA_LEN (".symtab"), 0, SHT_SYMTAB, 0 },
+ /* See struct bfd_elf_special_section declaration for the semantics of
+ this special case where .prefix_length != strlen (.prefix). */
+ { ".stabstr", 5, 3, SHT_STRTAB, 0 },
+ { NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section special_sections_t[] =
{
- { ".text", 5, -2, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
- { ".tbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_TLS },
- { ".tdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_TLS },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".text"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
+ { STRING_COMMA_LEN (".tbss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_TLS },
+ { STRING_COMMA_LEN (".tdata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_TLS },
+ { NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section *special_sections[] =
@@ -2452,10 +2550,13 @@ _bfd_elf_new_section_hook (bfd *abfd, asection *sec)
bed = get_elf_backend_data (abfd);
sec->use_rela_p = bed->default_use_rela_p;
- /* When we read a file, we don't need section type and flags unless
- it is a linker created section. They will be overridden in
- _bfd_elf_make_section_from_shdr anyway. */
- if (abfd->direction != read_direction
+ /* When we read a file, we don't need to set ELF section type and
+ flags. They will be overridden in _bfd_elf_make_section_from_shdr
+ anyway. We will set ELF section type and flags for all linker
+ created sections. If user specifies BFD section flags, we will
+ set ELF section type and flags based on BFD section flags in
+ elf_fake_sections. */
+ if ((!sec->flags && abfd->direction != read_direction)
|| (sec->flags & SEC_LINKER_CREATED) != 0)
{
ssect = (*bed->get_sec_type_attr) (abfd, sec);
@@ -2466,7 +2567,7 @@ _bfd_elf_new_section_hook (bfd *abfd, asection *sec)
}
}
- return TRUE;
+ return _bfd_generic_new_section_hook (abfd, sec);
}
/* Create a new bfd section from an ELF program header.
@@ -2657,11 +2758,12 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg)
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
bfd_boolean *failedptr = failedptrarg;
Elf_Internal_Shdr *this_hdr;
+ unsigned int sh_type;
if (*failedptr)
{
/* We already failed; just get out of the bfd_map_over_sections
- loop. */
+ loop. */
return;
}
@@ -2700,8 +2802,8 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg)
if ((asect->flags & SEC_GROUP) != 0)
this_hdr->sh_type = SHT_GROUP;
else if ((asect->flags & SEC_ALLOC) != 0
- && (((asect->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0)
- || (asect->flags & SEC_NEVER_LOAD) != 0))
+ && (((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;
@@ -2750,8 +2852,8 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg)
case SHT_GNU_verdef:
this_hdr->sh_entsize = 0;
/* objcopy or strip will copy over sh_info, but may not set
- cverdefs. The linker will set cverdefs, but sh_info will be
- zero. */
+ cverdefs. The linker will set cverdefs, but sh_info will be
+ zero. */
if (this_hdr->sh_info == 0)
this_hdr->sh_info = elf_tdata (abfd)->cverdefs;
else
@@ -2762,8 +2864,8 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg)
case SHT_GNU_verneed:
this_hdr->sh_entsize = 0;
/* objcopy or strip will copy over sh_info, but may not set
- cverrefs. The linker will set cverrefs, but sh_info will be
- zero. */
+ cverrefs. The linker will set cverrefs, but sh_info will be
+ zero. */
if (this_hdr->sh_info == 0)
this_hdr->sh_info = elf_tdata (abfd)->cverrefs;
else
@@ -2772,7 +2874,11 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg)
break;
case SHT_GROUP:
- this_hdr->sh_entsize = 4;
+ this_hdr->sh_entsize = GRP_ENTRY_SIZE;
+ break;
+
+ case SHT_GNU_HASH:
+ this_hdr->sh_entsize = bed->s->arch_size == 64 ? 0 : 4;
break;
}
@@ -2810,10 +2916,18 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg)
}
/* Check for processor-specific section types. */
+ sh_type = this_hdr->sh_type;
if (bed->elf_backend_fake_sections
&& !(*bed->elf_backend_fake_sections) (abfd, this_hdr, asect))
*failedptr = TRUE;
+ if (sh_type == SHT_NOBITS && asect->size != 0)
+ {
+ /* Don't change the header type from NOBITS if we are being
+ called for objcopy --only-keep-debug. */
+ this_hdr->sh_type = sh_type;
+ }
+
/* If the section has relocs, set up a section header for the
SHT_REL[A] section. If two relocation sections are required for
this section, it is up to the processor-specific back-end to
@@ -2935,14 +3049,14 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info)
d = elf_section_data (sec);
if (d->this_hdr.sh_type == SHT_GROUP)
- {
+ {
if (sec->flags & SEC_LINKER_CREATED)
{
/* Remove the linker created SHT_GROUP sections. */
bfd_section_list_remove (abfd, sec);
abfd->section_count--;
}
- else
+ else
{
if (section_number == SHN_LORESERVE)
section_number += SHN_HIRESERVE + 1 - SHN_LORESERVE;
@@ -3096,7 +3210,7 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info)
s, s->owner);
/* Point to the kept section if it has the same
size as the discarded one. */
- kept = _bfd_elf_check_kept_section (s);
+ kept = _bfd_elf_check_kept_section (s, link_info);
if (kept == NULL)
{
bfd_set_error (bfd_error_bad_value);
@@ -3129,7 +3243,7 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info)
The Intel C compiler generates SHT_IA_64_UNWIND with
SHF_LINK_ORDER. But it doesn't set the sh_link or
sh_info fields. Hence we could get the situation
- where s is NULL. */
+ where s is NULL. */
const struct elf_backend_data *bed
= get_elf_backend_data (abfd);
if (bed->link_order_error_handler)
@@ -3169,7 +3283,7 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info)
string section. We look for a section with the same name
but without the trailing ``str'', and set its sh_link
field to point to this section. */
- if (strncmp (sec->name, ".stab", sizeof ".stab" - 1) == 0
+ if (CONST_STRNEQ (sec->name, ".stab")
&& strcmp (sec->name + strlen (sec->name) - 3, "str") == 0)
{
size_t len;
@@ -3209,9 +3323,8 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info)
case SHT_GNU_LIBLIST:
/* sh_link is the section header index of the prelink library
- list
- used for the dynamic entries, or the symbol table, or the
- version strings. */
+ list used for the dynamic entries, or the symbol table, or
+ the version strings. */
s = bfd_get_section_by_name (abfd, (sec->flags & SEC_ALLOC)
? ".dynstr" : ".gnu.libstr");
if (s != NULL)
@@ -3219,6 +3332,7 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info)
break;
case SHT_HASH:
+ case SHT_GNU_HASH:
case SHT_GNU_versym:
/* sh_link is the section header index of the symbol table
this hash table or version table is for. */
@@ -3244,7 +3358,7 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info)
/* Map symbol from it's internal number to the external number, moving
all local symbols to be at the head of the list. */
-static int
+static bfd_boolean
sym_is_global (bfd *abfd, asymbol *sym)
{
/* If the backend has a special mapping, use it. */
@@ -3257,6 +3371,20 @@ sym_is_global (bfd *abfd, asymbol *sym)
|| bfd_is_com_section (bfd_get_section (sym)));
}
+/* Don't output section symbols for sections that are not going to be
+ output. Also, don't output section symbols for reloc and other
+ special sections. */
+
+static bfd_boolean
+ignore_section_sym (bfd *abfd, asymbol *sym)
+{
+ return ((sym->flags & BSF_SECTION_SYM) != 0
+ && (sym->value != 0
+ || (sym->section->owner != abfd
+ && (sym->section->output_section->owner != abfd
+ || sym->section->output_offset != 0))));
+}
+
static bfd_boolean
elf_map_symbols (bfd *abfd)
{
@@ -3297,51 +3425,29 @@ elf_map_symbols (bfd *abfd)
asymbol *sym = syms[idx];
if ((sym->flags & BSF_SECTION_SYM) != 0
- && sym->value == 0)
+ && !ignore_section_sym (abfd, sym))
{
- asection *sec;
+ asection *sec = sym->section;
- sec = sym->section;
+ if (sec->owner != abfd)
+ sec = sec->output_section;
- if (sec->owner != NULL)
- {
- if (sec->owner != abfd)
- {
- if (sec->output_offset != 0)
- continue;
-
- sec = sec->output_section;
-
- /* Empty sections in the input files may have had a
- section symbol created for them. (See the comment
- near the end of _bfd_generic_link_output_symbols in
- linker.c). If the linker script discards such
- sections then we will reach this point. Since we know
- that we cannot avoid this case, we detect it and skip
- the abort and the assignment to the sect_syms array.
- To reproduce this particular case try running the
- linker testsuite test ld-scripts/weak.exp for an ELF
- port that uses the generic linker. */
- if (sec->owner == NULL)
- continue;
-
- BFD_ASSERT (sec->owner == abfd);
- }
- sect_syms[sec->index] = syms[idx];
- }
+ sect_syms[sec->index] = syms[idx];
}
}
/* Classify all of the symbols. */
for (idx = 0; idx < symcount; idx++)
{
+ if (ignore_section_sym (abfd, syms[idx]))
+ continue;
if (!sym_is_global (abfd, syms[idx]))
num_locals++;
else
num_globals++;
}
- /* We will be adding a section symbol for each BFD section. Most normal
+ /* We will be adding a section symbol for each normal BFD section. Most
sections will already have a section symbol in outsymbols, but
eg. SHT_GROUP sections will not, and we need the section symbol mapped
at least in that case. */
@@ -3367,6 +3473,8 @@ elf_map_symbols (bfd *abfd)
asymbol *sym = syms[idx];
unsigned int i;
+ if (ignore_section_sym (abfd, sym))
+ continue;
if (!sym_is_global (abfd, sym))
i = num_locals2++;
else
@@ -3518,7 +3626,7 @@ _bfd_elf_compute_section_file_positions (bfd *abfd,
elf_tdata (abfd)->next_file_pos = off;
/* Now that we know where the .strtab section goes, write it
- out. */
+ out. */
if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0
|| ! _bfd_stringtab_emit (abfd, strtab))
return FALSE;
@@ -3530,6 +3638,90 @@ _bfd_elf_compute_section_file_positions (bfd *abfd,
return TRUE;
}
+/* Make an initial estimate of the size of the program header. If we
+ get the number wrong here, we'll redo section placement. */
+
+static bfd_size_type
+get_program_header_size (bfd *abfd, struct bfd_link_info *info)
+{
+ size_t segs;
+ asection *s;
+ const struct elf_backend_data *bed;
+
+ /* Assume we will need exactly two PT_LOAD segments: one for text
+ and one for data. */
+ segs = 2;
+
+ s = bfd_get_section_by_name (abfd, ".interp");
+ if (s != NULL && (s->flags & SEC_LOAD) != 0)
+ {
+ /* If we have a loadable interpreter section, we need a
+ PT_INTERP segment. In this case, assume we also need a
+ PT_PHDR segment, although that may not be true for all
+ targets. */
+ segs += 2;
+ }
+
+ if (bfd_get_section_by_name (abfd, ".dynamic") != NULL)
+ {
+ /* We need a PT_DYNAMIC segment. */
+ ++segs;
+
+ if (elf_tdata (abfd)->relro)
+ {
+ /* We need a PT_GNU_RELRO segment only when there is a
+ PT_DYNAMIC segment. */
+ ++segs;
+ }
+ }
+
+ if (elf_tdata (abfd)->eh_frame_hdr)
+ {
+ /* We need a PT_GNU_EH_FRAME segment. */
+ ++segs;
+ }
+
+ if (elf_tdata (abfd)->stack_flags)
+ {
+ /* We need a PT_GNU_STACK segment. */
+ ++segs;
+ }
+
+ for (s = abfd->sections; s != NULL; s = s->next)
+ {
+ if ((s->flags & SEC_LOAD) != 0
+ && CONST_STRNEQ (s->name, ".note"))
+ {
+ /* We need a PT_NOTE segment. */
+ ++segs;
+ }
+ }
+
+ for (s = abfd->sections; s != NULL; s = s->next)
+ {
+ if (s->flags & SEC_THREAD_LOCAL)
+ {
+ /* We need a PT_TLS segment. */
+ ++segs;
+ break;
+ }
+ }
+
+ /* Let the backend count up any program headers it might need. */
+ bed = get_elf_backend_data (abfd);
+ if (bed->elf_backend_additional_program_headers)
+ {
+ int a;
+
+ a = (*bed->elf_backend_additional_program_headers) (abfd, info);
+ if (a == -1)
+ abort ();
+ segs += a;
+ }
+
+ return segs * bed->s->sizeof_phdr;
+}
+
/* Create a mapping from a set of sections to a program segment. */
static struct elf_segment_map *
@@ -3580,363 +3772,421 @@ _bfd_elf_make_dynamic_segment (bfd *abfd, asection *dynsec)
m->p_type = PT_DYNAMIC;
m->count = 1;
m->sections[0] = dynsec;
-
+
return m;
}
-/* Set up a mapping from BFD sections to program segments. */
+/* Possibly add or remove segments from the segment map. */
static bfd_boolean
-map_sections_to_segments (bfd *abfd)
+elf_modify_segment_map (bfd *abfd, struct bfd_link_info *info)
{
- asection **sections = NULL;
- asection *s;
- unsigned int i;
- unsigned int count;
- struct elf_segment_map *mfirst;
- struct elf_segment_map **pm;
- struct elf_segment_map *m;
- asection *last_hdr;
- bfd_vma last_size;
- unsigned int phdr_index;
- bfd_vma maxpagesize;
- asection **hdrpp;
- bfd_boolean phdr_in_segment = TRUE;
- bfd_boolean writable;
- int tls_count = 0;
- asection *first_tls = NULL;
- asection *dynsec, *eh_frame_hdr;
- bfd_size_type amt;
-
- if (elf_tdata (abfd)->segment_map != NULL)
- return TRUE;
+ struct elf_segment_map **m;
+ const struct elf_backend_data *bed;
- if (bfd_count_sections (abfd) == 0)
- return TRUE;
+ /* The placement algorithm assumes that non allocated sections are
+ not in PT_LOAD segments. We ensure this here by removing such
+ sections from the segment map. We also remove excluded
+ sections. Finally, any PT_LOAD segment without sections is
+ removed. */
+ m = &elf_tdata (abfd)->segment_map;
+ while (*m)
+ {
+ unsigned int i, new_count;
- /* Select the allocated sections, and sort them. */
+ for (new_count = 0, i = 0; i < (*m)->count; i++)
+ {
+ if (((*m)->sections[i]->flags & SEC_EXCLUDE) == 0
+ && (((*m)->sections[i]->flags & SEC_ALLOC) != 0
+ || (*m)->p_type != PT_LOAD))
+ {
+ (*m)->sections[new_count] = (*m)->sections[i];
+ new_count++;
+ }
+ }
+ (*m)->count = new_count;
- sections = bfd_malloc2 (bfd_count_sections (abfd), sizeof (asection *));
- if (sections == NULL)
- goto error_return;
+ if ((*m)->p_type == PT_LOAD && (*m)->count == 0)
+ *m = (*m)->next;
+ else
+ m = &(*m)->next;
+ }
- i = 0;
- for (s = abfd->sections; s != NULL; s = s->next)
+ bed = get_elf_backend_data (abfd);
+ if (bed->elf_backend_modify_segment_map != NULL)
{
- if ((s->flags & SEC_ALLOC) != 0)
- {
- sections[i] = s;
- ++i;
- }
+ if (!(*bed->elf_backend_modify_segment_map) (abfd, info))
+ return FALSE;
}
- BFD_ASSERT (i <= bfd_count_sections (abfd));
- count = i;
- qsort (sections, (size_t) count, sizeof (asection *), elf_sort_sections);
+ return TRUE;
+}
- /* Build the mapping. */
+/* Set up a mapping from BFD sections to program segments. */
- mfirst = NULL;
- pm = &mfirst;
+bfd_boolean
+_bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
+{
+ unsigned int count;
+ struct elf_segment_map *m;
+ asection **sections = NULL;
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- /* If we have a .interp section, then create a PT_PHDR segment for
- the program headers and a PT_INTERP segment for the .interp
- section. */
- s = bfd_get_section_by_name (abfd, ".interp");
- if (s != NULL && (s->flags & SEC_LOAD) != 0)
+ if (elf_tdata (abfd)->segment_map == NULL
+ && bfd_count_sections (abfd) != 0)
{
- amt = sizeof (struct elf_segment_map);
- m = bfd_zalloc (abfd, amt);
- if (m == NULL)
- goto error_return;
- m->next = NULL;
- m->p_type = PT_PHDR;
- /* FIXME: UnixWare and Solaris set PF_X, Irix 5 does not. */
- m->p_flags = PF_R | PF_X;
- m->p_flags_valid = 1;
- m->includes_phdrs = 1;
+ asection *s;
+ unsigned int i;
+ struct elf_segment_map *mfirst;
+ struct elf_segment_map **pm;
+ asection *last_hdr;
+ bfd_vma last_size;
+ unsigned int phdr_index;
+ bfd_vma maxpagesize;
+ asection **hdrpp;
+ bfd_boolean phdr_in_segment = TRUE;
+ bfd_boolean writable;
+ int tls_count = 0;
+ asection *first_tls = NULL;
+ asection *dynsec, *eh_frame_hdr;
+ bfd_size_type amt;
- *pm = m;
- pm = &m->next;
+ /* Select the allocated sections, and sort them. */
- amt = sizeof (struct elf_segment_map);
- m = bfd_zalloc (abfd, amt);
- if (m == NULL)
+ sections = bfd_malloc2 (bfd_count_sections (abfd), sizeof (asection *));
+ if (sections == NULL)
goto error_return;
- m->next = NULL;
- m->p_type = PT_INTERP;
- m->count = 1;
- m->sections[0] = s;
-
- *pm = m;
- pm = &m->next;
- }
-
- /* Look through the sections. We put sections in the same program
- segment when the start of the second section can be placed within
- a few bytes of the end of the first section. */
- last_hdr = NULL;
- last_size = 0;
- phdr_index = 0;
- maxpagesize = get_elf_backend_data (abfd)->maxpagesize;
- writable = FALSE;
- dynsec = bfd_get_section_by_name (abfd, ".dynamic");
- if (dynsec != NULL
- && (dynsec->flags & SEC_LOAD) == 0)
- dynsec = NULL;
-
- /* Deal with -Ttext or something similar such that the first section
- is not adjacent to the program headers. This is an
- approximation, since at this point we don't know exactly how many
- program headers we will need. */
- if (count > 0)
- {
- bfd_size_type phdr_size;
-
- phdr_size = elf_tdata (abfd)->program_header_size;
- if (phdr_size == 0)
- phdr_size = get_elf_backend_data (abfd)->s->sizeof_phdr;
- if ((abfd->flags & D_PAGED) == 0
- || sections[0]->lma < phdr_size
- || sections[0]->lma % maxpagesize < phdr_size % maxpagesize)
- phdr_in_segment = FALSE;
- }
-
- for (i = 0, hdrpp = sections; i < count; i++, hdrpp++)
- {
- asection *hdr;
- bfd_boolean new_segment;
-
- hdr = *hdrpp;
-
- /* See if this section and the last one will fit in the same
- segment. */
- if (last_hdr == NULL)
- {
- /* If we don't have a segment yet, then we don't need a new
- one (we build the last one after this loop). */
- new_segment = FALSE;
- }
- else if (last_hdr->lma - last_hdr->vma != hdr->lma - hdr->vma)
- {
- /* If this section has a different relation between the
- virtual address and the load address, then we need a new
- segment. */
- new_segment = TRUE;
- }
- else if (BFD_ALIGN (last_hdr->lma + last_size, maxpagesize)
- < BFD_ALIGN (hdr->lma, maxpagesize))
- {
- /* If putting this section in this segment would force us to
- skip a page in the segment, then we need a new segment. */
- new_segment = TRUE;
- }
- else if ((last_hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) == 0
- && (hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) != 0)
+ i = 0;
+ for (s = abfd->sections; s != NULL; s = s->next)
{
- /* We don't want to put a loadable section after a
- nonloadable section in the same segment.
- Consider .tbss sections as loadable for this purpose. */
- new_segment = TRUE;
- }
- else if ((abfd->flags & D_PAGED) == 0)
- {
- /* If the file is not demand paged, which means that we
- don't require the sections to be correctly aligned in the
- file, then there is no other reason for a new segment. */
- new_segment = FALSE;
+ if ((s->flags & SEC_ALLOC) != 0)
+ {
+ sections[i] = s;
+ ++i;
+ }
}
- else if (! writable
- && (hdr->flags & SEC_READONLY) == 0
- && (((last_hdr->lma + last_size - 1)
- & ~(maxpagesize - 1))
- != (hdr->lma & ~(maxpagesize - 1))))
+ BFD_ASSERT (i <= bfd_count_sections (abfd));
+ count = i;
+
+ qsort (sections, (size_t) count, sizeof (asection *), elf_sort_sections);
+
+ /* Build the mapping. */
+
+ mfirst = NULL;
+ pm = &mfirst;
+
+ /* If we have a .interp section, then create a PT_PHDR segment for
+ the program headers and a PT_INTERP segment for the .interp
+ section. */
+ s = bfd_get_section_by_name (abfd, ".interp");
+ if (s != NULL && (s->flags & SEC_LOAD) != 0)
{
- /* We don't want to put a writable section in a read only
- segment, unless they are on the same page in memory
- anyhow. We already know that the last section does not
- bring us past the current section on the page, so the
- only case in which the new section is not on the same
- page as the previous section is when the previous section
- ends precisely on a page boundary. */
- new_segment = TRUE;
+ amt = sizeof (struct elf_segment_map);
+ m = bfd_zalloc (abfd, amt);
+ if (m == NULL)
+ goto error_return;
+ m->next = NULL;
+ m->p_type = PT_PHDR;
+ /* FIXME: UnixWare and Solaris set PF_X, Irix 5 does not. */
+ m->p_flags = PF_R | PF_X;
+ m->p_flags_valid = 1;
+ m->includes_phdrs = 1;
+
+ *pm = m;
+ pm = &m->next;
+
+ amt = sizeof (struct elf_segment_map);
+ m = bfd_zalloc (abfd, amt);
+ if (m == NULL)
+ goto error_return;
+ m->next = NULL;
+ m->p_type = PT_INTERP;
+ m->count = 1;
+ m->sections[0] = s;
+
+ *pm = m;
+ pm = &m->next;
}
- else
+
+ /* Look through the sections. We put sections in the same program
+ segment when the start of the second section can be placed within
+ a few bytes of the end of the first section. */
+ last_hdr = NULL;
+ last_size = 0;
+ phdr_index = 0;
+ maxpagesize = bed->maxpagesize;
+ writable = FALSE;
+ dynsec = bfd_get_section_by_name (abfd, ".dynamic");
+ if (dynsec != NULL
+ && (dynsec->flags & SEC_LOAD) == 0)
+ dynsec = NULL;
+
+ /* Deal with -Ttext or something similar such that the first section
+ is not adjacent to the program headers. This is an
+ approximation, since at this point we don't know exactly how many
+ program headers we will need. */
+ if (count > 0)
{
- /* Otherwise, we can use the same segment. */
- new_segment = FALSE;
+ bfd_size_type phdr_size = elf_tdata (abfd)->program_header_size;
+
+ if (phdr_size == (bfd_size_type) -1)
+ phdr_size = get_program_header_size (abfd, info);
+ if ((abfd->flags & D_PAGED) == 0
+ || sections[0]->lma < phdr_size
+ || sections[0]->lma % maxpagesize < phdr_size % maxpagesize)
+ phdr_in_segment = FALSE;
}
- if (! new_segment)
+ for (i = 0, hdrpp = sections; i < count; i++, hdrpp++)
{
+ asection *hdr;
+ bfd_boolean new_segment;
+
+ hdr = *hdrpp;
+
+ /* See if this section and the last one will fit in the same
+ segment. */
+
+ if (last_hdr == NULL)
+ {
+ /* If we don't have a segment yet, then we don't need a new
+ one (we build the last one after this loop). */
+ new_segment = FALSE;
+ }
+ else if (last_hdr->lma - last_hdr->vma != hdr->lma - hdr->vma)
+ {
+ /* If this section has a different relation between the
+ virtual address and the load address, then we need a new
+ segment. */
+ new_segment = TRUE;
+ }
+ else if (BFD_ALIGN (last_hdr->lma + last_size, maxpagesize)
+ < BFD_ALIGN (hdr->lma, maxpagesize))
+ {
+ /* If putting this section in this segment would force us to
+ skip a page in the segment, then we need a new segment. */
+ new_segment = TRUE;
+ }
+ else if ((last_hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) == 0
+ && (hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) != 0)
+ {
+ /* We don't want to put a loadable section after a
+ nonloadable section in the same segment.
+ Consider .tbss sections as loadable for this purpose. */
+ new_segment = TRUE;
+ }
+ else if ((abfd->flags & D_PAGED) == 0)
+ {
+ /* If the file is not demand paged, which means that we
+ don't require the sections to be correctly aligned in the
+ file, then there is no other reason for a new segment. */
+ new_segment = FALSE;
+ }
+ else if (! writable
+ && (hdr->flags & SEC_READONLY) == 0
+ && (((last_hdr->lma + last_size - 1)
+ & ~(maxpagesize - 1))
+ != (hdr->lma & ~(maxpagesize - 1))))
+ {
+ /* We don't want to put a writable section in a read only
+ segment, unless they are on the same page in memory
+ anyhow. We already know that the last section does not
+ bring us past the current section on the page, so the
+ only case in which the new section is not on the same
+ page as the previous section is when the previous section
+ ends precisely on a page boundary. */
+ new_segment = TRUE;
+ }
+ else
+ {
+ /* Otherwise, we can use the same segment. */
+ new_segment = FALSE;
+ }
+
+ /* Allow interested parties a chance to override our decision. */
+ if (last_hdr && info->callbacks->override_segment_assignment)
+ new_segment = info->callbacks->override_segment_assignment (info, abfd, hdr, last_hdr, new_segment);
+
+ if (! new_segment)
+ {
+ if ((hdr->flags & SEC_READONLY) == 0)
+ writable = TRUE;
+ last_hdr = hdr;
+ /* .tbss sections effectively have zero size. */
+ if ((hdr->flags & (SEC_THREAD_LOCAL | SEC_LOAD))
+ != SEC_THREAD_LOCAL)
+ last_size = hdr->size;
+ else
+ last_size = 0;
+ continue;
+ }
+
+ /* We need a new program segment. We must create a new program
+ header holding all the sections from phdr_index until hdr. */
+
+ m = make_mapping (abfd, sections, phdr_index, i, phdr_in_segment);
+ if (m == NULL)
+ goto error_return;
+
+ *pm = m;
+ pm = &m->next;
+
if ((hdr->flags & SEC_READONLY) == 0)
writable = TRUE;
+ else
+ writable = FALSE;
+
last_hdr = hdr;
/* .tbss sections effectively have zero size. */
if ((hdr->flags & (SEC_THREAD_LOCAL | SEC_LOAD)) != SEC_THREAD_LOCAL)
last_size = hdr->size;
else
last_size = 0;
- continue;
+ phdr_index = i;
+ phdr_in_segment = FALSE;
}
- /* We need a new program segment. We must create a new program
- header holding all the sections from phdr_index until hdr. */
+ /* Create a final PT_LOAD program segment. */
+ if (last_hdr != NULL)
+ {
+ m = make_mapping (abfd, sections, phdr_index, i, phdr_in_segment);
+ if (m == NULL)
+ goto error_return;
- m = make_mapping (abfd, sections, phdr_index, i, phdr_in_segment);
- if (m == NULL)
- goto error_return;
+ *pm = m;
+ pm = &m->next;
+ }
- *pm = m;
- pm = &m->next;
+ /* If there is a .dynamic section, throw in a PT_DYNAMIC segment. */
+ if (dynsec != NULL)
+ {
+ m = _bfd_elf_make_dynamic_segment (abfd, dynsec);
+ if (m == NULL)
+ goto error_return;
+ *pm = m;
+ pm = &m->next;
+ }
- if ((hdr->flags & SEC_READONLY) == 0)
- writable = TRUE;
- else
- writable = FALSE;
+ /* For each loadable .note section, add a PT_NOTE segment. We don't
+ use bfd_get_section_by_name, because if we link together
+ nonloadable .note sections and loadable .note sections, we will
+ generate two .note sections in the output file. FIXME: Using
+ names for section types is bogus anyhow. */
+ for (s = abfd->sections; s != NULL; s = s->next)
+ {
+ if ((s->flags & SEC_LOAD) != 0
+ && CONST_STRNEQ (s->name, ".note"))
+ {
+ amt = sizeof (struct elf_segment_map);
+ m = bfd_zalloc (abfd, amt);
+ if (m == NULL)
+ goto error_return;
+ m->next = NULL;
+ m->p_type = PT_NOTE;
+ m->count = 1;
+ m->sections[0] = s;
- last_hdr = hdr;
- /* .tbss sections effectively have zero size. */
- if ((hdr->flags & (SEC_THREAD_LOCAL | SEC_LOAD)) != SEC_THREAD_LOCAL)
- last_size = hdr->size;
- else
- last_size = 0;
- phdr_index = i;
- phdr_in_segment = FALSE;
- }
+ *pm = m;
+ pm = &m->next;
+ }
+ if (s->flags & SEC_THREAD_LOCAL)
+ {
+ if (! tls_count)
+ first_tls = s;
+ tls_count++;
+ }
+ }
- /* Create a final PT_LOAD program segment. */
- if (last_hdr != NULL)
- {
- m = make_mapping (abfd, sections, phdr_index, i, phdr_in_segment);
- if (m == NULL)
- goto error_return;
+ /* If there are any SHF_TLS output sections, add PT_TLS segment. */
+ if (tls_count > 0)
+ {
+ int i;
- *pm = m;
- pm = &m->next;
- }
+ amt = sizeof (struct elf_segment_map);
+ amt += (tls_count - 1) * sizeof (asection *);
+ m = bfd_zalloc (abfd, amt);
+ if (m == NULL)
+ goto error_return;
+ m->next = NULL;
+ m->p_type = PT_TLS;
+ m->count = tls_count;
+ /* Mandated PF_R. */
+ m->p_flags = PF_R;
+ m->p_flags_valid = 1;
+ for (i = 0; i < tls_count; ++i)
+ {
+ BFD_ASSERT (first_tls->flags & SEC_THREAD_LOCAL);
+ m->sections[i] = first_tls;
+ first_tls = first_tls->next;
+ }
- /* If there is a .dynamic section, throw in a PT_DYNAMIC segment. */
- if (dynsec != NULL)
- {
- m = _bfd_elf_make_dynamic_segment (abfd, dynsec);
- if (m == NULL)
- goto error_return;
- *pm = m;
- pm = &m->next;
- }
+ *pm = m;
+ pm = &m->next;
+ }
- /* For each loadable .note section, add a PT_NOTE segment. We don't
- use bfd_get_section_by_name, because if we link together
- nonloadable .note sections and loadable .note sections, we will
- generate two .note sections in the output file. FIXME: Using
- names for section types is bogus anyhow. */
- for (s = abfd->sections; s != NULL; s = s->next)
- {
- if ((s->flags & SEC_LOAD) != 0
- && strncmp (s->name, ".note", 5) == 0)
+ /* If there is a .eh_frame_hdr section, throw in a PT_GNU_EH_FRAME
+ segment. */
+ eh_frame_hdr = elf_tdata (abfd)->eh_frame_hdr;
+ if (eh_frame_hdr != NULL
+ && (eh_frame_hdr->output_section->flags & SEC_LOAD) != 0)
{
amt = sizeof (struct elf_segment_map);
m = bfd_zalloc (abfd, amt);
if (m == NULL)
goto error_return;
m->next = NULL;
- m->p_type = PT_NOTE;
+ m->p_type = PT_GNU_EH_FRAME;
m->count = 1;
- m->sections[0] = s;
+ m->sections[0] = eh_frame_hdr->output_section;
*pm = m;
pm = &m->next;
}
- if (s->flags & SEC_THREAD_LOCAL)
- {
- if (! tls_count)
- first_tls = s;
- tls_count++;
- }
- }
- /* If there are any SHF_TLS output sections, add PT_TLS segment. */
- if (tls_count > 0)
- {
- int i;
-
- amt = sizeof (struct elf_segment_map);
- amt += (tls_count - 1) * sizeof (asection *);
- m = bfd_zalloc (abfd, amt);
- if (m == NULL)
- goto error_return;
- m->next = NULL;
- m->p_type = PT_TLS;
- m->count = tls_count;
- /* Mandated PF_R. */
- m->p_flags = PF_R;
- m->p_flags_valid = 1;
- for (i = 0; i < tls_count; ++i)
+ if (elf_tdata (abfd)->stack_flags)
{
- BFD_ASSERT (first_tls->flags & SEC_THREAD_LOCAL);
- m->sections[i] = first_tls;
- first_tls = first_tls->next;
- }
-
- *pm = m;
- pm = &m->next;
- }
+ amt = sizeof (struct elf_segment_map);
+ m = bfd_zalloc (abfd, amt);
+ if (m == NULL)
+ goto error_return;
+ m->next = NULL;
+ m->p_type = PT_GNU_STACK;
+ m->p_flags = elf_tdata (abfd)->stack_flags;
+ m->p_flags_valid = 1;
- /* If there is a .eh_frame_hdr section, throw in a PT_GNU_EH_FRAME
- segment. */
- eh_frame_hdr = elf_tdata (abfd)->eh_frame_hdr;
- if (eh_frame_hdr != NULL
- && (eh_frame_hdr->output_section->flags & SEC_LOAD) != 0)
- {
- amt = sizeof (struct elf_segment_map);
- m = bfd_zalloc (abfd, amt);
- if (m == NULL)
- goto error_return;
- m->next = NULL;
- m->p_type = PT_GNU_EH_FRAME;
- m->count = 1;
- m->sections[0] = eh_frame_hdr->output_section;
+ *pm = m;
+ pm = &m->next;
+ }
- *pm = m;
- pm = &m->next;
- }
+ if (dynsec != NULL && elf_tdata (abfd)->relro)
+ {
+ /* We make a PT_GNU_RELRO segment only when there is a
+ PT_DYNAMIC segment. */
+ amt = sizeof (struct elf_segment_map);
+ m = bfd_zalloc (abfd, amt);
+ if (m == NULL)
+ goto error_return;
+ m->next = NULL;
+ m->p_type = PT_GNU_RELRO;
+ m->p_flags = PF_R;
+ m->p_flags_valid = 1;
- if (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;
+ }
- *pm = m;
- pm = &m->next;
+ free (sections);
+ elf_tdata (abfd)->segment_map = mfirst;
}
- if (elf_tdata (abfd)->relro)
- {
- amt = sizeof (struct elf_segment_map);
- m = bfd_zalloc (abfd, amt);
- if (m == NULL)
- goto error_return;
- m->next = NULL;
- m->p_type = PT_GNU_RELRO;
- m->p_flags = PF_R;
- m->p_flags_valid = 1;
-
- *pm = m;
- pm = &m->next;
- }
+ if (!elf_modify_segment_map (abfd, info))
+ return FALSE;
- free (sections);
- sections = NULL;
+ for (count = 0, m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
+ ++count;
+ elf_tdata (abfd)->program_header_size = count * bed->s->sizeof_phdr;
- elf_tdata (abfd)->segment_map = mfirst;
return TRUE;
error_return:
@@ -4023,7 +4273,7 @@ elf_sort_sections (const void *arg1, const void *arg2)
adjustment = vma_offset + bed->maxpagesize - off_offset;
else
adjustment = vma_offset - off_offset;
-
+
which can can be collapsed into the expression below. */
static file_ptr
@@ -4032,154 +4282,69 @@ vma_page_aligned_bias (bfd_vma vma, ufile_ptr off, bfd_vma maxpagesize)
return ((vma - off) % maxpagesize);
}
-static void
-print_segment_map (bfd *abfd)
-{
- struct elf_segment_map *m;
- unsigned int i, j;
-
- fprintf (stderr, _(" Section to Segment mapping:\n"));
- fprintf (stderr, _(" Segment Sections...\n"));
-
- for (i= 0, m = elf_tdata (abfd)->segment_map;
- m != NULL;
- i++, m = m->next)
- {
- const char *pt = get_segment_type (m->p_type);
- char buf[32];
-
- if (pt == NULL)
- {
- if (m->p_type >= PT_LOPROC && m->p_type <= PT_HIPROC)
- sprintf (buf, "LOPROC+%7.7x",
- (unsigned int) (m->p_type - PT_LOPROC));
- else if (m->p_type >= PT_LOOS && m->p_type <= PT_HIOS)
- sprintf (buf, "LOOS+%7.7x",
- (unsigned int) (m->p_type - PT_LOOS));
- else
- snprintf (buf, sizeof (buf), "%8.8x",
- (unsigned int) m->p_type);
- pt = buf;
- }
- fprintf (stderr, " %2.2d: %14.14s: ", i, pt);
- for (j = 0; j < m->count; j++)
- fprintf (stderr, "%s ", m->sections [j]->name);
- putc ('\n',stderr);
- }
-}
-
/* Assign file positions to the sections based on the mapping from
sections to segments. This function also sets up some fields in
- the file header, and writes out the program headers. */
+ the file header. */
static bfd_boolean
-assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info)
+assign_file_positions_for_load_sections (bfd *abfd,
+ struct bfd_link_info *link_info)
{
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- unsigned int count;
struct elf_segment_map *m;
- unsigned int alloc;
Elf_Internal_Phdr *phdrs;
- file_ptr off, voff;
- bfd_vma filehdr_vaddr, filehdr_paddr;
- bfd_vma phdrs_vaddr, phdrs_paddr;
Elf_Internal_Phdr *p;
+ file_ptr off;
+ bfd_size_type maxpagesize;
+ unsigned int alloc;
+ unsigned int i, j;
- if (elf_tdata (abfd)->segment_map == NULL)
- {
- if (! map_sections_to_segments (abfd))
- return FALSE;
- }
- else
- {
- /* The placement algorithm assumes that non allocated sections are
- not in PT_LOAD segments. We ensure this here by removing such
- sections from the segment map. We also remove excluded
- sections. */
- for (m = elf_tdata (abfd)->segment_map;
- m != NULL;
- m = m->next)
- {
- unsigned int new_count;
- unsigned int i;
-
- new_count = 0;
- for (i = 0; i < m->count; i ++)
- {
- if ((m->sections[i]->flags & SEC_EXCLUDE) == 0
- && ((m->sections[i]->flags & SEC_ALLOC) != 0
- || m->p_type != PT_LOAD))
- {
- if (i != new_count)
- m->sections[new_count] = m->sections[i];
-
- new_count ++;
- }
- }
-
- if (new_count != m->count)
- m->count = new_count;
- }
- }
-
- if (bed->elf_backend_modify_segment_map)
- {
- if (! (*bed->elf_backend_modify_segment_map) (abfd, link_info))
- return FALSE;
- }
+ if (link_info == NULL
+ && !elf_modify_segment_map (abfd, link_info))
+ return FALSE;
- count = 0;
+ alloc = 0;
for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
- ++count;
+ ++alloc;
elf_elfheader (abfd)->e_phoff = bed->s->sizeof_ehdr;
elf_elfheader (abfd)->e_phentsize = bed->s->sizeof_phdr;
- elf_elfheader (abfd)->e_phnum = count;
+ elf_elfheader (abfd)->e_phnum = alloc;
+
+ if (elf_tdata (abfd)->program_header_size == (bfd_size_type) -1)
+ elf_tdata (abfd)->program_header_size = alloc * bed->s->sizeof_phdr;
+ else
+ BFD_ASSERT (elf_tdata (abfd)->program_header_size
+ >= alloc * bed->s->sizeof_phdr);
- if (count == 0)
+ if (alloc == 0)
{
elf_tdata (abfd)->next_file_pos = bed->s->sizeof_ehdr;
return TRUE;
}
- /* If we already counted the number of program segments, make sure
- that we allocated enough space. This happens when SIZEOF_HEADERS
- is used in a linker script. */
- alloc = elf_tdata (abfd)->program_header_size / bed->s->sizeof_phdr;
- if (alloc != 0 && count > alloc)
- {
- ((*_bfd_error_handler)
- (_("%B: Not enough room for program headers (allocated %u, need %u)"),
- abfd, alloc, count));
- print_segment_map (abfd);
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- if (alloc == 0)
- alloc = count;
-
phdrs = bfd_alloc2 (abfd, alloc, sizeof (Elf_Internal_Phdr));
+ elf_tdata (abfd)->phdr = phdrs;
if (phdrs == NULL)
return FALSE;
+ maxpagesize = 1;
+ if ((abfd->flags & D_PAGED) != 0)
+ maxpagesize = bed->maxpagesize;
+
off = bed->s->sizeof_ehdr;
off += alloc * bed->s->sizeof_phdr;
- filehdr_vaddr = 0;
- filehdr_paddr = 0;
- phdrs_vaddr = 0;
- phdrs_paddr = 0;
-
- for (m = elf_tdata (abfd)->segment_map, p = phdrs;
+ for (m = elf_tdata (abfd)->segment_map, p = phdrs, j = 0;
m != NULL;
- m = m->next, p++)
+ m = m->next, p++, j++)
{
- unsigned int i;
asection **secpp;
+ bfd_vma off_adjust;
+ bfd_boolean no_contents;
/* If elf_segment_map is not from map_sections_to_segments, the
- sections may not be correctly ordered. NOTE: sorting should
+ sections may not be correctly ordered. NOTE: sorting should
not be done to the PT_NOTE section of a corefile, which may
contain several pseudo-sections artificially created by bfd.
Sorting these pseudo-sections breaks things badly. */
@@ -4193,58 +4358,109 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info)
number of sections with contents contributing to both p_filesz
and p_memsz, followed by a number of sections with no contents
that just contribute to p_memsz. In this loop, OFF tracks next
- available file offset for PT_LOAD and PT_NOTE segments. VOFF is
- an adjustment we use for segments that have no file contents
- but need zero filled memory allocation. */
- voff = 0;
+ available file offset for PT_LOAD and PT_NOTE segments. */
p->p_type = m->p_type;
p->p_flags = m->p_flags;
+ if (m->count == 0)
+ p->p_vaddr = 0;
+ else
+ p->p_vaddr = m->sections[0]->vma - m->p_vaddr_offset;
+
+ if (m->p_paddr_valid)
+ p->p_paddr = m->p_paddr;
+ else if (m->count == 0)
+ p->p_paddr = 0;
+ else
+ p->p_paddr = m->sections[0]->lma - m->p_vaddr_offset;
+
+ if (p->p_type == PT_LOAD
+ && (abfd->flags & D_PAGED) != 0)
+ {
+ /* p_align in demand paged PT_LOAD segments effectively stores
+ the maximum page size. When copying an executable with
+ objcopy, we set m->p_align from the input file. Use this
+ value for maxpagesize rather than bed->maxpagesize, which
+ may be different. Note that we use maxpagesize for PT_TLS
+ segment alignment later in this function, so we are relying
+ on at least one PT_LOAD segment appearing before a PT_TLS
+ segment. */
+ if (m->p_align_valid)
+ maxpagesize = m->p_align;
+
+ p->p_align = maxpagesize;
+ }
+ else if (m->count == 0)
+ p->p_align = 1 << bed->s->log_file_align;
+ else if (m->p_align_valid)
+ p->p_align = m->p_align;
+ else
+ p->p_align = 0;
+
+ no_contents = FALSE;
+ off_adjust = 0;
if (p->p_type == PT_LOAD
&& m->count > 0)
{
bfd_size_type align;
- bfd_vma adjust;
unsigned int align_power = 0;
- for (i = 0, secpp = m->sections; i < m->count; i++, secpp++)
+ if (m->p_align_valid)
+ align = p->p_align;
+ else
{
- unsigned int secalign;
+ for (i = 0, secpp = m->sections; i < m->count; i++, secpp++)
+ {
+ unsigned int secalign;
- secalign = bfd_get_section_alignment (abfd, *secpp);
- if (secalign > align_power)
- align_power = secalign;
+ secalign = bfd_get_section_alignment (abfd, *secpp);
+ if (secalign > align_power)
+ align_power = secalign;
+ }
+ align = (bfd_size_type) 1 << align_power;
+ if (align < maxpagesize)
+ align = maxpagesize;
}
- align = (bfd_size_type) 1 << align_power;
-
- if ((abfd->flags & D_PAGED) != 0 && bed->maxpagesize > align)
- align = bed->maxpagesize;
- adjust = vma_page_aligned_bias (m->sections[0]->vma, off, align);
- off += adjust;
- if (adjust != 0
- && !m->includes_filehdr
- && !m->includes_phdrs
- && (ufile_ptr) off >= align)
+ for (i = 0; i < m->count; i++)
+ if ((m->sections[i]->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0)
+ /* If we aren't making room for this section, then
+ it must be SHT_NOBITS regardless of what we've
+ set via struct bfd_elf_special_section. */
+ elf_section_type (m->sections[i]) = SHT_NOBITS;
+
+ /* Find out whether this segment contains any loadable
+ sections. If the first section isn't loadable, the same
+ holds for any other sections. */
+ i = 0;
+ while (elf_section_type (m->sections[i]) == SHT_NOBITS)
{
- /* If the first section isn't loadable, the same holds for
- any other sections. Since the segment won't need file
- space, we can make p_offset overlap some prior segment.
- However, .tbss is special. If a segment starts with
- .tbss, we need to look at the next section to decide
- whether the segment has any loadable sections. */
- i = 0;
- while ((m->sections[i]->flags & SEC_LOAD) == 0)
+ /* If a segment starts with .tbss, we need to look
+ at the next section to decide whether the segment
+ has any loadable sections. */
+ if ((elf_section_flags (m->sections[i]) & SHF_TLS) == 0
+ || ++i >= m->count)
{
- if ((m->sections[i]->flags & SEC_THREAD_LOCAL) == 0
- || ++i >= m->count)
- {
- off -= adjust;
- voff = adjust - align;
- break;
- }
+ no_contents = TRUE;
+ break;
}
}
+
+ off_adjust = vma_page_aligned_bias (m->sections[0]->vma, off, align);
+ off += off_adjust;
+ if (no_contents)
+ {
+ /* We shouldn't need to align the segment on disk since
+ the segment doesn't need file space, but the gABI
+ arguably requires the alignment and glibc ld.so
+ checks it. So to comply with the alignment
+ requirement but not waste file space, we adjust
+ p_offset for just this segment. (OFF_ADJUST is
+ subtracted from OFF later.) This may put p_offset
+ past the end of file, but that shouldn't matter. */
+ }
+ else
+ off_adjust = 0;
}
/* Make sure the .dynamic section is the first section in the
PT_DYNAMIC segment. */
@@ -4259,35 +4475,14 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info)
return FALSE;
}
- if (m->count == 0)
- p->p_vaddr = 0;
- else
- p->p_vaddr = m->sections[0]->vma;
-
- if (m->p_paddr_valid)
- p->p_paddr = m->p_paddr;
- else if (m->count == 0)
- p->p_paddr = 0;
- else
- p->p_paddr = m->sections[0]->lma;
-
- if (p->p_type == PT_LOAD
- && (abfd->flags & D_PAGED) != 0)
- p->p_align = bed->maxpagesize;
- else if (m->count == 0)
- p->p_align = 1 << bed->s->log_file_align;
- else
- p->p_align = 0;
-
p->p_offset = 0;
p->p_filesz = 0;
p->p_memsz = 0;
if (m->includes_filehdr)
{
- if (! m->p_flags_valid)
+ if (!m->p_flags_valid)
p->p_flags |= PF_R;
- p->p_offset = 0;
p->p_filesz = bed->s->sizeof_ehdr;
p->p_memsz = bed->s->sizeof_ehdr;
if (m->count > 0)
@@ -4304,30 +4499,17 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info)
}
p->p_vaddr -= off;
- if (! m->p_paddr_valid)
+ if (!m->p_paddr_valid)
p->p_paddr -= off;
}
- if (p->p_type == PT_LOAD)
- {
- filehdr_vaddr = p->p_vaddr;
- filehdr_paddr = p->p_paddr;
- }
}
if (m->includes_phdrs)
{
- if (! m->p_flags_valid)
+ if (!m->p_flags_valid)
p->p_flags |= PF_R;
- if (m->includes_filehdr)
- {
- if (p->p_type == PT_LOAD)
- {
- phdrs_vaddr = p->p_vaddr + bed->s->sizeof_ehdr;
- phdrs_paddr = p->p_paddr + bed->s->sizeof_ehdr;
- }
- }
- else
+ if (!m->includes_filehdr)
{
p->p_offset = bed->s->sizeof_ehdr;
@@ -4335,17 +4517,9 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info)
{
BFD_ASSERT (p->p_type == PT_LOAD);
p->p_vaddr -= off - p->p_offset;
- if (! m->p_paddr_valid)
+ if (!m->p_paddr_valid)
p->p_paddr -= off - p->p_offset;
}
-
- if (p->p_type == PT_LOAD)
- {
- phdrs_vaddr = p->p_vaddr;
- phdrs_paddr = p->p_paddr;
- }
- else
- phdrs_vaddr = bed->maxpagesize + bed->s->sizeof_ehdr;
}
p->p_filesz += alloc * bed->s->sizeof_phdr;
@@ -4355,36 +4529,44 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info)
if (p->p_type == PT_LOAD
|| (p->p_type == PT_NOTE && bfd_get_format (abfd) == bfd_core))
{
- if (! m->includes_filehdr && ! m->includes_phdrs)
- p->p_offset = off + voff;
+ if (!m->includes_filehdr && !m->includes_phdrs)
+ p->p_offset = off;
else
{
file_ptr adjust;
adjust = off - (p->p_offset + p->p_filesz);
- p->p_filesz += adjust;
+ if (!no_contents)
+ p->p_filesz += adjust;
p->p_memsz += adjust;
}
}
+ /* Set up p_filesz, p_memsz, p_align and p_flags from the section
+ maps. Set filepos for sections in PT_LOAD segments, and in
+ core files, for sections in PT_NOTE segments.
+ assign_file_positions_for_non_load_sections will set filepos
+ for other sections and update p_filesz for other segments. */
for (i = 0, secpp = m->sections; i < m->count; i++, secpp++)
{
asection *sec;
- flagword flags;
bfd_size_type align;
+ Elf_Internal_Shdr *this_hdr;
sec = *secpp;
- flags = sec->flags;
- align = 1 << bfd_get_section_alignment (abfd, sec);
+ this_hdr = &elf_section_data (sec)->this_hdr;
+ align = (bfd_size_type) 1 << bfd_get_section_alignment (abfd, sec);
if (p->p_type == PT_LOAD
|| p->p_type == PT_TLS)
{
- bfd_signed_vma adjust;
+ bfd_signed_vma adjust = sec->lma - (p->p_paddr + p->p_memsz);
- if ((flags & SEC_LOAD) != 0)
+ if (this_hdr->sh_type != SHT_NOBITS
+ || ((this_hdr->sh_flags & SHF_ALLOC) != 0
+ && ((this_hdr->sh_flags & SHF_TLS) == 0
+ || p->p_type == PT_TLS)))
{
- adjust = sec->lma - (p->p_paddr + p->p_filesz);
if (adjust < 0)
{
(*_bfd_error_handler)
@@ -4392,24 +4574,13 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info)
abfd, sec, (unsigned long) sec->lma);
adjust = 0;
}
- off += adjust;
- p->p_filesz += adjust;
- p->p_memsz += adjust;
- }
- /* .tbss is special. It doesn't contribute to p_memsz of
- normal segments. */
- else if ((flags & SEC_THREAD_LOCAL) == 0
- || p->p_type == PT_TLS)
- {
- /* The section VMA must equal the file position
- modulo the page size. */
- bfd_size_type page = align;
- if ((abfd->flags & D_PAGED) != 0 && bed->maxpagesize > page)
- page = bed->maxpagesize;
- adjust = vma_page_aligned_bias (sec->vma,
- p->p_vaddr + p->p_memsz,
- page);
p->p_memsz += adjust;
+
+ if (this_hdr->sh_type != SHT_NOBITS)
+ {
+ off += adjust;
+ p->p_filesz += adjust;
+ }
}
}
@@ -4419,9 +4590,9 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info)
everything. */
if (i == 0)
{
- sec->filepos = off;
- off += sec->size;
- p->p_filesz = sec->size;
+ this_hdr->sh_offset = sec->filepos = off;
+ off += this_hdr->sh_size;
+ p->p_filesz = this_hdr->sh_size;
p->p_memsz = 0;
p->p_align = 1;
}
@@ -4438,96 +4609,200 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info)
{
if (p->p_type == PT_LOAD)
{
- sec->filepos = off;
- /* FIXME: The SEC_HAS_CONTENTS test here dates back to
- 1997, and the exact reason for it isn't clear. One
- plausible explanation is that it is to work around
- a problem we have with linker scripts using data
- statements in NOLOAD sections. I don't think it
- makes a great deal of sense to have such a section
- assigned to a PT_LOAD segment, but apparently
- people do this. The data statement results in a
- bfd_data_link_order being built, and these need
- section contents to write into. Eventually, we get
- to _bfd_elf_write_object_contents which writes any
- section with contents to the output. Make room
- here for the write, so that following segments are
- not trashed. */
- if ((flags & SEC_LOAD) != 0
- || (flags & SEC_HAS_CONTENTS) != 0)
- off += sec->size;
+ this_hdr->sh_offset = sec->filepos = off;
+ if (this_hdr->sh_type != SHT_NOBITS)
+ off += this_hdr->sh_size;
}
- if ((flags & SEC_LOAD) != 0)
+ if (this_hdr->sh_type != SHT_NOBITS)
{
- p->p_filesz += sec->size;
- p->p_memsz += sec->size;
+ p->p_filesz += this_hdr->sh_size;
+ /* A load section without SHF_ALLOC is something like
+ a note section in a PT_NOTE segment. These take
+ file space but are not loaded into memory. */
+ if ((this_hdr->sh_flags & SHF_ALLOC) != 0)
+ p->p_memsz += this_hdr->sh_size;
}
- /* PR ld/594: Sections in note segments which are not loaded
- contribute to the file size but not the in-memory size. */
- else if (p->p_type == PT_NOTE
- && (flags & SEC_HAS_CONTENTS) != 0)
- p->p_filesz += sec->size;
-
- /* .tbss is special. It doesn't contribute to p_memsz of
- normal segments. */
- else if ((flags & SEC_THREAD_LOCAL) == 0
- || p->p_type == PT_TLS)
- p->p_memsz += sec->size;
-
- if (p->p_type == PT_TLS
- && sec->size == 0
- && (sec->flags & SEC_HAS_CONTENTS) == 0)
+ else if ((this_hdr->sh_flags & SHF_ALLOC) != 0)
{
- struct bfd_link_order *o = sec->map_tail.link_order;
- if (o != NULL)
- p->p_memsz += o->offset + o->size;
+ if (p->p_type == PT_TLS)
+ p->p_memsz += this_hdr->sh_size;
+
+ /* .tbss is special. It doesn't contribute to p_memsz of
+ normal segments. */
+ else if ((this_hdr->sh_flags & SHF_TLS) == 0)
+ p->p_memsz += this_hdr->sh_size;
}
- if (align > p->p_align
- && (p->p_type != PT_LOAD || (abfd->flags & D_PAGED) == 0))
+ if (p->p_type == PT_GNU_RELRO)
+ p->p_align = 1;
+ else if (align > p->p_align
+ && !m->p_align_valid
+ && (p->p_type != PT_LOAD
+ || (abfd->flags & D_PAGED) == 0))
p->p_align = align;
}
- if (! m->p_flags_valid)
+ if (!m->p_flags_valid)
{
p->p_flags |= PF_R;
- if ((flags & SEC_CODE) != 0)
+ if ((this_hdr->sh_flags & SHF_EXECINSTR) != 0)
p->p_flags |= PF_X;
- if ((flags & SEC_READONLY) == 0)
+ if ((this_hdr->sh_flags & SHF_WRITE) != 0)
p->p_flags |= PF_W;
}
}
+ off -= off_adjust;
+
+ /* Check that all sections are in a PT_LOAD segment.
+ Don't check funky gdb generated core files. */
+ if (p->p_type == PT_LOAD && bfd_get_format (abfd) != bfd_core)
+ for (i = 0, secpp = m->sections; i < m->count; i++, secpp++)
+ {
+ Elf_Internal_Shdr *this_hdr;
+ asection *sec;
+
+ sec = *secpp;
+ this_hdr = &(elf_section_data(sec)->this_hdr);
+ if (this_hdr->sh_size != 0
+ && !ELF_IS_SECTION_IN_SEGMENT_FILE (this_hdr, p))
+ {
+ (*_bfd_error_handler)
+ (_("%B: section `%A' can't be allocated in segment %d"),
+ abfd, sec, j);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+ }
+ }
+
+ elf_tdata (abfd)->next_file_pos = off;
+ return TRUE;
+}
+
+/* Assign file positions for the other sections. */
+
+static bfd_boolean
+assign_file_positions_for_non_load_sections (bfd *abfd,
+ struct bfd_link_info *link_info)
+{
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ Elf_Internal_Shdr **i_shdrpp;
+ Elf_Internal_Shdr **hdrpp;
+ Elf_Internal_Phdr *phdrs;
+ Elf_Internal_Phdr *p;
+ struct elf_segment_map *m;
+ bfd_vma filehdr_vaddr, filehdr_paddr;
+ bfd_vma phdrs_vaddr, phdrs_paddr;
+ file_ptr off;
+ unsigned int num_sec;
+ unsigned int i;
+ unsigned int count;
+
+ i_shdrpp = elf_elfsections (abfd);
+ num_sec = elf_numsections (abfd);
+ off = elf_tdata (abfd)->next_file_pos;
+ for (i = 1, hdrpp = i_shdrpp + 1; i < num_sec; i++, hdrpp++)
+ {
+ struct elf_obj_tdata *tdata = elf_tdata (abfd);
+ Elf_Internal_Shdr *hdr;
+
+ hdr = *hdrpp;
+ if (hdr->bfd_section != NULL
+ && (hdr->bfd_section->filepos != 0
+ || (hdr->sh_type == SHT_NOBITS
+ && hdr->contents == NULL)))
+ BFD_ASSERT (hdr->sh_offset == hdr->bfd_section->filepos);
+ else if ((hdr->sh_flags & SHF_ALLOC) != 0)
+ {
+ if (hdr->sh_size != 0)
+ ((*_bfd_error_handler)
+ (_("%B: warning: allocated section `%s' not in segment"),
+ abfd,
+ (hdr->bfd_section == NULL
+ ? "*unknown*"
+ : hdr->bfd_section->name)));
+ /* We don't need to page align empty sections. */
+ if ((abfd->flags & D_PAGED) != 0 && hdr->sh_size != 0)
+ off += vma_page_aligned_bias (hdr->sh_addr, off,
+ bed->maxpagesize);
+ else
+ off += vma_page_aligned_bias (hdr->sh_addr, off,
+ hdr->sh_addralign);
+ off = _bfd_elf_assign_file_position_for_section (hdr, off,
+ FALSE);
+ }
+ else if (((hdr->sh_type == SHT_REL || hdr->sh_type == SHT_RELA)
+ && hdr->bfd_section == NULL)
+ || hdr == i_shdrpp[tdata->symtab_section]
+ || hdr == i_shdrpp[tdata->symtab_shndx_section]
+ || hdr == i_shdrpp[tdata->strtab_section])
+ hdr->sh_offset = -1;
+ else
+ off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE);
+
+ if (i == SHN_LORESERVE - 1)
+ {
+ i += SHN_HIRESERVE + 1 - SHN_LORESERVE;
+ hdrpp += SHN_HIRESERVE + 1 - SHN_LORESERVE;
+ }
}
/* Now that we have set the section file positions, we can set up
the file positions for the non PT_LOAD segments. */
+ count = 0;
+ filehdr_vaddr = 0;
+ filehdr_paddr = 0;
+ phdrs_vaddr = bed->maxpagesize + bed->s->sizeof_ehdr;
+ phdrs_paddr = 0;
+ phdrs = elf_tdata (abfd)->phdr;
for (m = elf_tdata (abfd)->segment_map, p = phdrs;
m != NULL;
m = m->next, p++)
{
- if (p->p_type != PT_LOAD && m->count > 0)
+ ++count;
+ if (p->p_type != PT_LOAD)
+ continue;
+
+ if (m->includes_filehdr)
{
- BFD_ASSERT (! m->includes_filehdr && ! m->includes_phdrs);
- /* If the section has not yet been assigned a file position,
- do so now. The ARM BPABI requires that .dynamic section
- not be marked SEC_ALLOC because it is not part of any
- PT_LOAD segment, so it will not be processed above. */
- if (p->p_type == PT_DYNAMIC && m->sections[0]->filepos == 0)
+ filehdr_vaddr = p->p_vaddr;
+ filehdr_paddr = p->p_paddr;
+ }
+ if (m->includes_phdrs)
+ {
+ phdrs_vaddr = p->p_vaddr;
+ phdrs_paddr = p->p_paddr;
+ if (m->includes_filehdr)
{
- unsigned int i;
- Elf_Internal_Shdr ** const i_shdrpp = elf_elfsections (abfd);
-
- i = 1;
- while (i_shdrpp[i]->bfd_section != m->sections[0])
- ++i;
- off = (_bfd_elf_assign_file_position_for_section
- (i_shdrpp[i], off, TRUE));
- p->p_filesz = m->sections[0]->size;
+ phdrs_vaddr += bed->s->sizeof_ehdr;
+ phdrs_paddr += bed->s->sizeof_ehdr;
}
- p->p_offset = m->sections[0]->filepos;
}
- if (m->count == 0)
+ }
+
+ for (m = elf_tdata (abfd)->segment_map, p = phdrs;
+ m != NULL;
+ m = m->next, p++)
+ {
+ if (m->count != 0)
+ {
+ if (p->p_type != PT_LOAD
+ && (p->p_type != PT_NOTE || bfd_get_format (abfd) != bfd_core))
+ {
+ Elf_Internal_Shdr *hdr;
+ BFD_ASSERT (!m->includes_filehdr && !m->includes_phdrs);
+
+ hdr = &elf_section_data (m->sections[m->count - 1])->this_hdr;
+ p->p_filesz = (m->sections[m->count - 1]->filepos
+ - m->sections[0]->filepos);
+ if (hdr->sh_type != SHT_NOBITS)
+ p->p_filesz += hdr->sh_size;
+
+ p->p_offset = m->sections[0]->filepos;
+ }
+ }
+ else
{
if (m->includes_filehdr)
{
@@ -4550,8 +4825,8 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info)
if (lp->p_type == PT_LOAD
&& lp->p_vaddr <= link_info->relro_end
&& lp->p_vaddr >= link_info->relro_start
- && lp->p_vaddr + lp->p_filesz
- >= link_info->relro_end)
+ && (lp->p_vaddr + lp->p_filesz
+ >= link_info->relro_end))
break;
}
@@ -4575,131 +4850,11 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info)
}
}
- /* Clear out any program headers we allocated but did not use. */
- for (; count < alloc; count++, p++)
- {
- memset (p, 0, sizeof *p);
- p->p_type = PT_NULL;
- }
-
- elf_tdata (abfd)->phdr = phdrs;
-
elf_tdata (abfd)->next_file_pos = off;
- /* Write out the program headers. */
- if (bfd_seek (abfd, (bfd_signed_vma) bed->s->sizeof_ehdr, SEEK_SET) != 0
- || bed->s->write_out_phdrs (abfd, phdrs, alloc) != 0)
- return FALSE;
-
return TRUE;
}
-/* Get the size of the program header.
-
- If this is called by the linker before any of the section VMA's are set, it
- can't calculate the correct value for a strange memory layout. This only
- happens when SIZEOF_HEADERS is used in a linker script. In this case,
- SORTED_HDRS is NULL and we assume the normal scenario of one text and one
- data segment (exclusive of .interp and .dynamic).
-
- ??? User written scripts must either not use SIZEOF_HEADERS, or assume there
- will be two segments. */
-
-static bfd_size_type
-get_program_header_size (bfd *abfd)
-{
- size_t segs;
- asection *s;
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
-
- /* We can't return a different result each time we're called. */
- if (elf_tdata (abfd)->program_header_size != 0)
- return elf_tdata (abfd)->program_header_size;
-
- if (elf_tdata (abfd)->segment_map != NULL)
- {
- struct elf_segment_map *m;
-
- segs = 0;
- for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
- ++segs;
- elf_tdata (abfd)->program_header_size = segs * bed->s->sizeof_phdr;
- return elf_tdata (abfd)->program_header_size;
- }
-
- /* Assume we will need exactly two PT_LOAD segments: one for text
- and one for data. */
- segs = 2;
-
- s = bfd_get_section_by_name (abfd, ".interp");
- if (s != NULL && (s->flags & SEC_LOAD) != 0)
- {
- /* If we have a loadable interpreter section, we need a
- PT_INTERP segment. In this case, assume we also need a
- PT_PHDR segment, although that may not be true for all
- targets. */
- segs += 2;
- }
-
- if (bfd_get_section_by_name (abfd, ".dynamic") != NULL)
- {
- /* We need a PT_DYNAMIC segment. */
- ++segs;
- }
-
- if (elf_tdata (abfd)->eh_frame_hdr)
- {
- /* We need a PT_GNU_EH_FRAME segment. */
- ++segs;
- }
-
- if (elf_tdata (abfd)->stack_flags)
- {
- /* We need a PT_GNU_STACK segment. */
- ++segs;
- }
-
- if (elf_tdata (abfd)->relro)
- {
- /* We need a PT_GNU_RELRO segment. */
- ++segs;
- }
-
- for (s = abfd->sections; s != NULL; s = s->next)
- {
- if ((s->flags & SEC_LOAD) != 0
- && strncmp (s->name, ".note", 5) == 0)
- {
- /* We need a PT_NOTE segment. */
- ++segs;
- }
- }
-
- for (s = abfd->sections; s != NULL; s = s->next)
- {
- if (s->flags & SEC_THREAD_LOCAL)
- {
- /* We need a PT_TLS segment. */
- ++segs;
- break;
- }
- }
-
- /* Let the backend count up any program headers it might need. */
- if (bed->elf_backend_additional_program_headers)
- {
- int a;
-
- a = (*bed->elf_backend_additional_program_headers) (abfd);
- if (a == -1)
- abort ();
- segs += a;
- }
-
- elf_tdata (abfd)->program_header_size = segs * bed->s->sizeof_phdr;
- return elf_tdata (abfd)->program_header_size;
-}
-
/* Work out the file positions of all the sections. This is called by
_bfd_elf_compute_section_file_positions. All the section sizes and
VMAs must be known before this is called.
@@ -4718,16 +4873,16 @@ static bfd_boolean
assign_file_positions_except_relocs (bfd *abfd,
struct bfd_link_info *link_info)
{
- struct elf_obj_tdata * const tdata = elf_tdata (abfd);
- Elf_Internal_Ehdr * const i_ehdrp = elf_elfheader (abfd);
- Elf_Internal_Shdr ** const i_shdrpp = elf_elfsections (abfd);
- unsigned int num_sec = elf_numsections (abfd);
+ struct elf_obj_tdata *tdata = elf_tdata (abfd);
+ Elf_Internal_Ehdr *i_ehdrp = elf_elfheader (abfd);
file_ptr off;
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0
&& bfd_get_format (abfd) != bfd_core)
{
+ Elf_Internal_Shdr ** const i_shdrpp = elf_elfsections (abfd);
+ unsigned int num_sec = elf_numsections (abfd);
Elf_Internal_Shdr **hdrpp;
unsigned int i;
@@ -4762,57 +4917,30 @@ assign_file_positions_except_relocs (bfd *abfd,
}
else
{
- unsigned int i;
- Elf_Internal_Shdr **hdrpp;
+ unsigned int alloc;
/* Assign file positions for the loaded sections based on the
- assignment of sections to segments. */
- if (! assign_file_positions_for_segments (abfd, link_info))
+ assignment of sections to segments. */
+ if (!assign_file_positions_for_load_sections (abfd, link_info))
return FALSE;
- /* Assign file positions for the other sections. */
+ /* And for non-load sections. */
+ if (!assign_file_positions_for_non_load_sections (abfd, link_info))
+ return FALSE;
- off = elf_tdata (abfd)->next_file_pos;
- for (i = 1, hdrpp = i_shdrpp + 1; i < num_sec; i++, hdrpp++)
+ if (bed->elf_backend_modify_program_headers != NULL)
{
- Elf_Internal_Shdr *hdr;
+ if (!(*bed->elf_backend_modify_program_headers) (abfd, link_info))
+ return FALSE;
+ }
- hdr = *hdrpp;
- if (hdr->bfd_section != NULL
- && hdr->bfd_section->filepos != 0)
- hdr->sh_offset = hdr->bfd_section->filepos;
- else if ((hdr->sh_flags & SHF_ALLOC) != 0)
- {
- ((*_bfd_error_handler)
- (_("%B: warning: allocated section `%s' not in segment"),
- abfd,
- (hdr->bfd_section == NULL
- ? "*unknown*"
- : hdr->bfd_section->name)));
- if ((abfd->flags & D_PAGED) != 0)
- off += vma_page_aligned_bias (hdr->sh_addr, off,
- bed->maxpagesize);
- else
- off += vma_page_aligned_bias (hdr->sh_addr, off,
- hdr->sh_addralign);
- off = _bfd_elf_assign_file_position_for_section (hdr, off,
- FALSE);
- }
- else if (((hdr->sh_type == SHT_REL || hdr->sh_type == SHT_RELA)
- && hdr->bfd_section == NULL)
- || hdr == i_shdrpp[tdata->symtab_section]
- || hdr == i_shdrpp[tdata->symtab_shndx_section]
- || hdr == i_shdrpp[tdata->strtab_section])
- hdr->sh_offset = -1;
- else
- off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE);
+ /* Write out the program headers. */
+ alloc = tdata->program_header_size / bed->s->sizeof_phdr;
+ if (bfd_seek (abfd, (bfd_signed_vma) bed->s->sizeof_ehdr, SEEK_SET) != 0
+ || bed->s->write_out_phdrs (abfd, tdata->phdr, alloc) != 0)
+ return FALSE;
- if (i == SHN_LORESERVE - 1)
- {
- i += SHN_HIRESERVE + 1 - SHN_LORESERVE;
- hdrpp += SHN_HIRESERVE + 1 - SHN_LORESERVE;
- }
- }
+ off = tdata->next_file_pos;
}
/* Place the section headers. */
@@ -4820,7 +4948,7 @@ assign_file_positions_except_relocs (bfd *abfd,
i_ehdrp->e_shoff = off;
off += i_ehdrp->e_shnum * i_ehdrp->e_shentsize;
- elf_tdata (abfd)->next_file_pos = off;
+ tdata->next_file_pos = off;
return TRUE;
}
@@ -4987,7 +5115,7 @@ _bfd_elf_write_object_contents (bfd *abfd)
/* Write out the section header names. */
if (elf_shstrtab (abfd) != NULL
&& (bfd_seek (abfd, elf_tdata (abfd)->shstrtab_hdr.sh_offset, SEEK_SET) != 0
- || ! _bfd_elf_strtab_emit (abfd, elf_shstrtab (abfd))))
+ || !_bfd_elf_strtab_emit (abfd, elf_shstrtab (abfd))))
return FALSE;
if (bed->elf_backend_final_write_processing)
@@ -5059,13 +5187,14 @@ _bfd_elf_symbol_from_bfd_symbol (bfd *abfd, asymbol **asym_ptr_ptr)
&& (flags & BSF_SECTION_SYM)
&& asym_ptr->section)
{
+ asection *sec;
int indx;
- if (asym_ptr->section->output_section != NULL)
- indx = asym_ptr->section->output_section->index;
- else
- indx = asym_ptr->section->index;
- if (indx < elf_num_section_syms (abfd)
+ sec = asym_ptr->section;
+ if (sec->owner != abfd && sec->output_section != NULL)
+ sec = sec->output_section;
+ if (sec->owner == abfd
+ && (indx = sec->index) < elf_num_section_syms (abfd)
&& elf_section_syms (abfd)[indx] != NULL)
asym_ptr->udata.i = elf_section_syms (abfd)[indx]->udata.i;
}
@@ -5075,7 +5204,7 @@ _bfd_elf_symbol_from_bfd_symbol (bfd *abfd, asymbol **asym_ptr_ptr)
if (idx == 0)
{
/* This case can occur when using --strip-symbol on a symbol
- which is used in a relocation entry. */
+ which is used in a relocation entry. */
(*_bfd_error_handler)
(_("%B: symbol `%s' required but not present"),
abfd, bfd_asymbol_name (asym_ptr));
@@ -5154,7 +5283,7 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
&& bfd_get_format (ibfd) == bfd_core \
&& s->vma == 0 && s->lma == 0 \
&& (bfd_vma) s->filepos >= p->p_offset \
- && ((bfd_vma) s->filepos + s->size \
+ && ((bfd_vma) s->filepos + s->size \
<= p->p_offset + p->p_filesz))
/* The complicated case when p_vaddr is 0 is to handle the Solaris
@@ -5168,13 +5297,13 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
&& (s->flags & SEC_HAS_CONTENTS) != 0 \
&& s->size > 0 \
&& (bfd_vma) s->filepos >= p->p_offset \
- && ((bfd_vma) s->filepos + s->size \
+ && ((bfd_vma) s->filepos + s->size \
<= p->p_offset + p->p_filesz))
/* Decide if the given section should be included in the given segment.
A section will be included if:
1. It is within the address space of the segment -- we use the LMA
- if that is set for the segment and the VMA otherwise,
+ if that is set for the segment and the VMA otherwise,
2. It is an allocated segment,
3. There is an output section associated with it,
4. The section has not already been allocated to a previous segment.
@@ -5182,14 +5311,13 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
6. PT_TLS segment includes only SHF_TLS sections.
7. SHF_TLS sections are only in PT_TLS or PT_LOAD segments.
8. PT_DYNAMIC should not contain empty sections at the beginning
- (with the possible exception of .dynamic). */
-#define INCLUDE_SECTION_IN_SEGMENT(section, segment, bed) \
+ (with the possible exception of .dynamic). */
+#define IS_SECTION_IN_INPUT_SEGMENT(section, segment, bed) \
((((segment->p_paddr \
? IS_CONTAINED_BY_LMA (section, segment, segment->p_paddr) \
: IS_CONTAINED_BY_VMA (section, segment)) \
&& (section->flags & SEC_ALLOC) != 0) \
|| IS_COREFILE_NOTE (segment, section)) \
- && section->output_section != NULL \
&& segment->p_type != PT_GNU_STACK \
&& (segment->p_type != PT_TLS \
|| (section->flags & SEC_THREAD_LOCAL)) \
@@ -5199,12 +5327,18 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
&& (segment->p_type != PT_DYNAMIC \
|| SECTION_SIZE (section, segment) > 0 \
|| (segment->p_paddr \
- ? segment->p_paddr != section->lma \
- : segment->p_vaddr != section->vma) \
+ ? segment->p_paddr != section->lma \
+ : segment->p_vaddr != section->vma) \
|| (strcmp (bfd_get_section_name (ibfd, section), ".dynamic") \
- == 0)) \
+ == 0)) \
&& ! section->segment_mark)
+/* If the output section of a section in the input segment is NULL,
+ it is removed from the corresponding output segment. */
+#define INCLUDE_SECTION_IN_SEGMENT(section, segment, bed) \
+ (IS_SECTION_IN_INPUT_SEGMENT (section, segment, bed) \
+ && section->output_section != NULL)
+
/* Returns TRUE iff seg1 starts after the end of seg2. */
#define SEGMENT_AFTER_SEGMENT(seg1, seg2, field) \
(seg1->field >= SEGMENT_END (seg2, seg2->field))
@@ -5217,9 +5351,9 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
LMA. */
#define SEGMENT_OVERLAPS(seg1, seg2) \
( !(SEGMENT_AFTER_SEGMENT (seg1, seg2, p_vaddr) \
- || SEGMENT_AFTER_SEGMENT (seg2, seg1, p_vaddr)) \
+ || SEGMENT_AFTER_SEGMENT (seg2, seg1, p_vaddr)) \
&& !(SEGMENT_AFTER_SEGMENT (seg1, seg2, p_paddr) \
- || SEGMENT_AFTER_SEGMENT (seg2, seg1, p_paddr)))
+ || SEGMENT_AFTER_SEGMENT (seg2, seg1, p_paddr)))
/* Initialise the segment mark field. */
for (section = ibfd->sections; section != NULL; section = section->next)
@@ -5262,7 +5396,7 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
if (segment2->p_vaddr < segment->p_vaddr)
{
/* Extend SEGMENT2 to include SEGMENT and then delete
- SEGMENT. */
+ SEGMENT. */
extra_length =
SEGMENT_END (segment, segment->p_vaddr)
- SEGMENT_END (segment2, segment2->p_vaddr);
@@ -5283,7 +5417,7 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
else
{
/* Extend SEGMENT to include SEGMENT2 and then delete
- SEGMENT2. */
+ SEGMENT2. */
extra_length =
SEGMENT_END (segment2, segment2->p_vaddr)
- SEGMENT_END (segment, segment->p_vaddr);
@@ -5312,22 +5446,33 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
bfd_vma suggested_lma;
unsigned int j;
bfd_size_type amt;
+ asection * first_section;
if (segment->p_type == PT_NULL)
continue;
+ first_section = NULL;
/* Compute how many sections might be placed into this segment. */
for (section = ibfd->sections, section_count = 0;
section != NULL;
section = section->next)
- if (INCLUDE_SECTION_IN_SEGMENT (section, segment, bed))
- ++section_count;
+ {
+ /* Find the first section in the input segment, which may be
+ removed from the corresponding output segment. */
+ if (IS_SECTION_IN_INPUT_SEGMENT (section, segment, bed))
+ {
+ if (first_section == NULL)
+ first_section = section;
+ if (section->output_section != NULL)
+ ++section_count;
+ }
+ }
/* Allocate a segment map big enough to contain
all of the sections we have selected. */
amt = sizeof (struct elf_segment_map);
amt += ((bfd_size_type) section_count - 1) * sizeof (asection *);
- map = bfd_alloc (obfd, amt);
+ map = bfd_zalloc (obfd, amt);
if (map == NULL)
return FALSE;
@@ -5337,8 +5482,15 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
map->p_type = segment->p_type;
map->p_flags = segment->p_flags;
map->p_flags_valid = 1;
- map->p_paddr = segment->p_paddr;
- map->p_paddr_valid = 1;
+
+ /* If the first section in the input segment is removed, there is
+ no need to preserve segment physical address in the corresponding
+ output segment. */
+ if (!first_section || first_section->output_section != NULL)
+ {
+ map->p_paddr = segment->p_paddr;
+ map->p_paddr_valid = 1;
+ }
/* Determine if this segment contains the ELF file header
and if it contains the program headers themselves. */
@@ -5455,8 +5607,7 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
if (IS_CONTAINED_BY_LMA (output_section, segment, map->p_paddr)
|| IS_COREFILE_NOTE (segment, section)
|| (bed->want_p_paddr_set_to_zero &&
- IS_CONTAINED_BY_VMA (output_section, segment))
- )
+ IS_CONTAINED_BY_VMA (output_section, segment)))
{
if (matching_lma == 0)
matching_lma = output_section->lma;
@@ -5485,6 +5636,13 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
*pointer_to_map = map;
pointer_to_map = &map->next;
+ if (matching_lma != map->p_paddr
+ && !map->includes_filehdr && !map->includes_phdrs)
+ /* There is some padding before the first section in the
+ segment. So, we must account for that in the output
+ segment's vma. */
+ map->p_vaddr_offset = matching_lma - map->p_paddr;
+
free (sections);
continue;
}
@@ -5668,6 +5826,7 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
#undef IS_CONTAINED_BY_LMA
#undef IS_COREFILE_NOTE
#undef IS_SOLARIS_PT_INTERP
+#undef IS_SECTION_IN_INPUT_SEGMENT
#undef INCLUDE_SECTION_IN_SEGMENT
#undef SEGMENT_AFTER_SEGMENT
#undef SEGMENT_OVERLAPS
@@ -5702,6 +5861,7 @@ copy_elf_program_header (bfd *ibfd, bfd *obfd)
unsigned int section_count;
bfd_size_type amt;
Elf_Internal_Shdr *this_hdr;
+ asection *first_section = NULL;
/* FIXME: Do we need to copy PT_NULL segment? */
if (segment->p_type == PT_NULL)
@@ -5714,7 +5874,11 @@ copy_elf_program_header (bfd *ibfd, bfd *obfd)
{
this_hdr = &(elf_section_data(section)->this_hdr);
if (ELF_IS_SECTION_IN_SEGMENT_FILE (this_hdr, segment))
- section_count++;
+ {
+ if (!first_section)
+ first_section = section;
+ section_count++;
+ }
}
/* Allocate a segment map big enough to contain
@@ -5722,7 +5886,7 @@ copy_elf_program_header (bfd *ibfd, bfd *obfd)
amt = sizeof (struct elf_segment_map);
if (section_count != 0)
amt += ((bfd_size_type) section_count - 1) * sizeof (asection *);
- map = bfd_alloc (obfd, amt);
+ map = bfd_zalloc (obfd, amt);
if (map == NULL)
return FALSE;
@@ -5734,6 +5898,9 @@ copy_elf_program_header (bfd *ibfd, bfd *obfd)
map->p_flags_valid = 1;
map->p_paddr = segment->p_paddr;
map->p_paddr_valid = 1;
+ map->p_align = segment->p_align;
+ map->p_align_valid = 1;
+ map->p_vaddr_offset = 0;
/* Determine if this segment contains the ELF file header
and if it contains the program headers themselves. */
@@ -5753,17 +5920,26 @@ copy_elf_program_header (bfd *ibfd, bfd *obfd)
phdr_included = TRUE;
}
+ if (!map->includes_phdrs && !map->includes_filehdr)
+ /* There is some other padding before the first section. */
+ map->p_vaddr_offset = ((first_section ? first_section->lma : 0)
+ - segment->p_paddr);
+
if (section_count != 0)
{
unsigned int isec = 0;
- for (section = ibfd->sections;
+ for (section = first_section;
section != NULL;
section = section->next)
{
this_hdr = &(elf_section_data(section)->this_hdr);
if (ELF_IS_SECTION_IN_SEGMENT_FILE (this_hdr, segment))
- map->sections[isec++] = section->output_section;
+ {
+ map->sections[isec++] = section->output_section;
+ if (isec == section_count)
+ break;
+ }
}
}
@@ -5791,8 +5967,8 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd)
if (ibfd->xvec == obfd->xvec)
{
- /* Check if any sections in the input BFD covered by ELF program
- header are changed. */
+ /* Check to see if any sections in the input BFD
+ covered by ELF program header have changed. */
Elf_Internal_Phdr *segment;
asection *section, *osec;
unsigned int i, num_segments;
@@ -5808,6 +5984,15 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd)
i < num_segments;
i++, segment++)
{
+ /* PR binutils/3535. The Solaris linker always sets the p_paddr
+ and p_memsz fields of special segments (DYNAMIC, INTERP) to 0
+ which severly confuses things, so always regenerate the segment
+ map in this case. */
+ if (segment->p_paddr == 0
+ && segment->p_memsz == 0
+ && (segment->p_type == PT_INTERP || segment->p_type == PT_DYNAMIC))
+ goto rewrite;
+
for (section = ibfd->sections;
section != NULL; section = section->next)
{
@@ -5835,7 +6020,7 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd)
}
}
- /* Check to see if any output section doesn't come from the
+ /* Check to see if any output section do not come from the
input BFD. */
for (section = obfd->sections; section != NULL;
section = section->next)
@@ -5870,16 +6055,22 @@ _bfd_elf_init_private_section_data (bfd *ibfd,
|| obfd->xvec->flavour != bfd_target_elf_flavour)
return TRUE;
- /* FIXME: What if the output ELF section type has been set to
- something different? */
- if (elf_section_type (osec) == SHT_NULL)
+ /* Don't copy the output ELF section type from input if the
+ output BFD section flags have been set to something different.
+ elf_fake_sections will set ELF section type based on BFD
+ section flags. */
+ if (elf_section_type (osec) == SHT_NULL
+ && (osec->flags == isec->flags || !osec->flags))
elf_section_type (osec) = elf_section_type (isec);
+ /* FIXME: Is this correct for all OS/PROC specific flags? */
+ elf_section_flags (osec) |= (elf_section_flags (isec)
+ & (SHF_MASKOS | SHF_MASKPROC));
+
/* Set things up for objcopy and relocatable link. The output
SHT_GROUP section will have its elf_next_in_group pointing back
to the input group members. Ignore linker created group section.
See elfNN_ia64_object_p in elfxx-ia64.c. */
-
if (need_group)
{
if (elf_sec_group (isec) == NULL
@@ -5944,6 +6135,8 @@ _bfd_elf_copy_private_section_data (bfd *ibfd,
bfd_boolean
_bfd_elf_copy_private_header_data (bfd *ibfd, bfd *obfd)
{
+ asection *isec;
+
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
return TRUE;
@@ -5959,6 +6152,27 @@ _bfd_elf_copy_private_header_data (bfd *ibfd, bfd *obfd)
return FALSE;
}
+ /* _bfd_elf_copy_private_section_data copied over the SHF_GROUP flag
+ but this might be wrong if we deleted the group section. */
+ for (isec = ibfd->sections; isec != NULL; isec = isec->next)
+ if (elf_section_type (isec) == SHT_GROUP
+ && isec->output_section == NULL)
+ {
+ asection *first = elf_next_in_group (isec);
+ asection *s = first;
+ while (s != NULL)
+ {
+ if (s->output_section != NULL)
+ {
+ elf_section_flags (s->output_section) &= ~SHF_GROUP;
+ elf_group_name (s->output_section) = NULL;
+ }
+ s = elf_next_in_group (s);
+ if (s == first)
+ break;
+ }
+ }
+
return TRUE;
}
@@ -6231,6 +6445,10 @@ Unable to find equivalent output section for symbol '%s' from section '%s'"),
type = STT_FUNC;
else if ((flags & BSF_OBJECT) != 0)
type = STT_OBJECT;
+ else if ((flags & BSF_RELC) != 0)
+ type = STT_RELC;
+ else if ((flags & BSF_SRELC) != 0)
+ type = STT_SRELC;
else
type = STT_NOTYPE;
@@ -7029,13 +7247,31 @@ _bfd_elf_find_inliner_info (bfd *abfd,
}
int
-_bfd_elf_sizeof_headers (bfd *abfd, bfd_boolean reloc)
+_bfd_elf_sizeof_headers (bfd *abfd, struct bfd_link_info *info)
{
- int ret;
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ int ret = bed->s->sizeof_ehdr;
+
+ if (!info->relocatable)
+ {
+ bfd_size_type phdr_size = elf_tdata (abfd)->program_header_size;
+
+ if (phdr_size == (bfd_size_type) -1)
+ {
+ struct elf_segment_map *m;
+
+ phdr_size = 0;
+ for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
+ phdr_size += bed->s->sizeof_phdr;
+
+ if (phdr_size == 0)
+ phdr_size = get_program_header_size (abfd, info);
+ }
+
+ elf_tdata (abfd)->program_header_size = phdr_size;
+ ret += phdr_size;
+ }
- ret = get_elf_backend_data (abfd)->s->sizeof_ehdr;
- if (! reloc)
- ret += get_program_header_size (abfd);
return ret;
}
@@ -7171,7 +7407,7 @@ _bfd_elf_close_and_cleanup (bfd *abfd)
{
if (bfd_get_format (abfd) == bfd_object)
{
- if (elf_shstrtab (abfd) != NULL)
+ if (elf_tdata (abfd) != NULL && elf_shstrtab (abfd) != NULL)
_bfd_elf_strtab_free (elf_shstrtab (abfd));
_bfd_dwarf2_cleanup_debug_info (abfd);
}
@@ -7225,13 +7461,12 @@ elfcore_maybe_make_sect (bfd *abfd, char *name, asection *sect)
if (bfd_get_section_by_name (abfd, name) != NULL)
return TRUE;
- sect2 = bfd_make_section (abfd, name);
+ sect2 = bfd_make_section_with_flags (abfd, name, sect->flags);
if (sect2 == NULL)
return FALSE;
sect2->size = sect->size;
sect2->filepos = sect->filepos;
- sect2->flags = sect->flags;
sect2->alignment_power = sect->alignment_power;
return TRUE;
}
@@ -7263,12 +7498,12 @@ _bfd_elfcore_make_pseudosection (bfd *abfd,
return FALSE;
memcpy (threaded_name, buf, len);
- sect = bfd_make_section_anyway (abfd, threaded_name);
+ sect = bfd_make_section_anyway_with_flags (abfd, threaded_name,
+ SEC_HAS_CONTENTS);
if (sect == NULL)
return FALSE;
sect->size = size;
sect->filepos = filepos;
- sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 2;
return elfcore_maybe_make_sect (abfd, name, sect);
@@ -7547,7 +7782,7 @@ elfcore_grok_lwpstatus (bfd *abfd, Elf_Internal_Note *note)
return FALSE;
memcpy (name, buf, len);
- sect = bfd_make_section_anyway (abfd, name);
+ sect = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS);
if (sect == NULL)
return FALSE;
@@ -7562,7 +7797,6 @@ elfcore_grok_lwpstatus (bfd *abfd, Elf_Internal_Note *note)
sect->filepos = note->descpos + offsetof (lwpstatus_t, pr_reg);
#endif
- sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 2;
if (!elfcore_maybe_make_sect (abfd, ".reg", sect))
@@ -7577,7 +7811,7 @@ elfcore_grok_lwpstatus (bfd *abfd, Elf_Internal_Note *note)
return FALSE;
memcpy (name, buf, len);
- sect = bfd_make_section_anyway (abfd, name);
+ sect = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS);
if (sect == NULL)
return FALSE;
@@ -7592,7 +7826,6 @@ elfcore_grok_lwpstatus (bfd *abfd, Elf_Internal_Note *note)
sect->filepos = note->descpos + offsetof (lwpstatus_t, pr_fpreg);
#endif
- sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 2;
return elfcore_maybe_make_sect (abfd, ".reg2", sect);
@@ -7633,7 +7866,7 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note)
memcpy (name, buf, len);
- sect = bfd_make_section_anyway (abfd, name);
+ sect = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS);
if (sect == NULL)
return FALSE;
@@ -7641,7 +7874,6 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note)
sect->filepos = (note->descpos
+ offsetof (struct win32_pstatus,
data.thread_info.thread_context));
- sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 2;
if (pstatus.data.thread_info.is_active_thread)
@@ -7661,14 +7893,13 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note)
memcpy (name, buf, len);
- sect = bfd_make_section_anyway (abfd, name);
+ sect = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS);
if (sect == NULL)
return FALSE;
sect->size = note->descsz;
sect->filepos = note->descpos;
- sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 2;
break;
@@ -7738,13 +7969,13 @@ elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note)
case NT_AUXV:
{
- asection *sect = bfd_make_section_anyway (abfd, ".auxv");
+ asection *sect = bfd_make_section_anyway_with_flags (abfd, ".auxv",
+ SEC_HAS_CONTENTS);
if (sect == NULL)
return FALSE;
sect->size = note->descsz;
sect->filepos = note->descpos;
- sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 1 + bfd_get_arch_size (abfd) / 32;
return TRUE;
@@ -7769,7 +8000,6 @@ elfcore_netbsd_get_lwpid (Elf_Internal_Note *note, int *lwpidp)
static bfd_boolean
elfcore_grok_netbsd_procinfo (bfd *abfd, Elf_Internal_Note *note)
{
-
/* Signal number at offset 0x08. */
elf_tdata (abfd)->core_signal
= bfd_h_get_32 (abfd, (bfd_byte *) note->descdata + 0x08);
@@ -7797,9 +8027,9 @@ elfcore_grok_netbsd_note (bfd *abfd, Elf_Internal_Note *note)
if (note->type == NT_NETBSDCORE_PROCINFO)
{
/* NetBSD-specific core "procinfo". Note that we expect to
- find this note before any of the others, which is fine,
- since the kernel writes this note out first when it
- creates a core file. */
+ find this note before any of the others, which is fine,
+ since the kernel writes this note out first when it
+ creates a core file. */
return elfcore_grok_netbsd_procinfo (abfd, note);
}
@@ -7815,44 +8045,44 @@ elfcore_grok_netbsd_note (bfd *abfd, Elf_Internal_Note *note)
switch (bfd_get_arch (abfd))
{
- /* On the Alpha, SPARC (32-bit and 64-bit), PT_GETREGS == mach+0 and
- PT_GETFPREGS == mach+2. */
+ /* On the Alpha, SPARC (32-bit and 64-bit), PT_GETREGS == mach+0 and
+ PT_GETFPREGS == mach+2. */
case bfd_arch_alpha:
case bfd_arch_sparc:
switch (note->type)
- {
- case NT_NETBSDCORE_FIRSTMACH+0:
- return elfcore_make_note_pseudosection (abfd, ".reg", note);
+ {
+ case NT_NETBSDCORE_FIRSTMACH+0:
+ return elfcore_make_note_pseudosection (abfd, ".reg", note);
- case NT_NETBSDCORE_FIRSTMACH+2:
- return elfcore_make_note_pseudosection (abfd, ".reg2", note);
+ case NT_NETBSDCORE_FIRSTMACH+2:
+ return elfcore_make_note_pseudosection (abfd, ".reg2", note);
- default:
- return TRUE;
- }
+ default:
+ return TRUE;
+ }
- /* On all other arch's, PT_GETREGS == mach+1 and
- PT_GETFPREGS == mach+3. */
+ /* On all other arch's, PT_GETREGS == mach+1 and
+ PT_GETFPREGS == mach+3. */
default:
switch (note->type)
- {
- case NT_NETBSDCORE_FIRSTMACH+1:
- return elfcore_make_note_pseudosection (abfd, ".reg", note);
+ {
+ case NT_NETBSDCORE_FIRSTMACH+1:
+ return elfcore_make_note_pseudosection (abfd, ".reg", note);
- case NT_NETBSDCORE_FIRSTMACH+3:
- return elfcore_make_note_pseudosection (abfd, ".reg2", note);
+ case NT_NETBSDCORE_FIRSTMACH+3:
+ return elfcore_make_note_pseudosection (abfd, ".reg2", note);
- default:
- return TRUE;
- }
+ default:
+ return TRUE;
+ }
}
/* NOTREACHED */
}
static bfd_boolean
-elfcore_grok_nto_status (bfd *abfd, Elf_Internal_Note *note, pid_t *tid)
+elfcore_grok_nto_status (bfd *abfd, Elf_Internal_Note *note, long *tid)
{
void *ddata = note->descdata;
char buf[100];
@@ -7884,20 +8114,19 @@ elfcore_grok_nto_status (bfd *abfd, Elf_Internal_Note *note, pid_t *tid)
elf_tdata (abfd)->core_lwpid = *tid;
/* Make a ".qnx_core_status/%d" section. */
- sprintf (buf, ".qnx_core_status/%ld", (long) *tid);
+ sprintf (buf, ".qnx_core_status/%ld", *tid);
name = bfd_alloc (abfd, strlen (buf) + 1);
if (name == NULL)
return FALSE;
strcpy (name, buf);
- sect = bfd_make_section_anyway (abfd, name);
+ sect = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS);
if (sect == NULL)
return FALSE;
sect->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));
@@ -7906,7 +8135,7 @@ elfcore_grok_nto_status (bfd *abfd, Elf_Internal_Note *note, pid_t *tid)
static bfd_boolean
elfcore_grok_nto_regs (bfd *abfd,
Elf_Internal_Note *note,
- pid_t tid,
+ long tid,
char *base)
{
char buf[100];
@@ -7914,20 +8143,19 @@ elfcore_grok_nto_regs (bfd *abfd,
asection *sect;
/* Make a "(base)/%d" section. */
- sprintf (buf, "%s/%ld", base, (long) tid);
+ sprintf (buf, "%s/%ld", base, tid);
name = bfd_alloc (abfd, strlen (buf) + 1);
if (name == NULL)
return FALSE;
strcpy (name, buf);
- sect = bfd_make_section_anyway (abfd, name);
+ sect = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS);
if (sect == NULL)
return FALSE;
sect->size = note->descsz;
sect->filepos = note->descpos;
- sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 2;
/* This is the current thread. */
@@ -7948,7 +8176,7 @@ elfcore_grok_nto_note (bfd *abfd, Elf_Internal_Note *note)
/* Every GREG section has a STATUS section before it. Store the
tid from the previous call to pass down to the next gregs
function. */
- static pid_t tid = 1;
+ static long tid = 1;
switch (note->type)
{
@@ -7968,45 +8196,42 @@ elfcore_grok_nto_note (bfd *abfd, Elf_Internal_Note *note)
/* Function: elfcore_write_note
Inputs:
- buffer to hold note
+ buffer to hold note, and current size of buffer
name of note
type of note
data for note
size of data for note
+ Writes note to end of buffer. ELF64 notes are written exactly as
+ for ELF32, despite the current (as of 2006) ELF gabi specifying
+ that they ought to have 8-byte namesz and descsz field, and have
+ 8-byte alignment. Other writers, eg. Linux kernel, do the same.
+
Return:
- End of buffer containing note. */
+ Pointer to realloc'd buffer, *BUFSIZ updated. */
char *
-elfcore_write_note (bfd *abfd,
+elfcore_write_note (bfd *abfd,
char *buf,
- int *bufsiz,
+ int *bufsiz,
const char *name,
- int type,
+ int type,
const void *input,
- int size)
+ int size)
{
Elf_External_Note *xnp;
size_t namesz;
- size_t pad;
size_t newspace;
- char *p, *dest;
+ char *dest;
namesz = 0;
- pad = 0;
if (name != NULL)
- {
- const struct elf_backend_data *bed;
-
- namesz = strlen (name) + 1;
- bed = get_elf_backend_data (abfd);
- pad = -namesz & ((1 << bed->s->log_file_align) - 1);
- }
+ namesz = strlen (name) + 1;
- newspace = 12 + namesz + pad + size;
+ newspace = 12 + ((namesz + 3) & -4) + ((size + 3) & -4);
- p = realloc (buf, *bufsiz + newspace);
- dest = p + *bufsiz;
+ buf = realloc (buf, *bufsiz + newspace);
+ dest = buf + *bufsiz;
*bufsiz += newspace;
xnp = (Elf_External_Note *) dest;
H_PUT_32 (abfd, namesz, xnp->namesz);
@@ -8017,14 +8242,20 @@ elfcore_write_note (bfd *abfd,
{
memcpy (dest, name, namesz);
dest += namesz;
- while (pad != 0)
+ while (namesz & 3)
{
*dest++ = '\0';
- --pad;
+ ++namesz;
}
}
memcpy (dest, input, size);
- return p;
+ dest += size;
+ while (size & 3)
+ {
+ *dest++ = '\0';
+ ++size;
+ }
+ return buf;
}
#if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T)
@@ -8035,22 +8266,52 @@ elfcore_write_prpsinfo (bfd *abfd,
const char *fname,
const char *psargs)
{
- int note_type;
- char *note_name = "CORE";
+ const char *note_name = "CORE";
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+
+ if (bed->elf_backend_write_core_note != NULL)
+ {
+ char *ret;
+ ret = (*bed->elf_backend_write_core_note) (abfd, buf, bufsiz,
+ NT_PRPSINFO, fname, psargs);
+ if (ret != NULL)
+ return ret;
+ }
+
+#if defined (HAVE_PRPSINFO32_T) || defined (HAVE_PSINFO32_T)
+ if (bed->s->elfclass == ELFCLASS32)
+ {
+#if defined (HAVE_PSINFO32_T)
+ psinfo32_t data;
+ int note_type = NT_PSINFO;
+#else
+ prpsinfo32_t data;
+ int note_type = NT_PRPSINFO;
+#endif
+ memset (&data, 0, sizeof (data));
+ strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
+ strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
+ return elfcore_write_note (abfd, buf, bufsiz,
+ note_name, note_type, &data, sizeof (data));
+ }
+ else
+#endif
+ {
#if defined (HAVE_PSINFO_T)
- psinfo_t data;
- note_type = NT_PSINFO;
+ psinfo_t data;
+ int note_type = NT_PSINFO;
#else
- prpsinfo_t data;
- note_type = NT_PRPSINFO;
+ prpsinfo_t data;
+ int note_type = NT_PRPSINFO;
#endif
- memset (&data, 0, sizeof (data));
- strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
- strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
- return elfcore_write_note (abfd, buf, bufsiz,
- note_name, note_type, &data, sizeof (data));
+ memset (&data, 0, sizeof (data));
+ strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
+ strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
+ return elfcore_write_note (abfd, buf, bufsiz,
+ note_name, note_type, &data, sizeof (data));
+ }
}
#endif /* PSINFO_T or PRPSINFO_T */
@@ -8063,15 +8324,43 @@ elfcore_write_prstatus (bfd *abfd,
int cursig,
const void *gregs)
{
- prstatus_t prstat;
- char *note_name = "CORE";
+ const char *note_name = "CORE";
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- memset (&prstat, 0, sizeof (prstat));
- prstat.pr_pid = pid;
- prstat.pr_cursig = cursig;
- memcpy (&prstat.pr_reg, gregs, sizeof (prstat.pr_reg));
- return elfcore_write_note (abfd, buf, bufsiz,
- note_name, NT_PRSTATUS, &prstat, sizeof (prstat));
+ if (bed->elf_backend_write_core_note != NULL)
+ {
+ char *ret;
+ ret = (*bed->elf_backend_write_core_note) (abfd, buf, bufsiz,
+ NT_PRSTATUS,
+ pid, cursig, gregs);
+ if (ret != NULL)
+ return ret;
+ }
+
+#if defined (HAVE_PRSTATUS32_T)
+ if (bed->s->elfclass == ELFCLASS32)
+ {
+ prstatus32_t prstat;
+
+ memset (&prstat, 0, sizeof (prstat));
+ prstat.pr_pid = pid;
+ prstat.pr_cursig = cursig;
+ memcpy (&prstat.pr_reg, gregs, sizeof (prstat.pr_reg));
+ return elfcore_write_note (abfd, buf, bufsiz, note_name,
+ NT_PRSTATUS, &prstat, sizeof (prstat));
+ }
+ else
+#endif
+ {
+ prstatus_t prstat;
+
+ memset (&prstat, 0, sizeof (prstat));
+ prstat.pr_pid = pid;
+ prstat.pr_cursig = cursig;
+ memcpy (&prstat.pr_reg, gregs, sizeof (prstat.pr_reg));
+ return elfcore_write_note (abfd, buf, bufsiz, note_name,
+ NT_PRSTATUS, &prstat, sizeof (prstat));
+ }
}
#endif /* HAVE_PRSTATUS_T */
@@ -8085,7 +8374,7 @@ elfcore_write_lwpstatus (bfd *abfd,
const void *gregs)
{
lwpstatus_t lwpstat;
- char *note_name = "CORE";
+ const char *note_name = "CORE";
memset (&lwpstat, 0, sizeof (lwpstat));
lwpstat.pr_lwpid = pid >> 16;
@@ -8115,14 +8404,31 @@ elfcore_write_pstatus (bfd *abfd,
int cursig ATTRIBUTE_UNUSED,
const void *gregs ATTRIBUTE_UNUSED)
{
- pstatus_t pstat;
- char *note_name = "CORE";
+ const char *note_name = "CORE";
+#if defined (HAVE_PSTATUS32_T)
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- memset (&pstat, 0, sizeof (pstat));
- pstat.pr_pid = pid & 0xffff;
- buf = elfcore_write_note (abfd, buf, bufsiz, note_name,
- NT_PSTATUS, &pstat, sizeof (pstat));
- return buf;
+ if (bed->s->elfclass == ELFCLASS32)
+ {
+ pstatus32_t pstat;
+
+ memset (&pstat, 0, sizeof (pstat));
+ pstat.pr_pid = pid & 0xffff;
+ buf = elfcore_write_note (abfd, buf, bufsiz, note_name,
+ NT_PSTATUS, &pstat, sizeof (pstat));
+ return buf;
+ }
+ else
+#endif
+ {
+ pstatus_t pstat;
+
+ memset (&pstat, 0, sizeof (pstat));
+ pstat.pr_pid = pid & 0xffff;
+ buf = elfcore_write_note (abfd, buf, bufsiz, note_name,
+ NT_PSTATUS, &pstat, sizeof (pstat));
+ return buf;
+ }
}
#endif /* HAVE_PSTATUS_T */
@@ -8133,7 +8439,7 @@ elfcore_write_prfpreg (bfd *abfd,
const void *fpregs,
int size)
{
- char *note_name = "CORE";
+ const char *note_name = "CORE";
return elfcore_write_note (abfd, buf, bufsiz,
note_name, NT_FPREGSET, fpregs, size);
}
@@ -8189,21 +8495,21 @@ elfcore_read_notes (bfd *abfd, file_ptr offset, bfd_size_type size)
in.descdata = in.namedata + BFD_ALIGN (in.namesz, 4);
in.descpos = offset + (in.descdata - buf);
- if (strncmp (in.namedata, "NetBSD-CORE", 11) == 0)
- {
- if (! elfcore_grok_netbsd_note (abfd, &in))
- goto error;
- }
- else if (strncmp (in.namedata, "QNX", 3) == 0)
+ if (CONST_STRNEQ (in.namedata, "NetBSD-CORE"))
+ {
+ if (! elfcore_grok_netbsd_note (abfd, &in))
+ goto error;
+ }
+ else if (CONST_STRNEQ (in.namedata, "QNX"))
{
if (! elfcore_grok_nto_note (abfd, &in))
goto error;
}
else
- {
- if (! elfcore_grok_note (abfd, &in))
- goto error;
- }
+ {
+ if (! elfcore_grok_note (abfd, &in))
+ goto error;
+ }
p = in.descdata + BFD_ALIGN (in.descsz, 4);
}
@@ -8509,39 +8815,41 @@ _bfd_elf_get_synthetic_symtab (bfd *abfd,
return n;
}
-/* Sort symbol by binding and section. We want to put definitions
- sorted by section at the beginning. */
-
-static int
-elf_sort_elf_symbol (const void *arg1, const void *arg2)
+struct elf_symbuf_symbol
{
- const Elf_Internal_Sym *s1;
- const Elf_Internal_Sym *s2;
- int shndx;
-
- /* Make sure that undefined symbols are at the end. */
- s1 = (const Elf_Internal_Sym *) arg1;
- if (s1->st_shndx == SHN_UNDEF)
- return 1;
- s2 = (const Elf_Internal_Sym *) arg2;
- if (s2->st_shndx == SHN_UNDEF)
- return -1;
-
- /* Sorted by section index. */
- shndx = s1->st_shndx - s2->st_shndx;
- if (shndx != 0)
- return shndx;
+ unsigned long st_name; /* Symbol name, index in string tbl */
+ unsigned char st_info; /* Type and binding attributes */
+ unsigned char st_other; /* Visibilty, and target specific */
+};
- /* Sorted by binding. */
- return ELF_ST_BIND (s1->st_info) - ELF_ST_BIND (s2->st_info);
-}
+struct elf_symbuf_head
+{
+ struct elf_symbuf_symbol *ssym;
+ bfd_size_type count;
+ unsigned int st_shndx;
+};
struct elf_symbol
{
- Elf_Internal_Sym *sym;
+ union
+ {
+ Elf_Internal_Sym *isym;
+ struct elf_symbuf_symbol *ssym;
+ } u;
const char *name;
};
+/* Sort references to symbols by ascending section number. */
+
+static int
+elf_sort_elf_symbol (const void *arg1, const void *arg2)
+{
+ const Elf_Internal_Sym *s1 = *(const Elf_Internal_Sym **) arg1;
+ const Elf_Internal_Sym *s2 = *(const Elf_Internal_Sym **) arg2;
+
+ return s1->st_shndx - s2->st_shndx;
+}
+
static int
elf_sym_name_compare (const void *arg1, const void *arg2)
{
@@ -8550,20 +8858,79 @@ elf_sym_name_compare (const void *arg1, const void *arg2)
return strcmp (s1->name, s2->name);
}
+static struct elf_symbuf_head *
+elf_create_symbuf (bfd_size_type symcount, Elf_Internal_Sym *isymbuf)
+{
+ Elf_Internal_Sym **ind, **indbufend, **indbuf
+ = bfd_malloc2 (symcount, sizeof (*indbuf));
+ struct elf_symbuf_symbol *ssym;
+ struct elf_symbuf_head *ssymbuf, *ssymhead;
+ bfd_size_type i, shndx_count;
+
+ if (indbuf == NULL)
+ return NULL;
+
+ for (ind = indbuf, i = 0; i < symcount; i++)
+ if (isymbuf[i].st_shndx != SHN_UNDEF)
+ *ind++ = &isymbuf[i];
+ indbufend = ind;
+
+ qsort (indbuf, indbufend - indbuf, sizeof (Elf_Internal_Sym *),
+ elf_sort_elf_symbol);
+
+ shndx_count = 0;
+ if (indbufend > indbuf)
+ for (ind = indbuf, shndx_count++; ind < indbufend - 1; ind++)
+ if (ind[0]->st_shndx != ind[1]->st_shndx)
+ shndx_count++;
+
+ ssymbuf = bfd_malloc ((shndx_count + 1) * sizeof (*ssymbuf)
+ + (indbufend - indbuf) * sizeof (*ssymbuf));
+ if (ssymbuf == NULL)
+ {
+ free (indbuf);
+ return NULL;
+ }
+
+ ssym = (struct elf_symbuf_symbol *) (ssymbuf + shndx_count);
+ ssymbuf->ssym = NULL;
+ ssymbuf->count = shndx_count;
+ ssymbuf->st_shndx = 0;
+ for (ssymhead = ssymbuf, ind = indbuf; ind < indbufend; ssym++, ind++)
+ {
+ if (ind == indbuf || ssymhead->st_shndx != (*ind)->st_shndx)
+ {
+ ssymhead++;
+ ssymhead->ssym = ssym;
+ ssymhead->count = 0;
+ ssymhead->st_shndx = (*ind)->st_shndx;
+ }
+ ssym->st_name = (*ind)->st_name;
+ ssym->st_info = (*ind)->st_info;
+ ssym->st_other = (*ind)->st_other;
+ ssymhead->count++;
+ }
+ BFD_ASSERT ((bfd_size_type) (ssymhead - ssymbuf) == shndx_count);
+
+ free (indbuf);
+ return ssymbuf;
+}
+
/* Check if 2 sections define the same set of local and global
symbols. */
bfd_boolean
-bfd_elf_match_symbols_in_sections (asection *sec1, asection *sec2)
+bfd_elf_match_symbols_in_sections (asection *sec1, asection *sec2,
+ struct bfd_link_info *info)
{
bfd *bfd1, *bfd2;
const struct elf_backend_data *bed1, *bed2;
Elf_Internal_Shdr *hdr1, *hdr2;
bfd_size_type symcount1, symcount2;
Elf_Internal_Sym *isymbuf1, *isymbuf2;
- Elf_Internal_Sym *isymstart1 = NULL, *isymstart2 = NULL, *isym;
- Elf_Internal_Sym *isymend;
- struct elf_symbol *symp, *symtable1 = NULL, *symtable2 = NULL;
+ struct elf_symbuf_head *ssymbuf1, *ssymbuf2;
+ Elf_Internal_Sym *isym, *isymend;
+ struct elf_symbol *symtable1 = NULL, *symtable2 = NULL;
bfd_size_type count1, count2, i;
int shndx1, shndx2;
bfd_boolean result;
@@ -8573,10 +8940,8 @@ bfd_elf_match_symbols_in_sections (asection *sec1, asection *sec2)
/* If both are .gnu.linkonce sections, they have to have the same
section name. */
- if (strncmp (sec1->name, ".gnu.linkonce",
- sizeof ".gnu.linkonce" - 1) == 0
- && strncmp (sec2->name, ".gnu.linkonce",
- sizeof ".gnu.linkonce" - 1) == 0)
+ if (CONST_STRNEQ (sec1->name, ".gnu.linkonce")
+ && CONST_STRNEQ (sec2->name, ".gnu.linkonce"))
return strcmp (sec1->name + sizeof ".gnu.linkonce",
sec2->name + sizeof ".gnu.linkonce") == 0;
@@ -8612,84 +8977,155 @@ bfd_elf_match_symbols_in_sections (asection *sec1, asection *sec2)
if (symcount1 == 0 || symcount2 == 0)
return FALSE;
- isymbuf1 = bfd_elf_get_elf_syms (bfd1, hdr1, symcount1, 0,
- NULL, NULL, NULL);
- isymbuf2 = bfd_elf_get_elf_syms (bfd2, hdr2, symcount2, 0,
- NULL, NULL, NULL);
-
result = FALSE;
- if (isymbuf1 == NULL || isymbuf2 == NULL)
- goto done;
+ isymbuf1 = NULL;
+ isymbuf2 = NULL;
+ ssymbuf1 = elf_tdata (bfd1)->symbuf;
+ ssymbuf2 = elf_tdata (bfd2)->symbuf;
- /* Sort symbols by binding and section. Global definitions are at
- the beginning. */
- qsort (isymbuf1, symcount1, sizeof (Elf_Internal_Sym),
- elf_sort_elf_symbol);
- qsort (isymbuf2, symcount2, sizeof (Elf_Internal_Sym),
- elf_sort_elf_symbol);
+ if (ssymbuf1 == NULL)
+ {
+ isymbuf1 = bfd_elf_get_elf_syms (bfd1, hdr1, symcount1, 0,
+ NULL, NULL, NULL);
+ if (isymbuf1 == NULL)
+ goto done;
- /* Count definitions in the section. */
- count1 = 0;
- for (isym = isymbuf1, isymend = isym + symcount1;
- isym < isymend; isym++)
+ if (!info->reduce_memory_overheads)
+ elf_tdata (bfd1)->symbuf = ssymbuf1
+ = elf_create_symbuf (symcount1, isymbuf1);
+ }
+
+ if (ssymbuf1 == NULL || ssymbuf2 == NULL)
{
- if (isym->st_shndx == (unsigned int) shndx1)
- {
- if (count1 == 0)
- isymstart1 = isym;
- count1++;
- }
+ isymbuf2 = bfd_elf_get_elf_syms (bfd2, hdr2, symcount2, 0,
+ NULL, NULL, NULL);
+ if (isymbuf2 == NULL)
+ goto done;
- if (count1 && isym->st_shndx != (unsigned int) shndx1)
- break;
+ if (ssymbuf1 != NULL && !info->reduce_memory_overheads)
+ elf_tdata (bfd2)->symbuf = ssymbuf2
+ = elf_create_symbuf (symcount2, isymbuf2);
}
- count2 = 0;
- for (isym = isymbuf2, isymend = isym + symcount2;
- isym < isymend; isym++)
+ if (ssymbuf1 != NULL && ssymbuf2 != NULL)
{
- if (isym->st_shndx == (unsigned int) shndx2)
+ /* Optimized faster version. */
+ bfd_size_type lo, hi, mid;
+ struct elf_symbol *symp;
+ struct elf_symbuf_symbol *ssym, *ssymend;
+
+ lo = 0;
+ hi = ssymbuf1->count;
+ ssymbuf1++;
+ count1 = 0;
+ while (lo < hi)
{
- if (count2 == 0)
- isymstart2 = isym;
- count2++;
+ mid = (lo + hi) / 2;
+ if ((unsigned int) shndx1 < ssymbuf1[mid].st_shndx)
+ hi = mid;
+ else if ((unsigned int) shndx1 > ssymbuf1[mid].st_shndx)
+ lo = mid + 1;
+ else
+ {
+ count1 = ssymbuf1[mid].count;
+ ssymbuf1 += mid;
+ break;
+ }
}
- if (count2 && isym->st_shndx != (unsigned int) shndx2)
- break;
+ lo = 0;
+ hi = ssymbuf2->count;
+ ssymbuf2++;
+ count2 = 0;
+ while (lo < hi)
+ {
+ mid = (lo + hi) / 2;
+ if ((unsigned int) shndx2 < ssymbuf2[mid].st_shndx)
+ hi = mid;
+ else if ((unsigned int) shndx2 > ssymbuf2[mid].st_shndx)
+ lo = mid + 1;
+ else
+ {
+ count2 = ssymbuf2[mid].count;
+ ssymbuf2 += mid;
+ break;
+ }
+ }
+
+ if (count1 == 0 || count2 == 0 || count1 != count2)
+ goto done;
+
+ symtable1 = bfd_malloc (count1 * sizeof (struct elf_symbol));
+ symtable2 = bfd_malloc (count2 * sizeof (struct elf_symbol));
+ if (symtable1 == NULL || symtable2 == NULL)
+ goto done;
+
+ symp = symtable1;
+ for (ssym = ssymbuf1->ssym, ssymend = ssym + count1;
+ ssym < ssymend; ssym++, symp++)
+ {
+ symp->u.ssym = ssym;
+ symp->name = bfd_elf_string_from_elf_section (bfd1,
+ hdr1->sh_link,
+ ssym->st_name);
+ }
+
+ symp = symtable2;
+ for (ssym = ssymbuf2->ssym, ssymend = ssym + count2;
+ ssym < ssymend; ssym++, symp++)
+ {
+ symp->u.ssym = ssym;
+ symp->name = bfd_elf_string_from_elf_section (bfd2,
+ hdr2->sh_link,
+ ssym->st_name);
+ }
+
+ /* Sort symbol by name. */
+ qsort (symtable1, count1, sizeof (struct elf_symbol),
+ elf_sym_name_compare);
+ qsort (symtable2, count1, sizeof (struct elf_symbol),
+ elf_sym_name_compare);
+
+ for (i = 0; i < count1; i++)
+ /* Two symbols must have the same binding, type and name. */
+ if (symtable1 [i].u.ssym->st_info != symtable2 [i].u.ssym->st_info
+ || symtable1 [i].u.ssym->st_other != symtable2 [i].u.ssym->st_other
+ || strcmp (symtable1 [i].name, symtable2 [i].name) != 0)
+ goto done;
+
+ result = TRUE;
+ goto done;
}
- if (count1 == 0 || count2 == 0 || count1 != count2)
+ symtable1 = bfd_malloc (symcount1 * sizeof (struct elf_symbol));
+ symtable2 = bfd_malloc (symcount2 * sizeof (struct elf_symbol));
+ if (symtable1 == NULL || symtable2 == NULL)
goto done;
- symtable1 = bfd_malloc (count1 * sizeof (struct elf_symbol));
- symtable2 = bfd_malloc (count1 * sizeof (struct elf_symbol));
+ /* Count definitions in the section. */
+ count1 = 0;
+ for (isym = isymbuf1, isymend = isym + symcount1; isym < isymend; isym++)
+ if (isym->st_shndx == (unsigned int) shndx1)
+ symtable1[count1++].u.isym = isym;
- if (symtable1 == NULL || symtable2 == NULL)
+ count2 = 0;
+ for (isym = isymbuf2, isymend = isym + symcount2; isym < isymend; isym++)
+ if (isym->st_shndx == (unsigned int) shndx2)
+ symtable2[count2++].u.isym = isym;
+
+ if (count1 == 0 || count2 == 0 || count1 != count2)
goto done;
- symp = symtable1;
- for (isym = isymstart1, isymend = isym + count1;
- isym < isymend; isym++)
- {
- symp->sym = isym;
- symp->name = bfd_elf_string_from_elf_section (bfd1,
- hdr1->sh_link,
- isym->st_name);
- symp++;
- }
-
- symp = symtable2;
- for (isym = isymstart2, isymend = isym + count1;
- isym < isymend; isym++)
- {
- symp->sym = isym;
- symp->name = bfd_elf_string_from_elf_section (bfd2,
- hdr2->sh_link,
- isym->st_name);
- symp++;
- }
-
+ for (i = 0; i < count1; i++)
+ symtable1[i].name
+ = bfd_elf_string_from_elf_section (bfd1, hdr1->sh_link,
+ symtable1[i].u.isym->st_name);
+
+ for (i = 0; i < count2; i++)
+ symtable2[i].name
+ = bfd_elf_string_from_elf_section (bfd2, hdr2->sh_link,
+ symtable2[i].u.isym->st_name);
+
/* Sort symbol by name. */
qsort (symtable1, count1, sizeof (struct elf_symbol),
elf_sym_name_compare);
@@ -8698,8 +9134,8 @@ bfd_elf_match_symbols_in_sections (asection *sec1, asection *sec2)
for (i = 0; i < count1; i++)
/* Two symbols must have the same binding, type and name. */
- if (symtable1 [i].sym->st_info != symtable2 [i].sym->st_info
- || symtable1 [i].sym->st_other != symtable2 [i].sym->st_other
+ if (symtable1 [i].u.isym->st_info != symtable2 [i].u.isym->st_info
+ || symtable1 [i].u.isym->st_other != symtable2 [i].u.isym->st_other
|| strcmp (symtable1 [i].name, symtable2 [i].name) != 0)
goto done;
@@ -8721,8 +9157,7 @@ done:
/* It is only used by x86-64 so far. */
asection _bfd_elf_large_com_section
= BFD_FAKE_SECTION (_bfd_elf_large_com_section,
- SEC_IS_COMMON, NULL, NULL, "LARGE_COMMON",
- 0);
+ SEC_IS_COMMON, NULL, "LARGE_COMMON", 0);
/* Return TRUE if 2 section types are compatible. */
@@ -8738,3 +9173,25 @@ _bfd_elf_match_sections_by_type (bfd *abfd, const asection *asec,
return elf_section_type (asec) == elf_section_type (bsec);
}
+
+void
+_bfd_elf_set_osabi (bfd * abfd,
+ struct bfd_link_info * link_info ATTRIBUTE_UNUSED)
+{
+ Elf_Internal_Ehdr * i_ehdrp; /* ELF file header, internal form. */
+
+ i_ehdrp = elf_elfheader (abfd);
+
+ i_ehdrp->e_ident[EI_OSABI] = get_elf_backend_data (abfd)->elf_osabi;
+}
+
+
+/* Return TRUE for ELF symbol types that represent functions.
+ This is the default version of this function, which is sufficient for
+ most targets. It returns true if TYPE is STT_FUNC. */
+
+bfd_boolean
+_bfd_elf_is_function_type (unsigned int type)
+{
+ return (type == STT_FUNC);
+}
diff --git a/bfd/elf32-am33lin.c b/bfd/elf32-am33lin.c
index 81f1975f3fee..781e9526bb9e 100644
--- a/bfd/elf32-am33lin.c
+++ b/bfd/elf32-am33lin.c
@@ -1,5 +1,5 @@
/* Matsushita AM33/2.0 support for 32-bit GNU/Linux ELF
- Copyright 2003, 2005
+ Copyright 2003, 2005, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "elf-bfd.h"
#include "elf/mn10300.h"
diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index a6011bdb32dd..58d63010783f 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -1,5 +1,5 @@
/* ARC-specific support for 32-bit ELF
- Copyright 1994, 1995, 1997, 1999, 2001, 2002, 2005
+ Copyright 1994, 1995, 1997, 1999, 2001, 2002, 2005, 2007
Free Software Foundation, Inc.
Contributed by Doug Evans (dje@cygnus.com).
@@ -20,8 +20,8 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/arc.h"
@@ -147,6 +147,22 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return NULL;
}
+static reloc_howto_type *
+bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (elf_arc_howto_table) / sizeof (elf_arc_howto_table[0]);
+ i++)
+ if (elf_arc_howto_table[i].name != NULL
+ && strcasecmp (elf_arc_howto_table[i].name, r_name) == 0)
+ return &elf_arc_howto_table[i];
+
+ return NULL;
+}
+
/* Set the howto pointer for an ARC ELF reloc. */
static void
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index f64f5d6feee5..85ed8d7d6fb1 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -1,5 +1,5 @@
/* 32-bit ELF support for ARM
- Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libiberty.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -62,7 +62,7 @@
#define ARM_ELF_ABI_VERSION 0
#define ARM_ELF_OS_ABI_VERSION ELFOSABI_ARM
-static const struct elf_backend_data elf32_arm_vxworks_bed;
+static struct elf_backend_data elf32_arm_vxworks_bed;
/* Note: code such as elf32_arm_reloc_type_lookup expect to use e.g.
R_ARM_PC24 as an index into this, and find the R_ARM_PC24 HOWTO
@@ -130,19 +130,19 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
TRUE), /* pcrel_offset */
/* 8 bit absolute - R_ARM_LDR_PC_G0 in AAELF */
- HOWTO (R_ARM_PC13, /* type */
+ HOWTO (R_ARM_LDR_PC_G0, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- FALSE, /* pc_relative */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield,/* complain_on_overflow */
+ complain_overflow_dont,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
- "R_ARM_PC13", /* name */
+ "R_ARM_LDR_PC_G0", /* name */
FALSE, /* partial_inplace */
- 0x000000ff, /* src_mask */
- 0x000000ff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
/* 16 bit absolute */
HOWTO (R_ARM_ABS16, /* type */
@@ -217,11 +217,10 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
- /* FIXME: Has two more bits of offset in Thumb32. */
HOWTO (R_ARM_THM_CALL, /* type */
1, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
- 23, /* bitsize */
+ 25, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed,/* complain_on_overflow */
@@ -835,12 +834,12 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
13, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
- complain_overflow_signed,/* complain_on_overflow */
+ complain_overflow_dont,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_THM_ALU_PREL_11_0",/* name */
FALSE, /* partial_inplace */
- 0x040070ff, /* src_mask */
- 0x040070ff, /* dst_mask */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
TRUE), /* pcrel_offset */
HOWTO (R_ARM_THM_PC12, /* type */
@@ -849,12 +848,12 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
13, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
- complain_overflow_signed,/* complain_on_overflow */
+ complain_overflow_dont,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_THM_PC12", /* name */
FALSE, /* partial_inplace */
- 0x040070ff, /* src_mask */
- 0x040070ff, /* dst_mask */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
TRUE), /* pcrel_offset */
HOWTO (R_ARM_ABS32_NOI, /* type */
@@ -884,13 +883,389 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
-};
-/* Relocations 57 .. 83 are the "group relocations" which we do not
- support. */
+ /* Group relocations. */
+
+ HOWTO (R_ARM_ALU_PC_G0_NC, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_ALU_PC_G0_NC", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_ALU_PC_G0, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_ALU_PC_G0", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_ALU_PC_G1_NC, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_ALU_PC_G1_NC", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_ALU_PC_G1, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_ALU_PC_G1", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_ALU_PC_G2, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_ALU_PC_G2", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDR_PC_G1, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDR_PC_G1", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDR_PC_G2, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDR_PC_G2", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDRS_PC_G0, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDRS_PC_G0", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDRS_PC_G1, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDRS_PC_G1", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDRS_PC_G2, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDRS_PC_G2", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDC_PC_G0, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDC_PC_G0", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDC_PC_G1, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDC_PC_G1", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDC_PC_G2, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDC_PC_G2", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_ALU_SB_G0_NC, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_ALU_SB_G0_NC", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_ALU_SB_G0, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_ALU_SB_G0", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_ALU_SB_G1_NC, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_ALU_SB_G1_NC", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_ALU_SB_G1, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_ALU_SB_G1", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_ALU_SB_G2, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_ALU_SB_G2", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDR_SB_G0, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDR_SB_G0", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDR_SB_G1, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDR_SB_G1", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDR_SB_G2, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDR_SB_G2", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDRS_SB_G0, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDRS_SB_G0", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDRS_SB_G1, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDRS_SB_G1", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDRS_SB_G2, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDRS_SB_G2", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDC_SB_G0, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDC_SB_G0", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDC_SB_G1, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDC_SB_G1", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_ARM_LDC_SB_G2, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_LDC_SB_G2", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* End of group relocations. */
-static reloc_howto_type elf32_arm_howto_table_2[] =
-{
HOWTO (R_ARM_MOVW_BREL_NC, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@@ -1230,7 +1605,7 @@ static reloc_howto_type elf32_arm_howto_table_2[] =
249-255 extended, currently unused, relocations: */
-static reloc_howto_type elf32_arm_howto_table_3[4] =
+static reloc_howto_type elf32_arm_howto_table_2[4] =
{
HOWTO (R_ARM_RREL32, /* type */
0, /* rightshift */
@@ -1295,13 +1670,9 @@ elf32_arm_howto_from_type (unsigned int r_type)
if (r_type < NUM_ELEM (elf32_arm_howto_table_1))
return &elf32_arm_howto_table_1[r_type];
- if (r_type >= R_ARM_MOVW_BREL_NC
- && r_type < R_ARM_MOVW_BREL_NC + NUM_ELEM (elf32_arm_howto_table_2))
- return &elf32_arm_howto_table_2[r_type - R_ARM_MOVW_BREL_NC];
-
if (r_type >= R_ARM_RREL32
&& r_type < R_ARM_RREL32 + NUM_ELEM (elf32_arm_howto_table_2))
- return &elf32_arm_howto_table_3[r_type - R_ARM_RREL32];
+ return &elf32_arm_howto_table_2[r_type - R_ARM_RREL32];
return NULL;
}
@@ -1366,6 +1737,42 @@ static const struct elf32_arm_reloc_map elf32_arm_reloc_map[] =
{BFD_RELOC_ARM_TLS_LE32, R_ARM_TLS_LE32},
{BFD_RELOC_VTABLE_INHERIT, R_ARM_GNU_VTINHERIT},
{BFD_RELOC_VTABLE_ENTRY, R_ARM_GNU_VTENTRY},
+ {BFD_RELOC_ARM_MOVW, R_ARM_MOVW_ABS_NC},
+ {BFD_RELOC_ARM_MOVT, R_ARM_MOVT_ABS},
+ {BFD_RELOC_ARM_MOVW_PCREL, R_ARM_MOVW_PREL_NC},
+ {BFD_RELOC_ARM_MOVT_PCREL, R_ARM_MOVT_PREL},
+ {BFD_RELOC_ARM_THUMB_MOVW, R_ARM_THM_MOVW_ABS_NC},
+ {BFD_RELOC_ARM_THUMB_MOVT, R_ARM_THM_MOVT_ABS},
+ {BFD_RELOC_ARM_THUMB_MOVW_PCREL, R_ARM_THM_MOVW_PREL_NC},
+ {BFD_RELOC_ARM_THUMB_MOVT_PCREL, R_ARM_THM_MOVT_PREL},
+ {BFD_RELOC_ARM_ALU_PC_G0_NC, R_ARM_ALU_PC_G0_NC},
+ {BFD_RELOC_ARM_ALU_PC_G0, R_ARM_ALU_PC_G0},
+ {BFD_RELOC_ARM_ALU_PC_G1_NC, R_ARM_ALU_PC_G1_NC},
+ {BFD_RELOC_ARM_ALU_PC_G1, R_ARM_ALU_PC_G1},
+ {BFD_RELOC_ARM_ALU_PC_G2, R_ARM_ALU_PC_G2},
+ {BFD_RELOC_ARM_LDR_PC_G0, R_ARM_LDR_PC_G0},
+ {BFD_RELOC_ARM_LDR_PC_G1, R_ARM_LDR_PC_G1},
+ {BFD_RELOC_ARM_LDR_PC_G2, R_ARM_LDR_PC_G2},
+ {BFD_RELOC_ARM_LDRS_PC_G0, R_ARM_LDRS_PC_G0},
+ {BFD_RELOC_ARM_LDRS_PC_G1, R_ARM_LDRS_PC_G1},
+ {BFD_RELOC_ARM_LDRS_PC_G2, R_ARM_LDRS_PC_G2},
+ {BFD_RELOC_ARM_LDC_PC_G0, R_ARM_LDC_PC_G0},
+ {BFD_RELOC_ARM_LDC_PC_G1, R_ARM_LDC_PC_G1},
+ {BFD_RELOC_ARM_LDC_PC_G2, R_ARM_LDC_PC_G2},
+ {BFD_RELOC_ARM_ALU_SB_G0_NC, R_ARM_ALU_SB_G0_NC},
+ {BFD_RELOC_ARM_ALU_SB_G0, R_ARM_ALU_SB_G0},
+ {BFD_RELOC_ARM_ALU_SB_G1_NC, R_ARM_ALU_SB_G1_NC},
+ {BFD_RELOC_ARM_ALU_SB_G1, R_ARM_ALU_SB_G1},
+ {BFD_RELOC_ARM_ALU_SB_G2, R_ARM_ALU_SB_G2},
+ {BFD_RELOC_ARM_LDR_SB_G0, R_ARM_LDR_SB_G0},
+ {BFD_RELOC_ARM_LDR_SB_G1, R_ARM_LDR_SB_G1},
+ {BFD_RELOC_ARM_LDR_SB_G2, R_ARM_LDR_SB_G2},
+ {BFD_RELOC_ARM_LDRS_SB_G0, R_ARM_LDRS_SB_G0},
+ {BFD_RELOC_ARM_LDRS_SB_G1, R_ARM_LDRS_SB_G1},
+ {BFD_RELOC_ARM_LDRS_SB_G2, R_ARM_LDRS_SB_G2},
+ {BFD_RELOC_ARM_LDC_SB_G0, R_ARM_LDC_SB_G0},
+ {BFD_RELOC_ARM_LDC_SB_G1, R_ARM_LDC_SB_G1},
+ {BFD_RELOC_ARM_LDC_SB_G2, R_ARM_LDC_SB_G2}
};
static reloc_howto_type *
@@ -1380,6 +1787,31 @@ elf32_arm_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return NULL;
}
+static reloc_howto_type *
+elf32_arm_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (elf32_arm_howto_table_1)
+ / sizeof (elf32_arm_howto_table_1[0]));
+ i++)
+ if (elf32_arm_howto_table_1[i].name != NULL
+ && strcasecmp (elf32_arm_howto_table_1[i].name, r_name) == 0)
+ return &elf32_arm_howto_table_1[i];
+
+ for (i = 0;
+ i < (sizeof (elf32_arm_howto_table_2)
+ / sizeof (elf32_arm_howto_table_2[0]));
+ i++)
+ if (elf32_arm_howto_table_2[i].name != NULL
+ && strcasecmp (elf32_arm_howto_table_2[i].name, r_name) == 0)
+ return &elf32_arm_howto_table_2[i];
+
+ return NULL;
+}
+
/* Support for core dump NOTE sections */
static bfd_boolean
elf32_arm_nabi_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
@@ -1468,6 +1900,9 @@ typedef unsigned short int insn16;
#define ARM2THUMB_GLUE_SECTION_NAME ".glue_7"
#define ARM2THUMB_GLUE_ENTRY_NAME "__%s_from_arm"
+#define VFP11_ERRATUM_VENEER_SECTION_NAME ".vfp11_veneer"
+#define VFP11_ERRATUM_VENEER_ENTRY_NAME "__vfp11_veneer_%x"
+
/* The name of the dynamic interpreter. This is put in the .interp
section. */
#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
@@ -1580,11 +2015,46 @@ typedef struct elf32_elf_section_map
}
elf32_arm_section_map;
+/* Information about a VFP11 erratum veneer, or a branch to such a veneer. */
+
+typedef enum
+{
+ VFP11_ERRATUM_BRANCH_TO_ARM_VENEER,
+ VFP11_ERRATUM_BRANCH_TO_THUMB_VENEER,
+ VFP11_ERRATUM_ARM_VENEER,
+ VFP11_ERRATUM_THUMB_VENEER
+}
+elf32_vfp11_erratum_type;
+
+typedef struct elf32_vfp11_erratum_list
+{
+ struct elf32_vfp11_erratum_list *next;
+ bfd_vma vma;
+ union
+ {
+ struct
+ {
+ struct elf32_vfp11_erratum_list *veneer;
+ unsigned int vfp_insn;
+ } b;
+ struct
+ {
+ struct elf32_vfp11_erratum_list *branch;
+ unsigned int id;
+ } v;
+ } u;
+ elf32_vfp11_erratum_type type;
+}
+elf32_vfp11_erratum_list;
+
typedef struct _arm_elf_section_data
{
struct bfd_elf_section_data elf;
unsigned int mapcount;
+ unsigned int mapsize;
elf32_arm_section_map *map;
+ unsigned int erratumcount;
+ elf32_vfp11_erratum_list *erratumlist;
}
_arm_elf_section_data;
@@ -1594,22 +2064,6 @@ _arm_elf_section_data;
/* The size of the thread control block. */
#define TCB_SIZE 8
-#define NUM_KNOWN_ATTRIBUTES 32
-
-typedef struct aeabi_attribute
-{
- int type;
- unsigned int i;
- char *s;
-} aeabi_attribute;
-
-typedef struct aeabi_attribute_list
-{
- struct aeabi_attribute_list *next;
- int tag;
- aeabi_attribute attr;
-} aeabi_attribute_list;
-
struct elf32_arm_obj_tdata
{
struct elf_obj_tdata root;
@@ -1617,8 +2071,8 @@ struct elf32_arm_obj_tdata
/* tls_type for each local got entry. */
char *local_got_tls_type;
- aeabi_attribute known_eabi_attributes[NUM_KNOWN_ATTRIBUTES];
- aeabi_attribute_list *other_eabi_attributes;
+ /* Zero to warn when linking objects with incompatible enum sizes. */
+ int no_enum_size_warning;
};
#define elf32_arm_tdata(abfd) \
@@ -1630,11 +2084,14 @@ struct elf32_arm_obj_tdata
static bfd_boolean
elf32_arm_mkobject (bfd *abfd)
{
- bfd_size_type amt = sizeof (struct elf32_arm_obj_tdata);
- abfd->tdata.any = bfd_zalloc (abfd, amt);
if (abfd->tdata.any == NULL)
- return FALSE;
- return TRUE;
+ {
+ bfd_size_type amt = sizeof (struct elf32_arm_obj_tdata);
+ abfd->tdata.any = bfd_zalloc (abfd, amt);
+ if (abfd->tdata.any == NULL)
+ return FALSE;
+ }
+ return bfd_elf_mkobject (abfd);
}
/* The ARM linker needs to keep track of the number of relocs that it
@@ -1681,6 +2138,10 @@ struct elf32_arm_link_hash_entry
#define GOT_TLS_GD 2
#define GOT_TLS_IE 4
unsigned char tls_type;
+
+ /* The symbol marking the real symbol location for exported thumb
+ symbols with Arm stubs. */
+ struct elf_link_hash_entry *export_glue;
};
/* Traverse an arm ELF linker hash table. */
@@ -1706,6 +2167,10 @@ struct elf32_arm_link_hash_table
/* The size in bytes of the section containing the ARM-to-Thumb glue. */
bfd_size_type arm_glue_size;
+ /* The size in bytes of the section containing glue for VFP11 erratum
+ veneers. */
+ bfd_size_type vfp11_erratum_glue_size;
+
/* An arbitrary input BFD chosen to hold the glue sections. */
bfd * bfd_of_glue_owner;
@@ -1713,7 +2178,7 @@ struct elf32_arm_link_hash_table
int byteswap_code;
/* Zero if R_ARM_TARGET1 means R_ARM_ABS32.
- Nonzero if R_ARM_TARGET1 means R_ARM_ABS32. */
+ Nonzero if R_ARM_TARGET1 means R_ARM_REL32. */
int target1_is_rel;
/* The relocation to use for R_ARM_TARGET2 relocations. */
@@ -1725,6 +2190,16 @@ struct elf32_arm_link_hash_table
/* Nonzero if the ARM/Thumb BLX instructions are available for use. */
int use_blx;
+ /* What sort of code sequences we should look for which may trigger the
+ VFP11 denorm erratum. */
+ bfd_arm_vfp11_fix vfp11_fix;
+
+ /* Global counter for the number of fixes we have emitted. */
+ int num_vfp11_fixes;
+
+ /* Nonzero to force PIC branch veneers. */
+ int pic_veneer;
+
/* The number of bytes in the initial entry in the PLT. */
bfd_size_type plt_header_size;
@@ -1792,6 +2267,7 @@ elf32_arm_link_hash_newfunc (struct bfd_hash_entry * entry,
ret->tls_type = GOT_UNKNOWN;
ret->plt_thumb_refcount = 0;
ret->plt_got_offset = -1;
+ ret->export_glue = NULL;
}
return (struct bfd_hash_entry *) ret;
@@ -1805,9 +2281,9 @@ reloc_section_p (struct elf32_arm_link_hash_table *htab,
const char *name, asection *s)
{
if (htab->use_rel)
- return strncmp (name, ".rel", 4) == 0 && strcmp (s->name, name + 4) == 0;
+ return CONST_STRNEQ (name, ".rel") && strcmp (s->name, name + 4) == 0;
else
- return strncmp (name, ".rela", 5) == 0 && strcmp (s->name, name + 5) == 0;
+ return CONST_STRNEQ (name, ".rela") && strcmp (s->name, name + 5) == 0;
}
/* Create .got, .gotplt, and .rel(a).got sections in DYNOBJ, and set up
@@ -1940,15 +2416,17 @@ elf32_arm_copy_indirect_symbol (struct bfd_link_info *info,
eind->relocs_copied = NULL;
}
- /* Copy over PLT info. */
- edir->plt_thumb_refcount += eind->plt_thumb_refcount;
- eind->plt_thumb_refcount = 0;
-
- if (ind->root.type == bfd_link_hash_indirect
- && dir->got.refcount <= 0)
+ if (ind->root.type == bfd_link_hash_indirect)
{
- edir->tls_type = eind->tls_type;
- eind->tls_type = GOT_UNKNOWN;
+ /* Copy over PLT info. */
+ edir->plt_thumb_refcount += eind->plt_thumb_refcount;
+ eind->plt_thumb_refcount = 0;
+
+ if (dir->got.refcount <= 0)
+ {
+ edir->tls_type = eind->tls_type;
+ eind->tls_type = GOT_UNKNOWN;
+ }
}
_bfd_elf_link_hash_copy_indirect (info, dir, ind);
@@ -1984,6 +2462,9 @@ elf32_arm_link_hash_table_create (bfd *abfd)
ret->srelplt2 = NULL;
ret->thumb_glue_size = 0;
ret->arm_glue_size = 0;
+ ret->vfp11_fix = BFD_ARM_VFP11_FIX_NONE;
+ ret->vfp11_erratum_glue_size = 0;
+ ret->num_vfp11_fixes = 0;
ret->bfd_of_glue_owner = NULL;
ret->byteswap_code = 0;
ret->target1_is_rel = 0;
@@ -2012,7 +2493,7 @@ elf32_arm_link_hash_table_create (bfd *abfd)
static struct elf_link_hash_entry *
find_thumb_glue (struct bfd_link_info *link_info,
const char *name,
- bfd *input_bfd)
+ char **error_message)
{
char *tmp_name;
struct elf_link_hash_entry *hash;
@@ -2032,9 +2513,8 @@ find_thumb_glue (struct bfd_link_info *link_info,
(&(hash_table)->root, tmp_name, FALSE, FALSE, TRUE);
if (hash == NULL)
- /* xgettext:c-format */
- (*_bfd_error_handler) (_("%B: unable to find THUMB glue '%s' for `%s'"),
- input_bfd, tmp_name, name);
+ asprintf (error_message, _("unable to find THUMB glue '%s' for '%s'"),
+ tmp_name, name);
free (tmp_name);
@@ -2046,7 +2526,7 @@ find_thumb_glue (struct bfd_link_info *link_info,
static struct elf_link_hash_entry *
find_arm_glue (struct bfd_link_info *link_info,
const char *name,
- bfd *input_bfd)
+ char **error_message)
{
char *tmp_name;
struct elf_link_hash_entry *myh;
@@ -2066,9 +2546,8 @@ find_arm_glue (struct bfd_link_info *link_info,
(&(hash_table)->root, tmp_name, FALSE, FALSE, TRUE);
if (myh == NULL)
- /* xgettext:c-format */
- (*_bfd_error_handler) (_("%B: unable to find ARM glue '%s' for `%s'"),
- input_bfd, tmp_name, name);
+ asprintf (error_message, _("unable to find ARM glue '%s' for '%s'"),
+ tmp_name, name);
free (tmp_name);
@@ -2084,6 +2563,13 @@ find_arm_glue (struct bfd_link_info *link_info,
__func_addr:
.word func @ behave as if you saw a ARM_32 reloc.
+ (v5t static images)
+ .arm
+ __func_from_arm:
+ ldr pc, __func_addr
+ __func_addr:
+ .word func @ behave as if you saw a ARM_32 reloc.
+
(relocatable images)
.arm
__func_from_arm:
@@ -2099,6 +2585,10 @@ static const insn32 a2t1_ldr_insn = 0xe59fc000;
static const insn32 a2t2_bx_r12_insn = 0xe12fff1c;
static const insn32 a2t3_func_addr_insn = 0x00000001;
+#define ARM2THUMB_V5_STATIC_GLUE_SIZE 8
+static const insn32 a2t1v5_ldr_insn = 0xe51ff004;
+static const insn32 a2t2v5_func_addr_insn = 0x00000001;
+
#define ARM2THUMB_PIC_GLUE_SIZE 16
static const insn32 a2t1p_ldr_insn = 0xe59fc004;
static const insn32 a2t2p_add_pc_insn = 0xe08cc00f;
@@ -2125,6 +2615,8 @@ static const insn16 t2a1_bx_pc_insn = 0x4778;
static const insn16 t2a2_noop_insn = 0x46c0;
static const insn32 t2a3_b_insn = 0xea000000;
+#define VFP11_ERRATUM_VENEER_SIZE 8
+
#ifndef ELFARM_NABI_C_INCLUDED
bfd_boolean
bfd_elf32_arm_allocate_interworking_sections (struct bfd_link_info * info)
@@ -2148,7 +2640,7 @@ bfd_elf32_arm_allocate_interworking_sections (struct bfd_link_info * info)
foo = bfd_alloc (globals->bfd_of_glue_owner, globals->arm_glue_size);
- s->size = globals->arm_glue_size;
+ BFD_ASSERT (s->size == globals->arm_glue_size);
s->contents = foo;
}
@@ -2163,14 +2655,32 @@ bfd_elf32_arm_allocate_interworking_sections (struct bfd_link_info * info)
foo = bfd_alloc (globals->bfd_of_glue_owner, globals->thumb_glue_size);
- s->size = globals->thumb_glue_size;
+ BFD_ASSERT (s->size == globals->thumb_glue_size);
+ s->contents = foo;
+ }
+
+ if (globals->vfp11_erratum_glue_size != 0)
+ {
+ BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
+
+ s = bfd_get_section_by_name
+ (globals->bfd_of_glue_owner, VFP11_ERRATUM_VENEER_SECTION_NAME);
+
+ BFD_ASSERT (s != NULL);
+
+ foo = bfd_alloc (globals->bfd_of_glue_owner,
+ globals->vfp11_erratum_glue_size);
+
+ BFD_ASSERT (s->size == globals->vfp11_erratum_glue_size);
s->contents = foo;
}
return TRUE;
}
-static void
+/* Allocate space and symbols for calling a Thumb function from Arm mode.
+ returns the symbol identifying teh stub. */
+static struct elf_link_hash_entry *
record_arm_to_thumb_glue (struct bfd_link_info * link_info,
struct elf_link_hash_entry * h)
{
@@ -2181,6 +2691,7 @@ record_arm_to_thumb_glue (struct bfd_link_info * link_info,
struct bfd_link_hash_entry * bh;
struct elf32_arm_link_hash_table * globals;
bfd_vma val;
+ bfd_size_type size;
globals = elf32_arm_hash_table (link_info);
@@ -2205,7 +2716,7 @@ record_arm_to_thumb_glue (struct bfd_link_info * link_info,
{
/* We've already seen this guy. */
free (tmp_name);
- return;
+ return myh;
}
/* The only trick here is using hash_table->arm_glue_size as the value.
@@ -2223,12 +2734,18 @@ record_arm_to_thumb_glue (struct bfd_link_info * link_info,
free (tmp_name);
- if ((link_info->shared || globals->root.is_relocatable_executable))
- globals->arm_glue_size += ARM2THUMB_PIC_GLUE_SIZE;
+ if (link_info->shared || globals->root.is_relocatable_executable
+ || globals->pic_veneer)
+ size = ARM2THUMB_PIC_GLUE_SIZE;
+ else if (globals->use_blx)
+ size = ARM2THUMB_V5_STATIC_GLUE_SIZE;
else
- globals->arm_glue_size += ARM2THUMB_STATIC_GLUE_SIZE;
+ size = ARM2THUMB_STATIC_GLUE_SIZE;
- return;
+ s->size += size;
+ globals->arm_glue_size += size;
+
+ return myh;
}
static void
@@ -2302,11 +2819,162 @@ record_thumb_to_arm_glue (struct bfd_link_info *link_info,
free (tmp_name);
+ s->size += THUMB2ARM_GLUE_SIZE;
hash_table->thumb_glue_size += THUMB2ARM_GLUE_SIZE;
return;
}
+
+/* Add an entry to the code/data map for section SEC. */
+
+static void
+elf32_arm_section_map_add (asection *sec, char type, bfd_vma vma)
+{
+ struct _arm_elf_section_data *sec_data = elf32_arm_section_data (sec);
+ unsigned int newidx;
+
+ if (sec_data->map == NULL)
+ {
+ sec_data->map = bfd_malloc (sizeof (elf32_arm_section_map));
+ sec_data->mapcount = 0;
+ sec_data->mapsize = 1;
+ }
+
+ newidx = sec_data->mapcount++;
+
+ if (sec_data->mapcount > sec_data->mapsize)
+ {
+ sec_data->mapsize *= 2;
+ sec_data->map = bfd_realloc (sec_data->map, sec_data->mapsize
+ * sizeof (elf32_arm_section_map));
+ }
+
+ sec_data->map[newidx].vma = vma;
+ sec_data->map[newidx].type = type;
+}
+
+
+/* Record information about a VFP11 denorm-erratum veneer. Only ARM-mode
+ veneers are handled for now. */
+
+static bfd_vma
+record_vfp11_erratum_veneer (struct bfd_link_info *link_info,
+ elf32_vfp11_erratum_list *branch,
+ bfd *branch_bfd,
+ asection *branch_sec,
+ unsigned int offset)
+{
+ asection *s;
+ struct elf32_arm_link_hash_table *hash_table;
+ char *tmp_name;
+ struct elf_link_hash_entry *myh;
+ struct bfd_link_hash_entry *bh;
+ bfd_vma val;
+ struct _arm_elf_section_data *sec_data;
+ int errcount;
+ elf32_vfp11_erratum_list *newerr;
+
+ hash_table = elf32_arm_hash_table (link_info);
+
+ BFD_ASSERT (hash_table != NULL);
+ BFD_ASSERT (hash_table->bfd_of_glue_owner != NULL);
+
+ s = bfd_get_section_by_name
+ (hash_table->bfd_of_glue_owner, VFP11_ERRATUM_VENEER_SECTION_NAME);
+
+ sec_data = elf32_arm_section_data (s);
+
+ BFD_ASSERT (s != NULL);
+
+ tmp_name = bfd_malloc ((bfd_size_type) strlen
+ (VFP11_ERRATUM_VENEER_ENTRY_NAME) + 10);
+
+ BFD_ASSERT (tmp_name);
+
+ sprintf (tmp_name, VFP11_ERRATUM_VENEER_ENTRY_NAME,
+ hash_table->num_vfp11_fixes);
+
+ myh = elf_link_hash_lookup
+ (&(hash_table)->root, tmp_name, FALSE, FALSE, FALSE);
+
+ BFD_ASSERT (myh == NULL);
+
+ bh = NULL;
+ val = hash_table->vfp11_erratum_glue_size;
+ _bfd_generic_link_add_one_symbol (link_info, hash_table->bfd_of_glue_owner,
+ tmp_name, BSF_FUNCTION | BSF_LOCAL, s, val,
+ NULL, TRUE, FALSE, &bh);
+
+ myh = (struct elf_link_hash_entry *) bh;
+ myh->type = ELF_ST_INFO (STB_LOCAL, STT_FUNC);
+ myh->forced_local = 1;
+
+ /* Link veneer back to calling location. */
+ errcount = ++(sec_data->erratumcount);
+ newerr = bfd_zmalloc (sizeof (elf32_vfp11_erratum_list));
+
+ newerr->type = VFP11_ERRATUM_ARM_VENEER;
+ newerr->vma = -1;
+ newerr->u.v.branch = branch;
+ newerr->u.v.id = hash_table->num_vfp11_fixes;
+ branch->u.b.veneer = newerr;
+
+ newerr->next = sec_data->erratumlist;
+ sec_data->erratumlist = newerr;
+
+ /* A symbol for the return from the veneer. */
+ sprintf (tmp_name, VFP11_ERRATUM_VENEER_ENTRY_NAME "_r",
+ hash_table->num_vfp11_fixes);
+
+ myh = elf_link_hash_lookup
+ (&(hash_table)->root, tmp_name, FALSE, FALSE, FALSE);
+
+ if (myh != NULL)
+ abort ();
+
+ bh = NULL;
+ val = offset + 4;
+ _bfd_generic_link_add_one_symbol (link_info, branch_bfd, tmp_name, BSF_LOCAL,
+ branch_sec, val, NULL, TRUE, FALSE, &bh);
+
+ myh = (struct elf_link_hash_entry *) bh;
+ myh->type = ELF_ST_INFO (STB_LOCAL, STT_FUNC);
+ myh->forced_local = 1;
+
+ free (tmp_name);
+
+ /* Generate a mapping symbol for the veneer section, and explicitly add an
+ entry for that symbol to the code/data map for the section. */
+ if (hash_table->vfp11_erratum_glue_size == 0)
+ {
+ bh = NULL;
+ /* FIXME: Creates an ARM symbol. Thumb mode will need attention if it
+ ever requires this erratum fix. */
+ _bfd_generic_link_add_one_symbol (link_info,
+ hash_table->bfd_of_glue_owner, "$a",
+ BSF_LOCAL, s, 0, NULL,
+ TRUE, FALSE, &bh);
+
+ myh = (struct elf_link_hash_entry *) bh;
+ myh->type = ELF_ST_INFO (STB_LOCAL, STT_NOTYPE);
+ myh->forced_local = 1;
+
+ /* The elf32_arm_init_maps function only cares about symbols from input
+ BFDs. We must make a note of this generated mapping symbol
+ ourselves so that code byteswapping works properly in
+ elf32_arm_write_section. */
+ elf32_arm_section_map_add (s, 'a', 0);
+ }
+
+ s->size += VFP11_ERRATUM_VENEER_SIZE;
+ hash_table->vfp11_erratum_glue_size += VFP11_ERRATUM_VENEER_SIZE;
+ hash_table->num_vfp11_fixes++;
+
+ /* The offset of the veneer. */
+ return val;
+}
+
/* Add the glue sections to ABFD. This function is called from the
linker scripts in ld/emultempl/{armelf}.em. */
@@ -2329,7 +2997,8 @@ bfd_elf32_arm_add_glue_sections_to_bfd (bfd *abfd,
/* Note: we do not include the flag SEC_LINKER_CREATED, as this
will prevent elf_link_input_bfd() from processing the contents
of this section. */
- flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_CODE | SEC_READONLY;
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+ | SEC_CODE | SEC_READONLY);
sec = bfd_make_section_with_flags (abfd,
ARM2THUMB_GLUE_SECTION_NAME,
@@ -2348,8 +3017,8 @@ bfd_elf32_arm_add_glue_sections_to_bfd (bfd *abfd,
if (sec == NULL)
{
- flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
- | SEC_CODE | SEC_READONLY;
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+ | SEC_CODE | SEC_READONLY);
sec = bfd_make_section_with_flags (abfd,
THUMB2ARM_GLUE_SECTION_NAME,
@@ -2362,6 +3031,24 @@ bfd_elf32_arm_add_glue_sections_to_bfd (bfd *abfd,
sec->gc_mark = 1;
}
+ sec = bfd_get_section_by_name (abfd, VFP11_ERRATUM_VENEER_SECTION_NAME);
+
+ if (sec == NULL)
+ {
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+ | SEC_CODE | SEC_READONLY);
+
+ sec = bfd_make_section_with_flags (abfd,
+ VFP11_ERRATUM_VENEER_SECTION_NAME,
+ flags);
+
+ if (sec == NULL
+ || !bfd_set_section_alignment (abfd, sec, 2))
+ return FALSE;
+
+ sec->gc_mark = 1;
+ }
+
return TRUE;
}
@@ -2397,14 +3084,14 @@ bfd_elf32_arm_get_bfd_for_interworking (bfd *abfd, struct bfd_link_info *info)
static void check_use_blx(struct elf32_arm_link_hash_table *globals)
{
- if (elf32_arm_get_eabi_attr_int (globals->obfd, Tag_CPU_arch) > 2)
+ if (bfd_elf_get_obj_attr_int (globals->obfd, OBJ_ATTR_PROC,
+ Tag_CPU_arch) > 2)
globals->use_blx = 1;
}
bfd_boolean
bfd_elf32_arm_process_before_allocation (bfd *abfd,
- struct bfd_link_info *link_info,
- int byteswap_code)
+ struct bfd_link_info *link_info)
{
Elf_Internal_Shdr *symtab_hdr;
Elf_Internal_Rela *internal_relocs = NULL;
@@ -2427,13 +3114,12 @@ bfd_elf32_arm_process_before_allocation (bfd *abfd,
BFD_ASSERT (globals != NULL);
BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
- if (byteswap_code && !bfd_big_endian (abfd))
+ if (globals->byteswap_code && !bfd_big_endian (abfd))
{
_bfd_error_handler (_("%B: BE8 images only valid in big-endian mode."),
abfd);
return FALSE;
}
- globals->byteswap_code = byteswap_code;
/* Rummage around all the relocs and map the glue vectors. */
sec = abfd->sections;
@@ -2446,6 +3132,9 @@ bfd_elf32_arm_process_before_allocation (bfd *abfd,
if (sec->reloc_count == 0)
continue;
+ if ((sec->flags & SEC_EXCLUDE) != 0)
+ continue;
+
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
/* Load the relocs. */
@@ -2529,7 +3218,8 @@ bfd_elf32_arm_process_before_allocation (bfd *abfd,
/* This one is a call from thumb code. We look
up the target of the call. If it is not a thumb
target, we insert glue. */
- if (ELF_ST_TYPE (h->type) != STT_ARM_TFUNC && !globals->use_blx)
+ if (ELF_ST_TYPE (h->type) != STT_ARM_TFUNC && !globals->use_blx
+ && h->root.type != bfd_link_hash_undefweak)
record_thumb_to_arm_glue (link_info, h);
break;
@@ -2564,14 +3254,654 @@ error_return:
#endif
+/* Initialise maps of ARM/Thumb/data for input BFDs. */
+
+void
+bfd_elf32_arm_init_maps (bfd *abfd)
+{
+ Elf_Internal_Sym *isymbuf;
+ Elf_Internal_Shdr *hdr;
+ unsigned int i, localsyms;
+
+ if ((abfd->flags & DYNAMIC) != 0)
+ return;
+
+ hdr = &elf_tdata (abfd)->symtab_hdr;
+ localsyms = hdr->sh_info;
+
+ /* Obtain a buffer full of symbols for this BFD. The hdr->sh_info field
+ should contain the number of local symbols, which should come before any
+ global symbols. Mapping symbols are always local. */
+ isymbuf = bfd_elf_get_elf_syms (abfd, hdr, localsyms, 0, NULL, NULL,
+ NULL);
+
+ /* No internal symbols read? Skip this BFD. */
+ if (isymbuf == NULL)
+ return;
+
+ for (i = 0; i < localsyms; i++)
+ {
+ Elf_Internal_Sym *isym = &isymbuf[i];
+ asection *sec = bfd_section_from_elf_index (abfd, isym->st_shndx);
+ const char *name;
+
+ if (sec != NULL
+ && ELF_ST_BIND (isym->st_info) == STB_LOCAL)
+ {
+ name = bfd_elf_string_from_elf_section (abfd,
+ hdr->sh_link, isym->st_name);
+
+ if (bfd_is_arm_special_symbol_name (name,
+ BFD_ARM_SPECIAL_SYM_TYPE_MAP))
+ elf32_arm_section_map_add (sec, name[1], isym->st_value);
+ }
+ }
+}
+
+
+void
+bfd_elf32_arm_set_vfp11_fix (bfd *obfd, struct bfd_link_info *link_info)
+{
+ struct elf32_arm_link_hash_table *globals = elf32_arm_hash_table (link_info);
+ obj_attribute *out_attr = elf_known_obj_attributes_proc (obfd);
+
+ /* We assume that ARMv7+ does not need the VFP11 denorm erratum fix. */
+ if (out_attr[Tag_CPU_arch].i >= TAG_CPU_ARCH_V7)
+ {
+ switch (globals->vfp11_fix)
+ {
+ case BFD_ARM_VFP11_FIX_DEFAULT:
+ case BFD_ARM_VFP11_FIX_NONE:
+ globals->vfp11_fix = BFD_ARM_VFP11_FIX_NONE;
+ break;
+
+ default:
+ /* Give a warning, but do as the user requests anyway. */
+ (*_bfd_error_handler) (_("%B: warning: selected VFP11 erratum "
+ "workaround is not necessary for target architecture"), obfd);
+ }
+ }
+ else if (globals->vfp11_fix == BFD_ARM_VFP11_FIX_DEFAULT)
+ /* For earlier architectures, we might need the workaround, but do not
+ enable it by default. If users is running with broken hardware, they
+ must enable the erratum fix explicitly. */
+ globals->vfp11_fix = BFD_ARM_VFP11_FIX_NONE;
+}
+
+
+enum bfd_arm_vfp11_pipe {
+ VFP11_FMAC,
+ VFP11_LS,
+ VFP11_DS,
+ VFP11_BAD
+};
+
+/* Return a VFP register number. This is encoded as RX:X for single-precision
+ registers, or X:RX for double-precision registers, where RX is the group of
+ four bits in the instruction encoding and X is the single extension bit.
+ RX and X fields are specified using their lowest (starting) bit. The return
+ value is:
+
+ 0...31: single-precision registers s0...s31
+ 32...63: double-precision registers d0...d31.
+
+ Although X should be zero for VFP11 (encoding d0...d15 only), we might
+ encounter VFP3 instructions, so we allow the full range for DP registers. */
+
+static unsigned int
+bfd_arm_vfp11_regno (unsigned int insn, bfd_boolean is_double, unsigned int rx,
+ unsigned int x)
+{
+ if (is_double)
+ return (((insn >> rx) & 0xf) | (((insn >> x) & 1) << 4)) + 32;
+ else
+ return (((insn >> rx) & 0xf) << 1) | ((insn >> x) & 1);
+}
+
+/* Set bits in *WMASK according to a register number REG as encoded by
+ bfd_arm_vfp11_regno(). Ignore d16-d31. */
+
+static void
+bfd_arm_vfp11_write_mask (unsigned int *wmask, unsigned int reg)
+{
+ if (reg < 32)
+ *wmask |= 1 << reg;
+ else if (reg < 48)
+ *wmask |= 3 << ((reg - 32) * 2);
+}
+
+/* Return TRUE if WMASK overwrites anything in REGS. */
+
+static bfd_boolean
+bfd_arm_vfp11_antidependency (unsigned int wmask, int *regs, int numregs)
+{
+ int i;
+
+ for (i = 0; i < numregs; i++)
+ {
+ unsigned int reg = regs[i];
+
+ if (reg < 32 && (wmask & (1 << reg)) != 0)
+ return TRUE;
+
+ reg -= 32;
+
+ if (reg >= 16)
+ continue;
+
+ if ((wmask & (3 << (reg * 2))) != 0)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/* In this function, we're interested in two things: finding input registers
+ for VFP data-processing instructions, and finding the set of registers which
+ arbitrary VFP instructions may write to. We use a 32-bit unsigned int to
+ hold the written set, so FLDM etc. are easy to deal with (we're only
+ interested in 32 SP registers or 16 dp registers, due to the VFP version
+ implemented by the chip in question). DP registers are marked by setting
+ both SP registers in the write mask). */
+
+static enum bfd_arm_vfp11_pipe
+bfd_arm_vfp11_insn_decode (unsigned int insn, unsigned int *destmask, int *regs,
+ int *numregs)
+{
+ enum bfd_arm_vfp11_pipe pipe = VFP11_BAD;
+ bfd_boolean is_double = ((insn & 0xf00) == 0xb00) ? 1 : 0;
+
+ if ((insn & 0x0f000e10) == 0x0e000a00) /* A data-processing insn. */
+ {
+ unsigned int pqrs;
+ unsigned int fd = bfd_arm_vfp11_regno (insn, is_double, 12, 22);
+ unsigned int fm = bfd_arm_vfp11_regno (insn, is_double, 0, 5);
+
+ pqrs = ((insn & 0x00800000) >> 20)
+ | ((insn & 0x00300000) >> 19)
+ | ((insn & 0x00000040) >> 6);
+
+ switch (pqrs)
+ {
+ case 0: /* fmac[sd]. */
+ case 1: /* fnmac[sd]. */
+ case 2: /* fmsc[sd]. */
+ case 3: /* fnmsc[sd]. */
+ pipe = VFP11_FMAC;
+ bfd_arm_vfp11_write_mask (destmask, fd);
+ regs[0] = fd;
+ regs[1] = bfd_arm_vfp11_regno (insn, is_double, 16, 7); /* Fn. */
+ regs[2] = fm;
+ *numregs = 3;
+ break;
+
+ case 4: /* fmul[sd]. */
+ case 5: /* fnmul[sd]. */
+ case 6: /* fadd[sd]. */
+ case 7: /* fsub[sd]. */
+ pipe = VFP11_FMAC;
+ goto vfp_binop;
+
+ case 8: /* fdiv[sd]. */
+ pipe = VFP11_DS;
+ vfp_binop:
+ bfd_arm_vfp11_write_mask (destmask, fd);
+ regs[0] = bfd_arm_vfp11_regno (insn, is_double, 16, 7); /* Fn. */
+ regs[1] = fm;
+ *numregs = 2;
+ break;
+
+ case 15: /* extended opcode. */
+ {
+ unsigned int extn = ((insn >> 15) & 0x1e)
+ | ((insn >> 7) & 1);
+
+ switch (extn)
+ {
+ case 0: /* fcpy[sd]. */
+ case 1: /* fabs[sd]. */
+ case 2: /* fneg[sd]. */
+ case 8: /* fcmp[sd]. */
+ case 9: /* fcmpe[sd]. */
+ case 10: /* fcmpz[sd]. */
+ case 11: /* fcmpez[sd]. */
+ case 16: /* fuito[sd]. */
+ case 17: /* fsito[sd]. */
+ case 24: /* ftoui[sd]. */
+ case 25: /* ftouiz[sd]. */
+ case 26: /* ftosi[sd]. */
+ case 27: /* ftosiz[sd]. */
+ /* These instructions will not bounce due to underflow. */
+ *numregs = 0;
+ pipe = VFP11_FMAC;
+ break;
+
+ case 3: /* fsqrt[sd]. */
+ /* fsqrt cannot underflow, but it can (perhaps) overwrite
+ registers to cause the erratum in previous instructions. */
+ bfd_arm_vfp11_write_mask (destmask, fd);
+ pipe = VFP11_DS;
+ break;
+
+ case 15: /* fcvt{ds,sd}. */
+ {
+ int rnum = 0;
+
+ bfd_arm_vfp11_write_mask (destmask, fd);
+
+ /* Only FCVTSD can underflow. */
+ if ((insn & 0x100) != 0)
+ regs[rnum++] = fm;
+
+ *numregs = rnum;
+
+ pipe = VFP11_FMAC;
+ }
+ break;
+
+ default:
+ return VFP11_BAD;
+ }
+ }
+ break;
+
+ default:
+ return VFP11_BAD;
+ }
+ }
+ /* Two-register transfer. */
+ else if ((insn & 0x0fe00ed0) == 0x0c400a10)
+ {
+ unsigned int fm = bfd_arm_vfp11_regno (insn, is_double, 0, 5);
+
+ if ((insn & 0x100000) == 0)
+ {
+ if (is_double)
+ bfd_arm_vfp11_write_mask (destmask, fm);
+ else
+ {
+ bfd_arm_vfp11_write_mask (destmask, fm);
+ bfd_arm_vfp11_write_mask (destmask, fm + 1);
+ }
+ }
+
+ pipe = VFP11_LS;
+ }
+ else if ((insn & 0x0e100e00) == 0x0c100a00) /* A load insn. */
+ {
+ int fd = bfd_arm_vfp11_regno (insn, is_double, 12, 22);
+ unsigned int puw = ((insn >> 21) & 0x1) | (((insn >> 23) & 3) << 1);
+
+ switch (puw)
+ {
+ case 0: /* Two-reg transfer. We should catch these above. */
+ abort ();
+
+ case 2: /* fldm[sdx]. */
+ case 3:
+ case 5:
+ {
+ unsigned int i, offset = insn & 0xff;
+
+ if (is_double)
+ offset >>= 1;
+
+ for (i = fd; i < fd + offset; i++)
+ bfd_arm_vfp11_write_mask (destmask, i);
+ }
+ break;
+
+ case 4: /* fld[sd]. */
+ case 6:
+ bfd_arm_vfp11_write_mask (destmask, fd);
+ break;
+
+ default:
+ return VFP11_BAD;
+ }
+
+ pipe = VFP11_LS;
+ }
+ /* Single-register transfer. Note L==0. */
+ else if ((insn & 0x0f100e10) == 0x0e000a10)
+ {
+ unsigned int opcode = (insn >> 21) & 7;
+ unsigned int fn = bfd_arm_vfp11_regno (insn, is_double, 16, 7);
+
+ switch (opcode)
+ {
+ case 0: /* fmsr/fmdlr. */
+ case 1: /* fmdhr. */
+ /* Mark fmdhr and fmdlr as writing to the whole of the DP
+ destination register. I don't know if this is exactly right,
+ but it is the conservative choice. */
+ bfd_arm_vfp11_write_mask (destmask, fn);
+ break;
+
+ case 7: /* fmxr. */
+ break;
+ }
+
+ pipe = VFP11_LS;
+ }
+
+ return pipe;
+}
+
+
+static int elf32_arm_compare_mapping (const void * a, const void * b);
+
+
+/* Look for potentially-troublesome code sequences which might trigger the
+ VFP11 denormal/antidependency erratum. See, e.g., the ARM1136 errata sheet
+ (available from ARM) for details of the erratum. A short version is
+ described in ld.texinfo. */
+
+bfd_boolean
+bfd_elf32_arm_vfp11_erratum_scan (bfd *abfd, struct bfd_link_info *link_info)
+{
+ asection *sec;
+ bfd_byte *contents = NULL;
+ int state = 0;
+ int regs[3], numregs = 0;
+ struct elf32_arm_link_hash_table *globals = elf32_arm_hash_table (link_info);
+ int use_vector = (globals->vfp11_fix == BFD_ARM_VFP11_FIX_VECTOR);
+
+ /* We use a simple FSM to match troublesome VFP11 instruction sequences.
+ The states transition as follows:
+
+ 0 -> 1 (vector) or 0 -> 2 (scalar)
+ A VFP FMAC-pipeline instruction has been seen. Fill
+ regs[0]..regs[numregs-1] with its input operands. Remember this
+ instruction in 'first_fmac'.
+
+ 1 -> 2
+ Any instruction, except for a VFP instruction which overwrites
+ regs[*].
+
+ 1 -> 3 [ -> 0 ] or
+ 2 -> 3 [ -> 0 ]
+ A VFP instruction has been seen which overwrites any of regs[*].
+ We must make a veneer! Reset state to 0 before examining next
+ instruction.
+
+ 2 -> 0
+ If we fail to match anything in state 2, reset to state 0 and reset
+ the instruction pointer to the instruction after 'first_fmac'.
+
+ If the VFP11 vector mode is in use, there must be at least two unrelated
+ instructions between anti-dependent VFP11 instructions to properly avoid
+ triggering the erratum, hence the use of the extra state 1.
+ */
+
+ /* If we are only performing a partial link do not bother
+ to construct any glue. */
+ if (link_info->relocatable)
+ return TRUE;
+
+ /* We should have chosen a fix type by the time we get here. */
+ BFD_ASSERT (globals->vfp11_fix != BFD_ARM_VFP11_FIX_DEFAULT);
+
+ if (globals->vfp11_fix == BFD_ARM_VFP11_FIX_NONE)
+ return TRUE;
+
+ /* Skip if this bfd does not correspond to an ELF image. */
+ if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
+ return TRUE;
+
+ for (sec = abfd->sections; sec != NULL; sec = sec->next)
+ {
+ unsigned int i, span, first_fmac = 0, veneer_of_insn = 0;
+ struct _arm_elf_section_data *sec_data;
+
+ /* If we don't have executable progbits, we're not interested in this
+ section. Also skip if section is to be excluded. */
+ if (elf_section_type (sec) != SHT_PROGBITS
+ || (elf_section_flags (sec) & SHF_EXECINSTR) == 0
+ || (sec->flags & SEC_EXCLUDE) != 0
+ || strcmp (sec->name, VFP11_ERRATUM_VENEER_SECTION_NAME) == 0)
+ continue;
+
+ sec_data = elf32_arm_section_data (sec);
+
+ if (sec_data->mapcount == 0)
+ continue;
+
+ if (elf_section_data (sec)->this_hdr.contents != NULL)
+ contents = elf_section_data (sec)->this_hdr.contents;
+ else if (! bfd_malloc_and_get_section (abfd, sec, &contents))
+ goto error_return;
+
+ qsort (sec_data->map, sec_data->mapcount, sizeof (elf32_arm_section_map),
+ elf32_arm_compare_mapping);
+
+ for (span = 0; span < sec_data->mapcount; span++)
+ {
+ unsigned int span_start = sec_data->map[span].vma;
+ unsigned int span_end = (span == sec_data->mapcount - 1)
+ ? sec->size : sec_data->map[span + 1].vma;
+ char span_type = sec_data->map[span].type;
+
+ /* FIXME: Only ARM mode is supported at present. We may need to
+ support Thumb-2 mode also at some point. */
+ if (span_type != 'a')
+ continue;
+
+ for (i = span_start; i < span_end;)
+ {
+ unsigned int next_i = i + 4;
+ unsigned int insn = bfd_big_endian (abfd)
+ ? (contents[i] << 24)
+ | (contents[i + 1] << 16)
+ | (contents[i + 2] << 8)
+ | contents[i + 3]
+ : (contents[i + 3] << 24)
+ | (contents[i + 2] << 16)
+ | (contents[i + 1] << 8)
+ | contents[i];
+ unsigned int writemask = 0;
+ enum bfd_arm_vfp11_pipe pipe;
+
+ switch (state)
+ {
+ case 0:
+ pipe = bfd_arm_vfp11_insn_decode (insn, &writemask, regs,
+ &numregs);
+ /* I'm assuming the VFP11 erratum can trigger with denorm
+ operands on either the FMAC or the DS pipeline. This might
+ lead to slightly overenthusiastic veneer insertion. */
+ if (pipe == VFP11_FMAC || pipe == VFP11_DS)
+ {
+ state = use_vector ? 1 : 2;
+ first_fmac = i;
+ veneer_of_insn = insn;
+ }
+ break;
+
+ case 1:
+ {
+ int other_regs[3], other_numregs;
+ pipe = bfd_arm_vfp11_insn_decode (insn, &writemask,
+ other_regs,
+ &other_numregs);
+ if (pipe != VFP11_BAD
+ && bfd_arm_vfp11_antidependency (writemask, regs,
+ numregs))
+ state = 3;
+ else
+ state = 2;
+ }
+ break;
+
+ case 2:
+ {
+ int other_regs[3], other_numregs;
+ pipe = bfd_arm_vfp11_insn_decode (insn, &writemask,
+ other_regs,
+ &other_numregs);
+ if (pipe != VFP11_BAD
+ && bfd_arm_vfp11_antidependency (writemask, regs,
+ numregs))
+ state = 3;
+ else
+ {
+ state = 0;
+ next_i = first_fmac + 4;
+ }
+ }
+ break;
+
+ case 3:
+ abort (); /* Should be unreachable. */
+ }
+
+ if (state == 3)
+ {
+ elf32_vfp11_erratum_list *newerr
+ = bfd_zmalloc (sizeof (elf32_vfp11_erratum_list));
+ int errcount;
+
+ errcount = ++(elf32_arm_section_data (sec)->erratumcount);
+
+ newerr->u.b.vfp_insn = veneer_of_insn;
+
+ switch (span_type)
+ {
+ case 'a':
+ newerr->type = VFP11_ERRATUM_BRANCH_TO_ARM_VENEER;
+ break;
+
+ default:
+ abort ();
+ }
+
+ record_vfp11_erratum_veneer (link_info, newerr, abfd, sec,
+ first_fmac);
+
+ newerr->vma = -1;
+
+ newerr->next = sec_data->erratumlist;
+ sec_data->erratumlist = newerr;
+
+ state = 0;
+ }
+
+ i = next_i;
+ }
+ }
+
+ if (contents != NULL
+ && elf_section_data (sec)->this_hdr.contents != contents)
+ free (contents);
+ contents = NULL;
+ }
+
+ return TRUE;
+
+error_return:
+ if (contents != NULL
+ && elf_section_data (sec)->this_hdr.contents != contents)
+ free (contents);
+
+ return FALSE;
+}
+
+/* Find virtual-memory addresses for VFP11 erratum veneers and return locations
+ after sections have been laid out, using specially-named symbols. */
+
+void
+bfd_elf32_arm_vfp11_fix_veneer_locations (bfd *abfd,
+ struct bfd_link_info *link_info)
+{
+ asection *sec;
+ struct elf32_arm_link_hash_table *globals;
+ char *tmp_name;
+
+ if (link_info->relocatable)
+ return;
+
+ /* Skip if this bfd does not correspond to an ELF image. */
+ if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
+ return;
+
+ globals = elf32_arm_hash_table (link_info);
+
+ tmp_name = bfd_malloc ((bfd_size_type) strlen
+ (VFP11_ERRATUM_VENEER_ENTRY_NAME) + 10);
+
+ for (sec = abfd->sections; sec != NULL; sec = sec->next)
+ {
+ struct _arm_elf_section_data *sec_data = elf32_arm_section_data (sec);
+ elf32_vfp11_erratum_list *errnode = sec_data->erratumlist;
+
+ for (; errnode != NULL; errnode = errnode->next)
+ {
+ struct elf_link_hash_entry *myh;
+ bfd_vma vma;
+
+ switch (errnode->type)
+ {
+ case VFP11_ERRATUM_BRANCH_TO_ARM_VENEER:
+ case VFP11_ERRATUM_BRANCH_TO_THUMB_VENEER:
+ /* Find veneer symbol. */
+ sprintf (tmp_name, VFP11_ERRATUM_VENEER_ENTRY_NAME,
+ errnode->u.b.veneer->u.v.id);
+
+ myh = elf_link_hash_lookup
+ (&(globals)->root, tmp_name, FALSE, FALSE, TRUE);
+
+ if (myh == NULL)
+ (*_bfd_error_handler) (_("%B: unable to find VFP11 veneer "
+ "`%s'"), abfd, tmp_name);
+
+ vma = myh->root.u.def.section->output_section->vma
+ + myh->root.u.def.section->output_offset
+ + myh->root.u.def.value;
+
+ errnode->u.b.veneer->vma = vma;
+ break;
+
+ case VFP11_ERRATUM_ARM_VENEER:
+ case VFP11_ERRATUM_THUMB_VENEER:
+ /* Find return location. */
+ sprintf (tmp_name, VFP11_ERRATUM_VENEER_ENTRY_NAME "_r",
+ errnode->u.v.id);
+
+ myh = elf_link_hash_lookup
+ (&(globals)->root, tmp_name, FALSE, FALSE, TRUE);
+
+ if (myh == NULL)
+ (*_bfd_error_handler) (_("%B: unable to find VFP11 veneer "
+ "`%s'"), abfd, tmp_name);
+
+ vma = myh->root.u.def.section->output_section->vma
+ + myh->root.u.def.section->output_offset
+ + myh->root.u.def.value;
+
+ errnode->u.v.branch->vma = vma;
+ break;
+
+ default:
+ abort ();
+ }
+ }
+ }
+
+ free (tmp_name);
+}
+
+
/* Set target relocation values needed during linking. */
void
-bfd_elf32_arm_set_target_relocs (struct bfd_link_info *link_info,
+bfd_elf32_arm_set_target_relocs (struct bfd *output_bfd,
+ struct bfd_link_info *link_info,
int target1_is_rel,
char * target2_type,
int fix_v4bx,
- int use_blx)
+ int use_blx,
+ bfd_arm_vfp11_fix vfp11_fix,
+ int no_enum_warn, int pic_veneer)
{
struct elf32_arm_link_hash_table *globals;
@@ -2591,6 +3921,10 @@ bfd_elf32_arm_set_target_relocs (struct bfd_link_info *link_info,
}
globals->fix_v4bx = fix_v4bx;
globals->use_blx |= use_blx;
+ globals->vfp11_fix = vfp11_fix;
+ globals->pic_veneer = pic_veneer;
+
+ elf32_arm_tdata (output_bfd)->no_enum_size_warning = no_enum_warn;
}
/* The thumb form of a long branch is a bit finicky, because the offset
@@ -2647,6 +3981,35 @@ insert_thumb_branch (insn32 br_insn, int rel_off)
return br_insn;
}
+
+/* Store an Arm insn into an output section not processed by
+ elf32_arm_write_section. */
+
+static void
+put_arm_insn (struct elf32_arm_link_hash_table *htab,
+ bfd * output_bfd, bfd_vma val, void * ptr)
+{
+ if (htab->byteswap_code != bfd_little_endian (output_bfd))
+ bfd_putl32 (val, ptr);
+ else
+ bfd_putb32 (val, ptr);
+}
+
+
+/* Store a 16-bit Thumb insn into an output section not processed by
+ elf32_arm_write_section. */
+
+static void
+put_thumb_insn (struct elf32_arm_link_hash_table *htab,
+ bfd * output_bfd, bfd_vma val, void * ptr)
+{
+ if (htab->byteswap_code != bfd_little_endian (output_bfd))
+ bfd_putl16 (val, ptr);
+ else
+ bfd_putb16 (val, ptr);
+}
+
+
/* Thumb code calling an ARM function. */
static int
@@ -2659,7 +4022,8 @@ elf32_thumb_to_arm_stub (struct bfd_link_info * info,
asection * sym_sec,
bfd_vma offset,
bfd_signed_vma addend,
- bfd_vma val)
+ bfd_vma val,
+ char **error_message)
{
asection * s = 0;
bfd_vma my_offset;
@@ -2668,7 +4032,7 @@ elf32_thumb_to_arm_stub (struct bfd_link_info * info,
struct elf_link_hash_entry * myh;
struct elf32_arm_link_hash_table * globals;
- myh = find_thumb_glue (info, name, input_bfd);
+ myh = find_thumb_glue (info, name, error_message);
if (myh == NULL)
return FALSE;
@@ -2703,11 +4067,11 @@ elf32_thumb_to_arm_stub (struct bfd_link_info * info,
--my_offset;
myh->root.u.def.value = my_offset;
- bfd_put_16 (output_bfd, (bfd_vma) t2a1_bx_pc_insn,
- s->contents + my_offset);
+ put_thumb_insn (globals, output_bfd, (bfd_vma) t2a1_bx_pc_insn,
+ s->contents + my_offset);
- bfd_put_16 (output_bfd, (bfd_vma) t2a2_noop_insn,
- s->contents + my_offset + 2);
+ put_thumb_insn (globals, output_bfd, (bfd_vma) t2a2_noop_insn,
+ s->contents + my_offset + 2);
ret_offset =
/* Address of destination of the stub. */
@@ -2725,9 +4089,9 @@ elf32_thumb_to_arm_stub (struct bfd_link_info * info,
/* ARM branches work from the pc of the instruction + 8. */
+ 8);
- bfd_put_32 (output_bfd,
- (bfd_vma) t2a3_b_insn | ((ret_offset >> 2) & 0x00FFFFFF),
- s->contents + my_offset + 4);
+ put_arm_insn (globals, output_bfd,
+ (bfd_vma) t2a3_b_insn | ((ret_offset >> 2) & 0x00FFFFFF),
+ s->contents + my_offset + 4);
}
BFD_ASSERT (my_offset <= globals->thumb_glue_size);
@@ -2754,30 +4118,26 @@ elf32_thumb_to_arm_stub (struct bfd_link_info * info,
return TRUE;
}
-/* Arm code calling a Thumb function. */
+/* Populate an Arm to Thumb stub. Returns the stub symbol. */
-static int
-elf32_arm_to_thumb_stub (struct bfd_link_info * info,
- const char * name,
- bfd * input_bfd,
- bfd * output_bfd,
- asection * input_section,
- bfd_byte * hit_data,
- asection * sym_sec,
- bfd_vma offset,
- bfd_signed_vma addend,
- bfd_vma val)
+static struct elf_link_hash_entry *
+elf32_arm_create_thumb_stub (struct bfd_link_info * info,
+ const char * name,
+ bfd * input_bfd,
+ bfd * output_bfd,
+ asection * sym_sec,
+ bfd_vma val,
+ asection *s,
+ char **error_message)
{
- unsigned long int tmp;
bfd_vma my_offset;
- asection * s;
long int ret_offset;
struct elf_link_hash_entry * myh;
struct elf32_arm_link_hash_table * globals;
- myh = find_arm_glue (info, name, input_bfd);
+ myh = find_arm_glue (info, name, error_message);
if (myh == NULL)
- return FALSE;
+ return NULL;
globals = elf32_arm_hash_table (info);
@@ -2785,11 +4145,6 @@ elf32_arm_to_thumb_stub (struct bfd_link_info * info,
BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
my_offset = myh->root.u.def.value;
- s = bfd_get_section_by_name (globals->bfd_of_glue_owner,
- ARM2THUMB_GLUE_SECTION_NAME);
- BFD_ASSERT (s != NULL);
- BFD_ASSERT (s->contents != NULL);
- BFD_ASSERT (s->output_section != NULL);
if ((my_offset & 0x01) == 0x01)
{
@@ -2806,18 +4161,19 @@ elf32_arm_to_thumb_stub (struct bfd_link_info * info,
--my_offset;
myh->root.u.def.value = my_offset;
- if ((info->shared || globals->root.is_relocatable_executable))
+ if (info->shared || globals->root.is_relocatable_executable
+ || globals->pic_veneer)
{
/* For relocatable objects we can't use absolute addresses,
so construct the address from a relative offset. */
/* TODO: If the offset is small it's probably worth
constructing the address with adds. */
- bfd_put_32 (output_bfd, (bfd_vma) a2t1p_ldr_insn,
- s->contents + my_offset);
- bfd_put_32 (output_bfd, (bfd_vma) a2t2p_add_pc_insn,
- s->contents + my_offset + 4);
- bfd_put_32 (output_bfd, (bfd_vma) a2t3p_bx_r12_insn,
- s->contents + my_offset + 8);
+ put_arm_insn (globals, output_bfd, (bfd_vma) a2t1p_ldr_insn,
+ s->contents + my_offset);
+ put_arm_insn (globals, output_bfd, (bfd_vma) a2t2p_add_pc_insn,
+ s->contents + my_offset + 4);
+ put_arm_insn (globals, output_bfd, (bfd_vma) a2t3p_bx_r12_insn,
+ s->contents + my_offset + 8);
/* Adjust the offset by 4 for the position of the add,
and 8 for the pipeline offset. */
ret_offset = (val - (s->output_offset
@@ -2827,13 +4183,22 @@ elf32_arm_to_thumb_stub (struct bfd_link_info * info,
bfd_put_32 (output_bfd, ret_offset,
s->contents + my_offset + 12);
}
- else
+ else if (globals->use_blx)
{
- bfd_put_32 (output_bfd, (bfd_vma) a2t1_ldr_insn,
- s->contents + my_offset);
+ put_arm_insn (globals, output_bfd, (bfd_vma) a2t1v5_ldr_insn,
+ s->contents + my_offset);
- bfd_put_32 (output_bfd, (bfd_vma) a2t2_bx_r12_insn,
+ /* It's a thumb address. Add the low order bit. */
+ bfd_put_32 (output_bfd, val | a2t2v5_func_addr_insn,
s->contents + my_offset + 4);
+ }
+ else
+ {
+ put_arm_insn (globals, output_bfd, (bfd_vma) a2t1_ldr_insn,
+ s->contents + my_offset);
+
+ put_arm_insn (globals, output_bfd, (bfd_vma) a2t2_bx_r12_insn,
+ s->contents + my_offset + 4);
/* It's a thumb address. Add the low order bit. */
bfd_put_32 (output_bfd, val | a2t3_func_addr_insn,
@@ -2843,6 +4208,48 @@ elf32_arm_to_thumb_stub (struct bfd_link_info * info,
BFD_ASSERT (my_offset <= globals->arm_glue_size);
+ return myh;
+}
+
+/* Arm code calling a Thumb function. */
+
+static int
+elf32_arm_to_thumb_stub (struct bfd_link_info * info,
+ const char * name,
+ bfd * input_bfd,
+ bfd * output_bfd,
+ asection * input_section,
+ bfd_byte * hit_data,
+ asection * sym_sec,
+ bfd_vma offset,
+ bfd_signed_vma addend,
+ bfd_vma val,
+ char **error_message)
+{
+ unsigned long int tmp;
+ bfd_vma my_offset;
+ asection * s;
+ long int ret_offset;
+ struct elf_link_hash_entry * myh;
+ struct elf32_arm_link_hash_table * globals;
+
+ globals = elf32_arm_hash_table (info);
+
+ BFD_ASSERT (globals != NULL);
+ BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
+
+ s = bfd_get_section_by_name (globals->bfd_of_glue_owner,
+ ARM2THUMB_GLUE_SECTION_NAME);
+ BFD_ASSERT (s != NULL);
+ BFD_ASSERT (s->contents != NULL);
+ BFD_ASSERT (s->output_section != NULL);
+
+ myh = elf32_arm_create_thumb_stub (info, name, input_bfd, output_bfd,
+ sym_sec, val, s, error_message);
+ if (!myh)
+ return FALSE;
+
+ my_offset = myh->root.u.def.value;
tmp = bfd_get_32 (input_bfd, hit_data);
tmp = tmp & 0xFF000000;
@@ -2862,6 +4269,70 @@ elf32_arm_to_thumb_stub (struct bfd_link_info * info,
return TRUE;
}
+/* Populate Arm stub for an exported Thumb function. */
+
+static bfd_boolean
+elf32_arm_to_thumb_export_stub (struct elf_link_hash_entry *h, void * inf)
+{
+ struct bfd_link_info * info = (struct bfd_link_info *) inf;
+ asection * s;
+ struct elf_link_hash_entry * myh;
+ struct elf32_arm_link_hash_entry *eh;
+ struct elf32_arm_link_hash_table * globals;
+ asection *sec;
+ bfd_vma val;
+ char *error_message;
+
+ eh = elf32_arm_hash_entry(h);
+ /* Allocate stubs for exported Thumb functions on v4t. */
+ if (eh->export_glue == NULL)
+ return TRUE;
+
+ globals = elf32_arm_hash_table (info);
+
+ BFD_ASSERT (globals != NULL);
+ BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
+
+ s = bfd_get_section_by_name (globals->bfd_of_glue_owner,
+ ARM2THUMB_GLUE_SECTION_NAME);
+ BFD_ASSERT (s != NULL);
+ BFD_ASSERT (s->contents != NULL);
+ BFD_ASSERT (s->output_section != NULL);
+
+ sec = eh->export_glue->root.u.def.section;
+
+ BFD_ASSERT (sec->output_section != NULL);
+
+ val = eh->export_glue->root.u.def.value + sec->output_offset
+ + sec->output_section->vma;
+ myh = elf32_arm_create_thumb_stub (info, h->root.root.string,
+ h->root.u.def.section->owner,
+ globals->obfd, sec, val, s,
+ &error_message);
+ BFD_ASSERT (myh);
+ return TRUE;
+}
+
+/* Generate Arm stubs for exported Thumb symbols. */
+static void
+elf32_arm_begin_write_processing (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *link_info)
+{
+ struct elf32_arm_link_hash_table * globals;
+
+ if (!link_info)
+ return;
+
+ globals = elf32_arm_hash_table (link_info);
+ /* If blx is available then exported Thumb symbols are OK and there is
+ nothing to do. */
+ if (globals->use_blx)
+ return;
+
+ elf_link_hash_traverse (&globals->root, elf32_arm_to_thumb_export_stub,
+ link_info);
+}
+
/* Some relocations map to different relocations depending on the
target. Return the real relocation. */
static int
@@ -2927,6 +4398,83 @@ elf32_arm_abs12_reloc (bfd *abfd, void *data, bfd_vma value)
return bfd_reloc_ok;
}
+/* For a given value of n, calculate the value of G_n as required to
+ deal with group relocations. We return it in the form of an
+ encoded constant-and-rotation, together with the final residual. If n is
+ specified as less than zero, then final_residual is filled with the
+ input value and no further action is performed. */
+
+static bfd_vma
+calculate_group_reloc_mask (bfd_vma value, int n, bfd_vma *final_residual)
+{
+ int current_n;
+ bfd_vma g_n;
+ bfd_vma encoded_g_n = 0;
+ bfd_vma residual = value; /* Also known as Y_n. */
+
+ for (current_n = 0; current_n <= n; current_n++)
+ {
+ int shift;
+
+ /* Calculate which part of the value to mask. */
+ if (residual == 0)
+ shift = 0;
+ else
+ {
+ int msb;
+
+ /* Determine the most significant bit in the residual and
+ align the resulting value to a 2-bit boundary. */
+ for (msb = 30; msb >= 0; msb -= 2)
+ if (residual & (3 << msb))
+ break;
+
+ /* The desired shift is now (msb - 6), or zero, whichever
+ is the greater. */
+ shift = msb - 6;
+ if (shift < 0)
+ shift = 0;
+ }
+
+ /* Calculate g_n in 32-bit as well as encoded constant+rotation form. */
+ g_n = residual & (0xff << shift);
+ encoded_g_n = (g_n >> shift)
+ | ((g_n <= 0xff ? 0 : (32 - shift) / 2) << 8);
+
+ /* Calculate the residual for the next time around. */
+ residual &= ~g_n;
+ }
+
+ *final_residual = residual;
+
+ return encoded_g_n;
+}
+
+/* Given an ARM instruction, determine whether it is an ADD or a SUB.
+ Returns 1 if it is an ADD, -1 if it is a SUB, and 0 otherwise. */
+static int
+identify_add_or_sub(bfd_vma insn)
+{
+ int opcode = insn & 0x1e00000;
+
+ if (opcode == 1 << 23) /* ADD */
+ return 1;
+
+ if (opcode == 1 << 22) /* SUB */
+ return -1;
+
+ return 0;
+}
+
+/* Determine if we're dealing with a Thumb-2 object. */
+
+static int using_thumb2 (struct elf32_arm_link_hash_table *globals)
+{
+ int arch = bfd_elf_get_obj_attr_int (globals->obfd, OBJ_ATTR_PROC,
+ Tag_CPU_arch);
+ return arch == TAG_CPU_ARCH_V6T2 || arch >= TAG_CPU_ARCH_V7;
+}
+
/* Perform a relocation as part of a final link. */
static bfd_reloc_status_type
@@ -2942,7 +4490,8 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
const char * sym_name,
int sym_flags,
struct elf_link_hash_entry * h,
- bfd_boolean * unresolved_reloc_p)
+ bfd_boolean * unresolved_reloc_p,
+ char **error_message)
{
unsigned long r_type = howto->type;
unsigned long r_symndx;
@@ -3019,23 +4568,20 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
case R_ARM_PC24:
case R_ARM_ABS32:
+ case R_ARM_ABS32_NOI:
case R_ARM_REL32:
+ case R_ARM_REL32_NOI:
case R_ARM_CALL:
case R_ARM_JUMP24:
case R_ARM_XPC25:
case R_ARM_PREL31:
case R_ARM_PLT32:
- /* 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)
+ if ((r_type != R_ARM_ABS32 && r_type != R_ARM_REL32
+ && r_type != R_ARM_ABS32_NOI && r_type != R_ARM_REL32_NOI)
&& h != NULL
&& splt != NULL
&& h->plt.offset != (bfd_vma) -1)
@@ -3059,7 +4605,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
run time. */
if ((info->shared || globals->root.is_relocatable_executable)
&& (input_section->flags & SEC_ALLOC)
- && (r_type != R_ARM_REL32
+ && ((r_type != R_ARM_REL32 && r_type != R_ARM_REL32_NOI)
|| !SYMBOL_CALLS_LOCAL (info, h))
&& (h == NULL
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
@@ -3124,6 +4670,8 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
value |= 1;
if (globals->symbian_p)
{
+ asection *osec;
+
/* On Symbian OS, the data segment and text segement
can be relocated independently. Therefore, we
must indicate the segment to which this
@@ -3131,11 +4679,27 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
use any symbol in the right segment; we just use
the section symbol as it is convenient. (We
cannot use the symbol given by "h" directly as it
- will not appear in the dynamic symbol table.) */
+ will not appear in the dynamic symbol table.)
+
+ Note that the dynamic linker ignores the section
+ symbol value, so we don't subtract osec->vma
+ from the emitted reloc addend. */
if (sym_sec)
- symbol = elf_section_data (sym_sec->output_section)->dynindx;
+ osec = sym_sec->output_section;
else
- symbol = elf_section_data (input_section->output_section)->dynindx;
+ osec = input_section->output_section;
+ symbol = elf_section_data (osec)->dynindx;
+ if (symbol == 0)
+ {
+ struct elf_link_hash_table *htab = elf_hash_table (info);
+
+ if ((osec->flags & SEC_READONLY) == 0
+ && htab->data_index_section != NULL)
+ osec = htab->data_index_section;
+ else
+ osec = htab->text_index_section;
+ symbol = elf_section_data (osec)->dynindx;
+ }
BFD_ASSERT (symbol != 0);
}
else
@@ -3190,11 +4754,14 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
/* Check for Arm calling Thumb function. */
if (sym_flags == STT_ARM_TFUNC)
{
- elf32_arm_to_thumb_stub (info, sym_name, input_bfd,
- output_bfd, input_section,
- hit_data, sym_sec, rel->r_offset,
- signed_addend, value);
- return bfd_reloc_ok;
+ if (elf32_arm_to_thumb_stub (info, sym_name, input_bfd,
+ output_bfd, input_section,
+ hit_data, sym_sec, rel->r_offset,
+ signed_addend, value,
+ error_message))
+ return bfd_reloc_ok;
+ else
+ return bfd_reloc_dangerous;
}
}
@@ -3229,40 +4796,43 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
signed_addend = value;
signed_addend >>= howto->rightshift;
- /* It is not an error for an undefined weak reference to be
- out of range. Any program that branches to such a symbol
- is going to crash anyway, so there is no point worrying
- about getting the destination exactly right. */
- if (! h || h->root.type != bfd_link_hash_undefweak)
+ /* A branch to an undefined weak symbol is turned into a jump to
+ the next instruction. */
+ if (h && h->root.type == bfd_link_hash_undefweak)
+ {
+ value = (bfd_get_32 (input_bfd, hit_data) & 0xf0000000)
+ | 0x0affffff;
+ }
+ else
{
/* Perform a signed range check. */
if ( signed_addend > ((bfd_signed_vma) (howto->dst_mask >> 1))
|| signed_addend < - ((bfd_signed_vma) ((howto->dst_mask + 1) >> 1)))
return bfd_reloc_overflow;
- }
- addend = (value & 2);
+ addend = (value & 2);
- value = (signed_addend & howto->dst_mask)
- | (bfd_get_32 (input_bfd, hit_data) & (~ howto->dst_mask));
+ value = (signed_addend & howto->dst_mask)
+ | (bfd_get_32 (input_bfd, hit_data) & (~ howto->dst_mask));
- /* Set the H bit in the BLX instruction. */
- if (sym_flags == STT_ARM_TFUNC)
- {
- if (addend)
- value |= (1 << 24);
- else
- value &= ~(bfd_vma)(1 << 24);
- }
- if (r_type == R_ARM_CALL)
- {
- /* Select the correct instruction (BL or BLX). */
+ /* Set the H bit in the BLX instruction. */
if (sym_flags == STT_ARM_TFUNC)
- value |= (1 << 28);
- else
{
- value &= ~(bfd_vma)(1 << 28);
- value |= (1 << 24);
+ if (addend)
+ value |= (1 << 24);
+ else
+ value &= ~(bfd_vma)(1 << 24);
+ }
+ if (r_type == R_ARM_CALL)
+ {
+ /* Select the correct instruction (BL or BLX). */
+ if (sym_flags == STT_ARM_TFUNC)
+ value |= (1 << 28);
+ else
+ {
+ value &= ~(bfd_vma)(1 << 28);
+ value |= (1 << 24);
+ }
}
}
break;
@@ -3273,6 +4843,10 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
value |= 1;
break;
+ case R_ARM_ABS32_NOI:
+ value += addend;
+ break;
+
case R_ARM_REL32:
value += addend;
if (sym_flags == STT_ARM_TFUNC)
@@ -3281,6 +4855,12 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
+ input_section->output_offset + rel->r_offset);
break;
+ case R_ARM_REL32_NOI:
+ value += addend;
+ value -= (input_section->output_section->vma
+ + input_section->output_offset + rel->r_offset);
+ break;
+
case R_ARM_PREL31:
value -= (input_section->output_section->vma
+ input_section->output_offset + rel->r_offset);
@@ -3338,27 +4918,122 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
bfd_put_16 (input_bfd, value, hit_data);
return bfd_reloc_ok;
+ case R_ARM_THM_ALU_PREL_11_0:
+ /* Corresponds to: addw.w reg, pc, #offset (and similarly for subw). */
+ {
+ bfd_vma insn;
+ bfd_signed_vma relocation;
+
+ insn = (bfd_get_16 (input_bfd, hit_data) << 16)
+ | bfd_get_16 (input_bfd, hit_data + 2);
+
+ if (globals->use_rel)
+ {
+ signed_addend = (insn & 0xff) | ((insn & 0x7000) >> 4)
+ | ((insn & (1 << 26)) >> 15);
+ if (insn & 0xf00000)
+ signed_addend = -signed_addend;
+ }
+
+ relocation = value + signed_addend;
+ relocation -= (input_section->output_section->vma
+ + input_section->output_offset
+ + rel->r_offset);
+
+ value = abs (relocation);
+
+ if (value >= 0x1000)
+ return bfd_reloc_overflow;
+
+ insn = (insn & 0xfb0f8f00) | (value & 0xff)
+ | ((value & 0x700) << 4)
+ | ((value & 0x800) << 15);
+ if (relocation < 0)
+ insn |= 0xa00000;
+
+ bfd_put_16 (input_bfd, insn >> 16, hit_data);
+ bfd_put_16 (input_bfd, insn & 0xffff, hit_data + 2);
+
+ return bfd_reloc_ok;
+ }
+
+ case R_ARM_THM_PC12:
+ /* Corresponds to: ldr.w reg, [pc, #offset]. */
+ {
+ bfd_vma insn;
+ bfd_signed_vma relocation;
+
+ insn = (bfd_get_16 (input_bfd, hit_data) << 16)
+ | bfd_get_16 (input_bfd, hit_data + 2);
+
+ if (globals->use_rel)
+ {
+ signed_addend = insn & 0xfff;
+ if (!(insn & (1 << 23)))
+ signed_addend = -signed_addend;
+ }
+
+ relocation = value + signed_addend;
+ relocation -= (input_section->output_section->vma
+ + input_section->output_offset
+ + rel->r_offset);
+
+ value = abs (relocation);
+
+ if (value >= 0x1000)
+ return bfd_reloc_overflow;
+
+ insn = (insn & 0xff7ff000) | value;
+ if (relocation >= 0)
+ insn |= (1 << 23);
+
+ bfd_put_16 (input_bfd, insn >> 16, hit_data);
+ bfd_put_16 (input_bfd, insn & 0xffff, hit_data + 2);
+
+ return bfd_reloc_ok;
+ }
+
case R_ARM_THM_XPC22:
case R_ARM_THM_CALL:
/* Thumb BL (branch long instruction). */
{
bfd_vma relocation;
+ bfd_vma reloc_sign;
bfd_boolean overflow = FALSE;
bfd_vma upper_insn = bfd_get_16 (input_bfd, hit_data);
bfd_vma lower_insn = bfd_get_16 (input_bfd, hit_data + 2);
- bfd_signed_vma reloc_signed_max = ((1 << (howto->bitsize - 1)) - 1) >> howto->rightshift;
- bfd_signed_vma reloc_signed_min = ~ reloc_signed_max;
+ bfd_signed_vma reloc_signed_max;
+ bfd_signed_vma reloc_signed_min;
bfd_vma check;
bfd_signed_vma signed_check;
+ int bitsize;
+ int thumb2 = using_thumb2 (globals);
+
+ /* A branch to an undefined weak symbol is turned into a jump to
+ the next instruction. */
+ if (h && h->root.type == bfd_link_hash_undefweak)
+ {
+ bfd_put_16 (input_bfd, 0xe000, hit_data);
+ bfd_put_16 (input_bfd, 0xbf00, hit_data + 2);
+ return bfd_reloc_ok;
+ }
- /* Need to refetch the addend and squish the two 11 bit pieces
- together. */
+ /* Fetch the addend. We use the Thumb-2 encoding (backwards compatible
+ with Thumb-1) involving the J1 and J2 bits. */
if (globals->use_rel)
{
- bfd_vma upper = upper_insn & 0x7ff;
- bfd_vma lower = lower_insn & 0x7ff;
- upper = (upper ^ 0x400) - 0x400; /* Sign extend. */
- addend = (upper << 12) | (lower << 1);
+ bfd_vma s = (upper_insn & (1 << 10)) >> 10;
+ bfd_vma upper = upper_insn & 0x3ff;
+ bfd_vma lower = lower_insn & 0x7ff;
+ bfd_vma j1 = (lower_insn & (1 << 13)) >> 13;
+ bfd_vma j2 = (lower_insn & (1 << 11)) >> 11;
+ bfd_vma i1 = j1 ^ s ? 0 : 1;
+ bfd_vma i2 = j2 ^ s ? 0 : 1;
+
+ addend = (i1 << 23) | (i2 << 22) | (upper << 12) | (lower << 1);
+ /* Sign extend. */
+ addend = (addend | ((s ? 0 : 1) << 24)) - (1 << 24);
+
signed_addend = addend;
}
@@ -3390,7 +5065,8 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
}
else if (elf32_thumb_to_arm_stub
(info, sym_name, input_bfd, output_bfd, input_section,
- hit_data, sym_sec, rel->r_offset, signed_addend, value))
+ hit_data, sym_sec, rel->r_offset, signed_addend, value,
+ error_message))
return bfd_reloc_ok;
else
return bfd_reloc_dangerous;
@@ -3435,6 +5111,15 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
else
signed_check = check | ~((bfd_vma) -1 >> howto->rightshift);
+ /* Calculate the permissable maximum and minimum values for
+ this relocation according to whether we're relocating for
+ Thumb-2 or not. */
+ bitsize = howto->bitsize;
+ if (!thumb2)
+ bitsize -= 2;
+ reloc_signed_max = ((1 << (bitsize - 1)) - 1) >> howto->rightshift;
+ reloc_signed_min = ~reloc_signed_max;
+
/* Assumes two's complement. */
if (signed_check > reloc_signed_max || signed_check < reloc_signed_min)
overflow = TRUE;
@@ -3446,9 +5131,17 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
1 of the base address. */
relocation = (relocation + 2) & ~ 3;
- /* Put RELOCATION back into the insn. */
- upper_insn = (upper_insn & ~(bfd_vma) 0x7ff) | ((relocation >> 12) & 0x7ff);
- lower_insn = (lower_insn & ~(bfd_vma) 0x7ff) | ((relocation >> 1) & 0x7ff);
+ /* Put RELOCATION back into the insn. Assumes two's complement.
+ We use the Thumb-2 encoding, which is safe even if dealing with
+ a Thumb-1 instruction by virtue of our overflow check above. */
+ reloc_sign = (signed_check < 0) ? 1 : 0;
+ upper_insn = (upper_insn & ~(bfd_vma) 0x7ff)
+ | ((relocation >> 12) & 0x3ff)
+ | (reloc_sign << 10);
+ lower_insn = (lower_insn & ~(bfd_vma) 0x2fff)
+ | (((!((relocation >> 23) & 1)) ^ reloc_sign) << 13)
+ | (((!((relocation >> 22) & 1)) ^ reloc_sign) << 11)
+ | ((relocation >> 1) & 0x7ff);
/* Put the relocated value back in the object file: */
bfd_put_16 (input_bfd, upper_insn, hit_data);
@@ -3538,9 +5231,8 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
bfd_boolean overflow = FALSE;
bfd_vma upper_insn = bfd_get_16 (input_bfd, hit_data);
bfd_vma lower_insn = bfd_get_16 (input_bfd, hit_data + 2);
- bfd_signed_vma reloc_signed_max = ((1 << (howto->bitsize - 1)) - 1) >> howto->rightshift;
- bfd_signed_vma reloc_signed_min = ~ reloc_signed_max;
- bfd_vma check;
+ bfd_signed_vma reloc_signed_max = 0xffffe;
+ bfd_signed_vma reloc_signed_min = -0x100000;
bfd_signed_vma signed_check;
/* Need to refetch the addend, reconstruct the top three bits,
@@ -3548,14 +5240,14 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
if (globals->use_rel)
{
bfd_vma S = (upper_insn & 0x0400) >> 10;
- bfd_vma upper = (upper_insn & 0x001f);
+ bfd_vma upper = (upper_insn & 0x003f);
bfd_vma J1 = (lower_insn & 0x2000) >> 13;
bfd_vma J2 = (lower_insn & 0x0800) >> 11;
bfd_vma lower = (lower_insn & 0x07ff);
- upper |= J2 << 6;
- upper |= J1 << 7;
- upper |= ~S << 8;
+ upper |= J1 << 6;
+ upper |= J2 << 7;
+ upper |= (!S) << 8;
upper -= 0x0100; /* Sign extend. */
addend = (upper << 12) | (lower << 1);
@@ -3569,17 +5261,8 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
relocation -= (input_section->output_section->vma
+ input_section->output_offset
+ rel->r_offset);
+ signed_check = (bfd_signed_vma) relocation;
- check = relocation >> howto->rightshift;
-
- /* If this is a signed value, the rightshift just dropped
- leading 1 bits (assuming twos complement). */
- if ((bfd_signed_vma) relocation >= 0)
- signed_check = check;
- else
- signed_check = check | ~((bfd_vma) -1 >> howto->rightshift);
-
- /* Assumes two's complement. */
if (signed_check > reloc_signed_max || signed_check < reloc_signed_min)
overflow = TRUE;
@@ -3591,7 +5274,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
bfd_vma hi = (relocation & 0x0003f000) >> 12;
bfd_vma lo = (relocation & 0x00000ffe) >> 1;
- upper_insn = (upper_insn & 0xfb30) | (S << 10) | hi;
+ upper_insn = (upper_insn & 0xfbc0) | (S << 10) | hi;
lower_insn = (lower_insn & 0xd000) | (J1 << 13) | (J2 << 11) | lo;
}
@@ -4080,199 +5763,499 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
}
return bfd_reloc_ok;
- default:
- return bfd_reloc_notsupported;
- }
-}
+ case R_ARM_MOVW_ABS_NC:
+ case R_ARM_MOVT_ABS:
+ case R_ARM_MOVW_PREL_NC:
+ case R_ARM_MOVT_PREL:
+ /* Until we properly support segment-base-relative addressing then
+ we assume the segment base to be zero, as for the group relocations.
+ Thus R_ARM_MOVW_BREL_NC has the same semantics as R_ARM_MOVW_ABS_NC
+ and R_ARM_MOVT_BREL has the same semantics as R_ARM_MOVT_ABS. */
+ case R_ARM_MOVW_BREL_NC:
+ case R_ARM_MOVW_BREL:
+ case R_ARM_MOVT_BREL:
+ {
+ bfd_vma insn = bfd_get_32 (input_bfd, hit_data);
+ if (globals->use_rel)
+ {
+ addend = ((insn >> 4) & 0xf000) | (insn & 0xfff);
+ signed_addend = (addend ^ 0x10000) - 0x10000;
+ }
-static int
-uleb128_size (unsigned int i)
-{
- int size;
- size = 1;
- while (i >= 0x80)
- {
- i >>= 7;
- size++;
- }
- return size;
-}
+ value += signed_addend;
-/* Return TRUE if the attribute has the default value (0/""). */
-static bfd_boolean
-is_default_attr (aeabi_attribute *attr)
-{
- if ((attr->type & 1) && attr->i != 0)
- return FALSE;
- if ((attr->type & 2) && attr->s && *attr->s)
- return FALSE;
+ if (r_type == R_ARM_MOVW_PREL_NC || r_type == R_ARM_MOVT_PREL)
+ value -= (input_section->output_section->vma
+ + input_section->output_offset + rel->r_offset);
- return TRUE;
-}
+ if (r_type == R_ARM_MOVW_BREL && value >= 0x10000)
+ return bfd_reloc_overflow;
-/* Return the size of a single attribute. */
-static bfd_vma
-eabi_attr_size(int tag, aeabi_attribute *attr)
-{
- bfd_vma size;
+ if (sym_flags == STT_ARM_TFUNC)
+ value |= 1;
- if (is_default_attr (attr))
- return 0;
+ if (r_type == R_ARM_MOVT_ABS || r_type == R_ARM_MOVT_PREL
+ || r_type == R_ARM_MOVT_BREL)
+ value >>= 16;
- size = uleb128_size (tag);
- if (attr->type & 1)
- size += uleb128_size (attr->i);
- if (attr->type & 2)
- size += strlen ((char *)attr->s) + 1;
- return size;
-}
-
-/* Returns the size of the eabi object attributess section. */
-bfd_vma
-elf32_arm_eabi_attr_size (bfd *abfd)
-{
- bfd_vma size;
- aeabi_attribute *attr;
- aeabi_attribute_list *list;
- int i;
+ insn &= 0xfff0f000;
+ insn |= value & 0xfff;
+ insn |= (value & 0xf000) << 4;
+ bfd_put_32 (input_bfd, insn, hit_data);
+ }
+ return bfd_reloc_ok;
+
+ case R_ARM_THM_MOVW_ABS_NC:
+ case R_ARM_THM_MOVT_ABS:
+ case R_ARM_THM_MOVW_PREL_NC:
+ case R_ARM_THM_MOVT_PREL:
+ /* Until we properly support segment-base-relative addressing then
+ we assume the segment base to be zero, as for the above relocations.
+ Thus R_ARM_THM_MOVW_BREL_NC has the same semantics as
+ R_ARM_THM_MOVW_ABS_NC and R_ARM_THM_MOVT_BREL has the same semantics
+ as R_ARM_THM_MOVT_ABS. */
+ case R_ARM_THM_MOVW_BREL_NC:
+ case R_ARM_THM_MOVW_BREL:
+ case R_ARM_THM_MOVT_BREL:
+ {
+ bfd_vma insn;
+
+ insn = bfd_get_16 (input_bfd, hit_data) << 16;
+ insn |= bfd_get_16 (input_bfd, hit_data + 2);
- attr = elf32_arm_tdata (abfd)->known_eabi_attributes;
- size = 16; /* 'A' <size> "aeabi" 0x1 <size>. */
- for (i = 4; i < NUM_KNOWN_ATTRIBUTES; i++)
- size += eabi_attr_size (i, &attr[i]);
+ if (globals->use_rel)
+ {
+ addend = ((insn >> 4) & 0xf000)
+ | ((insn >> 15) & 0x0800)
+ | ((insn >> 4) & 0x0700)
+ | (insn & 0x00ff);
+ signed_addend = (addend ^ 0x10000) - 0x10000;
+ }
- for (list = elf32_arm_tdata (abfd)->other_eabi_attributes;
- list;
- list = list->next)
- size += eabi_attr_size (list->tag, &list->attr);
+ value += signed_addend;
- return size;
-}
+ if (r_type == R_ARM_THM_MOVW_PREL_NC || r_type == R_ARM_THM_MOVT_PREL)
+ value -= (input_section->output_section->vma
+ + input_section->output_offset + rel->r_offset);
-static bfd_byte *
-write_uleb128 (bfd_byte *p, unsigned int val)
-{
- bfd_byte c;
- do
- {
- c = val & 0x7f;
- val >>= 7;
- if (val)
- c |= 0x80;
- *(p++) = c;
- }
- while (val);
- return p;
-}
+ if (r_type == R_ARM_THM_MOVW_BREL && value >= 0x10000)
+ return bfd_reloc_overflow;
-/* Write attribute ATTR to butter P, and return a pointer to the following
- byte. */
-static bfd_byte *
-write_eabi_attribute (bfd_byte *p, int tag, aeabi_attribute *attr)
-{
- /* Suppress default entries. */
- if (is_default_attr(attr))
- return p;
-
- p = write_uleb128 (p, tag);
- if (attr->type & 1)
- p = write_uleb128 (p, attr->i);
- if (attr->type & 2)
- {
- int len;
+ if (sym_flags == STT_ARM_TFUNC)
+ value |= 1;
- len = strlen (attr->s) + 1;
- memcpy (p, attr->s, len);
- p += len;
- }
+ if (r_type == R_ARM_THM_MOVT_ABS || r_type == R_ARM_THM_MOVT_PREL
+ || r_type == R_ARM_THM_MOVT_BREL)
+ value >>= 16;
- return p;
-}
+ insn &= 0xfbf08f00;
+ insn |= (value & 0xf000) << 4;
+ insn |= (value & 0x0800) << 15;
+ insn |= (value & 0x0700) << 4;
+ insn |= (value & 0x00ff);
-/* Write the contents of the eabi attributes section to p. */
-void
-elf32_arm_set_eabi_attr_contents (bfd *abfd, bfd_byte *contents, bfd_vma size)
-{
- bfd_byte *p;
- aeabi_attribute *attr;
- aeabi_attribute_list *list;
- int i;
+ bfd_put_16 (input_bfd, insn >> 16, hit_data);
+ bfd_put_16 (input_bfd, insn & 0xffff, hit_data + 2);
+ }
+ return bfd_reloc_ok;
- p = contents;
- *(p++) = 'A';
- bfd_put_32 (abfd, size - 1, p);
- p += 4;
- memcpy (p, "aeabi", 6);
- p += 6;
- *(p++) = Tag_File;
- bfd_put_32 (abfd, size - 11, p);
- p += 4;
-
- attr = elf32_arm_tdata (abfd)->known_eabi_attributes;
- for (i = 4; i < NUM_KNOWN_ATTRIBUTES; i++)
- p = write_eabi_attribute (p, i, &attr[i]);
-
- for (list = elf32_arm_tdata (abfd)->other_eabi_attributes;
- list;
- list = list->next)
- p = write_eabi_attribute (p, list->tag, &list->attr);
-}
+ case R_ARM_ALU_PC_G0_NC:
+ case R_ARM_ALU_PC_G1_NC:
+ case R_ARM_ALU_PC_G0:
+ case R_ARM_ALU_PC_G1:
+ case R_ARM_ALU_PC_G2:
+ case R_ARM_ALU_SB_G0_NC:
+ case R_ARM_ALU_SB_G1_NC:
+ case R_ARM_ALU_SB_G0:
+ case R_ARM_ALU_SB_G1:
+ case R_ARM_ALU_SB_G2:
+ {
+ bfd_vma insn = bfd_get_32 (input_bfd, hit_data);
+ bfd_vma pc = input_section->output_section->vma
+ + input_section->output_offset + rel->r_offset;
+ /* sb should be the origin of the *segment* containing the symbol.
+ It is not clear how to obtain this OS-dependent value, so we
+ make an arbitrary choice of zero. */
+ bfd_vma sb = 0;
+ bfd_vma residual;
+ bfd_vma g_n;
+ bfd_signed_vma signed_value;
+ int group = 0;
+
+ /* Determine which group of bits to select. */
+ switch (r_type)
+ {
+ case R_ARM_ALU_PC_G0_NC:
+ case R_ARM_ALU_PC_G0:
+ case R_ARM_ALU_SB_G0_NC:
+ case R_ARM_ALU_SB_G0:
+ group = 0;
+ break;
+
+ case R_ARM_ALU_PC_G1_NC:
+ case R_ARM_ALU_PC_G1:
+ case R_ARM_ALU_SB_G1_NC:
+ case R_ARM_ALU_SB_G1:
+ group = 1;
+ break;
+
+ case R_ARM_ALU_PC_G2:
+ case R_ARM_ALU_SB_G2:
+ group = 2;
+ break;
+
+ default:
+ abort();
+ }
-/* Override final_link to handle EABI object attribute sections. */
+ /* If REL, extract the addend from the insn. If RELA, it will
+ have already been fetched for us. */
+ if (globals->use_rel)
+ {
+ int negative;
+ bfd_vma constant = insn & 0xff;
+ bfd_vma rotation = (insn & 0xf00) >> 8;
+
+ if (rotation == 0)
+ signed_addend = constant;
+ else
+ {
+ /* Compensate for the fact that in the instruction, the
+ rotation is stored in multiples of 2 bits. */
+ rotation *= 2;
+
+ /* Rotate "constant" right by "rotation" bits. */
+ signed_addend = (constant >> rotation) |
+ (constant << (8 * sizeof (bfd_vma) - rotation));
+ }
+
+ /* Determine if the instruction is an ADD or a SUB.
+ (For REL, this determines the sign of the addend.) */
+ negative = identify_add_or_sub (insn);
+ if (negative == 0)
+ {
+ (*_bfd_error_handler)
+ (_("%B(%A+0x%lx): Only ADD or SUB instructions are allowed for ALU group relocations"),
+ input_bfd, input_section,
+ (long) rel->r_offset, howto->name);
+ return bfd_reloc_overflow;
+ }
+
+ signed_addend *= negative;
+ }
-static bfd_boolean
-elf32_arm_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
-{
- asection *o;
- struct bfd_link_order *p;
- asection *attr_section = NULL;
- bfd_byte *contents;
- bfd_vma size = 0;
-
- /* elf32_arm_merge_private_bfd_data will already have merged the
- object attributes. Remove the input sections from the link, and set
- the contents of the output secton. */
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- if (strcmp (o->name, ".ARM.attributes") == 0)
- {
- for (p = o->map_head.link_order; p != NULL; p = p->next)
- {
- asection *input_section;
-
- if (p->type != bfd_indirect_link_order)
- continue;
- input_section = p->u.indirect.section;
- /* Hack: reset the SEC_HAS_CONTENTS flag so that
- elf_link_input_bfd ignores this section. */
- input_section->flags &= ~SEC_HAS_CONTENTS;
- }
-
- size = elf32_arm_eabi_attr_size (abfd);
- bfd_set_section_size (abfd, o, size);
- attr_section = o;
- /* Skip this section later on. */
- o->map_head.link_order = NULL;
- }
- }
- /* Invoke the ELF linker to do all the work. */
- if (!bfd_elf_final_link (abfd, info))
- return FALSE;
+ /* Compute the value (X) to go in the place. */
+ if (r_type == R_ARM_ALU_PC_G0_NC
+ || r_type == R_ARM_ALU_PC_G1_NC
+ || r_type == R_ARM_ALU_PC_G0
+ || r_type == R_ARM_ALU_PC_G1
+ || r_type == R_ARM_ALU_PC_G2)
+ /* PC relative. */
+ signed_value = value - pc + signed_addend;
+ else
+ /* Section base relative. */
+ signed_value = value - sb + signed_addend;
+
+ /* If the target symbol is a Thumb function, then set the
+ Thumb bit in the address. */
+ if (sym_flags == STT_ARM_TFUNC)
+ signed_value |= 1;
+
+ /* Calculate the value of the relevant G_n, in encoded
+ constant-with-rotation format. */
+ g_n = calculate_group_reloc_mask (abs (signed_value), group,
+ &residual);
+
+ /* Check for overflow if required. */
+ if ((r_type == R_ARM_ALU_PC_G0
+ || r_type == R_ARM_ALU_PC_G1
+ || r_type == R_ARM_ALU_PC_G2
+ || r_type == R_ARM_ALU_SB_G0
+ || r_type == R_ARM_ALU_SB_G1
+ || r_type == R_ARM_ALU_SB_G2) && residual != 0)
+ {
+ (*_bfd_error_handler)
+ (_("%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s"),
+ input_bfd, input_section,
+ (long) rel->r_offset, abs (signed_value), howto->name);
+ return bfd_reloc_overflow;
+ }
- if (attr_section)
- {
- contents = bfd_malloc(size);
- if (contents == NULL)
- return FALSE;
- elf32_arm_set_eabi_attr_contents (abfd, contents, size);
- bfd_set_section_contents (abfd, attr_section, contents, 0, size);
- free (contents);
+ /* Mask out the value and the ADD/SUB part of the opcode; take care
+ not to destroy the S bit. */
+ insn &= 0xff1ff000;
+
+ /* Set the opcode according to whether the value to go in the
+ place is negative. */
+ if (signed_value < 0)
+ insn |= 1 << 22;
+ else
+ insn |= 1 << 23;
+
+ /* Encode the offset. */
+ insn |= g_n;
+
+ bfd_put_32 (input_bfd, insn, hit_data);
+ }
+ return bfd_reloc_ok;
+
+ case R_ARM_LDR_PC_G0:
+ case R_ARM_LDR_PC_G1:
+ case R_ARM_LDR_PC_G2:
+ case R_ARM_LDR_SB_G0:
+ case R_ARM_LDR_SB_G1:
+ case R_ARM_LDR_SB_G2:
+ {
+ bfd_vma insn = bfd_get_32 (input_bfd, hit_data);
+ bfd_vma pc = input_section->output_section->vma
+ + input_section->output_offset + rel->r_offset;
+ bfd_vma sb = 0; /* See note above. */
+ bfd_vma residual;
+ bfd_signed_vma signed_value;
+ int group = 0;
+
+ /* Determine which groups of bits to calculate. */
+ switch (r_type)
+ {
+ case R_ARM_LDR_PC_G0:
+ case R_ARM_LDR_SB_G0:
+ group = 0;
+ break;
+
+ case R_ARM_LDR_PC_G1:
+ case R_ARM_LDR_SB_G1:
+ group = 1;
+ break;
+
+ case R_ARM_LDR_PC_G2:
+ case R_ARM_LDR_SB_G2:
+ group = 2;
+ break;
+
+ default:
+ abort();
+ }
+
+ /* If REL, extract the addend from the insn. If RELA, it will
+ have already been fetched for us. */
+ if (globals->use_rel)
+ {
+ int negative = (insn & (1 << 23)) ? 1 : -1;
+ signed_addend = negative * (insn & 0xfff);
+ }
+
+ /* Compute the value (X) to go in the place. */
+ if (r_type == R_ARM_LDR_PC_G0
+ || r_type == R_ARM_LDR_PC_G1
+ || r_type == R_ARM_LDR_PC_G2)
+ /* PC relative. */
+ signed_value = value - pc + signed_addend;
+ else
+ /* Section base relative. */
+ signed_value = value - sb + signed_addend;
+
+ /* Calculate the value of the relevant G_{n-1} to obtain
+ the residual at that stage. */
+ calculate_group_reloc_mask (abs (signed_value), group - 1, &residual);
+
+ /* Check for overflow. */
+ if (residual >= 0x1000)
+ {
+ (*_bfd_error_handler)
+ (_("%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s"),
+ input_bfd, input_section,
+ (long) rel->r_offset, abs (signed_value), howto->name);
+ return bfd_reloc_overflow;
+ }
+
+ /* Mask out the value and U bit. */
+ insn &= 0xff7ff000;
+
+ /* Set the U bit if the value to go in the place is non-negative. */
+ if (signed_value >= 0)
+ insn |= 1 << 23;
+
+ /* Encode the offset. */
+ insn |= residual;
+
+ bfd_put_32 (input_bfd, insn, hit_data);
+ }
+ return bfd_reloc_ok;
+
+ case R_ARM_LDRS_PC_G0:
+ case R_ARM_LDRS_PC_G1:
+ case R_ARM_LDRS_PC_G2:
+ case R_ARM_LDRS_SB_G0:
+ case R_ARM_LDRS_SB_G1:
+ case R_ARM_LDRS_SB_G2:
+ {
+ bfd_vma insn = bfd_get_32 (input_bfd, hit_data);
+ bfd_vma pc = input_section->output_section->vma
+ + input_section->output_offset + rel->r_offset;
+ bfd_vma sb = 0; /* See note above. */
+ bfd_vma residual;
+ bfd_signed_vma signed_value;
+ int group = 0;
+
+ /* Determine which groups of bits to calculate. */
+ switch (r_type)
+ {
+ case R_ARM_LDRS_PC_G0:
+ case R_ARM_LDRS_SB_G0:
+ group = 0;
+ break;
+
+ case R_ARM_LDRS_PC_G1:
+ case R_ARM_LDRS_SB_G1:
+ group = 1;
+ break;
+
+ case R_ARM_LDRS_PC_G2:
+ case R_ARM_LDRS_SB_G2:
+ group = 2;
+ break;
+
+ default:
+ abort();
+ }
+
+ /* If REL, extract the addend from the insn. If RELA, it will
+ have already been fetched for us. */
+ if (globals->use_rel)
+ {
+ int negative = (insn & (1 << 23)) ? 1 : -1;
+ signed_addend = negative * (((insn & 0xf00) >> 4) + (insn & 0xf));
+ }
+
+ /* Compute the value (X) to go in the place. */
+ if (r_type == R_ARM_LDRS_PC_G0
+ || r_type == R_ARM_LDRS_PC_G1
+ || r_type == R_ARM_LDRS_PC_G2)
+ /* PC relative. */
+ signed_value = value - pc + signed_addend;
+ else
+ /* Section base relative. */
+ signed_value = value - sb + signed_addend;
+
+ /* Calculate the value of the relevant G_{n-1} to obtain
+ the residual at that stage. */
+ calculate_group_reloc_mask (abs (signed_value), group - 1, &residual);
+
+ /* Check for overflow. */
+ if (residual >= 0x100)
+ {
+ (*_bfd_error_handler)
+ (_("%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s"),
+ input_bfd, input_section,
+ (long) rel->r_offset, abs (signed_value), howto->name);
+ return bfd_reloc_overflow;
+ }
+
+ /* Mask out the value and U bit. */
+ insn &= 0xff7ff0f0;
+
+ /* Set the U bit if the value to go in the place is non-negative. */
+ if (signed_value >= 0)
+ insn |= 1 << 23;
+
+ /* Encode the offset. */
+ insn |= ((residual & 0xf0) << 4) | (residual & 0xf);
+
+ bfd_put_32 (input_bfd, insn, hit_data);
+ }
+ return bfd_reloc_ok;
+
+ case R_ARM_LDC_PC_G0:
+ case R_ARM_LDC_PC_G1:
+ case R_ARM_LDC_PC_G2:
+ case R_ARM_LDC_SB_G0:
+ case R_ARM_LDC_SB_G1:
+ case R_ARM_LDC_SB_G2:
+ {
+ bfd_vma insn = bfd_get_32 (input_bfd, hit_data);
+ bfd_vma pc = input_section->output_section->vma
+ + input_section->output_offset + rel->r_offset;
+ bfd_vma sb = 0; /* See note above. */
+ bfd_vma residual;
+ bfd_signed_vma signed_value;
+ int group = 0;
+
+ /* Determine which groups of bits to calculate. */
+ switch (r_type)
+ {
+ case R_ARM_LDC_PC_G0:
+ case R_ARM_LDC_SB_G0:
+ group = 0;
+ break;
+
+ case R_ARM_LDC_PC_G1:
+ case R_ARM_LDC_SB_G1:
+ group = 1;
+ break;
+
+ case R_ARM_LDC_PC_G2:
+ case R_ARM_LDC_SB_G2:
+ group = 2;
+ break;
+
+ default:
+ abort();
+ }
+
+ /* If REL, extract the addend from the insn. If RELA, it will
+ have already been fetched for us. */
+ if (globals->use_rel)
+ {
+ int negative = (insn & (1 << 23)) ? 1 : -1;
+ signed_addend = negative * ((insn & 0xff) << 2);
+ }
+
+ /* Compute the value (X) to go in the place. */
+ if (r_type == R_ARM_LDC_PC_G0
+ || r_type == R_ARM_LDC_PC_G1
+ || r_type == R_ARM_LDC_PC_G2)
+ /* PC relative. */
+ signed_value = value - pc + signed_addend;
+ else
+ /* Section base relative. */
+ signed_value = value - sb + signed_addend;
+
+ /* Calculate the value of the relevant G_{n-1} to obtain
+ the residual at that stage. */
+ calculate_group_reloc_mask (abs (signed_value), group - 1, &residual);
+
+ /* Check for overflow. (The absolute value to go in the place must be
+ divisible by four and, after having been divided by four, must
+ fit in eight bits.) */
+ if ((residual & 0x3) != 0 || residual >= 0x400)
+ {
+ (*_bfd_error_handler)
+ (_("%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s"),
+ input_bfd, input_section,
+ (long) rel->r_offset, abs (signed_value), howto->name);
+ return bfd_reloc_overflow;
+ }
+
+ /* Mask out the value and U bit. */
+ insn &= 0xff7fff00;
+
+ /* Set the U bit if the value to go in the place is non-negative. */
+ if (signed_value >= 0)
+ insn |= 1 << 23;
+
+ /* Encode the offset. */
+ insn |= residual >> 2;
+
+ bfd_put_32 (input_bfd, insn, hit_data);
+ }
+ return bfd_reloc_ok;
+
+ default:
+ return bfd_reloc_notsupported;
}
- return TRUE;
}
-
/* Add INCREMENT to the reloc (of type HOWTO) at ADDRESS. */
static void
arm_add_to_rel (bfd * abfd,
@@ -4375,8 +6358,6 @@ elf32_arm_relocate_section (bfd * output_bfd,
struct elf32_arm_link_hash_table * globals;
globals = elf32_arm_hash_table (info);
- if (info->relocatable && !globals->use_rel)
- return TRUE;
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
@@ -4396,6 +6377,7 @@ elf32_arm_relocate_section (bfd * output_bfd,
arelent bfd_reloc;
char sym_type;
bfd_boolean unresolved_reloc = FALSE;
+ char *error_message = NULL;
r_symndx = ELF32_R_SYM (rel->r_info);
r_type = ELF32_R_TYPE (rel->r_info);
@@ -4408,29 +6390,6 @@ elf32_arm_relocate_section (bfd * output_bfd,
bfd_reloc.howto = elf32_arm_howto_from_type (r_type);
howto = bfd_reloc.howto;
- if (info->relocatable && globals->use_rel)
- {
- /* This is a relocatable link. We don't have to change
- anything, unless the reloc is against a section symbol,
- in which case we have to adjust according to where the
- section symbol winds up in the output section. */
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
- if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
- {
- sec = local_sections[r_symndx];
- arm_add_to_rel (input_bfd, contents + rel->r_offset,
- howto,
- (bfd_signed_vma) (sec->output_offset
- + sym->st_value));
- }
- }
-
- continue;
- }
-
- /* This is a final link. */
h = NULL;
sym = NULL;
sec = NULL;
@@ -4445,8 +6404,9 @@ elf32_arm_relocate_section (bfd * output_bfd,
relocation = (sec->output_section->vma
+ sec->output_offset
+ sym->st_value);
- if ((sec->flags & SEC_MERGE)
- && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ if (!info->relocatable
+ && (sec->flags & SEC_MERGE)
+ && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
{
asection *msec;
bfd_vma addend, value;
@@ -4496,6 +6456,34 @@ elf32_arm_relocate_section (bfd * output_bfd,
sym_type = h->type;
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ {
+ /* This is a relocatable link. We don't have to change
+ anything, unless the reloc is against a section symbol,
+ in which case we have to adjust according to where the
+ section symbol winds up in the output section. */
+ if (sym != NULL && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ {
+ if (globals->use_rel)
+ arm_add_to_rel (input_bfd, contents + rel->r_offset,
+ howto, (bfd_signed_vma) sec->output_offset);
+ else
+ rel->r_addend += sec->output_offset;
+ }
+ continue;
+ }
+
if (h != NULL)
name = h->root.root.string;
else
@@ -4529,7 +6517,7 @@ elf32_arm_relocate_section (bfd * output_bfd,
relocation, info, sec, name,
(h ? ELF_ST_TYPE (h->type) :
ELF_ST_TYPE (sym->st_info)), h,
- &unresolved_reloc);
+ &unresolved_reloc, &error_message);
/* Dynamic relocs are not propagated for SEC_DEBUGGING sections
because such sections are not SEC_ALLOC and thus ld.so will
@@ -4550,8 +6538,6 @@ elf32_arm_relocate_section (bfd * output_bfd,
if (r != bfd_reloc_ok)
{
- const char * msg = (const char *) 0;
-
switch (r)
{
case bfd_reloc_overflow:
@@ -4575,24 +6561,25 @@ elf32_arm_relocate_section (bfd * output_bfd,
break;
case bfd_reloc_outofrange:
- msg = _("internal error: out of range error");
+ error_message = _("out of range");
goto common_error;
case bfd_reloc_notsupported:
- msg = _("internal error: unsupported relocation error");
+ error_message = _("unsupported relocation");
goto common_error;
case bfd_reloc_dangerous:
- msg = _("internal error: dangerous error");
+ /* error_message should already be set. */
goto common_error;
default:
- msg = _("internal error: unknown error");
+ error_message = _("unknown error");
/* fall through */
common_error:
- if (!((*info->callbacks->warning)
- (info, msg, name, input_bfd, input_section,
+ BFD_ASSERT (error_message != NULL);
+ if (!((*info->callbacks->reloc_dangerous)
+ (info, error_message, input_bfd, input_section,
rel->r_offset)))
return FALSE;
break;
@@ -4603,130 +6590,6 @@ elf32_arm_relocate_section (bfd * output_bfd,
return TRUE;
}
-/* Allocate/find an object attribute. */
-static aeabi_attribute *
-elf32_arm_new_eabi_attr (bfd *abfd, int tag)
-{
- aeabi_attribute *attr;
- aeabi_attribute_list *list;
- aeabi_attribute_list *p;
- aeabi_attribute_list **lastp;
-
-
- if (tag < NUM_KNOWN_ATTRIBUTES)
- {
- /* Knwon tags are preallocated. */
- attr = &elf32_arm_tdata (abfd)->known_eabi_attributes[tag];
- }
- else
- {
- /* Create a new tag. */
- list = (aeabi_attribute_list *)
- bfd_alloc (abfd, sizeof (aeabi_attribute_list));
- memset (list, 0, sizeof (aeabi_attribute_list));
- list->tag = tag;
- /* Keep the tag list in order. */
- lastp = &elf32_arm_tdata (abfd)->other_eabi_attributes;
- for (p = *lastp; p; p = p->next)
- {
- if (tag < p->tag)
- break;
- lastp = &p->next;
- }
- list->next = *lastp;
- *lastp = list;
- attr = &list->attr;
- }
-
- return attr;
-}
-
-int
-elf32_arm_get_eabi_attr_int (bfd *abfd, int tag)
-{
- aeabi_attribute_list *p;
-
- if (tag < NUM_KNOWN_ATTRIBUTES)
- {
- /* Knwon tags are preallocated. */
- return elf32_arm_tdata (abfd)->known_eabi_attributes[tag].i;
- }
- else
- {
- for (p = elf32_arm_tdata (abfd)->other_eabi_attributes;
- p;
- p = p->next)
- {
- if (tag == p->tag)
- return p->attr.i;
- if (tag < p->tag)
- break;
- }
- return 0;
- }
-}
-
-void
-elf32_arm_add_eabi_attr_int (bfd *abfd, int tag, unsigned int i)
-{
- aeabi_attribute *attr;
-
- attr = elf32_arm_new_eabi_attr (abfd, tag);
- attr->type = 1;
- attr->i = i;
-}
-
-static char *
-attr_strdup (bfd *abfd, const char * s)
-{
- char * p;
- int len;
-
- len = strlen (s) + 1;
- p = (char *)bfd_alloc(abfd, len);
- return memcpy (p, s, len);
-}
-
-void
-elf32_arm_add_eabi_attr_string (bfd *abfd, int tag, const char *s)
-{
- aeabi_attribute *attr;
-
- attr = elf32_arm_new_eabi_attr (abfd, tag);
- attr->type = 2;
- attr->s = attr_strdup (abfd, s);
-}
-
-void
-elf32_arm_add_eabi_attr_compat (bfd *abfd, unsigned int i, const char *s)
-{
- aeabi_attribute_list *list;
- aeabi_attribute_list *p;
- aeabi_attribute_list **lastp;
-
- list = (aeabi_attribute_list *)
- bfd_alloc (abfd, sizeof (aeabi_attribute_list));
- memset (list, 0, sizeof (aeabi_attribute_list));
- list->tag = Tag_compatibility;
- list->attr.type = 3;
- list->attr.i = i;
- list->attr.s = attr_strdup (abfd, s);
-
- lastp = &elf32_arm_tdata (abfd)->other_eabi_attributes;
- for (p = *lastp; p; p = p->next)
- {
- int cmp;
- if (p->tag != Tag_compatibility)
- break;
- cmp = strcmp(s, p->attr.s);
- if (cmp < 0 || (cmp == 0 && i < p->attr.i))
- break;
- lastp = &p->next;
- }
- list->next = *lastp;
- *lastp = list;
-}
-
/* Set the right machine number. */
static bfd_boolean
@@ -4777,49 +6640,6 @@ elf32_arm_set_private_flags (bfd *abfd, flagword flags)
return TRUE;
}
-/* Copy the eabi object attribute from IBFD to OBFD. */
-static void
-copy_eabi_attributes (bfd *ibfd, bfd *obfd)
-{
- aeabi_attribute *in_attr;
- aeabi_attribute *out_attr;
- aeabi_attribute_list *list;
- int i;
-
- in_attr = elf32_arm_tdata (ibfd)->known_eabi_attributes;
- out_attr = elf32_arm_tdata (obfd)->known_eabi_attributes;
- for (i = 4; i < NUM_KNOWN_ATTRIBUTES; i++)
- {
- out_attr->i = in_attr->i;
- if (in_attr->s && *in_attr->s)
- out_attr->s = attr_strdup (obfd, in_attr->s);
- in_attr++;
- out_attr++;
- }
-
- for (list = elf32_arm_tdata (ibfd)->other_eabi_attributes;
- list;
- list = list->next)
- {
- in_attr = &list->attr;
- switch (in_attr->type)
- {
- case 1:
- elf32_arm_add_eabi_attr_int (obfd, list->tag, in_attr->i);
- break;
- case 2:
- elf32_arm_add_eabi_attr_string (obfd, list->tag, in_attr->s);
- break;
- case 3:
- elf32_arm_add_eabi_attr_compat (obfd, in_attr->i, in_attr->s);
- break;
- default:
- abort();
- }
- }
-}
-
-
/* Copy backend specific data from one object module to another. */
static bfd_boolean
@@ -4871,8 +6691,8 @@ elf32_arm_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
elf_elfheader (obfd)->e_ident[EI_OSABI] =
elf_elfheader (ibfd)->e_ident[EI_OSABI];
- /* Copy EABI object attributes. */
- copy_eabi_attributes (ibfd, obfd);
+ /* Copy object attributes. */
+ _bfd_elf_copy_obj_attributes (ibfd, obfd);
return TRUE;
}
@@ -4904,33 +6724,48 @@ enum
AEABI_enum_forced_wide
};
+/* Determine whether an object attribute tag takes an integer, a
+ string or both. */
+static int
+elf32_arm_obj_attrs_arg_type (int tag)
+{
+ if (tag == Tag_compatibility)
+ return 3;
+ else if (tag == 4 || tag == 5)
+ return 2;
+ else if (tag < 32)
+ return 1;
+ else
+ return (tag & 1) != 0 ? 2 : 1;
+}
+
/* Merge EABI object attributes from IBFD into OBFD. Raise an error if there
are conflicting attributes. */
static bfd_boolean
elf32_arm_merge_eabi_attributes (bfd *ibfd, bfd *obfd)
{
- aeabi_attribute *in_attr;
- aeabi_attribute *out_attr;
- aeabi_attribute_list *in_list;
- aeabi_attribute_list *out_list;
+ obj_attribute *in_attr;
+ obj_attribute *out_attr;
+ obj_attribute_list *in_list;
/* Some tags have 0 = don't care, 1 = strong requirement,
2 = weak requirement. */
static const int order_312[3] = {3, 1, 2};
int i;
- if (!elf32_arm_tdata (ibfd)->known_eabi_attributes[0].i)
+ if (!elf_known_obj_attributes_proc (obfd)[0].i)
{
/* This is the first object. Copy the attributes. */
- copy_eabi_attributes (ibfd, obfd);
+ _bfd_elf_copy_obj_attributes (ibfd, obfd);
+
+ /* Use the Tag_null value to indicate the attributes have been
+ initialized. */
+ elf_known_obj_attributes_proc (obfd)[0].i = 1;
+
return TRUE;
}
- /* Use the Tag_null value to indicate the attributes have been
- initialized. */
- elf32_arm_tdata (ibfd)->known_eabi_attributes[0].i = 1;
-
- in_attr = elf32_arm_tdata (ibfd)->known_eabi_attributes;
- out_attr = elf32_arm_tdata (obfd)->known_eabi_attributes;
+ in_attr = elf_known_obj_attributes_proc (ibfd);
+ out_attr = elf_known_obj_attributes_proc (obfd);
/* This needs to happen before Tag_ABI_FP_number_model is merged. */
if (in_attr[Tag_ABI_VFP_args].i != out_attr[Tag_ABI_VFP_args].i)
{
@@ -4946,16 +6781,19 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, bfd *obfd)
}
}
- for (i = 4; i < NUM_KNOWN_ATTRIBUTES; i++)
+ for (i = 4; i < NUM_KNOWN_OBJ_ATTRIBUTES; i++)
{
/* Merge this attribute with existing attributes. */
switch (i)
{
case Tag_CPU_raw_name:
case Tag_CPU_name:
- /* Use whichever has the greatest architecture requirements. */
- if (in_attr[Tag_CPU_arch].i > out_attr[Tag_CPU_arch].i)
- out_attr[i].s = attr_strdup(obfd, in_attr[i].s);
+ /* Use whichever has the greatest architecture requirements. We
+ won't necessarily have both the above tags, so make sure input
+ name is non-NULL. */
+ if (in_attr[Tag_CPU_arch].i > out_attr[Tag_CPU_arch].i
+ && in_attr[i].s)
+ out_attr[i].s = _bfd_elf_attr_strdup (obfd, in_attr[i].s);
break;
case Tag_ABI_optimization_goals:
@@ -5006,7 +6844,8 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, bfd *obfd)
}
break;
case Tag_ABI_PCS_R9_use:
- if (out_attr[i].i != AEABI_R9_unused
+ if (in_attr[i].i != out_attr[i].i
+ && out_attr[i].i != AEABI_R9_unused
&& in_attr[i].i != AEABI_R9_unused)
{
_bfd_error_handler
@@ -5067,10 +6906,15 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, bfd *obfd)
out_attr[i].i = in_attr[i].i;
}
else if (in_attr[i].i != AEABI_enum_forced_wide
- && out_attr[i].i != in_attr[i].i)
+ && out_attr[i].i != in_attr[i].i
+ && !elf32_arm_tdata (obfd)->no_enum_size_warning)
{
+ const char *aeabi_enum_names[] =
+ { "", "variable-size", "32-bit", "" };
_bfd_error_handler
- (_("ERROR: %B: Conflicting enum sizes"), ibfd);
+ (_("warning: %B uses %s enums yet the output is to use %s enums; use of enum values across objects may fail"),
+ ibfd, aeabi_enum_names[in_attr[i].i],
+ aeabi_enum_names[out_attr[i].i]);
}
}
break;
@@ -5091,60 +6935,13 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, bfd *obfd)
}
}
- in_list = elf32_arm_tdata (ibfd)->other_eabi_attributes;
- out_list = elf32_arm_tdata (ibfd)->other_eabi_attributes;
- while (in_list && in_list->tag == Tag_compatibility)
- {
- in_attr = &in_list->attr;
- if (in_attr->i == 0)
- continue;
- if (in_attr->i == 1)
- {
- _bfd_error_handler
- (_("ERROR: %B: Must be processed by '%s' toolchain"),
- ibfd, in_attr->s);
- return FALSE;
- }
- if (!out_list || out_list->tag != Tag_compatibility
- || strcmp (in_attr->s, out_list->attr.s) != 0)
- {
- /* Add this compatibility tag to the output. */
- elf32_arm_add_eabi_attr_compat (obfd, in_attr->i, in_attr->s);
- continue;
- }
- out_attr = &out_list->attr;
- /* Check all the input tags with the same identifier. */
- for (;;)
- {
- if (out_list->tag != Tag_compatibility
- || in_attr->i != out_attr->i
- || strcmp (in_attr->s, out_attr->s) != 0)
- {
- _bfd_error_handler
- (_("ERROR: %B: Incompatible object tag '%s':%d"),
- ibfd, in_attr->s, in_attr->i);
- return FALSE;
- }
- in_list = in_list->next;
- if (in_list->tag != Tag_compatibility
- || strcmp (in_attr->s, in_list->attr.s) != 0)
- break;
- in_attr = &in_list->attr;
- out_list = out_list->next;
- if (out_list)
- out_attr = &out_list->attr;
- }
+ /* Merge Tag_compatibility attributes and any common GNU ones. */
+ _bfd_elf_merge_object_attributes (ibfd, obfd);
- /* Check the output doesn't have extra tags with this identifier. */
- if (out_list && out_list->tag == Tag_compatibility
- && strcmp (in_attr->s, out_list->attr.s) == 0)
- {
- _bfd_error_handler
- (_("ERROR: %B: Incompatible object tag '%s':%d"),
- ibfd, in_attr->s, out_list->attr.i);
- return FALSE;
- }
- }
+ /* Check for any attributes not known on ARM. */
+ in_list = elf_other_obj_attributes_proc (ibfd);
+ while (in_list && in_list->tag == Tag_compatibility)
+ in_list = in_list->next;
for (; in_list; in_list = in_list->next)
{
@@ -5546,39 +7343,21 @@ elf32_arm_get_symbol_type (Elf_Internal_Sym * elf_sym, int type)
}
static asection *
-elf32_arm_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)
+elf32_arm_gc_mark_hook (asection *sec,
+ struct bfd_link_info *info,
+ Elf_Internal_Rela *rel,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
{
if (h != NULL)
- {
- switch (ELF32_R_TYPE (rel->r_info))
+ switch (ELF32_R_TYPE (rel->r_info))
{
case R_ARM_GNU_VTINHERIT:
case R_ARM_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
+ return NULL;
+ }
- return NULL;
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
/* Update the got entry reference counts for the section being removed. */
@@ -5644,13 +7423,23 @@ elf32_arm_gc_sweep_hook (bfd * abfd,
break;
case R_ARM_ABS32:
+ case R_ARM_ABS32_NOI:
case R_ARM_REL32:
+ case R_ARM_REL32_NOI:
case R_ARM_PC24:
case R_ARM_PLT32:
case R_ARM_CALL:
case R_ARM_JUMP24:
case R_ARM_PREL31:
case R_ARM_THM_CALL:
+ case R_ARM_MOVW_ABS_NC:
+ case R_ARM_MOVT_ABS:
+ case R_ARM_MOVW_PREL_NC:
+ case R_ARM_MOVT_PREL:
+ case R_ARM_THM_MOVW_ABS_NC:
+ case R_ARM_THM_MOVT_ABS:
+ case R_ARM_THM_MOVW_PREL_NC:
+ case R_ARM_THM_MOVT_PREL:
/* Should the interworking branches be here also? */
if (h != NULL)
@@ -5669,14 +7458,17 @@ elf32_arm_gc_sweep_hook (bfd * abfd,
}
if (r_type == R_ARM_ABS32
- || r_type == R_ARM_REL32)
+ || r_type == R_ARM_REL32
+ || r_type == R_ARM_ABS32_NOI
+ || r_type == R_ARM_REL32_NOI)
{
for (pp = &eh->relocs_copied; (p = *pp) != NULL;
pp = &p->next)
if (p->section == sec)
{
p->count -= 1;
- if (ELF32_R_TYPE (rel->r_info) == R_ARM_REL32)
+ if (ELF32_R_TYPE (rel->r_info) == R_ARM_REL32
+ || ELF32_R_TYPE (rel->r_info) == R_ARM_REL32_NOI)
p->pc_count -= 1;
if (p->count == 0)
*pp = p->next;
@@ -5854,13 +7646,23 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
/* Fall through */
case R_ARM_ABS32:
+ case R_ARM_ABS32_NOI:
case R_ARM_REL32:
+ case R_ARM_REL32_NOI:
case R_ARM_PC24:
case R_ARM_PLT32:
case R_ARM_CALL:
case R_ARM_JUMP24:
case R_ARM_PREL31:
case R_ARM_THM_CALL:
+ case R_ARM_MOVW_ABS_NC:
+ case R_ARM_MOVT_ABS:
+ case R_ARM_MOVW_PREL_NC:
+ case R_ARM_MOVT_PREL:
+ case R_ARM_THM_MOVW_ABS_NC:
+ case R_ARM_THM_MOVT_ABS:
+ case R_ARM_THM_MOVW_PREL_NC:
+ case R_ARM_THM_MOVT_PREL:
/* Should the interworking branches be listed here? */
if (h != NULL)
{
@@ -5877,12 +7679,11 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
refers to is in a different object. We can't tell for
sure yet, because something later might force the
symbol local. */
- if (r_type == R_ARM_PC24
- || r_type == R_ARM_CALL
- || r_type == R_ARM_JUMP24
- || r_type == R_ARM_PREL31
- || r_type == R_ARM_PLT32
- || r_type == R_ARM_THM_CALL)
+ if (r_type != R_ARM_ABS32
+ && r_type != R_ARM_REL32
+ && r_type != R_ARM_ABS32_NOI
+ && r_type != R_ARM_REL32_NOI
+ && r_type != R_ARM_ABS12)
h->needs_plt = 1;
/* If we create a PLT entry, this relocation will reference
@@ -5907,7 +7708,7 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
relocs_copied field of the hash table entry. */
if ((info->shared || htab->root.is_relocatable_executable)
&& (sec->flags & SEC_ALLOC) != 0
- && (r_type == R_ARM_ABS32
+ && ((r_type == R_ARM_ABS32 || r_type == R_ARM_ABS32_NOI)
|| (h != NULL && ! h->needs_plt
&& (! info->symbolic || ! h->def_regular))))
{
@@ -5991,7 +7792,7 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
p->pc_count = 0;
}
- if (r_type == R_ARM_REL32)
+ if (r_type == R_ARM_REL32 || r_type == R_ARM_REL32_NOI)
p->pc_count += 1;
p->count += 1;
}
@@ -6016,12 +7817,57 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
return TRUE;
}
+/* Unwinding tables are not referenced directly. This pass marks them as
+ required if the corresponding code section is marked. */
+
+static bfd_boolean
+elf32_arm_gc_mark_extra_sections(struct bfd_link_info *info,
+ elf_gc_mark_hook_fn gc_mark_hook)
+{
+ bfd *sub;
+ Elf_Internal_Shdr **elf_shdrp;
+ bfd_boolean again;
+
+ /* Marking EH data may cause additional code sections to be marked,
+ requiring multiple passes. */
+ again = TRUE;
+ while (again)
+ {
+ again = FALSE;
+ for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
+ {
+ asection *o;
+
+ if (bfd_get_flavour (sub) != bfd_target_elf_flavour)
+ continue;
+
+ elf_shdrp = elf_elfsections (sub);
+ for (o = sub->sections; o != NULL; o = o->next)
+ {
+ Elf_Internal_Shdr *hdr;
+ hdr = &elf_section_data (o)->this_hdr;
+ if (hdr->sh_type == SHT_ARM_EXIDX && hdr->sh_link
+ && !o->gc_mark
+ && elf_shdrp[hdr->sh_link]->bfd_section->gc_mark)
+ {
+ again = TRUE;
+ if (!_bfd_elf_gc_mark (info, o, gc_mark_hook))
+ return FALSE;
+ }
+ }
+ }
+ }
+
+ return TRUE;
+}
+
/* Treat mapping symbols as special target symbols. */
static bfd_boolean
elf32_arm_is_target_special_symbol (bfd * abfd ATTRIBUTE_UNUSED, asymbol * sym)
{
- return bfd_is_arm_mapping_symbol_name (sym->name);
+ return bfd_is_arm_special_symbol_name (sym->name,
+ BFD_ARM_SPECIAL_SYM_TYPE_ANY);
}
/* This is a copy of elf_find_function() from elf.c except that
@@ -6057,9 +7903,10 @@ arm_elf_find_function (bfd * abfd ATTRIBUTE_UNUSED,
case STT_FUNC:
case STT_ARM_TFUNC:
case STT_NOTYPE:
- /* Skip $a and $t symbols. */
+ /* Skip mapping symbols. */
if ((q->symbol.flags & BSF_LOCAL)
- && bfd_is_arm_mapping_symbol_name (q->symbol.name))
+ && bfd_is_arm_special_symbol_name (q->symbol.name,
+ BFD_ARM_SPECIAL_SYM_TYPE_ANY))
continue;
/* Fall through. */
if (bfd_get_section (&q->symbol) == section
@@ -6160,7 +8007,6 @@ elf32_arm_adjust_dynamic_symbol (struct bfd_link_info * info,
{
bfd * dynobj;
asection * s;
- unsigned int power_of_two;
struct elf32_arm_link_hash_entry * eh;
struct elf32_arm_link_hash_table *globals;
@@ -6273,28 +8119,7 @@ elf32_arm_adjust_dynamic_symbol (struct bfd_link_info * info,
h->needs_copy = 1;
}
- /* We need to figure out the alignment required for this symbol. I
- have no idea how ELF linkers handle this. */
- power_of_two = bfd_log2 (h->size);
- if (power_of_two > 3)
- power_of_two = 3;
-
- /* Apply the required alignment. */
- s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two));
- if (power_of_two > bfd_get_section_alignment (dynobj, s))
- {
- if (! bfd_set_section_alignment (dynobj, s, power_of_two))
- return FALSE;
- }
-
- /* Define the symbol as being at this point in the section. */
- h->root.u.def.section = s;
- h->root.u.def.value = s->size;
-
- /* Increment the section size to make room for the symbol. */
- s->size += h->size;
-
- return TRUE;
+ return _bfd_elf_adjust_dynamic_copy (h, s);
}
/* Allocate space in .plt, .got and associated reloc sections for
@@ -6483,6 +8308,37 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
else
h->got.offset = (bfd_vma) -1;
+ /* Allocate stubs for exported Thumb functions on v4t. */
+ if (!htab->use_blx && h->dynindx != -1
+ && h->def_regular
+ && ELF_ST_TYPE (h->type) == STT_ARM_TFUNC
+ && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
+ {
+ struct elf_link_hash_entry * th;
+ struct bfd_link_hash_entry * bh;
+ struct elf_link_hash_entry * myh;
+ char name[1024];
+ asection *s;
+ bh = NULL;
+ /* Create a new symbol to regist the real location of the function. */
+ s = h->root.u.def.section;
+ sprintf(name, "__real_%s", h->root.root.string);
+ _bfd_generic_link_add_one_symbol (info, s->owner,
+ name, BSF_GLOBAL, s,
+ h->root.u.def.value,
+ NULL, TRUE, FALSE, &bh);
+
+ myh = (struct elf_link_hash_entry *) bh;
+ myh->type = ELF_ST_INFO (STB_LOCAL, STT_ARM_TFUNC);
+ myh->forced_local = 1;
+ eh->export_glue = myh;
+ th = record_arm_to_thumb_glue (info, h);
+ /* Point the symbol at the stub. */
+ h->type = ELF_ST_INFO (ELF_ST_BIND (h->type), STT_FUNC);
+ h->root.u.def.section = th->root.u.def.section;
+ h->root.u.def.value = th->root.u.def.value & ~1;
+ }
+
if (eh->relocs_copied == NULL)
return TRUE;
@@ -6494,12 +8350,12 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
if (info->shared || htab->root.is_relocatable_executable)
{
- /* The only reloc that uses pc_count is R_ARM_REL32, which will
- appear on something like ".long foo - .". We want calls to
- protected symbols to resolve directly to the function rather
- than going via the plt. If people want function pointer
- comparisons to work as expected then they should avoid
- writing assembly like ".long foo - .". */
+ /* The only relocs that use pc_count are R_ARM_REL32 and
+ R_ARM_REL32_NOI, which will appear on something like
+ ".long foo - .". We want calls to protected symbols to resolve
+ directly to the function rather than going via the plt. If people
+ want function pointer comparisons to work as expected then they
+ should avoid writing assembly like ".long foo - .". */
if (SYMBOL_CALLS_LOCAL (info, h))
{
struct elf32_arm_relocs_copied **pp;
@@ -6616,6 +8472,16 @@ elf32_arm_readonly_dynrelocs (struct elf_link_hash_entry *h, PTR inf)
return TRUE;
}
+void
+bfd_elf32_arm_set_byteswap_code (struct bfd_link_info *info,
+ int byteswap_code)
+{
+ struct elf32_arm_link_hash_table *globals;
+
+ globals = elf32_arm_hash_table (info);
+ globals->byteswap_code = byteswap_code;
+}
+
/* Set the sizes of the dynamic sections. */
static bfd_boolean
@@ -6731,6 +8597,19 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
sym dynamic relocs. */
elf_link_hash_traverse (& htab->root, allocate_dynrelocs, info);
+ /* Here we rummage through the found bfds to collect glue information. */
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ {
+ /* Initialise mapping tables for code/data. */
+ bfd_elf32_arm_init_maps (ibfd);
+
+ if (!bfd_elf32_arm_process_before_allocation (ibfd, info)
+ || !bfd_elf32_arm_vfp11_erratum_scan (ibfd, info))
+ /* xgettext:c-format */
+ _bfd_error_handler (_("Errors encountered processing file %s"),
+ ibfd->filename);
+ }
+
/* The check_relocs and adjust_dynamic_symbol entry points have
determined the sizes of the various dynamic sections. Allocate
memory for them. */
@@ -6752,7 +8631,7 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
/* Remember whether there is a PLT. */
plt = s->size != 0;
}
- else if (strncmp (name, ".rel", 4) == 0)
+ else if (CONST_STRNEQ (name, ".rel"))
{
if (s->size != 0)
{
@@ -6766,7 +8645,7 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
s->reloc_count = 0;
}
}
- else if (strncmp (name, ".got", 4) != 0
+ else if (! CONST_STRNEQ (name, ".got")
&& strcmp (name, ".dynbss") != 0)
{
/* It's not one of our sections, so don't allocate space. */
@@ -6893,16 +8772,17 @@ elf32_arm_finish_dynamic_symbol (bfd * output_bfd, struct bfd_link_info * info,
/* Fill in the entry in the procedure linkage table. */
if (htab->symbian_p)
{
- unsigned i;
- for (i = 0; i < htab->plt_entry_size / 4; ++i)
- bfd_put_32 (output_bfd,
- elf32_arm_symbian_plt_entry[i],
- splt->contents + h->plt.offset + 4 * i);
+ put_arm_insn (htab, output_bfd,
+ elf32_arm_symbian_plt_entry[0],
+ splt->contents + h->plt.offset);
+ bfd_put_32 (output_bfd,
+ elf32_arm_symbian_plt_entry[1],
+ splt->contents + h->plt.offset + 4);
/* Fill in the entry in the .rel.plt section. */
rel.r_offset = (splt->output_section->vma
+ splt->output_offset
- + h->plt.offset + 4 * (i - 1));
+ + h->plt.offset + 4);
rel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_GLOB_DAT);
/* Get the index in the procedure linkage table which
@@ -6917,6 +8797,7 @@ elf32_arm_finish_dynamic_symbol (bfd * output_bfd, struct bfd_link_info * info,
bfd_vma got_offset, got_address, plt_address;
bfd_vma got_displacement;
asection * sgot;
+ bfd_byte * ptr;
sgot = bfd_get_section_by_name (dynobj, ".got.plt");
BFD_ASSERT (sgot != NULL);
@@ -6942,20 +8823,23 @@ elf32_arm_finish_dynamic_symbol (bfd * output_bfd, struct bfd_link_info * info,
+ splt->output_offset
+ h->plt.offset);
+ ptr = htab->splt->contents + h->plt.offset;
if (htab->vxworks_p && info->shared)
{
unsigned int i;
bfd_vma val;
- for (i = 0; i != htab->plt_entry_size / 4; i++)
+ for (i = 0; i != htab->plt_entry_size / 4; i++, ptr += 4)
{
val = elf32_arm_vxworks_shared_plt_entry[i];
if (i == 2)
val |= got_address - sgot->output_section->vma;
if (i == 5)
val |= plt_index * RELOC_SIZE (htab);
- bfd_put_32 (output_bfd, val,
- htab->splt->contents + h->plt.offset + i * 4);
+ if (i == 2 || i == 5)
+ bfd_put_32 (output_bfd, val, ptr);
+ else
+ put_arm_insn (htab, output_bfd, val, ptr);
}
}
else if (htab->vxworks_p)
@@ -6963,7 +8847,7 @@ elf32_arm_finish_dynamic_symbol (bfd * output_bfd, struct bfd_link_info * info,
unsigned int i;
bfd_vma val;
- for (i = 0; i != htab->plt_entry_size / 4; i++)
+ for (i = 0; i != htab->plt_entry_size / 4; i++, ptr += 4)
{
val = elf32_arm_vxworks_exec_plt_entry[i];
if (i == 2)
@@ -6972,8 +8856,10 @@ elf32_arm_finish_dynamic_symbol (bfd * output_bfd, struct bfd_link_info * info,
val |= 0xffffff & -((h->plt.offset + i * 4 + 8) >> 2);
if (i == 5)
val |= plt_index * RELOC_SIZE (htab);
- bfd_put_32 (output_bfd, val,
- htab->splt->contents + h->plt.offset + i * 4);
+ if (i == 2 || i == 5)
+ bfd_put_32 (output_bfd, val, ptr);
+ else
+ put_arm_insn (htab, output_bfd, val, ptr);
}
loc = (htab->srelplt2->contents
@@ -7006,27 +8892,26 @@ elf32_arm_finish_dynamic_symbol (bfd * output_bfd, struct bfd_link_info * info,
if (!htab->use_blx && eh->plt_thumb_refcount > 0)
{
- bfd_put_16 (output_bfd, elf32_arm_plt_thumb_stub[0],
- splt->contents + h->plt.offset - 4);
- bfd_put_16 (output_bfd, elf32_arm_plt_thumb_stub[1],
- splt->contents + h->plt.offset - 2);
+ put_thumb_insn (htab, output_bfd,
+ elf32_arm_plt_thumb_stub[0], ptr - 4);
+ put_thumb_insn (htab, output_bfd,
+ elf32_arm_plt_thumb_stub[1], ptr - 2);
}
- bfd_put_32 (output_bfd,
- elf32_arm_plt_entry[0]
- | ((got_displacement & 0x0ff00000) >> 20),
- splt->contents + h->plt.offset + 0);
- bfd_put_32 (output_bfd,
- elf32_arm_plt_entry[1]
- | ((got_displacement & 0x000ff000) >> 12),
- splt->contents + h->plt.offset + 4);
- bfd_put_32 (output_bfd,
- elf32_arm_plt_entry[2]
- | (got_displacement & 0x00000fff),
- splt->contents + h->plt.offset + 8);
+ put_arm_insn (htab, output_bfd,
+ elf32_arm_plt_entry[0]
+ | ((got_displacement & 0x0ff00000) >> 20),
+ ptr + 0);
+ put_arm_insn (htab, output_bfd,
+ elf32_arm_plt_entry[1]
+ | ((got_displacement & 0x000ff000) >> 12),
+ ptr+ 4);
+ put_arm_insn (htab, output_bfd,
+ elf32_arm_plt_entry[2]
+ | (got_displacement & 0x00000fff),
+ ptr + 8);
#ifdef FOUR_WORD_PLT
- bfd_put_32 (output_bfd, elf32_arm_plt_entry[3],
- splt->contents + h->plt.offset + 12);
+ bfd_put_32 (output_bfd, elf32_arm_plt_entry[3], ptr + 12);
#endif
}
@@ -7336,9 +9221,12 @@ elf32_arm_finish_dynamic_sections (bfd * output_bfd, struct bfd_link_info * info
Elf_Internal_Rela rel;
plt0_entry = elf32_arm_vxworks_exec_plt0_entry;
- bfd_put_32 (output_bfd, plt0_entry[0], splt->contents + 0);
- bfd_put_32 (output_bfd, plt0_entry[1], splt->contents + 4);
- bfd_put_32 (output_bfd, plt0_entry[2], splt->contents + 8);
+ put_arm_insn (htab, output_bfd, plt0_entry[0],
+ splt->contents + 0);
+ put_arm_insn (htab, output_bfd, plt0_entry[1],
+ splt->contents + 4);
+ put_arm_insn (htab, output_bfd, plt0_entry[2],
+ splt->contents + 8);
bfd_put_32 (output_bfd, got_address, splt->contents + 12);
/* Generate a relocation for _GLOBAL_OFFSET_TABLE_. */
@@ -7353,10 +9241,14 @@ elf32_arm_finish_dynamic_sections (bfd * output_bfd, struct bfd_link_info * info
got_displacement = got_address - (plt_address + 16);
plt0_entry = elf32_arm_plt0_entry;
- bfd_put_32 (output_bfd, plt0_entry[0], splt->contents + 0);
- bfd_put_32 (output_bfd, plt0_entry[1], splt->contents + 4);
- bfd_put_32 (output_bfd, plt0_entry[2], splt->contents + 8);
- bfd_put_32 (output_bfd, plt0_entry[3], splt->contents + 12);
+ put_arm_insn (htab, output_bfd, plt0_entry[0],
+ splt->contents + 0);
+ put_arm_insn (htab, output_bfd, plt0_entry[1],
+ splt->contents + 4);
+ put_arm_insn (htab, output_bfd, plt0_entry[2],
+ splt->contents + 8);
+ put_arm_insn (htab, output_bfd, plt0_entry[3],
+ splt->contents + 12);
#ifdef FOUR_WORD_PLT
/* The displacement value goes in the otherwise-unused
@@ -7370,7 +9262,8 @@ elf32_arm_finish_dynamic_sections (bfd * output_bfd, struct bfd_link_info * info
/* UnixWare sets the entsize of .plt to 4, although that doesn't
really seem like the right value. */
- elf_section_data (splt->output_section)->this_hdr.sh_entsize = 4;
+ if (splt->output_section->owner == output_bfd)
+ elf_section_data (splt->output_section)->this_hdr.sh_entsize = 4;
if (htab->vxworks_p && !info->shared && htab->splt->size > 0)
{
@@ -7481,12 +9374,8 @@ elf32_arm_final_write_processing (bfd *abfd, bfd_boolean linker ATTRIBUTE_UNUSED
static bfd_boolean
is_arm_elf_unwind_section_name (bfd * abfd ATTRIBUTE_UNUSED, const char * name)
{
- size_t len1, len2;
-
- len1 = sizeof (ELF_STRING_ARM_unwind) - 1;
- len2 = sizeof (ELF_STRING_ARM_unwind_once) - 1;
- return (strncmp (name, ELF_STRING_ARM_unwind, len1) == 0
- || strncmp (name, ELF_STRING_ARM_unwind_once, len2) == 0);
+ return (CONST_STRNEQ (name, ELF_STRING_ARM_unwind)
+ || CONST_STRNEQ (name, ELF_STRING_ARM_unwind_once));
}
@@ -7505,125 +9394,9 @@ elf32_arm_fake_sections (bfd * abfd, Elf_Internal_Shdr * hdr, asection * sec)
hdr->sh_type = SHT_ARM_EXIDX;
hdr->sh_flags |= SHF_LINK_ORDER;
}
- else if (strcmp(name, ".ARM.attributes") == 0)
- {
- hdr->sh_type = SHT_ARM_ATTRIBUTES;
- }
return TRUE;
}
-/* Parse an Arm EABI attributes section. */
-static void
-elf32_arm_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr)
-{
- bfd_byte *contents;
- bfd_byte *p;
- bfd_vma len;
-
- contents = bfd_malloc (hdr->sh_size);
- if (!contents)
- return;
- if (!bfd_get_section_contents (abfd, hdr->bfd_section, contents, 0,
- hdr->sh_size))
- {
- free (contents);
- return;
- }
- p = contents;
- if (*(p++) == 'A')
- {
- len = hdr->sh_size - 1;
- while (len > 0)
- {
- int namelen;
- bfd_vma section_len;
-
- section_len = bfd_get_32 (abfd, p);
- p += 4;
- if (section_len > len)
- section_len = len;
- len -= section_len;
- namelen = strlen ((char *)p) + 1;
- section_len -= namelen + 4;
- if (strcmp((char *)p, "aeabi") != 0)
- {
- /* Vendor section. Ignore it. */
- p += namelen + section_len;
- }
- else
- {
- p += namelen;
- while (section_len > 0)
- {
- int tag;
- unsigned int n;
- unsigned int val;
- bfd_vma subsection_len;
- bfd_byte *end;
-
- tag = read_unsigned_leb128 (abfd, p, &n);
- p += n;
- subsection_len = bfd_get_32 (abfd, p);
- p += 4;
- if (subsection_len > section_len)
- subsection_len = section_len;
- section_len -= subsection_len;
- subsection_len -= n + 4;
- end = p + subsection_len;
- switch (tag)
- {
- case Tag_File:
- while (p < end)
- {
- bfd_boolean is_string;
-
- tag = read_unsigned_leb128 (abfd, p, &n);
- p += n;
- if (tag == 4 || tag == 5)
- is_string = 1;
- else if (tag < 32)
- is_string = 0;
- else
- is_string = (tag & 1) != 0;
- if (tag == Tag_compatibility)
- {
- val = read_unsigned_leb128 (abfd, p, &n);
- p += n;
- elf32_arm_add_eabi_attr_compat (abfd, val,
- (char *)p);
- p += strlen ((char *)p) + 1;
- }
- else if (is_string)
- {
- elf32_arm_add_eabi_attr_string (abfd, tag,
- (char *)p);
- p += strlen ((char *)p) + 1;
- }
- else
- {
- val = read_unsigned_leb128 (abfd, p, &n);
- p += n;
- elf32_arm_add_eabi_attr_int (abfd, tag, val);
- }
- }
- break;
- case Tag_Section:
- case Tag_Symbol:
- /* Don't have anywhere convenient to attach these.
- Fall through for now. */
- default:
- /* Ignore things we don't kow about. */
- p += subsection_len;
- subsection_len = 0;
- break;
- }
- }
- }
- }
- }
- free (contents);
-}
-
/* Handle an ARM specific section when reading an object file. This is
called when bfd_section_from_shdr finds a section with an unknown
type. */
@@ -7653,8 +9426,6 @@ elf32_arm_section_from_shdr (bfd *abfd,
if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
return FALSE;
- if (hdr->sh_type == SHT_ARM_ATTRIBUTES)
- elf32_arm_parse_attributes(abfd, hdr);
return TRUE;
}
@@ -7759,61 +9530,218 @@ unrecord_section_with_arm_elf_section_data (asection * sec)
}
}
-/* Called for each symbol. Builds a section map based on mapping symbols.
- Does not alter any of the symbols. */
-static bfd_boolean
-elf32_arm_output_symbol_hook (struct bfd_link_info *info,
- const char *name,
- Elf_Internal_Sym *elfsym,
- asection *input_sec,
- struct elf_link_hash_entry *h)
+typedef struct
{
- int mapcount;
- elf32_arm_section_map *map;
- elf32_arm_section_map *newmap;
- _arm_elf_section_data *arm_data;
- struct elf32_arm_link_hash_table *globals;
+ void *finfo;
+ struct bfd_link_info *info;
+ asection *sec;
+ int sec_shndx;
+ bfd_boolean (*func) (void *, const char *, Elf_Internal_Sym *,
+ asection *, struct elf_link_hash_entry *);
+} output_arch_syminfo;
- globals = elf32_arm_hash_table (info);
- if (globals->vxworks_p
- && !elf_vxworks_link_output_symbol_hook (info, name, elfsym,
- input_sec, h))
+enum map_symbol_type
+{
+ ARM_MAP_ARM,
+ ARM_MAP_THUMB,
+ ARM_MAP_DATA
+};
+
+
+/* Output a single PLT mapping symbol. */
+
+static bfd_boolean
+elf32_arm_ouput_plt_map_sym (output_arch_syminfo *osi,
+ enum map_symbol_type type,
+ bfd_vma offset)
+{
+ static const char *names[3] = {"$a", "$t", "$d"};
+ struct elf32_arm_link_hash_table *htab;
+ Elf_Internal_Sym sym;
+
+ htab = elf32_arm_hash_table (osi->info);
+ sym.st_value = osi->sec->output_section->vma
+ + osi->sec->output_offset
+ + offset;
+ sym.st_size = 0;
+ sym.st_other = 0;
+ sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_NOTYPE);
+ sym.st_shndx = osi->sec_shndx;
+ if (!osi->func (osi->finfo, names[type], &sym, osi->sec, NULL))
return FALSE;
+ return TRUE;
+}
- /* Only do this on final link. */
- if (info->relocatable)
- return TRUE;
- /* Only build a map if we need to byteswap code. */
- if (!globals->byteswap_code)
- return TRUE;
+/* Output mapping symbols for PLT entries associated with H. */
- /* We only want mapping symbols. */
- if (! bfd_is_arm_mapping_symbol_name (name))
+static bfd_boolean
+elf32_arm_output_plt_map (struct elf_link_hash_entry *h, void *inf)
+{
+ output_arch_syminfo *osi = (output_arch_syminfo *) inf;
+ struct elf32_arm_link_hash_table *htab;
+ struct elf32_arm_link_hash_entry *eh;
+ bfd_vma addr;
+
+ htab = elf32_arm_hash_table (osi->info);
+
+ if (h->root.type == bfd_link_hash_indirect)
return TRUE;
- /* If this section has not been allocated an _arm_elf_section_data
- structure then we cannot record anything. */
- arm_data = get_arm_elf_section_data (input_sec);
- if (arm_data == NULL)
+ if (h->root.type == bfd_link_hash_warning)
+ /* When warning symbols are created, they **replace** the "real"
+ entry in the hash table, thus we never get to see the real
+ symbol in a hash traversal. So look at it now. */
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ if (h->plt.offset == (bfd_vma) -1)
return TRUE;
- mapcount = arm_data->mapcount + 1;
- map = arm_data->map;
+ eh = (struct elf32_arm_link_hash_entry *) h;
+ addr = h->plt.offset;
+ if (htab->symbian_p)
+ {
+ if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_ARM, addr))
+ return FALSE;
+ if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_DATA, addr + 4))
+ return FALSE;
+ }
+ else if (htab->vxworks_p)
+ {
+ if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_ARM, addr))
+ return FALSE;
+ if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_DATA, addr + 8))
+ return FALSE;
+ if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_ARM, addr + 12))
+ return FALSE;
+ if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_DATA, addr + 20))
+ return FALSE;
+ }
+ else
+ {
+ bfd_boolean thumb_stub;
+
+ thumb_stub = eh->plt_thumb_refcount > 0 && !htab->use_blx;
+ if (thumb_stub)
+ {
+ if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_THUMB, addr - 4))
+ return FALSE;
+ }
+#ifdef FOUR_WORD_PLT
+ if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_ARM, addr))
+ return FALSE;
+ if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_DATA, addr + 12))
+ return FALSE;
+#else
+ /* A three-word PLT with no Thumb thunk contains only Arm code,
+ so only need to output a mapping symbol for the first PLT entry and
+ entries with thumb thunks. */
+ if (thumb_stub || addr == 20)
+ {
+ if (!elf32_arm_ouput_plt_map_sym (osi, ARM_MAP_ARM, addr))
+ return FALSE;
+ }
+#endif
+ }
- /* TODO: This may be inefficient, but we probably don't usually have many
- mapping symbols per section. */
- newmap = bfd_realloc (map, mapcount * sizeof (* map));
- if (newmap != NULL)
+ return TRUE;
+}
+
+
+/* Output mapping symbols for linker generated sections. */
+
+static bfd_boolean
+elf32_arm_output_arch_local_syms (bfd *output_bfd,
+ struct bfd_link_info *info,
+ void *finfo, bfd_boolean (*func) (void *, const char *,
+ Elf_Internal_Sym *,
+ asection *,
+ struct elf_link_hash_entry *))
+{
+ output_arch_syminfo osi;
+ struct elf32_arm_link_hash_table *htab;
+ bfd_vma offset;
+ bfd_size_type size;
+
+ htab = elf32_arm_hash_table (info);
+ check_use_blx(htab);
+
+ osi.finfo = finfo;
+ osi.info = info;
+ osi.func = func;
+
+ /* ARM->Thumb glue. */
+ if (htab->arm_glue_size > 0)
{
- arm_data->map = newmap;
- arm_data->mapcount = mapcount;
+ osi.sec = bfd_get_section_by_name (htab->bfd_of_glue_owner,
+ ARM2THUMB_GLUE_SECTION_NAME);
+
+ osi.sec_shndx = _bfd_elf_section_from_bfd_section
+ (output_bfd, osi.sec->output_section);
+ if (info->shared || htab->root.is_relocatable_executable
+ || htab->pic_veneer)
+ size = ARM2THUMB_PIC_GLUE_SIZE;
+ else if (htab->use_blx)
+ size = ARM2THUMB_V5_STATIC_GLUE_SIZE;
+ else
+ size = ARM2THUMB_STATIC_GLUE_SIZE;
+
+ for (offset = 0; offset < htab->arm_glue_size; offset += size)
+ {
+ elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_ARM, offset);
+ elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_DATA, offset + size - 4);
+ }
+ }
+
+ /* Thumb->ARM glue. */
+ if (htab->thumb_glue_size > 0)
+ {
+ osi.sec = bfd_get_section_by_name (htab->bfd_of_glue_owner,
+ THUMB2ARM_GLUE_SECTION_NAME);
+
+ osi.sec_shndx = _bfd_elf_section_from_bfd_section
+ (output_bfd, osi.sec->output_section);
+ size = THUMB2ARM_GLUE_SIZE;
+
+ for (offset = 0; offset < htab->thumb_glue_size; offset += size)
+ {
+ elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_THUMB, offset);
+ elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_ARM, offset + 4);
+ }
+ }
+
+ /* Finally, output mapping symbols for the PLT. */
+ if (!htab->splt || htab->splt->size == 0)
+ return TRUE;
- newmap[mapcount - 1].vma = elfsym->st_value;
- newmap[mapcount - 1].type = name[1];
+ osi.sec_shndx = _bfd_elf_section_from_bfd_section (output_bfd,
+ htab->splt->output_section);
+ osi.sec = htab->splt;
+ /* Output mapping symbols for the plt header. SymbianOS does not have a
+ plt header. */
+ if (htab->vxworks_p)
+ {
+ /* VxWorks shared libraries have no PLT header. */
+ if (!info->shared)
+ {
+ if (!elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_ARM, 0))
+ return FALSE;
+ if (!elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_DATA, 12))
+ return FALSE;
+ }
+ }
+ else if (!htab->symbian_p)
+ {
+ if (!elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_ARM, 0))
+ return FALSE;
+#ifndef FOUR_WORD_PLT
+ if (!elf32_arm_ouput_plt_map_sym (&osi, ARM_MAP_DATA, 16))
+ return FALSE;
+#endif
}
+ elf_link_hash_traverse (&htab->root, elf32_arm_output_plt_map, (void *) &osi);
return TRUE;
}
@@ -7822,13 +9750,16 @@ elf32_arm_output_symbol_hook (struct bfd_link_info *info,
static bfd_boolean
elf32_arm_new_section_hook (bfd *abfd, asection *sec)
{
- _arm_elf_section_data *sdata;
- bfd_size_type amt = sizeof (*sdata);
+ if (!sec->used_by_bfd)
+ {
+ _arm_elf_section_data *sdata;
+ bfd_size_type amt = sizeof (*sdata);
- sdata = bfd_zalloc (abfd, amt);
- if (sdata == NULL)
- return FALSE;
- sec->used_by_bfd = sdata;
+ sdata = bfd_zalloc (abfd, amt);
+ if (sdata == NULL)
+ return FALSE;
+ sec->used_by_bfd = sdata;
+ }
record_section_with_arm_elf_section_data (sec);
@@ -7850,15 +9781,18 @@ elf32_arm_compare_mapping (const void * a, const void * b)
written out as normal. */
static bfd_boolean
-elf32_arm_write_section (bfd *output_bfd ATTRIBUTE_UNUSED, asection *sec,
+elf32_arm_write_section (bfd *output_bfd,
+ struct bfd_link_info *link_info, asection *sec,
bfd_byte *contents)
{
- int mapcount;
+ int mapcount, errcount;
_arm_elf_section_data *arm_data;
+ struct elf32_arm_link_hash_table *globals = elf32_arm_hash_table (link_info);
elf32_arm_section_map *map;
+ elf32_vfp11_erratum_list *errnode;
bfd_vma ptr;
bfd_vma end;
- bfd_vma offset;
+ bfd_vma offset = sec->output_section->vma + sec->output_offset;
bfd_byte tmp;
int i;
@@ -7870,57 +9804,136 @@ elf32_arm_write_section (bfd *output_bfd ATTRIBUTE_UNUSED, asection *sec,
mapcount = arm_data->mapcount;
map = arm_data->map;
+ errcount = arm_data->erratumcount;
+
+ if (errcount != 0)
+ {
+ unsigned int endianflip = bfd_big_endian (output_bfd) ? 3 : 0;
+
+ for (errnode = arm_data->erratumlist; errnode != 0;
+ errnode = errnode->next)
+ {
+ bfd_vma index = errnode->vma - offset;
+
+ switch (errnode->type)
+ {
+ case VFP11_ERRATUM_BRANCH_TO_ARM_VENEER:
+ {
+ bfd_vma branch_to_veneer;
+ /* Original condition code of instruction, plus bit mask for
+ ARM B instruction. */
+ unsigned int insn = (errnode->u.b.vfp_insn & 0xf0000000)
+ | 0x0a000000;
+
+ /* The instruction is before the label. */
+ index -= 4;
+
+ /* Above offset included in -4 below. */
+ branch_to_veneer = errnode->u.b.veneer->vma
+ - errnode->vma - 4;
+
+ if ((signed) branch_to_veneer < -(1 << 25)
+ || (signed) branch_to_veneer >= (1 << 25))
+ (*_bfd_error_handler) (_("%B: error: VFP11 veneer out of "
+ "range"), output_bfd);
+
+ insn |= (branch_to_veneer >> 2) & 0xffffff;
+ contents[endianflip ^ index] = insn & 0xff;
+ contents[endianflip ^ (index + 1)] = (insn >> 8) & 0xff;
+ contents[endianflip ^ (index + 2)] = (insn >> 16) & 0xff;
+ contents[endianflip ^ (index + 3)] = (insn >> 24) & 0xff;
+ }
+ break;
+
+ case VFP11_ERRATUM_ARM_VENEER:
+ {
+ bfd_vma branch_from_veneer;
+ unsigned int insn;
+
+ /* Take size of veneer into account. */
+ branch_from_veneer = errnode->u.v.branch->vma
+ - errnode->vma - 12;
+
+ if ((signed) branch_from_veneer < -(1 << 25)
+ || (signed) branch_from_veneer >= (1 << 25))
+ (*_bfd_error_handler) (_("%B: error: VFP11 veneer out of "
+ "range"), output_bfd);
+
+ /* Original instruction. */
+ insn = errnode->u.v.branch->u.b.vfp_insn;
+ contents[endianflip ^ index] = insn & 0xff;
+ contents[endianflip ^ (index + 1)] = (insn >> 8) & 0xff;
+ contents[endianflip ^ (index + 2)] = (insn >> 16) & 0xff;
+ contents[endianflip ^ (index + 3)] = (insn >> 24) & 0xff;
+
+ /* Branch back to insn after original insn. */
+ insn = 0xea000000 | ((branch_from_veneer >> 2) & 0xffffff);
+ contents[endianflip ^ (index + 4)] = insn & 0xff;
+ contents[endianflip ^ (index + 5)] = (insn >> 8) & 0xff;
+ contents[endianflip ^ (index + 6)] = (insn >> 16) & 0xff;
+ contents[endianflip ^ (index + 7)] = (insn >> 24) & 0xff;
+ }
+ break;
+
+ default:
+ abort ();
+ }
+ }
+ }
if (mapcount == 0)
return FALSE;
- qsort (map, mapcount, sizeof (* map), elf32_arm_compare_mapping);
-
- offset = sec->output_section->vma + sec->output_offset;
- ptr = map[0].vma - offset;
- for (i = 0; i < mapcount; i++)
+ if (globals->byteswap_code)
{
- if (i == mapcount - 1)
- end = sec->size;
- else
- end = map[i + 1].vma - offset;
+ qsort (map, mapcount, sizeof (* map), elf32_arm_compare_mapping);
- switch (map[i].type)
- {
- case 'a':
- /* Byte swap code words. */
- while (ptr + 3 < end)
- {
- tmp = contents[ptr];
- contents[ptr] = contents[ptr + 3];
- contents[ptr + 3] = tmp;
- tmp = contents[ptr + 1];
- contents[ptr + 1] = contents[ptr + 2];
- contents[ptr + 2] = tmp;
- ptr += 4;
- }
- break;
+ ptr = map[0].vma;
+ for (i = 0; i < mapcount; i++)
+ {
+ if (i == mapcount - 1)
+ end = sec->size;
+ else
+ end = map[i + 1].vma;
- case 't':
- /* Byte swap code halfwords. */
- while (ptr + 1 < end)
+ switch (map[i].type)
{
- tmp = contents[ptr];
- contents[ptr] = contents[ptr + 1];
- contents[ptr + 1] = tmp;
- ptr += 2;
- }
- break;
+ case 'a':
+ /* Byte swap code words. */
+ while (ptr + 3 < end)
+ {
+ tmp = contents[ptr];
+ contents[ptr] = contents[ptr + 3];
+ contents[ptr + 3] = tmp;
+ tmp = contents[ptr + 1];
+ contents[ptr + 1] = contents[ptr + 2];
+ contents[ptr + 2] = tmp;
+ ptr += 4;
+ }
+ break;
- case 'd':
- /* Leave data alone. */
- break;
- }
- ptr = end;
+ case 't':
+ /* Byte swap code halfwords. */
+ while (ptr + 1 < end)
+ {
+ tmp = contents[ptr];
+ contents[ptr] = contents[ptr + 1];
+ contents[ptr + 1] = tmp;
+ ptr += 2;
+ }
+ break;
+
+ case 'd':
+ /* Leave data alone. */
+ break;
+ }
+ ptr = end;
+ }
}
free (map);
arm_data->mapcount = 0;
+ arm_data->mapsize = 0;
arm_data->map = NULL;
unrecord_section_with_arm_elf_section_data (sec);
@@ -7938,11 +9951,25 @@ unrecord_section_via_map_over_sections (bfd * abfd ATTRIBUTE_UNUSED,
static bfd_boolean
elf32_arm_close_and_cleanup (bfd * abfd)
{
- bfd_map_over_sections (abfd, unrecord_section_via_map_over_sections, NULL);
+ if (abfd->sections)
+ bfd_map_over_sections (abfd,
+ unrecord_section_via_map_over_sections,
+ NULL);
return _bfd_elf_close_and_cleanup (abfd);
}
+static bfd_boolean
+elf32_arm_bfd_free_cached_info (bfd * abfd)
+{
+ if (abfd->sections)
+ bfd_map_over_sections (abfd,
+ unrecord_section_via_map_over_sections,
+ NULL);
+
+ return _bfd_free_cached_info (abfd);
+}
+
/* Display STT_ARM_TFUNC symbols as functions. */
static void
@@ -7958,13 +9985,14 @@ elf32_arm_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED,
/* Mangle thumb function symbols as we read them in. */
-static void
+static bfd_boolean
elf32_arm_swap_symbol_in (bfd * abfd,
const void *psrc,
const void *pshn,
Elf_Internal_Sym *dst)
{
- bfd_elf32_swap_symbol_in (abfd, psrc, pshn, dst);
+ if (!bfd_elf32_swap_symbol_in (abfd, psrc, pshn, dst))
+ return FALSE;
/* New EABI objects mark thumb function symbols by setting the low bit of
the address. Turn these into STT_ARM_TFUNC. */
@@ -7974,6 +10002,7 @@ elf32_arm_swap_symbol_in (bfd * abfd,
dst->st_info = ELF_ST_INFO (ELF_ST_BIND (dst->st_info), STT_ARM_TFUNC);
dst->st_value &= ~(bfd_vma) 1;
}
+ return TRUE;
}
@@ -7995,7 +10024,18 @@ elf32_arm_swap_symbol_out (bfd *abfd,
{
newsym = *src;
newsym.st_info = ELF_ST_INFO (ELF_ST_BIND (src->st_info), STT_FUNC);
- newsym.st_value |= 1;
+ if (newsym.st_shndx != SHN_UNDEF)
+ {
+ /* Do this only for defined symbols. At link type, the static
+ linker will simulate the work of dynamic linker of resolving
+ symbols and will carry over the thumbness of found symbols to
+ the output symbol table. It's not clear how it happens, but
+ the thumbness of undefined symbols can well be different at
+ runtime, and writing '1' for them will be confusing for users
+ and possibly for dynamic linker itself.
+ */
+ newsym.st_value |= 1;
+ }
src = &newsym;
}
@@ -8040,7 +10080,8 @@ elf32_arm_modify_segment_map (bfd *abfd,
/* We may add a PT_ARM_EXIDX program header. */
static int
-elf32_arm_additional_program_headers (bfd *abfd)
+elf32_arm_additional_program_headers (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
asection *sec;
@@ -8051,6 +10092,13 @@ elf32_arm_additional_program_headers (bfd *abfd)
return 0;
}
+/* We have two function types: STT_FUNC and STT_ARM_TFUNC. */
+static bfd_boolean
+elf32_arm_is_function_type (unsigned int type)
+{
+ return (type == STT_FUNC) || (type == STT_ARM_TFUNC);
+}
+
/* We use this to override swap_symbol_in and swap_symbol_out. */
const struct elf_size_info elf32_arm_size_info = {
sizeof (Elf32_External_Ehdr),
@@ -8088,6 +10136,7 @@ const struct elf_size_info elf32_arm_size_info = {
#define ELF_MAXPAGESIZE 0x8000
#endif
#define ELF_MINPAGESIZE 0x1000
+#define ELF_COMMONPAGESIZE 0x1000
#define bfd_elf32_mkobject elf32_arm_mkobject
@@ -8097,15 +10146,17 @@ const struct elf_size_info elf32_arm_size_info = {
#define bfd_elf32_bfd_print_private_bfd_data elf32_arm_print_private_bfd_data
#define bfd_elf32_bfd_link_hash_table_create elf32_arm_link_hash_table_create
#define bfd_elf32_bfd_reloc_type_lookup elf32_arm_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup elf32_arm_reloc_name_lookup
#define bfd_elf32_find_nearest_line elf32_arm_find_nearest_line
#define bfd_elf32_find_inliner_info elf32_arm_find_inliner_info
#define bfd_elf32_new_section_hook elf32_arm_new_section_hook
#define bfd_elf32_bfd_is_target_special_symbol elf32_arm_is_target_special_symbol
#define bfd_elf32_close_and_cleanup elf32_arm_close_and_cleanup
-#define bfd_elf32_bfd_final_link elf32_arm_bfd_final_link
+#define bfd_elf32_bfd_free_cached_info elf32_arm_bfd_free_cached_info
#define elf_backend_get_symbol_type elf32_arm_get_symbol_type
#define elf_backend_gc_mark_hook elf32_arm_gc_mark_hook
+#define elf_backend_gc_mark_extra_sections elf32_arm_gc_mark_extra_sections
#define elf_backend_gc_sweep_hook elf32_arm_gc_sweep_hook
#define elf_backend_check_relocs elf32_arm_check_relocs
#define elf_backend_relocate_section elf32_arm_relocate_section
@@ -8114,8 +10165,8 @@ const struct elf_size_info elf32_arm_size_info = {
#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_link_output_symbol_hook elf32_arm_output_symbol_hook
#define elf_backend_size_dynamic_sections elf32_arm_size_dynamic_sections
+#define elf_backend_init_index_section _bfd_elf_init_2_index_sections
#define elf_backend_post_process_headers elf32_arm_post_process_headers
#define elf_backend_reloc_type_class elf32_arm_reloc_type_class
#define elf_backend_object_p elf32_arm_object_p
@@ -8129,6 +10180,11 @@ const struct elf_size_info elf32_arm_size_info = {
#define elf_backend_modify_segment_map elf32_arm_modify_segment_map
#define elf_backend_additional_program_headers \
elf32_arm_additional_program_headers
+#define elf_backend_output_arch_local_syms \
+ elf32_arm_output_arch_local_syms
+#define elf_backend_begin_write_processing \
+ elf32_arm_begin_write_processing
+#define elf_backend_is_function_type elf32_arm_is_function_type
#define elf_backend_can_refcount 1
#define elf_backend_can_gc_sections 1
@@ -8138,10 +10194,18 @@ const struct elf_size_info elf32_arm_size_info = {
#define elf_backend_may_use_rel_p 1
#define elf_backend_may_use_rela_p 0
#define elf_backend_default_use_rela_p 0
-#define elf_backend_rela_normal 0
#define elf_backend_got_header_size 12
+#undef elf_backend_obj_attrs_vendor
+#define elf_backend_obj_attrs_vendor "aeabi"
+#undef elf_backend_obj_attrs_section
+#define elf_backend_obj_attrs_section ".ARM.attributes"
+#undef elf_backend_obj_attrs_arg_type
+#define elf_backend_obj_attrs_arg_type elf32_arm_obj_attrs_arg_type
+#undef elf_backend_obj_attrs_section_type
+#define elf_backend_obj_attrs_section_type SHT_ARM_ATTRIBUTES
+
#include "elf32-target.h"
/* VxWorks Targets */
@@ -8202,8 +10266,6 @@ elf32_arm_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker)
#define elf_backend_may_use_rela_p 1
#undef elf_backend_default_use_rela_p
#define elf_backend_default_use_rela_p 1
-#undef elf_backend_rela_normal
-#define elf_backend_rela_normal 1
#undef elf_backend_want_plt_sym
#define elf_backend_want_plt_sym 1
#undef ELF_MAXPAGESIZE
@@ -8254,24 +10316,23 @@ elf32_arm_symbian_special_sections[] =
the loadable read-only segment. The post-linker may wish to
refer to these sections, but they are not part of the final
program image. */
- { ".dynamic", 8, 0, SHT_DYNAMIC, 0 },
- { ".dynstr", 7, 0, SHT_STRTAB, 0 },
- { ".dynsym", 7, 0, SHT_DYNSYM, 0 },
- { ".got", 4, 0, SHT_PROGBITS, 0 },
- { ".hash", 5, 0, SHT_HASH, 0 },
+ { STRING_COMMA_LEN (".dynamic"), 0, SHT_DYNAMIC, 0 },
+ { STRING_COMMA_LEN (".dynstr"), 0, SHT_STRTAB, 0 },
+ { STRING_COMMA_LEN (".dynsym"), 0, SHT_DYNSYM, 0 },
+ { STRING_COMMA_LEN (".got"), 0, SHT_PROGBITS, 0 },
+ { STRING_COMMA_LEN (".hash"), 0, SHT_HASH, 0 },
/* These sections do not need to be writable as the SymbianOS
postlinker will arrange things so that no dynamic relocation is
required. */
- { ".init_array", 11, 0, SHT_INIT_ARRAY, SHF_ALLOC },
- { ".fini_array", 11, 0, SHT_FINI_ARRAY, SHF_ALLOC },
- { ".preinit_array", 14, 0, SHT_PREINIT_ARRAY, SHF_ALLOC },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".init_array"), 0, SHT_INIT_ARRAY, SHF_ALLOC },
+ { STRING_COMMA_LEN (".fini_array"), 0, SHT_FINI_ARRAY, SHF_ALLOC },
+ { STRING_COMMA_LEN (".preinit_array"), 0, SHT_PREINIT_ARRAY, SHF_ALLOC },
+ { NULL, 0, 0, 0, 0 }
};
static void
elf32_arm_symbian_begin_write_processing (bfd *abfd,
- struct bfd_link_info *link_info
- ATTRIBUTE_UNUSED)
+ struct bfd_link_info *link_info)
{
/* BPABI objects are never loaded directly by an OS kernel; they are
processed by a postlinker first, into an OS-specific format. If
@@ -8282,6 +10343,7 @@ elf32_arm_symbian_begin_write_processing (bfd *abfd,
recognize that the program headers should not be mapped into any
loadable segment. */
abfd->flags &= ~D_PAGED;
+ elf32_arm_begin_write_processing(abfd, link_info);
}
static bfd_boolean
@@ -8298,9 +10360,16 @@ elf32_arm_symbian_modify_segment_map (bfd *abfd,
dynsec = bfd_get_section_by_name (abfd, ".dynamic");
if (dynsec)
{
- m = _bfd_elf_make_dynamic_segment (abfd, dynsec);
- m->next = elf_tdata (abfd)->segment_map;
- elf_tdata (abfd)->segment_map = m;
+ for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
+ if (m->p_type == PT_DYNAMIC)
+ break;
+
+ if (m == NULL)
+ {
+ m = _bfd_elf_make_dynamic_segment (abfd, dynsec);
+ m->next = elf_tdata (abfd)->segment_map;
+ elf_tdata (abfd)->segment_map = m;
+ }
}
/* Also call the generic arm routine. */
@@ -8349,8 +10418,6 @@ elf32_arm_symbian_modify_segment_map (bfd *abfd,
#define elf_backend_may_use_rela_p 0
#undef elf_backend_default_use_rela_p
#define elf_backend_default_use_rela_p 0
-#undef elf_backend_rela_normal
-#define elf_backend_rela_normal 0
#undef elf_backend_want_plt_sym
#define elf_backend_want_plt_sym 0
#undef ELF_MAXPAGESIZE
diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c
index ec42bb335d1a..9169a8b88c38 100644
--- a/bfd/elf32-avr.c
+++ b/bfd/elf32-avr.c
@@ -1,5 +1,5 @@
/* AVR-specific support for 32-bit ELF
- Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2006
+ Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007
Free Software Foundation, Inc.
Contributed by Denis Chertykov <denisc@overta.ru>
@@ -20,11 +20,99 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/avr.h"
+#include "elf32-avr.h"
+
+/* Enable debugging printout at stdout with this variable. */
+static bfd_boolean debug_relax = FALSE;
+
+/* Enable debugging printout at stdout with this variable. */
+static bfd_boolean debug_stubs = FALSE;
+
+/* Hash table initialization and handling. Code is taken from the hppa port
+ and adapted to the needs of AVR. */
+
+/* We use two hash tables to hold information for linking avr objects.
+
+ The first is the elf32_avr_link_hash_tablse which is derived from the
+ stanard ELF linker hash table. We use this as a place to attach the other
+ hash table and some static information.
+
+ The second is the stub hash table which is derived from the base BFD
+ hash table. The stub hash table holds the information on the linker
+ stubs. */
+
+struct elf32_avr_stub_hash_entry
+{
+ /* Base hash table entry structure. */
+ struct bfd_hash_entry bh_root;
+
+ /* Offset within stub_sec of the beginning of this stub. */
+ bfd_vma stub_offset;
+
+ /* Given the symbol's value and its section we can determine its final
+ value when building the stubs (so the stub knows where to jump). */
+ bfd_vma target_value;
+
+ /* This way we could mark stubs to be no longer necessary. */
+ bfd_boolean is_actually_needed;
+};
+
+struct elf32_avr_link_hash_table
+{
+ /* The main hash table. */
+ struct elf_link_hash_table etab;
+
+ /* The stub hash table. */
+ struct bfd_hash_table bstab;
+
+ bfd_boolean no_stubs;
+
+ /* Linker stub bfd. */
+ bfd *stub_bfd;
+
+ /* The stub section. */
+ asection *stub_sec;
+
+ /* Usually 0, unless we are generating code for a bootloader. Will
+ be initialized by elf32_avr_size_stubs to the vma offset of the
+ output section associated with the stub section. */
+ bfd_vma vector_base;
+
+ /* Assorted information used by elf32_avr_size_stubs. */
+ unsigned int bfd_count;
+ int top_index;
+ asection ** input_list;
+ Elf_Internal_Sym ** all_local_syms;
+
+ /* Tables for mapping vma beyond the 128k boundary to the address of the
+ corresponding stub. (AMT)
+ "amt_max_entry_cnt" reflects the number of entries that memory is allocated
+ for in the "amt_stub_offsets" and "amt_destination_addr" arrays.
+ "amt_entry_cnt" informs how many of these entries actually contain
+ useful data. */
+ unsigned int amt_entry_cnt;
+ unsigned int amt_max_entry_cnt;
+ bfd_vma * amt_stub_offsets;
+ bfd_vma * amt_destination_addr;
+};
+
+/* Various hash macros and functions. */
+#define avr_link_hash_table(p) \
+ /* PR 3874: Check that we have an AVR style hash table before using it. */\
+ ((p)->hash->table.newfunc != elf32_avr_link_hash_newfunc ? NULL : \
+ ((struct elf32_avr_link_hash_table *) ((p)->hash)))
+
+#define avr_stub_hash_entry(ent) \
+ ((struct elf32_avr_stub_hash_entry *)(ent))
+
+#define avr_stub_hash_lookup(table, string, create, copy) \
+ ((struct elf32_avr_stub_hash_entry *) \
+ bfd_hash_lookup ((table), (string), (create), (copy)))
static reloc_howto_type elf_avr_howto_table[] =
{
@@ -101,7 +189,8 @@ static reloc_howto_type elf_avr_howto_table[] =
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
- /* A 16 bit absolute relocation for command address. */
+ /* A 16 bit absolute relocation for command address
+ Will be changed when linker stubs are needed. */
HOWTO (R_AVR_16_PM, /* type */
1, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
@@ -207,7 +296,7 @@ static reloc_howto_type elf_avr_howto_table[] =
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
/* A low 8 bit absolute relocation of 24 bit program memory address.
- For LDI command. */
+ For LDI command. Will not be changed when linker stubs are needed. */
HOWTO (R_AVR_LO8_LDI_PM, /* type */
1, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
@@ -221,8 +310,8 @@ static reloc_howto_type elf_avr_howto_table[] =
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
- /* A high 8 bit absolute relocation of 16 bit program memory address.
- For LDI command. */
+ /* A low 8 bit absolute relocation of 24 bit program memory address.
+ For LDI command. Will not be changed when linker stubs are needed. */
HOWTO (R_AVR_HI8_LDI_PM, /* type */
9, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
@@ -236,8 +325,8 @@ static reloc_howto_type elf_avr_howto_table[] =
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
- /* A high 8 bit absolute relocation of 24 bit program memory address.
- For LDI command. */
+ /* A low 8 bit absolute relocation of 24 bit program memory address.
+ For LDI command. Will not be changed when linker stubs are needed. */
HOWTO (R_AVR_HH8_LDI_PM, /* type */
17, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
@@ -251,8 +340,8 @@ static reloc_howto_type elf_avr_howto_table[] =
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
- /* A low 8 bit absolute relocation of a negative 24 bit
- program memory address. For LDI command. */
+ /* A low 8 bit absolute relocation of 24 bit program memory address.
+ For LDI command. Will not be changed when linker stubs are needed. */
HOWTO (R_AVR_LO8_LDI_PM_NEG, /* type */
1, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
@@ -266,8 +355,8 @@ static reloc_howto_type elf_avr_howto_table[] =
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
- /* A high 8 bit absolute relocation of a negative 16 bit
- program memory address. For LDI command. */
+ /* A low 8 bit absolute relocation of 24 bit program memory address.
+ For LDI command. Will not be changed when linker stubs are needed. */
HOWTO (R_AVR_HI8_LDI_PM_NEG, /* type */
9, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
@@ -281,8 +370,8 @@ static reloc_howto_type elf_avr_howto_table[] =
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
- /* A high 8 bit absolute relocation of a negative 24 bit
- program memory address. For LDI command. */
+ /* A low 8 bit absolute relocation of 24 bit program memory address.
+ For LDI command. Will not be changed when linker stubs are needed. */
HOWTO (R_AVR_HH8_LDI_PM_NEG, /* type */
17, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
@@ -382,7 +471,37 @@ static reloc_howto_type elf_avr_howto_table[] =
FALSE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- FALSE) /* pcrel_offset */
+ FALSE), /* pcrel_offset */
+ /* A low 8 bit absolute relocation of 24 bit program memory address.
+ For LDI command. Will be changed when linker stubs are needed. */
+ HOWTO (R_AVR_LO8_LDI_GS, /* type */
+ 1, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_AVR_LO8_LDI_GS", /* name */
+ FALSE, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+ /* A low 8 bit absolute relocation of 24 bit program memory address.
+ For LDI command. Will be changed when linker stubs are needed. */
+ HOWTO (R_AVR_HI8_LDI_GS, /* type */
+ 9, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_AVR_HI8_LDI_GS", /* name */
+ FALSE, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE) /* pcrel_offset */
};
/* Map BFD reloc types to AVR ELF reloc types. */
@@ -393,7 +512,7 @@ struct avr_reloc_map
unsigned int elf_reloc_val;
};
- static const struct avr_reloc_map avr_reloc_map[] =
+static const struct avr_reloc_map avr_reloc_map[] =
{
{ BFD_RELOC_NONE, R_AVR_NONE },
{ BFD_RELOC_32, R_AVR_32 },
@@ -410,7 +529,9 @@ struct avr_reloc_map
{ BFD_RELOC_AVR_HH8_LDI_NEG, R_AVR_HH8_LDI_NEG },
{ BFD_RELOC_AVR_MS8_LDI_NEG, R_AVR_MS8_LDI_NEG },
{ BFD_RELOC_AVR_LO8_LDI_PM, R_AVR_LO8_LDI_PM },
+ { BFD_RELOC_AVR_LO8_LDI_GS, R_AVR_LO8_LDI_GS },
{ BFD_RELOC_AVR_HI8_LDI_PM, R_AVR_HI8_LDI_PM },
+ { BFD_RELOC_AVR_HI8_LDI_GS, R_AVR_HI8_LDI_GS },
{ BFD_RELOC_AVR_HH8_LDI_PM, R_AVR_HH8_LDI_PM },
{ BFD_RELOC_AVR_LO8_LDI_PM_NEG, R_AVR_LO8_LDI_PM_NEG },
{ BFD_RELOC_AVR_HI8_LDI_PM_NEG, R_AVR_HI8_LDI_PM_NEG },
@@ -429,10 +550,116 @@ struct avr_reloc_map
that we will never suggest a wrap-around jump during relaxation.
The logic of the source code later on assumes that in
avr_pc_wrap_around one single bit is set. */
+static bfd_vma avr_pc_wrap_around = 0x10000000;
+
+/* If this variable holds a value different from zero, the linker relaxation
+ machine will try to optimize call/ret sequences by a single jump
+ instruction. This option could be switched off by a linker switch. */
+static int avr_replace_call_ret_sequences = 1;
+
+/* Initialize an entry in the stub hash table. */
+
+static struct bfd_hash_entry *
+stub_hash_newfunc (struct bfd_hash_entry *entry,
+ struct bfd_hash_table *table,
+ const char *string)
+{
+ /* Allocate the structure if it has not already been allocated by a
+ subclass. */
+ if (entry == NULL)
+ {
+ entry = bfd_hash_allocate (table,
+ sizeof (struct elf32_avr_stub_hash_entry));
+ if (entry == NULL)
+ return entry;
+ }
+
+ /* Call the allocation method of the superclass. */
+ entry = bfd_hash_newfunc (entry, table, string);
+ if (entry != NULL)
+ {
+ struct elf32_avr_stub_hash_entry *hsh;
+
+ /* Initialize the local fields. */
+ hsh = avr_stub_hash_entry (entry);
+ hsh->stub_offset = 0;
+ hsh->target_value = 0;
+ }
+
+ return entry;
+}
-unsigned int avr_pc_wrap_around = 0x10000000;
+/* This function is just a straight passthrough to the real
+ function in linker.c. Its prupose is so that its address
+ can be compared inside the avr_link_hash_table macro. */
+
+static struct bfd_hash_entry *
+elf32_avr_link_hash_newfunc (struct bfd_hash_entry * entry,
+ struct bfd_hash_table * table,
+ const char * string)
+{
+ return _bfd_elf_link_hash_newfunc (entry, table, string);
+}
+
+/* Create the derived linker hash table. The AVR ELF port uses the derived
+ hash table to keep information specific to the AVR ELF linker (without
+ using static variables). */
+
+static struct bfd_link_hash_table *
+elf32_avr_link_hash_table_create (bfd *abfd)
+{
+ struct elf32_avr_link_hash_table *htab;
+ bfd_size_type amt = sizeof (*htab);
+
+ htab = bfd_malloc (amt);
+ if (htab == NULL)
+ return NULL;
+
+ if (!_bfd_elf_link_hash_table_init (&htab->etab, abfd,
+ elf32_avr_link_hash_newfunc,
+ sizeof (struct elf_link_hash_entry)))
+ {
+ free (htab);
+ return NULL;
+ }
+
+ /* Init the stub hash table too. */
+ if (!bfd_hash_table_init (&htab->bstab, stub_hash_newfunc,
+ sizeof (struct elf32_avr_stub_hash_entry)))
+ return NULL;
+
+ htab->stub_bfd = NULL;
+ htab->stub_sec = NULL;
+
+ /* Initialize the address mapping table. */
+ htab->amt_stub_offsets = NULL;
+ htab->amt_destination_addr = NULL;
+ htab->amt_entry_cnt = 0;
+ htab->amt_max_entry_cnt = 0;
+
+ return &htab->etab.root;
+}
+
+/* Free the derived linker hash table. */
+
+static void
+elf32_avr_link_hash_table_free (struct bfd_link_hash_table *btab)
+{
+ struct elf32_avr_link_hash_table *htab
+ = (struct elf32_avr_link_hash_table *) btab;
+
+ /* Free the address mapping table. */
+ if (htab->amt_stub_offsets != NULL)
+ free (htab->amt_stub_offsets);
+ if (htab->amt_destination_addr != NULL)
+ free (htab->amt_destination_addr);
+
+ bfd_hash_table_free (&htab->bstab);
+ _bfd_generic_link_hash_table_free (btab);
+}
/* Calculates the effective distance of a pc relative jump/call. */
+
static int
avr_relative_distance_considering_wrap_around (unsigned int distance)
{
@@ -455,10 +682,24 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
for (i = 0;
i < sizeof (avr_reloc_map) / sizeof (struct avr_reloc_map);
i++)
- {
- if (avr_reloc_map[i].bfd_reloc_val == code)
- return &elf_avr_howto_table[avr_reloc_map[i].elf_reloc_val];
- }
+ if (avr_reloc_map[i].bfd_reloc_val == code)
+ return &elf_avr_howto_table[avr_reloc_map[i].elf_reloc_val];
+
+ return NULL;
+}
+
+static reloc_howto_type *
+bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (elf_avr_howto_table) / sizeof (elf_avr_howto_table[0]);
+ i++)
+ if (elf_avr_howto_table[i].name != NULL
+ && strcasecmp (elf_avr_howto_table[i].name, r_name) == 0)
+ return &elf_avr_howto_table[i];
return NULL;
}
@@ -477,48 +718,6 @@ avr_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED,
cache_ptr->howto = &elf_avr_howto_table[r_type];
}
-static asection *
-elf32_avr_gc_mark_hook (asection *sec,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
- Elf_Internal_Rela *rel,
- struct elf_link_hash_entry *h,
- Elf_Internal_Sym *sym)
-{
- if (h != NULL)
- {
- switch (ELF32_R_TYPE (rel->r_info))
- {
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
-
- return NULL;
-}
-
-static bfd_boolean
-elf32_avr_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
- asection *sec ATTRIBUTE_UNUSED,
- const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED)
-{
- /* We don't use got and plt entries for avr. */
- return TRUE;
-}
-
/* Look through the relocs for a section during the first phase.
Since we don't do .gots or .plts, we just need to consider the
virtual table relocs for gc. */
@@ -564,20 +763,57 @@ elf32_avr_check_relocs (bfd *abfd,
return TRUE;
}
+static bfd_boolean
+avr_stub_is_required_for_16_bit_reloc (bfd_vma relocation)
+{
+ return (relocation >= 0x020000);
+}
+
+/* Returns the address of the corresponding stub if there is one.
+ Returns otherwise an address above 0x020000. This function
+ could also be used, if there is no knowledge on the section where
+ the destination is found. */
+
+static bfd_vma
+avr_get_stub_addr (bfd_vma srel,
+ struct elf32_avr_link_hash_table *htab)
+{
+ unsigned int index;
+ bfd_vma stub_sec_addr =
+ (htab->stub_sec->output_section->vma +
+ htab->stub_sec->output_offset);
+
+ for (index = 0; index < htab->amt_max_entry_cnt; index ++)
+ if (htab->amt_destination_addr[index] == srel)
+ return htab->amt_stub_offsets[index] + stub_sec_addr;
+
+ /* Return an address that could not be reached by 16 bit relocs. */
+ return 0x020000;
+}
+
/* Perform a single relocation. By default we use the standard BFD
routines, but a few relocs, we have to do them ourselves. */
static bfd_reloc_status_type
-avr_final_link_relocate (reloc_howto_type * howto,
- bfd * input_bfd,
- asection * input_section,
- bfd_byte * contents,
- Elf_Internal_Rela * rel,
- bfd_vma relocation)
+avr_final_link_relocate (reloc_howto_type * howto,
+ bfd * input_bfd,
+ asection * input_section,
+ bfd_byte * contents,
+ Elf_Internal_Rela * rel,
+ bfd_vma relocation,
+ struct elf32_avr_link_hash_table * htab)
{
bfd_reloc_status_type r = bfd_reloc_ok;
bfd_vma x;
bfd_signed_vma srel;
+ bfd_signed_vma reloc_addr;
+ bfd_boolean use_stubs = FALSE;
+ /* Usually is 0, unless we are generating code for a bootloader. */
+ bfd_signed_vma base_addr = htab->vector_base;
+
+ /* Absolute addr of the reloc in the final excecutable. */
+ reloc_addr = rel->r_offset + input_section->output_section->vma
+ + input_section->output_offset;
switch (howto->type)
{
@@ -748,9 +984,31 @@ avr_final_link_relocate (reloc_howto_type * howto,
bfd_put_16 (input_bfd, x, contents);
break;
+ case R_AVR_LO8_LDI_GS:
+ use_stubs = (!htab->no_stubs);
+ /* Fall through. */
case R_AVR_LO8_LDI_PM:
contents += rel->r_offset;
srel = (bfd_signed_vma) relocation + rel->r_addend;
+
+ if (use_stubs
+ && avr_stub_is_required_for_16_bit_reloc (srel - base_addr))
+ {
+ bfd_vma old_srel = srel;
+
+ /* We need to use the address of the stub instead. */
+ srel = avr_get_stub_addr (srel, htab);
+ if (debug_stubs)
+ printf ("LD: Using jump stub (at 0x%x) with destination 0x%x for "
+ "reloc at address 0x%x.\n",
+ (unsigned int) srel,
+ (unsigned int) old_srel,
+ (unsigned int) reloc_addr);
+
+ if (avr_stub_is_required_for_16_bit_reloc (srel - base_addr))
+ return bfd_reloc_outofrange;
+ }
+
if (srel & 1)
return bfd_reloc_outofrange;
srel = srel >> 1;
@@ -759,9 +1017,31 @@ avr_final_link_relocate (reloc_howto_type * howto,
bfd_put_16 (input_bfd, x, contents);
break;
+ case R_AVR_HI8_LDI_GS:
+ use_stubs = (!htab->no_stubs);
+ /* Fall through. */
case R_AVR_HI8_LDI_PM:
contents += rel->r_offset;
srel = (bfd_signed_vma) relocation + rel->r_addend;
+
+ if (use_stubs
+ && avr_stub_is_required_for_16_bit_reloc (srel - base_addr))
+ {
+ bfd_vma old_srel = srel;
+
+ /* We need to use the address of the stub instead. */
+ srel = avr_get_stub_addr (srel, htab);
+ if (debug_stubs)
+ printf ("LD: Using jump stub (at 0x%x) with destination 0x%x for "
+ "reloc at address 0x%x.\n",
+ (unsigned int) srel,
+ (unsigned int) old_srel,
+ (unsigned int) reloc_addr);
+
+ if (avr_stub_is_required_for_16_bit_reloc (srel - base_addr))
+ return bfd_reloc_outofrange;
+ }
+
if (srel & 1)
return bfd_reloc_outofrange;
srel = srel >> 1;
@@ -833,6 +1113,35 @@ avr_final_link_relocate (reloc_howto_type * howto,
bfd_put_16 (input_bfd, (bfd_vma) srel & 0xffff, contents+2);
break;
+ case R_AVR_16_PM:
+ use_stubs = (!htab->no_stubs);
+ contents += rel->r_offset;
+ srel = (bfd_signed_vma) relocation + rel->r_addend;
+
+ if (use_stubs
+ && avr_stub_is_required_for_16_bit_reloc (srel - base_addr))
+ {
+ bfd_vma old_srel = srel;
+
+ /* We need to use the address of the stub instead. */
+ srel = avr_get_stub_addr (srel,htab);
+ if (debug_stubs)
+ printf ("LD: Using jump stub (at 0x%x) with destination 0x%x for "
+ "reloc at address 0x%x.\n",
+ (unsigned int) srel,
+ (unsigned int) old_srel,
+ (unsigned int) reloc_addr);
+
+ if (avr_stub_is_required_for_16_bit_reloc (srel - base_addr))
+ return bfd_reloc_outofrange;
+ }
+
+ if (srel & 1)
+ return bfd_reloc_outofrange;
+ srel = srel >> 1;
+ bfd_put_16 (input_bfd, (bfd_vma) srel &0x00ffff, contents);
+ break;
+
default:
r = _bfd_final_link_relocate (howto, input_bfd, input_section,
contents, rel->r_offset,
@@ -858,9 +1167,7 @@ elf32_avr_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
struct elf_link_hash_entry ** sym_hashes;
Elf_Internal_Rela * rel;
Elf_Internal_Rela * relend;
-
- if (info->relocatable)
- return TRUE;
+ struct elf32_avr_link_hash_table * htab = avr_link_hash_table (info);
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
@@ -878,7 +1185,6 @@ elf32_avr_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
const char * name;
int r_type;
- /* This is a final link. */
r_type = ELF32_R_TYPE (rel->r_info);
r_symndx = ELF32_R_SYM (rel->r_info);
howto = elf_avr_howto_table + ELF32_R_TYPE (rel->r_info);
@@ -908,8 +1214,22 @@ elf32_avr_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
name = h->root.root.string;
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
r = avr_final_link_relocate (howto, input_bfd, input_section,
- contents, rel, relocation);
+ contents, rel, relocation, htab);
if (r != bfd_reloc_ok)
{
@@ -990,6 +1310,10 @@ bfd_elf_avr_final_write_processing (bfd *abfd,
case bfd_mach_avr5:
val = E_AVR_MACH_AVR5;
break;
+
+ case bfd_mach_avr6:
+ val = E_AVR_MACH_AVR6;
+ break;
}
elf_elfheader (abfd)->e_machine = EM_AVR;
@@ -1032,6 +1356,10 @@ elf32_avr_object_p (bfd *abfd)
case E_AVR_MACH_AVR5:
e_set = bfd_mach_avr5;
break;
+
+ case E_AVR_MACH_AVR6:
+ e_set = bfd_mach_avr6;
+ break;
}
}
return bfd_default_set_arch_mach (abfd, bfd_arch_avr,
@@ -1039,9 +1367,6 @@ elf32_avr_object_p (bfd *abfd)
}
-/* Enable debugging printout at stdout with a value of 1. */
-#define DEBUG_RELAX 0
-
/* Delete some bytes from a section while changing the size of an instruction.
The parameter "addr" denotes the section-relative offset pointing just
behind the shrinked instruction. "addr+count" point at the first
@@ -1049,9 +1374,9 @@ elf32_avr_object_p (bfd *abfd)
static bfd_boolean
elf32_avr_relax_delete_bytes (bfd *abfd,
- asection *sec,
+ asection *sec,
bfd_vma addr,
- int count)
+ int count)
{
Elf_Internal_Shdr *symtab_hdr;
unsigned int sec_shndx;
@@ -1085,10 +1410,9 @@ elf32_avr_relax_delete_bytes (bfd *abfd,
(size_t) (toaddr - addr - count));
sec->size -= count;
- /* Adjust all the relocs. */
+ /* Adjust all the reloc addresses. */
for (irel = elf_section_data (sec)->relocs; irel < irelend; irel++)
{
- bfd_vma symval;
bfd_vma old_reloc_address;
bfd_vma shrinked_insn_address;
@@ -1101,7 +1425,7 @@ elf32_avr_relax_delete_bytes (bfd *abfd,
if ((irel->r_offset > addr
&& irel->r_offset < toaddr))
{
- if (DEBUG_RELAX)
+ if (debug_relax)
printf ("Relocation at address 0x%x needs to be moved.\n"
"Old section offset: 0x%x, New section offset: 0x%x \n",
(unsigned int) old_reloc_address,
@@ -1111,69 +1435,91 @@ elf32_avr_relax_delete_bytes (bfd *abfd,
irel->r_offset -= count;
}
- /* The reloc's own addresses are now ok. However, we need to readjust
- the reloc's addend if two conditions are met:
- 1.) the reloc is relative to a symbol in this section that
- is located in front of the shrinked instruction
- 2.) symbol plus addend end up behind the shrinked instruction.
-
- This should happen only for local symbols that are progmem related. */
-
- /* Read this BFD's local symbols if we haven't done so already. */
- if (isymbuf == NULL && symtab_hdr->sh_info != 0)
- {
- isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
- if (isymbuf == NULL)
- isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr,
- symtab_hdr->sh_info, 0,
- NULL, NULL, NULL);
- if (isymbuf == NULL)
- return FALSE;
- }
-
- /* Get the value of the symbol referred to by the reloc. */
- if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info)
- {
- /* A local symbol. */
- Elf_Internal_Sym *isym;
- asection *sym_sec;
+ }
- isym = isymbuf + ELF32_R_SYM (irel->r_info);
- sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx);
- symval = isym->st_value;
- /* If the reloc is absolute, it will not have
- a symbol or section associated with it. */
- if (sym_sec)
- {
- symval += sym_sec->output_section->vma
- + sym_sec->output_offset;
-
- if (DEBUG_RELAX)
- printf ("Checking if the relocation's "
- "addend needs corrections.\n"
- "Address of anchor symbol: 0x%x \n"
- "Address of relocation target: 0x%x \n"
- "Address of relaxed insn: 0x%x \n",
- (unsigned int) symval,
- (unsigned int) (symval + irel->r_addend),
- (unsigned int) shrinked_insn_address);
-
- if (symval <= shrinked_insn_address
- && (symval + irel->r_addend) > shrinked_insn_address)
+ /* The reloc's own addresses are now ok. However, we need to readjust
+ the reloc's addend, i.e. the reloc's value if two conditions are met:
+ 1.) the reloc is relative to a symbol in this section that
+ is located in front of the shrinked instruction
+ 2.) symbol plus addend end up behind the shrinked instruction.
+
+ The most common case where this happens are relocs relative to
+ the section-start symbol.
+
+ This step needs to be done for all of the sections of the bfd. */
+
+ {
+ struct bfd_section *isec;
+
+ for (isec = abfd->sections; isec; isec = isec->next)
+ {
+ bfd_vma symval;
+ bfd_vma shrinked_insn_address;
+
+ shrinked_insn_address = (sec->output_section->vma
+ + sec->output_offset + addr - count);
+
+ irelend = elf_section_data (isec)->relocs + isec->reloc_count;
+ for (irel = elf_section_data (isec)->relocs;
+ irel < irelend;
+ irel++)
+ {
+ /* Read this BFD's local symbols if we haven't done
+ so already. */
+ if (isymbuf == NULL && symtab_hdr->sh_info != 0)
+ {
+ isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
+ if (isymbuf == NULL)
+ isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr,
+ symtab_hdr->sh_info, 0,
+ NULL, NULL, NULL);
+ if (isymbuf == NULL)
+ return FALSE;
+ }
+
+ /* Get the value of the symbol referred to by the reloc. */
+ if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info)
+ {
+ /* A local symbol. */
+ Elf_Internal_Sym *isym;
+ asection *sym_sec;
+
+ isym = isymbuf + ELF32_R_SYM (irel->r_info);
+ sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx);
+ symval = isym->st_value;
+ /* If the reloc is absolute, it will not have
+ a symbol or section associated with it. */
+ if (sym_sec == sec)
{
- irel->r_addend -= count;
-
- if (DEBUG_RELAX)
- printf ("Anchor symbol and relocation target bracket "
- "shrinked insn address.\n"
- "Need for new addend : 0x%x\n",
- (unsigned int) irel->r_addend);
+ symval += sym_sec->output_section->vma
+ + sym_sec->output_offset;
+
+ if (debug_relax)
+ printf ("Checking if the relocation's "
+ "addend needs corrections.\n"
+ "Address of anchor symbol: 0x%x \n"
+ "Address of relocation target: 0x%x \n"
+ "Address of relaxed insn: 0x%x \n",
+ (unsigned int) symval,
+ (unsigned int) (symval + irel->r_addend),
+ (unsigned int) shrinked_insn_address);
+
+ if (symval <= shrinked_insn_address
+ && (symval + irel->r_addend) > shrinked_insn_address)
+ {
+ irel->r_addend -= count;
+
+ if (debug_relax)
+ printf ("Relocation's addend needed to be fixed \n");
+ }
}
- }
- /* else ... Reference symbol is absolute. No adjustment needed. */
- }
- /* else ... Reference symbol is extern. No need for adjusting the addend. */
- }
+ /* else...Reference symbol is absolute. No adjustment needed. */
+ }
+ /* else...Reference symbol is extern. No need for adjusting
+ the addend. */
+ }
+ }
+ }
/* Adjust the local symbols defined in this section. */
isym = (Elf_Internal_Sym *) symtab_hdr->contents;
@@ -1238,7 +1584,7 @@ elf32_avr_relax_delete_bytes (bfd *abfd,
contains 4-byte jump instructions whose relative offset must not
be changed. */
-static bfd_boolean
+static bfd_boolean
elf32_avr_relax_section (bfd *abfd,
asection *sec,
struct bfd_link_info *link_info,
@@ -1251,10 +1597,39 @@ elf32_avr_relax_section (bfd *abfd,
Elf_Internal_Sym *isymbuf = NULL;
static asection *last_input_section = NULL;
static Elf_Internal_Rela *last_reloc = NULL;
+ struct elf32_avr_link_hash_table *htab;
+
+ htab = avr_link_hash_table (link_info);
+ if (htab == NULL)
+ return FALSE;
/* Assume nothing changes. */
*again = FALSE;
+ if ((!htab->no_stubs) && (sec == htab->stub_sec))
+ {
+ /* We are just relaxing the stub section.
+ Let's calculate the size needed again. */
+ bfd_size_type last_estimated_stub_section_size = htab->stub_sec->size;
+
+ if (debug_relax)
+ printf ("Relaxing the stub section. Size prior to this pass: %i\n",
+ (int) last_estimated_stub_section_size);
+
+ elf32_avr_size_stubs (htab->stub_sec->output_section->owner,
+ link_info, FALSE);
+
+ /* Check if the number of trampolines changed. */
+ if (last_estimated_stub_section_size != htab->stub_sec->size)
+ *again = TRUE;
+
+ if (debug_relax)
+ printf ("Size of stub section after this pass: %i\n",
+ (int) htab->stub_sec->size);
+
+ return TRUE;
+ }
+
/* We don't have to do anything for a relocatable link, if
this section does not have relocs, or if this is not a
code section. */
@@ -1421,7 +1796,7 @@ elf32_avr_relax_section (bfd *abfd,
unsigned char code_msb;
unsigned char code_lsb;
- if (DEBUG_RELAX)
+ if (debug_relax)
printf ("shrinking jump/call instruction at address 0x%x"
" in section %s\n\n",
(int) dot, sec->name);
@@ -1496,8 +1871,9 @@ elf32_avr_relax_section (bfd *abfd,
+ sec->output_offset + irel->r_offset);
/* Here we look for rcall/ret or call/ret sequences that could be
- safely replaced by rjmp/ret or jmp/ret */
- if (0xd0 == (code_msb & 0xf0))
+ safely replaced by rjmp/ret or jmp/ret. */
+ if (((code_msb & 0xf0) == 0xd0)
+ && avr_replace_call_ret_sequences)
{
/* This insn is a rcall. */
unsigned char next_insn_msb = 0;
@@ -1517,7 +1893,7 @@ elf32_avr_relax_section (bfd *abfd,
into a rjmp instruction. */
code_msb &= 0xef;
bfd_put_8 (abfd, code_msb, contents + irel->r_offset + 1);
- if (DEBUG_RELAX)
+ if (debug_relax)
printf ("converted rcall/ret sequence at address 0x%x"
" into rjmp/ret sequence. Section is %s\n\n",
(int) dot, sec->name);
@@ -1526,7 +1902,8 @@ elf32_avr_relax_section (bfd *abfd,
}
}
else if ((0x94 == (code_msb & 0xfe))
- && (0x0e == (code_lsb & 0x0e)))
+ && (0x0e == (code_lsb & 0x0e))
+ && avr_replace_call_ret_sequences)
{
/* This insn is a call. */
unsigned char next_insn_msb = 0;
@@ -1547,7 +1924,7 @@ elf32_avr_relax_section (bfd *abfd,
code_lsb &= 0xfd;
bfd_put_8 (abfd, code_lsb, contents + irel->r_offset);
- if (DEBUG_RELAX)
+ if (debug_relax)
printf ("converted call/ret sequence at address 0x%x"
" into jmp/ret sequence. Section is %s\n\n",
(int) dot, sec->name);
@@ -1590,10 +1967,10 @@ elf32_avr_relax_section (bfd *abfd,
address_of_ret = dot + insn_size;
- if (DEBUG_RELAX && (insn_size == 2))
+ if (debug_relax && (insn_size == 2))
printf ("found rjmp / ret sequence at address 0x%x\n",
(int) dot);
- if (DEBUG_RELAX && (insn_size == 4))
+ if (debug_relax && (insn_size == 4))
printf ("found jmp / ret sequence at address 0x%x\n",
(int) dot);
@@ -1630,7 +2007,7 @@ elf32_avr_relax_section (bfd *abfd,
there_is_preceeding_non_skip_insn = 0;
if (there_is_preceeding_non_skip_insn == 0)
- if (DEBUG_RELAX)
+ if (debug_relax)
printf ("preceeding skip insn prevents deletion of"
" ret insn at addr 0x%x in section %s\n",
(int) dot + 2, sec->name);
@@ -1666,7 +2043,7 @@ elf32_avr_relax_section (bfd *abfd,
&& isym->st_shndx == sec_shndx)
{
deleting_ret_is_safe = 0;
- if (DEBUG_RELAX)
+ if (debug_relax)
printf ("local label prevents deletion of ret "
"insn at address 0x%x\n",
(int) dot + insn_size);
@@ -1695,7 +2072,7 @@ elf32_avr_relax_section (bfd *abfd,
&& sym_hash->root.u.def.value == section_offset_of_ret_insn)
{
deleting_ret_is_safe = 0;
- if (DEBUG_RELAX)
+ if (debug_relax)
printf ("global label prevents deletion of "
"ret insn at address 0x%x\n",
(int) dot + insn_size);
@@ -1772,7 +2149,7 @@ elf32_avr_relax_section (bfd *abfd,
if (address_of_ret == reloc_target)
{
deleting_ret_is_safe = 0;
- if (DEBUG_RELAX)
+ if (debug_relax)
printf ("ret from "
"rjmp/jmp ret sequence at address"
" 0x%x could not be deleted. ret"
@@ -1784,7 +2161,7 @@ elf32_avr_relax_section (bfd *abfd,
if (deleting_ret_is_safe)
{
- if (DEBUG_RELAX)
+ if (debug_relax)
printf ("unreachable ret instruction "
"at address 0x%x deleted.\n",
(int) dot + insn_size);
@@ -1952,6 +2329,625 @@ elf32_avr_get_relocated_section_contents (bfd *output_bfd,
}
+/* Determines the hash entry name for a particular reloc. It consists of
+ the identifier of the symbol section and the added reloc addend and
+ symbol offset relative to the section the symbol is attached to. */
+
+static char *
+avr_stub_name (const asection *symbol_section,
+ const bfd_vma symbol_offset,
+ const Elf_Internal_Rela *rela)
+{
+ char *stub_name;
+ bfd_size_type len;
+
+ len = 8 + 1 + 8 + 1 + 1;
+ stub_name = bfd_malloc (len);
+
+ sprintf (stub_name, "%08x+%08x",
+ symbol_section->id & 0xffffffff,
+ (unsigned int) ((rela->r_addend & 0xffffffff) + symbol_offset));
+
+ return stub_name;
+}
+
+
+/* Add a new stub entry to the stub hash. Not all fields of the new
+ stub entry are initialised. */
+
+static struct elf32_avr_stub_hash_entry *
+avr_add_stub (const char *stub_name,
+ struct elf32_avr_link_hash_table *htab)
+{
+ struct elf32_avr_stub_hash_entry *hsh;
+
+ /* Enter this entry into the linker stub hash table. */
+ hsh = avr_stub_hash_lookup (&htab->bstab, stub_name, TRUE, FALSE);
+
+ if (hsh == NULL)
+ {
+ (*_bfd_error_handler) (_("%B: cannot create stub entry %s"),
+ NULL, stub_name);
+ return NULL;
+ }
+
+ hsh->stub_offset = 0;
+ return hsh;
+}
+
+/* We assume that there is already space allocated for the stub section
+ contents and that before building the stubs the section size is
+ initialized to 0. We assume that within the stub hash table entry,
+ the absolute position of the jmp target has been written in the
+ target_value field. We write here the offset of the generated jmp insn
+ relative to the trampoline section start to the stub_offset entry in
+ the stub hash table entry. */
+
+static bfd_boolean
+avr_build_one_stub (struct bfd_hash_entry *bh, void *in_arg)
+{
+ struct elf32_avr_stub_hash_entry *hsh;
+ struct bfd_link_info *info;
+ struct elf32_avr_link_hash_table *htab;
+ bfd *stub_bfd;
+ bfd_byte *loc;
+ bfd_vma target;
+ bfd_vma starget;
+
+ /* Basic opcode */
+ bfd_vma jmp_insn = 0x0000940c;
+
+ /* Massage our args to the form they really have. */
+ hsh = avr_stub_hash_entry (bh);
+
+ if (!hsh->is_actually_needed)
+ return TRUE;
+
+ info = (struct bfd_link_info *) in_arg;
+
+ htab = avr_link_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
+ target = hsh->target_value;
+
+ /* Make a note of the offset within the stubs for this entry. */
+ hsh->stub_offset = htab->stub_sec->size;
+ loc = htab->stub_sec->contents + hsh->stub_offset;
+
+ stub_bfd = htab->stub_sec->owner;
+
+ if (debug_stubs)
+ printf ("Building one Stub. Address: 0x%x, Offset: 0x%x\n",
+ (unsigned int) target,
+ (unsigned int) hsh->stub_offset);
+
+ /* We now have to add the information on the jump target to the bare
+ opcode bits already set in jmp_insn. */
+
+ /* Check for the alignment of the address. */
+ if (target & 1)
+ return FALSE;
+
+ starget = target >> 1;
+ jmp_insn |= ((starget & 0x10000) | ((starget << 3) & 0x1f00000)) >> 16;
+ bfd_put_16 (stub_bfd, jmp_insn, loc);
+ bfd_put_16 (stub_bfd, (bfd_vma) starget & 0xffff, loc + 2);
+
+ htab->stub_sec->size += 4;
+
+ /* Now add the entries in the address mapping table if there is still
+ space left. */
+ {
+ unsigned int nr;
+
+ nr = htab->amt_entry_cnt + 1;
+ if (nr <= htab->amt_max_entry_cnt)
+ {
+ htab->amt_entry_cnt = nr;
+
+ htab->amt_stub_offsets[nr - 1] = hsh->stub_offset;
+ htab->amt_destination_addr[nr - 1] = target;
+ }
+ }
+
+ return TRUE;
+}
+
+static bfd_boolean
+avr_mark_stub_not_to_be_necessary (struct bfd_hash_entry *bh,
+ void *in_arg)
+{
+ struct elf32_avr_stub_hash_entry *hsh;
+ struct elf32_avr_link_hash_table *htab;
+
+ htab = in_arg;
+ hsh = avr_stub_hash_entry (bh);
+ hsh->is_actually_needed = FALSE;
+
+ return TRUE;
+}
+
+static bfd_boolean
+avr_size_one_stub (struct bfd_hash_entry *bh, void *in_arg)
+{
+ struct elf32_avr_stub_hash_entry *hsh;
+ struct elf32_avr_link_hash_table *htab;
+ int size;
+
+ /* Massage our args to the form they really have. */
+ hsh = avr_stub_hash_entry (bh);
+ htab = in_arg;
+
+ if (hsh->is_actually_needed)
+ size = 4;
+ else
+ size = 0;
+
+ htab->stub_sec->size += size;
+ return TRUE;
+}
+
+void
+elf32_avr_setup_params (struct bfd_link_info *info,
+ bfd *avr_stub_bfd,
+ asection *avr_stub_section,
+ bfd_boolean no_stubs,
+ bfd_boolean deb_stubs,
+ bfd_boolean deb_relax,
+ bfd_vma pc_wrap_around,
+ bfd_boolean call_ret_replacement)
+{
+ struct elf32_avr_link_hash_table *htab = avr_link_hash_table (info);
+
+ if (htab == NULL)
+ return;
+ htab->stub_sec = avr_stub_section;
+ htab->stub_bfd = avr_stub_bfd;
+ htab->no_stubs = no_stubs;
+
+ debug_relax = deb_relax;
+ debug_stubs = deb_stubs;
+ avr_pc_wrap_around = pc_wrap_around;
+ avr_replace_call_ret_sequences = call_ret_replacement;
+}
+
+
+/* Set up various things so that we can make a list of input sections
+ for each output section included in the link. Returns -1 on error,
+ 0 when no stubs will be needed, and 1 on success. It also sets
+ information on the stubs bfd and the stub section in the info
+ struct. */
+
+int
+elf32_avr_setup_section_lists (bfd *output_bfd,
+ struct bfd_link_info *info)
+{
+ bfd *input_bfd;
+ unsigned int bfd_count;
+ int top_id, top_index;
+ asection *section;
+ asection **input_list, **list;
+ bfd_size_type amt;
+ struct elf32_avr_link_hash_table *htab = avr_link_hash_table(info);
+
+ if (htab == NULL || htab->no_stubs)
+ return 0;
+
+ /* Count the number of input BFDs and find the top input section id. */
+ for (input_bfd = info->input_bfds, bfd_count = 0, top_id = 0;
+ input_bfd != NULL;
+ input_bfd = input_bfd->link_next)
+ {
+ bfd_count += 1;
+ for (section = input_bfd->sections;
+ section != NULL;
+ section = section->next)
+ if (top_id < section->id)
+ top_id = section->id;
+ }
+
+ htab->bfd_count = bfd_count;
+
+ /* We can't use output_bfd->section_count here to find the top output
+ section index as some sections may have been removed, and
+ strip_excluded_output_sections doesn't renumber the indices. */
+ for (section = output_bfd->sections, top_index = 0;
+ section != NULL;
+ section = section->next)
+ if (top_index < section->index)
+ top_index = section->index;
+
+ htab->top_index = top_index;
+ amt = sizeof (asection *) * (top_index + 1);
+ input_list = bfd_malloc (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);
+
+ for (section = output_bfd->sections;
+ section != NULL;
+ section = section->next)
+ if ((section->flags & SEC_CODE) != 0)
+ input_list[section->index] = NULL;
+
+ return 1;
+}
+
+
+/* Read in all local syms for all input bfds, and create hash entries
+ for export stubs if we are building a multi-subspace shared lib.
+ Returns -1 on error, 0 otherwise. */
+
+static int
+get_local_syms (bfd *input_bfd, struct bfd_link_info *info)
+{
+ unsigned int bfd_indx;
+ Elf_Internal_Sym *local_syms, **all_local_syms;
+ struct elf32_avr_link_hash_table *htab = avr_link_hash_table (info);
+
+ if (htab == NULL)
+ return -1;
+
+ /* We want to read in symbol extension records only once. To do this
+ we need to read in the local symbols in parallel and save them for
+ later use; so hold pointers to the local symbols in an array. */
+ bfd_size_type amt = sizeof (Elf_Internal_Sym *) * htab->bfd_count;
+ all_local_syms = bfd_zmalloc (amt);
+ htab->all_local_syms = all_local_syms;
+ if (all_local_syms == NULL)
+ return -1;
+
+ /* Walk over all the input BFDs, swapping in local symbols.
+ If we are creating a shared library, create hash entries for the
+ export stubs. */
+ for (bfd_indx = 0;
+ input_bfd != NULL;
+ input_bfd = input_bfd->link_next, bfd_indx++)
+ {
+ Elf_Internal_Shdr *symtab_hdr;
+
+ /* We'll need the symbol table in a second. */
+ symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+ if (symtab_hdr->sh_info == 0)
+ continue;
+
+ /* We need an array of the local symbols attached to the input bfd. */
+ 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);
+ /* Cache them for elf_link_input_bfd. */
+ symtab_hdr->contents = (unsigned char *) local_syms;
+ }
+ if (local_syms == NULL)
+ return -1;
+
+ all_local_syms[bfd_indx] = local_syms;
+ }
+
+ return 0;
+}
+
+#define ADD_DUMMY_STUBS_FOR_DEBUGGING 0
+
+bfd_boolean
+elf32_avr_size_stubs (bfd *output_bfd,
+ struct bfd_link_info *info,
+ bfd_boolean is_prealloc_run)
+{
+ struct elf32_avr_link_hash_table *htab;
+ int stub_changed = 0;
+
+ htab = avr_link_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
+ /* At this point we initialize htab->vector_base
+ To the start of the text output section. */
+ htab->vector_base = htab->stub_sec->output_section->vma;
+
+ if (get_local_syms (info->input_bfds, info))
+ {
+ if (htab->all_local_syms)
+ goto error_ret_free_local;
+ return FALSE;
+ }
+
+ if (ADD_DUMMY_STUBS_FOR_DEBUGGING)
+ {
+ struct elf32_avr_stub_hash_entry *test;
+
+ test = avr_add_stub ("Hugo",htab);
+ test->target_value = 0x123456;
+ test->stub_offset = 13;
+
+ test = avr_add_stub ("Hugo2",htab);
+ test->target_value = 0x84210;
+ test->stub_offset = 14;
+ }
+
+ while (1)
+ {
+ bfd *input_bfd;
+ unsigned int bfd_indx;
+
+ /* We will have to re-generate the stub hash table each time anything
+ in memory has changed. */
+
+ bfd_hash_traverse (&htab->bstab, avr_mark_stub_not_to_be_necessary, htab);
+ for (input_bfd = info->input_bfds, bfd_indx = 0;
+ input_bfd != NULL;
+ input_bfd = input_bfd->link_next, bfd_indx++)
+ {
+ Elf_Internal_Shdr *symtab_hdr;
+ asection *section;
+ Elf_Internal_Sym *local_syms;
+
+ /* We'll need the symbol table in a second. */
+ symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+ if (symtab_hdr->sh_info == 0)
+ continue;
+
+ local_syms = htab->all_local_syms[bfd_indx];
+
+ /* Walk over each section attached to the input bfd. */
+ for (section = input_bfd->sections;
+ section != NULL;
+ section = section->next)
+ {
+ Elf_Internal_Rela *internal_relocs, *irelaend, *irela;
+
+ /* If there aren't any relocs, then there's nothing more
+ to do. */
+ if ((section->flags & SEC_RELOC) == 0
+ || section->reloc_count == 0)
+ continue;
+
+ /* If this section is a link-once section that will be
+ discarded, then don't create any stubs. */
+ if (section->output_section == NULL
+ || section->output_section->owner != output_bfd)
+ continue;
+
+ /* Get the relocs. */
+ internal_relocs
+ = _bfd_elf_link_read_relocs (input_bfd, section, NULL, NULL,
+ info->keep_memory);
+ if (internal_relocs == NULL)
+ goto error_ret_free_local;
+
+ /* Now examine each relocation. */
+ irela = internal_relocs;
+ irelaend = irela + section->reloc_count;
+ for (; irela < irelaend; irela++)
+ {
+ unsigned int r_type, r_indx;
+ struct elf32_avr_stub_hash_entry *hsh;
+ asection *sym_sec;
+ bfd_vma sym_value;
+ bfd_vma destination;
+ struct elf_link_hash_entry *hh;
+ char *stub_name;
+
+ r_type = ELF32_R_TYPE (irela->r_info);
+ r_indx = ELF32_R_SYM (irela->r_info);
+
+ /* Only look for 16 bit GS relocs. No other reloc will need a
+ stub. */
+ if (!((r_type == R_AVR_16_PM)
+ || (r_type == R_AVR_LO8_LDI_GS)
+ || (r_type == R_AVR_HI8_LDI_GS)))
+ continue;
+
+ /* Now determine the call target, its name, value,
+ section. */
+ sym_sec = NULL;
+ sym_value = 0;
+ destination = 0;
+ hh = NULL;
+ if (r_indx < symtab_hdr->sh_info)
+ {
+ /* It's a local symbol. */
+ Elf_Internal_Sym *sym;
+ Elf_Internal_Shdr *hdr;
+
+ 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;
+ destination = (sym_value + irela->r_addend
+ + sym_sec->output_offset
+ + sym_sec->output_section->vma);
+ }
+ else
+ {
+ /* It's an external symbol. */
+ int e_indx;
+
+ e_indx = r_indx - symtab_hdr->sh_info;
+ hh = elf_sym_hashes (input_bfd)[e_indx];
+
+ while (hh->root.type == bfd_link_hash_indirect
+ || hh->root.type == bfd_link_hash_warning)
+ hh = (struct elf_link_hash_entry *)
+ (hh->root.u.i.link);
+
+ if (hh->root.type == bfd_link_hash_defined
+ || hh->root.type == bfd_link_hash_defweak)
+ {
+ sym_sec = hh->root.u.def.section;
+ sym_value = hh->root.u.def.value;
+ if (sym_sec->output_section != NULL)
+ destination = (sym_value + irela->r_addend
+ + sym_sec->output_offset
+ + sym_sec->output_section->vma);
+ }
+ else if (hh->root.type == bfd_link_hash_undefweak)
+ {
+ if (! info->shared)
+ continue;
+ }
+ else if (hh->root.type == bfd_link_hash_undefined)
+ {
+ if (! (info->unresolved_syms_in_objects == RM_IGNORE
+ && (ELF_ST_VISIBILITY (hh->other)
+ == STV_DEFAULT)))
+ continue;
+ }
+ else
+ {
+ bfd_set_error (bfd_error_bad_value);
+
+ error_ret_free_internal:
+ if (elf_section_data (section)->relocs == NULL)
+ free (internal_relocs);
+ goto error_ret_free_local;
+ }
+ }
+
+ if (! avr_stub_is_required_for_16_bit_reloc
+ (destination - htab->vector_base))
+ {
+ if (!is_prealloc_run)
+ /* We are having a reloc that does't need a stub. */
+ continue;
+
+ /* We don't right now know if a stub will be needed.
+ Let's rather be on the safe side. */
+ }
+
+ /* Get the name of this stub. */
+ stub_name = avr_stub_name (sym_sec, sym_value, irela);
+
+ if (!stub_name)
+ goto error_ret_free_internal;
+
+
+ hsh = avr_stub_hash_lookup (&htab->bstab,
+ stub_name,
+ FALSE, FALSE);
+ if (hsh != NULL)
+ {
+ /* The proper stub has already been created. Mark it
+ to be used and write the possibly changed destination
+ value. */
+ hsh->is_actually_needed = TRUE;
+ hsh->target_value = destination;
+ free (stub_name);
+ continue;
+ }
+
+ hsh = avr_add_stub (stub_name, htab);
+ if (hsh == NULL)
+ {
+ free (stub_name);
+ goto error_ret_free_internal;
+ }
+
+ hsh->is_actually_needed = TRUE;
+ hsh->target_value = destination;
+
+ if (debug_stubs)
+ printf ("Adding stub with destination 0x%x to the"
+ " hash table.\n", (unsigned int) destination);
+ if (debug_stubs)
+ printf ("(Pre-Alloc run: %i)\n", is_prealloc_run);
+
+ stub_changed = TRUE;
+ }
+
+ /* We're done with the internal relocs, free them. */
+ if (elf_section_data (section)->relocs == NULL)
+ free (internal_relocs);
+ }
+ }
+
+ /* Re-Calculate the number of needed stubs. */
+ htab->stub_sec->size = 0;
+ bfd_hash_traverse (&htab->bstab, avr_size_one_stub, htab);
+
+ if (!stub_changed)
+ break;
+
+ stub_changed = FALSE;
+ }
+
+ free (htab->all_local_syms);
+ return TRUE;
+
+ error_ret_free_local:
+ free (htab->all_local_syms);
+ return FALSE;
+}
+
+
+/* Build all the stubs associated with the current output file. The
+ stubs are kept in a hash table attached to the main linker hash
+ table. We also set up the .plt entries for statically linked PIC
+ functions here. This function is called via hppaelf_finish in the
+ linker. */
+
+bfd_boolean
+elf32_avr_build_stubs (struct bfd_link_info *info)
+{
+ asection *stub_sec;
+ struct bfd_hash_table *table;
+ struct elf32_avr_link_hash_table *htab;
+ bfd_size_type total_size = 0;
+
+ htab = avr_link_hash_table (info);
+ if (htab == NULL)
+ return FALSE;
+
+ /* In case that there were several stub sections: */
+ for (stub_sec = htab->stub_bfd->sections;
+ stub_sec != NULL;
+ stub_sec = stub_sec->next)
+ {
+ bfd_size_type size;
+
+ /* Allocate memory to hold the linker stubs. */
+ size = stub_sec->size;
+ total_size += size;
+
+ stub_sec->contents = bfd_zalloc (htab->stub_bfd, size);
+ if (stub_sec->contents == NULL && size != 0)
+ return FALSE;
+ stub_sec->size = 0;
+ }
+
+ /* Allocate memory for the adress mapping table. */
+ htab->amt_entry_cnt = 0;
+ htab->amt_max_entry_cnt = total_size / 4;
+ htab->amt_stub_offsets = bfd_malloc (sizeof (bfd_vma)
+ * htab->amt_max_entry_cnt);
+ htab->amt_destination_addr = bfd_malloc (sizeof (bfd_vma)
+ * htab->amt_max_entry_cnt );
+
+ if (debug_stubs)
+ printf ("Allocating %i entries in the AMT\n", htab->amt_max_entry_cnt);
+
+ /* Build the stubs as directed by the stub hash table. */
+ table = &htab->bstab;
+ bfd_hash_traverse (table, avr_build_one_stub, info);
+
+ if (debug_stubs)
+ printf ("Final Stub section Size: %i\n", (int) htab->stub_sec->size);
+
+ return TRUE;
+}
+
#define ELF_ARCH bfd_arch_avr
#define ELF_MACHINE_CODE EM_AVR
#define ELF_MACHINE_ALT1 EM_AVR_OLD
@@ -1960,11 +2956,12 @@ elf32_avr_get_relocated_section_contents (bfd *output_bfd,
#define TARGET_LITTLE_SYM bfd_elf32_avr_vec
#define TARGET_LITTLE_NAME "elf32-avr"
+#define bfd_elf32_bfd_link_hash_table_create elf32_avr_link_hash_table_create
+#define bfd_elf32_bfd_link_hash_table_free elf32_avr_link_hash_table_free
+
#define elf_info_to_howto avr_info_to_howto_rela
#define elf_info_to_howto_rel NULL
#define elf_backend_relocate_section elf32_avr_relocate_section
-#define elf_backend_gc_mark_hook elf32_avr_gc_mark_hook
-#define elf_backend_gc_sweep_hook elf32_avr_gc_sweep_hook
#define elf_backend_check_relocs elf32_avr_check_relocs
#define elf_backend_can_gc_sections 1
#define elf_backend_rela_normal 1
diff --git a/bfd/elf32-avr.h b/bfd/elf32-avr.h
new file mode 100644
index 000000000000..4b9035fa4753
--- /dev/null
+++ b/bfd/elf32-avr.h
@@ -0,0 +1,38 @@
+/* AVR-specific support for 32-bit ELF.
+ Copyright 2006 Free Software Foundation, Inc.
+
+ Written by Bjoern Haase <bjoern.m.haase@web.de>
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor,
+ Boston, MA 02110-1301, USA. */
+
+
+/* These four functions will be called from the ld back-end. */
+
+extern void
+elf32_avr_setup_params (struct bfd_link_info *, bfd *, asection *,
+ bfd_boolean, bfd_boolean, bfd_boolean,
+ bfd_vma, bfd_boolean);
+
+extern int
+elf32_avr_setup_section_lists (bfd *, struct bfd_link_info *);
+
+extern bfd_boolean
+elf32_avr_size_stubs (bfd *, struct bfd_link_info *, bfd_boolean);
+
+extern bfd_boolean
+elf32_avr_build_stubs (struct bfd_link_info *);
diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c
index d5a81dbc6057..bf8ed86882e2 100644
--- a/bfd/elf32-bfin.c
+++ b/bfd/elf32-bfin.c
@@ -1,5 +1,5 @@
/* ADI Blackfin BFD support for 32-bit ELF.
- Copyright 2005, 2006 Free Software Foundation, Inc.
+ Copyright 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/bfin.h"
@@ -1057,8 +1057,8 @@ bfin_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
else
cache_ptr->howto = (reloc_howto_type *) NULL;
-
}
+
/* Given a BFD reloc type, return the howto. */
static reloc_howto_type *
bfin_bfd_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
@@ -1078,8 +1078,33 @@ bfin_bfd_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
return &bfin_gnuext_howto_table [r_type - BFIN_GNUEXT_RELOC_MIN];
return (reloc_howto_type *) NULL;
+}
+
+static reloc_howto_type *
+bfin_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+ for (i = 0;
+ i < (sizeof (bfin_howto_table)
+ / sizeof (bfin_howto_table[0]));
+ i++)
+ if (bfin_howto_table[i].name != NULL
+ && strcasecmp (bfin_howto_table[i].name, r_name) == 0)
+ return &bfin_howto_table[i];
+
+ for (i = 0;
+ i < (sizeof (bfin_gnuext_howto_table)
+ / sizeof (bfin_gnuext_howto_table[0]));
+ i++)
+ if (bfin_gnuext_howto_table[i].name != NULL
+ && strcasecmp (bfin_gnuext_howto_table[i].name, r_name) == 0)
+ return &bfin_gnuext_howto_table[i];
+
+ return NULL;
}
+
/* Given a bfin relocation type, return the howto. */
static reloc_howto_type *
bfin_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
@@ -1092,7 +1117,6 @@ bfin_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
return &bfin_gnuext_howto_table [r_type - BFIN_GNUEXT_RELOC_MIN];
return (reloc_howto_type *) NULL;
-
}
/* Return TRUE if the name is a local label.
@@ -1961,7 +1985,7 @@ bfin_check_relocs (bfd * abfd,
case R_got:
if (h != NULL
- && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
+ && strcmp (h->root.root.string, "__GLOBAL_OFFSET_TABLE_") == 0)
break;
/* Fall through. */
@@ -1984,15 +2008,12 @@ bfin_check_relocs (bfd * abfd,
srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
if (srelgot == NULL)
{
- srelgot = bfd_make_section (dynobj, ".rela.got");
+ flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY | SEC_LINKER_CREATED
+ | SEC_READONLY);
+ srelgot = bfd_make_section_with_flags (dynobj, ".rela.got",
+ flags);
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;
}
@@ -2112,9 +2133,6 @@ bfinfdpic_relocate_section (bfd * output_bfd,
check_segment[2];
int silence_segment_error = !(info->shared || info->pie);
- if (info->relocatable)
- return TRUE;
-
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
relend = relocs + input_section->reloc_count;
@@ -2155,7 +2173,6 @@ bfinfdpic_relocate_section (bfd * output_bfd,
|| r_type == R_BFIN_GNU_VTENTRY)
continue;
- /* This is a final link. */
r_symndx = ELF32_R_SYM (rel->r_info);
howto = bfin_reloc_type_lookup (input_bfd, r_type);
if (howto == NULL)
@@ -2180,48 +2197,37 @@ bfinfdpic_relocate_section (bfd * output_bfd,
}
else
{
- h = sym_hashes [r_symndx - symtab_hdr->sh_info];
+ bfd_boolean warned;
+ bfd_boolean unresolved_reloc;
- 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);
+ osec = sec;
+ }
+
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
- name = h->root.root.string;
+ if (info->relocatable)
+ continue;
- if ((h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && ! BFINFDPIC_SYM_LOCAL (info, h))
- {
- sec = NULL;
- relocation = 0;
- }
- else
- if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- {
- sec = h->root.u.def.section;
- relocation = (h->root.u.def.value
- + sec->output_section->vma
- + sec->output_offset);
- }
- else if (h->root.type == bfd_link_hash_undefweak)
- {
- relocation = 0;
- }
- else if (info->unresolved_syms_in_objects == RM_IGNORE
- && 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->unresolved_syms_in_objects == RM_GENERATE_ERROR
- || ELF_ST_VISIBILITY (h->other)))))
- return FALSE;
- relocation = 0;
- }
- osec = sec;
+ if (h != NULL
+ && (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && !BFINFDPIC_SYM_LOCAL (info, h))
+ {
+ osec = sec = NULL;
+ relocation = 0;
}
switch (r_type)
@@ -2435,6 +2441,8 @@ bfinfdpic_relocate_section (bfd * output_bfd,
input_section->output_section)
& (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD))
{
+ bfd_vma offset;
+
if (_bfinfdpic_osec_readonly_p (output_bfd,
input_section
->output_section))
@@ -2445,15 +2453,23 @@ bfinfdpic_relocate_section (bfd * output_bfd,
name, input_bfd, input_section, rel->r_offset);
return FALSE;
}
- _bfinfdpic_add_dyn_reloc (output_bfd,
- bfinfdpic_gotrel_section (info),
- _bfd_elf_section_offset
- (output_bfd, info,
- input_section, rel->r_offset)
- + input_section
- ->output_section->vma
- + input_section->output_offset,
- r_type, dynindx, addend, picrel);
+ offset = _bfd_elf_section_offset (output_bfd, info,
+ input_section, rel->r_offset);
+ /* Only output a reloc for a not deleted entry. */
+ if (offset >= (bfd_vma) -2)
+ _bfinfdpic_add_dyn_reloc (output_bfd,
+ bfinfdpic_gotrel_section (info),
+ 0,
+ R_unused0,
+ dynindx, addend, picrel);
+ else
+ _bfinfdpic_add_dyn_reloc (output_bfd,
+ bfinfdpic_gotrel_section (info),
+ offset + input_section
+ ->output_section->vma
+ + input_section->output_offset,
+ r_type,
+ dynindx, addend, picrel);
}
else
addend += bfinfdpic_got_section (info)->output_section->vma;
@@ -2824,9 +2840,6 @@ bfin_relocate_section (bfd * output_bfd,
Elf_Internal_Rela *relend;
int i = 0;
- 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);
@@ -2883,13 +2896,27 @@ bfin_relocate_section (bfd * output_bfd,
else
{
bfd_boolean warned;
- h = NULL;
+
RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
r_symndx, symtab_hdr, sym_hashes,
h, sec, relocation,
unresolved_reloc, warned);
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
address = rel->r_offset;
/* Then, process normally. */
@@ -2903,7 +2930,7 @@ bfin_relocate_section (bfd * output_bfd,
/* Relocation is to the address of the entry for this symbol
in the global offset table. */
if (h != NULL
- && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
+ && strcmp (h->root.root.string, "__GLOBAL_OFFSET_TABLE_") == 0)
goto do_default;
/* Fall through. */
/* Relocation is the offset of the entry for this symbol in
@@ -3099,51 +3126,20 @@ bfin_relocate_section (bfd * output_bfd,
static asection *
bfin_gc_mark_hook (asection * sec,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info,
Elf_Internal_Rela * rel,
struct elf_link_hash_entry *h,
Elf_Internal_Sym * sym)
{
if (h != NULL)
- {
- switch (ELF32_R_TYPE (rel->r_info))
- {
-
- case R_BFIN_GNU_VTINHERIT:
- case R_BFIN_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- default:
- break;
-
- 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;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
-
- return NULL;
-}
-
-
-/* Update the got entry reference counts for the section being removed. */
+ switch (ELF32_R_TYPE (rel->r_info))
+ {
+ case R_BFIN_GNU_VTINHERIT:
+ case R_BFIN_GNU_VTENTRY:
+ return NULL;
+ }
-static bfd_boolean
-bfinfdpic_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
- asection *sec ATTRIBUTE_UNUSED,
- const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED)
-{
- return TRUE;
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
/* Update the got entry reference counts for the section being removed. */
@@ -3291,7 +3287,7 @@ _bfin_create_got_section (bfd *abfd, struct bfd_link_info *info)
(or .got.plt) section. We don't do this in the linker script
because we don't want to define the symbol if we are not creating
a global offset table. */
- h = _bfd_elf_define_linkage_sym (abfd, info, s, "_GLOBAL_OFFSET_TABLE_");
+ h = _bfd_elf_define_linkage_sym (abfd, info, s, "__GLOBAL_OFFSET_TABLE_");
elf_hash_table (info)->hgot = h;
if (h == NULL)
return FALSE;
@@ -3370,9 +3366,8 @@ elf32_bfinfdpic_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
if (bed->plt_readonly)
pltflags |= SEC_READONLY;
- s = bfd_make_section (abfd, ".plt");
+ s = bfd_make_section_with_flags (abfd, ".plt", pltflags);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, pltflags)
|| ! bfd_set_section_alignment (abfd, s, bed->plt_alignment))
return FALSE;
/* Blackfin-specific: remember it. */
@@ -3386,7 +3381,7 @@ elf32_bfinfdpic_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
struct bfd_link_hash_entry *bh = NULL;
if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, "_PROCEDURE_LINKAGE_TABLE_", BSF_GLOBAL, s, 0, NULL,
+ (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;
@@ -3399,9 +3394,8 @@ elf32_bfinfdpic_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
}
/* Blackfin-specific: we want rel relocations for the plt. */
- s = bfd_make_section (abfd, ".rel.plt");
+ s = bfd_make_section_with_flags (abfd, ".rel.plt", flags | SEC_READONLY);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
|| ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
return FALSE;
/* Blackfin-specific: remember it. */
@@ -3425,9 +3419,9 @@ elf32_bfinfdpic_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
image and use a R_*_COPY reloc to tell the dynamic linker to
initialize them at run time. The linker script puts the .dynbss
section into the .bss section of the final image. */
- s = bfd_make_section (abfd, ".dynbss");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, SEC_ALLOC | SEC_LINKER_CREATED))
+ s = bfd_make_section_with_flags (abfd, ".dynbss",
+ SEC_ALLOC | SEC_LINKER_CREATED);
+ if (s == NULL)
return FALSE;
/* The .rel[a].bss section holds copy relocs. This section is not
@@ -3443,11 +3437,11 @@ elf32_bfinfdpic_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
copy relocs. */
if (! info->shared)
{
- s = bfd_make_section (abfd,
- (bed->default_use_rela_p
- ? ".rela.bss" : ".rel.bss"));
+ s = bfd_make_section_with_flags (abfd,
+ (bed->default_use_rela_p
+ ? ".rela.bss" : ".rel.bss"),
+ flags | SEC_READONLY);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
|| ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
return FALSE;
}
@@ -4151,7 +4145,6 @@ elf32_bfinfdpic_always_size_sections (bfd *output_bfd,
if (!info->relocatable)
{
struct elf_link_hash_entry *h;
- asection *sec;
/* Force a PT_GNU_STACK segment to be created. */
if (! elf_tdata (output_bfd)->stack_flags)
@@ -4177,61 +4170,51 @@ elf32_bfinfdpic_always_size_sections (bfd *output_bfd,
h->def_regular = 1;
h->type = STT_OBJECT;
}
-
- /* Create a stack section, and set its alignment. */
- sec = bfd_make_section (output_bfd, ".stack");
-
- if (sec == NULL
- || ! bfd_set_section_alignment (output_bfd, sec, 3))
- return FALSE;
}
return TRUE;
}
static bfd_boolean
-elf32_bfinfdpic_modify_segment_map (bfd *output_bfd,
- struct bfd_link_info *info)
+elf32_bfinfdpic_modify_program_headers (bfd *output_bfd,
+ struct bfd_link_info *info)
{
+ struct elf_obj_tdata *tdata = elf_tdata (output_bfd);
struct elf_segment_map *m;
+ Elf_Internal_Phdr *p;
/* objcopy and strip preserve what's already there using
elf32_bfinfdpic_copy_private_bfd_data (). */
if (! info)
return TRUE;
- for (m = elf_tdata (output_bfd)->segment_map; m != NULL; m = m->next)
+ for (p = tdata->phdr, m = tdata->segment_map; m != NULL; m = m->next, p++)
if (m->p_type == PT_GNU_STACK)
break;
if (m)
{
- asection *sec = bfd_get_section_by_name (output_bfd, ".stack");
struct elf_link_hash_entry *h;
- if (sec)
+ /* Obtain the pointer to the __stacksize symbol. */
+ h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize",
+ FALSE, FALSE, FALSE);
+ if (h)
{
- /* Obtain the pointer to the __stacksize symbol. */
- h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize",
- FALSE, FALSE, 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;
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
BFD_ASSERT (h->root.type == bfd_link_hash_defined);
+ }
- /* Set the section size from the symbol value. We
- intentionally ignore the symbol section. */
- if (h->root.type == bfd_link_hash_defined)
- sec->size = h->root.u.def.value;
- else
- sec->size = DEFAULT_STACK_SIZE;
+ /* Set the header p_memsz from the symbol value. We
+ intentionally ignore the symbol section. */
+ if (h && h->root.type == bfd_link_hash_defined)
+ p->p_memsz = h->root.u.def.value;
+ else
+ p->p_memsz = DEFAULT_STACK_SIZE;
- /* Add the stack section to the PT_GNU_STACK segment,
- such that its size and alignment requirements make it
- to the segment. */
- m->sections[m->count] = sec;
- m->count++;
- }
+ p->p_align = 8;
}
return TRUE;
@@ -4742,6 +4725,10 @@ bfin_elf_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
elf_flags_init (obfd) = TRUE;
+
+ /* Copy object attributes. */
+ _bfd_elf_copy_obj_attributes (ibfd, obfd);
+
return TRUE;
}
@@ -5035,7 +5022,7 @@ bfin_finish_dynamic_symbol (bfd * output_bfd,
&& (info->symbolic
|| h->dynindx == -1 || h->forced_local) && h->def_regular)
{
-fprintf(stderr, "*** check this relocation %s\n", __FUNCTION__);
+ fprintf(stderr, "*** check this relocation %s\n", __FUNCTION__);
rela.r_info = ELF32_R_INFO (0, R_pcrel24);
rela.r_addend = bfd_get_signed_32 (output_bfd,
(sgot->contents
@@ -5061,7 +5048,7 @@ fprintf(stderr, "*** check this relocation %s\n", __FUNCTION__);
BFD_ASSERT (0);
}
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+ if (strcmp (h->root.root.string, "__DYNAMIC") == 0
|| h == elf_hash_table (info)->hgot)
sym->st_shndx = SHN_ABS;
@@ -5298,7 +5285,7 @@ bfin_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
strip = FALSE;
- if (strncmp (name, ".rela", 5) == 0)
+ if (CONST_STRNEQ (name, ".rela"))
{
if (s->size == 0)
{
@@ -5322,7 +5309,7 @@ bfin_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
s->reloc_count = 0;
}
}
- else if (strncmp (name, ".got", 4) != 0)
+ else if (! CONST_STRNEQ (name, ".got"))
{
/* It's not one of our sections, so don't allocate space. */
continue;
@@ -5516,6 +5503,8 @@ error_return:
#define elf_symbol_leading_char '_'
#define bfd_elf32_bfd_reloc_type_lookup bfin_bfd_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup \
+ bfin_bfd_reloc_name_lookup
#define elf_info_to_howto bfin_info_to_howto
#define elf_info_to_howto_rel 0
#define elf_backend_object_p elf32_bfin_object_p
@@ -5570,7 +5559,6 @@ error_return:
#define elf32_bed elf32_bfinfdpic_bed
#undef elf_backend_gc_sweep_hook
-#define elf_backend_gc_sweep_hook bfinfdpic_gc_sweep_hook
#undef elf_backend_got_header_size
#define elf_backend_got_header_size 0
@@ -5586,9 +5574,9 @@ error_return:
#undef elf_backend_always_size_sections
#define elf_backend_always_size_sections \
elf32_bfinfdpic_always_size_sections
-#undef elf_backend_modify_segment_map
-#define elf_backend_modify_segment_map \
- elf32_bfinfdpic_modify_segment_map
+#undef elf_backend_modify_program_headers
+#define elf_backend_modify_program_headers \
+ elf32_bfinfdpic_modify_program_headers
#undef bfd_elf32_bfd_copy_private_bfd_data
#define bfd_elf32_bfd_copy_private_bfd_data \
elf32_bfinfdpic_copy_private_bfd_data
diff --git a/bfd/elf32-cr16.c b/bfd/elf32-cr16.c
new file mode 100644
index 000000000000..197bff720085
--- /dev/null
+++ b/bfd/elf32-cr16.c
@@ -0,0 +1,1433 @@
+/* BFD back-end for National Semiconductor's CR16 ELF
+ Copyright 2007 Free Software Foundation, Inc.
+ Written by M R Swami Reddy.
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "bfdlink.h"
+#include "libbfd.h"
+#include "libiberty.h"
+#include "elf-bfd.h"
+#include "elf/cr16.h"
+
+/* cr16_reloc_map array maps BFD relocation enum into a CRGAS relocation type. */
+
+struct cr16_reloc_map
+{
+ bfd_reloc_code_real_type bfd_reloc_enum; /* BFD relocation enum. */
+ unsigned short cr16_reloc_type; /* CR16 relocation type. */
+};
+
+static const struct cr16_reloc_map cr16_reloc_map[R_CR16_MAX] =
+{
+ {BFD_RELOC_NONE, R_CR16_NONE},
+ {BFD_RELOC_CR16_NUM8, R_CR16_NUM8},
+ {BFD_RELOC_CR16_NUM16, R_CR16_NUM16},
+ {BFD_RELOC_CR16_NUM32, R_CR16_NUM32},
+ {BFD_RELOC_CR16_NUM32a, R_CR16_NUM32a},
+ {BFD_RELOC_CR16_REGREL4, R_CR16_REGREL4},
+ {BFD_RELOC_CR16_REGREL4a, R_CR16_REGREL4a},
+ {BFD_RELOC_CR16_REGREL14, R_CR16_REGREL14},
+ {BFD_RELOC_CR16_REGREL14a, R_CR16_REGREL14a},
+ {BFD_RELOC_CR16_REGREL16, R_CR16_REGREL16},
+ {BFD_RELOC_CR16_REGREL20, R_CR16_REGREL20},
+ {BFD_RELOC_CR16_REGREL20a, R_CR16_REGREL20a},
+ {BFD_RELOC_CR16_ABS20, R_CR16_ABS20},
+ {BFD_RELOC_CR16_ABS24, R_CR16_ABS24},
+ {BFD_RELOC_CR16_IMM4, R_CR16_IMM4},
+ {BFD_RELOC_CR16_IMM8, R_CR16_IMM8},
+ {BFD_RELOC_CR16_IMM16, R_CR16_IMM16},
+ {BFD_RELOC_CR16_IMM20, R_CR16_IMM20},
+ {BFD_RELOC_CR16_IMM24, R_CR16_IMM24},
+ {BFD_RELOC_CR16_IMM32, R_CR16_IMM32},
+ {BFD_RELOC_CR16_IMM32a, R_CR16_IMM32a},
+ {BFD_RELOC_CR16_DISP4, R_CR16_DISP4},
+ {BFD_RELOC_CR16_DISP8, R_CR16_DISP8},
+ {BFD_RELOC_CR16_DISP16, R_CR16_DISP16},
+ {BFD_RELOC_CR16_DISP24, R_CR16_DISP24},
+ {BFD_RELOC_CR16_DISP24a, R_CR16_DISP24a}
+};
+
+static reloc_howto_type cr16_elf_howto_table[] =
+{
+ HOWTO (R_CR16_NONE, /* type */
+ 0, /* rightshift */
+ 2, /* size */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_NONE", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_NUM8, /* type */
+ 0, /* rightshift */
+ 0, /* size */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_NUM8", /* name */
+ FALSE, /* partial_inplace */
+ 0xff, /* src_mask */
+ 0xff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_NUM16, /* type */
+ 0, /* rightshift */
+ 1, /* size */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_NUM16", /* name */
+ FALSE, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_NUM32, /* type */
+ 0, /* rightshift */
+ 2, /* size */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_NUM32", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_NUM32a, /* type */
+ 1, /* rightshift */
+ 2, /* size */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_NUM32a", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_REGREL4, /* type */
+ 0, /* rightshift */
+ 0, /* size */
+ 4, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_REGREL4", /* name */
+ FALSE, /* partial_inplace */
+ 0xf, /* src_mask */
+ 0xf, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_REGREL4a, /* type */
+ 0, /* rightshift */
+ 0, /* size */
+ 4, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_REGREL4a", /* name */
+ FALSE, /* partial_inplace */
+ 0xf, /* src_mask */
+ 0xf, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_REGREL14, /* type */
+ 0, /* rightshift */
+ 1, /* size */
+ 14, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_REGREL14", /* name */
+ FALSE, /* partial_inplace */
+ 0x3fff, /* src_mask */
+ 0x3fff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_REGREL14a, /* type */
+ 0, /* rightshift */
+ 1, /* size */
+ 14, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_REGREL14a", /* name */
+ FALSE, /* partial_inplace */
+ 0x3fff, /* src_mask */
+ 0x3fff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_REGREL16, /* type */
+ 0, /* rightshift */
+ 1, /* size */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_REGREL16", /* name */
+ FALSE, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_REGREL20, /* type */
+ 0, /* rightshift */
+ 2, /* size */
+ 20, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_REGREL20", /* name */
+ FALSE, /* partial_inplace */
+ 0xfffff, /* src_mask */
+ 0xfffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_REGREL20a, /* type */
+ 0, /* rightshift */
+ 2, /* size */
+ 20, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_REGREL20a", /* name */
+ FALSE, /* partial_inplace */
+ 0xfffff, /* src_mask */
+ 0xfffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_ABS20, /* type */
+ 0, /* rightshift */
+ 2, /* size */
+ 20, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_ABS20", /* name */
+ FALSE, /* partial_inplace */
+ 0xfffff, /* src_mask */
+ 0xfffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_ABS24, /* type */
+ 0, /* rightshift */
+ 2, /* size */
+ 24, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_ABS24", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffff, /* src_mask */
+ 0xffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_IMM4, /* type */
+ 0, /* rightshift */
+ 0, /* size */
+ 4, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_IMM4", /* name */
+ FALSE, /* partial_inplace */
+ 0xf, /* src_mask */
+ 0xf, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_IMM8, /* type */
+ 0, /* rightshift */
+ 0, /* size */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_IMM8", /* name */
+ FALSE, /* partial_inplace */
+ 0xff, /* src_mask */
+ 0xff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_IMM16, /* type */
+ 0, /* rightshift */
+ 1, /* size */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_IMM16", /* name */
+ FALSE, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_IMM20, /* type */
+ 0, /* rightshift */
+ 2, /* size */
+ 20, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_IMM20", /* name */
+ FALSE, /* partial_inplace */
+ 0xfffff, /* src_mask */
+ 0xfffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_IMM24, /* type */
+ 0, /* rightshift */
+ 2, /* size */
+ 24, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_IMM24", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffff, /* src_mask */
+ 0xffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_IMM32, /* type */
+ 0, /* rightshift */
+ 2, /* size */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_IMM32", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_IMM32a, /* type */
+ 1, /* rightshift */
+ 2, /* size */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_IMM32a", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_DISP4, /* type */
+ 1, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 4, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_DISP4", /* name */
+ FALSE, /* partial_inplace */
+ 0xf, /* src_mask */
+ 0xf, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_DISP8, /* type */
+ 1, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_DISP8", /* name */
+ FALSE, /* partial_inplace */
+ 0x1ff, /* src_mask */
+ 0x1ff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_DISP16, /* type */
+ 0, /* rightshift REVIITS: To sync with WinIDEA*/
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_DISP16", /* name */
+ FALSE, /* partial_inplace */
+ 0x1ffff, /* src_mask */
+ 0x1ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+ /* REVISIT: DISP24 should be left-shift by 2 as per ISA doc
+ but its not done, to sync with WinIDEA and CR16 4.1 tools */
+ HOWTO (R_CR16_DISP24, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 24, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_DISP24", /* name */
+ FALSE, /* partial_inplace */
+ 0x1ffffff, /* src_mask */
+ 0x1ffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_CR16_DISP24a, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 24, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_CR16_DISP24a", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffff, /* src_mask */
+ 0xffffff, /* dst_mask */
+ FALSE) /* pcrel_offset */
+};
+
+/* Retrieve a howto ptr using a BFD reloc_code. */
+
+static reloc_howto_type *
+elf_cr16_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_reloc_code_real_type code)
+{
+ unsigned int i;
+
+ for (i = 0; i < R_CR16_MAX; i++)
+ if (code == cr16_reloc_map[i].bfd_reloc_enum)
+ return &cr16_elf_howto_table[cr16_reloc_map[i].cr16_reloc_type];
+
+ _bfd_error_handler ("Unsupported CR16 relocation type: 0x%x\n", code);
+ return NULL;
+}
+
+static reloc_howto_type *
+elf_cr16_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0; ARRAY_SIZE (cr16_elf_howto_table); i++)
+ if (cr16_elf_howto_table[i].name != NULL
+ && strcasecmp (cr16_elf_howto_table[i].name, r_name) == 0)
+ return cr16_elf_howto_table + i;
+
+ return NULL;
+}
+
+/* Retrieve a howto ptr using an internal relocation entry. */
+
+static void
+elf_cr16_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr,
+ Elf_Internal_Rela *dst)
+{
+ unsigned int r_type = ELF32_R_TYPE (dst->r_info);
+
+ BFD_ASSERT (r_type < (unsigned int) R_CR16_MAX);
+ cache_ptr->howto = &cr16_elf_howto_table[r_type];
+}
+
+/* Perform a relocation as part of a final link. */
+
+static bfd_reloc_status_type
+cr16_elf_final_link_relocate (reloc_howto_type *howto,
+ bfd *input_bfd,
+ bfd *output_bfd ATTRIBUTE_UNUSED,
+ asection *input_section,
+ bfd_byte *contents,
+ bfd_vma offset,
+ bfd_vma Rvalue,
+ bfd_vma addend,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ asection *sec ATTRIBUTE_UNUSED,
+ int is_local ATTRIBUTE_UNUSED)
+{
+ unsigned short r_type = howto->type;
+ bfd_byte *hit_data = contents + offset;
+ bfd_vma reloc_bits, check, Rvalue1;
+
+ switch (r_type)
+ {
+ case R_CR16_IMM4:
+ case R_CR16_IMM8:
+ case R_CR16_IMM16:
+ case R_CR16_IMM20:
+ case R_CR16_IMM32:
+ case R_CR16_IMM32a:
+ case R_CR16_REGREL4:
+ case R_CR16_REGREL4a:
+ case R_CR16_REGREL14:
+ case R_CR16_REGREL14a:
+ case R_CR16_REGREL16:
+ case R_CR16_REGREL20:
+ case R_CR16_ABS20:
+ case R_CR16_ABS24:
+ case R_CR16_DISP16:
+ case R_CR16_DISP24:
+ /* 'hit_data' is relative to the start of the instruction, not the
+ relocation offset. Advance it to account for the exact offset. */
+ hit_data += 2;
+ break;
+
+ case R_CR16_NONE:
+ return bfd_reloc_ok;
+ break;
+
+ case R_CR16_DISP4:
+ case R_CR16_DISP8:
+ case R_CR16_DISP24a:
+ /* We only care about the addend, where the difference between
+ expressions is kept. */
+ if (is_local) Rvalue -= -1;
+
+ default:
+ break;
+ }
+
+ if (howto->pc_relative)
+ {
+ /* Subtract the address of the section containing the location. */
+ Rvalue -= (input_section->output_section->vma
+ + input_section->output_offset);
+ /* Subtract the position of the location within the section. */
+ Rvalue -= offset;
+ }
+
+ /* Add in supplied addend. */
+ Rvalue += addend;
+
+ /* Complain if the bitfield overflows, whether it is considered
+ as signed or unsigned. */
+ check = Rvalue >> howto->rightshift;
+
+ /* Assumes two's complement. This expression avoids
+ overflow if howto->bitsize is the number of bits in
+ bfd_vma. */
+ reloc_bits = (((1 << (howto->bitsize - 1)) - 1) << 1) | 1;
+
+ if (((bfd_vma) check & ~reloc_bits) != 0
+ && (((bfd_vma) check & ~reloc_bits)
+ != (-(bfd_vma) 1 & ~reloc_bits)))
+ {
+ /* The above right shift is incorrect for a signed
+ value. See if turning on the upper bits fixes the
+ overflow. */
+ if (howto->rightshift && (bfd_signed_vma) Rvalue < 0)
+ {
+ check |= ((bfd_vma) - 1
+ & ~((bfd_vma) - 1
+ >> howto->rightshift));
+
+ if (((bfd_vma) check & ~reloc_bits)
+ != (-(bfd_vma) 1 & ~reloc_bits))
+ return bfd_reloc_overflow;
+ }
+ else
+ return bfd_reloc_overflow;
+ }
+
+ /* Drop unwanted bits from the value we are relocating to. */
+ Rvalue >>= (bfd_vma) howto->rightshift;
+
+ /* Apply dst_mask to select only relocatable part of the insn. */
+ Rvalue &= howto->dst_mask;
+
+ switch (howto->size)
+ {
+ case 0:
+ if ((r_type == R_CR16_IMM4)
+ || (r_type == R_CR16_DISP4)
+ || (r_type == R_CR16_DISP8))
+ {
+ Rvalue1 = bfd_get_16 (input_bfd, hit_data);
+ Rvalue = ((Rvalue1 & 0xf000) | ((Rvalue << 4) & 0xf00)
+ | (Rvalue1 & 0x00f0) | (Rvalue & 0xf));
+ bfd_put_16 (input_bfd, Rvalue, hit_data);
+ }
+ break;
+
+ case 1:
+ if (r_type == R_CR16_DISP16)
+ {
+ Rvalue |= (bfd_get_16 (input_bfd, hit_data));
+ Rvalue = ((Rvalue & 0xfffe) | ((Rvalue >> 16) & 0x1));
+
+ bfd_put_16 (input_bfd, Rvalue, hit_data);
+ }
+ break;
+
+ case 2:
+ if (r_type == R_CR16_ABS20)
+ {
+ Rvalue |= (((bfd_get_16 (input_bfd, hit_data) << 16)
+ | (bfd_get_16 (input_bfd, hit_data + 2)))
+ & ~howto->dst_mask);
+ Rvalue |= (bfd_get_16 (input_bfd, hit_data + 2) << 16);
+
+ /* Relocation on INSTRUCTIONS is different : Instructions are
+ word-addressable, that is, each word itself is arranged according
+ to little-endian convention, whereas the words are arranged with
+ respect to one another in BIG ENDIAN fashion.
+ When there is an immediate value that spans a word boundary,
+ it is split in a big-endian way with respect to the words. */
+ bfd_put_16 (input_bfd, (Rvalue) & 0xffff, hit_data);
+ bfd_put_16 (input_bfd, (Rvalue >> 16)& 0xffff, hit_data + 2);
+ }
+ else if (r_type == R_CR16_ABS24)
+ {
+ Rvalue = ((((Rvalue >> 20)& 0xf)
+ | (((Rvalue >> 16) & 0xf) << 8)
+ | (bfd_get_16 (input_bfd, hit_data)))
+ | ((Rvalue & 0xffff) << 16));
+
+ bfd_put_32 (input_bfd, Rvalue, hit_data);
+ }
+ else if (r_type == R_CR16_DISP24)
+ {
+ Rvalue = ((((Rvalue >> 20)& 0xf) | (((Rvalue >> 16) & 0xf)<<8)
+ | (bfd_get_16 (input_bfd, hit_data)))
+ | (((Rvalue & 0xfffE) | ((Rvalue >> 24) & 0x1)) << 16));
+
+ bfd_put_32 (input_bfd, Rvalue, hit_data);
+ }
+ else if ((r_type == R_CR16_IMM32) || (r_type == R_CR16_IMM32a))
+ {
+ Rvalue = (((Rvalue >> 16)& 0xffff)
+ | (bfd_get_16 (input_bfd, hit_data)))
+ | ((Rvalue & 0xffff) << 16);
+ bfd_put_32 (input_bfd, Rvalue, hit_data);
+ }
+ else if (r_type == R_CR16_DISP24a)
+ {
+ Rvalue = (((Rvalue & 0xfffffe) | (Rvalue >> 23)));
+ Rvalue = ((Rvalue >> 16) & 0xff) | ((Rvalue & 0xffff) << 16)
+ | (bfd_get_32 (input_bfd, hit_data));
+
+ bfd_put_32 (input_bfd, Rvalue, hit_data);
+ }
+ else if ((r_type == R_CR16_NUM32) || (r_type == R_CR16_NUM32a))
+ {
+ bfd_put_32 (input_bfd, Rvalue, hit_data);
+ }
+ break;
+
+ default:
+ return bfd_reloc_notsupported;
+ }
+
+ return bfd_reloc_ok;
+}
+
+/* Delete some bytes from a section while relaxing. */
+
+static bfd_boolean
+elf32_cr16_relax_delete_bytes (struct bfd_link_info *link_info, bfd *abfd,
+ asection *sec, bfd_vma addr, int count)
+{
+ Elf_Internal_Shdr *symtab_hdr;
+ unsigned int sec_shndx;
+ bfd_byte *contents;
+ Elf_Internal_Rela *irel, *irelend;
+ Elf_Internal_Rela *irelalign;
+ bfd_vma toaddr;
+ Elf_Internal_Sym *isym;
+ Elf_Internal_Sym *isymend;
+ struct elf_link_hash_entry **sym_hashes;
+ struct elf_link_hash_entry **end_hashes;
+ struct elf_link_hash_entry **start_hashes;
+ unsigned int symcount;
+
+ sec_shndx = _bfd_elf_section_from_bfd_section (abfd, sec);
+
+ contents = elf_section_data (sec)->this_hdr.contents;
+
+ /* The deletion must stop at the next ALIGN reloc for an aligment
+ power larger than the number of bytes we are deleting. */
+ irelalign = NULL;
+ toaddr = sec->size;
+
+ irel = elf_section_data (sec)->relocs;
+ irelend = irel + sec->reloc_count;
+
+ /* Actually delete the bytes. */
+ memmove (contents + addr, contents + addr + count,
+ (size_t) (toaddr - addr - count));
+ sec->size -= count;
+
+ /* Adjust all the relocs. */
+ for (irel = elf_section_data (sec)->relocs; irel < irelend; irel++)
+ /* Get the new reloc address. */
+ if ((irel->r_offset > addr && irel->r_offset < toaddr))
+ irel->r_offset -= count;
+
+ /* Adjust the local symbols defined in this section. */
+ symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+ isym = (Elf_Internal_Sym *) symtab_hdr->contents;
+ for (isymend = isym + symtab_hdr->sh_info; isym < isymend; isym++)
+ {
+ if (isym->st_shndx == sec_shndx
+ && isym->st_value > addr
+ && isym->st_value < toaddr)
+ {
+ /* Adjust the addend of SWITCH relocations in this section,
+ which reference this local symbol. */
+ for (irel = elf_section_data (sec)->relocs; irel < irelend; irel++)
+ {
+ unsigned long r_symndx;
+ Elf_Internal_Sym *rsym;
+ bfd_vma addsym, subsym;
+
+ r_symndx = ELF32_R_SYM (irel->r_info);
+ rsym = (Elf_Internal_Sym *) symtab_hdr->contents + r_symndx;
+
+ /* Skip if not the local adjusted symbol. */
+ if (rsym != isym)
+ continue;
+
+ addsym = isym->st_value;
+ subsym = addsym - irel->r_addend;
+
+ /* Fix the addend only when -->> (addsym > addr >= subsym). */
+ if (subsym <= addr)
+ irel->r_addend -= count;
+ else
+ continue;
+ }
+
+ isym->st_value -= count;
+ }
+ }
+
+ /* Now adjust the global symbols defined in this section. */
+ symcount = (symtab_hdr->sh_size / sizeof (Elf32_External_Sym)
+ - symtab_hdr->sh_info);
+ sym_hashes = start_hashes = elf_sym_hashes (abfd);
+ end_hashes = sym_hashes + symcount;
+
+ for (; sym_hashes < end_hashes; sym_hashes++)
+ {
+ struct elf_link_hash_entry *sym_hash = *sym_hashes;
+
+ /* The '--wrap SYMBOL' option is causing a pain when the object file,
+ containing the definition of __wrap_SYMBOL, includes a direct
+ call to SYMBOL as well. Since both __wrap_SYMBOL and SYMBOL reference
+ the same symbol (which is __wrap_SYMBOL), but still exist as two
+ different symbols in 'sym_hashes', we don't want to adjust
+ the global symbol __wrap_SYMBOL twice.
+ This check is only relevant when symbols are being wrapped. */
+ if (link_info->wrap_hash != NULL)
+ {
+ struct elf_link_hash_entry **cur_sym_hashes;
+
+ /* Loop only over the symbols whom been already checked. */
+ for (cur_sym_hashes = start_hashes; cur_sym_hashes < sym_hashes;
+ cur_sym_hashes++)
+ /* If the current symbol is identical to 'sym_hash', that means
+ the symbol was already adjusted (or at least checked). */
+ if (*cur_sym_hashes == sym_hash)
+ break;
+
+ /* Don't adjust the symbol again. */
+ if (cur_sym_hashes < sym_hashes)
+ continue;
+ }
+
+ if ((sym_hash->root.type == bfd_link_hash_defined
+ || sym_hash->root.type == bfd_link_hash_defweak)
+ && sym_hash->root.u.def.section == sec
+ && sym_hash->root.u.def.value > addr
+ && sym_hash->root.u.def.value < toaddr)
+ sym_hash->root.u.def.value -= count;
+ }
+
+ return TRUE;
+}
+
+/* Relocate a CR16 ELF section. */
+
+static bfd_boolean
+elf32_cr16_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
+ bfd *input_bfd, asection *input_section,
+ bfd_byte *contents, Elf_Internal_Rela *relocs,
+ Elf_Internal_Sym *local_syms,
+ asection **local_sections)
+{
+ Elf_Internal_Shdr *symtab_hdr;
+ struct elf_link_hash_entry **sym_hashes;
+ Elf_Internal_Rela *rel, *relend;
+
+ if (info->relocatable)
+ return TRUE;
+
+ symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+ sym_hashes = elf_sym_hashes (input_bfd);
+
+ rel = relocs;
+ relend = relocs + input_section->reloc_count;
+ for (; rel < relend; rel++)
+ {
+ int r_type;
+ reloc_howto_type *howto;
+ unsigned long r_symndx;
+ Elf_Internal_Sym *sym;
+ asection *sec;
+ struct elf_link_hash_entry *h;
+ bfd_vma relocation;
+ bfd_reloc_status_type r;
+
+ r_symndx = ELF32_R_SYM (rel->r_info);
+ r_type = ELF32_R_TYPE (rel->r_info);
+ howto = cr16_elf_howto_table + (r_type);
+
+ h = NULL;
+ sym = NULL;
+ sec = NULL;
+ if (r_symndx < symtab_hdr->sh_info)
+ {
+ sym = local_syms + r_symndx;
+ sec = local_sections[r_symndx];
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
+ }
+ else
+ {
+ bfd_boolean unresolved_reloc, warned;
+
+ RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
+ r_symndx, symtab_hdr, sym_hashes,
+ h, sec, relocation,
+ unresolved_reloc, warned);
+ }
+
+ r = cr16_elf_final_link_relocate (howto, input_bfd, output_bfd,
+ input_section,
+ contents, rel->r_offset,
+ relocation, rel->r_addend,
+ info, sec, h == NULL);
+
+ if (r != bfd_reloc_ok)
+ {
+ const char *name;
+ const char *msg = NULL;
+
+ if (h != NULL)
+ name = h->root.root.string;
+ else
+ {
+ name = (bfd_elf_string_from_elf_section
+ (input_bfd, symtab_hdr->sh_link, sym->st_name));
+ if (name == NULL || *name == '\0')
+ name = bfd_section_name (input_bfd, sec);
+ }
+
+ switch (r)
+ {
+ case bfd_reloc_overflow:
+ if (!((*info->callbacks->reloc_overflow)
+ (info, (h ? &h->root : NULL), name, howto->name,
+ (bfd_vma) 0, input_bfd, input_section,
+ rel->r_offset)))
+ return FALSE;
+ break;
+
+ case bfd_reloc_undefined:
+ if (!((*info->callbacks->undefined_symbol)
+ (info, name, input_bfd, input_section,
+ rel->r_offset, TRUE)))
+ return FALSE;
+ break;
+
+ case bfd_reloc_outofrange:
+ msg = _("internal error: out of range error");
+ goto common_error;
+
+ case bfd_reloc_notsupported:
+ msg = _("internal error: unsupported relocation error");
+ goto common_error;
+
+ case bfd_reloc_dangerous:
+ msg = _("internal error: dangerous error");
+ goto common_error;
+
+ default:
+ msg = _("internal error: unknown error");
+ /* Fall through. */
+
+ common_error:
+ if (!((*info->callbacks->warning)
+ (info, msg, name, input_bfd, input_section,
+ rel->r_offset)))
+ return FALSE;
+ break;
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+/* This is a version of bfd_generic_get_relocated_section_contents
+ which uses elf32_cr16_relocate_section. */
+
+static bfd_byte *
+elf32_cr16_get_relocated_section_contents (bfd *output_bfd,
+ struct bfd_link_info *link_info,
+ struct bfd_link_order *link_order,
+ bfd_byte *data,
+ bfd_boolean relocatable,
+ asymbol **symbols)
+{
+ Elf_Internal_Shdr *symtab_hdr;
+ asection *input_section = link_order->u.indirect.section;
+ bfd *input_bfd = input_section->owner;
+ asection **sections = NULL;
+ Elf_Internal_Rela *internal_relocs = NULL;
+ Elf_Internal_Sym *isymbuf = NULL;
+
+ /* We only need to handle the case of relaxing, or of having a
+ particular set of section contents, specially. */
+ if (relocatable
+ || elf_section_data (input_section)->this_hdr.contents == NULL)
+ return bfd_generic_get_relocated_section_contents (output_bfd, link_info,
+ link_order, data,
+ relocatable,
+ symbols);
+
+ symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+
+ memcpy (data, elf_section_data (input_section)->this_hdr.contents,
+ (size_t) input_section->size);
+
+ if ((input_section->flags & SEC_RELOC) != 0
+ && input_section->reloc_count > 0)
+ {
+ Elf_Internal_Sym *isym;
+ Elf_Internal_Sym *isymend;
+ asection **secpp;
+ bfd_size_type amt;
+
+ internal_relocs = _bfd_elf_link_read_relocs (input_bfd, input_section,
+ NULL, NULL, FALSE);
+ if (internal_relocs == NULL)
+ goto error_return;
+
+ if (symtab_hdr->sh_info != 0)
+ {
+ isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
+ if (isymbuf == NULL)
+ isymbuf = bfd_elf_get_elf_syms (input_bfd, symtab_hdr,
+ symtab_hdr->sh_info, 0,
+ NULL, NULL, NULL);
+ if (isymbuf == NULL)
+ goto error_return;
+ }
+
+ amt = symtab_hdr->sh_info;
+ amt *= sizeof (asection *);
+ sections = bfd_malloc (amt);
+ if (sections == NULL && amt != 0)
+ goto error_return;
+
+ isymend = isymbuf + symtab_hdr->sh_info;
+ for (isym = isymbuf, secpp = sections; isym < isymend; ++isym, ++secpp)
+ {
+ asection *isec;
+
+ if (isym->st_shndx == SHN_UNDEF)
+ isec = bfd_und_section_ptr;
+ else if (isym->st_shndx == SHN_ABS)
+ isec = bfd_abs_section_ptr;
+ else if (isym->st_shndx == SHN_COMMON)
+ isec = bfd_com_section_ptr;
+ else
+ isec = bfd_section_from_elf_index (input_bfd, isym->st_shndx);
+
+ *secpp = isec;
+ }
+
+ if (! elf32_cr16_relocate_section (output_bfd, link_info, input_bfd,
+ input_section, data, internal_relocs,
+ isymbuf, sections))
+ goto error_return;
+
+ if (sections != NULL)
+ free (sections);
+ if (isymbuf != NULL
+ && symtab_hdr->contents != (unsigned char *) isymbuf)
+ free (isymbuf);
+ if (elf_section_data (input_section)->relocs != internal_relocs)
+ free (internal_relocs);
+ }
+
+ return data;
+
+ error_return:
+ if (sections != NULL)
+ free (sections);
+ if (isymbuf != NULL
+ && symtab_hdr->contents != (unsigned char *) isymbuf)
+ free (isymbuf);
+ if (internal_relocs != NULL
+ && elf_section_data (input_section)->relocs != internal_relocs)
+ free (internal_relocs);
+ return NULL;
+}
+
+/* This function handles relaxing for the CR16.
+
+ There's quite a few relaxing opportunites available on the CR16:
+
+ * bcond:24 -> bcond:16 2 bytes
+ * bcond:16 -> bcond:8 2 bytes
+ * arithmetic imm32 -> arithmetic imm16 2 bytes
+
+ Symbol- and reloc-reading infrastructure copied from elf-m10200.c. */
+
+static bfd_boolean
+elf32_cr16_relax_section (bfd *abfd, asection *sec,
+ struct bfd_link_info *link_info, bfd_boolean *again)
+{
+ Elf_Internal_Shdr *symtab_hdr;
+ Elf_Internal_Rela *internal_relocs;
+ Elf_Internal_Rela *irel, *irelend;
+ bfd_byte *contents = NULL;
+ Elf_Internal_Sym *isymbuf = NULL;
+
+ /* Assume nothing changes. */
+ *again = FALSE;
+
+ /* We don't have to do anything for a relocatable link, if
+ this section does not have relocs, or if this is not a
+ code section. */
+ if (link_info->relocatable
+ || (sec->flags & SEC_RELOC) == 0
+ || sec->reloc_count == 0
+ || (sec->flags & SEC_CODE) == 0)
+ return TRUE;
+
+ symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+
+ /* Get a copy of the native relocations. */
+ internal_relocs = _bfd_elf_link_read_relocs (abfd, sec, NULL, NULL,
+ link_info->keep_memory);
+ if (internal_relocs == NULL)
+ goto error_return;
+
+ /* Walk through them looking for relaxing opportunities. */
+ irelend = internal_relocs + sec->reloc_count;
+ for (irel = internal_relocs; irel < irelend; irel++)
+ {
+ bfd_vma symval;
+
+ /* If this isn't something that can be relaxed, then ignore
+ this reloc. */
+ if (ELF32_R_TYPE (irel->r_info) != (int) R_CR16_DISP16
+ && ELF32_R_TYPE (irel->r_info) != (int) R_CR16_DISP24)
+ continue;
+
+ /* Get the section contents if we haven't done so already. */
+ if (contents == NULL)
+ {
+ /* Get cached copy if it exists. */
+ if (elf_section_data (sec)->this_hdr.contents != NULL)
+ contents = elf_section_data (sec)->this_hdr.contents;
+ /* Go get them off disk. */
+ else if (!bfd_malloc_and_get_section (abfd, sec, &contents))
+ goto error_return;
+ }
+
+ /* Read this BFD's local symbols if we haven't done so already. */
+ if (isymbuf == NULL && symtab_hdr->sh_info != 0)
+ {
+ isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
+ if (isymbuf == NULL)
+ isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr,
+ symtab_hdr->sh_info, 0,
+ NULL, NULL, NULL);
+ if (isymbuf == NULL)
+ goto error_return;
+ }
+
+ /* Get the value of the symbol referred to by the reloc. */
+ if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info)
+ {
+ /* A local symbol. */
+ Elf_Internal_Sym *isym;
+ asection *sym_sec;
+
+ isym = isymbuf + ELF32_R_SYM (irel->r_info);
+ if (isym->st_shndx == SHN_UNDEF)
+ sym_sec = bfd_und_section_ptr;
+ else if (isym->st_shndx == SHN_ABS)
+ sym_sec = bfd_abs_section_ptr;
+ else if (isym->st_shndx == SHN_COMMON)
+ sym_sec = bfd_com_section_ptr;
+ else
+ sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx);
+ symval = (isym->st_value
+ + sym_sec->output_section->vma
+ + sym_sec->output_offset);
+ }
+ else
+ {
+ unsigned long indx;
+ struct elf_link_hash_entry *h;
+
+ /* An external symbol. */
+ indx = ELF32_R_SYM (irel->r_info) - symtab_hdr->sh_info;
+ h = elf_sym_hashes (abfd)[indx];
+ BFD_ASSERT (h != NULL);
+
+ if (h->root.type != bfd_link_hash_defined
+ && h->root.type != bfd_link_hash_defweak)
+ /* This appears to be a reference to an undefined
+ symbol. Just ignore it--it will be caught by the
+ regular reloc processing. */
+ continue;
+
+ symval = (h->root.u.def.value
+ + h->root.u.def.section->output_section->vma
+ + h->root.u.def.section->output_offset);
+ }
+
+ /* For simplicity of coding, we are going to modify the section
+ contents, the section relocs, and the BFD symbol table. We
+ must tell the rest of the code not to free up this
+ information. It would be possible to instead create a table
+ of changes which have to be made, as is done in coff-mips.c;
+ that would be more work, but would require less memory when
+ the linker is run. */
+
+ /* Try to turn a 24 branch/call into a 16bit relative
+ * branch/call. */
+ if (ELF32_R_TYPE (irel->r_info) == (int) R_CR16_DISP24)
+ {
+ bfd_vma value = symval;
+
+ /* Deal with pc-relative gunk. */
+ value -= (sec->output_section->vma + sec->output_offset);
+ value -= irel->r_offset;
+ value += irel->r_addend;
+
+ /* See if the value will fit in 16 bits, note the high value is
+ 0xfffe + 2 as the target will be two bytes closer if we are
+ able to relax. */
+ if ((long) value < 0x10000 && (long) value > -0x10002)
+ {
+ unsigned int code;
+
+ /* Get the opcode. */
+ code = (unsigned int) bfd_get_32 (abfd, contents + irel->r_offset);
+
+ /* Verify it's a 'bcond' and fix the opcode. */
+ if ((code & 0xffff) == 0x0010)
+ {
+ bfd_put_16 (abfd, 0x1800 | ((0xf & (code >>20))<<4), contents + irel->r_offset);
+ bfd_put_16 (abfd, value, contents + irel->r_offset+2);
+ }
+ else
+ continue;
+
+ /* Note that we've changed the relocs, section contents, etc. */
+ elf_section_data (sec)->relocs = internal_relocs;
+ elf_section_data (sec)->this_hdr.contents = contents;
+ symtab_hdr->contents = (unsigned char *) isymbuf;
+
+ /* Fix the relocation's type. */
+ irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
+ R_CR16_DISP16);
+
+ /* Delete two bytes of data. */
+ if (!elf32_cr16_relax_delete_bytes (link_info, abfd, sec,
+ irel->r_offset + 2, 2))
+ goto error_return;
+
+ /* That will change things, so, we should relax again.
+ Note that this is not required, and it may be slow. */
+ *again = TRUE;
+ }
+ }
+
+ /* Try to turn a 16bit pc-relative branch into an
+ 8bit pc-relative branch. */
+ if (ELF32_R_TYPE (irel->r_info) == (int) R_CR16_DISP16)
+ {
+ bfd_vma value = symval;
+
+ /* Deal with pc-relative gunk. */
+ value -= (sec->output_section->vma + sec->output_offset);
+ value -= irel->r_offset;
+ value += irel->r_addend;
+
+ /* See if the value will fit in 8 bits, note the high value is
+ 0xfc + 2 as the target will be two bytes closer if we are
+ able to relax. */
+ if ((long) value < 0xfe && (long) value > -0x100)
+ {
+ unsigned short code;
+
+ /* Get the opcode. */
+ code = (unsigned short) bfd_get_16 (abfd, contents + irel->r_offset);
+
+ /* Verify it's a 'bcond' opcode. */
+ if ((code & 0xff00) == 0x1800)
+ {
+ bfd_put_8 (abfd, 0x1 | ((0xf & (code>>4))<<4), contents + irel->r_offset);
+ bfd_put_8 (abfd, value, contents + irel->r_offset+2);
+ }
+ else
+ continue;
+
+ /* Note that we've changed the relocs, section contents, etc. */
+ elf_section_data (sec)->relocs = internal_relocs;
+ elf_section_data (sec)->this_hdr.contents = contents;
+ symtab_hdr->contents = (unsigned char *) isymbuf;
+
+ /* Fix the relocation's type. */
+ irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
+ R_CR16_DISP8);
+
+ /* Delete two bytes of data. */
+ if (!elf32_cr16_relax_delete_bytes (link_info, abfd, sec,
+ irel->r_offset + 2, 2))
+ goto error_return;
+
+ /* That will change things, so, we should relax again.
+ Note that this is not required, and it may be slow. */
+ *again = TRUE;
+ }
+ }
+
+#if 0 // REVISIT: To support IMM relaxation in CR16 target
+ /* Try to turn a 32bit immediate address into
+ a 20bit immediate address. */
+ if (ELF32_R_TYPE (irel->r_info) == (int) R_CR16_IMM32)
+ {
+ bfd_vma value = symval;
+
+ /* See if the value will fit in 20 bits. */
+ if ((long) value < 0x7ffff && (long) value > -0x80000)
+ {
+ unsigned short code;
+
+ /* Get the opcode. */
+ code = (unsigned short) bfd_get_16 (abfd, contents + irel->r_offset);
+
+ /* Verify it's a 'arithmetic double'. */
+ if ((code & 0xfff0) != 0x0070)
+ continue;
+
+ /* Note that we've changed the relocs, section contents, etc. */
+ elf_section_data (sec)->relocs = internal_relocs;
+ elf_section_data (sec)->this_hdr.contents = contents;
+ symtab_hdr->contents = (unsigned char *) isymbuf;
+
+ /* Fix the opcode. */
+ bfd_put_8 (abfd, (code & 0xff) - 0x10, contents + irel->r_offset);
+
+ /* Fix the relocation's type. */
+ irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
+ R_CR16_IMM20);
+
+ /* Delete two bytes of data. */
+ if (!elf32_cr16_relax_delete_bytes (link_info, abfd, sec,
+ irel->r_offset + 2, 2))
+ goto error_return;
+
+ /* That will change things, so, we should relax again.
+ Note that this is not required, and it may be slow. */
+ *again = TRUE;
+ }
+ }
+ /* Try to turn a 20bit/16bit immediate address into
+ a 4bit immediate address. */
+ if ((ELF32_R_TYPE (irel->r_info) == (int) R_CR16_IMM20)
+ || (ELF32_R_TYPE (irel->r_info) == (int) R_CR16_IMM16))
+ {
+ bfd_vma value = symval;
+
+ /* See if the value will fit in 4 bits. */
+ if ((long) value < 0x7 && (long) value > -0x8)
+ {
+ unsigned short code;
+
+ /* Get the opcode. */
+ code = (unsigned short) bfd_get_8 (abfd, contents + irel->r_offset);
+
+ /* Verify it's a 'arithmetic double'. */
+ if (((code & 0xff) != 0x50) || ((code & 0xff) != 0x45))
+ continue;
+
+ /* Note that we've changed the relocs, section contents, etc. */
+ elf_section_data (sec)->relocs = internal_relocs;
+ elf_section_data (sec)->this_hdr.contents = contents;
+ symtab_hdr->contents = (unsigned char *) isymbuf;
+
+ /* Fix the opcode. */
+ bfd_put_8 (abfd, (code & 0xff) - 0x10, contents + irel->r_offset);
+
+ /* Fix the relocation's type. */
+ irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
+ R_CR16_IMM4);
+
+ /* Delete two bytes of data. */
+ if (!elf32_cr16_relax_delete_bytes (link_info, abfd, sec,
+ irel->r_offset + 2, 2))
+ goto error_return;
+
+ /* That will change things, so, we should relax again.
+ Note that this is not required, and it may be slow. */
+ *again = TRUE;
+ }
+ }
+#endif
+ }
+
+ if (isymbuf != NULL
+ && symtab_hdr->contents != (unsigned char *) isymbuf)
+ {
+ if (! link_info->keep_memory)
+ free (isymbuf);
+ else
+ {
+ /* Cache the symbols for elf_link_input_bfd. */
+ symtab_hdr->contents = (unsigned char *) isymbuf;
+ }
+ }
+
+ if (contents != NULL
+ && elf_section_data (sec)->this_hdr.contents != contents)
+ {
+ if (! link_info->keep_memory)
+ free (contents);
+ else
+ {
+ /* Cache the section contents for elf_link_input_bfd. */
+ elf_section_data (sec)->this_hdr.contents = contents;
+ }
+ }
+
+ if (internal_relocs != NULL
+ && elf_section_data (sec)->relocs != internal_relocs)
+ free (internal_relocs);
+
+ return TRUE;
+
+ error_return:
+ if (isymbuf != NULL
+ && symtab_hdr->contents != (unsigned char *) isymbuf)
+ free (isymbuf);
+ if (contents != NULL
+ && elf_section_data (sec)->this_hdr.contents != contents)
+ free (contents);
+ if (internal_relocs != NULL
+ && elf_section_data (sec)->relocs != internal_relocs)
+ free (internal_relocs);
+
+ return FALSE;
+}
+
+static asection *
+elf32_cr16_gc_mark_hook (asection *sec,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ Elf_Internal_Rela *rel ATTRIBUTE_UNUSED,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
+{
+ if (h == NULL)
+ return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
+
+ switch (h->root.type)
+ {
+ case bfd_link_hash_defined:
+ case bfd_link_hash_defweak:
+ return h->root.u.def.section;
+
+ case bfd_link_hash_common:
+ return h->root.u.c.p->section;
+
+ default:
+ return NULL;
+ }
+}
+
+/* Update the got entry reference counts for the section being removed. */
+
+static bfd_boolean
+elf32_cr16_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ asection *sec ATTRIBUTE_UNUSED,
+ const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED)
+{
+ /* We don't support garbage collection of GOT and PLT relocs yet. */
+ return TRUE;
+}
+
+/* Definitions for setting CR16 target vector. */
+#define TARGET_LITTLE_SYM bfd_elf32_cr16_vec
+#define TARGET_LITTLE_NAME "elf32-cr16"
+#define ELF_ARCH bfd_arch_cr16
+#define ELF_MACHINE_CODE EM_CR16
+#define ELF_MAXPAGESIZE 0x1
+#define elf_symbol_leading_char '_'
+
+#define bfd_elf32_bfd_reloc_type_lookup elf_cr16_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup elf_cr16_reloc_name_lookup
+#define elf_info_to_howto elf_cr16_info_to_howto
+#define elf_info_to_howto_rel 0
+#define elf_backend_relocate_section elf32_cr16_relocate_section
+#define bfd_elf32_bfd_relax_section elf32_cr16_relax_section
+#define bfd_elf32_bfd_get_relocated_section_contents \
+ elf32_cr16_get_relocated_section_contents
+#define elf_backend_gc_mark_hook elf32_cr16_gc_mark_hook
+#define elf_backend_gc_sweep_hook elf32_cr16_gc_sweep_hook
+#define elf_backend_can_gc_sections 1
+#define elf_backend_rela_normal 1
+
+#include "elf32-target.h"
diff --git a/bfd/elf32-cr16c.c b/bfd/elf32-cr16c.c
index ec7199b26943..3a1db7e87647 100644
--- a/bfd/elf32-cr16c.c
+++ b/bfd/elf32-cr16c.c
@@ -1,5 +1,5 @@
/* BFD back-end for National Semiconductor's CR16C ELF
- Copyright 2004, 2005 Free Software Foundation, Inc.
+ Copyright 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,8 +17,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "bfdlink.h"
#include "elf/cr16c.h"
@@ -150,6 +150,20 @@ elf_cr16c_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return 0;
}
+static reloc_howto_type *
+elf_cr16c_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0; i < sizeof (elf_howto_table) / sizeof (elf_howto_table[0]); i++)
+ if (elf_howto_table[i].name != NULL
+ && strcasecmp (elf_howto_table[i].name, r_name) == 0)
+ return &elf_howto_table[i];
+
+ return NULL;
+}
+
static void
elf_cr16c_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
arelent *cache_ptr ATTRIBUTE_UNUSED,
@@ -692,26 +706,6 @@ elf32_cr16c_relocate_section (bfd *output_bfd,
r_type = ELF32_R_TYPE (rel->r_info);
howto = elf_howto_table + r_type;
- if (info->relocatable)
- {
- /* This is a relocatable link. We don't have to change
- anything, unless the reloc is against a section symbol,
- in which case we have to adjust according to where the
- section symbol winds up in the output section. */
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
- if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
- {
- sec = local_sections[r_symndx];
- rel->r_addend += sec->output_offset + sym->st_value;
- }
- }
-
- continue;
- }
-
- /* This is a final link. */
h = NULL;
sym = NULL;
sec = NULL;
@@ -731,6 +725,28 @@ elf32_cr16c_relocate_section (bfd *output_bfd,
unresolved_reloc, warned);
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ {
+ /* This is a relocatable link. We don't have to change
+ anything, unless the reloc is against a section symbol,
+ in which case we have to adjust according to where the
+ section symbol winds up in the output section. */
+ if (sym != NULL && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ rel->r_addend += sec->output_offset;
+ continue;
+ }
+
r = cr16c_elf_final_link_relocate (howto, input_bfd, output_bfd,
input_section,
contents, rel->r_offset,
@@ -798,53 +814,6 @@ elf32_cr16c_relocate_section (bfd *output_bfd,
return TRUE;
}
-static asection *
-elf32_cr16c_gc_mark_hook (asection *sec,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
- Elf_Internal_Rela *rel,
- struct elf_link_hash_entry *h,
- Elf_Internal_Sym *sym)
-{
- if (h != NULL)
- {
- switch (ELF32_R_TYPE (rel->r_info))
- {
-
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- {
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
- }
-
- return NULL;
-}
-
-/* Update the got entry reference counts for the section being removed. */
-
-static bfd_boolean
-elf32_cr16c_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
- asection *sec ATTRIBUTE_UNUSED,
- const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED)
-{
- /* We don't support garbage collection of GOT and PLT relocs yet. */
- return TRUE;
-}
-
/* CR16C ELF uses three common sections:
One is for default common symbols (placed in usual common section).
Second is for near common symbols (placed in "ncommon" section).
@@ -988,11 +957,10 @@ elf32_cr16c_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED
#define elf_symbol_leading_char '_'
#define bfd_elf32_bfd_reloc_type_lookup elf_cr16c_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup elf_cr16c_reloc_name_lookup
#define elf_info_to_howto elf_cr16c_info_to_howto
#define elf_info_to_howto_rel elf_cr16c_info_to_howto_rel
#define elf_backend_relocate_section elf32_cr16c_relocate_section
-#define elf_backend_gc_mark_hook elf32_cr16c_gc_mark_hook
-#define elf_backend_gc_sweep_hook elf32_cr16c_gc_sweep_hook
#define elf_backend_symbol_processing elf32_cr16c_symbol_processing
#define elf_backend_section_from_bfd_section elf32_cr16c_section_from_bfd_section
#define elf_backend_add_symbol_hook elf32_cr16c_add_symbol_hook
diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
index 4019e34e26b4..04f563bd7bcd 100644
--- a/bfd/elf32-cris.c
+++ b/bfd/elf32-cris.c
@@ -1,5 +1,5 @@
/* CRIS-specific support for 32-bit ELF.
- Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Contributed by Axis Communications AB.
Written by Hans-Peter Nilsson, based on elf32-fr30.c
@@ -21,8 +21,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/cris.h"
@@ -51,14 +51,6 @@ static bfd_reloc_status_type cris_final_link_relocate
PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, bfd_vma));
-static bfd_boolean cris_elf_gc_sweep_hook
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- const Elf_Internal_Rela *));
-
-static asection * cris_elf_gc_mark_hook
- PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *, Elf_Internal_Sym *));
-
static bfd_boolean cris_elf_object_p PARAMS ((bfd *));
static void cris_elf_final_write_processing PARAMS ((bfd *, bfd_boolean));
@@ -465,6 +457,21 @@ cris_reloc_type_lookup (abfd, code)
return NULL;
}
+static reloc_howto_type *
+cris_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (cris_elf_howto_table) / sizeof (cris_elf_howto_table[0]);
+ i++)
+ if (cris_elf_howto_table[i].name != NULL
+ && strcasecmp (cris_elf_howto_table[i].name, r_name) == 0)
+ return &cris_elf_howto_table[i];
+
+ return NULL;
+}
+
/* Set the howto pointer for an CRIS ELF reloc. */
static void
@@ -935,9 +942,6 @@ cris_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;
local_got_offsets = elf_local_got_offsets (input_bfd);
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
@@ -972,7 +976,6 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
|| r_type == R_CRIS_GNU_VTENTRY)
continue;
- /* This is a final link. */
r_symndx = ELF32_R_SYM (rel->r_info);
howto = cris_elf_howto_table + r_type;
h = NULL;
@@ -1050,7 +1053,7 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
|| r_type == R_CRIS_16_PCREL
|| r_type == R_CRIS_32_PCREL))
relocation = 0;
- else if (unresolved_reloc)
+ else if (!info->relocatable && unresolved_reloc)
{
_bfd_error_handler
(_("%B, section %A: unresolvable relocation %s against symbol `%s'"),
@@ -1064,6 +1067,20 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
}
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
switch (r_type)
{
case R_CRIS_16_GOTPLT:
@@ -1388,7 +1405,7 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (input_bfd,
input_section),
name + 5) == 0);
@@ -1438,11 +1455,12 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
}
else
{
+ outrel.r_addend = relocation + rel->r_addend;
+
if (r_type == R_CRIS_32)
{
relocate = TRUE;
outrel.r_info = ELF32_R_INFO (0, R_CRIS_RELATIVE);
- outrel.r_addend = relocation + rel->r_addend;
}
else
{
@@ -1459,13 +1477,24 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
{
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);
+ if (indx == 0)
+ {
+ struct elf_cris_link_hash_table *htab;
+ htab = elf_cris_hash_table (info);
+ osec = htab->root.text_index_section;
+ indx = elf_section_data (osec)->dynindx;
+ }
+ BFD_ASSERT (indx != 0);
}
outrel.r_info = ELF32_R_INFO (indx, r_type);
- outrel.r_addend = relocation + rel->r_addend;
}
}
@@ -1923,50 +1952,30 @@ elf_cris_finish_dynamic_sections (output_bfd, info)
relocation. */
static asection *
-cris_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;
+cris_elf_gc_mark_hook (asection *sec,
+ struct bfd_link_info *info,
+ Elf_Internal_Rela *rel,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
{
if (h != NULL)
- {
- switch (ELF32_R_TYPE (rel->r_info))
- {
- case R_CRIS_GNU_VTINHERIT:
- case R_CRIS_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
+ switch (ELF32_R_TYPE (rel->r_info))
+ {
+ case R_CRIS_GNU_VTINHERIT:
+ case R_CRIS_GNU_VTENTRY:
+ return NULL;
+ }
- return NULL;
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
/* Update the got entry reference counts for the section being removed. */
static bfd_boolean
-cris_elf_gc_sweep_hook (abfd, info, sec, relocs)
- bfd *abfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- asection *sec ATTRIBUTE_UNUSED;
- const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED;
+cris_elf_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;
@@ -2212,7 +2221,6 @@ elf_cris_adjust_dynamic_symbol (info, h)
{
bfd *dynobj;
asection *s;
- unsigned int power_of_two;
bfd_size_type plt_entry_size;
dynobj = elf_hash_table (info)->dynobj;
@@ -2420,31 +2428,7 @@ elf_cris_adjust_dynamic_symbol (info, h)
h->needs_copy = 1;
}
- /* Historic precedent: m68k and i386 allow max 8-byte alignment for the
- thing to copy; so do we. */
-
- /* We need to figure out the alignment required for this symbol. I
- have no idea how ELF linkers handle this. */
- power_of_two = bfd_log2 (h->size);
- if (power_of_two > 3)
- power_of_two = 3;
-
- /* Apply the required alignment. */
- s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two));
- if (power_of_two > bfd_get_section_alignment (dynobj, s))
- {
- if (!bfd_set_section_alignment (dynobj, s, power_of_two))
- return FALSE;
- }
-
- /* Define the symbol as being at this point in the section. */
- h->root.u.def.section = s;
- h->root.u.def.value = s->size;
-
- /* Increment the section size to make room for the symbol. */
- s->size += h->size;
-
- return TRUE;
+ return _bfd_elf_adjust_dynamic_copy (h, s);
}
/* Look through the relocs for a section during the first phase. */
@@ -2799,7 +2783,7 @@ cris_elf_check_relocs (abfd, info, sec, relocs)
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (abfd, sec),
name + 5) == 0);
@@ -2962,7 +2946,7 @@ elf_cris_size_dynamic_sections (output_bfd, info)
/* Remember whether there is a PLT. */
plt = s->size != 0;
}
- else if (strncmp (name, ".rela", 5) == 0)
+ else if (CONST_STRNEQ (name, ".rela"))
{
if (s->size != 0)
{
@@ -2976,7 +2960,7 @@ elf_cris_size_dynamic_sections (output_bfd, info)
s->reloc_count = 0;
}
}
- else if (strncmp (name, ".got", 4) != 0
+ else if (! CONST_STRNEQ (name, ".got")
&& strcmp (name, ".dynbss") != 0)
{
/* It's not one of our sections, so don't allocate space. */
@@ -3411,6 +3395,7 @@ elf_cris_reloc_type_class (rela)
cris_elf_copy_private_bfd_data
#define bfd_elf32_bfd_reloc_type_lookup cris_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup cris_reloc_name_lookup
#define bfd_elf32_bfd_link_hash_table_create \
elf_cris_link_hash_table_create
@@ -3418,6 +3403,7 @@ elf_cris_reloc_type_class (rela)
elf_cris_adjust_dynamic_symbol
#define elf_backend_size_dynamic_sections \
elf_cris_size_dynamic_sections
+#define elf_backend_init_index_section _bfd_elf_init_1_index_section
#define elf_backend_finish_dynamic_symbol \
elf_cris_finish_dynamic_symbol
#define elf_backend_finish_dynamic_sections \
@@ -3443,8 +3429,6 @@ elf_cris_reloc_type_class (rela)
#include "elf32-target.h"
-#define INCLUDED_TARGET_FILE
-
#undef TARGET_LITTLE_SYM
#undef TARGET_LITTLE_NAME
#undef elf_symbol_leading_char
@@ -3452,5 +3436,7 @@ elf_cris_reloc_type_class (rela)
#define TARGET_LITTLE_SYM bfd_elf32_us_cris_vec
#define TARGET_LITTLE_NAME "elf32-us-cris"
#define elf_symbol_leading_char '_'
+#undef elf32_bed
+#define elf32_bed elf32_us_cris_bed
#include "elf32-target.h"
diff --git a/bfd/elf32-crx.c b/bfd/elf32-crx.c
index 0a49885a7674..f4fe1fa9fc38 100644
--- a/bfd/elf32-crx.c
+++ b/bfd/elf32-crx.c
@@ -1,5 +1,5 @@
/* BFD back-end for National Semiconductor's CRX ELF
- Copyright 2004 Free Software Foundation, Inc.
+ Copyright 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Written by Tomer Levi, NSC, Israel.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -38,12 +38,6 @@ static bfd_reloc_status_type crx_elf_final_link_relocate
static bfd_boolean elf32_crx_relocate_section
(bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **);
-static asection * elf32_crx_gc_mark_hook
- (asection *, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *, Elf_Internal_Sym *);
-static bfd_boolean elf32_crx_gc_sweep_hook
- (bfd *, struct bfd_link_info *, asection *,
- const Elf_Internal_Rela *);
static bfd_boolean elf32_crx_relax_section
(bfd *, asection *, struct bfd_link_info *, bfd_boolean *);
static bfd_byte * elf32_crx_get_relocated_section_contents
@@ -405,6 +399,22 @@ elf_crx_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return 0;
}
+static reloc_howto_type *
+elf_crx_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (crx_elf_howto_table) / sizeof (crx_elf_howto_table[0]);
+ i++)
+ if (crx_elf_howto_table[i].name != NULL
+ && strcasecmp (crx_elf_howto_table[i].name, r_name) == 0)
+ return &crx_elf_howto_table[i];
+
+ return NULL;
+}
+
/* Retrieve a howto ptr using an internal relocation entry. */
static void
@@ -827,9 +837,6 @@ elf32_crx_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
struct elf_link_hash_entry **sym_hashes;
Elf_Internal_Rela *rel, *relend;
- if (info->relocatable)
- return TRUE;
-
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
@@ -869,6 +876,20 @@ elf32_crx_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
unresolved_reloc, warned);
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
r = crx_elf_final_link_relocate (howto, input_bfd, output_bfd,
input_section,
contents, rel->r_offset,
@@ -1297,42 +1318,6 @@ elf32_crx_relax_section (bfd *abfd, asection *sec,
return FALSE;
}
-static asection *
-elf32_crx_gc_mark_hook (asection *sec,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
- Elf_Internal_Rela *rel ATTRIBUTE_UNUSED,
- struct elf_link_hash_entry *h,
- Elf_Internal_Sym *sym)
-{
- if (h == NULL)
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
-
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- return NULL;
- }
-}
-
-/* Update the got entry reference counts for the section being removed. */
-
-static bfd_boolean
-elf32_crx_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
- asection *sec ATTRIBUTE_UNUSED,
- const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED)
-{
- /* We don't support garbage collection of GOT and PLT relocs yet. */
- return TRUE;
-}
-
/* Definitions for setting CRX target vector. */
#define TARGET_LITTLE_SYM bfd_elf32_crx_vec
#define TARGET_LITTLE_NAME "elf32-crx"
@@ -1342,14 +1327,14 @@ elf32_crx_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
#define elf_symbol_leading_char '_'
#define bfd_elf32_bfd_reloc_type_lookup elf_crx_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup \
+ elf_crx_reloc_name_lookup
#define elf_info_to_howto elf_crx_info_to_howto
#define elf_info_to_howto_rel 0
#define elf_backend_relocate_section elf32_crx_relocate_section
#define bfd_elf32_bfd_relax_section elf32_crx_relax_section
#define bfd_elf32_bfd_get_relocated_section_contents \
elf32_crx_get_relocated_section_contents
-#define elf_backend_gc_mark_hook elf32_crx_gc_mark_hook
-#define elf_backend_gc_sweep_hook elf32_crx_gc_sweep_hook
#define elf_backend_can_gc_sections 1
#define elf_backend_rela_normal 1
diff --git a/bfd/elf32-d10v.c b/bfd/elf32-d10v.c
index 293b1419de7c..f6a1d926c85a 100644
--- a/bfd/elf32-d10v.c
+++ b/bfd/elf32-d10v.c
@@ -1,6 +1,6 @@
/* D10V-specific support for 32-bit ELF
- Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
+ Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007 Free Software Foundation, Inc.
Contributed by Martin Hunt (hunt@cygnus.com).
This file is part of BFD, the Binary File Descriptor library.
@@ -20,8 +20,8 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/d10v.h"
@@ -203,6 +203,22 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return NULL;
}
+static reloc_howto_type *
+bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (elf_d10v_howto_table) / sizeof (elf_d10v_howto_table[0]);
+ i++)
+ if (elf_d10v_howto_table[i].name != NULL
+ && strcasecmp (elf_d10v_howto_table[i].name, r_name) == 0)
+ return &elf_d10v_howto_table[i];
+
+ return NULL;
+}
+
/* Set the howto pointer for an D10V ELF reloc. */
static void
@@ -219,48 +235,20 @@ d10v_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED,
static asection *
elf32_d10v_gc_mark_hook (asection *sec,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info,
Elf_Internal_Rela *rel,
struct elf_link_hash_entry *h,
Elf_Internal_Sym *sym)
{
if (h != NULL)
- {
- switch (ELF32_R_TYPE (rel->r_info))
+ switch (ELF32_R_TYPE (rel->r_info))
{
case R_D10V_GNU_VTINHERIT:
case R_D10V_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
+ return NULL;
+ }
- return NULL;
-}
-
-static bfd_boolean
-elf32_d10v_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
- asection *sec ATTRIBUTE_UNUSED,
- const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED)
-{
- /* We don't use got and plt entries for d10v. */
- return TRUE;
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
/* Look through the relocs for a section during the first phase.
@@ -433,35 +421,6 @@ elf32_d10v_relocate_section (bfd *output_bfd,
continue;
howto = elf_d10v_howto_table + r_type;
-
- if (info->relocatable)
- {
- bfd_vma val;
- bfd_byte *where;
-
- /* This is a relocatable link. We don't have to change
- anything, unless the reloc is against a section symbol,
- in which case we have to adjust according to where the
- section symbol winds up in the output section. */
- if (r_symndx >= symtab_hdr->sh_info)
- continue;
-
- sym = local_syms + r_symndx;
- if (ELF_ST_TYPE (sym->st_info) != STT_SECTION)
- continue;
-
- sec = local_sections[r_symndx];
- val = sec->output_offset;
- if (val == 0)
- continue;
-
- where = contents + rel->r_offset;
- val += extract_rel_addend (input_bfd, where, howto);
- insert_rel_addend (input_bfd, where, howto, val);
- continue;
- }
-
- /* This is a final link. */
h = NULL;
sym = NULL;
sec = NULL;
@@ -472,18 +431,26 @@ elf32_d10v_relocate_section (bfd *output_bfd,
relocation = (sec->output_section->vma
+ sec->output_offset
+ sym->st_value);
- if ((sec->flags & SEC_MERGE)
- && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ if (ELF_ST_TYPE (sym->st_info) == STT_SECTION
+ && ((sec->flags & SEC_MERGE) != 0
+ || (info->relocatable
+ && sec->output_offset != 0)))
{
- asection *msec;
bfd_vma addend;
bfd_byte *where = contents + rel->r_offset;
addend = extract_rel_addend (input_bfd, where, howto);
- msec = sec;
- addend = _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend);
- addend -= relocation;
- addend += msec->output_section->vma + msec->output_offset;
+
+ if (info->relocatable)
+ addend += sec->output_offset;
+ else
+ {
+ asection *msec = sec;
+ addend = _bfd_elf_rel_local_sym (output_bfd, sym, &msec,
+ addend);
+ addend -= relocation;
+ addend += msec->output_section->vma + msec->output_offset;
+ }
insert_rel_addend (input_bfd, where, howto, addend);
}
}
@@ -497,6 +464,20 @@ elf32_d10v_relocate_section (bfd *output_bfd,
unresolved_reloc, warned);
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
if (h != NULL)
name = h->root.root.string;
else
@@ -573,7 +554,6 @@ elf32_d10v_relocate_section (bfd *output_bfd,
#define elf_backend_object_p 0
#define elf_backend_final_write_processing 0
#define elf_backend_gc_mark_hook elf32_d10v_gc_mark_hook
-#define elf_backend_gc_sweep_hook elf32_d10v_gc_sweep_hook
#define elf_backend_check_relocs elf32_d10v_check_relocs
#define elf_backend_relocate_section elf32_d10v_relocate_section
#define elf_backend_can_gc_sections 1
diff --git a/bfd/elf32-d30v.c b/bfd/elf32-d30v.c
index c96937d5da06..6bcec43990f4 100644
--- a/bfd/elf32-d30v.c
+++ b/bfd/elf32-d30v.c
@@ -1,5 +1,5 @@
/* D30V-specific support for 32-bit ELF
- Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007
Free Software Foundation, Inc.
Contributed by Martin Hunt (hunt@cygnus.com).
@@ -20,8 +20,8 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/d30v.h"
@@ -491,6 +491,22 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return NULL;
}
+static reloc_howto_type *
+bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (elf_d30v_howto_table) / sizeof (elf_d30v_howto_table[0]);
+ i++)
+ if (elf_d30v_howto_table[i].name != NULL
+ && strcasecmp (elf_d30v_howto_table[i].name, r_name) == 0)
+ return &elf_d30v_howto_table[i];
+
+ return NULL;
+}
+
/* Set the howto pointer for an D30V ELF reloc (type REL). */
static void
diff --git a/bfd/elf32-dlx.c b/bfd/elf32-dlx.c
index ae42baf3a632..f57387bf5d6f 100644
--- a/bfd/elf32-dlx.c
+++ b/bfd/elf32-dlx.c
@@ -1,5 +1,6 @@
/* DLX specific support for 32-bit ELF
- Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright 2002, 2003, 2004, 2005, 2007
+ Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +19,8 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/dlx.h"
@@ -27,6 +28,7 @@
#define USE_REL 1
#define bfd_elf32_bfd_reloc_type_lookup elf32_dlx_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup elf32_dlx_reloc_name_lookup
#define elf_info_to_howto elf32_dlx_info_to_howto
#define elf_info_to_howto_rel elf32_dlx_info_to_howto_rel
#define elf_backend_check_relocs elf32_dlx_check_relocs
@@ -506,27 +508,46 @@ elf32_dlx_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
}
static reloc_howto_type *
+elf32_dlx_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (dlx_elf_howto_table) / sizeof (dlx_elf_howto_table[0]);
+ i++)
+ if (dlx_elf_howto_table[i].name != NULL
+ && strcasecmp (dlx_elf_howto_table[i].name, r_name) == 0)
+ return &dlx_elf_howto_table[i];
+
+ if (strcasecmp (elf_dlx_gnu_rel16_s2.name, r_name) == 0)
+ return &elf_dlx_gnu_rel16_s2;
+ if (strcasecmp (elf_dlx_gnu_rel26_s2.name, r_name) == 0)
+ return &elf_dlx_gnu_rel26_s2;
+ if (strcasecmp (elf_dlx_reloc_16_hi.name, r_name) == 0)
+ return &elf_dlx_reloc_16_hi;
+ if (strcasecmp (elf_dlx_reloc_16_lo.name, r_name) == 0)
+ return &elf_dlx_reloc_16_lo;
+
+ return NULL;
+}
+
+static reloc_howto_type *
dlx_rtype_to_howto (unsigned int r_type)
{
switch (r_type)
{
case R_DLX_RELOC_16_PCREL:
return & elf_dlx_gnu_rel16_s2;
- break;
case R_DLX_RELOC_26_PCREL:
return & elf_dlx_gnu_rel26_s2;
- break;
case R_DLX_RELOC_16_HI:
return & elf_dlx_reloc_16_hi;
- break;
case R_DLX_RELOC_16_LO:
return & elf_dlx_reloc_16_lo;
- break;
-
default:
BFD_ASSERT (r_type < (unsigned int) R_DLX_max);
return & dlx_elf_howto_table[r_type];
- break;
}
}
diff --git a/bfd/elf32-fr30.c b/bfd/elf32-fr30.c
index e17207960875..df2ebfcb8fc0 100644
--- a/bfd/elf32-fr30.c
+++ b/bfd/elf32-fr30.c
@@ -1,5 +1,5 @@
/* FR30-specific support for 32-bit ELF.
- Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/fr30.h"
@@ -39,12 +39,6 @@ static bfd_boolean fr30_elf_relocate_section
static bfd_reloc_status_type fr30_final_link_relocate
PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, bfd_vma));
-static bfd_boolean fr30_elf_gc_sweep_hook
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- const Elf_Internal_Rela *));
-static asection * fr30_elf_gc_mark_hook
- PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *, Elf_Internal_Sym *));
static bfd_boolean fr30_elf_check_relocs
PARAMS ((bfd *, struct bfd_link_info *, asection *,
const Elf_Internal_Rela *));
@@ -372,6 +366,21 @@ fr30_reloc_type_lookup (abfd, code)
return NULL;
}
+static reloc_howto_type *
+fr30_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (fr30_elf_howto_table) / sizeof (fr30_elf_howto_table[0]);
+ i++)
+ if (fr30_elf_howto_table[i].name != NULL
+ && strcasecmp (fr30_elf_howto_table[i].name, r_name) == 0)
+ return &fr30_elf_howto_table[i];
+
+ return NULL;
+}
+
/* Set the howto pointer for an FR30 ELF reloc. */
static void
@@ -516,9 +525,6 @@ fr30_elf_relocate_section (output_bfd, info, input_bfd, input_section,
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
- if (info->relocatable)
- return TRUE;
-
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
relend = relocs + input_section->reloc_count;
@@ -570,6 +576,20 @@ fr30_elf_relocate_section (output_bfd, info, input_bfd, input_section,
name = h->root.root.string;
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
r = fr30_final_link_relocate (howto, input_bfd, input_section,
contents, rel, relocation);
@@ -624,52 +644,21 @@ fr30_elf_relocate_section (output_bfd, info, input_bfd, input_section,
relocation. */
static asection *
-fr30_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;
+fr30_elf_gc_mark_hook (asection *sec,
+ struct bfd_link_info *info,
+ Elf_Internal_Rela *rel,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
{
if (h != NULL)
- {
- switch (ELF32_R_TYPE (rel->r_info))
- {
- case R_FR30_GNU_VTINHERIT:
- case R_FR30_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
-
- return NULL;
-}
-
-/* Update the got entry reference counts for the section being removed. */
-
-static bfd_boolean
-fr30_elf_gc_sweep_hook (abfd, info, sec, relocs)
- bfd *abfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- asection *sec ATTRIBUTE_UNUSED;
- const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED;
-{
- return TRUE;
+ switch (ELF32_R_TYPE (rel->r_info))
+ {
+ case R_FR30_GNU_VTINHERIT:
+ case R_FR30_GNU_VTENTRY:
+ return NULL;
+ }
+
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
/* Look through the relocs for a section during the first phase.
@@ -747,12 +736,12 @@ fr30_elf_check_relocs (abfd, info, sec, relocs)
#define elf_info_to_howto fr30_info_to_howto_rela
#define elf_backend_relocate_section fr30_elf_relocate_section
#define elf_backend_gc_mark_hook fr30_elf_gc_mark_hook
-#define elf_backend_gc_sweep_hook fr30_elf_gc_sweep_hook
#define elf_backend_check_relocs fr30_elf_check_relocs
#define elf_backend_can_gc_sections 1
#define elf_backend_rela_normal 1
#define bfd_elf32_bfd_reloc_type_lookup fr30_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup fr30_reloc_name_lookup
#include "elf32-target.h"
diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c
index 1758e27591fa..97cce0b7629e 100644
--- a/bfd/elf32-frv.c
+++ b/bfd/elf32-frv.c
@@ -1,5 +1,6 @@
/* FRV-specific support for 32-bit ELF.
- Copyright 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+ Copyright 2002, 2003, 2004, 2005, 2006, 2007
+ Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,8 +18,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/frv.h"
@@ -57,12 +58,6 @@ static bfd_boolean elf32_frv_add_symbol_hook
static bfd_reloc_status_type frv_final_link_relocate
PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, bfd_vma));
-static bfd_boolean elf32_frv_gc_sweep_hook
- PARAMS ((bfd *, struct bfd_link_info *, asection *, const
- Elf_Internal_Rela *));
-static asection * elf32_frv_gc_mark_hook
- PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *, Elf_Internal_Sym *));
static bfd_boolean elf32_frv_check_relocs
PARAMS ((bfd *, struct bfd_link_info *, asection *,
const Elf_Internal_Rela *));
@@ -2595,6 +2590,26 @@ frv_reloc_type_lookup (abfd, code)
return NULL;
}
+static reloc_howto_type *
+frv_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (elf32_frv_howto_table) / sizeof (elf32_frv_howto_table[0]);
+ i++)
+ if (elf32_frv_howto_table[i].name != NULL
+ && strcasecmp (elf32_frv_howto_table[i].name, r_name) == 0)
+ return &elf32_frv_howto_table[i];
+
+ if (strcasecmp (elf32_frv_vtinherit_howto.name, r_name) == 0)
+ return &elf32_frv_vtinherit_howto;
+ if (strcasecmp (elf32_frv_vtentry_howto.name, r_name) == 0)
+ return &elf32_frv_vtentry_howto;
+
+ return NULL;
+}
+
/* Set the howto pointer for an FRV ELF reloc. */
static void
@@ -2728,9 +2743,6 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section,
int silence_segment_error = !(info->shared || info->pie);
unsigned long insn;
- if (info->relocatable)
- return TRUE;
-
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
relend = relocs + input_section->reloc_count;
@@ -2782,7 +2794,6 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section,
|| r_type == R_FRV_GNU_VTENTRY)
continue;
- /* This is a final link. */
r_symndx = ELF32_R_SYM (rel->r_info);
howto = elf32_frv_howto_table + ELF32_R_TYPE (rel->r_info);
h = NULL;
@@ -2801,50 +2812,38 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section,
}
else
{
- h = sym_hashes [r_symndx - symtab_hdr->sh_info];
+ bfd_boolean warned;
+ bfd_boolean unresolved_reloc;
- 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);
+ osec = sec;
+ }
- name = h->root.root.string;
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
- if ((h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak))
- {
- if (/* TLSMOFF forces local binding. */
- r_type != R_FRV_TLSMOFF
- && ! FRVFDPIC_SYM_LOCAL (info, h))
- {
- sec = NULL;
- relocation = 0;
- }
- else
- {
- sec = h->root.u.def.section;
- 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->unresolved_syms_in_objects == RM_IGNORE
- && 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->unresolved_syms_in_objects == RM_GENERATE_ERROR
- || ELF_ST_VISIBILITY (h->other)))))
- return FALSE;
- relocation = 0;
- }
- osec = sec;
+ if (info->relocatable)
+ continue;
+
+ if (r_type != R_FRV_TLSMOFF
+ && h != NULL
+ && (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && !FRVFDPIC_SYM_LOCAL (info, h))
+ {
+ osec = sec = NULL;
+ relocation = 0;
}
switch (r_type)
@@ -3645,6 +3644,8 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section,
input_section->output_section)
& (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD))
{
+ bfd_vma offset;
+
if (_frvfdpic_osec_readonly_p (output_bfd,
input_section
->output_section))
@@ -3655,22 +3656,27 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section,
name, input_bfd, input_section, rel->r_offset);
return FALSE;
}
- _frvfdpic_add_rofixup (output_bfd,
- frvfdpic_gotfixup_section
- (info),
- _bfd_elf_section_offset
- (output_bfd, info,
- input_section, rel->r_offset)
- + input_section
- ->output_section->vma
- + input_section->output_offset,
- picrel);
+
+ offset = _bfd_elf_section_offset
+ (output_bfd, info,
+ input_section, rel->r_offset);
+
+ if (offset != (bfd_vma)-1)
+ _frvfdpic_add_rofixup (output_bfd,
+ frvfdpic_gotfixup_section
+ (info),
+ offset + input_section
+ ->output_section->vma
+ + input_section->output_offset,
+ picrel);
}
}
else if ((bfd_get_section_flags (output_bfd,
input_section->output_section)
& (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD))
{
+ bfd_vma offset;
+
if (_frvfdpic_osec_readonly_p (output_bfd,
input_section
->output_section))
@@ -3681,15 +3687,18 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section,
name, input_bfd, input_section, rel->r_offset);
return FALSE;
}
- _frvfdpic_add_dyn_reloc (output_bfd,
- frvfdpic_gotrel_section (info),
- _bfd_elf_section_offset
- (output_bfd, info,
- input_section, rel->r_offset)
- + input_section
- ->output_section->vma
- + input_section->output_offset,
- r_type, dynindx, addend, picrel);
+
+ offset = _bfd_elf_section_offset
+ (output_bfd, info,
+ input_section, rel->r_offset);
+
+ if (offset != (bfd_vma)-1)
+ _frvfdpic_add_dyn_reloc (output_bfd,
+ frvfdpic_gotrel_section (info),
+ offset + input_section
+ ->output_section->vma
+ + input_section->output_offset,
+ r_type, dynindx, addend, picrel);
}
else
addend += frvfdpic_got_section (info)->output_section->vma;
@@ -3770,25 +3779,27 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section,
}
if (!h || h->root.type != bfd_link_hash_undefweak)
{
- _frvfdpic_add_rofixup (output_bfd,
- frvfdpic_gotfixup_section
- (info),
- _bfd_elf_section_offset
- (output_bfd, info,
- input_section, rel->r_offset)
- + input_section
- ->output_section->vma
- + input_section->output_offset,
- picrel);
- if (r_type == R_FRV_FUNCDESC_VALUE)
- _frvfdpic_add_rofixup
- (output_bfd,
- frvfdpic_gotfixup_section (info),
- _bfd_elf_section_offset
- (output_bfd, info,
- input_section, rel->r_offset)
- + input_section->output_section->vma
- + input_section->output_offset + 4, picrel);
+ bfd_vma offset = _bfd_elf_section_offset
+ (output_bfd, info,
+ input_section, rel->r_offset);
+
+ if (offset != (bfd_vma)-1)
+ {
+ _frvfdpic_add_rofixup (output_bfd,
+ frvfdpic_gotfixup_section
+ (info),
+ offset + input_section
+ ->output_section->vma
+ + input_section->output_offset,
+ picrel);
+ if (r_type == R_FRV_FUNCDESC_VALUE)
+ _frvfdpic_add_rofixup
+ (output_bfd,
+ frvfdpic_gotfixup_section (info),
+ offset
+ + input_section->output_section->vma
+ + input_section->output_offset + 4, picrel);
+ }
}
}
}
@@ -3798,6 +3809,8 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section,
input_section->output_section)
& (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD))
{
+ bfd_vma offset;
+
if (_frvfdpic_osec_readonly_p (output_bfd,
input_section
->output_section))
@@ -3808,15 +3821,18 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section,
name, input_bfd, input_section, rel->r_offset);
return FALSE;
}
- _frvfdpic_add_dyn_reloc (output_bfd,
- frvfdpic_gotrel_section (info),
- _bfd_elf_section_offset
- (output_bfd, info,
- input_section, rel->r_offset)
- + input_section
- ->output_section->vma
- + input_section->output_offset,
- r_type, dynindx, addend, picrel);
+
+ offset = _bfd_elf_section_offset
+ (output_bfd, info,
+ input_section, rel->r_offset);
+
+ if (offset != (bfd_vma)-1)
+ _frvfdpic_add_dyn_reloc (output_bfd,
+ frvfdpic_gotrel_section (info),
+ offset + input_section
+ ->output_section->vma
+ + input_section->output_offset,
+ r_type, dynindx, addend, picrel);
}
else if (osec)
addend += osec->output_section->vma;
@@ -4145,54 +4161,22 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section,
relocation. */
static asection *
-elf32_frv_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;
+elf32_frv_gc_mark_hook (asection *sec,
+ struct bfd_link_info *info,
+ Elf_Internal_Rela *rel,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
{
if (h != NULL)
- {
- switch (ELF32_R_TYPE (rel->r_info))
- {
- case R_FRV_GNU_VTINHERIT:
- case R_FRV_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- default:
- break;
-
- 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;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
-
- return NULL;
-}
-
-/* Update the got entry reference counts for the section being removed. */
+ switch (ELF32_R_TYPE (rel->r_info))
+ {
+ case R_FRV_GNU_VTINHERIT:
+ case R_FRV_GNU_VTENTRY:
+ return NULL;
+ }
-static bfd_boolean
-elf32_frv_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;
-{
- return TRUE;
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
-
/* Hook called by the linker routine which adds symbols from an object
file. We use it to put .comm items in .scomm, and not .comm. */
@@ -5603,7 +5587,6 @@ elf32_frvfdpic_always_size_sections (bfd *output_bfd,
if (!info->relocatable)
{
struct elf_link_hash_entry *h;
- asection *sec;
/* Force a PT_GNU_STACK segment to be created. */
if (! elf_tdata (output_bfd)->stack_flags)
@@ -5630,12 +5613,121 @@ elf32_frvfdpic_always_size_sections (bfd *output_bfd,
h->type = STT_OBJECT;
/* This one must NOT be hidden. */
}
+ }
+
+ return TRUE;
+}
+
+/* Check whether any of the relocations was optimized away, and
+ subtract it from the relocation or fixup count. */
+static bfd_boolean
+_frvfdpic_check_discarded_relocs (bfd *abfd, asection *sec,
+ struct bfd_link_info *info,
+
+ bfd_boolean *changed)
+{
+ Elf_Internal_Shdr *symtab_hdr;
+ struct elf_link_hash_entry **sym_hashes, **sym_hashes_end;
+ Elf_Internal_Rela *rel, *erel;
+
+ if ((sec->flags & SEC_RELOC) == 0
+ || sec->reloc_count == 0)
+ return TRUE;
+
+ symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+ sym_hashes = elf_sym_hashes (abfd);
+ sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof(Elf32_External_Sym);
+ if (!elf_bad_symtab (abfd))
+ sym_hashes_end -= symtab_hdr->sh_info;
+
+ rel = elf_section_data (sec)->relocs;
+
+ /* Now examine each relocation. */
+ for (erel = rel + sec->reloc_count; rel < erel; rel++)
+ {
+ struct elf_link_hash_entry *h;
+ unsigned long r_symndx;
+ struct frvfdpic_relocs_info *picrel;
+ struct _frvfdpic_dynamic_got_info *dinfo;
+
+ if (ELF32_R_TYPE (rel->r_info) != R_FRV_32
+ && ELF32_R_TYPE (rel->r_info) != R_FRV_FUNCDESC)
+ continue;
+
+ if (_bfd_elf_section_offset (sec->output_section->owner,
+ info, sec, rel->r_offset)
+ != (bfd_vma)-1)
+ continue;
+
+ r_symndx = ELF32_R_SYM (rel->r_info);
+ if (r_symndx < symtab_hdr->sh_info)
+ h = NULL;
+ else
+ {
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *)h->root.u.i.link;
+ }
- /* Create a stack section, and set its alignment. */
- sec = bfd_make_section (output_bfd, ".stack");
+ if (h != NULL)
+ picrel = frvfdpic_relocs_info_for_global (frvfdpic_relocs_info (info),
+ abfd, h,
+ rel->r_addend, NO_INSERT);
+ else
+ picrel = frvfdpic_relocs_info_for_local (frvfdpic_relocs_info (info),
+ abfd, r_symndx,
+ rel->r_addend, NO_INSERT);
- if (sec == NULL
- || ! bfd_set_section_alignment (output_bfd, sec, 3))
+ if (! picrel)
+ return FALSE;
+
+ *changed = TRUE;
+ dinfo = frvfdpic_dynamic_got_plt_info (info);
+
+ _frvfdpic_count_relocs_fixups (picrel, dinfo, TRUE);
+ if (ELF32_R_TYPE (rel->r_info) == R_FRV_32)
+ picrel->relocs32--;
+ else /* we know (ELF32_R_TYPE (rel->r_info) == R_FRV_FUNCDESC) */
+ picrel->relocsfd--;
+ _frvfdpic_count_relocs_fixups (picrel, dinfo, FALSE);
+ }
+
+ return TRUE;
+}
+
+static bfd_boolean
+frvfdpic_elf_discard_info (bfd *ibfd,
+ struct elf_reloc_cookie *cookie ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info)
+{
+ bfd_boolean changed = FALSE;
+ asection *s;
+ bfd *obfd = NULL;
+
+ /* Account for relaxation of .eh_frame section. */
+ for (s = ibfd->sections; s; s = s->next)
+ if (s->sec_info_type == ELF_INFO_TYPE_EH_FRAME)
+ {
+ if (!_frvfdpic_check_discarded_relocs (ibfd, s, info, &changed))
+ return FALSE;
+ obfd = s->output_section->owner;
+ }
+
+ if (changed)
+ {
+ struct _frvfdpic_dynamic_got_plt_info gpinfo;
+
+ memset (&gpinfo, 0, sizeof (gpinfo));
+ memcpy (&gpinfo.g, frvfdpic_dynamic_got_plt_info (info),
+ sizeof (gpinfo.g));
+
+ /* Clear GOT and PLT assignments. */
+ htab_traverse (frvfdpic_relocs_info (info),
+ _frvfdpic_reset_got_plt_entries,
+ NULL);
+
+ if (!_frvfdpic_size_got_plt (obfd, &gpinfo))
return FALSE;
}
@@ -5718,48 +5810,45 @@ elf32_frvfdpic_relax_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec,
}
static bfd_boolean
-elf32_frvfdpic_modify_segment_map (bfd *output_bfd,
- struct bfd_link_info *info)
+elf32_frvfdpic_modify_program_headers (bfd *output_bfd,
+ struct bfd_link_info *info)
{
+ struct elf_obj_tdata *tdata = elf_tdata (output_bfd);
struct elf_segment_map *m;
+ Elf_Internal_Phdr *p;
/* objcopy and strip preserve what's already there using
elf32_frvfdpic_copy_private_bfd_data (). */
if (! info)
return TRUE;
- for (m = elf_tdata (output_bfd)->segment_map; m != NULL; m = m->next)
+ for (p = tdata->phdr, m = tdata->segment_map; m != NULL; m = m->next, p++)
if (m->p_type == PT_GNU_STACK)
break;
if (m)
{
- asection *sec = bfd_get_section_by_name (output_bfd, ".stack");
struct elf_link_hash_entry *h;
- if (sec)
+ /* Obtain the pointer to the __stacksize symbol. */
+ h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize",
+ FALSE, FALSE, FALSE);
+ if (h)
{
- /* Obtain the pointer to the __stacksize symbol. */
- h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize",
- FALSE, FALSE, 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;
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
BFD_ASSERT (h->root.type == bfd_link_hash_defined);
+ }
- /* Set the section size from the symbol value. We
- intentionally ignore the symbol section. */
- if (h->root.type == bfd_link_hash_defined)
- sec->size = h->root.u.def.value;
- else
- sec->size = DEFAULT_STACK_SIZE;
+ /* Set the header p_memsz from the symbol value. We
+ intentionally ignore the symbol section. */
+ if (h && h->root.type == bfd_link_hash_defined)
+ p->p_memsz = h->root.u.def.value;
+ else
+ p->p_memsz = DEFAULT_STACK_SIZE;
- /* Add the stack section to the PT_GNU_STACK segment,
- such that its size and alignment requirements make it
- to the segment. */
- m->sections[m->count] = sec;
- m->count++;
- }
+ p->p_align = 8;
}
return TRUE;
@@ -6401,6 +6490,10 @@ frv_elf_copy_private_bfd_data (ibfd, obfd)
elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
elf_flags_init (obfd) = TRUE;
+
+ /* Copy object attributes. */
+ _bfd_elf_copy_obj_attributes (ibfd, obfd);
+
return TRUE;
}
@@ -6922,7 +7015,6 @@ elf32_frv_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
#define elf_info_to_howto frv_info_to_howto_rela
#define elf_backend_relocate_section elf32_frv_relocate_section
#define elf_backend_gc_mark_hook elf32_frv_gc_mark_hook
-#define elf_backend_gc_sweep_hook elf32_frv_gc_sweep_hook
#define elf_backend_check_relocs elf32_frv_check_relocs
#define elf_backend_object_p elf32_frv_object_p
#define elf_backend_add_symbol_hook elf32_frv_add_symbol_hook
@@ -6931,6 +7023,7 @@ elf32_frv_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
#define elf_backend_rela_normal 1
#define bfd_elf32_bfd_reloc_type_lookup frv_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup frv_reloc_name_lookup
#define bfd_elf32_bfd_set_private_flags frv_elf_set_private_flags
#define bfd_elf32_bfd_copy_private_bfd_data frv_elf_copy_private_bfd_data
#define bfd_elf32_bfd_merge_private_bfd_data frv_elf_merge_private_bfd_data
@@ -6970,9 +7063,9 @@ elf32_frv_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
#undef elf_backend_always_size_sections
#define elf_backend_always_size_sections \
elf32_frvfdpic_always_size_sections
-#undef elf_backend_modify_segment_map
-#define elf_backend_modify_segment_map \
- elf32_frvfdpic_modify_segment_map
+#undef elf_backend_modify_program_headers
+#define elf_backend_modify_program_headers \
+ elf32_frvfdpic_modify_program_headers
#undef bfd_elf32_bfd_copy_private_bfd_data
#define bfd_elf32_bfd_copy_private_bfd_data \
elf32_frvfdpic_copy_private_bfd_data
@@ -6996,6 +7089,9 @@ elf32_frv_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
#define elf_backend_finish_dynamic_sections \
elf32_frvfdpic_finish_dynamic_sections
+#undef elf_backend_discard_info
+#define elf_backend_discard_info \
+ frvfdpic_elf_discard_info
#undef elf_backend_can_make_relative_eh_frame
#define elf_backend_can_make_relative_eh_frame \
frvfdpic_elf_use_relative_eh_frame
diff --git a/bfd/elf32-gen.c b/bfd/elf32-gen.c
index 23c74767799e..ef7d4e2308d7 100644
--- a/bfd/elf32-gen.c
+++ b/bfd/elf32-gen.c
@@ -1,5 +1,5 @@
/* Generic support for 32-bit ELF
- Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2004, 2005
+ Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2004, 2005, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -94,6 +94,7 @@ elf32_generic_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
#define ELF_MACHINE_CODE EM_NONE
#define ELF_MAXPAGESIZE 0x1
#define bfd_elf32_bfd_reloc_type_lookup bfd_default_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup
#define bfd_elf32_bfd_link_add_symbols elf32_generic_link_add_symbols
#define elf_info_to_howto elf_generic_info_to_howto
#define elf_info_to_howto_rel elf_generic_info_to_howto_rel
diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c
index 4cdf2defb588..17e8e30f68df 100644
--- a/bfd/elf32-h8300.c
+++ b/bfd/elf32-h8300.c
@@ -1,6 +1,6 @@
/* BFD back-end for Renesas H8/300 ELF binaries.
- Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
+ Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/h8.h"
@@ -42,11 +42,6 @@ static bfd_boolean elf32_h8_symbol_address_p (bfd *, asection *, bfd_vma);
static bfd_byte *elf32_h8_get_relocated_section_contents
(bfd *, struct bfd_link_info *, struct bfd_link_order *,
bfd_byte *, bfd_boolean, asymbol **);
-static asection *elf32_h8_gc_mark_hook
- (asection *, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *, Elf_Internal_Sym *);
-static bfd_boolean elf32_h8_gc_sweep_hook
- (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *);
static bfd_reloc_status_type elf32_h8_final_link_relocate
(unsigned long, bfd *, bfd *, asection *,
bfd_byte *, bfd_vma, bfd_vma, bfd_vma,
@@ -256,6 +251,22 @@ elf32_h8_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return NULL;
}
+static reloc_howto_type *
+elf32_h8_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (h8_elf_howto_table) / sizeof (h8_elf_howto_table[0]);
+ i++)
+ if (h8_elf_howto_table[i].name != NULL
+ && strcasecmp (h8_elf_howto_table[i].name, r_name) == 0)
+ return &h8_elf_howto_table[i];
+
+ return NULL;
+}
+
static void
elf32_h8_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *bfd_reloc,
Elf_Internal_Rela *elf_reloc)
@@ -407,9 +418,6 @@ elf32_h8_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
struct elf_link_hash_entry **sym_hashes;
Elf_Internal_Rela *rel, *relend;
- if (info->relocatable)
- return TRUE;
-
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
@@ -424,8 +432,12 @@ elf32_h8_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
struct elf_link_hash_entry *h;
bfd_vma relocation;
bfd_reloc_status_type r;
+ arelent bfd_reloc;
+ reloc_howto_type *howto;
+
+ elf32_h8_info_to_howto (input_bfd, &bfd_reloc, rel);
+ howto = bfd_reloc.howto;
- /* This is a final link. */
r_symndx = ELF32_R_SYM (rel->r_info);
r_type = ELF32_R_TYPE (rel->r_info);
h = NULL;
@@ -447,6 +459,20 @@ elf32_h8_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
unresolved_reloc, warned);
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
r = elf32_h8_final_link_relocate (r_type, input_bfd, output_bfd,
input_section,
contents, rel->r_offset,
@@ -457,11 +483,6 @@ elf32_h8_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
{
const char *name;
const char *msg = (const char *) 0;
- arelent bfd_reloc;
- reloc_howto_type *howto;
-
- elf32_h8_info_to_howto (input_bfd, &bfd_reloc, rel);
- howto = bfd_reloc.howto;
if (h != NULL)
name = h->root.root.string;
@@ -1490,42 +1511,6 @@ elf32_h8_get_relocated_section_contents (bfd *output_bfd,
return NULL;
}
-static asection *
-elf32_h8_gc_mark_hook (asection *sec,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
- Elf_Internal_Rela *rel ATTRIBUTE_UNUSED,
- struct elf_link_hash_entry *h,
- Elf_Internal_Sym *sym)
-{
- if (h != NULL)
- {
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
- return NULL;
-}
-
-static bfd_boolean
-elf32_h8_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
- asection *sec ATTRIBUTE_UNUSED,
- const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED)
-{
- return TRUE;
-}
-
#define TARGET_BIG_SYM bfd_elf32_h8300_vec
#define TARGET_BIG_NAME "elf32-h8300"
@@ -1533,6 +1518,7 @@ elf32_h8_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
#define ELF_MACHINE_CODE EM_H8_300
#define ELF_MAXPAGESIZE 0x1
#define bfd_elf32_bfd_reloc_type_lookup elf32_h8_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup elf32_h8_reloc_name_lookup
#define elf_info_to_howto elf32_h8_info_to_howto
#define elf_info_to_howto_rel elf32_h8_info_to_howto_rel
@@ -1544,8 +1530,6 @@ elf32_h8_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
elf32_h8_object_p
#define bfd_elf32_bfd_merge_private_bfd_data \
elf32_h8_merge_private_bfd_data
-#define elf_backend_gc_mark_hook elf32_h8_gc_mark_hook
-#define elf_backend_gc_sweep_hook elf32_h8_gc_sweep_hook
/* ??? when elf_backend_relocate_section is not defined, elf32-target.h
defaults to using _bfd_generic_link_hash_table_create, but
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index 51c210e5b1c3..49529210c53d 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -1,13 +1,15 @@
/* BFD back-end for HP PA-RISC ELF files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001,
- 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Original code by
Center for Software Science
Department of Computer Science
University of Utah
Largely rewritten by Alan Modra <alan@linuxcare.com.au>
-
+ Naming cleanup by Carlos O'Donell <carlos@systemhalted.org>
+ TLS support written by Randolph Chung <tausq@debian.org>
+
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
@@ -24,8 +26,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/hppa.h"
@@ -168,7 +170,8 @@ static const bfd_byte plt_stub[] =
shared lib. */
#define ELIMINATE_COPY_RELOCS 1
-enum elf32_hppa_stub_type {
+enum elf32_hppa_stub_type
+{
hppa_stub_long_branch,
hppa_stub_long_branch_shared,
hppa_stub_import,
@@ -177,8 +180,8 @@ enum elf32_hppa_stub_type {
hppa_stub_none
};
-struct elf32_hppa_stub_hash_entry {
-
+struct elf32_hppa_stub_hash_entry
+{
/* Base hash table entry structure. */
struct bfd_hash_entry bh_root;
@@ -203,8 +206,8 @@ struct elf32_hppa_stub_hash_entry {
asection *id_sec;
};
-struct elf32_hppa_link_hash_entry {
-
+struct elf32_hppa_link_hash_entry
+{
struct elf_link_hash_entry eh;
/* A pointer to the most recently used stub hash entry against this
@@ -213,8 +216,8 @@ struct elf32_hppa_link_hash_entry {
/* Used to count relocations for delayed sizing of relocation
sections. */
- struct elf32_hppa_dyn_reloc_entry {
-
+ struct elf32_hppa_dyn_reloc_entry
+ {
/* Next relocation in the chain. */
struct elf32_hppa_dyn_reloc_entry *hdh_next;
@@ -230,12 +233,17 @@ struct elf32_hppa_link_hash_entry {
#endif
} *dyn_relocs;
+ enum
+ {
+ GOT_UNKNOWN = 0, GOT_NORMAL = 1, GOT_TLS_GD = 2, GOT_TLS_LDM = 4, GOT_TLS_IE = 8
+ } tls_type;
+
/* Set if this symbol is used by a plabel reloc. */
unsigned int plabel:1;
};
-struct elf32_hppa_link_hash_table {
-
+struct elf32_hppa_link_hash_table
+{
/* The main hash table. */
struct elf_link_hash_table etab;
@@ -251,7 +259,8 @@ struct elf32_hppa_link_hash_table {
/* Array to keep track of which stub sections have been created, and
information on stub grouping. */
- struct map_stub {
+ struct map_stub
+ {
/* This is the section to which stubs in the group will be
attached. */
asection *link_sec;
@@ -292,6 +301,13 @@ struct elf32_hppa_link_hash_table {
/* Small local sym to section mapping cache. */
struct sym_sec_cache sym_sec;
+
+ /* Data for LDM relocations. */
+ union
+ {
+ bfd_signed_vma refcount;
+ bfd_vma offset;
+ } tls_ldm_got;
};
/* Various hash macros and functions. */
@@ -308,6 +324,15 @@ struct elf32_hppa_link_hash_table {
((struct elf32_hppa_stub_hash_entry *) \
bfd_hash_lookup ((table), (string), (create), (copy)))
+#define hppa_elf_local_got_tls_type(abfd) \
+ ((char *)(elf_local_got_offsets (abfd) + (elf_tdata (abfd)->symtab_hdr.sh_info * 2)))
+
+#define hh_name(hh) \
+ (hh ? hh->eh.root.root.string : "<undef>")
+
+#define eh_name(eh) \
+ (eh ? eh->root.root.string : "<undef>")
+
/* Assorted hash table functions. */
/* Initialize an entry in the stub hash table. */
@@ -375,6 +400,7 @@ hppa_link_hash_newfunc (struct bfd_hash_entry *entry,
hh->hsh_cache = NULL;
hh->dyn_relocs = NULL;
hh->plabel = 0;
+ hh->tls_type = GOT_UNKNOWN;
}
return entry;
@@ -390,7 +416,7 @@ elf32_hppa_link_hash_table_create (bfd *abfd)
struct elf32_hppa_link_hash_table *htab;
bfd_size_type amt = sizeof (*htab);
- htab = (struct elf32_hppa_link_hash_table *) bfd_malloc (amt);
+ htab = bfd_malloc (amt);
if (htab == NULL)
return NULL;
@@ -424,6 +450,7 @@ elf32_hppa_link_hash_table_create (bfd *abfd)
htab->has_22bit_branch = 0;
htab->need_plt_stub = 0;
htab->sym_sec.abfd = NULL;
+ htab->tls_ldm_got.refcount = 0;
return &htab->etab.root;
}
@@ -453,28 +480,24 @@ hppa_stub_name (const asection *input_section,
if (hh)
{
- len = 8 + 1 + strlen (hh->eh.root.root.string) + 1 + 8 + 1;
+ len = 8 + 1 + strlen (hh_name (hh)) + 1 + 8 + 1;
stub_name = bfd_malloc (len);
if (stub_name != NULL)
- {
- sprintf (stub_name, "%08x_%s+%x",
- input_section->id & 0xffffffff,
- hh->eh.root.root.string,
- (int) rela->r_addend & 0xffffffff);
- }
+ sprintf (stub_name, "%08x_%s+%x",
+ input_section->id & 0xffffffff,
+ hh_name (hh),
+ (int) rela->r_addend & 0xffffffff);
}
else
{
len = 8 + 1 + 8 + 1 + 8 + 1 + 8 + 1;
stub_name = bfd_malloc (len);
if (stub_name != NULL)
- {
- sprintf (stub_name, "%08x_%x:%x+%x",
- input_section->id & 0xffffffff,
- sym_sec->id & 0xffffffff,
- (int) ELF32_R_SYM (rela->r_info) & 0xffffffff,
- (int) rela->r_addend & 0xffffffff);
- }
+ sprintf (stub_name, "%08x_%x:%x+%x",
+ input_section->id & 0xffffffff,
+ sym_sec->id & 0xffffffff,
+ (int) ELF32_R_SYM (rela->r_info) & 0xffffffff,
+ (int) rela->r_addend & 0xffffffff);
}
return stub_name;
}
@@ -620,17 +643,13 @@ hppa_type_of_stub (asection *input_sec,
bytes on from the branch instruction location. The offset is
signed and counts in units of 4 bytes. */
if (r_type == (unsigned int) R_PARISC_PCREL17F)
- {
- max_branch_offset = (1 << (17-1)) << 2;
- }
+ max_branch_offset = (1 << (17 - 1)) << 2;
+
else if (r_type == (unsigned int) R_PARISC_PCREL12F)
- {
- max_branch_offset = (1 << (12-1)) << 2;
- }
+ max_branch_offset = (1 << (12 - 1)) << 2;
+
else /* R_PARISC_PCREL22F. */
- {
- max_branch_offset = (1 << (22-1)) << 2;
- }
+ max_branch_offset = (1 << (22 - 1)) << 2;
if (branch_offset + max_branch_offset >= 2*max_branch_offset)
return hppa_stub_long_branch;
@@ -1063,7 +1082,24 @@ elf32_hppa_copy_indirect_symbol (struct bfd_link_info *info,
eh_dir->needs_plt |= eh_ind->needs_plt;
}
else
- _bfd_elf_link_hash_copy_indirect (info, eh_dir, eh_ind);
+ {
+ if (eh_ind->root.type == bfd_link_hash_indirect
+ && eh_dir->got.refcount <= 0)
+ {
+ hh_dir->tls_type = hh_ind->tls_type;
+ hh_ind->tls_type = GOT_UNKNOWN;
+ }
+
+ _bfd_elf_link_hash_copy_indirect (info, eh_dir, eh_ind);
+ }
+}
+
+static int
+elf32_hppa_optimized_tls_reloc (struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ int r_type, int is_local ATTRIBUTE_UNUSED)
+{
+ /* For now we don't support linker optimizations. */
+ return r_type;
}
/* Look through the relocs for a section during the first phase, and
@@ -1084,6 +1120,7 @@ elf32_hppa_check_relocs (bfd *abfd,
struct elf32_hppa_link_hash_table *htab;
asection *sreloc;
asection *stubreloc;
+ int tls_type = GOT_UNKNOWN, old_tls_type = GOT_UNKNOWN;
if (info->relocatable)
return TRUE;
@@ -1121,6 +1158,7 @@ elf32_hppa_check_relocs (bfd *abfd,
}
r_type = ELF32_R_TYPE (rela->r_info);
+ r_type = elf32_hppa_optimized_tls_reloc (info, r_type, hh == NULL);
switch (r_type)
{
@@ -1243,6 +1281,20 @@ elf32_hppa_check_relocs (bfd *abfd,
return FALSE;
continue;
+ case R_PARISC_TLS_GD21L:
+ case R_PARISC_TLS_GD14R:
+ case R_PARISC_TLS_LDM21L:
+ case R_PARISC_TLS_LDM14R:
+ need_entry = NEED_GOT;
+ break;
+
+ case R_PARISC_TLS_IE21L:
+ case R_PARISC_TLS_IE14R:
+ if (info->shared)
+ info->flags |= DF_STATIC_TLS;
+ need_entry = NEED_GOT;
+ break;
+
default:
continue;
}
@@ -1250,6 +1302,25 @@ elf32_hppa_check_relocs (bfd *abfd,
/* Now carry out our orders. */
if (need_entry & NEED_GOT)
{
+ switch (r_type)
+ {
+ default:
+ tls_type = GOT_NORMAL;
+ break;
+ case R_PARISC_TLS_GD21L:
+ case R_PARISC_TLS_GD14R:
+ tls_type |= GOT_TLS_GD;
+ break;
+ case R_PARISC_TLS_LDM21L:
+ case R_PARISC_TLS_LDM14R:
+ tls_type |= GOT_TLS_LDM;
+ break;
+ case R_PARISC_TLS_IE21L:
+ case R_PARISC_TLS_IE14R:
+ tls_type |= GOT_TLS_IE;
+ break;
+ }
+
/* Allocate space for a GOT entry, as well as a dynamic
relocation for this entry. */
if (htab->sgot == NULL)
@@ -1260,31 +1331,56 @@ elf32_hppa_check_relocs (bfd *abfd,
return FALSE;
}
- if (hh != NULL)
- {
- hh->eh.got.refcount += 1;
- }
+ if (r_type == R_PARISC_TLS_LDM21L
+ || r_type == R_PARISC_TLS_LDM14R)
+ hppa_link_hash_table (info)->tls_ldm_got.refcount += 1;
else
{
- bfd_signed_vma *local_got_refcounts;
- /* This is a global offset table entry for a local symbol. */
- local_got_refcounts = elf_local_got_refcounts (abfd);
- if (local_got_refcounts == NULL)
- {
- bfd_size_type size;
-
- /* Allocate space for local got offsets and local
- plt offsets. Done this way to save polluting
- elf_obj_tdata with another target specific
- pointer. */
- size = symtab_hdr->sh_info;
- size *= 2 * sizeof (bfd_signed_vma);
- 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;
+ if (hh != NULL)
+ {
+ hh->eh.got.refcount += 1;
+ old_tls_type = hh->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;
+
+ /* Allocate space for local got offsets and local
+ plt offsets. Done this way to save polluting
+ elf_obj_tdata with another target specific
+ pointer. */
+ size = symtab_hdr->sh_info;
+ size *= 2 * sizeof (bfd_signed_vma);
+ /* Add in space to store the local GOT TLS types. */
+ size += symtab_hdr->sh_info;
+ local_got_refcounts = bfd_zalloc (abfd, size);
+ if (local_got_refcounts == NULL)
+ return FALSE;
+ elf_local_got_refcounts (abfd) = local_got_refcounts;
+ memset (hppa_elf_local_got_tls_type (abfd),
+ GOT_UNKNOWN, symtab_hdr->sh_info);
+ }
+ local_got_refcounts[r_symndx] += 1;
+
+ old_tls_type = hppa_elf_local_got_tls_type (abfd) [r_symndx];
+ }
+
+ tls_type |= old_tls_type;
+
+ if (old_tls_type != tls_type)
+ {
+ if (hh != NULL)
+ hh->tls_type = tls_type;
+ else
+ hppa_elf_local_got_tls_type (abfd) [r_symndx] = tls_type;
+ }
+
}
}
@@ -1325,6 +1421,8 @@ elf32_hppa_check_relocs (bfd *abfd,
plt offsets. */
size = symtab_hdr->sh_info;
size *= 2 * sizeof (bfd_signed_vma);
+ /* Add in space to store the local GOT TLS types. */
+ size += symtab_hdr->sh_info;
local_got_refcounts = bfd_zalloc (abfd, size);
if (local_got_refcounts == NULL)
return FALSE;
@@ -1490,38 +1588,20 @@ elf32_hppa_check_relocs (bfd *abfd,
static asection *
elf32_hppa_gc_mark_hook (asection *sec,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info,
Elf_Internal_Rela *rela,
struct elf_link_hash_entry *hh,
Elf_Internal_Sym *sym)
{
if (hh != NULL)
- {
- switch ((unsigned int) ELF32_R_TYPE (rela->r_info))
- {
- case R_PARISC_GNU_VTINHERIT:
- case R_PARISC_GNU_VTENTRY:
- break;
-
- default:
- switch (hh->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return hh->root.u.def.section;
-
- case bfd_link_hash_common:
- return hh->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
+ switch ((unsigned int) ELF32_R_TYPE (rela->r_info))
+ {
+ case R_PARISC_GNU_VTINHERIT:
+ case R_PARISC_GNU_VTENTRY:
+ return NULL;
+ }
- return NULL;
+ return _bfd_elf_gc_mark_hook (sec, info, rela, hh, sym);
}
/* Update the got and plt entry reference counts for the section being
@@ -1578,11 +1658,17 @@ elf32_hppa_gc_sweep_hook (bfd *abfd,
}
r_type = ELF32_R_TYPE (rela->r_info);
+ r_type = elf32_hppa_optimized_tls_reloc (info, r_type, eh != NULL);
+
switch (r_type)
{
case R_PARISC_DLTIND14F:
case R_PARISC_DLTIND14R:
case R_PARISC_DLTIND21L:
+ case R_PARISC_TLS_GD21L:
+ case R_PARISC_TLS_GD14R:
+ case R_PARISC_TLS_IE21L:
+ case R_PARISC_TLS_IE14R:
if (eh != NULL)
{
if (eh->got.refcount > 0)
@@ -1595,6 +1681,11 @@ elf32_hppa_gc_sweep_hook (bfd *abfd,
}
break;
+ case R_PARISC_TLS_LDM21L:
+ case R_PARISC_TLS_LDM14R:
+ hppa_link_hash_table (info)->tls_ldm_got.refcount -= 1;
+ break;
+
case R_PARISC_PCREL12F:
case R_PARISC_PCREL17C:
case R_PARISC_PCREL17F:
@@ -1709,7 +1800,7 @@ elf32_hppa_hide_symbol (struct bfd_link_info *info,
}
}
- if (! hppa_elf_hash_entry(eh)->plabel)
+ if (! hppa_elf_hash_entry (eh)->plabel)
{
eh->needs_plt = 0;
eh->plt = elf_hash_table (info)->init_plt_refcount;
@@ -1728,7 +1819,6 @@ elf32_hppa_adjust_dynamic_symbol (struct bfd_link_info *info,
{
struct elf32_hppa_link_hash_table *htab;
asection *sec;
- unsigned int power_of_two;
/* If this is a function, put it in the procedure linkage table. We
will fill in the contents of the procedure linkage table later. */
@@ -1838,30 +1928,9 @@ elf32_hppa_adjust_dynamic_symbol (struct bfd_link_info *info,
eh->needs_copy = 1;
}
- /* We need to figure out the alignment required for this symbol. I
- have no idea how other ELF linkers handle this. */
-
- power_of_two = bfd_log2 (eh->size);
- if (power_of_two > 3)
- power_of_two = 3;
-
- /* Apply the required alignment. */
sec = htab->sdynbss;
- sec->size = BFD_ALIGN (sec->size, (bfd_size_type) (1 << power_of_two));
- if (power_of_two > bfd_get_section_alignment (htab->etab.dynobj, sec))
- {
- if (! bfd_set_section_alignment (htab->etab.dynobj, sec, power_of_two))
- return FALSE;
- }
-
- /* Define the symbol as being at this point in the section. */
- eh->root.u.def.section = sec;
- eh->root.u.def.value = sec->size;
-
- /* Increment the section size to make room for the symbol. */
- sec->size += eh->size;
- return TRUE;
+ return _bfd_elf_adjust_dynamic_copy (eh, sec);
}
/* Allocate space in the .plt for entries that won't have relocations.
@@ -1882,7 +1951,7 @@ allocate_plt_static (struct elf_link_hash_entry *eh, void *inf)
eh = (struct elf_link_hash_entry *) eh->root.u.i.link;
info = (struct bfd_link_info *) inf;
- hh = hppa_elf_hash_entry(eh);
+ hh = hppa_elf_hash_entry (eh);
htab = hppa_link_hash_table (info);
if (htab->etab.dynamic_sections_created
&& eh->plt.refcount > 0)
@@ -1982,12 +2051,21 @@ allocate_dynrelocs (struct elf_link_hash_entry *eh, void *inf)
sec = htab->sgot;
eh->got.offset = sec->size;
sec->size += GOT_ENTRY_SIZE;
+ /* R_PARISC_TLS_GD* needs two GOT entries */
+ if ((hh->tls_type & (GOT_TLS_GD | GOT_TLS_IE)) == (GOT_TLS_GD | GOT_TLS_IE))
+ sec->size += GOT_ENTRY_SIZE * 2;
+ else if ((hh->tls_type & GOT_TLS_GD) == GOT_TLS_GD)
+ sec->size += GOT_ENTRY_SIZE;
if (htab->etab.dynamic_sections_created
&& (info->shared
|| (eh->dynindx != -1
&& !eh->forced_local)))
{
htab->srelgot->size += sizeof (Elf32_External_Rela);
+ if ((hh->tls_type & (GOT_TLS_GD | GOT_TLS_IE)) == (GOT_TLS_GD | GOT_TLS_IE))
+ htab->srelgot->size += 2 * sizeof (Elf32_External_Rela);
+ else if ((hh->tls_type & GOT_TLS_GD) == GOT_TLS_GD)
+ htab->srelgot->size += sizeof (Elf32_External_Rela);
}
}
else
@@ -2181,6 +2259,7 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
bfd_size_type locsymcount;
Elf_Internal_Shdr *symtab_hdr;
asection *srel;
+ char *local_tls_type;
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
continue;
@@ -2219,6 +2298,7 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
locsymcount = symtab_hdr->sh_info;
end_local_got = local_got + locsymcount;
+ local_tls_type = hppa_elf_local_got_tls_type (ibfd);
sec = htab->sgot;
srel = htab->srelgot;
for (; local_got < end_local_got; ++local_got)
@@ -2227,11 +2307,23 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
{
*local_got = sec->size;
sec->size += GOT_ENTRY_SIZE;
+ if ((*local_tls_type & (GOT_TLS_GD | GOT_TLS_IE)) == (GOT_TLS_GD | GOT_TLS_IE))
+ sec->size += 2 * GOT_ENTRY_SIZE;
+ else if ((*local_tls_type & GOT_TLS_GD) == GOT_TLS_GD)
+ sec->size += GOT_ENTRY_SIZE;
if (info->shared)
- srel->size += sizeof (Elf32_External_Rela);
+ {
+ srel->size += sizeof (Elf32_External_Rela);
+ if ((*local_tls_type & (GOT_TLS_GD | GOT_TLS_IE)) == (GOT_TLS_GD | GOT_TLS_IE))
+ srel->size += 2 * sizeof (Elf32_External_Rela);
+ else if ((*local_tls_type & GOT_TLS_GD) == GOT_TLS_GD)
+ srel->size += sizeof (Elf32_External_Rela);
+ }
}
else
*local_got = (bfd_vma) -1;
+
+ ++local_tls_type;
}
local_plt = end_local_got;
@@ -2260,6 +2352,17 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
}
}
}
+
+ if (htab->tls_ldm_got.refcount > 0)
+ {
+ /* Allocate 2 got entries and 1 dynamic reloc for
+ R_PARISC_TLS_DTPMOD32 relocs. */
+ htab->tls_ldm_got.offset = htab->sgot->size;
+ htab->sgot->size += (GOT_ENTRY_SIZE * 2);
+ htab->srelgot->size += sizeof (Elf32_External_Rela);
+ }
+ else
+ htab->tls_ldm_got.offset = -1;
/* Do all the .plt entries without relocs first. The dynamic linker
uses the last .plt reloc to find the end of the .plt (and hence
@@ -2299,7 +2402,7 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
else if (sec == htab->sgot
|| sec == htab->sdynbss)
;
- else if (strncmp (bfd_get_section_name (dynobj, sec), ".rela", 5) == 0)
+ else if (CONST_STRNEQ (bfd_get_section_name (dynobj, sec), ".rela"))
{
if (sec->size != 0)
{
@@ -2670,7 +2773,7 @@ get_local_syms (bfd *output_bfd, bfd *input_bfd, struct bfd_link_info *info)
struct elf32_hppa_stub_hash_entry *hsh;
sec = hh->eh.root.u.def.section;
- stub_name = hh->eh.root.root.string;
+ stub_name = hh_name (hh);
hsh = hppa_stub_hash_lookup (&htab->bstab,
stub_name,
FALSE, FALSE);
@@ -3104,6 +3207,35 @@ elf32_hppa_build_stubs (struct bfd_link_info *info)
return TRUE;
}
+/* Return the base vma address which should be subtracted from the real
+ address when resolving a 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 R_PARISC_TLS_TPOFF*.. */
+
+static bfd_vma
+tpoff (struct bfd_link_info *info, bfd_vma address)
+{
+ struct elf_link_hash_table *htab = elf_hash_table (info);
+
+ /* If tls_sec is NULL, we should have signalled an error already. */
+ if (htab->tls_sec == NULL)
+ return 0;
+ /* hppa TLS ABI is variant I and static TLS block start just after
+ tcbhead structure which has 2 pointer fields. */
+ return (address - htab->tls_sec->vma
+ + align_power ((bfd_vma) 8, htab->tls_sec->alignment_power));
+}
+
/* Perform a final link. */
static bfd_boolean
@@ -3315,6 +3447,12 @@ final_link_relocate (asection *input_section,
case R_PARISC_DLTIND21L:
case R_PARISC_DLTIND14R:
case R_PARISC_DLTIND14F:
+ case R_PARISC_TLS_GD21L:
+ case R_PARISC_TLS_GD14R:
+ case R_PARISC_TLS_LDM21L:
+ case R_PARISC_TLS_LDM14R:
+ case R_PARISC_TLS_IE21L:
+ case R_PARISC_TLS_IE14R:
value -= elf_gp (input_section->output_section->owner);
break;
@@ -3342,6 +3480,9 @@ final_link_relocate (asection *input_section,
case R_PARISC_DLTIND14F:
case R_PARISC_SEGBASE:
case R_PARISC_SEGREL32:
+ case R_PARISC_TLS_DTPMOD32:
+ case R_PARISC_TLS_DTPOFF32:
+ case R_PARISC_TLS_TPREL32:
r_field = e_fsel;
break;
@@ -3353,6 +3494,11 @@ final_link_relocate (asection *input_section,
case R_PARISC_DIR21L:
case R_PARISC_DPREL21L:
+ case R_PARISC_TLS_GD21L:
+ case R_PARISC_TLS_LDM21L:
+ case R_PARISC_TLS_LDO21L:
+ case R_PARISC_TLS_IE21L:
+ case R_PARISC_TLS_LE21L:
r_field = e_lrsel;
break;
@@ -3366,6 +3512,11 @@ final_link_relocate (asection *input_section,
case R_PARISC_DIR17R:
case R_PARISC_DIR14R:
case R_PARISC_DPREL14R:
+ case R_PARISC_TLS_GD14R:
+ case R_PARISC_TLS_LDM14R:
+ case R_PARISC_TLS_LDO14R:
+ case R_PARISC_TLS_IE14R:
+ case R_PARISC_TLS_LE14R:
r_field = e_rrsel;
break;
@@ -3478,9 +3629,6 @@ elf32_hppa_relocate_section (bfd *output_bfd,
Elf_Internal_Rela *rela;
Elf_Internal_Rela *relend;
- if (info->relocatable)
- return TRUE;
-
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
htab = hppa_link_hash_table (info);
@@ -3512,7 +3660,6 @@ elf32_hppa_relocate_section (bfd *output_bfd,
|| r_type == (unsigned int) R_PARISC_GNU_VTINHERIT)
continue;
- /* This is a final link. */
r_symndx = ELF32_R_SYM (rela->r_info);
hh = NULL;
sym = NULL;
@@ -3536,7 +3683,8 @@ elf32_hppa_relocate_section (bfd *output_bfd,
eh, sym_sec, relocation,
unresolved_reloc, warned_undef);
- if (relocation == 0
+ if (!info->relocatable
+ && relocation == 0
&& eh->root.type != bfd_link_hash_defined
&& eh->root.type != bfd_link_hash_defweak
&& eh->root.type != bfd_link_hash_undefweak)
@@ -3546,7 +3694,7 @@ elf32_hppa_relocate_section (bfd *output_bfd,
&& eh->type == STT_PARISC_MILLI)
{
if (! info->callbacks->undefined_symbol
- (info, eh->root.root.string, input_bfd,
+ (info, eh_name (eh), input_bfd,
input_section, rela->r_offset, FALSE))
return FALSE;
warned_undef = TRUE;
@@ -3555,6 +3703,22 @@ elf32_hppa_relocate_section (bfd *output_bfd,
hh = hppa_elf_hash_entry (eh);
}
+ if (sym_sec != NULL && elf_discarded_section (sym_sec))
+ {
+ /* For relocs against symbols from removed linkonce
+ sections, or sections discarded by a linker script,
+ we just want the section contents zeroed. Avoid any
+ special processing. */
+ _bfd_clear_contents (elf_hppa_howto_table + r_type, input_bfd,
+ contents + rela->r_offset);
+ rela->r_info = 0;
+ rela->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
/* Do any required modifications to the relocation value, and
determine what types of dynamic info we need to output, if
any. */
@@ -3766,11 +3930,7 @@ elf32_hppa_relocate_section (bfd *output_bfd,
case R_PARISC_DPREL14R:
case R_PARISC_DPREL21L:
case R_PARISC_DIR32:
- /* r_symndx will be zero only for relocs against symbols
- from removed linkonce sections, or sections discarded by
- a linker script. */
- if (r_symndx == 0
- || (input_section->flags & SEC_ALLOC) == 0)
+ if ((input_section->flags & SEC_ALLOC) == 0)
break;
/* The reloc types handled here and this conditional
@@ -3851,17 +4011,22 @@ elf32_hppa_relocate_section (bfd *output_bfd,
&& sym_sec->output_section != NULL
&& ! bfd_is_abs_section (sym_sec))
{
- /* Skip this relocation if the output section has
- been discarded. */
- if (bfd_is_abs_section (sym_sec->output_section))
- break;
+ asection *osec;
+
+ osec = sym_sec->output_section;
+ indx = elf_section_data (osec)->dynindx;
+ if (indx == 0)
+ {
+ osec = htab->etab.text_index_section;
+ indx = elf_section_data (osec)->dynindx;
+ }
+ BFD_ASSERT (indx != 0);
- indx = elf_section_data (sym_sec->output_section)->dynindx;
/* We are turning this relocation into one
against a section symbol, so subtract out the
output section's address but not the offset
of the input section in the output section. */
- outrel.r_addend -= sym_sec->output_section->vma;
+ outrel.r_addend -= osec->vma;
}
outrel.r_info = ELF32_R_INFO (indx, r_type);
@@ -3875,6 +4040,198 @@ elf32_hppa_relocate_section (bfd *output_bfd,
bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
}
break;
+
+ case R_PARISC_TLS_LDM21L:
+ case R_PARISC_TLS_LDM14R:
+ {
+ bfd_vma off;
+
+ off = htab->tls_ldm_got.offset;
+ if (off & 1)
+ off &= ~1;
+ else
+ {
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
+
+ outrel.r_offset = (off
+ + htab->sgot->output_section->vma
+ + htab->sgot->output_offset);
+ outrel.r_addend = 0;
+ outrel.r_info = ELF32_R_INFO (0, R_PARISC_TLS_DTPMOD32);
+ 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;
+ }
+
+ /* Add the base of the GOT to the relocation value. */
+ relocation = (off
+ + htab->sgot->output_offset
+ + htab->sgot->output_section->vma);
+
+ break;
+ }
+
+ case R_PARISC_TLS_LDO21L:
+ case R_PARISC_TLS_LDO14R:
+ relocation -= dtpoff_base (info);
+ break;
+
+ case R_PARISC_TLS_GD21L:
+ case R_PARISC_TLS_GD14R:
+ case R_PARISC_TLS_IE21L:
+ case R_PARISC_TLS_IE14R:
+ {
+ bfd_vma off;
+ int indx;
+ char tls_type;
+
+ indx = 0;
+ if (hh != NULL)
+ {
+ bfd_boolean dyn;
+ dyn = htab->etab.dynamic_sections_created;
+
+ if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, &hh->eh)
+ && (!info->shared
+ || !SYMBOL_REFERENCES_LOCAL (info, &hh->eh)))
+ {
+ indx = hh->eh.dynindx;
+ }
+ off = hh->eh.got.offset;
+ tls_type = hh->tls_type;
+ }
+ else
+ {
+ off = local_got_offsets[r_symndx];
+ tls_type = hppa_elf_local_got_tls_type (input_bfd)[r_symndx];
+ }
+
+ if (tls_type == GOT_UNKNOWN)
+ abort ();
+
+ if ((off & 1) != 0)
+ off &= ~1;
+ else
+ {
+ bfd_boolean need_relocs = FALSE;
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc = NULL;
+ int cur_off = off;
+
+ /* The GOT entries have not been initialized yet. Do it
+ now, and emit any relocations. If both an IE GOT and a
+ GD GOT are necessary, we emit the GD first. */
+
+ if ((info->shared || indx != 0)
+ && (hh == NULL
+ || ELF_ST_VISIBILITY (hh->eh.other) == STV_DEFAULT
+ || hh->eh.root.type != bfd_link_hash_undefweak))
+ {
+ need_relocs = TRUE;
+ loc = htab->srelgot->contents;
+ /* FIXME (CAO): Should this be reloc_count++ ? */
+ loc += htab->srelgot->reloc_count * sizeof (Elf32_External_Rela);
+ }
+
+ if (tls_type & GOT_TLS_GD)
+ {
+ if (need_relocs)
+ {
+ outrel.r_offset = (cur_off
+ + htab->sgot->output_section->vma
+ + htab->sgot->output_offset);
+ outrel.r_info = ELF32_R_INFO (indx,R_PARISC_TLS_DTPMOD32);
+ outrel.r_addend = 0;
+ bfd_put_32 (output_bfd, 0, htab->sgot->contents + cur_off);
+ bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
+ htab->srelgot->reloc_count++;
+ loc += sizeof (Elf32_External_Rela);
+
+ if (indx == 0)
+ bfd_put_32 (output_bfd, relocation - dtpoff_base (info),
+ htab->sgot->contents + cur_off + 4);
+ else
+ {
+ bfd_put_32 (output_bfd, 0,
+ htab->sgot->contents + cur_off + 4);
+ outrel.r_info = ELF32_R_INFO (indx, R_PARISC_TLS_DTPOFF32);
+ outrel.r_offset += 4;
+ bfd_elf32_swap_reloca_out (output_bfd, &outrel,loc);
+ htab->srelgot->reloc_count++;
+ loc += sizeof (Elf32_External_Rela);
+ }
+ }
+ else
+ {
+ /* If we are not emitting relocations for a
+ general dynamic reference, then we must be in a
+ static link or an executable link with the
+ symbol binding locally. Mark it as belonging
+ to module 1, the executable. */
+ bfd_put_32 (output_bfd, 1,
+ htab->sgot->contents + cur_off);
+ bfd_put_32 (output_bfd, relocation - dtpoff_base (info),
+ htab->sgot->contents + cur_off + 4);
+ }
+
+
+ cur_off += 8;
+ }
+
+ if (tls_type & GOT_TLS_IE)
+ {
+ if (need_relocs)
+ {
+ outrel.r_offset = (cur_off
+ + htab->sgot->output_section->vma
+ + htab->sgot->output_offset);
+ outrel.r_info = ELF32_R_INFO (indx, R_PARISC_TLS_TPREL32);
+
+ if (indx == 0)
+ outrel.r_addend = relocation - dtpoff_base (info);
+ else
+ outrel.r_addend = 0;
+
+ bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
+ htab->srelgot->reloc_count++;
+ loc += sizeof (Elf32_External_Rela);
+ }
+ else
+ bfd_put_32 (output_bfd, tpoff (info, relocation),
+ htab->sgot->contents + cur_off);
+
+ cur_off += 4;
+ }
+
+ if (hh != NULL)
+ hh->eh.got.offset |= 1;
+ else
+ local_got_offsets[r_symndx] |= 1;
+ }
+
+ if ((tls_type & GOT_TLS_GD)
+ && r_type != R_PARISC_TLS_GD21L
+ && r_type != R_PARISC_TLS_GD14R)
+ off += 2 * GOT_ENTRY_SIZE;
+
+ /* Add the base of the GOT to the relocation value. */
+ relocation = (off
+ + htab->sgot->output_offset
+ + htab->sgot->output_section->vma);
+
+ break;
+ }
+
+ case R_PARISC_TLS_LE21L:
+ case R_PARISC_TLS_LE14R:
+ {
+ relocation = tpoff (info, relocation);
+ break;
+ }
+ break;
default:
break;
@@ -3887,7 +4244,7 @@ elf32_hppa_relocate_section (bfd *output_bfd,
continue;
if (hh != NULL)
- sym_name = hh->eh.root.root.string;
+ sym_name = hh_name (hh);
else
{
sym_name = bfd_elf_string_from_elf_section (input_bfd,
@@ -3996,7 +4353,9 @@ elf32_hppa_finish_dynamic_symbol (bfd *output_bfd,
}
}
- if (eh->got.offset != (bfd_vma) -1)
+ if (eh->got.offset != (bfd_vma) -1
+ && (hppa_elf_hash_entry (eh)->tls_type & GOT_TLS_GD) == 0
+ && (hppa_elf_hash_entry (eh)->tls_type & GOT_TLS_IE) == 0)
{
/* This symbol has an entry in the global offset table. Set it
up. */
@@ -4057,8 +4416,8 @@ elf32_hppa_finish_dynamic_symbol (bfd *output_bfd,
}
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
- if (eh->root.root.string[0] == '_'
- && (strcmp (eh->root.root.string, "_DYNAMIC") == 0
+ if (eh_name (eh)[0] == '_'
+ && (strcmp (eh_name (eh), "_DYNAMIC") == 0
|| eh == htab->etab.hgot))
{
sym->st_shndx = SHN_ABS;
@@ -4073,6 +4432,17 @@ elf32_hppa_finish_dynamic_symbol (bfd *output_bfd,
static enum elf_reloc_type_class
elf32_hppa_reloc_type_class (const Elf_Internal_Rela *rela)
{
+ /* Handle TLS relocs first; we don't want them to be marked
+ relative by the "if (ELF32_R_SYM (rela->r_info) == 0)"
+ check below. */
+ switch ((int) ELF32_R_TYPE (rela->r_info))
+ {
+ case R_PARISC_TLS_DTPMOD32:
+ case R_PARISC_TLS_DTPOFF32:
+ case R_PARISC_TLS_TPREL32:
+ return reloc_class_normal;
+ }
+
if (ELF32_R_SYM (rela->r_info) == 0)
return reloc_class_relative;
@@ -4209,30 +4579,6 @@ elf32_hppa_finish_dynamic_sections (bfd *output_bfd,
return TRUE;
}
-/* Tweak the OSABI field of the elf header. */
-
-static void
-elf32_hppa_post_process_headers (bfd *abfd,
- struct bfd_link_info *info ATTRIBUTE_UNUSED)
-{
- Elf_Internal_Ehdr * i_ehdrp;
-
- i_ehdrp = elf_elfheader (abfd);
-
- if (strcmp (bfd_get_target (abfd), "elf32-hppa-linux") == 0)
- {
- i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_LINUX;
- }
- else if (strcmp (bfd_get_target (abfd), "elf32-hppa-netbsd") == 0)
- {
- i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_NETBSD;
- }
- else
- {
- i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_HPUX;
- }
-}
-
/* Called when writing out an object file to decide the type of a
symbol. */
static int
@@ -4247,6 +4593,7 @@ elf32_hppa_elf_get_symbol_type (Elf_Internal_Sym *elf_sym, int type)
/* Misc BFD support code. */
#define bfd_elf32_bfd_is_local_label_name elf_hppa_is_local_label_name
#define bfd_elf32_bfd_reloc_type_lookup elf_hppa_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup elf_hppa_reloc_name_lookup
#define elf_info_to_howto elf_hppa_info_to_howto
#define elf_info_to_howto_rel elf_hppa_info_to_howto_rel
@@ -4264,13 +4611,14 @@ elf32_hppa_elf_get_symbol_type (Elf_Internal_Sym *elf_sym, int type)
#define elf_backend_finish_dynamic_symbol elf32_hppa_finish_dynamic_symbol
#define elf_backend_finish_dynamic_sections elf32_hppa_finish_dynamic_sections
#define elf_backend_size_dynamic_sections elf32_hppa_size_dynamic_sections
+#define elf_backend_init_index_section _bfd_elf_init_1_index_section
#define elf_backend_gc_mark_hook elf32_hppa_gc_mark_hook
#define elf_backend_gc_sweep_hook elf32_hppa_gc_sweep_hook
#define elf_backend_grok_prstatus elf32_hppa_grok_prstatus
#define elf_backend_grok_psinfo elf32_hppa_grok_psinfo
#define elf_backend_object_p elf32_hppa_object_p
#define elf_backend_final_write_processing elf_hppa_final_write_processing
-#define elf_backend_post_process_headers elf32_hppa_post_process_headers
+#define elf_backend_post_process_headers _bfd_elf_set_osabi
#define elf_backend_get_symbol_type elf32_hppa_elf_get_symbol_type
#define elf_backend_reloc_type_class elf32_hppa_reloc_type_class
#define elf_backend_action_discarded elf_hppa_action_discarded
@@ -4289,20 +4637,29 @@ elf32_hppa_elf_get_symbol_type (Elf_Internal_Sym *elf_sym, int type)
#define ELF_ARCH bfd_arch_hppa
#define ELF_MACHINE_CODE EM_PARISC
#define ELF_MAXPAGESIZE 0x1000
+#define ELF_OSABI ELFOSABI_HPUX
+#define elf32_bed elf32_hppa_hpux_bed
#include "elf32-target.h"
#undef TARGET_BIG_SYM
-#define TARGET_BIG_SYM bfd_elf32_hppa_linux_vec
+#define TARGET_BIG_SYM bfd_elf32_hppa_linux_vec
#undef TARGET_BIG_NAME
-#define TARGET_BIG_NAME "elf32-hppa-linux"
+#define TARGET_BIG_NAME "elf32-hppa-linux"
+#undef ELF_OSABI
+#define ELF_OSABI ELFOSABI_LINUX
+#undef elf32_bed
+#define elf32_bed elf32_hppa_linux_bed
-#define INCLUDED_TARGET_FILE 1
#include "elf32-target.h"
#undef TARGET_BIG_SYM
-#define TARGET_BIG_SYM bfd_elf32_hppa_nbsd_vec
+#define TARGET_BIG_SYM bfd_elf32_hppa_nbsd_vec
#undef TARGET_BIG_NAME
-#define TARGET_BIG_NAME "elf32-hppa-netbsd"
+#define TARGET_BIG_NAME "elf32-hppa-netbsd"
+#undef ELF_OSABI
+#define ELF_OSABI ELFOSABI_NETBSD
+#undef elf32_bed
+#define elf32_bed elf32_hppa_netbsd_bed
#include "elf32-target.h"
diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c
index d9e6fbf52806..0ec34b872e17 100644
--- a/bfd/elf32-i370.c
+++ b/bfd/elf32-i370.c
@@ -1,6 +1,6 @@
/* i370-specific support for 32-bit ELF
- Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
+ Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004,
+ 2005, 2006, 2007 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
Hacked by Linas Vepstas for i370 linas@linas.org
@@ -27,8 +27,8 @@
else is a wild card. In particular, don't expect shared libs or
dynamic loading to work ... its never been tested. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -267,6 +267,22 @@ i370_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return i370_elf_howto_table[ (int)i370_reloc ];
};
+static reloc_howto_type *
+i370_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (i370_elf_howto_raw) / sizeof (i370_elf_howto_raw[0]);
+ i++)
+ if (i370_elf_howto_raw[i].name != NULL
+ && strcasecmp (i370_elf_howto_raw[i].name, r_name) == 0)
+ return &i370_elf_howto_raw[i];
+
+ return NULL;
+}
+
/* The name of the dynamic interpreter. This is put in the .interp
section. */
@@ -445,7 +461,6 @@ i370_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
{
bfd *dynobj = elf_hash_table (info)->dynobj;
asection *s;
- unsigned int power_of_two;
#ifdef DEBUG
fprintf (stderr, "i370_elf_adjust_dynamic_symbol called for %s\n",
@@ -530,28 +545,7 @@ i370_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
h->needs_copy = 1;
}
- /* We need to figure out the alignment required for this symbol. I
- have no idea how ELF linkers handle this. */
- power_of_two = bfd_log2 (h->size);
- if (power_of_two > 4)
- power_of_two = 4;
-
- /* Apply the required alignment. */
- s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two));
- if (power_of_two > bfd_get_section_alignment (dynobj, s))
- {
- if (! bfd_set_section_alignment (dynobj, s, power_of_two))
- return FALSE;
- }
-
- /* Define the symbol as being at this point in the section. */
- h->root.u.def.section = s;
- h->root.u.def.value = s->size;
-
- /* Increment the section size to make room for the symbol. */
- s->size += h->size;
-
- return TRUE;
+ return _bfd_elf_adjust_dynamic_copy (h, s);
}
/* Increment the index of a dynamic symbol by a given amount. Called
@@ -567,7 +561,7 @@ i370_elf_adjust_dynindx (struct elf_link_hash_entry *h, void * cparg)
#ifdef DEBUG
fprintf (stderr,
- "i370_elf_adjust_dynindx called, h->dynindx = %d, *cp = %d\n",
+ "i370_elf_adjust_dynindx called, h->dynindx = %ld, *cp = %d\n",
h->dynindx, *cp);
#endif
@@ -655,7 +649,7 @@ i370_elf_size_dynamic_sections (bfd *output_bfd,
/* Remember whether there is a PLT. */
plt = s->size != 0;
}
- else if (strncmp (name, ".rela", 5) == 0)
+ else if (CONST_STRNEQ (name, ".rela"))
{
if (s->size != 0)
{
@@ -867,7 +861,7 @@ i370_elf_check_relocs (bfd *abfd,
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (abfd, sec), name + 5) == 0);
sreloc = bfd_get_section_by_name (dynobj, name);
@@ -1077,9 +1071,6 @@ i370_elf_relocate_section (bfd *output_bfd,
bfd_vma *local_got_offsets;
bfd_boolean ret = TRUE;
- if (info->relocatable)
- return TRUE;
-
#ifdef DEBUG
_bfd_error_handler ("i370_elf_relocate_section called for %B section %A, %ld relocations%s",
input_bfd, input_section,
@@ -1122,6 +1113,7 @@ i370_elf_relocate_section (bfd *output_bfd,
howto = i370_elf_howto_table[(int) r_type];
r_symndx = ELF32_R_SYM (rel->r_info);
+ relocation = 0;
if (r_symndx < symtab_hdr->sh_info)
{
@@ -1154,18 +1146,18 @@ i370_elf_relocate_section (bfd *output_bfd,
/* 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
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->unresolved_syms_in_objects == RM_IGNORE
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
- relocation = 0;
- else
+ ;
+ else if (!info->relocatable)
{
if ((*info->callbacks->undefined_symbol)
(info, h->root.root.string, input_bfd,
@@ -1176,10 +1168,23 @@ i370_elf_relocate_section (bfd *output_bfd,
ret = FALSE;
continue;
}
- relocation = 0;
}
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
switch ((int) r_type)
{
default:
@@ -1236,7 +1241,7 @@ i370_elf_relocate_section (bfd *output_bfd,
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (input_bfd,
input_section),
name + 5) == 0);
@@ -1290,13 +1295,25 @@ i370_elf_relocate_section (bfd *output_bfd,
{
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);
+ if (indx == 0)
+ {
+ struct elf_link_hash_table *htab;
+ htab = elf_hash_table (info);
+ osec = htab->text_index_section;
+ indx = elf_section_data (osec)->dynindx;
+ }
+ BFD_ASSERT (indx != 0);
#ifdef DEBUG
if (indx <= 0)
{
- printf ("indx=%d section=%s flags=%08x name=%s\n",
+ printf ("indx=%ld section=%s flags=%08x name=%s\n",
indx, osec->name, osec->flags,
h->root.root.string);
}
@@ -1394,16 +1411,6 @@ i370_elf_relocate_section (bfd *output_bfd,
return ret;
}
-
-static void
-i370_elf_post_process_headers (bfd * abfd,
- struct bfd_link_info * link_info ATTRIBUTE_UNUSED)
-{
- Elf_Internal_Ehdr * i_ehdrp; /* Elf file header, internal form. */
-
- i_ehdrp = elf_elfheader (abfd);
- i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_LINUX;
-}
#define TARGET_BIG_SYM bfd_elf32_i370_vec
#define TARGET_BIG_NAME "elf32-i370"
@@ -1413,12 +1420,15 @@ i370_elf_post_process_headers (bfd * abfd,
#define ELF_MACHINE_ALT1 EM_I370_OLD
#endif
#define ELF_MAXPAGESIZE 0x1000
+#define ELF_OSABI ELFOSABI_LINUX
+
#define elf_info_to_howto i370_elf_info_to_howto
#define elf_backend_plt_not_loaded 1
#define elf_backend_rela_normal 1
#define bfd_elf32_bfd_reloc_type_lookup i370_elf_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup i370_elf_reloc_name_lookup
#define bfd_elf32_bfd_set_private_flags i370_elf_set_private_flags
#define bfd_elf32_bfd_merge_private_bfd_data i370_elf_merge_private_bfd_data
#define elf_backend_relocate_section i370_elf_relocate_section
@@ -1427,12 +1437,13 @@ i370_elf_post_process_headers (bfd * abfd,
link glibc's ld.so without errors. */
#define elf_backend_create_dynamic_sections i370_elf_create_dynamic_sections
#define elf_backend_size_dynamic_sections i370_elf_size_dynamic_sections
+#define elf_backend_init_index_section _bfd_elf_init_1_index_section
#define elf_backend_finish_dynamic_sections i370_elf_finish_dynamic_sections
#define elf_backend_fake_sections i370_elf_fake_sections
#define elf_backend_section_from_shdr i370_elf_section_from_shdr
#define elf_backend_adjust_dynamic_symbol i370_elf_adjust_dynamic_symbol
#define elf_backend_check_relocs i370_elf_check_relocs
-#define elf_backend_post_process_headers i370_elf_post_process_headers
+#define elf_backend_post_process_headers _bfd_elf_set_osabi
static int
i370_noop (void)
@@ -1440,19 +1451,9 @@ i370_noop (void)
return 1;
}
-/* We need to define these at least as no-ops to link glibc ld.so. */
-
-#define elf_backend_add_symbol_hook \
- (bfd_boolean (*) \
- (bfd *, struct bfd_link_info *, Elf_Internal_Sym *, \
- const char **, flagword *, asection **, bfd_vma *)) i370_noop
#define elf_backend_finish_dynamic_symbol \
(bfd_boolean (*) \
(bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, \
Elf_Internal_Sym *)) i370_noop
-#define elf_backend_additional_program_headers \
- (int (*) (bfd *)) i370_noop
-#define elf_backend_modify_segment_map \
- (bfd_boolean (*) (bfd *, struct bfd_link_info *)) i370_noop
#include "elf32-target.h"
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 754aa52254d5..0e023df4ad0d 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -1,6 +1,6 @@
/* Intel 80386/80486-specific support for 32-bit ELF
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -330,6 +330,20 @@ elf_i386_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return 0;
}
+static reloc_howto_type *
+elf_i386_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0; i < sizeof (elf_howto_table) / sizeof (elf_howto_table[0]); i++)
+ if (elf_howto_table[i].name != NULL
+ && strcasecmp (elf_howto_table[i].name, r_name) == 0)
+ return &elf_howto_table[i];
+
+ return NULL;
+}
+
static void
elf_i386_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED,
arelent *cache_ptr,
@@ -582,10 +596,6 @@ struct elf_i386_link_hash_entry
#define GOT_TLS_IE_NEG 6
#define GOT_TLS_IE_BOTH 7
#define GOT_TLS_GDESC 8
-#define GOT_TLS_MASK 0x0f
-#define GOT_TLS_IE_IE 0x10
-#define GOT_TLS_IE_GD 0x20
-#define GOT_TLS_IE_MASK 0x30
#define GOT_TLS_GD_BOTH_P(type) \
((type) == (GOT_TLS_GD | GOT_TLS_GDESC))
#define GOT_TLS_GD_P(type) \
@@ -626,11 +636,14 @@ struct elf_i386_obj_tdata
static bfd_boolean
elf_i386_mkobject (bfd *abfd)
{
- bfd_size_type amt = sizeof (struct elf_i386_obj_tdata);
- abfd->tdata.any = bfd_zalloc (abfd, amt);
if (abfd->tdata.any == NULL)
- return FALSE;
- return TRUE;
+ {
+ bfd_size_type amt = sizeof (struct elf_i386_obj_tdata);
+ abfd->tdata.any = bfd_zalloc (abfd, amt);
+ if (abfd->tdata.any == NULL)
+ return FALSE;
+ }
+ return bfd_elf_mkobject (abfd);
}
/* i386 ELF linker hash table. */
@@ -1011,25 +1024,12 @@ elf_i386_check_relocs (bfd *abfd,
case R_386_TLS_IE_32:
if (ELF32_R_TYPE (rel->r_info) == r_type)
tls_type = GOT_TLS_IE_NEG;
- else if (h
- && ELF32_R_TYPE (rel->r_info) == R_386_TLS_GD)
- /* If this is a GD->IE transition, we may use either
- of R_386_TLS_TPOFF and R_386_TLS_TPOFF32. But if
- we may have both R_386_TLS_IE and R_386_TLS_GD,
- we can't share the same R_386_TLS_TPOFF since
- they require different offsets. So we remember
- it comes from R_386_TLS_GD. */
- tls_type = GOT_TLS_IE | GOT_TLS_IE_GD;
else
+ /* If this is a GD->IE transition, we may use either of
+ R_386_TLS_TPOFF and R_386_TLS_TPOFF32. */
tls_type = GOT_TLS_IE;
break;
case R_386_TLS_IE:
- if (h)
- {
- /* We remember it comes from R_386_TLS_IE. */
- tls_type = GOT_TLS_IE_POS | GOT_TLS_IE_IE;
- break;
- }
case R_386_TLS_GOTIE:
tls_type = GOT_TLS_IE_POS; break;
}
@@ -1069,8 +1069,7 @@ elf_i386_check_relocs (bfd *abfd,
tls_type |= old_tls_type;
/* If a TLS symbol is accessed using IE at least once,
there is no point to use dynamic model for it. */
- else if (old_tls_type != tls_type
- && old_tls_type != GOT_UNKNOWN
+ else if (old_tls_type != tls_type && old_tls_type != GOT_UNKNOWN
&& (! GOT_TLS_GD_ANY_P (old_tls_type)
|| (tls_type & GOT_TLS_IE) == 0))
{
@@ -1165,7 +1164,7 @@ elf_i386_check_relocs (bfd *abfd,
&& (sec->flags & SEC_ALLOC) != 0
&& (r_type != R_386_PC32
|| (h != NULL
- && (! info->symbolic
+ && (! SYMBOLIC_BIND (info, h)
|| h->root.type == bfd_link_hash_defweak
|| !h->def_regular))))
|| (ELIMINATE_COPY_RELOCS
@@ -1192,7 +1191,7 @@ elf_i386_check_relocs (bfd *abfd,
if (name == NULL)
return FALSE;
- if (strncmp (name, ".rel", 4) != 0
+ if (! CONST_STRNEQ (name, ".rel")
|| strcmp (bfd_get_section_name (abfd, sec),
name + 4) != 0)
{
@@ -1294,38 +1293,20 @@ elf_i386_check_relocs (bfd *abfd,
static asection *
elf_i386_gc_mark_hook (asection *sec,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info,
Elf_Internal_Rela *rel,
struct elf_link_hash_entry *h,
Elf_Internal_Sym *sym)
{
if (h != NULL)
- {
- switch (ELF32_R_TYPE (rel->r_info))
- {
- case R_386_GNU_VTINHERIT:
- case R_386_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
-
- return NULL;
+ switch (ELF32_R_TYPE (rel->r_info))
+ {
+ case R_386_GNU_VTINHERIT:
+ case R_386_GNU_VTENTRY:
+ return NULL;
+ }
+
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
/* Update the got entry reference counts for the section being removed. */
@@ -1438,7 +1419,6 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info,
{
struct elf_i386_link_hash_table *htab;
asection *s;
- unsigned int power_of_two;
/* If this is a function, put it in the procedure linkage table. We
will fill in the contents of the procedure linkage table later,
@@ -1558,29 +1538,9 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info,
h->needs_copy = 1;
}
- /* We need to figure out the alignment required for this symbol. I
- have no idea how ELF linkers handle this. */
- power_of_two = bfd_log2 (h->size);
- if (power_of_two > 3)
- power_of_two = 3;
-
- /* Apply the required alignment. */
s = htab->sdynbss;
- s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two));
- if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s))
- {
- if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two))
- return FALSE;
- }
-
- /* Define the symbol as being at this point in the section. */
- h->root.u.def.section = s;
- h->root.u.def.value = s->size;
-
- /* Increment the section size to make room for the symbol. */
- s->size += h->size;
- return TRUE;
+ return _bfd_elf_adjust_dynamic_copy (h, s);
}
/* Allocate space in .plt, .got and associated reloc sections for
@@ -1700,14 +1660,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
asection *s;
bfd_boolean dyn;
int tls_type = elf_i386_hash_entry(h)->tls_type;
-
- /* If we have both R_386_TLS_IE and R_386_TLS_GD, GOT_TLS_IE_BOTH
- should be used. */
- if ((tls_type & GOT_TLS_IE_MASK)
- == (GOT_TLS_IE_IE | GOT_TLS_IE_GD))
- tls_type = GOT_TLS_IE_BOTH;
- else
- tls_type &= GOT_TLS_MASK;
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
@@ -2052,7 +2004,7 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
if (htab->elf.hplt != NULL)
strip_section = FALSE;
}
- else if (strncmp (bfd_get_section_name (dynobj, s), ".rel", 4) == 0)
+ else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rel"))
{
if (s->size != 0 && s != htab->srelplt && s != htab->srelplt2)
relocs = TRUE;
@@ -2305,51 +2257,6 @@ elf_i386_relocate_section (bfd *output_bfd,
howto = elf_howto_table + indx;
r_symndx = ELF32_R_SYM (rel->r_info);
-
- if (info->relocatable)
- {
- bfd_vma val;
- bfd_byte *where;
-
- /* This is a relocatable link. We don't have to change
- anything, unless the reloc is against a section symbol,
- in which case we have to adjust according to where the
- section symbol winds up in the output section. */
- if (r_symndx >= symtab_hdr->sh_info)
- continue;
-
- sym = local_syms + r_symndx;
- if (ELF_ST_TYPE (sym->st_info) != STT_SECTION)
- continue;
-
- sec = local_sections[r_symndx];
- val = sec->output_offset;
- if (val == 0)
- continue;
-
- where = contents + rel->r_offset;
- switch (howto->size)
- {
- /* FIXME: overflow checks. */
- case 0:
- val += bfd_get_8 (input_bfd, where);
- bfd_put_8 (input_bfd, val, where);
- break;
- case 1:
- val += bfd_get_16 (input_bfd, where);
- bfd_put_16 (input_bfd, val, where);
- break;
- case 2:
- val += bfd_get_32 (input_bfd, where);
- bfd_put_32 (input_bfd, val, where);
- break;
- default:
- abort ();
- }
- continue;
- }
-
- /* This is a final link. */
h = NULL;
sym = NULL;
sec = NULL;
@@ -2361,10 +2268,12 @@ elf_i386_relocate_section (bfd *output_bfd,
relocation = (sec->output_section->vma
+ sec->output_offset
+ sym->st_value);
- if ((sec->flags & SEC_MERGE)
- && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+
+ if (ELF_ST_TYPE (sym->st_info) == STT_SECTION
+ && ((sec->flags & SEC_MERGE) != 0
+ || (info->relocatable
+ && sec->output_offset != 0)))
{
- asection *msec;
bfd_vma addend;
bfd_byte *where = contents + rel->r_offset;
@@ -2398,10 +2307,16 @@ elf_i386_relocate_section (bfd *output_bfd,
abort ();
}
- msec = sec;
- addend = _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend);
- addend -= relocation;
- addend += msec->output_section->vma + msec->output_offset;
+ if (info->relocatable)
+ addend += sec->output_offset;
+ else
+ {
+ asection *msec = sec;
+ addend = _bfd_elf_rel_local_sym (output_bfd, sym, &msec,
+ addend);
+ addend -= relocation;
+ addend += msec->output_section->vma + msec->output_offset;
+ }
switch (howto->size)
{
@@ -2434,21 +2349,20 @@ elf_i386_relocate_section (bfd *output_bfd,
unresolved_reloc, warned);
}
- if (r_symndx == 0)
+ if (sec != NULL && elf_discarded_section (sec))
{
- /* r_symndx will be zero only for relocs against symbols from
- removed linkonce sections, or sections discarded by a linker
- script. For these relocs, we just want the section contents
- zeroed. Avoid any special processing in the switch below. */
- r_type = R_386_NONE;
-
- relocation = 0;
- if (howto->pc_relative)
- relocation = (input_section->output_section->vma
- + input_section->output_offset
- + rel->r_offset);
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
}
+ if (info->relocatable)
+ continue;
+
switch (r_type)
{
case R_386_GOT32:
@@ -2652,7 +2566,7 @@ elf_i386_relocate_section (bfd *output_bfd,
&& h->dynindx != -1
&& (r_type == R_386_PC32
|| !info->shared
- || !info->symbolic
+ || !SYMBOLIC_BIND (info, h)
|| !h->def_regular))
outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
else
@@ -2711,13 +2625,6 @@ elf_i386_relocate_section (bfd *output_bfd,
else if (h != NULL)
{
tls_type = elf_i386_hash_entry(h)->tls_type;
- /* If we have both R_386_TLS_IE and R_386_TLS_GD,
- GOT_TLS_IE_BOTH should be used. */
- if ((tls_type & GOT_TLS_IE_MASK)
- == (GOT_TLS_IE_IE | GOT_TLS_IE_GD))
- tls_type = GOT_TLS_IE_BOTH;
- else
- tls_type &= GOT_TLS_MASK;
if (!info->shared && h->dynindx == -1 && (tls_type & GOT_TLS_IE))
r_type = R_386_TLS_LE_32;
}
@@ -2851,8 +2758,9 @@ elf_i386_relocate_section (bfd *output_bfd,
val = bfd_get_8 (input_bfd, contents + roff + 1);
BFD_ASSERT (val == 0x10);
- /* Now modify the instruction as appropriate. */
- bfd_put_8 (output_bfd, 0x90, contents + roff);
+ /* Now modify the instruction as appropriate. Use
+ xchg %ax,%ax instead of 2 nops. */
+ bfd_put_8 (output_bfd, 0x66, contents + roff);
bfd_put_8 (output_bfd, 0x90, contents + roff + 1);
continue;
}
@@ -3172,12 +3080,8 @@ elf_i386_relocate_section (bfd *output_bfd,
subl $foo@gottpoff(%reg), %eax
into:
addl $foo@gotntpoff(%reg), %eax. */
- if (r_type == R_386_TLS_GOTIE)
- {
- contents[roff + 6] = 0x03;
- if (tls_type == GOT_TLS_IE_BOTH)
- off += 4;
- }
+ if (tls_type == GOT_TLS_IE_POS)
+ contents[roff + 6] = 0x03;
bfd_put_32 (output_bfd,
htab->sgot->output_section->vma
+ htab->sgot->output_offset + off
@@ -3261,8 +3165,8 @@ elf_i386_relocate_section (bfd *output_bfd,
/* Now modify the instruction as appropriate. */
if (tls_type != GOT_TLS_IE_NEG)
{
- /* nop; nop */
- bfd_put_8 (output_bfd, 0x90, contents + roff);
+ /* xchg %ax,%ax */
+ bfd_put_8 (output_bfd, 0x66, contents + roff);
bfd_put_8 (output_bfd, 0x90, contents + roff + 1);
}
else
@@ -3872,6 +3776,18 @@ elf_i386_plt_sym_val (bfd_vma i, const asection *plt,
return plt->vma + (i + 1) * PLT_ENTRY_SIZE;
}
+/* Return TRUE if symbol should be hashed in the `.gnu.hash' section. */
+
+static bfd_boolean
+elf_i386_hash_symbol (struct elf_link_hash_entry *h)
+{
+ if (h->plt.offset != (bfd_vma) -1
+ && !h->def_regular
+ && !h->pointer_equality_needed)
+ return FALSE;
+
+ return _bfd_elf_hash_symbol (h);
+}
#define TARGET_LITTLE_SYM bfd_elf32_i386_vec
#define TARGET_LITTLE_NAME "elf32-i386"
@@ -3895,6 +3811,7 @@ elf_i386_plt_sym_val (bfd_vma i, const asection *plt,
#define bfd_elf32_bfd_is_local_label_name elf_i386_is_local_label_name
#define bfd_elf32_bfd_link_hash_table_create elf_i386_link_hash_table_create
#define bfd_elf32_bfd_reloc_type_lookup elf_i386_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup elf_i386_reloc_name_lookup
#define elf_backend_adjust_dynamic_symbol elf_i386_adjust_dynamic_symbol
#define elf_backend_check_relocs elf_i386_check_relocs
@@ -3911,7 +3828,10 @@ elf_i386_plt_sym_val (bfd_vma i, const asection *plt,
#define elf_backend_relocate_section elf_i386_relocate_section
#define elf_backend_size_dynamic_sections elf_i386_size_dynamic_sections
#define elf_backend_always_size_sections elf_i386_always_size_sections
+#define elf_backend_omit_section_dynsym \
+ ((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) bfd_true)
#define elf_backend_plt_sym_val elf_i386_plt_sym_val
+#define elf_backend_hash_symbol elf_i386_hash_symbol
#include "elf32-target.h"
@@ -3921,6 +3841,8 @@ elf_i386_plt_sym_val (bfd_vma i, const asection *plt,
#define TARGET_LITTLE_SYM bfd_elf32_i386_freebsd_vec
#undef TARGET_LITTLE_NAME
#define TARGET_LITTLE_NAME "elf32-i386-freebsd"
+#undef ELF_OSABI
+#define ELF_OSABI ELFOSABI_FREEBSD
/* The kernel recognizes executables as valid only if they carry a
"FreeBSD" label in the ELF header. So we put this label on all
@@ -3935,7 +3857,7 @@ elf_i386_post_process_headers (bfd *abfd,
i_ehdrp = elf_elfheader (abfd);
/* Put an ABI label supported by FreeBSD >= 4.1. */
- i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
+ i_ehdrp->e_ident[EI_OSABI] = get_elf_backend_data (abfd)->elf_osabi;
#ifdef OLD_FREEBSD_ABI_LABEL
/* The ABI label supported by FreeBSD <= 4.0 is quite nonstandard. */
memcpy (&i_ehdrp->e_ident[EI_ABIVERSION], "FreeBSD", 8);
@@ -3955,7 +3877,7 @@ elf_i386_post_process_headers (bfd *abfd,
#define TARGET_LITTLE_SYM bfd_elf32_i386_vxworks_vec
#undef TARGET_LITTLE_NAME
#define TARGET_LITTLE_NAME "elf32-i386-vxworks"
-
+#undef ELF_OSABI
/* Like elf_i386_link_hash_table_create but with tweaks for VxWorks. */
diff --git a/bfd/elf32-i860.c b/bfd/elf32-i860.c
index 453256018884..22cebeea6912 100644
--- a/bfd/elf32-i860.c
+++ b/bfd/elf32-i860.c
@@ -1,5 +1,5 @@
/* Intel i860 specific support for 32-bit ELF.
- Copyright 1993, 1995, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright 1993, 1995, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007
Free Software Foundation, Inc.
Full i860 support contributed by Jason Eckhardt <jle@cygnus.com>.
@@ -20,8 +20,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/i860.h"
@@ -886,6 +886,23 @@ elf32_i860_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return lookup_howto (rtype);
}
+static reloc_howto_type *
+elf32_i860_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (elf32_i860_howto_table)
+ / sizeof (elf32_i860_howto_table[0]));
+ i++)
+ if (elf32_i860_howto_table[i].name != NULL
+ && strcasecmp (elf32_i860_howto_table[i].name, r_name) == 0)
+ return &elf32_i860_howto_table[i];
+
+ return NULL;
+}
+
/* Given a ELF reloc, return the matching HOWTO structure. */
static void
elf32_i860_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED,
@@ -1066,9 +1083,6 @@ elf32_i860_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
- if (info->relocatable)
- return TRUE;
-
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
relend = relocs + input_section->reloc_count;
@@ -1113,6 +1127,20 @@ elf32_i860_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
unresolved_reloc, warned);
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
switch (r_type)
{
default:
@@ -1241,6 +1269,7 @@ elf32_i860_is_local_label_name (bfd *abfd, const char *name)
#define elf_info_to_howto elf32_i860_info_to_howto_rela
#define elf_backend_relocate_section elf32_i860_relocate_section
#define bfd_elf32_bfd_reloc_type_lookup elf32_i860_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup elf32_i860_reloc_name_lookup
#define bfd_elf32_bfd_is_local_label_name elf32_i860_is_local_label_name
#include "elf32-target.h"
diff --git a/bfd/elf32-i960.c b/bfd/elf32-i960.c
index f458320655b4..10e6e55aa872 100644
--- a/bfd/elf32-i960.c
+++ b/bfd/elf32-i960.c
@@ -1,5 +1,6 @@
/* Intel 960 specific support for 32-bit ELF
- Copyright 1999, 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002, 2003, 2005, 2007
+ Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +19,8 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/i960.h"
@@ -27,6 +28,8 @@
#define USE_REL 1
#define bfd_elf32_bfd_reloc_type_lookup elf32_i960_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup \
+ elf32_i960_reloc_name_lookup
#define elf_info_to_howto elf32_i960_info_to_howto
#define elf_info_to_howto_rel elf32_i960_info_to_howto_rel
@@ -142,6 +145,20 @@ elf32_i960_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return elf_howto_table + elf32_i960_bfd_to_reloc_type (code);
}
+static reloc_howto_type *
+elf32_i960_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0; i < sizeof (elf_howto_table) / sizeof (elf_howto_table[0]); i++)
+ if (elf_howto_table[i].name != NULL
+ && strcasecmp (elf_howto_table[i].name, r_name) == 0)
+ return &elf_howto_table[i];
+
+ return NULL;
+}
+
#define TARGET_LITTLE_SYM bfd_elf32_i960_vec
#define TARGET_LITTLE_NAME "elf32-i960"
#define ELF_ARCH bfd_arch_i960
diff --git a/bfd/elf32-ip2k.c b/bfd/elf32-ip2k.c
index 135ef1314ba5..1d61aa476797 100644
--- a/bfd/elf32-ip2k.c
+++ b/bfd/elf32-ip2k.c
@@ -1,5 +1,5 @@
/* Ubicom IP2xxx specific support for 32-bit ELF
- Copyright 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -19,8 +19,8 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/ip2k.h"
@@ -223,6 +223,21 @@ ip2k_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
return NULL;
}
+static reloc_howto_type *
+ip2k_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (ip2k_elf_howto_table) / sizeof (ip2k_elf_howto_table[0]);
+ i++)
+ if (ip2k_elf_howto_table[i].name != NULL
+ && strcasecmp (ip2k_elf_howto_table[i].name, r_name) == 0)
+ return &ip2k_elf_howto_table[i];
+
+ return NULL;
+}
+
static void
ip2k_get_mem (bfd *abfd ATTRIBUTE_UNUSED,
bfd_byte *addr,
@@ -1399,9 +1414,6 @@ ip2k_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
- if (info->relocatable)
- return TRUE;
-
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
relend = relocs + input_section->reloc_count;
@@ -1418,7 +1430,6 @@ ip2k_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
const char * name = NULL;
int r_type;
- /* This is a final link. */
r_type = ELF32_R_TYPE (rel->r_info);
r_symndx = ELF32_R_SYM (rel->r_info);
howto = ip2k_elf_howto_table + ELF32_R_TYPE (rel->r_info);
@@ -1449,6 +1460,20 @@ ip2k_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
name = h->root.root.string;
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
/* Finally, the sole IP2K-specific part. */
r = ip2k_final_link_relocate (howto, input_bfd, input_section,
contents, rel, relocation);
@@ -1502,53 +1527,6 @@ ip2k_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
return TRUE;
}
-static asection *
-ip2k_elf_gc_mark_hook (asection *sec,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
- Elf_Internal_Rela *rel,
- struct elf_link_hash_entry *h,
- Elf_Internal_Sym *sym)
-{
- if (h != NULL)
- {
- switch (ELF32_R_TYPE (rel->r_info))
- {
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- {
- if (!(elf_bad_symtab (sec->owner)
- && ELF_ST_BIND (sym->st_info) != STB_LOCAL)
- && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE)
- && sym->st_shndx != SHN_COMMON))
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
- }
- return NULL;
-}
-
-static bfd_boolean
-ip2k_elf_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
- asection *sec ATTRIBUTE_UNUSED,
- const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED)
-{
- /* We don't use got and plt entries for ip2k. */
- return TRUE;
-}
-
#define TARGET_BIG_SYM bfd_elf32_ip2k_vec
#define TARGET_BIG_NAME "elf32-ip2k"
@@ -1562,12 +1540,11 @@ ip2k_elf_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
#define elf_backend_can_gc_sections 1
#define elf_backend_rela_normal 1
-#define elf_backend_gc_mark_hook ip2k_elf_gc_mark_hook
-#define elf_backend_gc_sweep_hook ip2k_elf_gc_sweep_hook
#define elf_backend_relocate_section ip2k_elf_relocate_section
#define elf_symbol_leading_char '_'
#define bfd_elf32_bfd_reloc_type_lookup ip2k_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup ip2k_reloc_name_lookup
#define bfd_elf32_bfd_relax_section ip2k_elf_relax_section
#include "elf32-target.h"
diff --git a/bfd/elf32-iq2000.c b/bfd/elf32-iq2000.c
index 146dcaaecaf4..160c996e6041 100644
--- a/bfd/elf32-iq2000.c
+++ b/bfd/elf32-iq2000.c
@@ -1,5 +1,6 @@
/* IQ2000-specific support for 32-bit ELF.
- Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005, 2006, 2007
+ Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,8 +18,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/iq2000.h"
@@ -349,6 +350,26 @@ iq2000_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return NULL;
}
+static reloc_howto_type *
+iq2000_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (iq2000_elf_howto_table)
+ / sizeof (iq2000_elf_howto_table[0]));
+ i++)
+ if (iq2000_elf_howto_table[i].name != NULL
+ && strcasecmp (iq2000_elf_howto_table[i].name, r_name) == 0)
+ return &iq2000_elf_howto_table[i];
+
+ if (strcasecmp (iq2000_elf_vtinherit_howto.name, r_name) == 0)
+ return &iq2000_elf_vtinherit_howto;
+ if (strcasecmp (iq2000_elf_vtentry_howto.name, r_name) == 0)
+ return &iq2000_elf_vtentry_howto;
+
+ return NULL;
+}
/* Perform a single relocation. By default we use the standard BFD
routines. */
@@ -452,9 +473,9 @@ iq2000_elf_check_relocs (bfd *abfd,
case R_IQ2000_32:
/* For debug section, change to special harvard-aware relocations. */
- if (memcmp (sec->name, ".debug", 6) == 0
- || memcmp (sec->name, ".stab", 5) == 0
- || memcmp (sec->name, ".eh_frame", 9) == 0)
+ if (CONST_STRNEQ (sec->name, ".debug")
+ || CONST_STRNEQ (sec->name, ".stab")
+ || CONST_STRNEQ (sec->name, ".eh_frame"))
{
((Elf_Internal_Rela *) rel)->r_info
= ELF32_R_INFO (ELF32_R_SYM (rel->r_info), R_IQ2000_32_DEBUG);
@@ -521,9 +542,6 @@ iq2000_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED,
Elf_Internal_Rela * rel;
Elf_Internal_Rela * relend;
- if (info->relocatable)
- return TRUE;
-
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
relend = relocs + input_section->reloc_count;
@@ -548,7 +566,6 @@ iq2000_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED,
r_symndx = ELF32_R_SYM (rel->r_info);
- /* This is a final link. */
howto = iq2000_elf_howto_table + ELF32_R_TYPE (rel->r_info);
h = NULL;
sym = NULL;
@@ -579,6 +596,20 @@ iq2000_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED,
name = h->root.root.string;
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
switch (r_type)
{
case R_IQ2000_HI16:
@@ -642,53 +673,25 @@ iq2000_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED,
}
-/* Update the got entry reference counts for the section being
- removed. */
-
-static bfd_boolean
-iq2000_elf_gc_sweep_hook (bfd * abfd ATTRIBUTE_UNUSED,
- struct bfd_link_info * info ATTRIBUTE_UNUSED,
- asection * sec ATTRIBUTE_UNUSED,
- const Elf_Internal_Rela * relocs ATTRIBUTE_UNUSED)
-{
- return TRUE;
-}
-
/* Return the section that should be marked against GC for a given
relocation. */
static asection *
-iq2000_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)
+iq2000_elf_gc_mark_hook (asection *sec,
+ struct bfd_link_info *info,
+ Elf_Internal_Rela *rel,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
{
- if (h == NULL)
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
-
- switch (ELF32_R_TYPE (rel->r_info))
- {
- case R_IQ2000_GNU_VTINHERIT:
- case R_IQ2000_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
-
- return NULL;
+ if (h != NULL)
+ switch (ELF32_R_TYPE (rel->r_info))
+ {
+ case R_IQ2000_GNU_VTINHERIT:
+ case R_IQ2000_GNU_VTENTRY:
+ return NULL;
+ }
+
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
@@ -733,6 +736,10 @@ iq2000_elf_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
elf_flags_init (obfd) = TRUE;
+
+ /* Copy object attributes. */
+ _bfd_elf_copy_obj_attributes (ibfd, obfd);
+
return TRUE;
}
@@ -874,7 +881,6 @@ iq2000_elf_object_p (bfd *abfd)
#define elf_info_to_howto iq2000_info_to_howto_rela
#define elf_backend_relocate_section iq2000_elf_relocate_section
#define elf_backend_gc_mark_hook iq2000_elf_gc_mark_hook
-#define elf_backend_gc_sweep_hook iq2000_elf_gc_sweep_hook
#define elf_backend_check_relocs iq2000_elf_check_relocs
#define elf_backend_object_p iq2000_elf_object_p
#define elf_backend_rela_normal 1
@@ -882,6 +888,7 @@ iq2000_elf_object_p (bfd *abfd)
#define elf_backend_can_gc_sections 1
#define bfd_elf32_bfd_reloc_type_lookup iq2000_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup iq2000_reloc_name_lookup
#define bfd_elf32_bfd_set_private_flags iq2000_elf_set_private_flags
#define bfd_elf32_bfd_copy_private_bfd_data iq2000_elf_copy_private_bfd_data
#define bfd_elf32_bfd_merge_private_bfd_data iq2000_elf_merge_private_bfd_data
diff --git a/bfd/elf32-m32c.c b/bfd/elf32-m32c.c
index 5e9f3ab28a21..43499cec01c2 100644
--- a/bfd/elf32-m32c.c
+++ b/bfd/elf32-m32c.c
@@ -1,5 +1,5 @@
/* M16C/M32C specific support for 32-bit ELF.
- Copyright (C) 2005, 2006
+ Copyright (C) 2005, 2006, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@
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 "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/m32c.h"
@@ -32,15 +32,12 @@ static void m32c_info_to_howto_rela
(bfd *, arelent *, Elf_Internal_Rela *);
static bfd_boolean m32c_elf_relocate_section
(bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **);
-static bfd_boolean m32c_elf_gc_sweep_hook
- (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *);
-static asection * m32c_elf_gc_mark_hook
- (asection *, struct bfd_link_info *, Elf_Internal_Rela *, struct elf_link_hash_entry *, Elf_Internal_Sym *);
static bfd_boolean m32c_elf_check_relocs
(bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *);
static bfd_boolean m32c_elf_relax_delete_bytes (bfd *, asection *, bfd_vma, int);
#ifdef DEBUG
-static char * m32c_get_reloc (long reloc);
+char * m32c_get_reloc (long reloc);
+void dump_symtab (bfd *, void *, void *);
#endif
static bfd_boolean m32c_elf_relax_section
(bfd *abfd, asection *sec, struct bfd_link_info *link_info, bfd_boolean *again);
@@ -63,13 +60,16 @@ static reloc_howto_type m32c_elf_howto_table [] =
0, /* dst_mask */
FALSE), /* pcrel_offset */
+ /* GCC intentionally overflows these next two in order to work
+ around limitations in the addressing modes, so don't complain
+ about overflow. */
HOWTO (R_M32C_16, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_M32C_16", /* name */
FALSE, /* partial_inplace */
@@ -83,7 +83,7 @@ static reloc_howto_type m32c_elf_howto_table [] =
24, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_M32C_24", /* name */
FALSE, /* partial_inplace */
@@ -272,6 +272,21 @@ m32c_reloc_type_lookup
return NULL;
}
+static reloc_howto_type *
+m32c_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (m32c_elf_howto_table) / sizeof (m32c_elf_howto_table[0]);
+ i++)
+ if (m32c_elf_howto_table[i].name != NULL
+ && strcasecmp (m32c_elf_howto_table[i].name, r_name) == 0)
+ return &m32c_elf_howto_table[i];
+
+ return NULL;
+}
+
/* Set the howto pointer for an M32C ELF reloc. */
static void
@@ -372,31 +387,11 @@ m32c_elf_relocate_section
r_symndx = ELF32_R_SYM (rel->r_info);
- if (info->relocatable)
- {
- /* This is a relocatable link. We don't have to change
- anything, unless the reloc is against a section symbol,
- in which case we have to adjust according to where the
- section symbol winds up in the output section. */
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
-
- if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
- {
- sec = local_sections [r_symndx];
- rel->r_addend += sec->output_offset + sym->st_value;
- }
- }
-
- continue;
- }
-
- /* This is a final link. */
howto = m32c_elf_howto_table + ELF32_R_TYPE (rel->r_info);
h = NULL;
sym = NULL;
sec = NULL;
+ relocation = 0;
if (r_symndx < symtab_hdr->sh_info)
{
@@ -429,19 +424,38 @@ m32c_elf_relocate_section
+ sec->output_offset);
}
else if (h->root.type == bfd_link_hash_undefweak)
- {
- relocation = 0;
- }
- else
+ ;
+ else if (!info->relocatable)
{
if (! ((*info->callbacks->undefined_symbol)
(info, h->root.root.string, input_bfd,
input_section, rel->r_offset, TRUE)))
return FALSE;
- relocation = 0;
}
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ {
+ /* This is a relocatable link. We don't have to change
+ anything, unless the reloc is against a section symbol,
+ in which case we have to adjust according to where the
+ section symbol winds up in the output section. */
+ if (sym != NULL && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ rel->r_addend += sec->output_offset;
+ continue;
+ }
+
switch (ELF32_R_TYPE (rel->r_info))
{
case R_M32C_16:
@@ -571,62 +585,6 @@ m32c_elf_relocate_section
return TRUE;
}
-/* Return the section that should be marked against GC for a given
- relocation. */
-
-static asection *
-m32c_elf_gc_mark_hook
- (asection * sec,
- struct bfd_link_info * info ATTRIBUTE_UNUSED,
- Elf_Internal_Rela * rel,
- struct elf_link_hash_entry * h,
- Elf_Internal_Sym * sym)
-{
- if (h != NULL)
- {
- switch (ELF32_R_TYPE (rel->r_info))
- {
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- {
- if (!(elf_bad_symtab (sec->owner)
- && ELF_ST_BIND (sym->st_info) != STB_LOCAL)
- && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE)
- && sym->st_shndx != SHN_COMMON))
- {
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
- }
- }
-
- return NULL;
-}
-
-/* Update the got entry reference counts for the section being removed. */
-
-static bfd_boolean
-m32c_elf_gc_sweep_hook
- (bfd * abfd ATTRIBUTE_UNUSED,
- struct bfd_link_info * info ATTRIBUTE_UNUSED,
- asection * sec ATTRIBUTE_UNUSED,
- const Elf_Internal_Rela * relocs ATTRIBUTE_UNUSED)
-{
- return TRUE;
-}
-
/* We support 16-bit pointers to code above 64k by generating a thunk
below 64k containing a JMP instruction to the final address. */
@@ -690,16 +648,11 @@ m32c_elf_check_relocs
splt = bfd_get_section_by_name (dynobj, ".plt");
if (splt == NULL)
{
- splt = bfd_make_section (dynobj, ".plt");
+ flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY | SEC_LINKER_CREATED
+ | SEC_READONLY | SEC_CODE);
+ splt = bfd_make_section_with_flags (dynobj, ".plt", flags);
if (splt == NULL
- || ! bfd_set_section_flags (dynobj, splt,
- (SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_LINKER_CREATED
- | SEC_READONLY
- | SEC_CODE))
|| ! bfd_set_section_alignment (dynobj, splt, 1))
return FALSE;
}
@@ -936,7 +889,7 @@ m32c_elf_object_p (bfd *abfd)
#ifdef DEBUG
-static void
+void
dump_symtab (bfd * abfd, void *internal_syms, void *external_syms)
{
size_t locsymcount;
@@ -977,7 +930,6 @@ dump_symtab (bfd * abfd, void *internal_syms, void *external_syms)
{
case STT_FUNC: st_info_str = "STT_FUNC";
case STT_SECTION: st_info_str = "STT_SECTION";
- case STT_SRELC: st_info_str = "STT_SRELC";
case STT_FILE: st_info_str = "STT_FILE";
case STT_OBJECT: st_info_str = "STT_OBJECT";
case STT_TLS: st_info_str = "STT_TLS";
@@ -1022,7 +974,7 @@ dump_symtab (bfd * abfd, void *internal_syms, void *external_syms)
free (external_syms);
}
-static char *
+char *
m32c_get_reloc (long reloc)
{
if (0 <= reloc && reloc < R_M32C_max)
@@ -2055,8 +2007,6 @@ m32c_elf_relax_delete_bytes
#define elf_info_to_howto m32c_info_to_howto_rela
#define elf_backend_object_p m32c_elf_object_p
#define elf_backend_relocate_section m32c_elf_relocate_section
-#define elf_backend_gc_mark_hook m32c_elf_gc_mark_hook
-#define elf_backend_gc_sweep_hook m32c_elf_gc_sweep_hook
#define elf_backend_check_relocs m32c_elf_check_relocs
#define elf_backend_object_p m32c_elf_object_p
#define elf_symbol_leading_char ('_')
@@ -2068,6 +2018,7 @@ m32c_elf_relax_delete_bytes
#define elf_backend_can_gc_sections 1
#define bfd_elf32_bfd_reloc_type_lookup m32c_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup m32c_reloc_name_lookup
#define bfd_elf32_bfd_relax_section m32c_elf_relax_section
#define bfd_elf32_bfd_set_private_flags m32c_elf_set_private_flags
#define bfd_elf32_bfd_merge_private_bfd_data m32c_elf_merge_private_bfd_data
diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c
index 6c42c2f5b60d..31151fc1a47f 100644
--- a/bfd/elf32-m32r.c
+++ b/bfd/elf32-m32r.c
@@ -1,6 +1,6 @@
/* M32R-specific support for 32-bit ELF.
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- 2006 Free Software Foundation, Inc.
+ 2006, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/m32r.h"
@@ -1254,6 +1254,22 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return NULL;
}
+static reloc_howto_type *
+bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (m32r_elf_howto_table) / sizeof (m32r_elf_howto_table[0]);
+ i++)
+ if (m32r_elf_howto_table[i].name != NULL
+ && strcasecmp (m32r_elf_howto_table[i].name, r_name) == 0)
+ return &m32r_elf_howto_table[i];
+
+ return NULL;
+}
+
/* Set the howto pointer for an M32R ELF reloc. */
static void
@@ -1817,7 +1833,6 @@ m32r_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
struct elf_m32r_dyn_relocs *p;
bfd *dynobj;
asection *s;
- unsigned int power_of_two;
#ifdef DEBUG_PIC
printf ("m32r_elf_adjust_dynamic_symbol()\n");
@@ -1945,28 +1960,7 @@ m32r_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
h->needs_copy = 1;
}
- /* We need to figure out the alignment required for this symbol. I
- have no idea how ELF linkers handle this. */
- power_of_two = bfd_log2 (h->size);
- if (power_of_two > 3)
- power_of_two = 3;
-
- /* Apply the required alignment. */
- s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two));
- if (power_of_two > bfd_get_section_alignment (dynobj, s))
- {
- if (! bfd_set_section_alignment (dynobj, s, power_of_two))
- return FALSE;
- }
-
- /* Define the symbol as being at this point in the section. */
- h->root.u.def.section = s;
- h->root.u.def.value = s->size;
-
- /* Increment the section size to make room for the symbol. */
- s->size += h->size;
-
- return TRUE;
+ return _bfd_elf_adjust_dynamic_copy (h, s);
}
/* Allocate space in .plt, .got and associated reloc sections for
@@ -2309,7 +2303,7 @@ m32r_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
/* Strip this section if we don't need it; see the
comment below. */
}
- else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0)
+ else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela"))
{
if (s->size != 0 && s != htab->srelplt)
relocs = TRUE;
@@ -2477,6 +2471,7 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
`r_addend'. */
bfd_vma addend = rel->r_addend;
bfd_vma offset = rel->r_offset;
+ bfd_vma relocation;
Elf_Internal_Sym *sym;
asection *sec;
const char *sym_name;
@@ -2509,27 +2504,152 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
howto = m32r_elf_howto_table + r_type;
r_symndx = ELF32_R_SYM (rel->r_info);
- if (info->relocatable && use_rel)
+ sym = NULL;
+ sec = NULL;
+ h = NULL;
+
+ if (r_symndx < symtab_hdr->sh_info)
+ {
+ /* Local symbol. */
+ sym = local_syms + r_symndx;
+ sec = local_sections[r_symndx];
+ sym_name = "<local symbol>";
+
+ if (!use_rel)
+ {
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
+ addend = rel->r_addend;
+ }
+ else
+ {
+ relocation = (sec->output_section->vma
+ + sec->output_offset
+ + sym->st_value);
+ }
+ }
+ else
+ {
+ /* External symbol. */
+ relocation = 0;
+
+ 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;
+ sym_name = h->root.root.string;
+
+ if (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ {
+ bfd_boolean dyn;
+ sec = h->root.u.def.section;
+
+ dyn = htab->root.dynamic_sections_created;
+ sec = h->root.u.def.section;
+ if (r_type == R_M32R_GOTPC24
+ || (r_type == R_M32R_GOTPC_HI_ULO
+ || r_type == R_M32R_GOTPC_HI_SLO
+ || r_type == R_M32R_GOTPC_LO)
+ || (r_type == R_M32R_26_PLTREL
+ && h->plt.offset != (bfd_vma) -1)
+ || ((r_type == R_M32R_GOT24
+ || r_type == R_M32R_GOT16_HI_ULO
+ || r_type == R_M32R_GOT16_HI_SLO
+ || r_type == R_M32R_GOT16_LO)
+ && WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
+ info->shared, h)
+ && (! info->shared
+ || (! info->symbolic && h->dynindx != -1)
+ || !h->def_regular))
+ || (info->shared
+ && ((! info->symbolic && h->dynindx != -1)
+ || !h->def_regular)
+ && (((r_type == R_M32R_16_RELA
+ || r_type == R_M32R_32_RELA
+ || r_type == R_M32R_24_RELA
+ || r_type == R_M32R_HI16_ULO_RELA
+ || r_type == R_M32R_HI16_SLO_RELA
+ || r_type == R_M32R_LO16_RELA)
+ && !h->forced_local)
+ || r_type == R_M32R_REL32
+ || r_type == R_M32R_10_PCREL_RELA
+ || r_type == R_M32R_18_PCREL_RELA
+ || r_type == R_M32R_26_PCREL_RELA)
+ && ((input_section->flags & SEC_ALLOC) != 0
+ /* DWARF will emit R_M32R_16(24,32) relocations
+ in its sections against symbols defined
+ externally in shared libraries. We can't do
+ anything with them here. */
+ || ((input_section->flags & SEC_DEBUGGING) != 0
+ && h->def_dynamic))))
+ {
+ /* In these cases, we don't need the relocation
+ value. We check specially because in some
+ obscure cases sec->output_section will be NULL. */
+ }
+ else if (sec->output_section != NULL)
+ relocation = (h->root.u.def.value
+ + sec->output_section->vma
+ + sec->output_offset);
+ else if (!info->relocatable)
+ {
+ (*_bfd_error_handler)
+ (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
+ input_bfd,
+ input_section,
+ (long) rel->r_offset,
+ howto->name,
+ h->root.root.string);
+ }
+ }
+ 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 if (!info->relocatable)
+ {
+ if (! ((*info->callbacks->undefined_symbol)
+ (info, h->root.root.string, input_bfd,
+ input_section, offset,
+ (info->unresolved_syms_in_objects == RM_GENERATE_ERROR
+ || ELF_ST_VISIBILITY (h->other)))))
+ return FALSE;
+ }
+ }
+
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable && !use_rel)
{
/* 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. */
- sec = NULL;
- if (r_symndx >= symtab_hdr->sh_info)
- /* External symbol. */
- continue;
+ if (sym != NULL && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ rel->r_addend += sec->output_offset;
+ continue;
+ }
- /* Local symbol. */
- sym = local_syms + r_symndx;
- sym_name = "<local symbol>";
- /* STT_SECTION: symbol is associated with a section. */
- if (ELF_ST_TYPE (sym->st_info) != STT_SECTION)
- /* Symbol isn't associated with a section. Nothing to do. */
+ if (info->relocatable && use_rel)
+ {
+ /* This is a relocatable link. We don't have to change
+ anything, unless the reloc is against a section symbol,
+ in which case we have to adjust according to where the
+ section symbol winds up in the output section. */
+ if (sym == NULL || ELF_ST_TYPE (sym->st_info) != STT_SECTION)
continue;
- sec = local_sections[r_symndx];
- addend += sec->output_offset + sym->st_value;
+ addend += sec->output_offset;
/* If partial_inplace, we need to store any additional addend
back in the section. */
@@ -2567,140 +2687,6 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
}
else
{
- bfd_vma relocation;
-
- /* This is a final link. */
- sym = NULL;
- sec = NULL;
- h = NULL;
-
- if (r_symndx < symtab_hdr->sh_info)
- {
- /* Local symbol. */
- sym = local_syms + r_symndx;
- sec = local_sections[r_symndx];
- sym_name = "<local symbol>";
-
- if (!use_rel)
- {
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
- addend = rel->r_addend;
-
- if (info->relocatable)
- {
- /* This is a relocatable link. We don't have to change
- anything, unless the reloc is against a section symbol,
- in which case we have to adjust according to where the
- section symbol winds up in the output section. */
- if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
- rel->r_addend += sec->output_offset + sym->st_value;
-
- continue;
- }
- }
- else
- {
- relocation = (sec->output_section->vma
- + sec->output_offset
- + sym->st_value);
- }
- }
- else
- {
- /* External symbol. */
- if (info->relocatable && !use_rel)
- continue;
-
- 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;
- sym_name = h->root.root.string;
-
- if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- {
- bfd_boolean dyn;
- sec = h->root.u.def.section;
-
- dyn = htab->root.dynamic_sections_created;
- sec = h->root.u.def.section;
- if (r_type == R_M32R_GOTPC24
- || (r_type == R_M32R_GOTPC_HI_ULO
- || r_type == R_M32R_GOTPC_HI_SLO
- || r_type == R_M32R_GOTPC_LO)
- || (r_type == R_M32R_26_PLTREL
- && h->plt.offset != (bfd_vma) -1)
- || ((r_type == R_M32R_GOT24
- || r_type == R_M32R_GOT16_HI_ULO
- || r_type == R_M32R_GOT16_HI_SLO
- || r_type == R_M32R_GOT16_LO)
- && WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
- info->shared, h)
- && (! info->shared
- || (! info->symbolic && h->dynindx != -1)
- || !h->def_regular))
- || (info->shared
- && ((! info->symbolic && h->dynindx != -1)
- || !h->def_regular)
- && (((r_type == R_M32R_16_RELA
- || r_type == R_M32R_32_RELA
- || r_type == R_M32R_24_RELA
- || r_type == R_M32R_HI16_ULO_RELA
- || r_type == R_M32R_HI16_SLO_RELA
- || r_type == R_M32R_LO16_RELA)
- && !h->forced_local)
- || r_type == R_M32R_REL32
- || r_type == R_M32R_10_PCREL_RELA
- || r_type == R_M32R_18_PCREL_RELA
- || r_type == R_M32R_26_PCREL_RELA)
- && ((input_section->flags & SEC_ALLOC) != 0
- /* DWARF will emit R_M32R_16(24,32) relocations
- in its sections against symbols defined
- externally in shared libraries. We can't do
- anything with them here. */
- || ((input_section->flags & SEC_DEBUGGING) != 0
- && h->def_dynamic))))
- {
- /* 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_error_handler)
- (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
- input_bfd,
- input_section,
- (long) rel->r_offset,
- howto->name,
- h->root.root.string);
-
- 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->unresolved_syms_in_objects == RM_IGNORE
- && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
- relocation = 0;
- else
- {
- if (! ((*info->callbacks->undefined_symbol)
- (info, h->root.root.string, input_bfd,
- input_section, offset,
- (info->unresolved_syms_in_objects == RM_GENERATE_ERROR
- || ELF_ST_VISIBILITY (h->other)))))
- return FALSE;
- relocation = 0;
- }
- }
-
/* Sanity check the address. */
if (offset > high_address)
{
@@ -2933,7 +2919,7 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (input_bfd,
input_section),
name + 5) == 0);
@@ -3637,40 +3623,22 @@ m32r_elf_print_private_bfd_data (bfd *abfd, void * ptr)
static asection *
m32r_elf_gc_mark_hook (asection *sec,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info,
Elf_Internal_Rela *rel,
struct elf_link_hash_entry *h,
Elf_Internal_Sym *sym)
{
if (h != NULL)
- {
- switch (ELF32_R_TYPE (rel->r_info))
+ switch (ELF32_R_TYPE (rel->r_info))
{
case R_M32R_GNU_VTINHERIT:
case R_M32R_GNU_VTENTRY:
case R_M32R_RELA_GNU_VTINHERIT:
case R_M32R_RELA_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
+ return NULL;
+ }
- return NULL;
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
static bfd_boolean
@@ -3990,7 +3958,7 @@ m32r_elf_check_relocs (bfd *abfd,
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (abfd, sec),
name + 5) == 0);
@@ -4082,9 +4050,9 @@ m32r_elf_check_relocs (bfd *abfd,
static const struct bfd_elf_special_section m32r_elf_special_sections[] =
{
- { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
- { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".sbss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".sdata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { NULL, 0, 0, 0, 0 }
};
static bfd_boolean
@@ -4159,6 +4127,8 @@ m32r_elf_reloc_type_class (const Elf_Internal_Rela *rela)
#define elf_backend_create_dynamic_sections m32r_elf_create_dynamic_sections
#define bfd_elf32_bfd_link_hash_table_create m32r_elf_link_hash_table_create
#define elf_backend_size_dynamic_sections m32r_elf_size_dynamic_sections
+#define elf_backend_omit_section_dynsym \
+ ((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) bfd_true)
#define elf_backend_finish_dynamic_sections m32r_elf_finish_dynamic_sections
#define elf_backend_adjust_dynamic_symbol m32r_elf_adjust_dynamic_symbol
#define elf_backend_finish_dynamic_symbol m32r_elf_finish_dynamic_symbol
diff --git a/bfd/elf32-m68hc11.c b/bfd/elf32-m68hc11.c
index d61590ff4861..00253978df0b 100644
--- a/bfd/elf32-m68hc11.c
+++ b/bfd/elf32-m68hc11.c
@@ -1,5 +1,5 @@
/* Motorola 68HC11-specific support for 32-bit ELF
- Copyright 1999, 2000, 2001, 2002, 2003, 2004
+ Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Contributed by Stephane Carrez (stcarrez@nerim.fr)
(Heavily copied from the D10V port by Martin Hunt (hunt@cygnus.com))
@@ -20,8 +20,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -358,6 +358,23 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return NULL;
}
+static reloc_howto_type *
+bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (elf_m68hc11_howto_table)
+ / sizeof (elf_m68hc11_howto_table[0]));
+ i++)
+ if (elf_m68hc11_howto_table[i].name != NULL
+ && strcasecmp (elf_m68hc11_howto_table[i].name, r_name) == 0)
+ return &elf_m68hc11_howto_table[i];
+
+ return NULL;
+}
+
/* Set the howto pointer for an M68HC11 ELF reloc. */
static void
@@ -1259,11 +1276,11 @@ m68hc11_elf_relax_delete_bytes (bfd *abfd, asection *sec,
vectors. */
static const struct bfd_elf_special_section elf32_m68hc11_special_sections[] =
{
- { ".eeprom", 7, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".page0", 6, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".softregs", 9, 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
- { ".vectors", 8, 0, SHT_PROGBITS, SHF_ALLOC },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".eeprom"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".page0"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".softregs"), 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".vectors"), 0, SHT_PROGBITS, SHF_ALLOC },
+ { NULL, 0, 0, 0, 0 }
};
#define ELF_ARCH bfd_arch_m68hc11
@@ -1276,8 +1293,6 @@ static const struct bfd_elf_special_section elf32_m68hc11_special_sections[] =
#define elf_info_to_howto 0
#define elf_info_to_howto_rel m68hc11_info_to_howto_rel
#define bfd_elf32_bfd_relax_section m68hc11_elf_relax_section
-#define elf_backend_gc_mark_hook elf32_m68hc11_gc_mark_hook
-#define elf_backend_gc_sweep_hook elf32_m68hc11_gc_sweep_hook
#define elf_backend_check_relocs elf32_m68hc11_check_relocs
#define elf_backend_relocate_section elf32_m68hc11_relocate_section
#define elf_backend_add_symbol_hook elf32_m68hc11_add_symbol_hook
diff --git a/bfd/elf32-m68hc12.c b/bfd/elf32-m68hc12.c
index b52f3fff853f..fca2d659e2a9 100644
--- a/bfd/elf32-m68hc12.c
+++ b/bfd/elf32-m68hc12.c
@@ -1,5 +1,6 @@
/* Motorola 68HC12-specific support for 32-bit ELF
- Copyright 1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007
+ Free Software Foundation, Inc.
Contributed by Stephane Carrez (stcarrez@nerim.fr)
(Heavily copied from the D10V port by Martin Hunt (hunt@cygnus.com))
@@ -19,8 +20,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -406,6 +407,23 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return NULL;
}
+static reloc_howto_type *
+bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (elf_m68hc11_howto_table)
+ / sizeof (elf_m68hc11_howto_table[0]));
+ i++)
+ if (elf_m68hc11_howto_table[i].name != NULL
+ && strcasecmp (elf_m68hc11_howto_table[i].name, r_name) == 0)
+ return &elf_m68hc11_howto_table[i];
+
+ return NULL;
+}
+
/* Set the howto pointer for an M68HC11 ELF reloc. */
static void
@@ -537,11 +555,11 @@ m68hc12_elf_set_mach_from_flags (bfd *abfd)
vectors. */
static const struct bfd_elf_special_section elf32_m68hc12_special_sections[] =
{
- { ".eeprom", 7, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".page0", 6, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".softregs", 9, 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
- { ".vectors", 8, 0, SHT_PROGBITS, SHF_ALLOC },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".eeprom"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".page0"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".softregs"), 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".vectors"), 0, SHT_PROGBITS, SHF_ALLOC },
+ { NULL, 0, 0, 0, 0 }
};
#define ELF_ARCH bfd_arch_m68hc12
@@ -553,8 +571,6 @@ static const struct bfd_elf_special_section elf32_m68hc12_special_sections[] =
#define elf_info_to_howto 0
#define elf_info_to_howto_rel m68hc11_info_to_howto_rel
-#define elf_backend_gc_mark_hook elf32_m68hc11_gc_mark_hook
-#define elf_backend_gc_sweep_hook elf32_m68hc11_gc_sweep_hook
#define elf_backend_check_relocs elf32_m68hc11_check_relocs
#define elf_backend_relocate_section elf32_m68hc11_relocate_section
#define elf_backend_object_p m68hc12_elf_set_mach_from_flags
diff --git a/bfd/elf32-m68hc1x.c b/bfd/elf32-m68hc1x.c
index e7fb944b26b3..84e3b6e43a3c 100644
--- a/bfd/elf32-m68hc1x.c
+++ b/bfd/elf32-m68hc1x.c
@@ -1,5 +1,5 @@
/* Motorola 68HC11/HC12-specific support for 32-bit ELF
- Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Contributed by Stephane Carrez (stcarrez@nerim.fr)
@@ -19,8 +19,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -810,48 +810,6 @@ m68hc11_elf_special_reloc (bfd *abfd ATTRIBUTE_UNUSED,
abort();
}
-asection *
-elf32_m68hc11_gc_mark_hook (asection *sec,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
- Elf_Internal_Rela *rel,
- struct elf_link_hash_entry *h,
- Elf_Internal_Sym *sym)
-{
- if (h != NULL)
- {
- switch (ELF32_R_TYPE (rel->r_info))
- {
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
-
- return NULL;
-}
-
-bfd_boolean
-elf32_m68hc11_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
- asection *sec ATTRIBUTE_UNUSED,
- const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED)
-{
- /* We don't use got and plt entries for 68hc11/68hc12. */
- return TRUE;
-}
-
/* Look through the relocs for a section during the first phase.
Since we don't do .gots or .plts, we just need to consider the
virtual table relocs for gc. */
@@ -915,86 +873,6 @@ elf32_m68hc11_check_relocs (bfd *abfd, struct bfd_link_info *info,
return TRUE;
}
-static bfd_boolean
-m68hc11_get_relocation_value (bfd *input_bfd, struct bfd_link_info *info,
- asection *input_section,
- asection **local_sections,
- Elf_Internal_Sym *local_syms,
- Elf_Internal_Rela *rel,
- const char **name,
- bfd_vma *relocation, bfd_boolean *is_far)
-{
- Elf_Internal_Shdr *symtab_hdr;
- struct elf_link_hash_entry **sym_hashes;
- unsigned long r_symndx;
- asection *sec;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
- const char* stub_name = 0;
-
- symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
- sym_hashes = elf_sym_hashes (input_bfd);
-
- r_symndx = ELF32_R_SYM (rel->r_info);
-
- /* This is a final link. */
- h = NULL;
- sym = NULL;
- sec = NULL;
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
- sec = local_sections[r_symndx];
- *relocation = (sec->output_section->vma
- + sec->output_offset
- + sym->st_value);
- *is_far = (sym && (sym->st_other & STO_M68HC12_FAR));
- if (*is_far)
- stub_name = (bfd_elf_string_from_elf_section
- (input_bfd, symtab_hdr->sh_link,
- sym->st_name));
- }
- else
- {
- bfd_boolean unresolved_reloc, warned;
-
- RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
- r_symndx, symtab_hdr, sym_hashes,
- h, sec, *relocation, unresolved_reloc, warned);
-
- *is_far = (h && (h->other & STO_M68HC12_FAR));
- stub_name = h->root.root.string;
- }
-
- if (h != NULL)
- *name = h->root.root.string;
- else
- {
- *name = (bfd_elf_string_from_elf_section
- (input_bfd, symtab_hdr->sh_link, sym->st_name));
- if (*name == NULL || **name == '\0')
- *name = bfd_section_name (input_bfd, sec);
- }
-
- if (*is_far && ELF32_R_TYPE (rel->r_info) == R_M68HC11_16)
- {
- struct elf32_m68hc11_stub_hash_entry* stub;
- struct m68hc11_elf_link_hash_table *htab;
-
- htab = m68hc11_elf_hash_table (info);
- stub = m68hc12_stub_hash_lookup (htab->stub_hash_table,
- *name, FALSE, FALSE);
- if (stub)
- {
- *relocation = stub->stub_offset
- + stub->stub_sec->output_section->vma
- + stub->stub_sec->output_offset;
- *is_far = FALSE;
- }
- }
- return TRUE;
-}
-
/* Relocate a 68hc11/68hc12 ELF section. */
bfd_boolean
elf32_m68hc11_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
@@ -1035,6 +913,8 @@ elf32_m68hc11_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
bfd_vma insn_addr;
bfd_vma insn_page;
bfd_boolean is_far = FALSE;
+ struct elf_link_hash_entry *h;
+ const char* stub_name = 0;
r_symndx = ELF32_R_SYM (rel->r_info);
r_type = ELF32_R_TYPE (rel->r_info);
@@ -1043,30 +923,86 @@ elf32_m68hc11_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|| r_type == R_M68HC11_GNU_VTINHERIT )
continue;
+ (*ebd->elf_info_to_howto_rel) (input_bfd, &arel, rel);
+ howto = arel.howto;
+
+ h = NULL;
+ sym = NULL;
+ sec = NULL;
+ if (r_symndx < symtab_hdr->sh_info)
+ {
+ sym = local_syms + r_symndx;
+ sec = local_sections[r_symndx];
+ relocation = (sec->output_section->vma
+ + sec->output_offset
+ + sym->st_value);
+ is_far = (sym && (sym->st_other & STO_M68HC12_FAR));
+ if (is_far)
+ stub_name = (bfd_elf_string_from_elf_section
+ (input_bfd, symtab_hdr->sh_link,
+ sym->st_name));
+ }
+ else
+ {
+ bfd_boolean unresolved_reloc, warned;
+
+ RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
+ r_symndx, symtab_hdr, sym_hashes,
+ h, sec, relocation, unresolved_reloc,
+ warned);
+
+ is_far = (h && (h->other & STO_M68HC12_FAR));
+ stub_name = h->root.root.string;
+ }
+
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
if (info->relocatable)
{
/* This is a relocatable link. We don't have to change
anything, unless the reloc is against a section symbol,
in which case we have to adjust according to where the
section symbol winds up in the output section. */
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
- if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
- {
- sec = local_sections[r_symndx];
- rel->r_addend += sec->output_offset + sym->st_value;
- }
- }
-
+ if (sym != NULL && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ rel->r_addend += sec->output_offset;
continue;
}
- (*ebd->elf_info_to_howto_rel) (input_bfd, &arel, rel);
- howto = arel.howto;
- m68hc11_get_relocation_value (input_bfd, info, input_section,
- local_sections, local_syms,
- rel, &name, &relocation, &is_far);
+ if (h != NULL)
+ name = h->root.root.string;
+ else
+ {
+ name = (bfd_elf_string_from_elf_section
+ (input_bfd, symtab_hdr->sh_link, sym->st_name));
+ if (name == NULL || *name == '\0')
+ name = bfd_section_name (input_bfd, sec);
+ }
+
+ if (is_far && ELF32_R_TYPE (rel->r_info) == R_M68HC11_16)
+ {
+ struct elf32_m68hc11_stub_hash_entry* stub;
+ struct m68hc11_elf_link_hash_table *htab;
+
+ htab = m68hc11_elf_hash_table (info);
+ stub = m68hc12_stub_hash_lookup (htab->stub_hash_table,
+ name, FALSE, FALSE);
+ if (stub)
+ {
+ relocation = stub->stub_offset
+ + stub->stub_sec->output_section->vma
+ + stub->stub_sec->output_offset;
+ is_far = FALSE;
+ }
+ }
/* Do the memory bank mapping. */
phys_addr = m68hc11_phys_addr (pinfo, relocation + rel->r_addend);
diff --git a/bfd/elf32-m68hc1x.h b/bfd/elf32-m68hc1x.h
index 402ae3e68b87..7cae2e8db7a3 100644
--- a/bfd/elf32-m68hc1x.h
+++ b/bfd/elf32-m68hc1x.h
@@ -1,5 +1,5 @@
/* Motorola 68HC11/68HC12-specific support for 32-bit ELF
- Copyright 2003, 2004 Free Software Foundation, Inc.
+ Copyright 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Contributed by Stephane Carrez (stcarrez@nerim.fr)
This file is part of BFD, the Binary File Descriptor library.
@@ -159,14 +159,6 @@ bfd_reloc_status_type m68hc11_elf_special_reloc
asymbol *symbol, void *data, asection *input_section,
bfd *output_bfd, char **error_message);
-/* GC mark and sweep. */
-asection *elf32_m68hc11_gc_mark_hook
- (asection *sec, struct bfd_link_info *info,
- Elf_Internal_Rela *rel, struct elf_link_hash_entry *h,
- Elf_Internal_Sym *sym);
-bfd_boolean elf32_m68hc11_gc_sweep_hook
- (bfd *abfd, struct bfd_link_info *info,
- asection *sec, const Elf_Internal_Rela *relocs);
bfd_boolean elf32_m68hc11_check_relocs
(bfd * abfd, struct bfd_link_info * info,
asection * sec, const Elf_Internal_Rela * relocs);
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c
index df988a849663..82fad32fdd2a 100644
--- a/bfd/elf32-m68k.c
+++ b/bfd/elf32-m68k.c
@@ -1,6 +1,6 @@
/* Motorola 68k series support for 32-bit ELF
Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005, 2006 Free Software Foundation, Inc.
+ 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -37,12 +37,6 @@ static struct bfd_link_hash_table *elf_m68k_link_hash_table_create
static bfd_boolean elf_m68k_check_relocs
PARAMS ((bfd *, struct bfd_link_info *, asection *,
const Elf_Internal_Rela *));
-static asection *elf_m68k_gc_mark_hook
- PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *, Elf_Internal_Sym *));
-static bfd_boolean elf_m68k_gc_sweep_hook
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- const Elf_Internal_Rela *));
static bfd_boolean elf_m68k_adjust_dynamic_symbol
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
static bfd_boolean elf_m68k_size_dynamic_sections
@@ -180,7 +174,21 @@ reloc_type_lookup (abfd, code)
return 0;
}
+static reloc_howto_type *
+reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0; i < sizeof (howto_table) / sizeof (howto_table[0]); i++)
+ if (howto_table[i].name != NULL
+ && strcasecmp (howto_table[i].name, r_name) == 0)
+ return &howto_table[i];
+
+ return NULL;
+}
+
#define bfd_elf32_bfd_reloc_type_lookup reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup reloc_name_lookup
#define ELF_ARCH bfd_arch_m68k
/* Functions for the m68k ELF linker. */
@@ -190,6 +198,40 @@ reloc_type_lookup (abfd, code)
#define ELF_DYNAMIC_INTERPRETER "/usr/lib/libc.so.1"
+/* Describes one of the various PLT styles. */
+
+struct elf_m68k_plt_info
+{
+ /* The size of each PLT entry. */
+ bfd_vma size;
+
+ /* The template for the first PLT entry. */
+ const bfd_byte *plt0_entry;
+
+ /* Offsets of fields in PLT0_ENTRY that require R_68K_PC32 relocations.
+ The comments by each member indicate the value that the relocation
+ is against. */
+ struct {
+ unsigned int got4; /* .got + 4 */
+ unsigned int got8; /* .got + 8 */
+ } plt0_relocs;
+
+ /* The template for a symbol's PLT entry. */
+ const bfd_byte *symbol_entry;
+
+ /* Offsets of fields in SYMBOL_ENTRY that require R_68K_PC32 relocations.
+ The comments by each member indicate the value that the relocation
+ is against. */
+ struct {
+ unsigned int got; /* the symbol's .got.plt entry */
+ unsigned int plt; /* .plt */
+ } symbol_relocs;
+
+ /* The offset of the resolver stub from the start of SYMBOL_ENTRY.
+ The stub starts with "move.l #relocoffset,%d0". */
+ bfd_vma symbol_resolve_entry;
+};
+
/* The size in bytes of an entry in the procedure linkage table. */
#define PLT_ENTRY_SIZE 20
@@ -200,9 +242,9 @@ reloc_type_lookup (abfd, code)
static const bfd_byte elf_m68k_plt0_entry[PLT_ENTRY_SIZE] =
{
0x2f, 0x3b, 0x01, 0x70, /* move.l (%pc,addr),-(%sp) */
- 0, 0, 0, 0, /* replaced with offset to .got + 4. */
+ 0, 0, 0, 2, /* + (.got + 4) - . */
0x4e, 0xfb, 0x01, 0x71, /* jmp ([%pc,addr]) */
- 0, 0, 0, 0, /* replaced with offset to .got + 8. */
+ 0, 0, 0, 2, /* + (.got + 8) - . */
0, 0, 0, 0 /* pad out to 20 bytes. */
};
@@ -211,71 +253,118 @@ static const bfd_byte elf_m68k_plt0_entry[PLT_ENTRY_SIZE] =
static const bfd_byte elf_m68k_plt_entry[PLT_ENTRY_SIZE] =
{
0x4e, 0xfb, 0x01, 0x71, /* jmp ([%pc,symbol@GOTPC]) */
- 0, 0, 0, 0, /* replaced with offset to symbol's .got entry. */
+ 0, 0, 0, 2, /* + (.got.plt entry) - . */
0x2f, 0x3c, /* move.l #offset,-(%sp) */
- 0, 0, 0, 0, /* replaced with offset into relocation table. */
+ 0, 0, 0, 0, /* + reloc index */
0x60, 0xff, /* bra.l .plt */
- 0, 0, 0, 0 /* replaced with offset to start of .plt. */
+ 0, 0, 0, 0 /* + .plt - . */
};
+static const struct elf_m68k_plt_info elf_m68k_plt_info = {
+ PLT_ENTRY_SIZE,
+ elf_m68k_plt0_entry, { 4, 12 },
+ elf_m68k_plt_entry, { 4, 16 }, 8
+};
-#define CFV4E_PLT_ENTRY_SIZE 24
-
-#define CFV4E_FLAG(abfd) (elf_elfheader (abfd)->e_flags & EF_M68K_CFV4E)
+#define ISAB_PLT_ENTRY_SIZE 24
-static const bfd_byte elf_cfv4e_plt0_entry[CFV4E_PLT_ENTRY_SIZE] =
+static const bfd_byte elf_isab_plt0_entry[ISAB_PLT_ENTRY_SIZE] =
{
- 0x20, 0x3c,
- 0, 0, 0, 0, /* Replaced with offset to .got + 4. */
- 0x2f, 0x3b, 0x08, 0xfa, /* move.l (%pc,addr),-(%sp) */
- 0x20, 0x3c,
- 0, 0, 0, 0, /* Replaced with offset to .got + 8. */
- 0x20, 0x7b, 0x08, 0x00, /* move.l (%pc,%d0:l), %a0 */
+ 0x20, 0x3c, /* move.l #offset,%d0 */
+ 0, 0, 0, 0, /* + (.got + 4) - . */
+ 0x2f, 0x3b, 0x08, 0xfa, /* move.l (-6,%pc,%d0:l),-(%sp) */
+ 0x20, 0x3c, /* move.l #offset,%d0 */
+ 0, 0, 0, 0, /* + (.got + 8) - . */
+ 0x20, 0x7b, 0x08, 0xfa, /* move.l (-6,%pc,%d0:l), %a0 */
0x4e, 0xd0, /* jmp (%a0) */
0x4e, 0x71 /* nop */
};
/* Subsequent entries in a procedure linkage table look like this. */
-static const bfd_byte elf_cfv4e_plt_entry[CFV4E_PLT_ENTRY_SIZE] =
+static const bfd_byte elf_isab_plt_entry[ISAB_PLT_ENTRY_SIZE] =
{
- 0x20, 0x3c,
- 0, 0, 0, 0, /* Replaced with offset to symbol's .got entry. */
- 0x20, 0x7b, 0x08, 0x00, /* move.l (%pc,%d0:l), %a0 */
+ 0x20, 0x3c, /* move.l #offset,%d0 */
+ 0, 0, 0, 0, /* + (.got.plt entry) - . */
+ 0x20, 0x7b, 0x08, 0xfa, /* move.l (-6,%pc,%d0:l), %a0 */
0x4e, 0xd0, /* jmp (%a0) */
0x2f, 0x3c, /* move.l #offset,-(%sp) */
- 0, 0, 0, 0, /* Replaced with offset into relocation table. */
+ 0, 0, 0, 0, /* + reloc index */
0x60, 0xff, /* bra.l .plt */
- 0, 0, 0, 0 /* Replaced with offset to start of .plt. */
+ 0, 0, 0, 0 /* + .plt - . */
};
-#define CPU32_FLAG(abfd) (elf_elfheader (abfd)->e_flags & EF_M68K_CPU32)
+static const struct elf_m68k_plt_info elf_isab_plt_info = {
+ ISAB_PLT_ENTRY_SIZE,
+ elf_isab_plt0_entry, { 2, 12 },
+ elf_isab_plt_entry, { 2, 20 }, 12
+};
-#define PLT_CPU32_ENTRY_SIZE 24
+#define ISAC_PLT_ENTRY_SIZE 24
+
+static const bfd_byte elf_isac_plt0_entry[ISAC_PLT_ENTRY_SIZE] =
+{
+ 0x20, 0x3c, /* move.l #offset,%d0 */
+ 0, 0, 0, 0, /* replaced with .got + 4 - . */
+ 0x2e, 0xbb, 0x08, 0xfa, /* move.l (-6,%pc,%d0:l),(%sp) */
+ 0x20, 0x3c, /* move.l #offset,%d0 */
+ 0, 0, 0, 0, /* replaced with .got + 8 - . */
+ 0x20, 0x7b, 0x08, 0xfa, /* move.l (-6,%pc,%d0:l), %a0 */
+ 0x4e, 0xd0, /* jmp (%a0) */
+ 0x4e, 0x71 /* nop */
+};
+
+/* Subsequent entries in a procedure linkage table look like this. */
+
+static const bfd_byte elf_isac_plt_entry[ISAC_PLT_ENTRY_SIZE] =
+{
+ 0x20, 0x3c, /* move.l #offset,%d0 */
+ 0, 0, 0, 0, /* replaced with (.got entry) - . */
+ 0x20, 0x7b, 0x08, 0xfa, /* move.l (-6,%pc,%d0:l), %a0 */
+ 0x4e, 0xd0, /* jmp (%a0) */
+ 0x2f, 0x3c, /* move.l #offset,-(%sp) */
+ 0, 0, 0, 0, /* replaced with offset into relocation table */
+ 0x61, 0xff, /* bsr.l .plt */
+ 0, 0, 0, 0 /* replaced with .plt - . */
+};
+
+static const struct elf_m68k_plt_info elf_isac_plt_info = {
+ ISAC_PLT_ENTRY_SIZE,
+ elf_isac_plt0_entry, { 2, 12},
+ elf_isac_plt_entry, { 2, 20 }, 12
+};
+
+#define CPU32_PLT_ENTRY_SIZE 24
/* Procedure linkage table entries for the cpu32 */
-static const bfd_byte elf_cpu32_plt0_entry[PLT_CPU32_ENTRY_SIZE] =
+static const bfd_byte elf_cpu32_plt0_entry[CPU32_PLT_ENTRY_SIZE] =
{
0x2f, 0x3b, 0x01, 0x70, /* move.l (%pc,addr),-(%sp) */
- 0, 0, 0, 0, /* replaced with offset to .got + 4. */
+ 0, 0, 0, 2, /* + (.got + 4) - . */
0x22, 0x7b, 0x01, 0x70, /* moveal %pc@(0xc), %a1 */
- 0, 0, 0, 0, /* replace with offset to .got +8. */
+ 0, 0, 0, 2, /* + (.got + 8) - . */
0x4e, 0xd1, /* jmp %a1@ */
0, 0, 0, 0, /* pad out to 24 bytes. */
0, 0
};
-static const bfd_byte elf_cpu32_plt_entry[PLT_CPU32_ENTRY_SIZE] =
+static const bfd_byte elf_cpu32_plt_entry[CPU32_PLT_ENTRY_SIZE] =
{
0x22, 0x7b, 0x01, 0x70, /* moveal %pc@(0xc), %a1 */
- 0, 0, 0, 0, /* replaced with offset to symbol's .got entry. */
+ 0, 0, 0, 2, /* + (.got.plt entry) - . */
0x4e, 0xd1, /* jmp %a1@ */
0x2f, 0x3c, /* move.l #offset,-(%sp) */
- 0, 0, 0, 0, /* replaced with offset into relocation table. */
+ 0, 0, 0, 0, /* + reloc index */
0x60, 0xff, /* bra.l .plt */
- 0, 0, 0, 0, /* replaced with offset to start of .plt. */
+ 0, 0, 0, 0, /* + .plt - . */
0, 0
};
+static const struct elf_m68k_plt_info elf_cpu32_plt_info = {
+ CPU32_PLT_ENTRY_SIZE,
+ elf_cpu32_plt0_entry, { 4, 12 },
+ elf_cpu32_plt_entry, { 4, 18 }, 10
+};
+
/* The m68k linker needs to keep track of the number of relocs that it
decides to copy in check_relocs for each symbol. This is so that it
can discard PC relative relocs if it doesn't need them when linking
@@ -315,6 +404,10 @@ struct elf_m68k_link_hash_table
/* Small local sym to section mapping cache. */
struct sym_sec_cache sym_sec;
+
+ /* The PLT format used by this link, or NULL if the format has not
+ yet been chosen. */
+ const struct elf_m68k_plt_info *plt_info;
};
/* Get the m68k ELF linker hash table from a link_info structure. */
@@ -370,6 +463,7 @@ elf_m68k_link_hash_table_create (abfd)
}
ret->sym_sec.abfd = NULL;
+ ret->plt_info = NULL;
return &ret->root.root;
}
@@ -383,40 +477,45 @@ elf32_m68k_object_p (bfd *abfd)
unsigned features = 0;
flagword eflags = elf_elfheader (abfd)->e_flags;
- if (eflags & EF_M68K_M68000)
+ if ((eflags & EF_M68K_ARCH_MASK) == EF_M68K_M68000)
features |= m68000;
- else if (eflags & EF_M68K_CPU32)
+ else if ((eflags & EF_M68K_ARCH_MASK) == EF_M68K_CPU32)
features |= cpu32;
- else if (eflags & EF_M68K_ISA_MASK)
+ else if ((eflags & EF_M68K_ARCH_MASK) == EF_M68K_FIDO)
+ features |= fido_a;
+ else
{
- switch (eflags & EF_M68K_ISA_MASK)
+ switch (eflags & EF_M68K_CF_ISA_MASK)
{
- case EF_M68K_ISA_A_NODIV:
+ case EF_M68K_CF_ISA_A_NODIV:
features |= mcfisa_a;
break;
- case EF_M68K_ISA_A:
+ case EF_M68K_CF_ISA_A:
features |= mcfisa_a|mcfhwdiv;
break;
- case EF_M68K_ISA_A_PLUS:
+ case EF_M68K_CF_ISA_A_PLUS:
features |= mcfisa_a|mcfisa_aa|mcfhwdiv|mcfusp;
break;
- case EF_M68K_ISA_B_NOUSP:
+ case EF_M68K_CF_ISA_B_NOUSP:
features |= mcfisa_a|mcfisa_b|mcfhwdiv;
break;
- case EF_M68K_ISA_B:
+ case EF_M68K_CF_ISA_B:
features |= mcfisa_a|mcfisa_b|mcfhwdiv|mcfusp;
break;
+ case EF_M68K_CF_ISA_C:
+ features |= mcfisa_a|mcfisa_c|mcfhwdiv|mcfusp;
+ break;
}
- switch (eflags & EF_M68K_MAC_MASK)
+ switch (eflags & EF_M68K_CF_MAC_MASK)
{
- case EF_M68K_MAC:
+ case EF_M68K_CF_MAC:
features |= mcfmac;
break;
- case EF_M68K_EMAC:
+ case EF_M68K_CF_EMAC:
features |= mcfemac;
break;
}
- if (eflags & EF_M68K_FLOAT)
+ if (eflags & EF_M68K_CF_FLOAT)
features |= cfloat;
}
@@ -472,10 +571,27 @@ elf32_m68k_merge_private_bfd_data (ibfd, obfd)
else
{
out_flags = elf_elfheader (obfd)->e_flags;
- in_isa = (in_flags & EF_M68K_ISA_MASK);
- out_isa = (out_flags & EF_M68K_ISA_MASK);
+ unsigned int variant_mask;
+
+ if ((in_flags & EF_M68K_ARCH_MASK) == EF_M68K_M68000)
+ variant_mask = 0;
+ else if ((in_flags & EF_M68K_ARCH_MASK) == EF_M68K_CPU32)
+ variant_mask = 0;
+ else if ((in_flags & EF_M68K_ARCH_MASK) == EF_M68K_FIDO)
+ variant_mask = 0;
+ else
+ variant_mask = EF_M68K_CF_ISA_MASK;
+
+ in_isa = (in_flags & variant_mask);
+ out_isa = (out_flags & variant_mask);
if (in_isa > out_isa)
out_flags ^= in_isa ^ out_isa;
+ if (((in_flags & EF_M68K_ARCH_MASK) == EF_M68K_CPU32
+ && (out_flags & EF_M68K_ARCH_MASK) == EF_M68K_FIDO)
+ || ((in_flags & EF_M68K_ARCH_MASK) == EF_M68K_FIDO
+ && (out_flags & EF_M68K_ARCH_MASK) == EF_M68K_CPU32))
+ out_flags = EF_M68K_FIDO;
+ else
out_flags |= in_flags ^ in_isa;
}
elf_elfheader (obfd)->e_flags = out_flags;
@@ -502,58 +618,64 @@ elf32_m68k_print_private_bfd_data (abfd, ptr)
/* xgettext:c-format */
fprintf (file, _("private flags = %lx:"), elf_elfheader (abfd)->e_flags);
- if (eflags & EF_M68K_CPU32)
- fprintf (file, " [cpu32]");
-
- if (eflags & EF_M68K_M68000)
+ if ((eflags & EF_M68K_ARCH_MASK) == EF_M68K_M68000)
fprintf (file, " [m68000]");
-
- if (eflags & EF_M68K_CFV4E)
- fprintf (file, " [cfv4e]");
-
- if (eflags & EF_M68K_ISA_MASK)
+ else if ((eflags & EF_M68K_ARCH_MASK) == EF_M68K_CPU32)
+ fprintf (file, " [cpu32]");
+ else if ((eflags & EF_M68K_ARCH_MASK) == EF_M68K_FIDO)
+ fprintf (file, " [fido]");
+ else
{
- char const *isa = _("unknown");
- char const *mac = _("unknown");
- char const *additional = "";
-
- switch (eflags & EF_M68K_ISA_MASK)
- {
- case EF_M68K_ISA_A_NODIV:
- isa = "A";
- additional = " [nodiv]";
- break;
- case EF_M68K_ISA_A:
- isa = "A";
- break;
- case EF_M68K_ISA_A_PLUS:
- isa = "A+";
- break;
- case EF_M68K_ISA_B_NOUSP:
- isa = "B";
- additional = " [nousp]";
- break;
- case EF_M68K_ISA_B:
- isa = "B";
- break;
- }
- fprintf (file, " [isa %s]%s", isa, additional);
- if (eflags & EF_M68K_FLOAT)
- fprintf (file, " [float]");
- switch (eflags & EF_M68K_MAC_MASK)
+ if ((eflags & EF_M68K_ARCH_MASK) == EF_M68K_CFV4E)
+ fprintf (file, " [cfv4e]");
+
+ if (eflags & EF_M68K_CF_ISA_MASK)
{
- case 0:
- mac = NULL;
- break;
- case EF_M68K_MAC:
- mac = "mac";
- break;
- case EF_M68K_EMAC:
- mac = "emac";
- break;
+ char const *isa = _("unknown");
+ char const *mac = _("unknown");
+ char const *additional = "";
+
+ switch (eflags & EF_M68K_CF_ISA_MASK)
+ {
+ case EF_M68K_CF_ISA_A_NODIV:
+ isa = "A";
+ additional = " [nodiv]";
+ break;
+ case EF_M68K_CF_ISA_A:
+ isa = "A";
+ break;
+ case EF_M68K_CF_ISA_A_PLUS:
+ isa = "A+";
+ break;
+ case EF_M68K_CF_ISA_B_NOUSP:
+ isa = "B";
+ additional = " [nousp]";
+ break;
+ case EF_M68K_CF_ISA_B:
+ isa = "B";
+ break;
+ case EF_M68K_CF_ISA_C:
+ isa = "C";
+ break;
+ }
+ fprintf (file, " [isa %s]%s", isa, additional);
+ if (eflags & EF_M68K_CF_FLOAT)
+ fprintf (file, " [float]");
+ switch (eflags & EF_M68K_CF_MAC_MASK)
+ {
+ case 0:
+ mac = NULL;
+ break;
+ case EF_M68K_CF_MAC:
+ mac = "mac";
+ break;
+ case EF_M68K_CF_EMAC:
+ mac = "emac";
+ break;
+ }
+ if (mac)
+ fprintf (file, " [%s]", mac);
}
- if (mac)
- fprintf (file, " [%s]", mac);
}
fputc ('\n', file);
@@ -812,7 +934,7 @@ elf_m68k_check_relocs (abfd, info, sec, relocs)
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (abfd, sec),
name + 5) == 0);
@@ -928,50 +1050,30 @@ elf_m68k_check_relocs (abfd, info, sec, relocs)
relocation. */
static asection *
-elf_m68k_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_m68k_gc_mark_hook (asection *sec,
+ struct bfd_link_info *info,
+ Elf_Internal_Rela *rel,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
{
if (h != NULL)
- {
- switch (ELF32_R_TYPE (rel->r_info))
- {
- case R_68K_GNU_VTINHERIT:
- case R_68K_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- default:
- break;
-
- 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;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
-
- return NULL;
+ switch (ELF32_R_TYPE (rel->r_info))
+ {
+ case R_68K_GNU_VTINHERIT:
+ case R_68K_GNU_VTENTRY:
+ return NULL;
+ }
+
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
/* Update the got entry reference counts for the section being removed. */
static bfd_boolean
-elf_m68k_gc_sweep_hook (abfd, info, sec, relocs)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *sec;
- const Elf_Internal_Rela *relocs;
+elf_m68k_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;
@@ -1070,6 +1172,34 @@ elf_m68k_gc_sweep_hook (abfd, info, sec, relocs)
return TRUE;
}
+
+/* Return the type of PLT associated with OUTPUT_BFD. */
+
+static const struct elf_m68k_plt_info *
+elf_m68k_get_plt_info (bfd *output_bfd)
+{
+ unsigned int features;
+
+ features = bfd_m68k_mach_to_features (bfd_get_mach (output_bfd));
+ if (features & cpu32)
+ return &elf_cpu32_plt_info;
+ if (features & mcfisa_b)
+ return &elf_isab_plt_info;
+ if (features & mcfisa_c)
+ return &elf_isac_plt_info;
+ return &elf_m68k_plt_info;
+}
+
+/* This function is called after all the input files have been read,
+ and the input sections have been assigned to output sections.
+ It's a convenient place to determine the PLT style. */
+
+static bfd_boolean
+elf_m68k_always_size_sections (bfd *output_bfd, struct bfd_link_info *info)
+{
+ elf_m68k_hash_table (info)->plt_info = elf_m68k_get_plt_info (output_bfd);
+ return TRUE;
+}
/* Adjust a symbol defined by a dynamic object and referenced by a
regular object. The current definition is in some section of the
@@ -1082,10 +1212,11 @@ elf_m68k_adjust_dynamic_symbol (info, h)
struct bfd_link_info *info;
struct elf_link_hash_entry *h;
{
+ struct elf_m68k_link_hash_table *htab;
bfd *dynobj;
asection *s;
- unsigned int power_of_two;
+ htab = elf_m68k_hash_table (info);
dynobj = elf_hash_table (info)->dynobj;
/* Make sure we know what is going on here. */
@@ -1135,14 +1266,7 @@ elf_m68k_adjust_dynamic_symbol (info, h)
/* If this is the first .plt entry, make room for the special
first entry. */
if (s->size == 0)
- {
- if (CPU32_FLAG (dynobj))
- s->size += PLT_CPU32_ENTRY_SIZE;
- else if (CFV4E_FLAG (dynobj))
- s->size += CFV4E_PLT_ENTRY_SIZE;
- else
- s->size += PLT_ENTRY_SIZE;
- }
+ s->size = htab->plt_info->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
@@ -1159,12 +1283,7 @@ elf_m68k_adjust_dynamic_symbol (info, h)
h->plt.offset = s->size;
/* Make room for this entry. */
- if (CPU32_FLAG (dynobj))
- s->size += PLT_CPU32_ENTRY_SIZE;
- else if (CFV4E_FLAG (dynobj))
- s->size += CFV4E_PLT_ENTRY_SIZE;
- else
- s->size += PLT_ENTRY_SIZE;
+ s->size += htab->plt_info->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. */
@@ -1240,28 +1359,7 @@ elf_m68k_adjust_dynamic_symbol (info, h)
h->needs_copy = 1;
}
- /* We need to figure out the alignment required for this symbol. I
- have no idea how ELF linkers handle this. */
- power_of_two = bfd_log2 (h->size);
- if (power_of_two > 3)
- power_of_two = 3;
-
- /* Apply the required alignment. */
- s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two));
- if (power_of_two > bfd_get_section_alignment (dynobj, s))
- {
- if (!bfd_set_section_alignment (dynobj, s, power_of_two))
- return FALSE;
- }
-
- /* Define the symbol as being at this point in the section. */
- h->root.u.def.section = s;
- h->root.u.def.value = s->size;
-
- /* Increment the section size to make room for the symbol. */
- s->size += h->size;
-
- return TRUE;
+ return _bfd_elf_adjust_dynamic_copy (h, s);
}
/* Set the sizes of the dynamic sections. */
@@ -1334,7 +1432,7 @@ elf_m68k_size_dynamic_sections (output_bfd, info)
/* Remember whether there is a PLT. */
plt = s->size != 0;
}
- else if (strncmp (name, ".rela", 5) == 0)
+ else if (CONST_STRNEQ (name, ".rela"))
{
if (s->size != 0)
{
@@ -1345,7 +1443,7 @@ elf_m68k_size_dynamic_sections (output_bfd, info)
s->reloc_count = 0;
}
}
- else if (strncmp (name, ".got", 4) != 0
+ else if (! CONST_STRNEQ (name, ".got")
&& strcmp (name, ".dynbss") != 0)
{
/* It's not one of our sections, so don't allocate space. */
@@ -1501,9 +1599,6 @@ elf_m68k_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);
@@ -1558,6 +1653,20 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
unresolved_reloc, warned);
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
switch (r_type)
{
case R_68K_GOT8:
@@ -1791,11 +1900,12 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
else
{
/* This symbol is local, or marked to become local. */
+ outrel.r_addend = relocation + rel->r_addend;
+
if (r_type == R_68K_32)
{
relocate = TRUE;
outrel.r_info = ELF32_R_INFO (0, R_68K_RELATIVE);
- outrel.r_addend = relocation + rel->r_addend;
}
else
{
@@ -1812,13 +1922,24 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
{
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);
+ if (indx == 0)
+ {
+ struct elf_link_hash_table *htab;
+ htab = elf_hash_table (info);
+ osec = htab->text_index_section;
+ indx = elf_section_data (osec)->dynindx;
+ }
+ BFD_ASSERT (indx != 0);
}
outrel.r_info = ELF32_R_INFO (indx, r_type);
- outrel.r_addend = relocation + rel->r_addend;
}
}
@@ -1909,6 +2030,21 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
return TRUE;
}
+/* Install an M_68K_PC32 relocation against VALUE at offset OFFSET
+ into section SEC. */
+
+static void
+elf_m68k_install_pc32 (asection *sec, bfd_vma offset, bfd_vma value)
+{
+ /* Make VALUE PC-relative. */
+ value -= sec->output_section->vma + offset;
+
+ /* Apply any in-place addend. */
+ value += bfd_get_32 (sec->owner, sec->contents + offset);
+
+ bfd_put_32 (sec->owner, value, sec->contents + offset);
+}
+
/* Finish up dynamic symbol handling. We set the contents of various
dynamic sections here. */
@@ -1920,12 +2056,12 @@ elf_m68k_finish_dynamic_symbol (output_bfd, info, h, sym)
Elf_Internal_Sym *sym;
{
bfd *dynobj;
- int plt_off1, plt_off2, plt_off3;
dynobj = elf_hash_table (info)->dynobj;
if (h->plt.offset != (bfd_vma) -1)
{
+ const struct elf_m68k_plt_info *plt_info;
asection *splt;
asection *sgot;
asection *srela;
@@ -1939,6 +2075,7 @@ elf_m68k_finish_dynamic_symbol (output_bfd, info, h, sym)
BFD_ASSERT (h->dynindx != -1);
+ plt_info = elf_m68k_hash_table (info)->plt_info;
splt = bfd_get_section_by_name (dynobj, ".plt");
sgot = bfd_get_section_by_name (dynobj, ".got.plt");
srela = bfd_get_section_by_name (dynobj, ".rela.plt");
@@ -1948,66 +2085,36 @@ elf_m68k_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. */
- if (CPU32_FLAG (output_bfd))
- plt_index = (h->plt.offset / PLT_CPU32_ENTRY_SIZE) - 1;
- else if (CFV4E_FLAG (output_bfd))
- plt_index = (h->plt.offset / CFV4E_PLT_ENTRY_SIZE) - 1;
- else
- plt_index = (h->plt.offset / PLT_ENTRY_SIZE) - 1;
+ plt_index = (h->plt.offset / plt_info->size) - 1;
/* Get the offset into the .got table of the entry that
corresponds to this function. Each .got entry is 4 bytes.
The first three are reserved. */
got_offset = (plt_index + 3) * 4;
- if (CPU32_FLAG (output_bfd))
- {
- /* Fill in the entry in the procedure linkage table. */
- memcpy (splt->contents + h->plt.offset, elf_cpu32_plt_entry,
- PLT_CPU32_ENTRY_SIZE);
- plt_off1 = 4;
- plt_off2 = 12;
- plt_off3 = 18;
- }
- else if (CFV4E_FLAG (output_bfd))
- {
- memcpy (splt->contents + h->plt.offset, elf_cfv4e_plt_entry,
- CFV4E_PLT_ENTRY_SIZE);
- plt_off1 = 2;
- plt_off2 = 14;
- plt_off3 = 20;
- }
- else
- {
- /* Fill in the entry in the procedure linkage table. */
- memcpy (splt->contents + h->plt.offset, elf_m68k_plt_entry,
- PLT_ENTRY_SIZE);
- plt_off1 = 4;
- plt_off2 = 10;
- plt_off3 = 16;
- }
-
- /* The offset is relative to the first extension word. */
- bfd_put_32 (output_bfd,
- sgot->output_section->vma
- + sgot->output_offset
- + got_offset
- - (splt->output_section->vma
- + h->plt.offset
- + (CFV4E_FLAG (output_bfd) ? 8 : 2)),
- splt->contents + h->plt.offset + plt_off1);
+ memcpy (splt->contents + h->plt.offset,
+ plt_info->symbol_entry,
+ plt_info->size);
+
+ elf_m68k_install_pc32 (splt, h->plt.offset + plt_info->symbol_relocs.got,
+ (sgot->output_section->vma
+ + sgot->output_offset
+ + got_offset));
bfd_put_32 (output_bfd, plt_index * sizeof (Elf32_External_Rela),
- splt->contents + h->plt.offset + plt_off2);
- bfd_put_32 (output_bfd, - (h->plt.offset + plt_off3),
- splt->contents + h->plt.offset + plt_off3);
+ splt->contents
+ + h->plt.offset
+ + plt_info->symbol_resolve_entry + 2);
+
+ elf_m68k_install_pc32 (splt, h->plt.offset + plt_info->symbol_relocs.plt,
+ splt->output_section->vma);
/* Fill in the entry in the global offset table. */
bfd_put_32 (output_bfd,
(splt->output_section->vma
+ splt->output_offset
+ h->plt.offset
- + (CFV4E_FLAG (output_bfd) ? 12 : 8)),
+ + plt_info->symbol_resolve_entry),
sgot->contents + got_offset);
/* Fill in the entry in the .rela.plt section. */
@@ -2185,54 +2292,23 @@ elf_m68k_finish_dynamic_sections (output_bfd, info)
/* Fill in the first entry in the procedure linkage table. */
if (splt->size > 0)
{
- if (CFV4E_FLAG (output_bfd))
- {
- memcpy (splt->contents, elf_cfv4e_plt0_entry, CFV4E_PLT_ENTRY_SIZE);
- bfd_put_32 (output_bfd,
- (sgot->output_section->vma
- + sgot->output_offset + 4
- - (splt->output_section->vma + 2)),
- splt->contents + 2);
- bfd_put_32 (output_bfd,
- (sgot->output_section->vma
- + sgot->output_offset + 8
- - (splt->output_section->vma + 10) - 8),
- splt->contents + 12);
- elf_section_data (splt->output_section)->this_hdr.sh_entsize
- = CFV4E_PLT_ENTRY_SIZE;
- }
- else if (CPU32_FLAG (output_bfd))
- {
- memcpy (splt->contents, elf_cpu32_plt0_entry, PLT_CPU32_ENTRY_SIZE);
- bfd_put_32 (output_bfd,
- (sgot->output_section->vma
- + sgot->output_offset + 4
- - (splt->output_section->vma + 2)),
- splt->contents + 4);
- bfd_put_32 (output_bfd,
- (sgot->output_section->vma
- + sgot->output_offset + 8
- - (splt->output_section->vma + 10)),
- splt->contents + 12);
- elf_section_data (splt->output_section)->this_hdr.sh_entsize
- = PLT_CPU32_ENTRY_SIZE;
- }
- else
- {
- memcpy (splt->contents, elf_m68k_plt0_entry, PLT_ENTRY_SIZE);
- bfd_put_32 (output_bfd,
- (sgot->output_section->vma
- + sgot->output_offset + 4
- - (splt->output_section->vma + 2)),
- splt->contents + 4);
- bfd_put_32 (output_bfd,
- (sgot->output_section->vma
- + sgot->output_offset + 8
- - (splt->output_section->vma + 10)),
- splt->contents + 12);
- elf_section_data (splt->output_section)->this_hdr.sh_entsize
- = PLT_ENTRY_SIZE;
- }
+ const struct elf_m68k_plt_info *plt_info;
+
+ plt_info = elf_m68k_hash_table (info)->plt_info;
+ memcpy (splt->contents, plt_info->plt0_entry, plt_info->size);
+
+ elf_m68k_install_pc32 (splt, plt_info->plt0_relocs.got4,
+ (sgot->output_section->vma
+ + sgot->output_offset
+ + 4));
+
+ elf_m68k_install_pc32 (splt, plt_info->plt0_relocs.got8,
+ (sgot->output_section->vma
+ + sgot->output_offset
+ + 8));
+
+ elf_section_data (splt->output_section)->this_hdr.sh_entsize
+ = plt_info->size;
}
}
@@ -2401,9 +2477,7 @@ static bfd_vma
elf_m68k_plt_sym_val (bfd_vma i, const asection *plt,
const arelent *rel ATTRIBUTE_UNUSED)
{
- if (CPU32_FLAG (plt->owner))
- return plt->vma + (i + 1) * PLT_CPU32_ENTRY_SIZE;
- return plt->vma + (i + 1) * PLT_ENTRY_SIZE;
+ return plt->vma + (i + 1) * elf_m68k_get_plt_info (plt->owner)->size;
}
#define TARGET_BIG_SYM bfd_elf32_m68k_vec
@@ -2417,10 +2491,13 @@ elf_m68k_plt_sym_val (bfd_vma i, const asection *plt,
#define bfd_elf32_bfd_final_link bfd_elf_gc_common_final_link
#define elf_backend_check_relocs elf_m68k_check_relocs
+#define elf_backend_always_size_sections \
+ elf_m68k_always_size_sections
#define elf_backend_adjust_dynamic_symbol \
elf_m68k_adjust_dynamic_symbol
#define elf_backend_size_dynamic_sections \
elf_m68k_size_dynamic_sections
+#define elf_backend_init_index_section _bfd_elf_init_1_index_section
#define elf_backend_relocate_section elf_m68k_relocate_section
#define elf_backend_finish_dynamic_symbol \
elf_m68k_finish_dynamic_symbol
diff --git a/bfd/elf32-m88k.c b/bfd/elf32-m88k.c
index 1554c23884c7..c6c34a3105c7 100644
--- a/bfd/elf32-m88k.c
+++ b/bfd/elf32-m88k.c
@@ -1,5 +1,5 @@
/* Motorola 88k-specific support for 32-bit ELF
- Copyright 1993, 1995, 1999 Free Software Foundation, Inc.
+ Copyright 1993, 1995, 1999, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -31,6 +31,7 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
#define ELF_MACHINE_CODE EM_88K
#define ELF_MAXPAGESIZE 1 /* FIXME: This number is wrong, It should be the page size in bytes. */
#define bfd_elf32_bfd_reloc_type_lookup bfd_default_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup
#define elf_info_to_howto _bfd_elf_no_info_to_howto
#include "elf32-target.h"
diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c
index ed0123d553bd..66f4db8b62ab 100644
--- a/bfd/elf32-mcore.c
+++ b/bfd/elf32-mcore.c
@@ -1,6 +1,6 @@
/* Motorola MCore specific support for 32-bit ELF
- Copyright 1994, 1995, 1999, 2000, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
+ Copyright 1994, 1995, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -22,8 +22,8 @@
/* This file is based on a preliminary RCE ELF ABI. The
information may not match the final RCE ELF ABI. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -317,6 +317,22 @@ mcore_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
return mcore_elf_howto_table [(int) mcore_reloc];
};
+static reloc_howto_type *
+mcore_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (mcore_elf_howto_raw) / sizeof (mcore_elf_howto_raw[0]);
+ i++)
+ if (mcore_elf_howto_raw[i].name != NULL
+ && strcasecmp (mcore_elf_howto_raw[i].name, r_name) == 0)
+ return &mcore_elf_howto_raw[i];
+
+ return NULL;
+}
+
/* Set the howto pointer for a RCE ELF reloc. */
static void
@@ -387,9 +403,6 @@ mcore_elf_relocate_section (bfd * output_bfd,
(info->relocatable) ? " (relocatable)" : "");
#endif
- if (info->relocatable)
- return TRUE;
-
if (! mcore_elf_howto_table [R_MCORE_PCRELIMM8BY4]) /* Initialize howto table if needed */
mcore_elf_howto_init ();
@@ -452,6 +465,20 @@ mcore_elf_relocate_section (bfd * output_bfd,
unresolved_reloc, warned);
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
switch (r_type)
{
default:
@@ -526,37 +553,21 @@ mcore_elf_relocate_section (bfd * output_bfd,
relocation. */
static asection *
-mcore_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)
+mcore_elf_gc_mark_hook (asection *sec,
+ struct bfd_link_info *info,
+ Elf_Internal_Rela *rel,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
{
- if (h == NULL)
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
-
- switch (ELF32_R_TYPE (rel->r_info))
- {
- case R_MCORE_GNU_VTINHERIT:
- case R_MCORE_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
-
- return NULL;
+ if (h != NULL)
+ switch (ELF32_R_TYPE (rel->r_info))
+ {
+ case R_MCORE_GNU_VTINHERIT:
+ case R_MCORE_GNU_VTENTRY:
+ return NULL;
+ }
+
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
/* Update the got entry reference counts for the section being removed. */
@@ -637,9 +648,9 @@ mcore_elf_check_relocs (bfd * abfd,
static const struct bfd_elf_special_section mcore_elf_special_sections[]=
{
- { ".ctors", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".dtors", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".ctors"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".dtors"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { NULL, 0, 0, 0, 0 }
};
#define TARGET_BIG_SYM bfd_elf32_mcore_big_vec
@@ -656,6 +667,7 @@ static const struct bfd_elf_special_section mcore_elf_special_sections[]=
#define bfd_elf32_bfd_merge_private_bfd_data mcore_elf_merge_private_bfd_data
#define bfd_elf32_bfd_set_private_flags mcore_elf_set_private_flags
#define bfd_elf32_bfd_reloc_type_lookup mcore_elf_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup mcore_elf_reloc_name_lookup
#define elf_backend_relocate_section mcore_elf_relocate_section
#define elf_backend_gc_mark_hook mcore_elf_gc_mark_hook
#define elf_backend_gc_sweep_hook mcore_elf_gc_sweep_hook
diff --git a/bfd/elf32-mep.c b/bfd/elf32-mep.c
new file mode 100644
index 000000000000..169da4454bc3
--- /dev/null
+++ b/bfd/elf32-mep.c
@@ -0,0 +1,959 @@
+/* MeP-specific support for 32-bit ELF.
+ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ Free Software Foundation, Inc.
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "libbfd.h"
+#include "elf-bfd.h"
+#include "elf/mep.h"
+#include "libiberty.h"
+
+/* Forward declarations. */
+
+/* Private relocation functions. */
+
+#define MEPREL(type, size, bits, right, left, pcrel, overflow, mask) \
+ {(unsigned)type, right, size, bits, pcrel, left, overflow, mep_reloc, #type, FALSE, 0, mask, 0 }
+
+#define N complain_overflow_dont
+#define S complain_overflow_signed
+#define U complain_overflow_unsigned
+
+static bfd_reloc_status_type mep_reloc (bfd *, arelent *, struct bfd_symbol *,
+ void *, asection *, bfd *, char **);
+
+static reloc_howto_type mep_elf_howto_table [] =
+{
+ /* type, size, bits, leftshift, rightshift, pcrel, OD/OS/OU, mask. */
+ MEPREL (R_MEP_NONE, 0, 0, 0, 0, 0, N, 0),
+ MEPREL (R_RELC, 0, 0, 0, 0, 0, N, 0),
+ /* MEPRELOC:HOWTO */
+ /* This section generated from bfd/mep-relocs.pl from include/elf/mep.h. */
+ MEPREL (R_MEP_8, 0, 8, 0, 0, 0, U, 0xff),
+ MEPREL (R_MEP_16, 1, 16, 0, 0, 0, U, 0xffff),
+ MEPREL (R_MEP_32, 2, 32, 0, 0, 0, U, 0xffffffff),
+ MEPREL (R_MEP_PCREL8A2, 1, 8, 1, 1, 1, S, 0x00fe),
+ MEPREL (R_MEP_PCREL12A2,1, 12, 1, 1, 1, S, 0x0ffe),
+ MEPREL (R_MEP_PCREL17A2,2, 17, 0, 1, 1, S, 0x0000ffff),
+ MEPREL (R_MEP_PCREL24A2,2, 24, 0, 1, 1, S, 0x07f0ffff),
+ MEPREL (R_MEP_PCABS24A2,2, 24, 0, 1, 0, U, 0x07f0ffff),
+ MEPREL (R_MEP_LOW16, 2, 16, 0, 0, 0, N, 0x0000ffff),
+ MEPREL (R_MEP_HI16U, 2, 32, 0,16, 0, N, 0x0000ffff),
+ MEPREL (R_MEP_HI16S, 2, 32, 0,16, 0, N, 0x0000ffff),
+ MEPREL (R_MEP_GPREL, 2, 16, 0, 0, 0, S, 0x0000ffff),
+ MEPREL (R_MEP_TPREL, 2, 16, 0, 0, 0, S, 0x0000ffff),
+ MEPREL (R_MEP_TPREL7, 1, 7, 0, 0, 0, U, 0x007f),
+ MEPREL (R_MEP_TPREL7A2, 1, 7, 1, 1, 0, U, 0x007e),
+ MEPREL (R_MEP_TPREL7A4, 1, 7, 2, 2, 0, U, 0x007c),
+ MEPREL (R_MEP_UIMM24, 2, 24, 0, 0, 0, U, 0x00ffffff),
+ MEPREL (R_MEP_ADDR24A4, 2, 24, 0, 2, 0, U, 0x00fcffff),
+ MEPREL (R_MEP_GNU_VTINHERIT,1, 0,16,32, 0, N, 0x0000),
+ MEPREL (R_MEP_GNU_VTENTRY,1, 0,16,32, 0, N, 0x0000),
+ /* MEPRELOC:END */
+};
+
+#define VALID_MEP_RELOC(N) ((N) >= 0 \
+ && (N) < ARRAY_SIZE (mep_elf_howto_table)
+
+#undef N
+#undef S
+#undef U
+
+static bfd_reloc_status_type
+mep_reloc
+ (bfd * abfd ATTRIBUTE_UNUSED,
+ arelent * reloc_entry ATTRIBUTE_UNUSED,
+ struct bfd_symbol * symbol ATTRIBUTE_UNUSED,
+ void * data ATTRIBUTE_UNUSED,
+ asection * input_section ATTRIBUTE_UNUSED,
+ bfd * output_bfd ATTRIBUTE_UNUSED,
+ char ** error_message ATTRIBUTE_UNUSED)
+{
+ return bfd_reloc_ok;
+}
+
+
+
+#define BFD_RELOC_MEP_NONE BFD_RELOC_NONE
+#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
+#define MAP(n) case BFD_RELOC_MEP_##n: type = R_MEP_##n; break
+#else
+#define MAP(n) case BFD_RELOC_MEP_/**/n: type = R_MEP_/**/n; break
+#endif
+
+static reloc_howto_type *
+mep_reloc_type_lookup
+ (bfd * abfd ATTRIBUTE_UNUSED,
+ bfd_reloc_code_real_type code)
+{
+ unsigned int type = 0;
+
+ switch (code)
+ {
+ MAP(NONE);
+ case BFD_RELOC_8:
+ type = R_MEP_8;
+ break;
+ case BFD_RELOC_16:
+ type = R_MEP_16;
+ break;
+ case BFD_RELOC_32:
+ type = R_MEP_32;
+ break;
+ case BFD_RELOC_VTABLE_ENTRY:
+ type = R_MEP_GNU_VTENTRY;
+ break;
+ case BFD_RELOC_VTABLE_INHERIT:
+ type = R_MEP_GNU_VTINHERIT;
+ break;
+ case BFD_RELOC_RELC:
+ type = R_RELC;
+ break;
+
+ /* MEPRELOC:MAP */
+ /* This section generated from bfd/mep-relocs.pl from include/elf/mep.h. */
+ MAP(8);
+ MAP(16);
+ MAP(32);
+ MAP(PCREL8A2);
+ MAP(PCREL12A2);
+ MAP(PCREL17A2);
+ MAP(PCREL24A2);
+ MAP(PCABS24A2);
+ MAP(LOW16);
+ MAP(HI16U);
+ MAP(HI16S);
+ MAP(GPREL);
+ MAP(TPREL);
+ MAP(TPREL7);
+ MAP(TPREL7A2);
+ MAP(TPREL7A4);
+ MAP(UIMM24);
+ MAP(ADDR24A4);
+ MAP(GNU_VTINHERIT);
+ MAP(GNU_VTENTRY);
+ /* MEPRELOC:END */
+
+ default:
+ /* Pacify gcc -Wall. */
+ fprintf (stderr, "mep: no reloc for code %d\n", code);
+ return NULL;
+ }
+
+ if (mep_elf_howto_table[type].type != type)
+ {
+ fprintf (stderr, "MeP: howto %d has type %d\n", type, mep_elf_howto_table[type].type);
+ abort ();
+ }
+
+ return mep_elf_howto_table + type;
+}
+
+#undef MAP
+
+static reloc_howto_type *
+mep_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (mep_elf_howto_table) / sizeof (mep_elf_howto_table[0]);
+ i++)
+ if (mep_elf_howto_table[i].name != NULL
+ && strcasecmp (mep_elf_howto_table[i].name, r_name) == 0)
+ return &mep_elf_howto_table[i];
+
+ return NULL;
+}
+
+/* Perform a single relocation. */
+
+static struct bfd_link_info *mep_info;
+static int warn_tp = 0, warn_sda = 0;
+
+static bfd_vma
+mep_lookup_global
+ (char * name,
+ bfd_vma ofs,
+ bfd_vma * cache,
+ int * warn)
+{
+ struct bfd_link_hash_entry *h;
+
+ if (*cache || *warn)
+ return *cache;
+
+ h = bfd_link_hash_lookup (mep_info->hash, name, FALSE, FALSE, TRUE);
+ if (h == 0 || h->type != bfd_link_hash_defined)
+ {
+ *warn = ofs + 1;
+ return 0;
+ }
+ *cache = (h->u.def.value
+ + h->u.def.section->output_section->vma
+ + h->u.def.section->output_offset);
+ return *cache;
+}
+
+static bfd_vma
+mep_tpoff_base (bfd_vma ofs)
+{
+ static bfd_vma cache = 0;
+ return mep_lookup_global ("__tpbase", ofs, &cache, &warn_tp);
+}
+
+static bfd_vma
+mep_sdaoff_base (bfd_vma ofs)
+{
+ static bfd_vma cache = 0;
+ return mep_lookup_global ("__sdabase", ofs, &cache, &warn_sda);
+}
+
+static bfd_reloc_status_type
+mep_final_link_relocate
+ (reloc_howto_type * howto,
+ bfd * input_bfd,
+ asection * input_section,
+ bfd_byte * contents,
+ Elf_Internal_Rela * rel,
+ bfd_vma relocation)
+{
+ unsigned long u;
+ long s;
+ unsigned char *byte;
+ bfd_vma pc;
+ bfd_reloc_status_type r = bfd_reloc_ok;
+ int e2, e4;
+
+ if (bfd_big_endian (input_bfd))
+ {
+ e2 = 0;
+ e4 = 0;
+ }
+ else
+ {
+ e2 = 1;
+ e4 = 3;
+ }
+
+ pc = (input_section->output_section->vma
+ + input_section->output_offset
+ + rel->r_offset);
+
+ s = relocation + rel->r_addend;
+
+ byte = (unsigned char *)contents + rel->r_offset;
+
+ if (howto->type == R_MEP_PCREL24A2
+ && s == 0
+ && pc >= 0x800000)
+ {
+ /* This is an unreachable branch to an undefined weak function.
+ Silently ignore it, since the opcode can't do that but should
+ never be executed anyway. */
+ return bfd_reloc_ok;
+ }
+
+ if (howto->pc_relative)
+ s -= pc;
+
+ u = (unsigned long) s;
+
+ switch (howto->type)
+ {
+ /* MEPRELOC:APPLY */
+ /* This section generated from bfd/mep-relocs.pl from include/elf/mep.h. */
+ case R_MEP_8: /* 76543210 */
+ if (u > 255) r = bfd_reloc_overflow;
+ byte[0] = (u & 0xff);
+ break;
+ case R_MEP_16: /* fedcba9876543210 */
+ if (u > 65535) r = bfd_reloc_overflow;
+ byte[0^e2] = ((u >> 8) & 0xff);
+ byte[1^e2] = (u & 0xff);
+ break;
+ case R_MEP_32: /* vutsrqponmlkjihgfedcba9876543210 */
+ byte[0^e4] = ((u >> 24) & 0xff);
+ byte[1^e4] = ((u >> 16) & 0xff);
+ byte[2^e4] = ((u >> 8) & 0xff);
+ byte[3^e4] = (u & 0xff);
+ break;
+ case R_MEP_PCREL8A2: /* --------7654321- */
+ if (-128 > s || s > 127) r = bfd_reloc_overflow;
+ byte[1^e2] = (byte[1^e2] & 0x01) | (s & 0xfe);
+ break;
+ case R_MEP_PCREL12A2: /* ----ba987654321- */
+ if (-2048 > s || s > 2047) r = bfd_reloc_overflow;
+ byte[0^e2] = (byte[0^e2] & 0xf0) | ((s >> 8) & 0x0f);
+ byte[1^e2] = (byte[1^e2] & 0x01) | (s & 0xfe);
+ break;
+ case R_MEP_PCREL17A2: /* ----------------gfedcba987654321 */
+ if (-65536 > s || s > 65535) r = bfd_reloc_overflow;
+ byte[2^e2] = ((s >> 9) & 0xff);
+ byte[3^e2] = ((s >> 1) & 0xff);
+ break;
+ case R_MEP_PCREL24A2: /* -----7654321----nmlkjihgfedcba98 */
+ if (-8388608 > s || s > 8388607) r = bfd_reloc_overflow;
+ byte[0^e2] = (byte[0^e2] & 0xf8) | ((s >> 5) & 0x07);
+ byte[1^e2] = (byte[1^e2] & 0x0f) | ((s << 3) & 0xf0);
+ byte[2^e2] = ((s >> 16) & 0xff);
+ byte[3^e2] = ((s >> 8) & 0xff);
+ break;
+ case R_MEP_PCABS24A2: /* -----7654321----nmlkjihgfedcba98 */
+ if (u > 16777215) r = bfd_reloc_overflow;
+ byte[0^e2] = (byte[0^e2] & 0xf8) | ((u >> 5) & 0x07);
+ byte[1^e2] = (byte[1^e2] & 0x0f) | ((u << 3) & 0xf0);
+ byte[2^e2] = ((u >> 16) & 0xff);
+ byte[3^e2] = ((u >> 8) & 0xff);
+ break;
+ case R_MEP_LOW16: /* ----------------fedcba9876543210 */
+ byte[2^e2] = ((u >> 8) & 0xff);
+ byte[3^e2] = (u & 0xff);
+ break;
+ case R_MEP_HI16U: /* ----------------vutsrqponmlkjihg */
+ byte[2^e2] = ((u >> 24) & 0xff);
+ byte[3^e2] = ((u >> 16) & 0xff);
+ break;
+ case R_MEP_HI16S: /* ----------------vutsrqponmlkjihg */
+ byte[2^e2] = ((s >> 24) & 0xff);
+ byte[3^e2] = ((s >> 16) & 0xff);
+ break;
+ case R_MEP_GPREL: /* ----------------fedcba9876543210 */
+ s -= mep_sdaoff_base(rel->r_offset);
+ if (-32768 > s || s > 32767) r = bfd_reloc_overflow;
+ byte[2^e2] = ((s >> 8) & 0xff);
+ byte[3^e2] = (s & 0xff);
+ break;
+ case R_MEP_TPREL: /* ----------------fedcba9876543210 */
+ s -= mep_tpoff_base(rel->r_offset);
+ if (-32768 > s || s > 32767) r = bfd_reloc_overflow;
+ byte[2^e2] = ((s >> 8) & 0xff);
+ byte[3^e2] = (s & 0xff);
+ break;
+ case R_MEP_TPREL7: /* ---------6543210 */
+ u -= mep_tpoff_base(rel->r_offset);
+ if (u > 127) r = bfd_reloc_overflow;
+ byte[1^e2] = (byte[1^e2] & 0x80) | (u & 0x7f);
+ break;
+ case R_MEP_TPREL7A2: /* ---------654321- */
+ u -= mep_tpoff_base(rel->r_offset);
+ if (u > 127) r = bfd_reloc_overflow;
+ byte[1^e2] = (byte[1^e2] & 0x81) | (u & 0x7e);
+ break;
+ case R_MEP_TPREL7A4: /* ---------65432-- */
+ u -= mep_tpoff_base(rel->r_offset);
+ if (u > 127) r = bfd_reloc_overflow;
+ byte[1^e2] = (byte[1^e2] & 0x83) | (u & 0x7c);
+ break;
+ case R_MEP_UIMM24: /* --------76543210nmlkjihgfedcba98 */
+ if (u > 16777215) r = bfd_reloc_overflow;
+ byte[1^e2] = (u & 0xff);
+ byte[2^e2] = ((u >> 16) & 0xff);
+ byte[3^e2] = ((u >> 8) & 0xff);
+ break;
+ case R_MEP_ADDR24A4: /* --------765432--nmlkjihgfedcba98 */
+ if (u > 16777215) r = bfd_reloc_overflow;
+ byte[1^e2] = (byte[1^e2] & 0x03) | (u & 0xfc);
+ byte[2^e2] = ((u >> 16) & 0xff);
+ byte[3^e2] = ((u >> 8) & 0xff);
+ break;
+ case R_MEP_GNU_VTINHERIT: /* ---------------- */
+ break;
+ case R_MEP_GNU_VTENTRY: /* ---------------- */
+ break;
+ /* MEPRELOC:END */
+ default:
+ abort ();
+ }
+
+ return r;
+}
+
+/* Set the howto pointer for a MEP ELF reloc. */
+
+static void
+mep_info_to_howto_rela
+ (bfd * abfd ATTRIBUTE_UNUSED,
+ arelent * cache_ptr,
+ Elf_Internal_Rela * dst)
+{
+ unsigned int r_type;
+
+ r_type = ELF32_R_TYPE (dst->r_info);
+ cache_ptr->howto = & mep_elf_howto_table [r_type];
+}
+
+/* Look through the relocs for a section during the first phase.
+ Since we don't do .gots or .plts, we just need to consider the
+ virtual table relocs for gc. */
+
+static bfd_boolean
+mep_elf_check_relocs
+ (bfd * abfd,
+ struct bfd_link_info * info,
+ asection * sec,
+ const Elf_Internal_Rela * relocs)
+{
+ Elf_Internal_Shdr * symtab_hdr;
+ struct elf_link_hash_entry ** sym_hashes;
+ struct elf_link_hash_entry ** sym_hashes_end;
+ const Elf_Internal_Rela * rel;
+ const Elf_Internal_Rela * rel_end;
+
+ if (info->relocatable)
+ return TRUE;
+
+ symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+ sym_hashes = elf_sym_hashes (abfd);
+ sym_hashes_end = sym_hashes + symtab_hdr->sh_size / sizeof (Elf32_External_Sym);
+ if (!elf_bad_symtab (abfd))
+ sym_hashes_end -= symtab_hdr->sh_info;
+
+ rel_end = relocs + sec->reloc_count;
+ for (rel = relocs; rel < rel_end; rel++)
+ {
+ struct elf_link_hash_entry *h;
+ unsigned long r_symndx;
+
+ r_symndx = ELF32_R_SYM (rel->r_info);
+ if (r_symndx < symtab_hdr->sh_info)
+ h = NULL;
+ else
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ }
+ return TRUE;
+}
+
+
+/* Relocate a MEP ELF section.
+ There is some attempt to make this function usable for many architectures,
+ both USE_REL and USE_RELA ['twould be nice if such a critter existed],
+ if only to serve as a learning tool.
+
+ The RELOCATE_SECTION function is called by the new ELF backend linker
+ to handle the relocations for a section.
+
+ The relocs are always passed as Rela structures; if the section
+ actually uses Rel structures, the r_addend field will always be
+ zero.
+
+ This function is responsible for adjusting the section contents as
+ necessary, and (if using Rela relocs and generating a relocatable
+ output file) adjusting the reloc addend as necessary.
+
+ This function does not have to worry about setting the reloc
+ address or the reloc symbol index.
+
+ LOCAL_SYMS is a pointer to the swapped in local symbols.
+
+ LOCAL_SECTIONS is an array giving the section in the input file
+ corresponding to the st_shndx field of each local symbol.
+
+ The global hash table entry for the global symbols can be found
+ via elf_sym_hashes (input_bfd).
+
+ When generating relocatable output, this function must handle
+ STB_LOCAL/STT_SECTION symbols specially. The output symbol is
+ going to be the section symbol corresponding to the output
+ section, which means that the addend must be adjusted
+ accordingly. */
+
+static bfd_boolean
+mep_elf_relocate_section
+ (bfd * output_bfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info * info,
+ bfd * input_bfd,
+ asection * input_section,
+ bfd_byte * contents,
+ Elf_Internal_Rela * relocs,
+ Elf_Internal_Sym * local_syms,
+ asection ** local_sections)
+{
+ Elf_Internal_Shdr * symtab_hdr;
+ struct elf_link_hash_entry ** sym_hashes;
+ Elf_Internal_Rela * rel;
+ Elf_Internal_Rela * relend;
+
+ symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
+ sym_hashes = elf_sym_hashes (input_bfd);
+ relend = relocs + input_section->reloc_count;
+
+ mep_info = info;
+
+ for (rel = relocs; rel < relend; rel ++)
+ {
+ reloc_howto_type * howto;
+ unsigned long r_symndx;
+ Elf_Internal_Sym * sym;
+ asection * sec;
+ struct elf_link_hash_entry * h;
+ bfd_vma relocation;
+ bfd_reloc_status_type r;
+ const char * name = NULL;
+ int r_type;
+
+ r_type = ELF32_R_TYPE (rel->r_info);
+
+ r_symndx = ELF32_R_SYM (rel->r_info);
+
+ /* Is this a complex relocation? */
+ if (!info->relocatable && ELF32_R_TYPE (rel->r_info) == R_RELC)
+ {
+ bfd_elf_perform_complex_relocation (output_bfd, info,
+ input_bfd, input_section, contents,
+ rel, local_syms, local_sections);
+ continue;
+ }
+
+ howto = mep_elf_howto_table + ELF32_R_TYPE (rel->r_info);
+ h = NULL;
+ sym = NULL;
+ sec = NULL;
+
+ if (r_symndx < symtab_hdr->sh_info)
+ {
+ sym = local_syms + r_symndx;
+ sec = local_sections [r_symndx];
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
+
+ name = bfd_elf_string_from_elf_section
+ (input_bfd, symtab_hdr->sh_link, sym->st_name);
+ name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name;
+#if 0
+ fprintf (stderr, "local: sec: %s, sym: %s (%d), value: %x + %x + %x addend %x\n",
+ sec->name, name, sym->st_name,
+ sec->output_section->vma, sec->output_offset,
+ sym->st_value, rel->r_addend);
+#endif
+ }
+ else
+ {
+ relocation = 0;
+ h = sym_hashes [r_symndx];
+
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ name = h->root.root.string;
+
+ if (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ {
+ sec = h->root.u.def.section;
+ relocation = (h->root.u.def.value
+ + sec->output_section->vma
+ + sec->output_offset);
+#if 0
+ fprintf (stderr,
+ "defined: sec: %s, name: %s, value: %x + %x + %x gives: %x\n",
+ sec->name, name, h->root.u.def.value,
+ sec->output_section->vma, sec->output_offset, relocation);
+#endif
+ }
+ else if (h->root.type == bfd_link_hash_undefweak)
+ {
+#if 0
+ fprintf (stderr, "undefined: sec: %s, name: %s\n",
+ sec->name, name);
+#endif
+ }
+ else if (!info->relocatable)
+ {
+ if (! ((*info->callbacks->undefined_symbol)
+ (info, h->root.root.string, input_bfd,
+ input_section, rel->r_offset,
+ (!info->shared && info->unresolved_syms_in_objects == RM_GENERATE_ERROR))))
+ return FALSE;
+#if 0
+ fprintf (stderr, "unknown: name: %s\n", name);
+#endif
+ }
+ }
+
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ {
+ /* This is a relocatable link. We don't have to change
+ anything, unless the reloc is against a section symbol,
+ in which case we have to adjust according to where the
+ section symbol winds up in the output section. */
+ if (sym != NULL && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ rel->r_addend += sec->output_offset;
+ continue;
+ }
+
+ switch (r_type)
+ {
+ default:
+ r = mep_final_link_relocate (howto, input_bfd, input_section,
+ contents, rel, relocation);
+ break;
+ }
+
+ if (r != bfd_reloc_ok)
+ {
+ const char * msg = (const char *) NULL;
+
+ switch (r)
+ {
+ case bfd_reloc_overflow:
+ r = info->callbacks->reloc_overflow
+ (info, (h ? &h->root : NULL), name, howto->name, (bfd_vma) 0,
+ input_bfd, input_section, rel->r_offset);
+ break;
+
+ case bfd_reloc_undefined:
+ r = info->callbacks->undefined_symbol
+ (info, name, input_bfd, input_section, rel->r_offset, TRUE);
+ break;
+
+ case bfd_reloc_outofrange:
+ msg = _("internal error: out of range error");
+ break;
+
+ case bfd_reloc_notsupported:
+ msg = _("internal error: unsupported relocation error");
+ break;
+
+ case bfd_reloc_dangerous:
+ msg = _("internal error: dangerous relocation");
+ break;
+
+ default:
+ msg = _("internal error: unknown error");
+ break;
+ }
+
+ if (msg)
+ r = info->callbacks->warning
+ (info, msg, name, input_bfd, input_section, rel->r_offset);
+
+ if (! r)
+ return FALSE;
+ }
+ }
+
+ if (warn_tp)
+ info->callbacks->undefined_symbol
+ (info, "__tpbase", input_bfd, input_section, warn_tp-1, TRUE);
+ if (warn_sda)
+ info->callbacks->undefined_symbol
+ (info, "__sdabase", input_bfd, input_section, warn_sda-1, TRUE);
+ if (warn_sda || warn_tp)
+ return FALSE;
+
+ return TRUE;
+}
+
+
+/* Update the got entry reference counts for the section being
+ removed. */
+
+static bfd_boolean
+mep_elf_gc_sweep_hook
+ (bfd * abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info * info ATTRIBUTE_UNUSED,
+ asection * sec ATTRIBUTE_UNUSED,
+ const Elf_Internal_Rela * relocs ATTRIBUTE_UNUSED)
+{
+ return TRUE;
+}
+
+/* Return the section that should be marked against GC for a given
+ relocation. */
+
+static asection *
+mep_elf_gc_mark_hook
+ (asection * sec,
+ struct bfd_link_info * info ATTRIBUTE_UNUSED,
+ Elf_Internal_Rela * rel,
+ struct elf_link_hash_entry * h,
+ Elf_Internal_Sym * sym)
+{
+ if (h != NULL)
+ {
+ switch (ELF32_R_TYPE (rel->r_info))
+ {
+ default:
+ switch (h->root.type)
+ {
+ case bfd_link_hash_defined:
+ case bfd_link_hash_defweak:
+ return h->root.u.def.section;
+
+ case bfd_link_hash_common:
+ return h->root.u.c.p->section;
+
+ default:
+ break;
+ }
+ }
+ }
+ else
+ {
+ if (!(elf_bad_symtab (sec->owner)
+ && ELF_ST_BIND (sym->st_info) != STB_LOCAL)
+ && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE)
+ && sym->st_shndx != SHN_COMMON))
+ return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
+ }
+
+ return NULL;
+}
+
+
+/* Function to set the ELF flag bits. */
+
+static bfd_boolean
+mep_elf_set_private_flags (bfd * abfd,
+ flagword flags)
+{
+ elf_elfheader (abfd)->e_flags = flags;
+ elf_flags_init (abfd) = TRUE;
+ return TRUE;
+}
+
+static bfd_boolean
+mep_elf_copy_private_bfd_data (bfd * ibfd, bfd * obfd)
+{
+ if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
+ || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
+ return TRUE;
+
+ elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
+ elf_flags_init (obfd) = TRUE;
+
+ /* Copy object attributes. */
+ _bfd_elf_copy_obj_attributes (ibfd, obfd);
+
+ return TRUE;
+}
+
+/* Merge backend specific data from an object file to the output
+ object file when linking. */
+
+static bfd_boolean
+mep_elf_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
+{
+ static bfd *last_ibfd = 0;
+ flagword old_flags, new_flags;
+ flagword old_partial, new_partial;
+
+ /* Check if we have the same endianess. */
+ if (_bfd_generic_verify_endian_match (ibfd, obfd) == FALSE)
+ return FALSE;
+
+ new_flags = elf_elfheader (ibfd)->e_flags;
+ old_flags = elf_elfheader (obfd)->e_flags;
+
+#ifdef DEBUG
+ _bfd_error_handler ("%B: old_flags = 0x%.8lx, new_flags = 0x%.8lx, init = %s",
+ ibfd, old_flags, new_flags, elf_flags_init (obfd) ? "yes" : "no");
+#endif
+
+ /* First call, no flags set. */
+ if (!elf_flags_init (obfd))
+ {
+ elf_flags_init (obfd) = TRUE;
+ old_flags = new_flags;
+ }
+ else if ((new_flags | old_flags) & EF_MEP_LIBRARY)
+ {
+ /* Non-library flags trump library flags. The choice doesn't really
+ matter if both OLD_FLAGS and NEW_FLAGS have EF_MEP_LIBRARY set. */
+ if (old_flags & EF_MEP_LIBRARY)
+ old_flags = new_flags;
+ }
+ else
+ {
+ /* Make sure they're for the same mach. Allow upgrade from the "mep"
+ mach. */
+ new_partial = (new_flags & EF_MEP_CPU_MASK);
+ old_partial = (old_flags & EF_MEP_CPU_MASK);
+ if (new_partial == old_partial)
+ ;
+ else if (new_partial == EF_MEP_CPU_MEP)
+ ;
+ else if (old_partial == EF_MEP_CPU_MEP)
+ old_flags = (old_flags & ~EF_MEP_CPU_MASK) | new_partial;
+ else
+ {
+ _bfd_error_handler (_("%B and %B are for different cores"), last_ibfd, ibfd);
+ bfd_set_error (bfd_error_invalid_target);
+ return FALSE;
+ }
+
+ /* Make sure they're for the same me_module. Allow basic config to
+ mix with any other. */
+ new_partial = (new_flags & EF_MEP_INDEX_MASK);
+ old_partial = (old_flags & EF_MEP_INDEX_MASK);
+ if (new_partial == old_partial)
+ ;
+ else if (new_partial == 0)
+ ;
+ else if (old_partial == 0)
+ old_flags = (old_flags & ~EF_MEP_INDEX_MASK) | new_partial;
+ else
+ {
+ _bfd_error_handler (_("%B and %B are for different configurations"), last_ibfd, ibfd);
+ bfd_set_error (bfd_error_invalid_target);
+ return FALSE;
+ }
+ }
+
+ elf_elfheader (obfd)->e_flags = old_flags;
+ last_ibfd = ibfd;
+ return TRUE;
+}
+
+/* This will be edited by the MeP configration tool. */
+static const char * config_names[] =
+{
+ "basic"
+ /* start-mepcfgtool */
+ ,"simple"
+ ,"fmax"
+ /* end-mepcfgtool */
+};
+
+static const char * core_names[] =
+{
+ "MeP", "MeP-c2", "MeP-c3", "MeP-h1"
+};
+
+static bfd_boolean
+mep_elf_print_private_bfd_data (bfd * abfd, void * ptr)
+{
+ FILE * file = (FILE *) ptr;
+ flagword flags, partial_flags;
+
+ BFD_ASSERT (abfd != NULL && ptr != NULL);
+
+ /* Print normal ELF private data. */
+ _bfd_elf_print_private_bfd_data (abfd, ptr);
+
+ flags = elf_elfheader (abfd)->e_flags;
+ fprintf (file, _("private flags = 0x%lx"), (long)flags);
+
+ partial_flags = (flags & EF_MEP_CPU_MASK) >> 24;
+ if (partial_flags < ARRAY_SIZE (core_names))
+ fprintf (file, " core: %s", core_names[(long)partial_flags]);
+
+ partial_flags = flags & EF_MEP_INDEX_MASK;
+ if (partial_flags < ARRAY_SIZE (config_names))
+ fprintf (file, " me_module: %s", config_names[(long)partial_flags]);
+
+ fputc ('\n', file);
+
+ return TRUE;
+}
+
+/* Return the machine subcode from the ELF e_flags header. */
+
+static int
+elf32_mep_machine (bfd * abfd)
+{
+ switch (elf_elfheader (abfd)->e_flags & EF_MEP_CPU_MASK)
+ {
+ default: break;
+ case EF_MEP_CPU_C2: return bfd_mach_mep;
+ case EF_MEP_CPU_C3: return bfd_mach_mep;
+ case EF_MEP_CPU_C4: return bfd_mach_mep;
+ case EF_MEP_CPU_H1: return bfd_mach_mep_h1;
+ }
+
+ return bfd_mach_mep;
+}
+
+static bfd_boolean
+mep_elf_object_p (bfd * abfd)
+{
+ /* Irix 5 and 6 is broken. Object file symbol tables are not always
+ sorted correctly such that local symbols preceed global symbols,
+ and the sh_info field in the symbol table is not always right. */
+ /* This is needed for the RELC support code. */
+ elf_bad_symtab (abfd) = TRUE;
+ bfd_default_set_arch_mach (abfd, bfd_arch_mep, elf32_mep_machine (abfd));
+ return TRUE;
+}
+
+static bfd_boolean
+mep_elf_section_flags (flagword * flags, const Elf_Internal_Shdr * hdr)
+{
+ if (hdr->sh_flags & SHF_MEP_VLIW)
+ * flags |= SEC_MEP_VLIW;
+ return TRUE;
+}
+
+static bfd_boolean
+mep_elf_fake_sections (bfd * abfd ATTRIBUTE_UNUSED,
+ Elf_Internal_Shdr * hdr,
+ asection * sec)
+{
+ if (sec->flags & SEC_MEP_VLIW)
+ hdr->sh_flags |= SHF_MEP_VLIW;
+ return TRUE;
+}
+
+
+#define ELF_ARCH bfd_arch_mep
+#define ELF_MACHINE_CODE EM_CYGNUS_MEP
+#define ELF_MAXPAGESIZE 0x1000
+
+#define TARGET_BIG_SYM bfd_elf32_mep_vec
+#define TARGET_BIG_NAME "elf32-mep"
+
+#define TARGET_LITTLE_SYM bfd_elf32_mep_little_vec
+#define TARGET_LITTLE_NAME "elf32-mep-little"
+
+#define elf_info_to_howto_rel NULL
+#define elf_info_to_howto mep_info_to_howto_rela
+#define elf_backend_relocate_section mep_elf_relocate_section
+#define elf_backend_gc_mark_hook mep_elf_gc_mark_hook
+#define elf_backend_gc_sweep_hook mep_elf_gc_sweep_hook
+#define elf_backend_check_relocs mep_elf_check_relocs
+#define elf_backend_object_p mep_elf_object_p
+#define elf_backend_section_flags mep_elf_section_flags
+#define elf_backend_fake_sections mep_elf_fake_sections
+
+#define elf_backend_can_gc_sections 1
+
+#define bfd_elf32_bfd_reloc_type_lookup mep_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup mep_reloc_name_lookup
+#define bfd_elf32_bfd_set_private_flags mep_elf_set_private_flags
+#define bfd_elf32_bfd_copy_private_bfd_data mep_elf_copy_private_bfd_data
+#define bfd_elf32_bfd_merge_private_bfd_data mep_elf_merge_private_bfd_data
+#define bfd_elf32_bfd_print_private_bfd_data mep_elf_print_private_bfd_data
+
+/* We use only the RELA entries. */
+#define USE_RELA
+
+#include "elf32-target.h"
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c
index 6ed4ad35f627..3843b856e16a 100644
--- a/bfd/elf32-mips.c
+++ b/bfd/elf32-mips.c
@@ -1,6 +1,6 @@
/* MIPS-specific support for 32-bit ELF
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
Most of the information added by Ian Lance Taylor, Cygnus Support,
<ian@cygnus.com>.
@@ -29,8 +29,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
different MIPS ELF from other targets. This matters when linking.
This file supports both, switching at runtime. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "bfdlink.h"
#include "genlink.h"
@@ -68,8 +68,6 @@ static bfd_boolean mips_elf32_object_p
(bfd *);
static bfd_boolean mips_elf_is_local_label_name
(bfd *, const char *);
-static bfd_reloc_status_type mips16_jump_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
static bfd_reloc_status_type mips16_gprel_reloc
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
static bfd_reloc_status_type mips_elf_final_gp
@@ -702,6 +700,21 @@ static reloc_howto_type elf_mips_howto_table_rel[] =
0x0000ffff, /* src_mask */
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
+
+ /* 32 bit relocation with no addend. */
+ HOWTO (R_MIPS_GLOB_DAT, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ _bfd_mips_elf_generic_reloc, /* special_function */
+ "R_MIPS_GLOB_DAT", /* name */
+ FALSE, /* partial_inplace */
+ 0x0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
};
/* The reloc used for BFD_RELOC_CTOR when doing a 64 bit link. This
@@ -734,7 +747,7 @@ static reloc_howto_type elf_mips16_howto_table_rel[] =
/* This needs complex overflow
detection, because the upper four
bits must match the PC. */
- mips16_jump_reloc, /* special_function */
+ _bfd_mips_elf_generic_reloc, /* special_function */
"R_MIPS16_26", /* name */
TRUE, /* partial_inplace */
0x3ffffff, /* src_mask */
@@ -1112,36 +1125,6 @@ mips32_64bit_reloc (bfd *abfd, arelent *reloc_entry,
return r;
}
-/* Handle a mips16 jump. */
-
-static bfd_reloc_status_type
-mips16_jump_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry,
- asymbol *symbol, void *data ATTRIBUTE_UNUSED,
- asection *input_section, bfd *output_bfd,
- char **error_message ATTRIBUTE_UNUSED)
-{
- if (output_bfd != NULL
- && (symbol->flags & BSF_SECTION_SYM) == 0
- && reloc_entry->addend == 0)
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- /* FIXME. */
- {
- static bfd_boolean warned;
-
- if (! warned)
- (*_bfd_error_handler)
- (_("Linking mips16 objects into %s format is not supported"),
- bfd_get_target (input_section->output_section->owner));
- warned = TRUE;
- }
-
- return bfd_reloc_undefined;
-}
-
/* Handle a mips16 GP relative reloc. */
static bfd_reloc_status_type
@@ -1291,6 +1274,40 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code)
}
}
+static reloc_howto_type *
+bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (elf_mips_howto_table_rel)
+ / sizeof (elf_mips_howto_table_rel[0]));
+ i++)
+ if (elf_mips_howto_table_rel[i].name != NULL
+ && strcasecmp (elf_mips_howto_table_rel[i].name, r_name) == 0)
+ return &elf_mips_howto_table_rel[i];
+
+ for (i = 0;
+ i < (sizeof (elf_mips16_howto_table_rel)
+ / sizeof (elf_mips16_howto_table_rel[0]));
+ i++)
+ if (elf_mips16_howto_table_rel[i].name != NULL
+ && strcasecmp (elf_mips16_howto_table_rel[i].name, r_name) == 0)
+ return &elf_mips16_howto_table_rel[i];
+
+ if (strcasecmp (elf_mips_gnu_pcrel32.name, r_name) == 0)
+ return &elf_mips_gnu_pcrel32;
+ if (strcasecmp (elf_mips_gnu_rel16_s2.name, r_name) == 0)
+ return &elf_mips_gnu_rel16_s2;
+ if (strcasecmp (elf_mips_gnu_vtinherit_howto.name, r_name) == 0)
+ return &elf_mips_gnu_vtinherit_howto;
+ if (strcasecmp (elf_mips_gnu_vtentry_howto.name, r_name) == 0)
+ return &elf_mips_gnu_vtentry_howto;
+
+ return NULL;
+}
+
/* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */
static reloc_howto_type *
@@ -1537,12 +1554,15 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
#define elf_backend_create_dynamic_sections \
_bfd_mips_elf_create_dynamic_sections
#define elf_backend_check_relocs _bfd_mips_elf_check_relocs
+#define elf_backend_merge_symbol_attribute \
+ _bfd_mips_elf_merge_symbol_attribute
#define elf_backend_adjust_dynamic_symbol \
_bfd_mips_elf_adjust_dynamic_symbol
#define elf_backend_always_size_sections \
_bfd_mips_elf_always_size_sections
#define elf_backend_size_dynamic_sections \
_bfd_mips_elf_size_dynamic_sections
+#define elf_backend_init_index_section _bfd_elf_init_1_index_section
#define elf_backend_relocate_section _bfd_mips_elf_relocate_section
#define elf_backend_finish_dynamic_symbol \
_bfd_mips_elf_finish_dynamic_symbol
@@ -1599,6 +1619,7 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
/* The SVR4 MIPS ABI says that this should be 0x10000, but Irix 5 uses
a value of 0x1000, and we are compatible. */
#define ELF_MAXPAGESIZE 0x1000
+#define ELF_COMMONPAGESIZE 0x1000
#include "elf32-target.h"
@@ -1609,15 +1630,20 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
#undef TARGET_BIG_NAME
#undef ELF_MAXPAGESIZE
+#undef ELF_COMMONPAGESIZE
#define TARGET_LITTLE_SYM bfd_elf32_tradlittlemips_vec
#define TARGET_LITTLE_NAME "elf32-tradlittlemips"
#define TARGET_BIG_SYM bfd_elf32_tradbigmips_vec
#define TARGET_BIG_NAME "elf32-tradbigmips"
-/* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses
- page sizes of up to that limit, so we need to respect it. */
+/* The MIPS ABI says at Page 5-1:
+ Virtual addresses and file offsets for MIPS segments are congruent
+ modulo 64 KByte (0x10000) or larger powers of 2. Because 64 KBytes
+ is the maximum page size, the files are suitable for paging
+ regardless of physical page size. */
#define ELF_MAXPAGESIZE 0x10000
+#define ELF_COMMONPAGESIZE 0x1000
#define elf32_bed elf32_tradbed
/* Include the target file again for this target. */
@@ -1672,6 +1698,17 @@ mips_vxworks_bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code)
}
}
+static reloc_howto_type *
+mips_vxworks_bfd_reloc_name_lookup (bfd *abfd, const char *r_name)
+{
+ if (strcasecmp (mips_vxworks_copy_howto_rela.name, r_name) == 0)
+ return &mips_vxworks_copy_howto_rela;
+ if (strcasecmp (mips_vxworks_jump_slot_howto_rela.name, r_name) == 0)
+ return &mips_vxworks_jump_slot_howto_rela;
+
+ return bfd_elf32_bfd_reloc_name_lookup (abfd, r_name);
+}
+
/* Implement elf_backend_mips_rtype_to_lookup for VxWorks. */
static reloc_howto_type *
@@ -1702,6 +1739,9 @@ mips_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker)
#undef TARGET_BIG_SYM
#undef TARGET_BIG_NAME
+#undef ELF_MAXPAGESIZE
+#undef ELF_COMMONPAGESIZE
+
#define TARGET_LITTLE_SYM bfd_elf32_littlemips_vxworks_vec
#define TARGET_LITTLE_NAME "elf32-littlemips-vxworks"
#define TARGET_BIG_SYM bfd_elf32_bigmips_vxworks_vec
@@ -1710,8 +1750,8 @@ mips_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker)
#undef elf32_bed
#define elf32_bed elf32_mips_vxworks_bed
-#undef ELF_MAXPAGESIZE
#define ELF_MAXPAGESIZE 0x1000
+#define ELF_COMMONPAGESIZE 0x1000
#undef elf_backend_want_got_plt
#define elf_backend_want_got_plt 1
@@ -1735,6 +1775,9 @@ mips_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker)
#undef bfd_elf32_bfd_reloc_type_lookup
#define bfd_elf32_bfd_reloc_type_lookup \
mips_vxworks_bfd_reloc_type_lookup
+#undef bfd_elf32_bfd_reloc_name_lookup
+#define bfd_elf32_bfd_reloc_name_lookup \
+ mips_vxworks_bfd_reloc_name_lookup
#undef elf_backend_mips_rtype_to_howto
#define elf_backend_mips_rtype_to_howto \
mips_vxworks_rtype_to_howto
diff --git a/bfd/elf32-msp430.c b/bfd/elf32-msp430.c
index af737714de29..bd576c3be899 100644
--- a/bfd/elf32-msp430.c
+++ b/bfd/elf32-msp430.c
@@ -1,5 +1,6 @@
/* MSP430-specific support for 32-bit ELF
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007
+ Free Software Foundation, Inc.
Contributed by Dmitry Diky <diwil@mail.ru>
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +19,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libiberty.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -199,6 +200,23 @@ bfd_elf32_bfd_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
return NULL;
}
+static reloc_howto_type *
+bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (elf_msp430_howto_table)
+ / sizeof (elf_msp430_howto_table[0]));
+ i++)
+ if (elf_msp430_howto_table[i].name != NULL
+ && strcasecmp (elf_msp430_howto_table[i].name, r_name) == 0)
+ return &elf_msp430_howto_table[i];
+
+ return NULL;
+}
+
/* Set the howto pointer for an MSP430 ELF reloc. */
static void
@@ -213,48 +231,6 @@ msp430_info_to_howto_rela (bfd * abfd ATTRIBUTE_UNUSED,
cache_ptr->howto = &elf_msp430_howto_table[r_type];
}
-static asection *
-elf32_msp430_gc_mark_hook (asection * sec,
- struct bfd_link_info * info ATTRIBUTE_UNUSED,
- Elf_Internal_Rela * rel,
- struct elf_link_hash_entry * h,
- Elf_Internal_Sym * sym)
-{
- if (h != NULL)
- {
- switch (ELF32_R_TYPE (rel->r_info))
- {
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
-
- return NULL;
-}
-
-static bfd_boolean
-elf32_msp430_gc_sweep_hook (bfd * abfd ATTRIBUTE_UNUSED,
- struct bfd_link_info * info ATTRIBUTE_UNUSED,
- asection * sec ATTRIBUTE_UNUSED,
- const Elf_Internal_Rela * relocs ATTRIBUTE_UNUSED)
-{
- /* We don't use got and plt entries for msp430. */
- return TRUE;
-}
-
/* Look through the relocs for a section during the first phase.
Since we don't do .gots or .plts, we just need to consider the
virtual table relocs for gc. */
@@ -454,8 +430,6 @@ elf32_msp430_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED,
const char *name = NULL;
int r_type;
- /* This is a final link. */
-
r_type = ELF32_R_TYPE (rel->r_info);
r_symndx = ELF32_R_SYM (rel->r_info);
howto = elf_msp430_howto_table + ELF32_R_TYPE (rel->r_info);
@@ -483,6 +457,20 @@ elf32_msp430_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED,
unresolved_reloc, warned);
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
r = msp430_final_link_relocate (howto, input_bfd, input_section,
contents, rel, relocation);
@@ -685,21 +673,6 @@ elf32_msp430_object_p (bfd * abfd)
return bfd_default_set_arch_mach (abfd, bfd_arch_msp430, e_set);
}
-static void
-elf32_msp430_post_process_headers (bfd * abfd,
- struct bfd_link_info * link_info ATTRIBUTE_UNUSED)
-{
- Elf_Internal_Ehdr * i_ehdrp; /* ELF file header, internal form. */
-
- i_ehdrp = elf_elfheader (abfd);
-
-#ifndef ELFOSABI_STANDALONE
-#define ELFOSABI_STANDALONE 255
-#endif
-
- i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_STANDALONE;
-}
-
/* These functions handle relaxing for the msp430.
Relaxation required only in two cases:
- Bad hand coding like jumps from one section to another or
@@ -1203,6 +1176,7 @@ error_return:
#define ELF_MACHINE_CODE EM_MSP430
#define ELF_MACHINE_ALT1 EM_MSP430_OLD
#define ELF_MAXPAGESIZE 1
+#define ELF_OSABI ELFOSABI_STANDALONE
#define TARGET_LITTLE_SYM bfd_elf32_msp430_vec
#define TARGET_LITTLE_NAME "elf32-msp430"
@@ -1210,13 +1184,11 @@ error_return:
#define elf_info_to_howto msp430_info_to_howto_rela
#define elf_info_to_howto_rel NULL
#define elf_backend_relocate_section elf32_msp430_relocate_section
-#define elf_backend_gc_mark_hook elf32_msp430_gc_mark_hook
-#define elf_backend_gc_sweep_hook elf32_msp430_gc_sweep_hook
#define elf_backend_check_relocs elf32_msp430_check_relocs
#define elf_backend_can_gc_sections 1
#define elf_backend_final_write_processing bfd_elf_msp430_final_write_processing
#define elf_backend_object_p elf32_msp430_object_p
-#define elf_backend_post_process_headers elf32_msp430_post_process_headers
+#define elf_backend_post_process_headers _bfd_elf_set_osabi
#define bfd_elf32_bfd_relax_section msp430_elf_relax_section
#include "elf32-target.h"
diff --git a/bfd/elf32-mt.c b/bfd/elf32-mt.c
index 320ef1e34157..a1d86523b836 100644
--- a/bfd/elf32-mt.c
+++ b/bfd/elf32-mt.c
@@ -1,5 +1,5 @@
/* Morpho Technologies MT specific support for 32-bit ELF
- Copyright 2001, 2002, 2003, 2004, 2005
+ Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@
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 "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/mt.h"
@@ -187,6 +187,22 @@ mt_reloc_type_lookup
return NULL;
}
+static reloc_howto_type *
+mt_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (mt_elf_howto_table) / sizeof (mt_elf_howto_table[0]);
+ i++)
+ if (mt_elf_howto_table[i].name != NULL
+ && strcasecmp (mt_elf_howto_table[i].name, r_name) == 0)
+ return &mt_elf_howto_table[i];
+
+ return NULL;
+}
+
bfd_reloc_status_type
mt_elf_relocate_hi16
(bfd * input_bfd,
@@ -309,7 +325,6 @@ mt_elf_relocate_section
r_symndx = ELF32_R_SYM (rel->r_info);
- /* This is a final link. */
howto = mt_elf_howto_table + ELF32_R_TYPE (rel->r_info);
h = NULL;
sym = NULL;
@@ -338,6 +353,19 @@ mt_elf_relocate_section
name = h->root.root.string;
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
/* Finally, the sole MT-specific part. */
switch (r_type)
@@ -394,57 +422,6 @@ mt_elf_relocate_section
return TRUE;
}
-/* Return the section that should be marked against GC for a given
- relocation. */
-
-static asection *
-mt_elf_gc_mark_hook
- (asection * sec,
- struct bfd_link_info * info ATTRIBUTE_UNUSED,
- Elf_Internal_Rela * rel ATTRIBUTE_UNUSED,
- struct elf_link_hash_entry * h,
- Elf_Internal_Sym * sym)
-{
- if (h != NULL)
- {
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- else
- {
- if (!(elf_bad_symtab (sec->owner)
- && ELF_ST_BIND (sym->st_info) != STB_LOCAL)
- && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE)
- && sym->st_shndx != SHN_COMMON))
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
- }
-
- return NULL;
-}
-
-/* Update the got entry reference counts for the section being
- removed. */
-
-static bfd_boolean
-mt_elf_gc_sweep_hook
- (bfd * abfd ATTRIBUTE_UNUSED,
- struct bfd_link_info * info ATTRIBUTE_UNUSED,
- asection * sec ATTRIBUTE_UNUSED,
- const Elf_Internal_Rela * relocs ATTRIBUTE_UNUSED)
-{
- return TRUE;
-}
-
/* Look through the relocs for a section during the first phase.
Since we don't do .gots or .plts, we just need to consider the
virtual table relocs for gc. */
@@ -538,6 +515,10 @@ mt_elf_copy_private_bfd_data (bfd * ibfd, bfd * obfd)
elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
elf_flags_init (obfd) = TRUE;
+
+ /* Copy object attributes. */
+ _bfd_elf_copy_obj_attributes (ibfd, obfd);
+
return TRUE;
}
@@ -631,9 +612,8 @@ mt_elf_print_private_bfd_data (bfd * abfd, void * ptr)
#define elf_backend_relocate_section mt_elf_relocate_section
#define bfd_elf32_bfd_reloc_type_lookup mt_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup mt_reloc_name_lookup
-#define elf_backend_gc_mark_hook mt_elf_gc_mark_hook
-#define elf_backend_gc_sweep_hook mt_elf_gc_sweep_hook
#define elf_backend_check_relocs mt_elf_check_relocs
#define elf_backend_object_p mt_elf_object_p
#define elf_backend_rela_normal 1
diff --git a/bfd/elf32-openrisc.c b/bfd/elf32-openrisc.c
index b3d67bb82cf2..f0b780b05915 100644
--- a/bfd/elf32-openrisc.c
+++ b/bfd/elf32-openrisc.c
@@ -1,5 +1,6 @@
/* OpenRISC-specific support for 32-bit ELF.
- Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ Free Software Foundation, Inc.
Contributed by Johan Rydberg, jrydberg@opencores.org
This file is part of BFD, the Binary File Descriptor library.
@@ -19,8 +20,8 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/openrisc.h"
@@ -191,9 +192,9 @@ static const struct openrisc_reloc_map openrisc_reloc_map[] =
{ BFD_RELOC_32, R_OPENRISC_32 },
{ BFD_RELOC_16, R_OPENRISC_16 },
{ BFD_RELOC_8, R_OPENRISC_8 },
- { BFD_RELOC_OPENRISC_REL_26,R_OPENRISC_INSN_REL_26 },
- { BFD_RELOC_OPENRISC_ABS_26,R_OPENRISC_INSN_ABS_26 },
- { BFD_RELOC_HI16, R_OPENRISC_HI_16_IN_INSN },
+ { BFD_RELOC_OPENRISC_REL_26, R_OPENRISC_INSN_REL_26 },
+ { BFD_RELOC_OPENRISC_ABS_26, R_OPENRISC_INSN_ABS_26 },
+ { BFD_RELOC_HI16, R_OPENRISC_HI_16_IN_INSN },
{ BFD_RELOC_LO16, R_OPENRISC_LO_16_IN_INSN },
{ BFD_RELOC_VTABLE_INHERIT, R_OPENRISC_GNU_VTINHERIT },
{ BFD_RELOC_VTABLE_ENTRY, R_OPENRISC_GNU_VTENTRY }
@@ -213,6 +214,23 @@ openrisc_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
return NULL;
}
+static reloc_howto_type *
+openrisc_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (openrisc_elf_howto_table)
+ / sizeof (openrisc_elf_howto_table[0]));
+ i++)
+ if (openrisc_elf_howto_table[i].name != NULL
+ && strcasecmp (openrisc_elf_howto_table[i].name, r_name) == 0)
+ return &openrisc_elf_howto_table[i];
+
+ return NULL;
+}
+
/* Set the howto pointer for an OpenRISC ELF reloc. */
static void
@@ -303,9 +321,6 @@ openrisc_elf_relocate_section (bfd *output_bfd,
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
- if (info->relocatable)
- return TRUE;
-
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
relend = relocs + input_section->reloc_count;
@@ -333,7 +348,6 @@ openrisc_elf_relocate_section (bfd *output_bfd,
(sizeof openrisc_elf_howto_table / sizeof (reloc_howto_type)))
abort ();
- /* This is a final link. */
howto = openrisc_elf_howto_table + ELF32_R_TYPE (rel->r_info);
h = NULL;
sym = NULL;
@@ -359,6 +373,20 @@ openrisc_elf_relocate_section (bfd *output_bfd,
unresolved_reloc, warned);
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
r = openrisc_final_link_relocate (howto, input_bfd, input_section,
contents, rel, relocation);
@@ -413,47 +441,20 @@ openrisc_elf_relocate_section (bfd *output_bfd,
static asection *
openrisc_elf_gc_mark_hook (asection *sec,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info,
Elf_Internal_Rela *rel,
struct elf_link_hash_entry *h,
Elf_Internal_Sym *sym)
{
- if (h == NULL)
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
-
- switch (ELF32_R_TYPE (rel->r_info))
- {
- case R_OPENRISC_GNU_VTINHERIT:
- case R_OPENRISC_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
-
- return NULL;
-}
-
-/* Update the got entry reference counts for the section being removed. */
-
-static bfd_boolean
-openrisc_elf_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
- asection *sec ATTRIBUTE_UNUSED,
- const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED)
-{
- return TRUE;
+ if (h != NULL)
+ switch (ELF32_R_TYPE (rel->r_info))
+ {
+ case R_OPENRISC_GNU_VTINHERIT:
+ case R_OPENRISC_GNU_VTENTRY:
+ return NULL;
+ }
+
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
/* Look through the relocs for a section during the first phase.
@@ -560,13 +561,13 @@ openrisc_elf_final_write_processing (bfd *abfd,
#define elf_info_to_howto openrisc_info_to_howto_rela
#define elf_backend_relocate_section openrisc_elf_relocate_section
#define elf_backend_gc_mark_hook openrisc_elf_gc_mark_hook
-#define elf_backend_gc_sweep_hook openrisc_elf_gc_sweep_hook
#define elf_backend_check_relocs openrisc_elf_check_relocs
#define elf_backend_can_gc_sections 1
#define elf_backend_rela_normal 1
#define bfd_elf32_bfd_reloc_type_lookup openrisc_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup openrisc_reloc_name_lookup
#define elf_backend_object_p openrisc_elf_object_p
#define elf_backend_final_write_processing openrisc_elf_final_write_processing
diff --git a/bfd/elf32-or32.c b/bfd/elf32-or32.c
index 546aa151f5c8..598c8c5e5702 100644
--- a/bfd/elf32-or32.c
+++ b/bfd/elf32-or32.c
@@ -1,5 +1,5 @@
/* OR32-specific support for 32-bit ELF
- Copyright 2002, 2004, 2005 Free Software Foundation, Inc.
+ Copyright 2002, 2004, 2005, 2007 Free Software Foundation, Inc.
Contributed by Ivan Guzvinec <ivang@opencores.org>
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/or32.h"
@@ -466,6 +466,22 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return NULL;
}
+static reloc_howto_type *
+bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (elf_or32_howto_table) / sizeof (elf_or32_howto_table[0]);
+ i++)
+ if (elf_or32_howto_table[i].name != NULL
+ && strcasecmp (elf_or32_howto_table[i].name, r_name) == 0)
+ return &elf_or32_howto_table[i];
+
+ return NULL;
+}
+
/* Set the howto pointer for an OR32 ELF reloc. */
static void
diff --git a/bfd/elf32-pj.c b/bfd/elf32-pj.c
index bd0a5b49ffa8..6b2f1de70b9d 100644
--- a/bfd/elf32-pj.c
+++ b/bfd/elf32-pj.c
@@ -1,5 +1,6 @@
/* picoJava specific support for 32-bit ELF
- Copyright 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002, 2005, 2007
+ Free Software Foundation, Inc.
Contributed by Steve Chamberlan of Transmeta (sac@pobox.com).
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +19,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -291,6 +292,22 @@ pj_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return NULL;
}
+static reloc_howto_type *
+pj_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (pj_elf_howto_table) / sizeof (pj_elf_howto_table[0]);
+ i++)
+ if (pj_elf_howto_table[i].name != NULL
+ && strcasecmp (pj_elf_howto_table[i].name, r_name) == 0)
+ return &pj_elf_howto_table[i];
+
+ return NULL;
+}
+
/* Given an ELF reloc, fill in the howto field of a relent. */
static void
@@ -326,8 +343,10 @@ pj_elf_final_write_processing (bfd *abfd,
#define ELF_MACHINE_CODE EM_PJ
#define ELF_MACHINE_ALT1 EM_PJ_OLD
#define ELF_MAXPAGESIZE 0x1000
-#define bfd_elf32_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
-#define bfd_elf32_bfd_reloc_type_lookup pj_elf_reloc_type_lookup
-#define elf_backend_final_write_processing pj_elf_final_write_processing
-#define elf_info_to_howto pj_elf_info_to_howto
+#define bfd_elf32_bfd_get_relocated_section_contents \
+ bfd_generic_get_relocated_section_contents
+#define bfd_elf32_bfd_reloc_type_lookup pj_elf_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup pj_elf_reloc_name_lookup
+#define elf_backend_final_write_processing pj_elf_final_write_processing
+#define elf_info_to_howto pj_elf_info_to_howto
#include "elf32-target.h"
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 53d1046bb8cb..d67ad866a6f0 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -1,6 +1,6 @@
/* PowerPC-specific support for 32-bit ELF
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005, 2006 Free Software Foundation, Inc.
+ 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -25,8 +25,9 @@
suggestions from the in-progress Embedded PowerPC ABI, and that
information may also not match. */
-#include "bfd.h"
#include "sysdep.h"
+#include <stdarg.h>
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -1577,6 +1578,22 @@ ppc_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return ppc_elf_howto_table[r];
};
+static reloc_howto_type *
+ppc_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (ppc_elf_howto_raw) / sizeof (ppc_elf_howto_raw[0]);
+ i++)
+ if (ppc_elf_howto_raw[i].name != NULL
+ && strcasecmp (ppc_elf_howto_raw[i].name, r_name) == 0)
+ return &ppc_elf_howto_raw[i];
+
+ return NULL;
+}
+
/* Set the howto pointer for a PowerPC ELF reloc. */
static void
@@ -1590,6 +1607,17 @@ ppc_elf_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
BFD_ASSERT (ELF32_R_TYPE (dst->r_info) < (unsigned int) R_PPC_max);
cache_ptr->howto = ppc_elf_howto_table[ELF32_R_TYPE (dst->r_info)];
+
+ /* Just because the above assert didn't trigger doesn't mean that
+ ELF32_R_TYPE (dst->r_info) is necessarily a valid relocation. */
+ if (!cache_ptr->howto)
+ {
+ (*_bfd_error_handler) (_("%B: invalid relocation type %d"),
+ abfd, ELF32_R_TYPE (dst->r_info));
+ bfd_set_error (bfd_error_bad_value);
+
+ cache_ptr->howto = ppc_elf_howto_table[R_PPC_NONE];
+ }
}
/* Handle the R_PPC_ADDR16_HA and R_PPC_REL16_HA relocs. */
@@ -1695,6 +1723,10 @@ struct ppc_elf_obj_tdata
/* A mapping from local symbols to offsets into the various linker
sections added. This is index by the symbol index. */
elf_linker_section_pointers_t **linker_section_pointers;
+
+ /* Flags used to auto-detect plt type. */
+ unsigned int makes_plt_call : 1;
+ unsigned int has_rel16 : 1;
};
#define ppc_elf_tdata(bfd) \
@@ -1708,11 +1740,14 @@ struct ppc_elf_obj_tdata
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;
+ {
+ bfd_size_type amt = sizeof (struct ppc_elf_obj_tdata);
+ abfd->tdata.any = bfd_zalloc (abfd, amt);
+ if (abfd->tdata.any == NULL)
+ return FALSE;
+ }
+ return bfd_elf_mkobject (abfd);
}
/* Fix bad default arch selected for a 32 bit input bfd when the
@@ -1810,6 +1845,52 @@ ppc_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
return TRUE;
}
+static char *
+ppc_elf_write_core_note (bfd *abfd, char *buf, int *bufsiz, int note_type, ...)
+{
+ switch (note_type)
+ {
+ default:
+ return NULL;
+
+ case NT_PRPSINFO:
+ {
+ char data[128];
+ va_list ap;
+
+ va_start (ap, note_type);
+ memset (data, 0, 32);
+ strncpy (data + 32, va_arg (ap, const char *), 16);
+ strncpy (data + 48, va_arg (ap, const char *), 80);
+ va_end (ap);
+ return elfcore_write_note (abfd, buf, bufsiz,
+ "CORE", note_type, data, sizeof (data));
+ }
+
+ case NT_PRSTATUS:
+ {
+ char data[268];
+ va_list ap;
+ long pid;
+ int cursig;
+ const void *greg;
+
+ va_start (ap, note_type);
+ memset (data, 0, 72);
+ pid = va_arg (ap, long);
+ bfd_put_32 (abfd, pid, data + 24);
+ cursig = va_arg (ap, int);
+ bfd_put_16 (abfd, cursig, data + 12);
+ greg = va_arg (ap, const void *);
+ memcpy (data + 72, greg, 192);
+ memset (data + 264, 0, 4);
+ va_end (ap);
+ return elfcore_write_note (abfd, buf, bufsiz,
+ "CORE", note_type, data, sizeof (data));
+ }
+ }
+}
+
/* Return address for Ith PLT stub in section PLT, for relocation REL
or (bfd_vma) -1 if it should not be included. */
@@ -1869,7 +1950,8 @@ ppc_elf_fake_sections (bfd *abfd ATTRIBUTE_UNUSED,
need to bump up the number of section headers. */
static int
-ppc_elf_additional_program_headers (bfd *abfd)
+ppc_elf_additional_program_headers (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
asection *s;
int ret = 0;
@@ -1892,21 +1974,21 @@ ppc_elf_additional_program_headers (bfd *abfd)
static const struct bfd_elf_special_section ppc_elf_special_sections[] =
{
- { ".plt", 4, 0, SHT_NOBITS, SHF_ALLOC + SHF_EXECINSTR },
- { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
- { ".sbss2", 6, -2, SHT_PROGBITS, SHF_ALLOC },
- { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".sdata2", 7, -2, SHT_PROGBITS, SHF_ALLOC },
- { ".tags", 5, 0, SHT_ORDERED, SHF_ALLOC },
- { ".PPC.EMB.apuinfo", 16, 0, SHT_NOTE, 0 },
- { ".PPC.EMB.sbss0", 14, 0, SHT_PROGBITS, SHF_ALLOC },
- { ".PPC.EMB.sdata0", 15, 0, SHT_PROGBITS, SHF_ALLOC },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".plt"), 0, SHT_NOBITS, SHF_ALLOC + SHF_EXECINSTR },
+ { STRING_COMMA_LEN (".sbss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".sbss2"), -2, SHT_PROGBITS, SHF_ALLOC },
+ { STRING_COMMA_LEN (".sdata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".sdata2"), -2, SHT_PROGBITS, SHF_ALLOC },
+ { STRING_COMMA_LEN (".tags"), 0, SHT_ORDERED, SHF_ALLOC },
+ { STRING_COMMA_LEN (".PPC.EMB.apuinfo"), 0, SHT_NOTE, 0 },
+ { STRING_COMMA_LEN (".PPC.EMB.sbss0"), 0, SHT_PROGBITS, SHF_ALLOC },
+ { STRING_COMMA_LEN (".PPC.EMB.sdata0"), 0, SHT_PROGBITS, SHF_ALLOC },
+ { NULL, 0, 0, 0, 0 }
};
/* This is what we want for new plt/got. */
static struct bfd_elf_special_section ppc_alt_plt =
- { ".plt", 4, 0, SHT_PROGBITS, SHF_ALLOC };
+ { STRING_COMMA_LEN (".plt"), 0, SHT_PROGBITS, SHF_ALLOC };
static const struct bfd_elf_special_section *
ppc_elf_get_sec_type_attr (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
@@ -2147,6 +2229,7 @@ ppc_elf_begin_write_processing (bfd *abfd, struct bfd_link_info *link_info)
static bfd_boolean
ppc_elf_write_section (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
asection *asec,
bfd_byte *contents ATTRIBUTE_UNUSED)
{
@@ -2313,13 +2396,6 @@ struct ppc_elf_link_hash_entry
#define ppc_elf_hash_entry(ent) ((struct ppc_elf_link_hash_entry *) (ent))
-enum ppc_elf_plt_type {
- PLT_UNSET,
- PLT_OLD,
- PLT_NEW,
- PLT_VXWORKS
-};
-
/* PPC ELF linker hash table. */
struct ppc_elf_link_hash_table
@@ -2339,9 +2415,18 @@ struct ppc_elf_link_hash_table
elf_linker_section_t sdata[2];
asection *sbss;
+ /* The (unloaded but important) .rela.plt.unloaded on VxWorks. */
+ asection *srelplt2;
+
+ /* The .got.plt section (VxWorks only)*/
+ asection *sgotplt;
+
/* Shortcut to .__tls_get_addr. */
struct elf_link_hash_entry *tls_get_addr;
+ /* The bfd that forced an old-style PLT. */
+ bfd *old_bfd;
+
/* TLS local dynamic got entry handling. */
union {
bfd_signed_vma refcount;
@@ -2359,23 +2444,11 @@ struct ppc_elf_link_hash_table
/* The type of PLT we have chosen to use. */
enum ppc_elf_plt_type plt_type;
- /* Whether we can use the new PLT layout. */
- unsigned int can_use_new_plt:1;
-
/* Set if we should emit symbols for stubs. */
unsigned int emit_stub_syms:1;
- /* Small local sym to section mapping cache. */
- struct sym_sec_cache sym_sec;
-
- /* The (unloaded but important) .rela.plt.unloaded on VxWorks. */
- asection *srelplt2;
-
- /* The .got.plt section (VxWorks only)*/
- asection *sgotplt;
-
/* True if the target system is VxWorks. */
- int is_vxworks;
+ unsigned int is_vxworks:1;
/* The size of PLT entries. */
int plt_entry_size;
@@ -2383,6 +2456,9 @@ struct ppc_elf_link_hash_table
int plt_slot_size;
/* The size of the first PLT entry. */
int plt_initial_entry_size;
+
+ /* Small local sym to section mapping cache. */
+ struct sym_sec_cache sym_sec;
};
/* Get the PPC ELF linker hash table from a link_info structure. */
@@ -2454,8 +2530,6 @@ ppc_elf_link_hash_table_create (bfd *abfd)
ret->plt_entry_size = 12;
ret->plt_slot_size = 8;
ret->plt_initial_entry_size = 72;
-
- ret->is_vxworks = 0;
return &ret->elf.root;
}
@@ -3225,8 +3299,13 @@ ppc_elf_check_relocs (bfd *abfd,
}
else
{
- bfd_vma addend = r_type == R_PPC_PLTREL24 ? rel->r_addend : 0;
+ bfd_vma addend = 0;
+ if (r_type == R_PPC_PLTREL24)
+ {
+ ppc_elf_tdata (abfd)->makes_plt_call = 1;
+ addend = rel->r_addend;
+ }
h->needs_plt = 1;
if (!update_plt_info (abfd, h, got2, addend))
return FALSE;
@@ -3251,7 +3330,7 @@ ppc_elf_check_relocs (bfd *abfd,
case R_PPC_REL16_LO:
case R_PPC_REL16_HI:
case R_PPC_REL16_HA:
- htab->can_use_new_plt = 1;
+ ppc_elf_tdata (abfd)->has_rel16 = 1;
break;
/* These are just markers. */
@@ -3280,7 +3359,10 @@ ppc_elf_check_relocs (bfd *abfd,
/* This refers only to functions defined in the shared library. */
case R_PPC_LOCAL24PC:
if (h && h == htab->elf.hgot && htab->plt_type == PLT_UNSET)
- htab->plt_type = PLT_OLD;
+ {
+ htab->plt_type = PLT_OLD;
+ htab->old_bfd = abfd;
+ }
break;
/* This relocation describes the C++ object vtable hierarchy.
@@ -3334,7 +3416,10 @@ ppc_elf_check_relocs (bfd *abfd,
s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, sec,
r_symndx);
if (s == got2)
- htab->plt_type = PLT_OLD;
+ {
+ htab->plt_type = PLT_OLD;
+ htab->old_bfd = abfd;
+ }
}
if (h == NULL || h == htab->elf.hgot)
break;
@@ -3349,7 +3434,10 @@ ppc_elf_check_relocs (bfd *abfd,
if (h == htab->elf.hgot)
{
if (htab->plt_type == PLT_UNSET)
- htab->plt_type = PLT_OLD;
+ {
+ htab->plt_type = PLT_OLD;
+ htab->old_bfd = abfd;
+ }
break;
}
/* fall through */
@@ -3432,7 +3520,7 @@ ppc_elf_check_relocs (bfd *abfd,
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (abfd, sec),
name + 5) == 0);
@@ -3506,6 +3594,62 @@ ppc_elf_check_relocs (bfd *abfd,
return TRUE;
}
+
+/* Merge object attributes from IBFD into OBFD. Raise an error if
+ there are conflicting attributes. */
+static bfd_boolean
+ppc_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
+{
+ obj_attribute *in_attr;
+ obj_attribute *out_attr;
+
+ if (!elf_known_obj_attributes_proc (obfd)[0].i)
+ {
+ /* This is the first object. Copy the attributes. */
+ _bfd_elf_copy_obj_attributes (ibfd, obfd);
+
+ /* Use the Tag_null value to indicate the attributes have been
+ initialized. */
+ elf_known_obj_attributes_proc (obfd)[0].i = 1;
+
+ return TRUE;
+ }
+
+ /* Check for conflicting Tag_GNU_Power_ABI_FP attributes and merge
+ non-conflicting ones. */
+ in_attr = elf_known_obj_attributes (ibfd)[OBJ_ATTR_GNU];
+ out_attr = elf_known_obj_attributes (obfd)[OBJ_ATTR_GNU];
+ if (in_attr[Tag_GNU_Power_ABI_FP].i != out_attr[Tag_GNU_Power_ABI_FP].i)
+ {
+ out_attr[Tag_GNU_Power_ABI_FP].type = 1;
+ if (out_attr[Tag_GNU_Power_ABI_FP].i == 0)
+ out_attr[Tag_GNU_Power_ABI_FP].i = in_attr[Tag_GNU_Power_ABI_FP].i;
+ else if (in_attr[Tag_GNU_Power_ABI_FP].i == 0)
+ ;
+ else if (out_attr[Tag_GNU_Power_ABI_FP].i == 1
+ && in_attr[Tag_GNU_Power_ABI_FP].i == 2)
+ _bfd_error_handler
+ (_("Warning: %B uses hard float, %B uses soft float"), obfd, ibfd);
+ else if (out_attr[Tag_GNU_Power_ABI_FP].i == 2
+ && in_attr[Tag_GNU_Power_ABI_FP].i == 1)
+ _bfd_error_handler
+ (_("Warning: %B uses hard float, %B uses soft float"), ibfd, obfd);
+ else if (in_attr[Tag_GNU_Power_ABI_FP].i > 2)
+ _bfd_error_handler
+ (_("Warning: %B uses unknown floating point ABI %d"), ibfd,
+ in_attr[Tag_GNU_Power_ABI_FP].i);
+ else
+ _bfd_error_handler
+ (_("Warning: %B uses unknown floating point ABI %d"), obfd,
+ out_attr[Tag_GNU_Power_ABI_FP].i);
+ }
+
+ /* Merge Tag_compatibility attributes and any common GNU ones. */
+ _bfd_elf_merge_object_attributes (ibfd, obfd);
+
+ return TRUE;
+}
+
/* Merge backend specific data from an object file to the output
object file when linking. */
@@ -3524,6 +3668,9 @@ ppc_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
if (! _bfd_generic_verify_endian_match (ibfd, obfd))
return FALSE;
+ if (!ppc_elf_merge_obj_attributes (ibfd, obfd))
+ return FALSE;
+
new_flags = elf_elfheader (ibfd)->e_flags;
old_flags = elf_elfheader (obfd)->e_flags;
if (!elf_flags_init (obfd))
@@ -3603,7 +3750,7 @@ ppc_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
int
ppc_elf_select_plt_layout (bfd *output_bfd ATTRIBUTE_UNUSED,
struct bfd_link_info *info,
- int force_old_plt,
+ enum ppc_elf_plt_type plt_style,
int emit_stub_syms)
{
struct ppc_elf_link_hash_table *htab;
@@ -3612,8 +3759,37 @@ ppc_elf_select_plt_layout (bfd *output_bfd ATTRIBUTE_UNUSED,
htab = ppc_elf_hash_table (info);
if (htab->plt_type == PLT_UNSET)
- htab->plt_type = (force_old_plt || !htab->can_use_new_plt
- ? PLT_OLD : PLT_NEW);
+ {
+ if (plt_style == PLT_OLD)
+ htab->plt_type = PLT_OLD;
+ else
+ {
+ bfd *ibfd;
+ enum ppc_elf_plt_type plt_type = plt_style;
+
+ /* Look through the reloc flags left by ppc_elf_check_relocs.
+ Use the old style bss plt if a file makes plt calls
+ without using the new relocs, and if ld isn't given
+ --secure-plt and we never see REL16 relocs. */
+ if (plt_type == PLT_UNSET)
+ plt_type = PLT_OLD;
+ for (ibfd = info->input_bfds; ibfd; ibfd = ibfd->link_next)
+ if (is_ppc_elf_target (ibfd->xvec))
+ {
+ if (ppc_elf_tdata (ibfd)->has_rel16)
+ plt_type = PLT_NEW;
+ else if (ppc_elf_tdata (ibfd)->makes_plt_call)
+ {
+ plt_type = PLT_OLD;
+ htab->old_bfd = ibfd;
+ break;
+ }
+ }
+ htab->plt_type = plt_type;
+ }
+ }
+ if (htab->plt_type == PLT_OLD && plt_style == PLT_NEW)
+ info->callbacks->info (_("Using bss-plt due to %B"), htab->old_bfd);
htab->emit_stub_syms = emit_stub_syms;
@@ -3649,38 +3825,20 @@ ppc_elf_select_plt_layout (bfd *output_bfd ATTRIBUTE_UNUSED,
static asection *
ppc_elf_gc_mark_hook (asection *sec,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info,
Elf_Internal_Rela *rel,
struct elf_link_hash_entry *h,
Elf_Internal_Sym *sym)
{
if (h != NULL)
- {
- switch (ELF32_R_TYPE (rel->r_info))
- {
- case R_PPC_GNU_VTINHERIT:
- case R_PPC_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
+ switch (ELF32_R_TYPE (rel->r_info))
+ {
+ case R_PPC_GNU_VTINHERIT:
+ case R_PPC_GNU_VTENTRY:
+ return NULL;
+ }
- return NULL;
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
/* Update the got, plt and dynamic reloc reference counts for the
@@ -4048,7 +4206,6 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
{
struct ppc_elf_link_hash_table *htab;
asection *s;
- unsigned int power_of_two;
#ifdef DEBUG
fprintf (stderr, "ppc_elf_adjust_dynamic_symbol called for %s\n",
@@ -4190,28 +4347,7 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
h->needs_copy = 1;
}
- /* We need to figure out the alignment required for this symbol. I
- have no idea how ELF linkers handle this. */
- power_of_two = bfd_log2 (h->size);
- if (power_of_two > 4)
- power_of_two = 4;
-
- /* Apply the required alignment. */
- s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two));
- if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s))
- {
- if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two))
- return FALSE;
- }
-
- /* Define the symbol as being at this point in the section. */
- h->root.u.def.section = s;
- h->root.u.def.value = s->size;
-
- /* Increment the section size to make room for the symbol. */
- s->size += h->size;
-
- return TRUE;
+ return _bfd_elf_adjust_dynamic_copy (h, s);
}
/* Generate a symbol to mark plt call stubs. For non-PIC code the sym is
@@ -4450,13 +4586,15 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
}
else
ent->plt.offset = (bfd_vma) -1;
-
- if (!doneone)
- {
- h->plt.plist = NULL;
- h->needs_plt = 0;
- }
}
+ else
+ ent->plt.offset = (bfd_vma) -1;
+
+ if (!doneone)
+ {
+ h->plt.plist = NULL;
+ h->needs_plt = 0;
+ }
}
else
{
@@ -4860,7 +4998,7 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
{
/* Strip these too. */
}
- else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0)
+ else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela"))
{
if (s->size != 0)
{
@@ -5518,6 +5656,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
asection *got2, *sreloc = NULL;
bfd_vma *local_got_offsets;
bfd_boolean ret = TRUE;
+ bfd_vma d_offset = (bfd_big_endian (output_bfd) ? 2 : 0);
#ifdef DEBUG
_bfd_error_handler ("ppc_elf_relocate_section called for %B section %A, "
@@ -5529,29 +5668,6 @@ ppc_elf_relocate_section (bfd *output_bfd,
got2 = bfd_get_section_by_name (input_bfd, ".got2");
- if (info->relocatable)
- {
- if (got2 == NULL)
- return TRUE;
-
- rel = relocs;
- relend = relocs + input_section->reloc_count;
- for (; rel < relend; rel++)
- {
- enum elf_ppc_reloc_type r_type;
-
- r_type = ELF32_R_TYPE (rel->r_info);
- if (r_type == R_PPC_PLTREL24
- && rel->r_addend >= 32768)
- {
- /* R_PPC_PLTREL24 is rather special. If non-zero, the
- addend specifies the GOT pointer offset within .got2. */
- rel->r_addend += got2->output_offset;
- }
- }
- return TRUE;
- }
-
/* Initialize howto table if not already done. */
if (!ppc_elf_howto_table[R_PPC_ADDR32])
ppc_elf_howto_init ();
@@ -5605,6 +5721,33 @@ ppc_elf_relocate_section (bfd *output_bfd,
sym_name = h->root.root.string;
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ howto = NULL;
+ if (r_type < R_PPC_max)
+ howto = ppc_elf_howto_table[r_type];
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ {
+ if (got2 != NULL
+ && r_type == R_PPC_PLTREL24
+ && rel->r_addend >= 32768)
+ {
+ /* R_PPC_PLTREL24 is rather special. If non-zero, the
+ addend specifies the GOT pointer offset within .got2. */
+ rel->r_addend += got2->output_offset;
+ }
+ continue;
+ }
+
/* TLS optimizations. Replace instruction sequences and relocs
based on information we collected in tls_optimize. We edit
RELOCS so that --emit-relocs will output something sensible
@@ -5644,10 +5787,10 @@ ppc_elf_relocate_section (bfd *output_bfd,
&& (tls_mask & TLS_TPREL) == 0)
{
bfd_vma insn;
- insn = bfd_get_32 (output_bfd, contents + rel->r_offset - 2);
+ insn = bfd_get_32 (output_bfd, contents + rel->r_offset - d_offset);
insn &= 31 << 21;
insn |= 0x3c020000; /* addis 0,2,0 */
- bfd_put_32 (output_bfd, insn, contents + rel->r_offset - 2);
+ bfd_put_32 (output_bfd, insn, contents + rel->r_offset - d_offset);
r_type = R_PPC_TPREL16_HA;
rel->r_info = ELF32_R_INFO (r_symndx, r_type);
}
@@ -5691,9 +5834,10 @@ ppc_elf_relocate_section (bfd *output_bfd,
bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
r_type = R_PPC_TPREL16_LO;
rel->r_info = ELF32_R_INFO (r_symndx, r_type);
+
/* Was PPC_TLS which sits on insn boundary, now
- PPC_TPREL16_LO which is at insn+2. */
- rel->r_offset += 2;
+ PPC_TPREL16_LO which is at low-order half-word. */
+ rel->r_offset += d_offset;
}
break;
@@ -5715,7 +5859,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
else
{
bfd_put_32 (output_bfd, NOP, contents + rel->r_offset);
- rel->r_offset -= 2;
+ rel->r_offset -= d_offset;
r_type = R_PPC_NONE;
}
rel->r_info = ELF32_R_INFO (r_symndx, r_type);
@@ -5764,7 +5908,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
/* OK, it checks out. Replace the call. */
offset = rel[1].r_offset;
insn1 = bfd_get_32 (output_bfd,
- contents + rel->r_offset - 2);
+ contents + rel->r_offset - d_offset);
if ((tls_mask & tls_gd) != 0)
{
/* IE */
@@ -5792,10 +5936,10 @@ ppc_elf_relocate_section (bfd *output_bfd,
rel->r_info = ELF32_R_INFO (r_symndx, r_type);
rel[1].r_info = ELF32_R_INFO (r_symndx,
R_PPC_TPREL16_LO);
- rel[1].r_offset += 2;
+ rel[1].r_offset += d_offset;
rel[1].r_addend = rel->r_addend;
}
- bfd_put_32 (output_bfd, insn1, contents + rel->r_offset - 2);
+ bfd_put_32 (output_bfd, insn1, contents + rel->r_offset - d_offset);
bfd_put_32 (output_bfd, insn2, contents + offset);
if (tls_gd == 0)
{
@@ -6189,14 +6333,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
case R_PPC_ADDR14_BRNTAKEN:
case R_PPC_UADDR32:
case R_PPC_UADDR16:
- /* r_symndx will be zero only for relocs against symbols
- from removed linkonce sections, or sections discarded by
- a linker script. */
dodyn:
- if (r_symndx == 0)
- break;
- /* Fall thru. */
-
if ((input_section->flags & SEC_ALLOC) == 0)
break;
/* Fall thru. */
@@ -6238,7 +6375,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (input_bfd,
input_section),
name + 5) == 0);
@@ -6294,10 +6431,15 @@ ppc_elf_relocate_section (bfd *output_bfd,
but ld.so expects buggy relocs. */
osec = sec->output_section;
indx = elf_section_data (osec)->dynindx;
- BFD_ASSERT (indx > 0);
+ if (indx == 0)
+ {
+ osec = htab->elf.text_index_section;
+ indx = elf_section_data (osec)->dynindx;
+ }
+ BFD_ASSERT (indx != 0);
#ifdef DEBUG
- if (indx <= 0)
- printf ("indx=%d section=%s flags=%08x name=%s\n",
+ if (indx == 0)
+ printf ("indx=%ld section=%s flags=%08x name=%s\n",
indx, osec->name, osec->flags,
h->root.root.string);
#endif
@@ -6441,9 +6583,9 @@ ppc_elf_relocate_section (bfd *output_bfd,
BFD_ASSERT (sec != NULL);
name = bfd_get_section_name (abfd, sec->output_section);
- if (! ((strncmp (name, ".sdata", 6) == 0
+ if (! ((CONST_STRNEQ (name, ".sdata")
&& (name[6] == 0 || name[6] == '.'))
- || (strncmp (name, ".sbss", 5) == 0
+ || (CONST_STRNEQ (name, ".sbss")
&& (name[5] == 0 || name[5] == '.'))))
{
(*_bfd_error_handler)
@@ -6469,8 +6611,8 @@ ppc_elf_relocate_section (bfd *output_bfd,
BFD_ASSERT (sec != NULL);
name = bfd_get_section_name (abfd, sec->output_section);
- if (! (strncmp (name, ".sdata2", 7) == 0
- || strncmp (name, ".sbss2", 6) == 0))
+ if (! (CONST_STRNEQ (name, ".sdata2")
+ || CONST_STRNEQ (name, ".sbss2")))
{
(*_bfd_error_handler)
(_("%B: the target (%s) of a %s relocation is "
@@ -6501,9 +6643,9 @@ ppc_elf_relocate_section (bfd *output_bfd,
BFD_ASSERT (sec != NULL);
name = bfd_get_section_name (abfd, sec->output_section);
- if (((strncmp (name, ".sdata", 6) == 0
+ if (((CONST_STRNEQ (name, ".sdata")
&& (name[6] == 0 || name[6] == '.'))
- || (strncmp (name, ".sbss", 5) == 0
+ || (CONST_STRNEQ (name, ".sbss")
&& (name[5] == 0 || name[5] == '.'))))
{
reg = 13;
@@ -6513,8 +6655,8 @@ ppc_elf_relocate_section (bfd *output_bfd,
+ sh->root.u.def.section->output_section->vma);
}
- else if (strncmp (name, ".sdata2", 7) == 0
- || strncmp (name, ".sbss2", 6) == 0)
+ else if (CONST_STRNEQ (name, ".sdata2")
+ || CONST_STRNEQ (name, ".sbss2"))
{
reg = 2;
sh = htab->sdata[1].sym;
@@ -6605,25 +6747,28 @@ ppc_elf_relocate_section (bfd *output_bfd,
case R_PPC_ADDR16_HA:
case R_PPC_REL16_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;
+ if (sec == NULL)
+ break;
+ /* Fall thru */
+
+ case R_PPC_PLT16_HA:
+ case R_PPC_GOT16_HA:
+ case R_PPC_GOT_TLSGD16_HA:
+ case R_PPC_GOT_TLSLD16_HA:
+ case R_PPC_GOT_TPREL16_HA:
+ case R_PPC_GOT_DTPREL16_HA:
+ /* Add 0x10000 if sign bit in 0:15 is set.
+ Bits 0:15 are not used. */
+ addend += 0x8000;
break;
}
@@ -7436,6 +7581,7 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd,
#define ELF_MAXPAGESIZE 0x10000
#endif
#define ELF_MINPAGESIZE 0x1000
+#define ELF_COMMONPAGESIZE 0x1000
#define elf_info_to_howto ppc_elf_info_to_howto
#ifdef EM_CYGNUS_POWERPC
@@ -7455,6 +7601,7 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd,
#define bfd_elf32_bfd_merge_private_bfd_data ppc_elf_merge_private_bfd_data
#define bfd_elf32_bfd_relax_section ppc_elf_relax_section
#define bfd_elf32_bfd_reloc_type_lookup ppc_elf_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup ppc_elf_reloc_name_lookup
#define bfd_elf32_bfd_set_private_flags ppc_elf_set_private_flags
#define bfd_elf32_bfd_link_hash_table_create ppc_elf_link_hash_table_create
@@ -7475,6 +7622,7 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd,
#define elf_backend_additional_program_headers ppc_elf_additional_program_headers
#define elf_backend_grok_prstatus ppc_elf_grok_prstatus
#define elf_backend_grok_psinfo ppc_elf_grok_psinfo
+#define elf_backend_write_core_note ppc_elf_write_core_note
#define elf_backend_reloc_type_class ppc_elf_reloc_type_class
#define elf_backend_begin_write_processing ppc_elf_begin_write_processing
#define elf_backend_final_write_processing ppc_elf_final_write_processing
@@ -7482,6 +7630,7 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd,
#define elf_backend_get_sec_type_attr ppc_elf_get_sec_type_attr
#define elf_backend_plt_sym_val ppc_elf_plt_sym_val
#define elf_backend_action_discarded ppc_elf_action_discarded
+#define elf_backend_init_index_section _bfd_elf_init_1_index_section
#include "elf32-target.h"
diff --git a/bfd/elf32-ppc.h b/bfd/elf32-ppc.h
index 5f8f63a38a59..f5383a7bb587 100644
--- a/bfd/elf32-ppc.h
+++ b/bfd/elf32-ppc.h
@@ -1,5 +1,5 @@
/* PowerPC-specific support for 64-bit ELF.
- Copyright 2003, 2005 Free Software Foundation, Inc.
+ Copyright 2003, 2005, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,7 +17,15 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-int ppc_elf_select_plt_layout (bfd *, struct bfd_link_info *, int, int);
+enum ppc_elf_plt_type {
+ PLT_UNSET,
+ PLT_OLD,
+ PLT_NEW,
+ PLT_VXWORKS
+};
+
+int ppc_elf_select_plt_layout (bfd *, struct bfd_link_info *,
+ enum ppc_elf_plt_type, int);
asection *ppc_elf_tls_setup (bfd *, struct bfd_link_info *);
bfd_boolean ppc_elf_tls_optimize (bfd *, struct bfd_link_info *);
void ppc_elf_set_sdata_syms (bfd *, struct bfd_link_info *);
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index eb8e1724fc19..9e36a5d57465 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -1,5 +1,5 @@
/* IBM S/390-specific support for 32-bit ELF
- Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Contributed by Carl B. Pedersen and Martin Schwidefsky.
@@ -20,8 +20,8 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -46,12 +46,6 @@ static void elf_s390_copy_indirect_symbol
static bfd_boolean elf_s390_check_relocs
PARAMS ((bfd *, struct bfd_link_info *, asection *,
const Elf_Internal_Rela *));
-static asection *elf_s390_gc_mark_hook
- PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *, Elf_Internal_Sym *));
-static bfd_boolean elf_s390_gc_sweep_hook
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- const Elf_Internal_Rela *));
struct elf_s390_link_hash_entry;
static void elf_s390_adjust_gotplt
PARAMS ((struct elf_s390_link_hash_entry *));
@@ -73,8 +67,6 @@ static enum elf_reloc_type_class elf_s390_reloc_type_class
PARAMS ((const Elf_Internal_Rela *));
static bfd_boolean elf_s390_finish_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean elf_s390_mkobject
- PARAMS ((bfd *));
static bfd_boolean elf_s390_object_p
PARAMS ((bfd *));
static bfd_boolean elf_s390_grok_prstatus
@@ -342,6 +334,25 @@ elf_s390_reloc_type_lookup (abfd, code)
return 0;
}
+static reloc_howto_type *
+elf_s390_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0; i < sizeof (elf_howto_table) / sizeof (elf_howto_table[0]); i++)
+ if (elf_howto_table[i].name != NULL
+ && strcasecmp (elf_howto_table[i].name, r_name) == 0)
+ return &elf_howto_table[i];
+
+ if (strcasecmp (elf32_s390_vtinherit_howto.name, r_name) == 0)
+ return &elf32_s390_vtinherit_howto;
+ if (strcasecmp (elf32_s390_vtentry_howto.name, r_name) == 0)
+ return &elf32_s390_vtentry_howto;
+
+ return NULL;
+}
+
/* We need to use ELF32_R_TYPE so we have our own copy of this function,
and elf32-s390.c has its own copy. */
@@ -678,14 +689,16 @@ struct elf_s390_obj_tdata
(elf_s390_tdata (abfd)->local_got_tls_type)
static bfd_boolean
-elf_s390_mkobject (abfd)
- bfd *abfd;
+elf_s390_mkobject (bfd *abfd)
{
- bfd_size_type amt = sizeof (struct elf_s390_obj_tdata);
- abfd->tdata.any = bfd_zalloc (abfd, amt);
if (abfd->tdata.any == NULL)
- return FALSE;
- return TRUE;
+ {
+ bfd_size_type amt = sizeof (struct elf_s390_obj_tdata);
+ abfd->tdata.any = bfd_zalloc (abfd, amt);
+ if (abfd->tdata.any == NULL)
+ return FALSE;
+ }
+ return bfd_elf_mkobject (abfd);
}
static bfd_boolean
@@ -1273,7 +1286,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
if (name == NULL)
return FALSE;
- if (strncmp (name, ".rela", 5) != 0
+ if (! CONST_STRNEQ (name, ".rela")
|| strcmp (bfd_get_section_name (abfd, sec),
name + 5) != 0)
{
@@ -1379,50 +1392,30 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
relocation. */
static asection *
-elf_s390_gc_mark_hook (sec, info, rel, h, sym)
- asection *sec;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- Elf_Internal_Rela *rel;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
+elf_s390_gc_mark_hook (asection *sec,
+ struct bfd_link_info *info,
+ Elf_Internal_Rela *rel,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
{
if (h != NULL)
- {
- switch (ELF32_R_TYPE (rel->r_info))
- {
- case R_390_GNU_VTINHERIT:
- case R_390_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
+ switch (ELF32_R_TYPE (rel->r_info))
+ {
+ case R_390_GNU_VTINHERIT:
+ case R_390_GNU_VTENTRY:
+ return NULL;
+ }
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
-
- return NULL;
}
/* Update the got entry reference counts for the section being removed. */
static bfd_boolean
-elf_s390_gc_sweep_hook (abfd, info, sec, relocs)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *sec;
- const Elf_Internal_Rela *relocs;
+elf_s390_gc_sweep_hook (bfd *abfd,
+ struct bfd_link_info *info,
+ asection *sec,
+ const Elf_Internal_Rela *relocs)
{
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
@@ -1589,7 +1582,6 @@ elf_s390_adjust_dynamic_symbol (info, h)
{
struct elf_s390_link_hash_table *htab;
asection *s;
- unsigned int power_of_two;
/* If this is a function, put it in the procedure linkage table. We
will fill in the contents of the procedure linkage table later
@@ -1710,29 +1702,9 @@ elf_s390_adjust_dynamic_symbol (info, h)
h->needs_copy = 1;
}
- /* We need to figure out the alignment required for this symbol. I
- have no idea how ELF linkers handle this. */
- power_of_two = bfd_log2 (h->size);
- if (power_of_two > 3)
- power_of_two = 3;
-
- /* Apply the required alignment. */
s = htab->sdynbss;
- s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two));
- if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s))
- {
- if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two))
- return FALSE;
- }
-
- /* Define the symbol as being at this point in the section. */
- h->root.u.def.section = s;
- h->root.u.def.value = s->size;
- /* Increment the section size to make room for the symbol. */
- s->size += h->size;
-
- return TRUE;
+ return _bfd_elf_adjust_dynamic_copy (h, s);
}
/* Allocate space in .plt, .got and associated reloc sections for
@@ -2126,7 +2098,7 @@ elf_s390_size_dynamic_sections (output_bfd, info)
/* Strip this section if we don't need it; see the
comment below. */
}
- else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0)
+ else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela"))
{
if (s->size != 0)
relocs = TRUE;
@@ -2268,6 +2240,7 @@ invalid_tls_insn (input_bfd, input_section, rel)
input_section,
(long) rel->r_offset,
howto->name);
+ bfd_set_error (bfd_error_bad_value);
}
/* Relocate a 390 ELF section. */
@@ -2291,9 +2264,6 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
- if (info->relocatable)
- return TRUE;
-
htab = elf_s390_hash_table (info);
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
@@ -2328,7 +2298,6 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
howto = elf_howto_table + r_type;
r_symndx = ELF32_R_SYM (rel->r_info);
- /* This is a final link. */
h = NULL;
sym = NULL;
sec = NULL;
@@ -2349,6 +2318,20 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
unresolved_reloc, warned);
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
switch (r_type)
{
case R_390_GOTPLT12:
@@ -2565,11 +2548,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
case R_390_PC16DBL:
case R_390_PC32DBL:
case R_390_PC32:
- /* r_symndx will be zero only for relocs against symbols
- from removed linkonce sections, or sections discarded by
- a linker script. */
- if (r_symndx == 0
- || (input_section->flags & SEC_ALLOC) == 0)
+ if ((input_section->flags & SEC_ALLOC) == 0)
break;
if ((info->shared
@@ -2655,14 +2634,18 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
osec = sec->output_section;
sindx = elf_section_data (osec)->dynindx;
- BFD_ASSERT (sindx > 0);
+ if (sindx == 0)
+ {
+ osec = htab->elf.text_index_section;
+ sindx = elf_section_data (osec)->dynindx;
+ }
+ BFD_ASSERT (sindx != 0);
/* We are turning this relocation into one
against a section symbol, so subtract out
the output section's address but not the
offset of the input section in the output
section. */
-
outrel.r_addend -= osec->vma;
}
outrel.r_info = ELF32_R_INFO (sindx, r_type);
@@ -2926,7 +2909,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
continue;
case R_390_TLS_LDO32:
- if (info->shared || (input_section->flags & SEC_CODE) == 0)
+ if (info->shared)
relocation -= dtpoff_base (info);
else
/* When converting LDO to LE, we must negate. */
@@ -2982,16 +2965,44 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
unsigned int insn;
insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
- if ((insn & 0xff000fff) != 0x4d000000)
+ if ((insn & 0xff000fff) != 0x4d000000 &&
+ (insn & 0xffff0000) != 0xc0e50000)
invalid_tls_insn (input_bfd, input_section, rel);
if (!info->shared && (h == NULL || h->dynindx == -1))
- /* GD->LE transition.
- bas %r14,0(%rx,%r13) -> bc 0,0 */
- insn = 0x47000000;
+ {
+ if ((insn & 0xff000000) == 0x4d000000)
+ {
+ /* GD->LE transition.
+ bas %r14,0(%rx,%r13) -> bc 0,0 */
+ insn = 0x47000000;
+ }
+ else
+ {
+ /* GD->LE transition.
+ brasl %r14,_tls_get_addr@plt -> brcl 0,. */
+ insn = 0xc0040000;
+ bfd_put_16 (output_bfd, 0x0000,
+ contents + rel->r_offset + 4);
+ }
+ }
else
- /* GD->IE transition.
- bas %r14,0(%rx,%r13) -> l %r2,0(%r2,%r12) */
- insn = 0x5822c000;
+ {
+ if ((insn & 0xff000000) == 0x4d000000)
+ {
+ /* GD->IE transition.
+ bas %r14,0(%rx,%r13) -> l %r2,0(%r2,%r12) */
+ insn = 0x5822c000;
+ }
+ else
+ {
+ /* GD->IE transition.
+ brasl %r14,__tls_get_addr@plt ->
+ l %r2,0(%r2,%r12) ; bcr 0,0 */
+ insn = 0x5822c000;
+ bfd_put_16 (output_bfd, 0x0700,
+ contents + rel->r_offset + 4);
+ }
+ }
bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
}
else if (r_type == R_390_TLS_LDCALL)
@@ -3001,11 +3012,23 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
unsigned int insn;
insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
- if ((insn & 0xff000fff) != 0x4d000000)
+ if ((insn & 0xff000fff) != 0x4d000000 &&
+ (insn & 0xffff0000) != 0xc0e50000)
invalid_tls_insn (input_bfd, input_section, rel);
- /* LD->LE transition.
- bas %r14,0(%rx,%r13) -> bc 0,0 */
- insn = 0x47000000;
+ if ((insn & 0xff000000) == 0x4d000000)
+ {
+ /* LD->LE transition.
+ bas %r14,0(%rx,%r13) -> bc 0,0 */
+ insn = 0x47000000;
+ }
+ else
+ {
+ /* LD->LE transition.
+ brasl %r14,__tls_get_addr@plt -> brcl 0,. */
+ insn = 0xc0040000;
+ bfd_put_16 (output_bfd, 0x0000,
+ contents + rel->r_offset + 4);
+ }
bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
}
}
@@ -3515,6 +3538,7 @@ elf_s390_plt_sym_val (bfd_vma i, const asection *plt,
#define bfd_elf32_bfd_is_local_label_name elf_s390_is_local_label_name
#define bfd_elf32_bfd_link_hash_table_create elf_s390_link_hash_table_create
#define bfd_elf32_bfd_reloc_type_lookup elf_s390_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup elf_s390_reloc_name_lookup
#define elf_backend_adjust_dynamic_symbol elf_s390_adjust_dynamic_symbol
#define elf_backend_check_relocs elf_s390_check_relocs
@@ -3527,6 +3551,7 @@ elf_s390_plt_sym_val (bfd_vma i, const asection *plt,
#define elf_backend_reloc_type_class elf_s390_reloc_type_class
#define elf_backend_relocate_section elf_s390_relocate_section
#define elf_backend_size_dynamic_sections elf_s390_size_dynamic_sections
+#define elf_backend_init_index_section _bfd_elf_init_1_index_section
#define elf_backend_reloc_type_class elf_s390_reloc_type_class
#define elf_backend_grok_prstatus elf_s390_grok_prstatus
#define elf_backend_plt_sym_val elf_s390_plt_sym_val
diff --git a/bfd/elf32-score.c b/bfd/elf32-score.c
new file mode 100644
index 000000000000..070177b15075
--- /dev/null
+++ b/bfd/elf32-score.c
@@ -0,0 +1,3883 @@
+/* 32-bit ELF support for S+core.
+ Copyright 2006, 2007 Free Software Foundation, Inc.
+ Contributed by
+ Mei Ligang (ligang@sunnorth.com.cn)
+ Pei-Lin Tsai (pltsai@sunplus.com)
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "libbfd.h"
+#include "libiberty.h"
+#include "elf-bfd.h"
+#include "elf/score.h"
+#include "elf/common.h"
+#include "elf/internal.h"
+#include "hashtab.h"
+
+
+/* Score ELF linker hash table. */
+
+struct score_elf_link_hash_table
+{
+ /* The main hash table. */
+ struct elf_link_hash_table root;
+};
+
+/* The SCORE ELF linker needs additional information for each symbol in
+ the global hash table. */
+
+struct score_elf_link_hash_entry
+{
+ struct elf_link_hash_entry root;
+
+ /* Number of R_SCORE_ABS32, R_SCORE_REL32 relocs against this symbol. */
+ unsigned int possibly_dynamic_relocs;
+
+ /* If the R_SCORE_ABS32, R_SCORE_REL32 reloc is against a readonly section. */
+ bfd_boolean readonly_reloc;
+
+ /* We must not create a stub for a symbol that has relocations related to
+ taking the function's address, i.e. any but R_SCORE_CALL15 ones. */
+ bfd_boolean no_fn_stub;
+
+ /* Are we forced local? This will only be set if we have converted
+ the initial global GOT entry to a local GOT entry. */
+ bfd_boolean forced_local;
+};
+
+/* Traverse a score ELF linker hash table. */
+#define score_elf_link_hash_traverse(table, func, info) \
+ (elf_link_hash_traverse \
+ (&(table)->root, \
+ (bfd_boolean (*) (struct elf_link_hash_entry *, void *)) (func), \
+ (info)))
+
+/* Get the SCORE elf linker hash table from a link_info structure. */
+#define score_elf_hash_table(info) \
+ ((struct score_elf_link_hash_table *) ((info)->hash))
+
+/* This structure is used to hold .got entries while estimating got sizes. */
+struct score_got_entry
+{
+ /* The input bfd in which the symbol is defined. */
+ bfd *abfd;
+ /* The index of the symbol, as stored in the relocation r_info, if
+ we have a local symbol; -1 otherwise. */
+ long symndx;
+ union
+ {
+ /* If abfd == NULL, an address that must be stored in the got. */
+ bfd_vma address;
+ /* If abfd != NULL && symndx != -1, the addend of the relocation
+ that should be added to the symbol value. */
+ bfd_vma addend;
+ /* If abfd != NULL && symndx == -1, the hash table entry
+ corresponding to a global symbol in the got (or, local, if
+ h->forced_local). */
+ struct score_elf_link_hash_entry *h;
+ } d;
+
+ /* The offset from the beginning of the .got section to the entry
+ corresponding to this symbol+addend. If it's a global symbol
+ whose offset is yet to be decided, it's going to be -1. */
+ long gotidx;
+};
+
+/* This structure is passed to score_elf_sort_hash_table_f when sorting
+ the dynamic symbols. */
+
+struct score_elf_hash_sort_data
+{
+ /* The symbol in the global GOT with the lowest dynamic symbol table index. */
+ struct elf_link_hash_entry *low;
+ /* The least dynamic symbol table index corresponding to a symbol with a GOT entry. */
+ long min_got_dynindx;
+ /* The greatest dynamic symbol table index corresponding to a symbol
+ with a GOT entry that is not referenced (e.g., a dynamic symbol
+ with dynamic relocations pointing to it from non-primary GOTs). */
+ long max_unref_got_dynindx;
+ /* The greatest dynamic symbol table index not corresponding to a
+ symbol without a GOT entry. */
+ long max_non_got_dynindx;
+};
+
+struct score_got_info
+{
+ /* The global symbol in the GOT with the lowest index in the dynamic
+ symbol table. */
+ struct elf_link_hash_entry *global_gotsym;
+ /* The number of global .got entries. */
+ unsigned int global_gotno;
+ /* The number of local .got entries. */
+ unsigned int local_gotno;
+ /* The number of local .got entries we have used. */
+ unsigned int assigned_gotno;
+ /* A hash table holding members of the got. */
+ struct htab *got_entries;
+ /* In multi-got links, a pointer to the next got (err, rather, most
+ of the time, it points to the previous got). */
+ struct score_got_info *next;
+};
+
+/* A structure used to count GOT entries, for GOT entry or ELF symbol table traversal. */
+struct _score_elf_section_data
+{
+ struct bfd_elf_section_data elf;
+ union
+ {
+ struct score_got_info *got_info;
+ bfd_byte *tdata;
+ }
+ u;
+};
+
+#define score_elf_section_data(sec) \
+ ((struct _score_elf_section_data *) elf_section_data (sec))
+
+/* The size of a symbol-table entry. */
+#define SCORE_ELF_SYM_SIZE(abfd) \
+ (get_elf_backend_data (abfd)->s->sizeof_sym)
+
+/* In case we're on a 32-bit machine, construct a 64-bit "-1" value
+ from smaller values. Start with zero, widen, *then* decrement. */
+#define MINUS_ONE (((bfd_vma)0) - 1)
+#define MINUS_TWO (((bfd_vma)0) - 2)
+
+#define PDR_SIZE 32
+
+
+/* The number of local .got entries we reserve. */
+#define SCORE_RESERVED_GOTNO (2)
+#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
+
+/* The offset of $gp from the beginning of the .got section. */
+#define ELF_SCORE_GP_OFFSET(abfd) (0x3ff0)
+/* The maximum size of the GOT for it to be addressable using 15-bit offsets from $gp. */
+#define SCORE_ELF_GOT_MAX_SIZE(abfd) (ELF_SCORE_GP_OFFSET(abfd) + 0x3fff)
+
+#define SCORE_ELF_STUB_SECTION_NAME (".SCORE.stub")
+#define SCORE_FUNCTION_STUB_SIZE (16)
+
+#define STUB_LW 0xc3bcc010 /* lw r29, [r28, -0x3ff0] */
+#define STUB_MOVE 0x8363bc56 /* mv r27, r3 */
+#define STUB_LI16 0x87548000 /* ori r26, .dynsym_index */
+#define STUB_BRL 0x801dbc09 /* brl r29 */
+
+#define SCORE_ELF_GOT_SIZE(abfd) \
+ (get_elf_backend_data (abfd)->s->arch_size / 8)
+
+#define SCORE_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \
+ (_bfd_elf_add_dynamic_entry (info, (bfd_vma) tag, (bfd_vma) val))
+
+/* The size of an external dynamic table entry. */
+#define SCORE_ELF_DYN_SIZE(abfd) \
+ (get_elf_backend_data (abfd)->s->sizeof_dyn)
+
+/* The size of an external REL relocation. */
+#define SCORE_ELF_REL_SIZE(abfd) \
+ (get_elf_backend_data (abfd)->s->sizeof_rel)
+
+/* The default alignment for sections, as a power of two. */
+#define SCORE_ELF_LOG_FILE_ALIGN(abfd)\
+ (get_elf_backend_data (abfd)->s->log_file_align)
+
+#ifndef NUM_ELEM
+#define NUM_ELEM(a) (sizeof (a) / (sizeof (a)[0]))
+#endif
+
+static bfd_byte *hi16_rel_addr;
+
+/* This will be used when we sort the dynamic relocation records. */
+static bfd *reldyn_sorting_bfd;
+
+/* SCORE ELF uses two common sections. One is the usual one, and the
+ other is for small objects. All the small objects are kept
+ together, and then referenced via the gp pointer, which yields
+ faster assembler code. This is what we use for the small common
+ section. This approach is copied from ecoff.c. */
+static asection score_elf_scom_section;
+static asymbol score_elf_scom_symbol;
+static asymbol *score_elf_scom_symbol_ptr;
+
+static bfd_reloc_status_type
+score_elf_hi16_reloc (bfd *abfd ATTRIBUTE_UNUSED,
+ arelent *reloc_entry,
+ asymbol *symbol ATTRIBUTE_UNUSED,
+ void * data,
+ asection *input_section ATTRIBUTE_UNUSED,
+ bfd *output_bfd ATTRIBUTE_UNUSED,
+ char **error_message ATTRIBUTE_UNUSED)
+{
+ hi16_rel_addr = (bfd_byte *) data + reloc_entry->address;
+ return bfd_reloc_ok;
+}
+
+static bfd_reloc_status_type
+score_elf_lo16_reloc (bfd *abfd,
+ arelent *reloc_entry,
+ asymbol *symbol ATTRIBUTE_UNUSED,
+ void * data,
+ asection *input_section,
+ bfd *output_bfd ATTRIBUTE_UNUSED,
+ char **error_message ATTRIBUTE_UNUSED)
+{
+ bfd_vma addend = 0, offset = 0;
+ unsigned long val;
+ unsigned long hi16_offset, hi16_value, uvalue;
+
+ hi16_value = bfd_get_32 (abfd, hi16_rel_addr);
+ hi16_offset = ((((hi16_value >> 16) & 0x3) << 15) | (hi16_value & 0x7fff)) >> 1;
+ addend = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
+ offset = ((((addend >> 16) & 0x3) << 15) | (addend & 0x7fff)) >> 1;
+ val = reloc_entry->addend;
+ if (reloc_entry->address > input_section->size)
+ return bfd_reloc_outofrange;
+ uvalue = ((hi16_offset << 16) | (offset & 0xffff)) + val;
+ hi16_offset = (uvalue >> 16) << 1;
+ hi16_value = (hi16_value & ~0x37fff) | (hi16_offset & 0x7fff) | ((hi16_offset << 1) & 0x30000);
+ bfd_put_32 (abfd, hi16_value, hi16_rel_addr);
+ offset = (uvalue & 0xffff) << 1;
+ addend = (addend & ~0x37fff) | (offset & 0x7fff) | ((offset << 1) & 0x30000);
+ bfd_put_32 (abfd, addend, (bfd_byte *) data + reloc_entry->address);
+ return bfd_reloc_ok;
+}
+
+/* Set the GP value for OUTPUT_BFD. Returns FALSE if this is a
+ dangerous relocation. */
+
+static bfd_boolean
+score_elf_assign_gp (bfd *output_bfd, bfd_vma *pgp)
+{
+ unsigned int count;
+ asymbol **sym;
+ unsigned int i;
+
+ /* If we've already figured out what GP will be, just return it. */
+ *pgp = _bfd_get_gp_value (output_bfd);
+ if (*pgp)
+ return TRUE;
+
+ count = bfd_get_symcount (output_bfd);
+ sym = bfd_get_outsymbols (output_bfd);
+
+ /* The linker script will have created a symbol named `_gp' with the
+ appropriate value. */
+ if (sym == NULL)
+ i = count;
+ else
+ {
+ for (i = 0; i < count; i++, sym++)
+ {
+ const char *name;
+
+ name = bfd_asymbol_name (*sym);
+ if (*name == '_' && strcmp (name, "_gp") == 0)
+ {
+ *pgp = bfd_asymbol_value (*sym);
+ _bfd_set_gp_value (output_bfd, *pgp);
+ break;
+ }
+ }
+ }
+
+ if (i >= count)
+ {
+ /* Only get the error once. */
+ *pgp = 4;
+ _bfd_set_gp_value (output_bfd, *pgp);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/* We have to figure out the gp value, so that we can adjust the
+ symbol value correctly. We look up the symbol _gp in the output
+ BFD. If we can't find it, we're stuck. We cache it in the ELF
+ target data. We don't need to adjust the symbol value for an
+ external symbol if we are producing relocatable output. */
+
+static bfd_reloc_status_type
+score_elf_final_gp (bfd *output_bfd,
+ asymbol *symbol,
+ bfd_boolean relocatable,
+ char **error_message,
+ bfd_vma *pgp)
+{
+ if (bfd_is_und_section (symbol->section)
+ && ! relocatable)
+ {
+ *pgp = 0;
+ return bfd_reloc_undefined;
+ }
+
+ *pgp = _bfd_get_gp_value (output_bfd);
+ if (*pgp == 0
+ && (! relocatable
+ || (symbol->flags & BSF_SECTION_SYM) != 0))
+ {
+ if (relocatable)
+ {
+ /* Make up a value. */
+ *pgp = symbol->section->output_section->vma + 0x4000;
+ _bfd_set_gp_value (output_bfd, *pgp);
+ }
+ else if (!score_elf_assign_gp (output_bfd, pgp))
+ {
+ *error_message =
+ (char *) _("GP relative relocation when _gp not defined");
+ return bfd_reloc_dangerous;
+ }
+ }
+
+ return bfd_reloc_ok;
+}
+
+static bfd_reloc_status_type
+score_elf_gprel15_with_gp (bfd *abfd,
+ asymbol *symbol,
+ arelent *reloc_entry,
+ asection *input_section,
+ bfd_boolean relocateable,
+ void * data,
+ bfd_vma gp ATTRIBUTE_UNUSED)
+{
+ bfd_vma relocation;
+ unsigned long insn;
+
+ if (bfd_is_com_section (symbol->section))
+ relocation = 0;
+ else
+ relocation = symbol->value;
+
+ relocation += symbol->section->output_section->vma;
+ relocation += symbol->section->output_offset;
+ if (reloc_entry->address > input_section->size)
+ return bfd_reloc_outofrange;
+
+ insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
+ if (((reloc_entry->addend & 0xffffc000) != 0)
+ && ((reloc_entry->addend & 0xffffc000) != 0xffffc000))
+ return bfd_reloc_overflow;
+
+ insn = (insn & ~0x7fff) | (reloc_entry->addend & 0x7fff);
+ bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
+ if (relocateable)
+ reloc_entry->address += input_section->output_offset;
+
+ return bfd_reloc_ok;
+}
+
+static bfd_reloc_status_type
+gprel32_with_gp (bfd *abfd, asymbol *symbol, arelent *reloc_entry,
+ asection *input_section, bfd_boolean relocatable,
+ void *data, bfd_vma gp)
+{
+ bfd_vma relocation;
+ bfd_vma val;
+
+ if (bfd_is_com_section (symbol->section))
+ relocation = 0;
+ else
+ relocation = symbol->value;
+
+ relocation += symbol->section->output_section->vma;
+ relocation += symbol->section->output_offset;
+
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
+ return bfd_reloc_outofrange;
+
+ /* Set val to the offset into the section or symbol. */
+ val = reloc_entry->addend;
+
+ if (reloc_entry->howto->partial_inplace)
+ val += bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
+
+ /* Adjust val for the final section location and GP value. If we
+ are producing relocatable output, we don't want to do this for
+ an external symbol. */
+ if (! relocatable
+ || (symbol->flags & BSF_SECTION_SYM) != 0)
+ val += relocation - gp;
+
+ if (reloc_entry->howto->partial_inplace)
+ bfd_put_32 (abfd, val, (bfd_byte *) data + reloc_entry->address);
+ else
+ reloc_entry->addend = val;
+
+ if (relocatable)
+ reloc_entry->address += input_section->output_offset;
+
+ return bfd_reloc_ok;
+}
+
+static bfd_reloc_status_type
+score_elf_gprel15_reloc (bfd *abfd,
+ arelent *reloc_entry,
+ asymbol *symbol,
+ void * data,
+ asection *input_section,
+ bfd *output_bfd,
+ char **error_message)
+{
+ bfd_boolean relocateable;
+ bfd_reloc_status_type ret;
+ bfd_vma gp;
+
+ if (output_bfd != (bfd *) NULL
+ && (symbol->flags & BSF_SECTION_SYM) == 0 && reloc_entry->addend == 0)
+ {
+ reloc_entry->address += input_section->output_offset;
+ return bfd_reloc_ok;
+ }
+ if (output_bfd != (bfd *) NULL)
+ relocateable = TRUE;
+ else
+ {
+ relocateable = FALSE;
+ output_bfd = symbol->section->output_section->owner;
+ }
+
+ ret = score_elf_final_gp (output_bfd, symbol, relocateable, error_message, &gp);
+ if (ret != bfd_reloc_ok)
+ return ret;
+
+ return score_elf_gprel15_with_gp (abfd, symbol, reloc_entry,
+ input_section, relocateable, data, gp);
+}
+
+/* Do a R_SCORE_GPREL32 relocation. This is a 32 bit value which must
+ become the offset from the gp register. */
+
+static bfd_reloc_status_type
+score_elf_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
+ void *data, asection *input_section, bfd *output_bfd,
+ char **error_message)
+{
+ bfd_boolean relocatable;
+ bfd_reloc_status_type ret;
+ bfd_vma gp;
+
+ /* R_SCORE_GPREL32 relocations are defined for local symbols only. */
+ if (output_bfd != NULL
+ && (symbol->flags & BSF_SECTION_SYM) == 0
+ && (symbol->flags & BSF_LOCAL) != 0)
+ {
+ *error_message = (char *)
+ _("32bits gp relative relocation occurs for an external symbol");
+ return bfd_reloc_outofrange;
+ }
+
+ if (output_bfd != NULL)
+ relocatable = TRUE;
+ else
+ {
+ relocatable = FALSE;
+ output_bfd = symbol->section->output_section->owner;
+ }
+
+ ret = score_elf_final_gp (output_bfd, symbol, relocatable, error_message, &gp);
+ if (ret != bfd_reloc_ok)
+ return ret;
+
+ gp = 0; /* FIXME. */
+ return gprel32_with_gp (abfd, symbol, reloc_entry, input_section,
+ relocatable, data, gp);
+}
+
+/* A howto special_function for R_SCORE_GOT15 relocations. This is just
+ like any other 16-bit relocation when applied to global symbols, but is
+ treated in the same as R_SCORE_HI16 when applied to local symbols. */
+
+static bfd_reloc_status_type
+score_elf_got15_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
+ void *data, asection *input_section,
+ bfd *output_bfd, char **error_message)
+{
+ if ((symbol->flags & (BSF_GLOBAL | BSF_WEAK)) != 0
+ || bfd_is_und_section (bfd_get_section (symbol))
+ || bfd_is_com_section (bfd_get_section (symbol)))
+ /* The relocation is against a global symbol. */
+ return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
+ input_section, output_bfd,
+ error_message);
+
+ return score_elf_hi16_reloc (abfd, reloc_entry, symbol, data,
+ input_section, output_bfd, error_message);
+}
+
+static bfd_reloc_status_type
+score_elf_got_lo16_reloc (bfd *abfd,
+ arelent *reloc_entry,
+ asymbol *symbol ATTRIBUTE_UNUSED,
+ void * data,
+ asection *input_section,
+ bfd *output_bfd ATTRIBUTE_UNUSED,
+ char **error_message ATTRIBUTE_UNUSED)
+{
+ bfd_vma addend = 0, offset = 0;
+ signed long val;
+ signed long hi16_offset, hi16_value, uvalue;
+
+ hi16_value = bfd_get_32 (abfd, hi16_rel_addr);
+ hi16_offset = ((((hi16_value >> 16) & 0x3) << 15) | (hi16_value & 0x7fff)) >> 1;
+ addend = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
+ offset = ((((addend >> 16) & 0x3) << 15) | (addend & 0x7fff)) >> 1;
+ val = reloc_entry->addend;
+ if (reloc_entry->address > input_section->size)
+ return bfd_reloc_outofrange;
+ uvalue = ((hi16_offset << 16) | (offset & 0xffff)) + val;
+ if ((uvalue > -0x8000) && (uvalue < 0x7fff))
+ hi16_offset = 0;
+ else
+ hi16_offset = (uvalue >> 16) & 0x7fff;
+ hi16_value = (hi16_value & ~0x37fff) | (hi16_offset & 0x7fff) | ((hi16_offset << 1) & 0x30000);
+ bfd_put_32 (abfd, hi16_value, hi16_rel_addr);
+ offset = (uvalue & 0xffff) << 1;
+ addend = (addend & ~0x37fff) | (offset & 0x7fff) | ((offset << 1) & 0x30000);
+ bfd_put_32 (abfd, addend, (bfd_byte *) data + reloc_entry->address);
+ return bfd_reloc_ok;
+}
+
+static reloc_howto_type elf32_score_howto_table[] =
+{
+ /* No relocation. */
+ HOWTO (R_SCORE_NONE, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SCORE_NONE", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* R_SCORE_HI16 */
+ HOWTO (R_SCORE_HI16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 1, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ score_elf_hi16_reloc, /* special_function */
+ "R_SCORE_HI16", /* name */
+ TRUE, /* partial_inplace */
+ 0x37fff, /* src_mask */
+ 0x37fff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* R_SCORE_LO16 */
+ HOWTO (R_SCORE_LO16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 1, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ score_elf_lo16_reloc, /* special_function */
+ "R_SCORE_LO16", /* name */
+ TRUE, /* partial_inplace */
+ 0x37fff, /* src_mask */
+ 0x37fff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* R_SCORE_DUMMY1 */
+ HOWTO (R_SCORE_DUMMY1, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 1, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SCORE_DUMMY1", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /*R_SCORE_24 */
+ HOWTO (R_SCORE_24, /* type */
+ 1, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 24, /* bitsize */
+ FALSE, /* pc_relative */
+ 1, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SCORE_24", /* name */
+ FALSE, /* partial_inplace */
+ 0x3ff7fff, /* src_mask */
+ 0x3ff7fff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /*R_SCORE_PC19 */
+ HOWTO (R_SCORE_PC19, /* type */
+ 1, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 19, /* bitsize */
+ TRUE, /* pc_relative */
+ 1, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SCORE_PC19", /* name */
+ FALSE, /* partial_inplace */
+ 0x3ff03fe, /* src_mask */
+ 0x3ff03fe, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /*R_SCORE16_11 */
+ HOWTO (R_SCORE16_11, /* type */
+ 1, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 11, /* bitsize */
+ FALSE, /* pc_relative */
+ 1, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SCORE16_11", /* name */
+ FALSE, /* partial_inplace */
+ 0x000000ffe, /* src_mask */
+ 0x000000ffe, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* R_SCORE16_PC8 */
+ HOWTO (R_SCORE16_PC8, /* type */
+ 1, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SCORE16_PC8", /* name */
+ FALSE, /* partial_inplace */
+ 0x000000ff, /* src_mask */
+ 0x000000ff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* 32 bit absolute */
+ HOWTO (R_SCORE_ABS32, /* type 8 */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SCORE_ABS32", /* name */
+ FALSE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* 16 bit absolute */
+ HOWTO (R_SCORE_ABS16, /* type 11 */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SCORE_ABS16", /* name */
+ FALSE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* R_SCORE_DUMMY2 */
+ HOWTO (R_SCORE_DUMMY2, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SCORE_DUMMY2", /* name */
+ TRUE, /* partial_inplace */
+ 0x00007fff, /* src_mask */
+ 0x00007fff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* R_SCORE_GP15 */
+ HOWTO (R_SCORE_GP15, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ score_elf_gprel15_reloc,/* special_function */
+ "R_SCORE_GP15", /* name */
+ TRUE, /* partial_inplace */
+ 0x00007fff, /* src_mask */
+ 0x00007fff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* GNU extension to record C++ vtable hierarchy. */
+ HOWTO (R_SCORE_GNU_VTINHERIT, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ NULL, /* special_function */
+ "R_SCORE_GNU_VTINHERIT", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* GNU extension to record C++ vtable member usage */
+ HOWTO (R_SCORE_GNU_VTENTRY, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ _bfd_elf_rel_vtable_reloc_fn, /* special_function */
+ "R_SCORE_GNU_VTENTRY", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Reference to global offset table. */
+ HOWTO (R_SCORE_GOT15, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ score_elf_got15_reloc, /* special_function */
+ "R_SCORE_GOT15", /* name */
+ TRUE, /* partial_inplace */
+ 0x00007fff, /* src_mask */
+ 0x00007fff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Low 16 bits of displacement in global offset table. */
+ HOWTO (R_SCORE_GOT_LO16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 1, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ score_elf_got_lo16_reloc, /* special_function */
+ "R_SCORE_GOT_LO16", /* name */
+ TRUE, /* partial_inplace */
+ 0x37ffe, /* src_mask */
+ 0x37ffe, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* 15 bit call through global offset table. */
+ HOWTO (R_SCORE_CALL15, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SCORE_CALL15", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* 32 bit GP relative reference. */
+ HOWTO (R_SCORE_GPREL32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ score_elf_gprel32_reloc, /* special_function */
+ "R_SCORE_GPREL32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* 32 bit symbol relative relocation. */
+ HOWTO (R_SCORE_REL32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SCORE_REL32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* R_SCORE_DUMMY_HI16 */
+ HOWTO (R_SCORE_DUMMY_HI16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 1, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ score_elf_hi16_reloc, /* special_function */
+ "R_SCORE_DUMMY_HI16", /* name */
+ TRUE, /* partial_inplace */
+ 0x37fff, /* src_mask */
+ 0x37fff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+};
+
+struct score_reloc_map
+{
+ bfd_reloc_code_real_type bfd_reloc_val;
+ unsigned char elf_reloc_val;
+};
+
+static const struct score_reloc_map elf32_score_reloc_map[] =
+{
+ {BFD_RELOC_NONE, R_SCORE_NONE},
+ {BFD_RELOC_HI16_S, R_SCORE_HI16},
+ {BFD_RELOC_LO16, R_SCORE_LO16},
+ {BFD_RELOC_SCORE_DUMMY1, R_SCORE_DUMMY1},
+ {BFD_RELOC_SCORE_JMP, R_SCORE_24},
+ {BFD_RELOC_SCORE_BRANCH, R_SCORE_PC19},
+ {BFD_RELOC_SCORE16_JMP, R_SCORE16_11},
+ {BFD_RELOC_SCORE16_BRANCH, R_SCORE16_PC8},
+ {BFD_RELOC_32, R_SCORE_ABS32},
+ {BFD_RELOC_16, R_SCORE_ABS16},
+ {BFD_RELOC_SCORE_DUMMY2, R_SCORE_DUMMY2},
+ {BFD_RELOC_SCORE_GPREL15, R_SCORE_GP15},
+ {BFD_RELOC_VTABLE_INHERIT, R_SCORE_GNU_VTINHERIT},
+ {BFD_RELOC_VTABLE_ENTRY, R_SCORE_GNU_VTENTRY},
+ {BFD_RELOC_SCORE_GOT15, R_SCORE_GOT15},
+ {BFD_RELOC_SCORE_GOT_LO16, R_SCORE_GOT_LO16},
+ {BFD_RELOC_SCORE_CALL15, R_SCORE_CALL15},
+ {BFD_RELOC_GPREL32, R_SCORE_GPREL32},
+ {BFD_RELOC_32_PCREL, R_SCORE_REL32},
+ {BFD_RELOC_SCORE_DUMMY_HI16, R_SCORE_DUMMY_HI16},
+};
+
+/* got_entries only match if they're identical, except for gotidx, so
+ use all fields to compute the hash, and compare the appropriate
+ union members. */
+
+static hashval_t
+score_elf_got_entry_hash (const void *entry_)
+{
+ const struct score_got_entry *entry = (struct score_got_entry *)entry_;
+
+ return entry->symndx
+ + (!entry->abfd ? entry->d.address : entry->abfd->id);
+}
+
+static int
+score_elf_got_entry_eq (const void *entry1, const void *entry2)
+{
+ const struct score_got_entry *e1 = (struct score_got_entry *)entry1;
+ const struct score_got_entry *e2 = (struct score_got_entry *)entry2;
+
+ return e1->abfd == e2->abfd && e1->symndx == e2->symndx
+ && (! e1->abfd ? e1->d.address == e2->d.address
+ : e1->symndx >= 0 ? e1->d.addend == e2->d.addend
+ : e1->d.h == e2->d.h);
+}
+
+/* If H needs a GOT entry, assign it the highest available dynamic
+ index. Otherwise, assign it the lowest available dynamic
+ index. */
+
+static bfd_boolean
+score_elf_sort_hash_table_f (struct score_elf_link_hash_entry *h, void *data)
+{
+ struct score_elf_hash_sort_data *hsd = data;
+
+ if (h->root.root.type == bfd_link_hash_warning)
+ h = (struct score_elf_link_hash_entry *) h->root.root.u.i.link;
+
+ /* Symbols without dynamic symbol table entries aren't interesting at all. */
+ if (h->root.dynindx == -1)
+ return TRUE;
+
+ /* Global symbols that need GOT entries that are not explicitly
+ referenced are marked with got offset 2. Those that are
+ referenced get a 1, and those that don't need GOT entries get
+ -1. */
+ if (h->root.got.offset == 2)
+ {
+ if (hsd->max_unref_got_dynindx == hsd->min_got_dynindx)
+ hsd->low = (struct elf_link_hash_entry *) h;
+ h->root.dynindx = hsd->max_unref_got_dynindx++;
+ }
+ else if (h->root.got.offset != 1)
+ h->root.dynindx = hsd->max_non_got_dynindx++;
+ else
+ {
+ h->root.dynindx = --hsd->min_got_dynindx;
+ hsd->low = (struct elf_link_hash_entry *) h;
+ }
+
+ return TRUE;
+}
+
+static asection *
+score_elf_got_section (bfd *abfd, bfd_boolean maybe_excluded)
+{
+ asection *sgot = bfd_get_section_by_name (abfd, ".got");
+
+ if (sgot == NULL || (! maybe_excluded && (sgot->flags & SEC_EXCLUDE) != 0))
+ return NULL;
+ return sgot;
+}
+
+/* Returns the GOT information associated with the link indicated by
+ INFO. If SGOTP is non-NULL, it is filled in with the GOT section. */
+
+static struct score_got_info *
+score_elf_got_info (bfd *abfd, asection **sgotp)
+{
+ asection *sgot;
+ struct score_got_info *g;
+
+ sgot = score_elf_got_section (abfd, TRUE);
+ BFD_ASSERT (sgot != NULL);
+ BFD_ASSERT (elf_section_data (sgot) != NULL);
+ g = score_elf_section_data (sgot)->u.got_info;
+ BFD_ASSERT (g != NULL);
+
+ if (sgotp)
+ *sgotp = sgot;
+ return g;
+}
+
+/* Sort the dynamic symbol table so that symbols that need GOT entries
+ appear towards the end. This reduces the amount of GOT space
+ required. MAX_LOCAL is used to set the number of local symbols
+ known to be in the dynamic symbol table. During
+ _bfd_score_elf_size_dynamic_sections, this value is 1. Afterward, the
+ section symbols are added and the count is higher. */
+
+static bfd_boolean
+score_elf_sort_hash_table (struct bfd_link_info *info,
+ unsigned long max_local)
+{
+ struct score_elf_hash_sort_data hsd;
+ struct score_got_info *g;
+ bfd *dynobj;
+
+ dynobj = elf_hash_table (info)->dynobj;
+
+ g = score_elf_got_info (dynobj, NULL);
+
+ hsd.low = NULL;
+ hsd.max_unref_got_dynindx =
+ hsd.min_got_dynindx = elf_hash_table (info)->dynsymcount
+ /* In the multi-got case, assigned_gotno of the master got_info
+ indicate the number of entries that aren't referenced in the
+ primary GOT, but that must have entries because there are
+ dynamic relocations that reference it. Since they aren't
+ referenced, we move them to the end of the GOT, so that they
+ don't prevent other entries that are referenced from getting
+ too large offsets. */
+ - (g->next ? g->assigned_gotno : 0);
+ hsd.max_non_got_dynindx = max_local;
+ score_elf_link_hash_traverse (((struct score_elf_link_hash_table *)
+ elf_hash_table (info)),
+ score_elf_sort_hash_table_f,
+ &hsd);
+
+ /* There should have been enough room in the symbol table to
+ accommodate both the GOT and non-GOT symbols. */
+ BFD_ASSERT (hsd.max_non_got_dynindx <= hsd.min_got_dynindx);
+ BFD_ASSERT ((unsigned long)hsd.max_unref_got_dynindx
+ <= elf_hash_table (info)->dynsymcount);
+
+ /* Now we know which dynamic symbol has the lowest dynamic symbol
+ table index in the GOT. */
+ g->global_gotsym = hsd.low;
+
+ return TRUE;
+}
+
+/* Create an entry in an score ELF linker hash table. */
+
+static struct bfd_hash_entry *
+score_elf_link_hash_newfunc (struct bfd_hash_entry *entry,
+ struct bfd_hash_table *table,
+ const char *string)
+{
+ struct score_elf_link_hash_entry *ret = (struct score_elf_link_hash_entry *)entry;
+
+ /* Allocate the structure if it has not already been allocated by a subclass. */
+ if (ret == NULL)
+ ret = bfd_hash_allocate (table, sizeof (struct score_elf_link_hash_entry));
+ if (ret == NULL)
+ return (struct bfd_hash_entry *)ret;
+
+ /* Call the allocation method of the superclass. */
+ ret = ((struct score_elf_link_hash_entry *)
+ _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *)ret, table, string));
+
+ if (ret != NULL)
+ {
+ ret->possibly_dynamic_relocs = 0;
+ ret->readonly_reloc = FALSE;
+ ret->no_fn_stub = FALSE;
+ ret->forced_local = FALSE;
+ }
+
+ return (struct bfd_hash_entry *)ret;
+}
+
+/* Returns the first relocation of type r_type found, beginning with
+ RELOCATION. RELEND is one-past-the-end of the relocation table. */
+
+static const Elf_Internal_Rela *
+score_elf_next_relocation (bfd *abfd ATTRIBUTE_UNUSED, unsigned int r_type,
+ const Elf_Internal_Rela *relocation,
+ const Elf_Internal_Rela *relend)
+{
+ while (relocation < relend)
+ {
+ if (ELF32_R_TYPE (relocation->r_info) == r_type)
+ return relocation;
+
+ ++relocation;
+ }
+
+ /* We didn't find it. */
+ bfd_set_error (bfd_error_bad_value);
+ return NULL;
+}
+
+/* This function is called via qsort() to sort the dynamic relocation
+ entries by increasing r_symndx value. */
+
+static int
+score_elf_sort_dynamic_relocs (const void *arg1, const void *arg2)
+{
+ Elf_Internal_Rela int_reloc1;
+ Elf_Internal_Rela int_reloc2;
+
+ bfd_elf32_swap_reloc_in (reldyn_sorting_bfd, arg1, &int_reloc1);
+ bfd_elf32_swap_reloc_in (reldyn_sorting_bfd, arg2, &int_reloc2);
+
+ return (ELF32_R_SYM (int_reloc1.r_info) - ELF32_R_SYM (int_reloc2.r_info));
+}
+
+/* Return whether a relocation is against a local symbol. */
+
+static bfd_boolean
+score_elf_local_relocation_p (bfd *input_bfd,
+ const Elf_Internal_Rela *relocation,
+ asection **local_sections,
+ bfd_boolean check_forced)
+{
+ unsigned long r_symndx;
+ Elf_Internal_Shdr *symtab_hdr;
+ struct score_elf_link_hash_entry *h;
+ size_t extsymoff;
+
+ r_symndx = ELF32_R_SYM (relocation->r_info);
+ symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+ extsymoff = (elf_bad_symtab (input_bfd)) ? 0 : symtab_hdr->sh_info;
+
+ if (r_symndx < extsymoff)
+ return TRUE;
+ if (elf_bad_symtab (input_bfd) && local_sections[r_symndx] != NULL)
+ return TRUE;
+
+ if (check_forced)
+ {
+ /* Look up the hash table to check whether the symbol was forced local. */
+ h = (struct score_elf_link_hash_entry *)
+ elf_sym_hashes (input_bfd) [r_symndx - extsymoff];
+ /* Find the real hash-table entry for this symbol. */
+ while (h->root.root.type == bfd_link_hash_indirect
+ || h->root.root.type == bfd_link_hash_warning)
+ h = (struct score_elf_link_hash_entry *) h->root.root.u.i.link;
+ if (h->root.forced_local)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/* Returns the dynamic relocation section for DYNOBJ. */
+
+static asection *
+score_elf_rel_dyn_section (bfd *dynobj, bfd_boolean create_p)
+{
+ static const char dname[] = ".rel.dyn";
+ asection *sreloc;
+
+ sreloc = bfd_get_section_by_name (dynobj, dname);
+ if (sreloc == NULL && create_p)
+ {
+ sreloc = bfd_make_section_with_flags (dynobj, dname,
+ (SEC_ALLOC
+ | SEC_LOAD
+ | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED
+ | SEC_READONLY));
+ if (sreloc == NULL
+ || ! bfd_set_section_alignment (dynobj, sreloc,
+ SCORE_ELF_LOG_FILE_ALIGN (dynobj)))
+ return NULL;
+ }
+ return sreloc;
+}
+
+static void
+score_elf_allocate_dynamic_relocations (bfd *abfd, unsigned int n)
+{
+ asection *s;
+
+ s = score_elf_rel_dyn_section (abfd, FALSE);
+ BFD_ASSERT (s != NULL);
+
+ if (s->size == 0)
+ {
+ /* Make room for a null element. */
+ s->size += SCORE_ELF_REL_SIZE (abfd);
+ ++s->reloc_count;
+ }
+ s->size += n * SCORE_ELF_REL_SIZE (abfd);
+}
+
+/* Create a rel.dyn relocation for the dynamic linker to resolve. REL
+ is the original relocation, which is now being transformed into a
+ dynamic relocation. The ADDENDP is adjusted if necessary; the
+ caller should store the result in place of the original addend. */
+
+static bfd_boolean
+score_elf_create_dynamic_relocation (bfd *output_bfd,
+ struct bfd_link_info *info,
+ const Elf_Internal_Rela *rel,
+ struct score_elf_link_hash_entry *h,
+ bfd_vma symbol,
+ bfd_vma *addendp, asection *input_section)
+{
+ Elf_Internal_Rela outrel[3];
+ asection *sreloc;
+ bfd *dynobj;
+ int r_type;
+ long indx;
+ bfd_boolean defined_p;
+
+ r_type = ELF32_R_TYPE (rel->r_info);
+ dynobj = elf_hash_table (info)->dynobj;
+ sreloc = score_elf_rel_dyn_section (dynobj, FALSE);
+ BFD_ASSERT (sreloc != NULL);
+ BFD_ASSERT (sreloc->contents != NULL);
+ BFD_ASSERT (sreloc->reloc_count * SCORE_ELF_REL_SIZE (output_bfd) < sreloc->size);
+
+ outrel[0].r_offset =
+ _bfd_elf_section_offset (output_bfd, info, input_section, rel[0].r_offset);
+ outrel[1].r_offset =
+ _bfd_elf_section_offset (output_bfd, info, input_section, rel[1].r_offset);
+ outrel[2].r_offset =
+ _bfd_elf_section_offset (output_bfd, info, input_section, rel[2].r_offset);
+
+ if (outrel[0].r_offset == MINUS_ONE)
+ /* The relocation field has been deleted. */
+ return TRUE;
+
+ if (outrel[0].r_offset == MINUS_TWO)
+ {
+ /* The relocation field has been converted into a relative value of
+ some sort. Functions like _bfd_elf_write_section_eh_frame expect
+ the field to be fully relocated, so add in the symbol's value. */
+ *addendp += symbol;
+ return TRUE;
+ }
+
+ /* We must now calculate the dynamic symbol table index to use
+ in the relocation. */
+ if (h != NULL
+ && (! info->symbolic || !h->root.def_regular)
+ /* h->root.dynindx may be -1 if this symbol was marked to
+ become local. */
+ && h->root.dynindx != -1)
+ {
+ indx = h->root.dynindx;
+ /* ??? glibc's ld.so just adds the final GOT entry to the
+ relocation field. It therefore treats relocs against
+ defined symbols in the same way as relocs against
+ undefined symbols. */
+ defined_p = FALSE;
+ }
+ else
+ {
+ indx = 0;
+ defined_p = TRUE;
+ }
+
+ /* If the relocation was previously an absolute relocation and
+ this symbol will not be referred to by the relocation, we must
+ adjust it by the value we give it in the dynamic symbol table.
+ Otherwise leave the job up to the dynamic linker. */
+ if (defined_p && r_type != R_SCORE_REL32)
+ *addendp += symbol;
+
+ /* The relocation is always an REL32 relocation because we don't
+ know where the shared library will wind up at load-time. */
+ outrel[0].r_info = ELF32_R_INFO ((unsigned long) indx, R_SCORE_REL32);
+
+ /* For strict adherence to the ABI specification, we should
+ generate a R_SCORE_64 relocation record by itself before the
+ _REL32/_64 record as well, such that the addend is read in as
+ a 64-bit value (REL32 is a 32-bit relocation, after all).
+ However, since none of the existing ELF64 SCORE dynamic
+ loaders seems to care, we don't waste space with these
+ artificial relocations. If this turns out to not be true,
+ score_elf_allocate_dynamic_relocations() should be tweaked so
+ as to make room for a pair of dynamic relocations per
+ invocation if ABI_64_P, and here we should generate an
+ additional relocation record with R_SCORE_64 by itself for a
+ NULL symbol before this relocation record. */
+ outrel[1].r_info = ELF32_R_INFO (0, R_SCORE_NONE);
+ outrel[2].r_info = ELF32_R_INFO (0, R_SCORE_NONE);
+
+ /* Adjust the output offset of the relocation to reference the
+ correct location in the output file. */
+ outrel[0].r_offset += (input_section->output_section->vma
+ + input_section->output_offset);
+ outrel[1].r_offset += (input_section->output_section->vma
+ + input_section->output_offset);
+ outrel[2].r_offset += (input_section->output_section->vma
+ + input_section->output_offset);
+
+ /* Put the relocation back out. We have to use the special
+ relocation outputter in the 64-bit case since the 64-bit
+ relocation format is non-standard. */
+ bfd_elf32_swap_reloc_out
+ (output_bfd, &outrel[0],
+ (sreloc->contents + sreloc->reloc_count * sizeof (Elf32_External_Rel)));
+
+ /* We've now added another relocation. */
+ ++sreloc->reloc_count;
+
+ /* Make sure the output section is writable. The dynamic linker
+ will be writing to it. */
+ elf_section_data (input_section->output_section)->this_hdr.sh_flags |= SHF_WRITE;
+
+ return TRUE;
+}
+
+static bfd_boolean
+score_elf_create_got_section (bfd *abfd,
+ struct bfd_link_info *info,
+ bfd_boolean maybe_exclude)
+{
+ flagword flags;
+ asection *s;
+ struct elf_link_hash_entry *h;
+ struct bfd_link_hash_entry *bh;
+ struct score_got_info *g;
+ bfd_size_type amt;
+
+ /* This function may be called more than once. */
+ s = score_elf_got_section (abfd, TRUE);
+ if (s)
+ {
+ if (! maybe_exclude)
+ s->flags &= ~SEC_EXCLUDE;
+ return TRUE;
+ }
+
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED);
+
+ if (maybe_exclude)
+ flags |= SEC_EXCLUDE;
+
+ /* We have to use an alignment of 2**4 here because this is hardcoded
+ in the function stub generation and in the linker script. */
+ s = bfd_make_section_with_flags (abfd, ".got", flags);
+ if (s == NULL
+ || ! bfd_set_section_alignment (abfd, s, 4))
+ return FALSE;
+
+ /* Define the symbol _GLOBAL_OFFSET_TABLE_. We don't do this in the
+ linker script because we don't want to define the symbol if we
+ are not creating a global offset table. */
+ bh = NULL;
+ if (! (_bfd_generic_link_add_one_symbol
+ (info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s,
+ 0, NULL, FALSE, get_elf_backend_data (abfd)->collect, &bh)))
+ return FALSE;
+
+ h = (struct elf_link_hash_entry *) bh;
+ h->non_elf = 0;
+ h->def_regular = 1;
+ h->type = STT_OBJECT;
+
+ if (info->shared && ! bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
+
+ amt = sizeof (struct score_got_info);
+ g = bfd_alloc (abfd, amt);
+ if (g == NULL)
+ return FALSE;
+
+ g->global_gotsym = NULL;
+ g->global_gotno = 0;
+
+ g->local_gotno = SCORE_RESERVED_GOTNO;
+ g->assigned_gotno = SCORE_RESERVED_GOTNO;
+ g->next = NULL;
+
+ g->got_entries = htab_try_create (1, score_elf_got_entry_hash,
+ score_elf_got_entry_eq, NULL);
+ if (g->got_entries == NULL)
+ return FALSE;
+ score_elf_section_data (s)->u.got_info = g;
+ score_elf_section_data (s)->elf.this_hdr.sh_flags |= SHF_ALLOC | SHF_WRITE | SHF_SCORE_GPREL;
+
+ return TRUE;
+}
+
+/* Calculate the %high function. */
+
+static bfd_vma
+score_elf_high (bfd_vma value)
+{
+ return ((value + (bfd_vma) 0x8000) >> 16) & 0xffff;
+}
+
+/* Create a local GOT entry for VALUE. Return the index of the entry,
+ or -1 if it could not be created. */
+
+static struct score_got_entry *
+score_elf_create_local_got_entry (bfd *abfd,
+ bfd *ibfd ATTRIBUTE_UNUSED,
+ struct score_got_info *gg,
+ asection *sgot, bfd_vma value,
+ unsigned long r_symndx ATTRIBUTE_UNUSED,
+ struct score_elf_link_hash_entry *h ATTRIBUTE_UNUSED,
+ int r_type ATTRIBUTE_UNUSED)
+{
+ struct score_got_entry entry, **loc;
+ struct score_got_info *g;
+
+ entry.abfd = NULL;
+ entry.symndx = -1;
+ entry.d.address = value;
+
+ g = gg;
+ loc = (struct score_got_entry **) htab_find_slot (g->got_entries, &entry, INSERT);
+ if (*loc)
+ return *loc;
+
+ entry.gotidx = SCORE_ELF_GOT_SIZE (abfd) * g->assigned_gotno++;
+
+ *loc = bfd_alloc (abfd, sizeof entry);
+
+ if (! *loc)
+ return NULL;
+
+ memcpy (*loc, &entry, sizeof entry);
+
+ if (g->assigned_gotno >= g->local_gotno)
+ {
+ (*loc)->gotidx = -1;
+ /* We didn't allocate enough space in the GOT. */
+ (*_bfd_error_handler)
+ (_("not enough GOT space for local GOT entries"));
+ bfd_set_error (bfd_error_bad_value);
+ return NULL;
+ }
+
+ bfd_put_32 (abfd, value, (sgot->contents + entry.gotidx));
+
+ return *loc;
+}
+
+/* Find a GOT entry whose higher-order 16 bits are the same as those
+ for value. Return the index into the GOT for this entry. */
+
+static bfd_vma
+score_elf_got16_entry (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
+ bfd_vma value, bfd_boolean external)
+{
+ asection *sgot;
+ struct score_got_info *g;
+ struct score_got_entry *entry;
+
+ if (!external)
+ {
+ /* Although the ABI says that it is "the high-order 16 bits" that we
+ want, it is really the %high value. The complete value is
+ calculated with a `addiu' of a LO16 relocation, just as with a
+ HI16/LO16 pair. */
+ value = score_elf_high (value) << 16;
+ }
+
+ g = score_elf_got_info (elf_hash_table (info)->dynobj, &sgot);
+
+ entry = score_elf_create_local_got_entry (abfd, ibfd, g, sgot, value, 0, NULL,
+ R_SCORE_GOT15);
+ if (entry)
+ return entry->gotidx;
+ else
+ return MINUS_ONE;
+}
+
+static void
+_bfd_score_elf_hide_symbol (struct bfd_link_info *info,
+ struct elf_link_hash_entry *entry,
+ bfd_boolean force_local)
+{
+ bfd *dynobj;
+ asection *got;
+ struct score_got_info *g;
+ struct score_elf_link_hash_entry *h;
+
+ h = (struct score_elf_link_hash_entry *) entry;
+ if (h->forced_local)
+ return;
+ h->forced_local = TRUE;
+
+ dynobj = elf_hash_table (info)->dynobj;
+ if (dynobj != NULL && force_local)
+ {
+ got = score_elf_got_section (dynobj, FALSE);
+ if (got == NULL)
+ return;
+ g = score_elf_section_data (got)->u.got_info;
+
+ if (g->next)
+ {
+ struct score_got_entry e;
+ struct score_got_info *gg = g;
+
+ /* Since we're turning what used to be a global symbol into a
+ local one, bump up the number of local entries of each GOT
+ that had an entry for it. This will automatically decrease
+ the number of global entries, since global_gotno is actually
+ the upper limit of global entries. */
+ e.abfd = dynobj;
+ e.symndx = -1;
+ e.d.h = h;
+
+ for (g = g->next; g != gg; g = g->next)
+ if (htab_find (g->got_entries, &e))
+ {
+ BFD_ASSERT (g->global_gotno > 0);
+ g->local_gotno++;
+ g->global_gotno--;
+ }
+
+ /* If this was a global symbol forced into the primary GOT, we
+ no longer need an entry for it. We can't release the entry
+ at this point, but we must at least stop counting it as one
+ of the symbols that required a forced got entry. */
+ if (h->root.got.offset == 2)
+ {
+ BFD_ASSERT (gg->assigned_gotno > 0);
+ gg->assigned_gotno--;
+ }
+ }
+ else if (g->global_gotno == 0 && g->global_gotsym == NULL)
+ /* If we haven't got through GOT allocation yet, just bump up the
+ number of local entries, as this symbol won't be counted as
+ global. */
+ g->local_gotno++;
+ else if (h->root.got.offset == 1)
+ {
+ /* If we're past non-multi-GOT allocation and this symbol had
+ been marked for a global got entry, give it a local entry
+ instead. */
+ BFD_ASSERT (g->global_gotno > 0);
+ g->local_gotno++;
+ g->global_gotno--;
+ }
+ }
+
+ _bfd_elf_link_hash_hide_symbol (info, &h->root, force_local);
+}
+
+/* If H is a symbol that needs a global GOT entry, but has a dynamic
+ symbol table index lower than any we've seen to date, record it for
+ posterity. */
+
+static bfd_boolean
+score_elf_record_global_got_symbol (struct elf_link_hash_entry *h,
+ bfd *abfd,
+ struct bfd_link_info *info,
+ struct score_got_info *g)
+{
+ struct score_got_entry entry, **loc;
+
+ /* A global symbol in the GOT must also be in the dynamic symbol table. */
+ if (h->dynindx == -1)
+ {
+ switch (ELF_ST_VISIBILITY (h->other))
+ {
+ case STV_INTERNAL:
+ case STV_HIDDEN:
+ _bfd_score_elf_hide_symbol (info, h, TRUE);
+ break;
+ }
+ if (!bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
+ }
+
+ entry.abfd = abfd;
+ entry.symndx = -1;
+ entry.d.h = (struct score_elf_link_hash_entry *)h;
+
+ loc = (struct score_got_entry **)htab_find_slot (g->got_entries, &entry, INSERT);
+
+ /* If we've already marked this entry as needing GOT space, we don't
+ need to do it again. */
+ if (*loc)
+ return TRUE;
+
+ *loc = bfd_alloc (abfd, sizeof entry);
+ if (! *loc)
+ return FALSE;
+
+ entry.gotidx = -1;
+
+ memcpy (*loc, &entry, sizeof (entry));
+
+ if (h->got.offset != MINUS_ONE)
+ return TRUE;
+
+ /* By setting this to a value other than -1, we are indicating that
+ there needs to be a GOT entry for H. Avoid using zero, as the
+ generic ELF copy_indirect_symbol tests for <= 0. */
+ h->got.offset = 1;
+
+ return TRUE;
+}
+
+/* Reserve space in G for a GOT entry containing the value of symbol
+ SYMNDX in input bfd ABDF, plus ADDEND. */
+
+static bfd_boolean
+score_elf_record_local_got_symbol (bfd *abfd,
+ long symndx,
+ bfd_vma addend,
+ struct score_got_info *g)
+{
+ struct score_got_entry entry, **loc;
+
+ entry.abfd = abfd;
+ entry.symndx = symndx;
+ entry.d.addend = addend;
+ loc = (struct score_got_entry **)htab_find_slot (g->got_entries, &entry, INSERT);
+
+ if (*loc)
+ return TRUE;
+
+ entry.gotidx = g->local_gotno++;
+
+ *loc = bfd_alloc (abfd, sizeof(entry));
+ if (! *loc)
+ return FALSE;
+
+ memcpy (*loc, &entry, sizeof (entry));
+
+ return TRUE;
+}
+
+/* Returns the GOT offset at which the indicated address can be found.
+ If there is not yet a GOT entry for this value, create one.
+ Returns -1 if no satisfactory GOT offset can be found. */
+
+static bfd_vma
+score_elf_local_got_index (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
+ bfd_vma value, unsigned long r_symndx,
+ struct score_elf_link_hash_entry *h, int r_type)
+{
+ asection *sgot;
+ struct score_got_info *g;
+ struct score_got_entry *entry;
+
+ g = score_elf_got_info (elf_hash_table (info)->dynobj, &sgot);
+
+ entry = score_elf_create_local_got_entry (abfd, ibfd, g, sgot, value,
+ r_symndx, h, r_type);
+ if (!entry)
+ return MINUS_ONE;
+
+ else
+ return entry->gotidx;
+}
+
+/* Returns the GOT index for the global symbol indicated by H. */
+
+static bfd_vma
+score_elf_global_got_index (bfd *abfd, struct elf_link_hash_entry *h)
+{
+ bfd_vma index;
+ asection *sgot;
+ struct score_got_info *g;
+ long global_got_dynindx = 0;
+
+ g = score_elf_got_info (abfd, &sgot);
+ if (g->global_gotsym != NULL)
+ global_got_dynindx = g->global_gotsym->dynindx;
+
+ /* Once we determine the global GOT entry with the lowest dynamic
+ symbol table index, we must put all dynamic symbols with greater
+ indices into the GOT. That makes it easy to calculate the GOT
+ offset. */
+ BFD_ASSERT (h->dynindx >= global_got_dynindx);
+ index = ((h->dynindx - global_got_dynindx + g->local_gotno) * SCORE_ELF_GOT_SIZE (abfd));
+ BFD_ASSERT (index < sgot->size);
+
+ return index;
+}
+
+/* Returns the offset for the entry at the INDEXth position in the GOT. */
+
+static bfd_vma
+score_elf_got_offset_from_index (bfd *dynobj, bfd *output_bfd,
+ bfd *input_bfd ATTRIBUTE_UNUSED, bfd_vma index)
+{
+ asection *sgot;
+ bfd_vma gp;
+ struct score_got_info *g;
+
+ g = score_elf_got_info (dynobj, &sgot);
+ gp = _bfd_get_gp_value (output_bfd);
+
+ return sgot->output_section->vma + sgot->output_offset + index - gp;
+}
+
+/* Follow indirect and warning hash entries so that each got entry
+ points to the final symbol definition. P must point to a pointer
+ to the hash table we're traversing. Since this traversal may
+ modify the hash table, we set this pointer to NULL to indicate
+ we've made a potentially-destructive change to the hash table, so
+ the traversal must be restarted. */
+static int
+score_elf_resolve_final_got_entry (void **entryp, void *p)
+{
+ struct score_got_entry *entry = (struct score_got_entry *)*entryp;
+ htab_t got_entries = *(htab_t *)p;
+
+ if (entry->abfd != NULL && entry->symndx == -1)
+ {
+ struct score_elf_link_hash_entry *h = entry->d.h;
+
+ while (h->root.root.type == bfd_link_hash_indirect
+ || h->root.root.type == bfd_link_hash_warning)
+ h = (struct score_elf_link_hash_entry *) h->root.root.u.i.link;
+
+ if (entry->d.h == h)
+ return 1;
+
+ entry->d.h = h;
+
+ /* If we can't find this entry with the new bfd hash, re-insert
+ it, and get the traversal restarted. */
+ if (! htab_find (got_entries, entry))
+ {
+ htab_clear_slot (got_entries, entryp);
+ entryp = htab_find_slot (got_entries, entry, INSERT);
+ if (! *entryp)
+ *entryp = entry;
+ /* Abort the traversal, since the whole table may have
+ moved, and leave it up to the parent to restart the
+ process. */
+ *(htab_t *)p = NULL;
+ return 0;
+ }
+ /* We might want to decrement the global_gotno count, but it's
+ either too early or too late for that at this point. */
+ }
+
+ return 1;
+}
+
+/* Turn indirect got entries in a got_entries table into their final locations. */
+static void
+score_elf_resolve_final_got_entries (struct score_got_info *g)
+{
+ htab_t got_entries;
+
+ do
+ {
+ got_entries = g->got_entries;
+
+ htab_traverse (got_entries,
+ score_elf_resolve_final_got_entry,
+ &got_entries);
+ }
+ while (got_entries == NULL);
+}
+
+/* Add INCREMENT to the reloc (of type HOWTO) at ADDRESS. for -r */
+
+static void
+score_elf_add_to_rel (bfd *abfd,
+ bfd_byte *address,
+ reloc_howto_type *howto,
+ bfd_signed_vma increment)
+{
+ bfd_signed_vma addend;
+ bfd_vma contents;
+ unsigned long offset;
+ unsigned long r_type = howto->type;
+ unsigned long hi16_addend, hi16_offset, hi16_value, uvalue;
+
+ contents = bfd_get_32 (abfd, address);
+ /* Get the (signed) value from the instruction. */
+ addend = contents & howto->src_mask;
+ if (addend & ((howto->src_mask + 1) >> 1))
+ {
+ bfd_signed_vma mask;
+
+ mask = -1;
+ mask &= ~howto->src_mask;
+ addend |= mask;
+ }
+ /* Add in the increment, (which is a byte value). */
+ switch (r_type)
+ {
+ case R_SCORE_PC19:
+ offset =
+ (((contents & howto->src_mask) & 0x3ff0000) >> 6) | ((contents & howto->src_mask) & 0x3ff);
+ offset += increment;
+ contents =
+ (contents & ~howto->
+ src_mask) | (((offset << 6) & howto->src_mask) & 0x3ff0000) | (offset & 0x3ff);
+ bfd_put_32 (abfd, contents, address);
+ break;
+ case R_SCORE_HI16:
+ break;
+ case R_SCORE_LO16:
+ hi16_addend = bfd_get_32 (abfd, address - 4);
+ hi16_offset = ((((hi16_addend >> 16) & 0x3) << 15) | (hi16_addend & 0x7fff)) >> 1;
+ offset = ((((contents >> 16) & 0x3) << 15) | (contents & 0x7fff)) >> 1;
+ offset = (hi16_offset << 16) | (offset & 0xffff);
+ uvalue = increment + offset;
+ hi16_offset = (uvalue >> 16) << 1;
+ hi16_value = (hi16_addend & (~(howto->dst_mask)))
+ | (hi16_offset & 0x7fff) | ((hi16_offset << 1) & 0x30000);
+ bfd_put_32 (abfd, hi16_value, address - 4);
+ offset = (uvalue & 0xffff) << 1;
+ contents = (contents & (~(howto->dst_mask))) | (offset & 0x7fff) | ((offset << 1) & 0x30000);
+ bfd_put_32 (abfd, contents, address);
+ break;
+ case R_SCORE_24:
+ offset =
+ (((contents & howto->src_mask) >> 1) & 0x1ff8000) | ((contents & howto->src_mask) & 0x7fff);
+ offset += increment;
+ contents =
+ (contents & ~howto->
+ src_mask) | (((offset << 1) & howto->src_mask) & 0x3ff0000) | (offset & 0x7fff);
+ bfd_put_32 (abfd, contents, address);
+ break;
+ case R_SCORE16_11:
+
+ contents = bfd_get_16 (abfd, address);
+ offset = contents & howto->src_mask;
+ offset += increment;
+ contents = (contents & ~howto->src_mask) | (offset & howto->src_mask);
+ bfd_put_16 (abfd, contents, address);
+
+ break;
+ case R_SCORE16_PC8:
+
+ contents = bfd_get_16 (abfd, address);
+ offset = (contents & howto->src_mask) + ((increment >> 1) & 0xff);
+ contents = (contents & (~howto->src_mask)) | (offset & howto->src_mask);
+ bfd_put_16 (abfd, contents, address);
+
+ break;
+ default:
+ addend += increment;
+ contents = (contents & ~howto->dst_mask) | (addend & howto->dst_mask);
+ bfd_put_32 (abfd, contents, address);
+ break;
+ }
+}
+
+/* Perform a relocation as part of a final link. */
+
+static bfd_reloc_status_type
+score_elf_final_link_relocate (reloc_howto_type *howto,
+ bfd *input_bfd,
+ bfd *output_bfd,
+ asection *input_section,
+ bfd_byte *contents,
+ Elf_Internal_Rela *rel,
+ Elf_Internal_Rela *relocs,
+ bfd_vma symbol,
+ struct bfd_link_info *info,
+ const char *sym_name ATTRIBUTE_UNUSED,
+ int sym_flags ATTRIBUTE_UNUSED,
+ struct score_elf_link_hash_entry *h,
+ asection **local_sections,
+ bfd_boolean gp_disp_p)
+{
+ unsigned long r_type;
+ unsigned long r_symndx;
+ bfd_byte *hit_data = contents + rel->r_offset;
+ bfd_vma addend;
+ /* The final GP value to be used for the relocatable, executable, or
+ shared object file being produced. */
+ bfd_vma gp = MINUS_ONE;
+ /* The place (section offset or address) of the storage unit being relocated. */
+ bfd_vma rel_addr;
+ /* The value of GP used to create the relocatable object. */
+ bfd_vma gp0 = MINUS_ONE;
+ /* The offset into the global offset table at which the address of the relocation entry
+ symbol, adjusted by the addend, resides during execution. */
+ bfd_vma g = MINUS_ONE;
+ /* TRUE if the symbol referred to by this relocation is a local symbol. */
+ bfd_boolean local_p;
+ /* The eventual value we will relocate. */
+ bfd_vma value = symbol;
+ unsigned long hi16_addend, hi16_offset, hi16_value, uvalue, offset, abs_value = 0;
+
+ if (elf_gp (output_bfd) == 0)
+ {
+ struct bfd_link_hash_entry *bh;
+ asection *o;
+
+ bh = bfd_link_hash_lookup (info->hash, "_gp", 0, 0, 1);
+ if (bh != (struct bfd_link_hash_entry *)NULL && bh->type == bfd_link_hash_defined)
+ elf_gp (output_bfd) = (bh->u.def.value
+ + bh->u.def.section->output_section->vma
+ + bh->u.def.section->output_offset);
+ else if (info->relocatable)
+ {
+ bfd_vma lo = -1;
+
+ /* Find the GP-relative section with the lowest offset. */
+ for (o = output_bfd->sections; o != (asection *) NULL; o = o->next)
+ if (o->vma < lo)
+ lo = o->vma;
+ /* And calculate GP relative to that. */
+ elf_gp (output_bfd) = lo + ELF_SCORE_GP_OFFSET (input_bfd);
+ }
+ else
+ {
+ /* If the relocate_section function needs to do a reloc
+ involving the GP value, it should make a reloc_dangerous
+ callback to warn that GP is not defined. */
+ }
+ }
+
+ /* Parse the relocation. */
+ r_symndx = ELF32_R_SYM (rel->r_info);
+ r_type = ELF32_R_TYPE (rel->r_info);
+ rel_addr = (input_section->output_section->vma + input_section->output_offset + rel->r_offset);
+ local_p = score_elf_local_relocation_p (input_bfd, rel, local_sections, TRUE);
+
+ if (r_type == R_SCORE_GOT15)
+ {
+ const Elf_Internal_Rela *relend;
+ const Elf_Internal_Rela *lo16_rel;
+ const struct elf_backend_data *bed;
+ bfd_vma lo_value = 0;
+
+ bed = get_elf_backend_data (output_bfd);
+ relend = relocs + input_section->reloc_count * bed->s->int_rels_per_ext_rel;
+ lo16_rel = score_elf_next_relocation (input_bfd, R_SCORE_GOT_LO16, rel, relend);
+ if ((local_p) && (lo16_rel != NULL))
+ {
+ bfd_vma tmp = 0;
+ tmp = bfd_get_32 (input_bfd, contents + lo16_rel->r_offset);
+ lo_value = (((tmp >> 16) & 0x3) << 14) | ((tmp & 0x7fff) >> 1);
+ }
+ addend = lo_value;
+ }
+ else
+ {
+ addend = (bfd_get_32 (input_bfd, hit_data) >> howto->bitpos) & howto->src_mask;
+ }
+
+ /* If we haven't already determined the GOT offset, or the GP value,
+ and we're going to need it, get it now. */
+ switch (r_type)
+ {
+ case R_SCORE_CALL15:
+ case R_SCORE_GOT15:
+ if (!local_p)
+ {
+ g = score_elf_global_got_index (elf_hash_table (info)->dynobj,
+ (struct elf_link_hash_entry *) h);
+ if ((! elf_hash_table(info)->dynamic_sections_created
+ || (info->shared
+ && (info->symbolic || h->root.dynindx == -1)
+ && h->root.def_regular)))
+ {
+ /* This is a static link or a -Bsymbolic link. The
+ symbol is defined locally, or was forced to be local.
+ We must initialize this entry in the GOT. */
+ bfd *tmpbfd = elf_hash_table (info)->dynobj;
+ asection *sgot = score_elf_got_section (tmpbfd, FALSE);
+ bfd_put_32 (tmpbfd, value, sgot->contents + g);
+ }
+ }
+ else if (r_type == R_SCORE_GOT15 || r_type == R_SCORE_CALL15)
+ {
+ /* There's no need to create a local GOT entry here; the
+ calculation for a local GOT15 entry does not involve G. */
+ ;
+ }
+ else
+ {
+ g = score_elf_local_got_index (output_bfd, input_bfd, info,
+ symbol + addend, r_symndx, h, r_type);
+ if (g == MINUS_ONE)
+ return bfd_reloc_outofrange;
+ }
+
+ /* Convert GOT indices to actual offsets. */
+ g = score_elf_got_offset_from_index (elf_hash_table (info)->dynobj,
+ output_bfd, input_bfd, g);
+ break;
+
+ case R_SCORE_HI16:
+ case R_SCORE_LO16:
+ case R_SCORE_GPREL32:
+ gp0 = _bfd_get_gp_value (input_bfd);
+ gp = _bfd_get_gp_value (output_bfd);
+ break;
+
+ case R_SCORE_GP15:
+ gp = _bfd_get_gp_value (output_bfd);
+
+ default:
+ break;
+ }
+
+ switch (r_type)
+ {
+ case R_SCORE_NONE:
+ return bfd_reloc_ok;
+
+ case R_SCORE_ABS32:
+ case R_SCORE_REL32:
+ if ((info->shared
+ || (elf_hash_table (info)->dynamic_sections_created
+ && h != NULL
+ && h->root.def_dynamic
+ && !h->root.def_regular))
+ && r_symndx != 0
+ && (input_section->flags & SEC_ALLOC) != 0)
+ {
+ /* If we're creating a shared library, or this relocation is against a symbol
+ in a shared library, then we can't know where the symbol will end up.
+ So, we create a relocation record in the output, and leave the job up
+ to the dynamic linker. */
+ value = addend;
+ if (!score_elf_create_dynamic_relocation (output_bfd, info, rel, h,
+ symbol, &value,
+ input_section))
+ return bfd_reloc_undefined;
+ }
+ else
+ {
+ if (r_type != R_SCORE_REL32)
+ value = symbol + addend;
+ else
+ value = addend;
+ }
+ value &= howto->dst_mask;
+ bfd_put_32 (input_bfd, value, hit_data);
+ return bfd_reloc_ok;
+
+ case R_SCORE_ABS16:
+ value += addend;
+ if ((long)value > 0x7fff || (long)value < -0x8000)
+ return bfd_reloc_overflow;
+ bfd_put_16 (input_bfd, value, hit_data);
+ return bfd_reloc_ok;
+
+ case R_SCORE_24:
+ addend = bfd_get_32 (input_bfd, hit_data);
+ offset = (((addend & howto->src_mask) >> 1) & 0x1ff8000) | ((addend & howto->src_mask) & 0x7fff);
+ if ((offset & 0x1000000) != 0)
+ offset |= 0xfe000000;
+ value += offset;
+ addend = (addend & ~howto->src_mask)
+ | (((value << 1) & howto->src_mask) & 0x3ff0000) | (value & 0x7fff);
+ bfd_put_32 (input_bfd, addend, hit_data);
+ return bfd_reloc_ok;
+
+ case R_SCORE_PC19:
+ addend = bfd_get_32 (input_bfd, hit_data);
+ offset = (((addend & howto->src_mask) & 0x3ff0000) >> 6) | ((addend & howto->src_mask) & 0x3ff);
+ if ((offset & 0x80000) != 0)
+ offset |= 0xfff00000;
+ abs_value = value = value - rel_addr + offset;
+ /* exceed 20 bit : overflow. */
+ if ((abs_value & 0x80000000) == 0x80000000)
+ abs_value = 0xffffffff - value + 1;
+ if ((abs_value & 0xfff80000) != 0)
+ return bfd_reloc_overflow;
+ addend = (addend & ~howto->src_mask)
+ | (((value << 6) & howto->src_mask) & 0x3ff0000) | (value & 0x3ff);
+ bfd_put_32 (input_bfd, addend, hit_data);
+ return bfd_reloc_ok;
+
+ case R_SCORE16_11:
+ addend = bfd_get_16 (input_bfd, hit_data);
+ offset = addend & howto->src_mask;
+ if ((offset & 0x800) != 0) /* Offset is negative. */
+ offset |= 0xfffff000;
+ value += offset;
+ addend = (addend & ~howto->src_mask) | (value & howto->src_mask);
+ bfd_put_16 (input_bfd, addend, hit_data);
+ return bfd_reloc_ok;
+
+ case R_SCORE16_PC8:
+ addend = bfd_get_16 (input_bfd, hit_data);
+ offset = (addend & howto->src_mask) << 1;
+ if ((offset & 0x100) != 0) /* Offset is negative. */
+ offset |= 0xfffffe00;
+ abs_value = value = value - rel_addr + offset;
+ /* Sign bit + exceed 9 bit. */
+ if (((value & 0xffffff00) != 0) && ((value & 0xffffff00) != 0xffffff00))
+ return bfd_reloc_overflow;
+ value >>= 1;
+ addend = (addend & ~howto->src_mask) | (value & howto->src_mask);
+ bfd_put_16 (input_bfd, addend, hit_data);
+ return bfd_reloc_ok;
+
+ case R_SCORE_HI16:
+ return bfd_reloc_ok;
+
+ case R_SCORE_LO16:
+ hi16_addend = bfd_get_32 (input_bfd, hit_data - 4);
+ hi16_offset = ((((hi16_addend >> 16) & 0x3) << 15) | (hi16_addend & 0x7fff)) >> 1;
+ addend = bfd_get_32 (input_bfd, hit_data);
+ offset = ((((addend >> 16) & 0x3) << 15) | (addend & 0x7fff)) >> 1;
+ offset = (hi16_offset << 16) | (offset & 0xffff);
+
+ if (!gp_disp_p)
+ uvalue = value + offset;
+ else
+ uvalue = offset + gp - rel_addr + 4;
+
+ hi16_offset = (uvalue >> 16) << 1;
+ hi16_value = (hi16_addend & (~(howto->dst_mask)))
+ | (hi16_offset & 0x7fff) | ((hi16_offset << 1) & 0x30000);
+ bfd_put_32 (input_bfd, hi16_value, hit_data - 4);
+ offset = (uvalue & 0xffff) << 1;
+ value = (addend & (~(howto->dst_mask))) | (offset & 0x7fff) | ((offset << 1) & 0x30000);
+ bfd_put_32 (input_bfd, value, hit_data);
+ return bfd_reloc_ok;
+
+ case R_SCORE_GP15:
+ addend = bfd_get_32 (input_bfd, hit_data);
+ offset = addend & 0x7fff;
+ if ((offset & 0x4000) == 0x4000)
+ offset |= 0xffffc000;
+ value = value + offset - gp;
+ if (((value & 0xffffc000) != 0) && ((value & 0xffffc000) != 0xffffc000))
+ return bfd_reloc_overflow;
+ value = (addend & ~howto->src_mask) | (value & howto->src_mask);
+ bfd_put_32 (input_bfd, value, hit_data);
+ return bfd_reloc_ok;
+
+ case R_SCORE_GOT15:
+ case R_SCORE_CALL15:
+ if (local_p)
+ {
+ bfd_boolean forced;
+
+ /* The special case is when the symbol is forced to be local. We need the
+ full address in the GOT since no R_SCORE_GOT_LO16 relocation follows. */
+ forced = ! score_elf_local_relocation_p (input_bfd, rel,
+ local_sections, FALSE);
+ value = score_elf_got16_entry (output_bfd, input_bfd, info,
+ symbol + addend, forced);
+ if (value == MINUS_ONE)
+ return bfd_reloc_outofrange;
+ value = score_elf_got_offset_from_index (elf_hash_table (info)->dynobj,
+ output_bfd, input_bfd, value);
+ }
+ else
+ {
+ value = g;
+ }
+
+ if ((long) value > 0x3fff || (long) value < -0x4000)
+ return bfd_reloc_overflow;
+
+ addend = bfd_get_32 (input_bfd, hit_data);
+ value = (addend & ~howto->dst_mask) | (value & howto->dst_mask);
+ bfd_put_32 (input_bfd, value, hit_data);
+ return bfd_reloc_ok;
+
+ case R_SCORE_GPREL32:
+ value = (addend + symbol - gp);
+ value &= howto->dst_mask;
+ bfd_put_32 (input_bfd, value, hit_data);
+ return bfd_reloc_ok;
+
+ case R_SCORE_GOT_LO16:
+ addend = bfd_get_32 (input_bfd, hit_data);
+ value = (((addend >> 16) & 0x3) << 14) | ((addend & 0x7fff) >> 1);
+ value += symbol;
+ value = (addend & (~(howto->dst_mask))) | ((value & 0x3fff) << 1)
+ | (((value >> 14) & 0x3) << 16);
+
+ bfd_put_32 (input_bfd, value, hit_data);
+ return bfd_reloc_ok;
+
+ case R_SCORE_DUMMY_HI16:
+ return bfd_reloc_ok;
+
+ case R_SCORE_GNU_VTINHERIT:
+ case R_SCORE_GNU_VTENTRY:
+ /* We don't do anything with these at present. */
+ return bfd_reloc_continue;
+
+ default:
+ return bfd_reloc_notsupported;
+ }
+}
+
+/* Score backend functions. */
+
+static void
+_bfd_score_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
+ arelent *bfd_reloc,
+ Elf_Internal_Rela *elf_reloc)
+{
+ unsigned int r_type;
+
+ r_type = ELF32_R_TYPE (elf_reloc->r_info);
+ if (r_type >= NUM_ELEM (elf32_score_howto_table))
+ bfd_reloc->howto = NULL;
+ else
+ bfd_reloc->howto = &elf32_score_howto_table[r_type];
+}
+
+/* Relocate an score ELF section. */
+
+static bfd_boolean
+_bfd_score_elf_relocate_section (bfd *output_bfd,
+ struct bfd_link_info *info,
+ bfd *input_bfd,
+ asection *input_section,
+ bfd_byte *contents,
+ Elf_Internal_Rela *relocs,
+ Elf_Internal_Sym *local_syms,
+ asection **local_sections)
+{
+ Elf_Internal_Shdr *symtab_hdr;
+ struct elf_link_hash_entry **sym_hashes;
+ Elf_Internal_Rela *rel;
+ Elf_Internal_Rela *relend;
+ const char *name;
+ unsigned long offset;
+ unsigned long hi16_addend, hi16_offset, hi16_value, uvalue;
+ size_t extsymoff;
+ bfd_boolean gp_disp_p = FALSE;
+
+ /* Sort dynsym. */
+ if (elf_hash_table (info)->dynamic_sections_created)
+ {
+ bfd_size_type dynsecsymcount = 0;
+ if (info->shared)
+ {
+ asection * p;
+ const struct elf_backend_data *bed = get_elf_backend_data (output_bfd);
+
+ for (p = output_bfd->sections; p ; p = p->next)
+ if ((p->flags & SEC_EXCLUDE) == 0
+ && (p->flags & SEC_ALLOC) != 0
+ && !(*bed->elf_backend_omit_section_dynsym) (output_bfd, info, p))
+ ++ dynsecsymcount;
+ }
+
+ if (!score_elf_sort_hash_table (info, dynsecsymcount + 1))
+ return FALSE;
+ }
+
+ symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+ extsymoff = (elf_bad_symtab (input_bfd)) ? 0 : symtab_hdr->sh_info;
+ sym_hashes = elf_sym_hashes (input_bfd);
+ rel = relocs;
+ relend = relocs + input_section->reloc_count;
+ for (; rel < relend; rel++)
+ {
+ int r_type;
+ reloc_howto_type *howto;
+ unsigned long r_symndx;
+ Elf_Internal_Sym *sym;
+ asection *sec;
+ struct score_elf_link_hash_entry *h;
+ bfd_vma relocation = 0;
+ bfd_reloc_status_type r;
+ arelent bfd_reloc;
+
+ r_symndx = ELF32_R_SYM (rel->r_info);
+ r_type = ELF32_R_TYPE (rel->r_info);
+
+ _bfd_score_info_to_howto (input_bfd, &bfd_reloc, (Elf_Internal_Rela *) rel);
+ howto = bfd_reloc.howto;
+
+ h = NULL;
+ sym = NULL;
+ sec = NULL;
+
+ if (r_symndx < extsymoff)
+ {
+ sym = local_syms + r_symndx;
+ sec = local_sections[r_symndx];
+ relocation = (sec->output_section->vma
+ + sec->output_offset
+ + sym->st_value);
+ name = bfd_elf_sym_name (input_bfd, symtab_hdr, sym, sec);
+
+ if (!info->relocatable
+ && (sec->flags & SEC_MERGE) != 0
+ && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ {
+ asection *msec;
+ bfd_vma addend, value;
+
+ switch (r_type)
+ {
+ case R_SCORE_HI16:
+ break;
+ case R_SCORE_LO16:
+ hi16_addend = bfd_get_32 (input_bfd, contents + rel->r_offset - 4);
+ hi16_offset = ((((hi16_addend >> 16) & 0x3) << 15) | (hi16_addend & 0x7fff)) >> 1;
+ value = bfd_get_32 (input_bfd, contents + rel->r_offset);
+ offset = ((((value >> 16) & 0x3) << 15) | (value & 0x7fff)) >> 1;
+ addend = (hi16_offset << 16) | (offset & 0xffff);
+ msec = sec;
+ addend = _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend);
+ addend -= relocation;
+ addend += msec->output_section->vma + msec->output_offset;
+ uvalue = addend;
+ hi16_offset = (uvalue >> 16) << 1;
+ hi16_value = (hi16_addend & (~(howto->dst_mask)))
+ | (hi16_offset & 0x7fff) | ((hi16_offset << 1) & 0x30000);
+ bfd_put_32 (input_bfd, hi16_value, contents + rel->r_offset - 4);
+ offset = (uvalue & 0xffff) << 1;
+ value = (value & (~(howto->dst_mask)))
+ | (offset & 0x7fff) | ((offset << 1) & 0x30000);
+ bfd_put_32 (input_bfd, value, contents + rel->r_offset);
+ break;
+ case R_SCORE_GOT_LO16:
+ value = bfd_get_32 (input_bfd, contents + rel->r_offset);
+ addend = (((value >> 16) & 0x3) << 14) | ((value & 0x7fff) >> 1);
+ msec = sec;
+ addend = _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend) - relocation;
+ addend += msec->output_section->vma + msec->output_offset;
+ value = (value & (~(howto->dst_mask))) | ((addend & 0x3fff) << 1)
+ | (((addend >> 14) & 0x3) << 16);
+
+ bfd_put_32 (input_bfd, value, contents + rel->r_offset);
+ break;
+ default:
+ value = bfd_get_32 (input_bfd, contents + rel->r_offset);
+ /* Get the (signed) value from the instruction. */
+ addend = value & howto->src_mask;
+ if (addend & ((howto->src_mask + 1) >> 1))
+ {
+ bfd_signed_vma mask;
+
+ mask = -1;
+ mask &= ~howto->src_mask;
+ addend |= mask;
+ }
+ msec = sec;
+ addend = _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend) - relocation;
+ addend += msec->output_section->vma + msec->output_offset;
+ value = (value & ~howto->dst_mask) | (addend & howto->dst_mask);
+ bfd_put_32 (input_bfd, value, contents + rel->r_offset);
+ break;
+ }
+ }
+ }
+ else
+ {
+ /* For global symbols we look up the symbol in the hash-table. */
+ h = ((struct score_elf_link_hash_entry *)
+ elf_sym_hashes (input_bfd) [r_symndx - extsymoff]);
+ /* Find the real hash-table entry for this symbol. */
+ while (h->root.root.type == bfd_link_hash_indirect
+ || h->root.root.type == bfd_link_hash_warning)
+ h = (struct score_elf_link_hash_entry *) h->root.root.u.i.link;
+
+ /* Record the name of this symbol, for our caller. */
+ name = h->root.root.root.string;
+
+ /* See if this is the special GP_DISP_LABEL symbol. Note that such a
+ symbol must always be a global symbol. */
+ if (strcmp (name, GP_DISP_LABEL) == 0)
+ {
+ /* Relocations against GP_DISP_LABEL are permitted only with
+ R_SCORE_HI16 and R_SCORE_LO16 relocations. */
+ if (r_type != R_SCORE_HI16 && r_type != R_SCORE_LO16)
+ return bfd_reloc_notsupported;
+
+ gp_disp_p = TRUE;
+ }
+
+ /* If this symbol is defined, calculate its address. Note that
+ GP_DISP_LABEL is a magic symbol, always implicitly defined by the
+ linker, so it's inappropriate to check to see whether or not
+ its defined. */
+ else if ((h->root.root.type == bfd_link_hash_defined
+ || h->root.root.type == bfd_link_hash_defweak)
+ && h->root.root.u.def.section)
+ {
+ sec = h->root.root.u.def.section;
+ if (sec->output_section)
+ relocation = (h->root.root.u.def.value
+ + sec->output_section->vma
+ + sec->output_offset);
+ else
+ {
+ relocation = h->root.root.u.def.value;
+ }
+ }
+ else if (h->root.root.type == bfd_link_hash_undefweak)
+ /* We allow relocations against undefined weak symbols, giving
+ it the value zero, so that you can undefined weak functions
+ and check to see if they exist by looking at their addresses. */
+ relocation = 0;
+ else if (info->unresolved_syms_in_objects == RM_IGNORE
+ && ELF_ST_VISIBILITY (h->root.other) == STV_DEFAULT)
+ relocation = 0;
+ else if (strcmp (name, "_DYNAMIC_LINK") == 0)
+ {
+ /* If this is a dynamic link, we should have created a _DYNAMIC_LINK symbol
+ in _bfd_score_elf_create_dynamic_sections. Otherwise, we should define
+ the symbol with a value of 0. */
+ BFD_ASSERT (! info->shared);
+ BFD_ASSERT (bfd_get_section_by_name (output_bfd, ".dynamic") == NULL);
+ relocation = 0;
+ }
+ else if (!info->relocatable)
+ {
+ if (! ((*info->callbacks->undefined_symbol)
+ (info, h->root.root.root.string, input_bfd,
+ input_section, rel->r_offset,
+ (info->unresolved_syms_in_objects == RM_GENERATE_ERROR)
+ || ELF_ST_VISIBILITY (h->root.other))))
+ return bfd_reloc_undefined;
+ relocation = 0;
+ }
+ }
+
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ {
+ /* This is a relocatable link. We don't have to change
+ anything, unless the reloc is against a section symbol,
+ in which case we have to adjust according to where the
+ section symbol winds up in the output section. */
+ if (sym != NULL && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ score_elf_add_to_rel (input_bfd, contents + rel->r_offset,
+ howto, (bfd_signed_vma) sec->output_offset);
+ continue;
+ }
+
+ r = score_elf_final_link_relocate (howto, input_bfd, output_bfd,
+ input_section, contents, rel, relocs,
+ relocation, info, name,
+ (h ? ELF_ST_TYPE ((unsigned int)h->root.root.type) :
+ ELF_ST_TYPE ((unsigned int)sym->st_info)), h, local_sections,
+ gp_disp_p);
+
+ if (r != bfd_reloc_ok)
+ {
+ const char *msg = (const char *)0;
+
+ switch (r)
+ {
+ case bfd_reloc_overflow:
+ /* If the overflowing reloc was to an undefined symbol,
+ we have already printed one error message and there
+ is no point complaining again. */
+ if (((!h) || (h->root.root.type != bfd_link_hash_undefined))
+ && (!((*info->callbacks->reloc_overflow)
+ (info, NULL, name, howto->name, (bfd_vma) 0,
+ input_bfd, input_section, rel->r_offset))))
+ return FALSE;
+ break;
+ case bfd_reloc_undefined:
+ if (!((*info->callbacks->undefined_symbol)
+ (info, name, input_bfd, input_section, rel->r_offset, TRUE)))
+ return FALSE;
+ break;
+
+ case bfd_reloc_outofrange:
+ msg = _("internal error: out of range error");
+ goto common_error;
+
+ case bfd_reloc_notsupported:
+ msg = _("internal error: unsupported relocation error");
+ goto common_error;
+
+ case bfd_reloc_dangerous:
+ msg = _("internal error: dangerous error");
+ goto common_error;
+
+ default:
+ msg = _("internal error: unknown error");
+ /* fall through */
+
+ common_error:
+ if (!((*info->callbacks->warning)
+ (info, msg, name, input_bfd, input_section, rel->r_offset)))
+ return FALSE;
+ break;
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+/* Look through the relocs for a section during the first phase, and
+ allocate space in the global offset table. */
+
+static bfd_boolean
+_bfd_score_elf_check_relocs (bfd *abfd,
+ struct bfd_link_info *info,
+ asection *sec,
+ const Elf_Internal_Rela *relocs)
+{
+ const char *name;
+ bfd *dynobj;
+ Elf_Internal_Shdr *symtab_hdr;
+ struct elf_link_hash_entry **sym_hashes;
+ struct score_got_info *g;
+ size_t extsymoff;
+ const Elf_Internal_Rela *rel;
+ const Elf_Internal_Rela *rel_end;
+ asection *sgot;
+ asection *sreloc;
+ const struct elf_backend_data *bed;
+
+ if (info->relocatable)
+ return TRUE;
+
+ dynobj = elf_hash_table (info)->dynobj;
+ symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+ sym_hashes = elf_sym_hashes (abfd);
+ extsymoff = (elf_bad_symtab (abfd)) ? 0 : symtab_hdr->sh_info;
+
+ name = bfd_get_section_name (abfd, sec);
+
+ if (dynobj == NULL)
+ {
+ sgot = NULL;
+ g = NULL;
+ }
+ else
+ {
+ sgot = score_elf_got_section (dynobj, FALSE);
+ if (sgot == NULL)
+ g = NULL;
+ else
+ {
+ BFD_ASSERT (score_elf_section_data (sgot) != NULL);
+ g = score_elf_section_data (sgot)->u.got_info;
+ BFD_ASSERT (g != NULL);
+ }
+ }
+
+ sreloc = NULL;
+ bed = get_elf_backend_data (abfd);
+ rel_end = relocs + sec->reloc_count * bed->s->int_rels_per_ext_rel;
+ for (rel = relocs; rel < rel_end; ++rel)
+ {
+ unsigned long r_symndx;
+ unsigned int r_type;
+ struct elf_link_hash_entry *h;
+
+ r_symndx = ELF32_R_SYM (rel->r_info);
+ r_type = ELF32_R_TYPE (rel->r_info);
+
+ if (r_symndx < extsymoff)
+ {
+ h = NULL;
+ }
+ else if (r_symndx >= extsymoff + NUM_SHDR_ENTRIES (symtab_hdr))
+ {
+ (*_bfd_error_handler) (_("%s: Malformed reloc detected for section %s"), abfd, name);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+ else
+ {
+ h = sym_hashes[r_symndx - extsymoff];
+
+ /* This may be an indirect symbol created because of a version. */
+ if (h != NULL)
+ {
+ while (h->root.type == bfd_link_hash_indirect)
+ h = (struct elf_link_hash_entry *)h->root.u.i.link;
+ }
+ }
+
+ /* Some relocs require a global offset table. */
+ if (dynobj == NULL || sgot == NULL)
+ {
+ switch (r_type)
+ {
+ case R_SCORE_GOT15:
+ case R_SCORE_CALL15:
+ if (dynobj == NULL)
+ elf_hash_table (info)->dynobj = dynobj = abfd;
+ if (!score_elf_create_got_section (dynobj, info, FALSE))
+ return FALSE;
+ g = score_elf_got_info (dynobj, &sgot);
+ break;
+ case R_SCORE_ABS32:
+ case R_SCORE_REL32:
+ if (dynobj == NULL && (info->shared || h != NULL) && (sec->flags & SEC_ALLOC) != 0)
+ elf_hash_table (info)->dynobj = dynobj = abfd;
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (!h && (r_type == R_SCORE_GOT_LO16))
+ {
+ if (! score_elf_record_local_got_symbol (abfd, r_symndx, rel->r_addend, g))
+ return FALSE;
+ }
+
+ switch (r_type)
+ {
+ case R_SCORE_CALL15:
+ if (h == NULL)
+ {
+ (*_bfd_error_handler)
+ (_("%B: CALL15 reloc at 0x%lx not against global symbol"),
+ abfd, (unsigned long) rel->r_offset);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+ else
+ {
+ /* This symbol requires a global offset table entry. */
+ if (! score_elf_record_global_got_symbol (h, abfd, info, g))
+ return FALSE;
+
+ /* We need a stub, not a plt entry for the undefined function. But we record
+ it as if it needs plt. See _bfd_elf_adjust_dynamic_symbol. */
+ h->needs_plt = 1;
+ h->type = STT_FUNC;
+ }
+ break;
+ case R_SCORE_GOT15:
+ if (h && ! score_elf_record_global_got_symbol (h, abfd, info, g))
+ return FALSE;
+ break;
+ case R_SCORE_ABS32:
+ case R_SCORE_REL32:
+ if ((info->shared || h != NULL) && (sec->flags & SEC_ALLOC) != 0)
+ {
+ if (sreloc == NULL)
+ {
+ sreloc = score_elf_rel_dyn_section (dynobj, TRUE);
+ if (sreloc == NULL)
+ return FALSE;
+ }
+#define SCORE_READONLY_SECTION (SEC_ALLOC | SEC_LOAD | SEC_READONLY)
+ if (info->shared)
+ {
+ /* When creating a shared object, we must copy these reloc types into
+ the output file as R_SCORE_REL32 relocs. We make room for this reloc
+ in the .rel.dyn reloc section. */
+ score_elf_allocate_dynamic_relocations (dynobj, 1);
+ if ((sec->flags & SCORE_READONLY_SECTION)
+ == SCORE_READONLY_SECTION)
+ /* We tell the dynamic linker that there are
+ relocations against the text segment. */
+ info->flags |= DF_TEXTREL;
+ }
+ else
+ {
+ struct score_elf_link_hash_entry *hscore;
+
+ /* We only need to copy this reloc if the symbol is
+ defined in a dynamic object. */
+ hscore = (struct score_elf_link_hash_entry *)h;
+ ++hscore->possibly_dynamic_relocs;
+ if ((sec->flags & SCORE_READONLY_SECTION)
+ == SCORE_READONLY_SECTION)
+ /* We need it to tell the dynamic linker if there
+ are relocations against the text segment. */
+ hscore->readonly_reloc = TRUE;
+ }
+
+ /* Even though we don't directly need a GOT entry for this symbol,
+ a symbol must have a dynamic symbol table index greater that
+ DT_SCORE_GOTSYM if there are dynamic relocations against it. */
+ if (h != NULL)
+ {
+ if (dynobj == NULL)
+ elf_hash_table (info)->dynobj = dynobj = abfd;
+ if (! score_elf_create_got_section (dynobj, info, TRUE))
+ return FALSE;
+ g = score_elf_got_info (dynobj, &sgot);
+ if (! score_elf_record_global_got_symbol (h, abfd, info, g))
+ return FALSE;
+ }
+ }
+ break;
+
+ /* This relocation describes the C++ object vtable hierarchy.
+ Reconstruct it for later use during GC. */
+ case R_SCORE_GNU_VTINHERIT:
+ if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
+ return FALSE;
+ break;
+
+ /* This relocation describes which C++ vtable entries are actually
+ used. Record for later use during GC. */
+ case R_SCORE_GNU_VTENTRY:
+ if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_offset))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+
+ /* We must not create a stub for a symbol that has relocations
+ related to taking the function's address. */
+ switch (r_type)
+ {
+ default:
+ if (h != NULL)
+ {
+ struct score_elf_link_hash_entry *sh;
+
+ sh = (struct score_elf_link_hash_entry *) h;
+ sh->no_fn_stub = TRUE;
+ }
+ break;
+ case R_SCORE_CALL15:
+ break;
+ }
+ }
+
+ return TRUE;
+}
+
+static bfd_boolean
+_bfd_score_elf_add_symbol_hook (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ Elf_Internal_Sym *sym,
+ const char **namep ATTRIBUTE_UNUSED,
+ flagword *flagsp ATTRIBUTE_UNUSED,
+ asection **secp,
+ bfd_vma *valp)
+{
+ switch (sym->st_shndx)
+ {
+ case SHN_COMMON:
+ if (sym->st_size > elf_gp_size (abfd))
+ break;
+ /* Fall through. */
+ case SHN_SCORE_SCOMMON:
+ *secp = bfd_make_section_old_way (abfd, ".scommon");
+ (*secp)->flags |= SEC_IS_COMMON;
+ *valp = sym->st_size;
+ break;
+ }
+
+ return TRUE;
+}
+
+static void
+_bfd_score_elf_symbol_processing (bfd *abfd, asymbol *asym)
+{
+ elf_symbol_type *elfsym;
+
+ elfsym = (elf_symbol_type *) asym;
+ switch (elfsym->internal_elf_sym.st_shndx)
+ {
+ case SHN_COMMON:
+ if (asym->value > elf_gp_size (abfd))
+ break;
+ /* Fall through. */
+ case SHN_SCORE_SCOMMON:
+ if (score_elf_scom_section.name == NULL)
+ {
+ /* Initialize the small common section. */
+ score_elf_scom_section.name = ".scommon";
+ score_elf_scom_section.flags = SEC_IS_COMMON;
+ score_elf_scom_section.output_section = &score_elf_scom_section;
+ score_elf_scom_section.symbol = &score_elf_scom_symbol;
+ score_elf_scom_section.symbol_ptr_ptr = &score_elf_scom_symbol_ptr;
+ score_elf_scom_symbol.name = ".scommon";
+ score_elf_scom_symbol.flags = BSF_SECTION_SYM;
+ score_elf_scom_symbol.section = &score_elf_scom_section;
+ score_elf_scom_symbol_ptr = &score_elf_scom_symbol;
+ }
+ asym->section = &score_elf_scom_section;
+ asym->value = elfsym->internal_elf_sym.st_size;
+ break;
+ }
+}
+
+static bfd_boolean
+_bfd_score_elf_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ const char *name ATTRIBUTE_UNUSED,
+ Elf_Internal_Sym *sym,
+ asection *input_sec,
+ struct elf_link_hash_entry *h ATTRIBUTE_UNUSED)
+{
+ /* If we see a common symbol, which implies a relocatable link, then
+ if a symbol was small common in an input file, mark it as small
+ common in the output file. */
+ if (sym->st_shndx == SHN_COMMON && strcmp (input_sec->name, ".scommon") == 0)
+ sym->st_shndx = SHN_SCORE_SCOMMON;
+
+ return TRUE;
+}
+
+static bfd_boolean
+_bfd_score_elf_section_from_bfd_section (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *sec,
+ int *retval)
+{
+ if (strcmp (bfd_get_section_name (abfd, sec), ".scommon") == 0)
+ {
+ *retval = SHN_SCORE_SCOMMON;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/* Adjust a symbol defined by a dynamic object and referenced by a
+ regular object. The current definition is in some section of the
+ dynamic object, but we're not including those sections. We have to
+ change the definition to something the rest of the link can understand. */
+
+static bfd_boolean
+_bfd_score_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
+ struct elf_link_hash_entry *h)
+{
+ bfd *dynobj;
+ struct score_elf_link_hash_entry *hscore;
+ asection *s;
+
+ dynobj = elf_hash_table (info)->dynobj;
+
+ /* Make sure we know what is going on here. */
+ BFD_ASSERT (dynobj != NULL
+ && (h->needs_plt
+ || h->u.weakdef != NULL
+ || (h->def_dynamic && h->ref_regular && !h->def_regular)));
+
+ /* If this symbol is defined in a dynamic object, we need to copy
+ any R_SCORE_ABS32 or R_SCORE_REL32 relocs against it into the output
+ file. */
+ hscore = (struct score_elf_link_hash_entry *)h;
+ if (!info->relocatable
+ && hscore->possibly_dynamic_relocs != 0
+ && (h->root.type == bfd_link_hash_defweak || !h->def_regular))
+ {
+ score_elf_allocate_dynamic_relocations (dynobj, hscore->possibly_dynamic_relocs);
+ if (hscore->readonly_reloc)
+ /* We tell the dynamic linker that there are relocations
+ against the text segment. */
+ info->flags |= DF_TEXTREL;
+ }
+
+ /* For a function, create a stub, if allowed. */
+ if (!hscore->no_fn_stub && h->needs_plt)
+ {
+ if (!elf_hash_table (info)->dynamic_sections_created)
+ return TRUE;
+
+ /* If this symbol is not defined in a regular file, then set
+ the symbol to the stub location. This is required to make
+ function pointers compare as equal between the normal
+ executable and the shared library. */
+ if (!h->def_regular)
+ {
+ /* We need .stub section. */
+ s = bfd_get_section_by_name (dynobj, SCORE_ELF_STUB_SECTION_NAME);
+ BFD_ASSERT (s != NULL);
+
+ h->root.u.def.section = s;
+ h->root.u.def.value = s->size;
+
+ /* XXX Write this stub address somewhere. */
+ h->plt.offset = s->size;
+
+ /* Make room for this stub code. */
+ s->size += SCORE_FUNCTION_STUB_SIZE;
+
+ /* The last half word of the stub will be filled with the index
+ of this symbol in .dynsym section. */
+ return TRUE;
+ }
+ }
+ else if ((h->type == STT_FUNC) && !h->needs_plt)
+ {
+ /* This will set the entry for this symbol in the GOT to 0, and
+ the dynamic linker will take care of this. */
+ h->root.u.def.value = 0;
+ return TRUE;
+ }
+
+ /* If this is a weak symbol, and there is a real definition, the
+ processor independent code will have arranged for us to see the
+ real definition first, and we can just use the same value. */
+ if (h->u.weakdef != NULL)
+ {
+ BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined
+ || h->u.weakdef->root.type == bfd_link_hash_defweak);
+ h->root.u.def.section = h->u.weakdef->root.u.def.section;
+ h->root.u.def.value = h->u.weakdef->root.u.def.value;
+ return TRUE;
+ }
+
+ /* This is a reference to a symbol defined by a dynamic object which
+ is not a function. */
+ return TRUE;
+}
+
+/* This function is called after all the input files have been read,
+ and the input sections have been assigned to output sections. */
+
+static bfd_boolean
+_bfd_score_elf_always_size_sections (bfd *output_bfd,
+ struct bfd_link_info *info)
+{
+ bfd *dynobj;
+ asection *s;
+ struct score_got_info *g;
+ int i;
+ bfd_size_type loadable_size = 0;
+ bfd_size_type local_gotno;
+ bfd *sub;
+
+ dynobj = elf_hash_table (info)->dynobj;
+ if (dynobj == NULL)
+ /* Relocatable links don't have it. */
+ return TRUE;
+
+ g = score_elf_got_info (dynobj, &s);
+ if (s == NULL)
+ return TRUE;
+
+ /* Calculate the total loadable size of the output. That will give us the
+ maximum number of GOT_PAGE entries required. */
+ for (sub = info->input_bfds; sub; sub = sub->link_next)
+ {
+ asection *subsection;
+
+ for (subsection = sub->sections;
+ subsection;
+ subsection = subsection->next)
+ {
+ if ((subsection->flags & SEC_ALLOC) == 0)
+ continue;
+ loadable_size += ((subsection->size + 0xf)
+ &~ (bfd_size_type) 0xf);
+ }
+ }
+
+ /* There has to be a global GOT entry for every symbol with
+ a dynamic symbol table index of DT_SCORE_GOTSYM or
+ higher. Therefore, it make sense to put those symbols
+ that need GOT entries at the end of the symbol table. We
+ do that here. */
+ if (! score_elf_sort_hash_table (info, 1))
+ return FALSE;
+
+ if (g->global_gotsym != NULL)
+ i = elf_hash_table (info)->dynsymcount - g->global_gotsym->dynindx;
+ else
+ /* If there are no global symbols, or none requiring
+ relocations, then GLOBAL_GOTSYM will be NULL. */
+ i = 0;
+
+ /* In the worst case, we'll get one stub per dynamic symbol. */
+ loadable_size += SCORE_FUNCTION_STUB_SIZE * i;
+
+ /* Assume there are two loadable segments consisting of
+ contiguous sections. Is 5 enough? */
+ local_gotno = (loadable_size >> 16) + 5;
+
+ g->local_gotno += local_gotno;
+ s->size += g->local_gotno * SCORE_ELF_GOT_SIZE (output_bfd);
+
+ g->global_gotno = i;
+ s->size += i * SCORE_ELF_GOT_SIZE (output_bfd);
+
+ score_elf_resolve_final_got_entries (g);
+
+ if (s->size > SCORE_ELF_GOT_MAX_SIZE (output_bfd))
+ {
+ /* Fixme. Error message or Warning message should be issued here. */
+ }
+
+ return TRUE;
+}
+
+/* Set the sizes of the dynamic sections. */
+
+static bfd_boolean
+_bfd_score_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
+{
+ bfd *dynobj;
+ asection *s;
+ bfd_boolean reltext;
+
+ dynobj = elf_hash_table (info)->dynobj;
+ BFD_ASSERT (dynobj != NULL);
+
+ if (elf_hash_table (info)->dynamic_sections_created)
+ {
+ /* Set the contents of the .interp section to the interpreter. */
+ if (!info->shared)
+ {
+ s = bfd_get_section_by_name (dynobj, ".interp");
+ BFD_ASSERT (s != NULL);
+ s->size = strlen (ELF_DYNAMIC_INTERPRETER) + 1;
+ s->contents = (bfd_byte *) ELF_DYNAMIC_INTERPRETER;
+ }
+ }
+
+ /* The check_relocs and adjust_dynamic_symbol entry points have
+ determined the sizes of the various dynamic sections. Allocate
+ memory for them. */
+ reltext = FALSE;
+ for (s = dynobj->sections; s != NULL; s = s->next)
+ {
+ const char *name;
+
+ if ((s->flags & SEC_LINKER_CREATED) == 0)
+ continue;
+
+ /* It's OK to base decisions on the section name, because none
+ of the dynobj section names depend upon the input files. */
+ name = bfd_get_section_name (dynobj, s);
+
+ if (CONST_STRNEQ (name, ".rel"))
+ {
+ if (s->size == 0)
+ {
+ /* We only strip the section if the output section name
+ has the same name. Otherwise, there might be several
+ input sections for this output section. FIXME: This
+ code is probably not needed these days anyhow, since
+ the linker now does not create empty output sections. */
+ if (s->output_section != NULL
+ && strcmp (name,
+ bfd_get_section_name (s->output_section->owner,
+ s->output_section)) == 0)
+ s->flags |= SEC_EXCLUDE;
+ }
+ else
+ {
+ const char *outname;
+ asection *target;
+
+ /* If this relocation section applies to a read only
+ section, then we probably need a DT_TEXTREL entry.
+ If the relocation section is .rel.dyn, we always
+ assert a DT_TEXTREL entry rather than testing whether
+ there exists a relocation to a read only section or
+ not. */
+ outname = bfd_get_section_name (output_bfd, s->output_section);
+ target = bfd_get_section_by_name (output_bfd, outname + 4);
+ if ((target != NULL
+ && (target->flags & SEC_READONLY) != 0
+ && (target->flags & SEC_ALLOC) != 0) || strcmp (outname, ".rel.dyn") == 0)
+ reltext = TRUE;
+
+ /* We use the reloc_count field as a counter if we need
+ to copy relocs into the output file. */
+ if (strcmp (name, ".rel.dyn") != 0)
+ s->reloc_count = 0;
+ }
+ }
+ else if (CONST_STRNEQ (name, ".got"))
+ {
+ /* _bfd_score_elf_always_size_sections() has already done
+ most of the work, but some symbols may have been mapped
+ to versions that we must now resolve in the got_entries
+ hash tables. */
+ }
+ else if (strcmp (name, SCORE_ELF_STUB_SECTION_NAME) == 0)
+ {
+ /* IRIX rld assumes that the function stub isn't at the end
+ of .text section. So put a dummy. XXX */
+ s->size += SCORE_FUNCTION_STUB_SIZE;
+ }
+ else if (! CONST_STRNEQ (name, ".init"))
+ {
+ /* It's not one of our sections, so don't allocate space. */
+ continue;
+ }
+
+ /* Allocate memory for the section contents. */
+ s->contents = bfd_zalloc (dynobj, s->size);
+ if (s->contents == NULL && s->size != 0)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ return FALSE;
+ }
+ }
+
+ if (elf_hash_table (info)->dynamic_sections_created)
+ {
+ /* Add some entries to the .dynamic section. We fill in the
+ values later, in _bfd_score_elf_finish_dynamic_sections, but we
+ must add the entries now so that we get the correct size for
+ the .dynamic section. The DT_DEBUG entry is filled in by the
+ dynamic linker and used by the debugger. */
+
+ if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0))
+ return FALSE;
+
+ if (reltext)
+ info->flags |= DF_TEXTREL;
+
+ if ((info->flags & DF_TEXTREL) != 0)
+ {
+ if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_TEXTREL, 0))
+ return FALSE;
+ }
+
+ if (! SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_PLTGOT, 0))
+ return FALSE;
+
+ if (score_elf_rel_dyn_section (dynobj, FALSE))
+ {
+ if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_REL, 0))
+ return FALSE;
+
+ if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_RELSZ, 0))
+ return FALSE;
+
+ if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_RELENT, 0))
+ return FALSE;
+ }
+
+ if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_SCORE_BASE_ADDRESS, 0))
+ return FALSE;
+
+ if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_SCORE_LOCAL_GOTNO, 0))
+ return FALSE;
+
+ if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_SCORE_SYMTABNO, 0))
+ return FALSE;
+
+ if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_SCORE_UNREFEXTNO, 0))
+ return FALSE;
+
+ if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_SCORE_GOTSYM, 0))
+ return FALSE;
+
+ if (!SCORE_ELF_ADD_DYNAMIC_ENTRY (info, DT_SCORE_HIPAGENO, 0))
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static bfd_boolean
+_bfd_score_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
+{
+ struct elf_link_hash_entry *h;
+ struct bfd_link_hash_entry *bh;
+ flagword flags;
+ asection *s;
+
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED | SEC_READONLY);
+
+ /* ABI requests the .dynamic section to be read only. */
+ s = bfd_get_section_by_name (abfd, ".dynamic");
+ if (s != NULL)
+ {
+ if (!bfd_set_section_flags (abfd, s, flags))
+ return FALSE;
+ }
+
+ /* We need to create .got section. */
+ if (!score_elf_create_got_section (abfd, info, FALSE))
+ return FALSE;
+
+ if (!score_elf_rel_dyn_section (elf_hash_table (info)->dynobj, TRUE))
+ return FALSE;
+
+ /* Create .stub section. */
+ if (bfd_get_section_by_name (abfd, SCORE_ELF_STUB_SECTION_NAME) == NULL)
+ {
+ s = bfd_make_section_with_flags (abfd, SCORE_ELF_STUB_SECTION_NAME,
+ flags | SEC_CODE);
+ if (s == NULL
+ || !bfd_set_section_alignment (abfd, s, 2))
+
+ return FALSE;
+ }
+
+ if (!info->shared)
+ {
+ const char *name;
+
+ name = "_DYNAMIC_LINK";
+ bh = NULL;
+ if (!(_bfd_generic_link_add_one_symbol
+ (info, abfd, name, BSF_GLOBAL, bfd_abs_section_ptr,
+ (bfd_vma) 0, (const char *)NULL, FALSE, get_elf_backend_data (abfd)->collect, &bh)))
+ return FALSE;
+
+ h = (struct elf_link_hash_entry *)bh;
+ h->non_elf = 0;
+ h->def_regular = 1;
+ h->type = STT_SECTION;
+
+ if (!bfd_elf_link_record_dynamic_symbol (info, h))
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+/* Finish up dynamic symbol handling. We set the contents of various
+ dynamic sections here. */
+
+static bfd_boolean
+_bfd_score_elf_finish_dynamic_symbol (bfd *output_bfd,
+ struct bfd_link_info *info,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
+{
+ bfd *dynobj;
+ asection *sgot;
+ struct score_got_info *g;
+ const char *name;
+
+ dynobj = elf_hash_table (info)->dynobj;
+
+ if (h->plt.offset != MINUS_ONE)
+ {
+ asection *s;
+ bfd_byte stub[SCORE_FUNCTION_STUB_SIZE];
+
+ /* This symbol has a stub. Set it up. */
+ BFD_ASSERT (h->dynindx != -1);
+
+ s = bfd_get_section_by_name (dynobj, SCORE_ELF_STUB_SECTION_NAME);
+ BFD_ASSERT (s != NULL);
+
+ /* FIXME: Can h->dynindex be more than 64K? */
+ if (h->dynindx & 0xffff0000)
+ return FALSE;
+
+ /* Fill the stub. */
+ bfd_put_32 (output_bfd, STUB_LW, stub);
+ bfd_put_32 (output_bfd, STUB_MOVE, stub + 4);
+ bfd_put_32 (output_bfd, STUB_LI16 | (h->dynindx << 1), stub + 8);
+ bfd_put_32 (output_bfd, STUB_BRL, stub + 12);
+
+ BFD_ASSERT (h->plt.offset <= s->size);
+ memcpy (s->contents + h->plt.offset, stub, SCORE_FUNCTION_STUB_SIZE);
+
+ /* Mark the symbol as undefined. plt.offset != -1 occurs
+ only for the referenced symbol. */
+ sym->st_shndx = SHN_UNDEF;
+
+ /* The run-time linker uses the st_value field of the symbol
+ to reset the global offset table entry for this external
+ to its stub address when unlinking a shared object. */
+ sym->st_value = (s->output_section->vma + s->output_offset + h->plt.offset);
+ }
+
+ BFD_ASSERT (h->dynindx != -1 || h->forced_local);
+
+ sgot = score_elf_got_section (dynobj, FALSE);
+ BFD_ASSERT (sgot != NULL);
+ BFD_ASSERT (score_elf_section_data (sgot) != NULL);
+ g = score_elf_section_data (sgot)->u.got_info;
+ BFD_ASSERT (g != NULL);
+
+ /* Run through the global symbol table, creating GOT entries for all
+ the symbols that need them. */
+ if (g->global_gotsym != NULL && h->dynindx >= g->global_gotsym->dynindx)
+ {
+ bfd_vma offset;
+ bfd_vma value;
+
+ value = sym->st_value;
+ offset = score_elf_global_got_index (dynobj, h);
+ bfd_put_32 (output_bfd, value, sgot->contents + offset);
+ }
+
+ /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
+ name = h->root.root.string;
+ if (strcmp (name, "_DYNAMIC") == 0 || strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0)
+ sym->st_shndx = SHN_ABS;
+ else if (strcmp (name, "_DYNAMIC_LINK") == 0)
+ {
+ sym->st_shndx = SHN_ABS;
+ sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION);
+ sym->st_value = 1;
+ }
+ else if (strcmp (name, GP_DISP_LABEL) == 0)
+ {
+ sym->st_shndx = SHN_ABS;
+ sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION);
+ sym->st_value = elf_gp (output_bfd);
+ }
+
+ return TRUE;
+}
+
+/* Finish up the dynamic sections. */
+
+static bfd_boolean
+_bfd_score_elf_finish_dynamic_sections (bfd *output_bfd,
+ struct bfd_link_info *info)
+{
+ bfd *dynobj;
+ asection *sdyn;
+ asection *sgot;
+ asection *s;
+ struct score_got_info *g;
+
+ dynobj = elf_hash_table (info)->dynobj;
+
+ sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
+
+ sgot = score_elf_got_section (dynobj, FALSE);
+ if (sgot == NULL)
+ g = NULL;
+ else
+ {
+ BFD_ASSERT (score_elf_section_data (sgot) != NULL);
+ g = score_elf_section_data (sgot)->u.got_info;
+ BFD_ASSERT (g != NULL);
+ }
+
+ if (elf_hash_table (info)->dynamic_sections_created)
+ {
+ bfd_byte *b;
+
+ BFD_ASSERT (sdyn != NULL);
+ BFD_ASSERT (g != NULL);
+
+ for (b = sdyn->contents;
+ b < sdyn->contents + sdyn->size;
+ b += SCORE_ELF_DYN_SIZE (dynobj))
+ {
+ Elf_Internal_Dyn dyn;
+ const char *name;
+ size_t elemsize;
+ bfd_boolean swap_out_p;
+
+ /* Read in the current dynamic entry. */
+ (*get_elf_backend_data (dynobj)->s->swap_dyn_in) (dynobj, b, &dyn);
+
+ /* Assume that we're going to modify it and write it out. */
+ swap_out_p = TRUE;
+
+ switch (dyn.d_tag)
+ {
+ case DT_RELENT:
+ s = score_elf_rel_dyn_section (dynobj, FALSE);
+ BFD_ASSERT (s != NULL);
+ dyn.d_un.d_val = SCORE_ELF_REL_SIZE (dynobj);
+ break;
+
+ case DT_STRSZ:
+ /* Rewrite DT_STRSZ. */
+ dyn.d_un.d_val = _bfd_elf_strtab_size (elf_hash_table (info)->dynstr);
+ break;
+
+ case DT_PLTGOT:
+ name = ".got";
+ s = bfd_get_section_by_name (output_bfd, name);
+ BFD_ASSERT (s != NULL);
+ dyn.d_un.d_ptr = s->vma;
+ break;
+
+ case DT_SCORE_BASE_ADDRESS:
+ s = output_bfd->sections;
+ BFD_ASSERT (s != NULL);
+ dyn.d_un.d_ptr = s->vma & ~(bfd_vma) 0xffff;
+ break;
+
+ case DT_SCORE_LOCAL_GOTNO:
+ dyn.d_un.d_val = g->local_gotno;
+ break;
+
+ case DT_SCORE_UNREFEXTNO:
+ /* The index into the dynamic symbol table which is the
+ entry of the first external symbol that is not
+ referenced within the same object. */
+ dyn.d_un.d_val = bfd_count_sections (output_bfd) + 1;
+ break;
+
+ case DT_SCORE_GOTSYM:
+ if (g->global_gotsym)
+ {
+ dyn.d_un.d_val = g->global_gotsym->dynindx;
+ break;
+ }
+ /* In case if we don't have global got symbols we default
+ to setting DT_SCORE_GOTSYM to the same value as
+ DT_SCORE_SYMTABNO, so we just fall through. */
+
+ case DT_SCORE_SYMTABNO:
+ name = ".dynsym";
+ elemsize = SCORE_ELF_SYM_SIZE (output_bfd);
+ s = bfd_get_section_by_name (output_bfd, name);
+ BFD_ASSERT (s != NULL);
+
+ dyn.d_un.d_val = s->size / elemsize;
+ break;
+
+ case DT_SCORE_HIPAGENO:
+ dyn.d_un.d_val = g->local_gotno - SCORE_RESERVED_GOTNO;
+ break;
+
+ default:
+ swap_out_p = FALSE;
+ break;
+ }
+
+ if (swap_out_p)
+ (*get_elf_backend_data (dynobj)->s->swap_dyn_out) (dynobj, &dyn, b);
+ }
+ }
+
+ /* The first entry of the global offset table will be filled at
+ runtime. The second entry will be used by some runtime loaders.
+ This isn't the case of IRIX rld. */
+ if (sgot != NULL && sgot->size > 0)
+ {
+ bfd_put_32 (output_bfd, 0, sgot->contents);
+ bfd_put_32 (output_bfd, 0x80000000, sgot->contents + SCORE_ELF_GOT_SIZE (output_bfd));
+ }
+
+ if (sgot != NULL)
+ elf_section_data (sgot->output_section)->this_hdr.sh_entsize
+ = SCORE_ELF_GOT_SIZE (output_bfd);
+
+
+ /* We need to sort the entries of the dynamic relocation section. */
+ s = score_elf_rel_dyn_section (dynobj, FALSE);
+
+ if (s != NULL && s->size > (bfd_vma)2 * SCORE_ELF_REL_SIZE (output_bfd))
+ {
+ reldyn_sorting_bfd = output_bfd;
+ qsort ((Elf32_External_Rel *) s->contents + 1, s->reloc_count - 1,
+ sizeof (Elf32_External_Rel), score_elf_sort_dynamic_relocs);
+ }
+
+ return TRUE;
+}
+
+/* This function set up the ELF section header for a BFD section in preparation for writing
+ it out. This is where the flags and type fields are set for unusual sections. */
+
+static bfd_boolean
+_bfd_score_elf_fake_sections (bfd *abfd ATTRIBUTE_UNUSED,
+ Elf_Internal_Shdr *hdr,
+ asection *sec)
+{
+ const char *name;
+
+ name = bfd_get_section_name (abfd, sec);
+
+ if (strcmp (name, ".got") == 0
+ || strcmp (name, ".srdata") == 0
+ || strcmp (name, ".sdata") == 0
+ || strcmp (name, ".sbss") == 0)
+ hdr->sh_flags |= SHF_SCORE_GPREL;
+
+ return TRUE;
+}
+
+/* This function do additional processing on the ELF section header before writing
+ it out. This is used to set the flags and type fields for some sections. */
+
+/* assign_file_positions_except_relocs() check section flag and if it is allocatable,
+ warning message will be issued. backend_fake_section is called before
+ assign_file_positions_except_relocs(); backend_section_processing after it. so, we
+ modify section flag there, but not backend_fake_section. */
+
+static bfd_boolean
+_bfd_score_elf_section_processing (bfd *abfd ATTRIBUTE_UNUSED, Elf_Internal_Shdr *hdr)
+{
+ if (hdr->bfd_section != NULL)
+ {
+ const char *name = bfd_get_section_name (abfd, hdr->bfd_section);
+
+ if (strcmp (name, ".sdata") == 0)
+ {
+ hdr->sh_flags |= SHF_ALLOC | SHF_WRITE | SHF_SCORE_GPREL;
+ hdr->sh_type = SHT_PROGBITS;
+ }
+ else if (strcmp (name, ".sbss") == 0)
+ {
+ hdr->sh_flags |= SHF_ALLOC | SHF_WRITE | SHF_SCORE_GPREL;
+ hdr->sh_type = SHT_NOBITS;
+ }
+ else if (strcmp (name, ".srdata") == 0)
+ {
+ hdr->sh_flags |= SHF_ALLOC | SHF_SCORE_GPREL;
+ hdr->sh_type = SHT_PROGBITS;
+ }
+ }
+
+ return TRUE;
+}
+
+static bfd_boolean
+_bfd_score_elf_write_section (bfd *output_bfd,
+ struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
+ asection *sec, bfd_byte *contents)
+{
+ bfd_byte *to, *from, *end;
+ int i;
+
+ if (strcmp (sec->name, ".pdr") != 0)
+ return FALSE;
+
+ if (score_elf_section_data (sec)->u.tdata == NULL)
+ return FALSE;
+
+ to = contents;
+ end = contents + sec->size;
+ for (from = contents, i = 0; from < end; from += PDR_SIZE, i++)
+ {
+ if ((score_elf_section_data (sec)->u.tdata)[i] == 1)
+ continue;
+
+ if (to != from)
+ memcpy (to, from, PDR_SIZE);
+
+ to += PDR_SIZE;
+ }
+ bfd_set_section_contents (output_bfd, sec->output_section, contents,
+ (file_ptr) sec->output_offset, sec->size);
+
+ return TRUE;
+}
+
+/* Copy data from a SCORE ELF indirect symbol to its direct symbol, hiding the old
+ indirect symbol. Process additional relocation information. */
+
+static void
+_bfd_score_elf_copy_indirect_symbol (struct bfd_link_info *info,
+ struct elf_link_hash_entry *dir,
+ struct elf_link_hash_entry *ind)
+{
+ struct score_elf_link_hash_entry *dirscore, *indscore;
+
+ _bfd_elf_link_hash_copy_indirect (info, dir, ind);
+
+ if (ind->root.type != bfd_link_hash_indirect)
+ return;
+
+ dirscore = (struct score_elf_link_hash_entry *) dir;
+ indscore = (struct score_elf_link_hash_entry *) ind;
+ dirscore->possibly_dynamic_relocs += indscore->possibly_dynamic_relocs;
+
+ if (indscore->readonly_reloc)
+ dirscore->readonly_reloc = TRUE;
+
+ if (indscore->no_fn_stub)
+ dirscore->no_fn_stub = TRUE;
+}
+
+/* Remove information about discarded functions from other sections which mention them. */
+
+static bfd_boolean
+_bfd_score_elf_discard_info (bfd *abfd, struct elf_reloc_cookie *cookie,
+ struct bfd_link_info *info)
+{
+ asection *o;
+ bfd_boolean ret = FALSE;
+ unsigned char *tdata;
+ size_t i, skip;
+
+ o = bfd_get_section_by_name (abfd, ".pdr");
+ if ((!o) || (o->size == 0) || (o->size % PDR_SIZE != 0)
+ || (o->output_section != NULL && bfd_is_abs_section (o->output_section)))
+ return FALSE;
+
+ tdata = bfd_zmalloc (o->size / PDR_SIZE);
+ if (!tdata)
+ return FALSE;
+
+ cookie->rels = _bfd_elf_link_read_relocs (abfd, o, NULL, NULL, info->keep_memory);
+ if (!cookie->rels)
+ {
+ free (tdata);
+ return FALSE;
+ }
+
+ cookie->rel = cookie->rels;
+ cookie->relend = cookie->rels + o->reloc_count;
+
+ for (i = 0, skip = 0; i < o->size; i++)
+ {
+ if (bfd_elf_reloc_symbol_deleted_p (i * PDR_SIZE, cookie))
+ {
+ tdata[i] = 1;
+ skip++;
+ }
+ }
+
+ if (skip != 0)
+ {
+ score_elf_section_data (o)->u.tdata = tdata;
+ o->size -= skip * PDR_SIZE;
+ ret = TRUE;
+ }
+ else
+ free (tdata);
+
+ if (!info->keep_memory)
+ free (cookie->rels);
+
+ return ret;
+}
+
+/* Signal that discard_info() has removed the discarded relocations for this section. */
+
+static bfd_boolean
+_bfd_score_elf_ignore_discarded_relocs (asection *sec)
+{
+ if (strcmp (sec->name, ".pdr") == 0)
+ return TRUE;
+ return FALSE;
+}
+
+/* Return the section that should be marked against GC for a given
+ relocation. */
+
+static asection *
+_bfd_score_elf_gc_mark_hook (asection *sec,
+ struct bfd_link_info *info,
+ Elf_Internal_Rela *rel,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
+{
+ if (h != NULL)
+ switch (ELF32_R_TYPE (rel->r_info))
+ {
+ case R_SCORE_GNU_VTINHERIT:
+ case R_SCORE_GNU_VTENTRY:
+ return NULL;
+ }
+
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+}
+
+/* Support for core dump NOTE sections. */
+
+static bfd_boolean
+_bfd_score_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
+{
+ int offset;
+ unsigned int raw_size;
+
+ switch (note->descsz)
+ {
+ default:
+ return FALSE;
+
+ case 148: /* Linux/Score 32-bit. */
+ /* pr_cursig */
+ elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+
+ /* pr_pid */
+ elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
+
+ /* pr_reg */
+ offset = 72;
+ raw_size = 72;
+
+ break;
+ }
+
+ /* Make a ".reg/999" section. */
+ return _bfd_elfcore_make_pseudosection (abfd, ".reg", raw_size, note->descpos + offset);
+}
+
+static bfd_boolean
+_bfd_score_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
+{
+ switch (note->descsz)
+ {
+ default:
+ return FALSE;
+
+ case 124: /* Linux/Score elf_prpsinfo. */
+ elf_tdata (abfd)->core_program = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
+ elf_tdata (abfd)->core_command = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
+ }
+
+ /* Note that for some reason, a spurious space is tacked
+ onto the end of the args in some (at least one anyway)
+ implementations, so strip it off if it exists. */
+
+ {
+ char *command = elf_tdata (abfd)->core_command;
+ int n = strlen (command);
+
+ if (0 < n && command[n - 1] == ' ')
+ command[n - 1] = '\0';
+ }
+
+ return TRUE;
+}
+
+
+/* Score BFD functions. */
+
+static reloc_howto_type *
+elf32_score_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, bfd_reloc_code_real_type code)
+{
+ unsigned int i;
+
+ for (i = 0; i < NUM_ELEM (elf32_score_reloc_map); i++)
+ if (elf32_score_reloc_map[i].bfd_reloc_val == code)
+ return &elf32_score_howto_table[elf32_score_reloc_map[i].elf_reloc_val];
+
+ return NULL;
+}
+
+static reloc_howto_type *
+elf32_score_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (elf32_score_howto_table)
+ / sizeof (elf32_score_howto_table[0]));
+ i++)
+ if (elf32_score_howto_table[i].name != NULL
+ && strcasecmp (elf32_score_howto_table[i].name, r_name) == 0)
+ return &elf32_score_howto_table[i];
+
+ return NULL;
+}
+
+/* Create a score elf linker hash table. */
+
+static struct bfd_link_hash_table *
+elf32_score_link_hash_table_create (bfd *abfd)
+{
+ struct score_elf_link_hash_table *ret;
+ bfd_size_type amt = sizeof (struct score_elf_link_hash_table);
+
+ ret = bfd_malloc (amt);
+ if (ret == NULL)
+ return NULL;
+
+ if (!_bfd_elf_link_hash_table_init (&ret->root, abfd, score_elf_link_hash_newfunc,
+ sizeof (struct score_elf_link_hash_entry)))
+ {
+ free (ret);
+ return NULL;
+ }
+
+ return &ret->root.root;
+}
+
+static bfd_boolean
+elf32_score_print_private_bfd_data (bfd *abfd, void * ptr)
+{
+ FILE *file = (FILE *) ptr;
+
+ BFD_ASSERT (abfd != NULL && ptr != NULL);
+
+ /* Print normal ELF private data. */
+ _bfd_elf_print_private_bfd_data (abfd, ptr);
+
+ /* xgettext:c-format */
+ fprintf (file, _("private flags = %lx:"), elf_elfheader (abfd)->e_flags);
+ if (elf_elfheader (abfd)->e_flags & EF_SCORE_PIC)
+ {
+ fprintf (file, _(" [pic]"));
+ }
+ if (elf_elfheader (abfd)->e_flags & EF_SCORE_FIXDEP)
+ {
+ fprintf (file, _(" [fix dep]"));
+ }
+ fputc ('\n', file);
+
+ return TRUE;
+}
+
+static bfd_boolean
+elf32_score_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
+{
+ flagword in_flags;
+ flagword out_flags;
+
+ if (!_bfd_generic_verify_endian_match (ibfd, obfd))
+ return FALSE;
+
+ in_flags = elf_elfheader (ibfd)->e_flags;
+ out_flags = elf_elfheader (obfd)->e_flags;
+
+ if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
+ || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
+ return TRUE;
+
+ in_flags = elf_elfheader (ibfd)->e_flags;
+ out_flags = elf_elfheader (obfd)->e_flags;
+
+ if (! elf_flags_init (obfd))
+ {
+ elf_flags_init (obfd) = TRUE;
+ elf_elfheader (obfd)->e_flags = in_flags;
+
+ if (bfd_get_arch (obfd) == bfd_get_arch (ibfd)
+ && bfd_get_arch_info (obfd)->the_default)
+ {
+ return bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), bfd_get_mach (ibfd));
+ }
+
+ return TRUE;
+ }
+
+ if (((in_flags & EF_SCORE_PIC) != 0) != ((out_flags & EF_SCORE_PIC) != 0))
+ {
+ (*_bfd_error_handler) (_("%B: warning: linking PIC files with non-PIC files"), ibfd);
+ }
+
+ /* FIXME: Maybe dependency fix compatibility should be checked here. */
+
+ return TRUE;
+}
+
+static bfd_boolean
+elf32_score_new_section_hook (bfd *abfd, asection *sec)
+{
+ struct _score_elf_section_data *sdata;
+ bfd_size_type amt = sizeof (*sdata);
+
+ sdata = bfd_zalloc (abfd, amt);
+ if (sdata == NULL)
+ return FALSE;
+ sec->used_by_bfd = sdata;
+
+ return _bfd_elf_new_section_hook (abfd, sec);
+}
+
+
+#define USE_REL 1
+#define TARGET_LITTLE_SYM bfd_elf32_littlescore_vec
+#define TARGET_LITTLE_NAME "elf32-littlescore"
+#define TARGET_BIG_SYM bfd_elf32_bigscore_vec
+#define TARGET_BIG_NAME "elf32-bigscore"
+#define ELF_ARCH bfd_arch_score
+#define ELF_MACHINE_CODE EM_SCORE
+#define ELF_MAXPAGESIZE 0x8000
+
+#define elf_info_to_howto 0
+#define elf_info_to_howto_rel _bfd_score_info_to_howto
+#define elf_backend_relocate_section _bfd_score_elf_relocate_section
+#define elf_backend_check_relocs _bfd_score_elf_check_relocs
+#define elf_backend_add_symbol_hook _bfd_score_elf_add_symbol_hook
+#define elf_backend_symbol_processing _bfd_score_elf_symbol_processing
+#define elf_backend_link_output_symbol_hook \
+ _bfd_score_elf_link_output_symbol_hook
+#define elf_backend_section_from_bfd_section \
+ _bfd_score_elf_section_from_bfd_section
+#define elf_backend_adjust_dynamic_symbol \
+ _bfd_score_elf_adjust_dynamic_symbol
+#define elf_backend_always_size_sections \
+ _bfd_score_elf_always_size_sections
+#define elf_backend_size_dynamic_sections \
+ _bfd_score_elf_size_dynamic_sections
+#define elf_backend_omit_section_dynsym \
+ ((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) bfd_true)
+#define elf_backend_create_dynamic_sections \
+ _bfd_score_elf_create_dynamic_sections
+#define elf_backend_finish_dynamic_symbol \
+ _bfd_score_elf_finish_dynamic_symbol
+#define elf_backend_finish_dynamic_sections \
+ _bfd_score_elf_finish_dynamic_sections
+#define elf_backend_fake_sections _bfd_score_elf_fake_sections
+#define elf_backend_section_processing _bfd_score_elf_section_processing
+#define elf_backend_write_section _bfd_score_elf_write_section
+#define elf_backend_copy_indirect_symbol _bfd_score_elf_copy_indirect_symbol
+#define elf_backend_hide_symbol _bfd_score_elf_hide_symbol
+#define elf_backend_discard_info _bfd_score_elf_discard_info
+#define elf_backend_ignore_discarded_relocs \
+ _bfd_score_elf_ignore_discarded_relocs
+#define elf_backend_gc_mark_hook _bfd_score_elf_gc_mark_hook
+#define elf_backend_grok_prstatus _bfd_score_elf_grok_prstatus
+#define elf_backend_grok_psinfo _bfd_score_elf_grok_psinfo
+#define elf_backend_can_gc_sections 1
+#define elf_backend_want_plt_sym 0
+#define elf_backend_got_header_size (4 * SCORE_RESERVED_GOTNO)
+#define elf_backend_plt_header_size 0
+#define elf_backend_collect TRUE
+#define elf_backend_type_change_ok TRUE
+
+#define bfd_elf32_bfd_reloc_type_lookup elf32_score_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup \
+ elf32_score_reloc_name_lookup
+#define bfd_elf32_bfd_link_hash_table_create elf32_score_link_hash_table_create
+#define bfd_elf32_bfd_print_private_bfd_data elf32_score_print_private_bfd_data
+#define bfd_elf32_bfd_merge_private_bfd_data elf32_score_merge_private_bfd_data
+#define bfd_elf32_new_section_hook elf32_score_new_section_hook
+
+#include "elf32-target.h"
diff --git a/bfd/elf32-sh-relocs.h b/bfd/elf32-sh-relocs.h
new file mode 100644
index 000000000000..3488ef4edbe4
--- /dev/null
+++ b/bfd/elf32-sh-relocs.h
@@ -0,0 +1,1716 @@
+ /* No relocation. */
+ HOWTO (R_SH_NONE, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_NONE", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* 32 bit absolute relocation. Setting partial_inplace to TRUE and
+ src_mask to a non-zero value is similar to the COFF toolchain. */
+ HOWTO (R_SH_DIR32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ SH_ELF_RELOC, /* special_function */
+ "R_SH_DIR32", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* 32 bit PC relative relocation. */
+ HOWTO (R_SH_REL32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_REL32", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* 8 bit PC relative branch divided by 2. */
+ HOWTO (R_SH_DIR8WPN, /* type */
+ 1, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_DIR8WPN", /* name */
+ TRUE, /* partial_inplace */
+ 0xff, /* src_mask */
+ 0xff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* 12 bit PC relative branch divided by 2. */
+ /* This cannot be partial_inplace because relaxation can't know the
+ eventual value of a symbol. */
+ HOWTO (R_SH_IND12W, /* type */
+ 1, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ NULL, /* special_function */
+ "R_SH_IND12W", /* name */
+ FALSE, /* partial_inplace */
+ 0x0, /* src_mask */
+ 0xfff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* 8 bit unsigned PC relative divided by 4. */
+ HOWTO (R_SH_DIR8WPL, /* type */
+ 2, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_DIR8WPL", /* name */
+ TRUE, /* partial_inplace */
+ 0xff, /* src_mask */
+ 0xff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* 8 bit unsigned PC relative divided by 2. */
+ HOWTO (R_SH_DIR8WPZ, /* type */
+ 1, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_DIR8WPZ", /* name */
+ TRUE, /* partial_inplace */
+ 0xff, /* src_mask */
+ 0xff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* 8 bit GBR relative. FIXME: This only makes sense if we have some
+ special symbol for the GBR relative area, and that is not
+ implemented. */
+ HOWTO (R_SH_DIR8BP, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_DIR8BP", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* 8 bit GBR relative divided by 2. FIXME: This only makes sense if
+ we have some special symbol for the GBR relative area, and that
+ is not implemented. */
+ HOWTO (R_SH_DIR8W, /* type */
+ 1, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_DIR8W", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* 8 bit GBR relative divided by 4. FIXME: This only makes sense if
+ we have some special symbol for the GBR relative area, and that
+ is not implemented. */
+ HOWTO (R_SH_DIR8L, /* type */
+ 2, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_DIR8L", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* 8 bit PC relative divided by 2 - but specified in a very odd way. */
+ HOWTO (R_SH_LOOP_START, /* type */
+ 1, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_LOOP_START", /* name */
+ TRUE, /* partial_inplace */
+ 0xff, /* src_mask */
+ 0xff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* 8 bit PC relative divided by 2 - but specified in a very odd way. */
+ HOWTO (R_SH_LOOP_END, /* type */
+ 1, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_LOOP_END", /* name */
+ TRUE, /* partial_inplace */
+ 0xff, /* src_mask */
+ 0xff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ EMPTY_HOWTO (12),
+ EMPTY_HOWTO (13),
+ EMPTY_HOWTO (14),
+ EMPTY_HOWTO (15),
+ EMPTY_HOWTO (16),
+ EMPTY_HOWTO (17),
+ EMPTY_HOWTO (18),
+ EMPTY_HOWTO (19),
+ EMPTY_HOWTO (20),
+ EMPTY_HOWTO (21),
+
+ /* The remaining relocs are a GNU extension used for relaxing. The
+ final pass of the linker never needs to do anything with any of
+ these relocs. Any required operations are handled by the
+ relaxation code. */
+
+ /* GNU extension to record C++ vtable hierarchy */
+ HOWTO (R_SH_GNU_VTINHERIT, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ NULL, /* special_function */
+ "R_SH_GNU_VTINHERIT", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* GNU extension to record C++ vtable member usage */
+ HOWTO (R_SH_GNU_VTENTRY, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ _bfd_elf_rel_vtable_reloc_fn, /* special_function */
+ "R_SH_GNU_VTENTRY", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* An 8 bit switch table entry. This is generated for an expression
+ such as ``.word L1 - L2''. The offset holds the difference
+ between the reloc address and L2. */
+ HOWTO (R_SH_SWITCH8, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_SWITCH8", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* A 16 bit switch table entry. This is generated for an expression
+ such as ``.word L1 - L2''. The offset holds the difference
+ between the reloc address and L2. */
+ HOWTO (R_SH_SWITCH16, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_SWITCH16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* A 32 bit switch table entry. This is generated for an expression
+ such as ``.long L1 - L2''. The offset holds the difference
+ between the reloc address and L2. */
+ HOWTO (R_SH_SWITCH32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_SWITCH32", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* Indicates a .uses pseudo-op. The compiler will generate .uses
+ pseudo-ops when it finds a function call which can be relaxed.
+ The offset field holds the PC relative offset to the instruction
+ which loads the register used in the function call. */
+ HOWTO (R_SH_USES, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_USES", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* The assembler will generate this reloc for addresses referred to
+ by the register loads associated with USES relocs. The offset
+ field holds the number of times the address is referenced in the
+ object file. */
+ HOWTO (R_SH_COUNT, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_COUNT", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* Indicates an alignment statement. The offset field is the power
+ of 2 to which subsequent portions of the object file must be
+ aligned. */
+ HOWTO (R_SH_ALIGN, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_ALIGN", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* The assembler will generate this reloc before a block of
+ instructions. A section should be processed as assuming it
+ contains data, unless this reloc is seen. */
+ HOWTO (R_SH_CODE, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_CODE", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* The assembler will generate this reloc after a block of
+ instructions when it sees data that is not instructions. */
+ HOWTO (R_SH_DATA, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_DATA", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* The assembler generates this reloc for each label within a block
+ of instructions. This permits the linker to avoid swapping
+ instructions which are the targets of branches. */
+ HOWTO (R_SH_LABEL, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_LABEL", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* The next 12 are only supported via linking in SHC-generated objects. */
+ HOWTO (R_SH_DIR16, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_DIR8, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR8", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_DIR8UL, /* type */
+ 2, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR8UL", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_DIR8UW, /* type */
+ 1, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR8UW", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_DIR8U, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR8U", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_DIR8SW, /* type */
+ 1, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR8SW", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_DIR8S, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR8S", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_DIR4UL, /* type */
+ 2, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 4, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR4UL", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x0f, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_DIR4UW, /* type */
+ 1, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 4, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR4UW", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x0f, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_DIR4U, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 4, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR4U", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x0f, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_PSHA, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 7, /* bitsize */
+ FALSE, /* pc_relative */
+ 4, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_PSHA", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x0f, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_PSHL, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 7, /* bitsize */
+ FALSE, /* pc_relative */
+ 4, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_PSHL", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x0f, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+#ifdef INCLUDE_SHMEDIA
+ /* Used in SHLLI.L and SHLRI.L. */
+ HOWTO (R_SH_DIR5U, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 5, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR5U", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in SHARI, SHLLI et al. */
+ HOWTO (R_SH_DIR6U, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 6, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR6U", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in BxxI, LDHI.L et al. */
+ HOWTO (R_SH_DIR6S, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 6, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR6S", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in ADDI, ANDI et al. */
+ HOWTO (R_SH_DIR10S, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 10, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR10S", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in LD.UW, ST.W et al. */
+ HOWTO (R_SH_DIR10SW, /* type */
+ 1, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 11, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR10SW", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in LD.L, FLD.S et al. */
+ HOWTO (R_SH_DIR10SL, /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR10SL", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in FLD.D, FST.P et al. */
+ HOWTO (R_SH_DIR10SQ, /* type */
+ 3, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 13, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR10SQ", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+#else
+ EMPTY_HOWTO (45),
+ EMPTY_HOWTO (46),
+ EMPTY_HOWTO (47),
+ EMPTY_HOWTO (48),
+ EMPTY_HOWTO (49),
+ EMPTY_HOWTO (50),
+ EMPTY_HOWTO (51),
+#endif
+
+ EMPTY_HOWTO (52),
+
+ HOWTO (R_SH_DIR16S, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_DIR16S", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ EMPTY_HOWTO (54),
+ EMPTY_HOWTO (55),
+ EMPTY_HOWTO (56),
+ EMPTY_HOWTO (57),
+ EMPTY_HOWTO (58),
+ EMPTY_HOWTO (59),
+ EMPTY_HOWTO (60),
+ EMPTY_HOWTO (61),
+ EMPTY_HOWTO (62),
+ EMPTY_HOWTO (63),
+ EMPTY_HOWTO (64),
+ EMPTY_HOWTO (65),
+ EMPTY_HOWTO (66),
+ EMPTY_HOWTO (67),
+ EMPTY_HOWTO (68),
+ EMPTY_HOWTO (69),
+ EMPTY_HOWTO (70),
+ EMPTY_HOWTO (71),
+ EMPTY_HOWTO (72),
+ EMPTY_HOWTO (73),
+ EMPTY_HOWTO (74),
+ EMPTY_HOWTO (75),
+ EMPTY_HOWTO (76),
+ EMPTY_HOWTO (77),
+ EMPTY_HOWTO (78),
+ EMPTY_HOWTO (79),
+ EMPTY_HOWTO (80),
+ EMPTY_HOWTO (81),
+ EMPTY_HOWTO (82),
+ EMPTY_HOWTO (83),
+ EMPTY_HOWTO (84),
+ EMPTY_HOWTO (85),
+ EMPTY_HOWTO (86),
+ EMPTY_HOWTO (87),
+ EMPTY_HOWTO (88),
+ EMPTY_HOWTO (89),
+ EMPTY_HOWTO (90),
+ EMPTY_HOWTO (91),
+ EMPTY_HOWTO (92),
+ EMPTY_HOWTO (93),
+ EMPTY_HOWTO (94),
+ EMPTY_HOWTO (95),
+ EMPTY_HOWTO (96),
+ EMPTY_HOWTO (97),
+ EMPTY_HOWTO (98),
+ EMPTY_HOWTO (99),
+ EMPTY_HOWTO (100),
+ EMPTY_HOWTO (101),
+ EMPTY_HOWTO (102),
+ EMPTY_HOWTO (103),
+ EMPTY_HOWTO (104),
+ EMPTY_HOWTO (105),
+ EMPTY_HOWTO (106),
+ EMPTY_HOWTO (107),
+ EMPTY_HOWTO (108),
+ EMPTY_HOWTO (109),
+ EMPTY_HOWTO (110),
+ EMPTY_HOWTO (111),
+ EMPTY_HOWTO (112),
+ EMPTY_HOWTO (113),
+ EMPTY_HOWTO (114),
+ EMPTY_HOWTO (115),
+ EMPTY_HOWTO (116),
+ EMPTY_HOWTO (117),
+ EMPTY_HOWTO (118),
+ EMPTY_HOWTO (119),
+ EMPTY_HOWTO (120),
+ EMPTY_HOWTO (121),
+ EMPTY_HOWTO (122),
+ EMPTY_HOWTO (123),
+ EMPTY_HOWTO (124),
+ EMPTY_HOWTO (125),
+ EMPTY_HOWTO (126),
+ EMPTY_HOWTO (127),
+ EMPTY_HOWTO (128),
+ EMPTY_HOWTO (129),
+ EMPTY_HOWTO (130),
+ EMPTY_HOWTO (131),
+ EMPTY_HOWTO (132),
+ EMPTY_HOWTO (133),
+ EMPTY_HOWTO (134),
+ EMPTY_HOWTO (135),
+ EMPTY_HOWTO (136),
+ EMPTY_HOWTO (137),
+ EMPTY_HOWTO (138),
+ EMPTY_HOWTO (139),
+ EMPTY_HOWTO (140),
+ EMPTY_HOWTO (141),
+ EMPTY_HOWTO (142),
+ EMPTY_HOWTO (143),
+
+ HOWTO (R_SH_TLS_GD_32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* */
+ "R_SH_TLS_GD_32", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_TLS_LD_32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* */
+ "R_SH_TLS_LD_32", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_TLS_LDO_32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* */
+ "R_SH_TLS_LDO_32", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_TLS_IE_32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* */
+ "R_SH_TLS_IE_32", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_TLS_LE_32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* */
+ "R_SH_TLS_LE_32", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_TLS_DTPMOD32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* */
+ "R_SH_TLS_DTPMOD32", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_TLS_DTPOFF32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* */
+ "R_SH_TLS_DTPOFF32", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_TLS_TPOFF32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* */
+ "R_SH_TLS_TPOFF32", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ EMPTY_HOWTO (152),
+ EMPTY_HOWTO (153),
+ EMPTY_HOWTO (154),
+ EMPTY_HOWTO (155),
+ EMPTY_HOWTO (156),
+ EMPTY_HOWTO (157),
+ EMPTY_HOWTO (158),
+ EMPTY_HOWTO (159),
+
+ HOWTO (R_SH_GOT32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* */
+ "R_SH_GOT32", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_PLT32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* */
+ "R_SH_PLT32", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_SH_COPY, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* */
+ "R_SH_COPY", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_GLOB_DAT, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* */
+ "R_SH_GLOB_DAT", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_JMP_SLOT, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* */
+ "R_SH_JMP_SLOT", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_RELATIVE, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* */
+ "R_SH_RELATIVE", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_GOTOFF, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* */
+ "R_SH_GOTOFF", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_GOTPC, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* */
+ "R_SH_GOTPC", /* name */
+ SH_PARTIAL32, /* partial_inplace */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ HOWTO (R_SH_GOTPLT32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* */
+ "R_SH_GOTPLT32", /* name */
+ FALSE, /* partial_inplace */
+ /* ??? Why not 0? */
+ SH_SRC_MASK32, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+#ifdef INCLUDE_SHMEDIA
+ /* Used in MOVI and SHORI (x & 65536). */
+ HOWTO (R_SH_GOT_LOW16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOT_LOW16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 16) & 65536). */
+ HOWTO (R_SH_GOT_MEDLOW16, /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOT_MEDLOW16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 32) & 65536). */
+ HOWTO (R_SH_GOT_MEDHI16, /* type */
+ 32, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOT_MEDHI16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 48) & 65536). */
+ HOWTO (R_SH_GOT_HI16, /* type */
+ 48, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOT_HI16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI (x & 65536). */
+ HOWTO (R_SH_GOTPLT_LOW16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOTPLT_LOW16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 16) & 65536). */
+ HOWTO (R_SH_GOTPLT_MEDLOW16, /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOTPLT_MEDLOW16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 32) & 65536). */
+ HOWTO (R_SH_GOTPLT_MEDHI16, /* type */
+ 32, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOTPLT_MEDHI16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 48) & 65536). */
+ HOWTO (R_SH_GOTPLT_HI16, /* type */
+ 48, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOTPLT_HI16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI (x & 65536). */
+ HOWTO (R_SH_PLT_LOW16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ TRUE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_PLT_LOW16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 16) & 65536). */
+ HOWTO (R_SH_PLT_MEDLOW16, /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ TRUE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_PLT_MEDLOW16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 32) & 65536). */
+ HOWTO (R_SH_PLT_MEDHI16, /* type */
+ 32, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ TRUE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_PLT_MEDHI16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 48) & 65536). */
+ HOWTO (R_SH_PLT_HI16, /* type */
+ 48, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ TRUE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_PLT_HI16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI (x & 65536). */
+ HOWTO (R_SH_GOTOFF_LOW16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOTOFF_LOW16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 16) & 65536). */
+ HOWTO (R_SH_GOTOFF_MEDLOW16, /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOTOFF_MEDLOW16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 32) & 65536). */
+ HOWTO (R_SH_GOTOFF_MEDHI16, /* type */
+ 32, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOTOFF_MEDHI16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 48) & 65536). */
+ HOWTO (R_SH_GOTOFF_HI16, /* type */
+ 48, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOTOFF_HI16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI (x & 65536). */
+ HOWTO (R_SH_GOTPC_LOW16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ TRUE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOTPC_LOW16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 16) & 65536). */
+ HOWTO (R_SH_GOTPC_MEDLOW16, /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ TRUE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOTPC_MEDLOW16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 32) & 65536). */
+ HOWTO (R_SH_GOTPC_MEDHI16, /* type */
+ 32, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ TRUE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOTPC_MEDHI16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 48) & 65536). */
+ HOWTO (R_SH_GOTPC_HI16, /* type */
+ 48, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ TRUE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOTPC_HI16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* Used in LD.L, FLD.S et al. */
+ HOWTO (R_SH_GOT10BY4, /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOT10BY4", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in LD.L, FLD.S et al. */
+ HOWTO (R_SH_GOTPLT10BY4, /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOTPLT10BY4", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in FLD.D, FST.P et al. */
+ HOWTO (R_SH_GOT10BY8, /* type */
+ 3, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 13, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOT10BY8", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in FLD.D, FST.P et al. */
+ HOWTO (R_SH_GOTPLT10BY8, /* type */
+ 3, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 13, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GOTPLT10BY8", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_COPY64, /* type */
+ 0, /* rightshift */
+ 4, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_COPY64", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ ((bfd_vma) 0) - 1, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_GLOB_DAT64, /* type */
+ 0, /* rightshift */
+ 4, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_GLOB_DAT64", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ ((bfd_vma) 0) - 1, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_JMP_SLOT64, /* type */
+ 0, /* rightshift */
+ 4, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_JMP_SLOT64", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ ((bfd_vma) 0) - 1, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ HOWTO (R_SH_RELATIVE64, /* type */
+ 0, /* rightshift */
+ 4, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_RELATIVE64", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ ((bfd_vma) 0) - 1, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ EMPTY_HOWTO (197),
+ EMPTY_HOWTO (198),
+ EMPTY_HOWTO (199),
+ EMPTY_HOWTO (200),
+ EMPTY_HOWTO (201),
+ EMPTY_HOWTO (202),
+ EMPTY_HOWTO (203),
+ EMPTY_HOWTO (204),
+ EMPTY_HOWTO (205),
+ EMPTY_HOWTO (206),
+ EMPTY_HOWTO (207),
+ EMPTY_HOWTO (208),
+ EMPTY_HOWTO (209),
+ EMPTY_HOWTO (210),
+ EMPTY_HOWTO (211),
+ EMPTY_HOWTO (212),
+ EMPTY_HOWTO (213),
+ EMPTY_HOWTO (214),
+ EMPTY_HOWTO (215),
+ EMPTY_HOWTO (216),
+ EMPTY_HOWTO (217),
+ EMPTY_HOWTO (218),
+ EMPTY_HOWTO (219),
+ EMPTY_HOWTO (220),
+ EMPTY_HOWTO (221),
+ EMPTY_HOWTO (222),
+ EMPTY_HOWTO (223),
+ EMPTY_HOWTO (224),
+ EMPTY_HOWTO (225),
+ EMPTY_HOWTO (226),
+ EMPTY_HOWTO (227),
+ EMPTY_HOWTO (228),
+ EMPTY_HOWTO (229),
+ EMPTY_HOWTO (230),
+ EMPTY_HOWTO (231),
+ EMPTY_HOWTO (232),
+ EMPTY_HOWTO (233),
+ EMPTY_HOWTO (234),
+ EMPTY_HOWTO (235),
+ EMPTY_HOWTO (236),
+ EMPTY_HOWTO (237),
+ EMPTY_HOWTO (238),
+ EMPTY_HOWTO (239),
+ EMPTY_HOWTO (240),
+ EMPTY_HOWTO (241),
+
+ /* Relocations for SHmedia code. None of these are partial_inplace or
+ use the field being relocated (except R_SH_PT_16). */
+
+ /* The assembler will generate this reloc before a block of SHmedia
+ instructions. A section should be processed as assuming it contains
+ data, unless this reloc is seen. Note that a block of SHcompact
+ instructions are instead preceded by R_SH_CODE.
+ This is currently not implemented, but should be used for SHmedia
+ linker relaxation. */
+ HOWTO (R_SH_SHMEDIA_CODE, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ sh_elf_ignore_reloc, /* special_function */
+ "R_SH_SHMEDIA_CODE", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* The assembler will generate this reloc at a PTA or PTB instruction,
+ and the linker checks the right type of target, or changes a PTA to a
+ PTB, if the original insn was PT. */
+ HOWTO (R_SH_PT_16, /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 18, /* bitsize */
+ TRUE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_PT_16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* Used in unexpanded MOVI. */
+ HOWTO (R_SH_IMMS16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_IMMS16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in SHORI. */
+ HOWTO (R_SH_IMMU16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_IMMU16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI (x & 65536). */
+ HOWTO (R_SH_IMM_LOW16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_IMM_LOW16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x - $) & 65536). */
+ HOWTO (R_SH_IMM_LOW16_PCREL, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ TRUE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_IMM_LOW16_PCREL", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 16) & 65536). */
+ HOWTO (R_SH_IMM_MEDLOW16, /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_IMM_MEDLOW16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI (((x - $) >> 16) & 65536). */
+ HOWTO (R_SH_IMM_MEDLOW16_PCREL, /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ TRUE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_IMM_MEDLOW16_PCREL", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 32) & 65536). */
+ HOWTO (R_SH_IMM_MEDHI16, /* type */
+ 32, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_IMM_MEDHI16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI (((x - $) >> 32) & 65536). */
+ HOWTO (R_SH_IMM_MEDHI16_PCREL, /* type */
+ 32, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ TRUE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_IMM_MEDHI16_PCREL", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI ((x >> 48) & 65536). */
+ HOWTO (R_SH_IMM_HI16, /* type */
+ 48, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_IMM_HI16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* Used in MOVI and SHORI (((x - $) >> 48) & 65536). */
+ HOWTO (R_SH_IMM_HI16_PCREL, /* type */
+ 48, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ TRUE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_IMM_HI16_PCREL", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffc00, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+ /* For the .uaquad pseudo. */
+ HOWTO (R_SH_64, /* type */
+ 0, /* rightshift */
+ 4, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_64", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ ((bfd_vma) 0) - 1, /* dst_mask */
+ FALSE), /* pcrel_offset */
+
+ /* For the .uaquad pseudo, (x - $). */
+ HOWTO (R_SH_64_PCREL, /* type */
+ 48, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ TRUE, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_SH_64_PCREL", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ ((bfd_vma) 0) - 1, /* dst_mask */
+ TRUE), /* pcrel_offset */
+
+#endif
+#undef SH_PARTIAL32
+#undef SH_SRC_MASK32
+#undef SH_ELF_RELOC
diff --git a/bfd/elf32-sh-symbian.c b/bfd/elf32-sh-symbian.c
index 477cf243e708..7ea9207009fe 100644
--- a/bfd/elf32-sh-symbian.c
+++ b/bfd/elf32-sh-symbian.c
@@ -1,5 +1,5 @@
/* Renesas / SuperH specific support for Symbian 32-bit ELF files
- Copyright 2004, 2005
+ Copyright 2004, 2005, 2006
Free Software Foundation, Inc.
Contributed by Red Hat
@@ -26,8 +26,8 @@
#include "elf32-sh.c"
-//#define DEBUG 1
-#define DEBUG 0
+//#define SYMBIAN_DEBUG 1
+#define SYMBIAN_DEBUG 0
#define DIRECTIVE_HEADER "#<SYMEDIT>#\n"
#define DIRECTIVE_IMPORT "IMPORT "
@@ -36,7 +36,7 @@
/* Macro to advance 's' until either it reaches 'e' or the
character pointed to by 's' is equal to 'c'. If 'e' is
- reached and DEBUG is enabled then the error message 'm'
+ reached and SYMBIAN_DEBUG is enabled then the error message 'm'
is displayed. */
#define SKIP_UNTIL(s,e,c,m) \
do \
@@ -45,7 +45,7 @@
++ s; \
if (s >= e) \
{ \
- if (DEBUG) \
+ if (SYMBIAN_DEBUG) \
fprintf (stderr, "Corrupt directive: %s\n", m); \
result = FALSE; \
} \
@@ -63,7 +63,7 @@
++ s; \
if (s >= e) \
{ \
- if (DEBUG) \
+ if (SYMBIAN_DEBUG) \
fprintf (stderr, "Corrupt directive: %s\n", m); \
result = FALSE; \
} \
@@ -74,7 +74,7 @@
/* Macro to advance 's' until either it reaches 'e' or the
character pointed to by 's' is not equal to 'c'. If 'e'
- is reached and DEBUG is enabled then the error message
+ is reached and SYMBIAN_DEBUG is enabled then the error message
'm' is displayed. */
#define SKIP_WHILE(s,e,c,m) \
do \
@@ -83,7 +83,7 @@
++ s; \
if (s >= e) \
{ \
- if (DEBUG) \
+ if (SYMBIAN_DEBUG) \
fprintf (stderr, "Corrupt directive: %s\n", m); \
result = FALSE; \
} \
@@ -114,7 +114,7 @@ sh_symbian_import_as (struct bfd_link_info *info, bfd * abfd,
struct elf_link_hash_entry * new_hash;
symbol_rename * node;
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "IMPORT '%s' AS '%s'\n", current_name, new_name);
for (node = rename_list; node; node = node->next)
@@ -132,14 +132,14 @@ sh_symbian_import_as (struct bfd_link_info *info, bfd * abfd,
if ((node = bfd_malloc (sizeof * node)) == NULL)
{
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "IMPORT AS: No mem for new rename node\n");
return FALSE;
}
if ((node->current_name = bfd_malloc (strlen (current_name) + 1)) == NULL)
{
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "IMPORT AS: No mem for current name field in rename node\n");
free (node);
return FALSE;
@@ -149,7 +149,7 @@ sh_symbian_import_as (struct bfd_link_info *info, bfd * abfd,
if ((node->new_name = bfd_malloc (strlen (new_name) + 1)) == NULL)
{
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "IMPORT AS: No mem for new name field in rename node\n");
free (node->current_name);
free (node);
@@ -175,7 +175,7 @@ sh_symbian_import_as (struct bfd_link_info *info, bfd * abfd,
static bfd_boolean
sh_symbian_import (bfd * abfd ATTRIBUTE_UNUSED, char * name)
{
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "IMPORT '%s'\n", name);
/* XXX: Generate an import somehow ? */
@@ -186,7 +186,7 @@ sh_symbian_import (bfd * abfd ATTRIBUTE_UNUSED, char * name)
static bfd_boolean
sh_symbian_export (bfd * abfd ATTRIBUTE_UNUSED, char * name)
{
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "EXPORT '%s'\n", name);
/* XXX: Generate an export somehow ? */
@@ -225,7 +225,7 @@ sh_symbian_process_embedded_commands (struct bfd_link_info *info, bfd * abfd,
break;
case 'I':
- if (strncmp (s, DIRECTIVE_IMPORT, strlen (DIRECTIVE_IMPORT)))
+ if (! CONST_STRNEQ (s, DIRECTIVE_IMPORT))
result = FALSE;
else
{
@@ -261,12 +261,12 @@ sh_symbian_process_embedded_commands (struct bfd_link_info *info, bfd * abfd,
name_end_char = * new_name_end;
* new_name_end = 0;
- /* Check to see if 'AS '... is present. If se we have an IMPORT AS
- directive, otherwise we have an IMPORT directive. */
- if (strncmp (s, DIRECTIVE_AS, strlen (DIRECTIVE_AS)))
+ /* Check to see if 'AS '... is present. If so we have an
+ IMPORT AS directive, otherwise we have an IMPORT directive. */
+ if (! CONST_STRNEQ (s, DIRECTIVE_AS))
{
/* Skip the new-line at the end of the name. */
- if (DEBUG && name_end_char != '\n')
+ if (SYMBIAN_DEBUG && name_end_char != '\n')
fprintf (stderr, "IMPORT: No newline at end of directive\n");
else
s ++;
@@ -276,7 +276,7 @@ sh_symbian_process_embedded_commands (struct bfd_link_info *info, bfd * abfd,
/* Skip past the NUL character. */
if (* s ++ != 0)
{
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "IMPORT: No NUL at end of directive\n");
}
}
@@ -300,7 +300,7 @@ sh_symbian_process_embedded_commands (struct bfd_link_info *info, bfd * abfd,
SKIP_WHILE (s, e, ' ', "IMPORT AS: Current name just followed by spaces");
/* Skip past the newline character. */
if (* s ++ != '\n')
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "IMPORT AS: No newline at end of directive\n");
/* Terminate the current name after having performed the skips. */
@@ -311,7 +311,7 @@ sh_symbian_process_embedded_commands (struct bfd_link_info *info, bfd * abfd,
/* The next character should be a NUL. */
if (* s != 0)
{
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "IMPORT AS: Junk at end of directive\n");
result = FALSE;
}
@@ -327,7 +327,7 @@ sh_symbian_process_embedded_commands (struct bfd_link_info *info, bfd * abfd,
break;
case 'E':
- if (strncmp (s, DIRECTIVE_EXPORT, strlen (DIRECTIVE_EXPORT)))
+ if (! CONST_STRNEQ (s, DIRECTIVE_EXPORT))
result = FALSE;
else
{
@@ -355,7 +355,7 @@ sh_symbian_process_embedded_commands (struct bfd_link_info *info, bfd * abfd,
/* The next character should be a NUL. */
if (* s != 0)
{
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "EXPORT: Junk at end of directive\n");
result = FALSE;
}
@@ -373,7 +373,7 @@ sh_symbian_process_embedded_commands (struct bfd_link_info *info, bfd * abfd,
if (! result)
{
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "offset into .directive section: %ld\n",
(long) (directive - (char *) contents));
@@ -464,7 +464,7 @@ sh_symbian_relocate_section (bfd * output_bfd,
if (ptr->current_hash == NULL)
{
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "IMPORT AS: current symbol '%s' does not exist\n", ptr->current_name);
continue;
}
@@ -511,7 +511,7 @@ sh_symbian_relocate_section (bfd * output_bfd,
if (new_hash->dynindx == -1)
new_hash->def_regular = 1;
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "Created new symbol %s\n", ptr->new_name);
}
@@ -521,7 +521,7 @@ sh_symbian_relocate_section (bfd * output_bfd,
if (* h == new_hash)
{
ptr->new_symndx = h - sym_hashes + num_local_syms;
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "Converted new hash to index of %ld\n", ptr->new_symndx);
break;
}
@@ -539,7 +539,7 @@ sh_symbian_relocate_section (bfd * output_bfd,
new_sym_hashes = bfd_alloc (input_bfd, num_global_syms * sizeof * sym_hashes);
if (new_sym_hashes == NULL)
{
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "Out of memory extending hash table\n");
continue;
}
@@ -551,7 +551,7 @@ sh_symbian_relocate_section (bfd * output_bfd,
ptr->new_symndx = num_global_syms - 1 + num_local_syms;
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "Extended symbol hash table to insert new symbol as index %ld\n",
ptr->new_symndx);
}
@@ -601,7 +601,7 @@ sh_symbian_relocate_section (bfd * output_bfd,
if (h == ptr->current_hash)
{
BFD_ASSERT (ptr->new_symndx);
- if (DEBUG)
+ if (SYMBIAN_DEBUG)
fprintf (stderr, "convert reloc %lx from using index %ld to using index %ld\n",
(long) rel->r_info, (long) ELF32_R_SYM (rel->r_info), ptr->new_symndx);
rel->r_info = ELF32_R_INFO (ptr->new_symndx, r_type);
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index 118690d9a58f..739d2d7b671a 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -1,6 +1,6 @@
/* Renesas / SuperH SH specific support for 32-bit ELF
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- 2006 Free Software Foundation, Inc.
+ 2006, 2007 Free Software Foundation, Inc.
Contributed by Ian Lance Taylor, Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -19,11 +19,12 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
+#include "elf-vxworks.h"
#include "elf/sh.h"
#include "libiberty.h"
#include "../opcodes/sh-opc.h"
@@ -52,1721 +53,49 @@ static bfd_vma tpoff
#define ELF_DYNAMIC_INTERPRETER "/usr/lib/libc.so.1"
+#define MINUS_ONE ((bfd_vma) 0 - 1)
+
+#define SH_PARTIAL32 TRUE
+#define SH_SRC_MASK32 0xffffffff
+#define SH_ELF_RELOC sh_elf_reloc
static reloc_howto_type sh_elf_howto_table[] =
{
- /* No relocation. */
- HOWTO (R_SH_NONE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- sh_elf_ignore_reloc, /* special_function */
- "R_SH_NONE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 32 bit absolute relocation. Setting partial_inplace to TRUE and
- src_mask to a non-zero value is similar to the COFF toolchain. */
- HOWTO (R_SH_DIR32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- sh_elf_reloc, /* special_function */
- "R_SH_DIR32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* 32 bit PC relative relocation. */
- HOWTO (R_SH_REL32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- sh_elf_ignore_reloc, /* special_function */
- "R_SH_REL32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* 8 bit PC relative branch divided by 2. */
- HOWTO (R_SH_DIR8WPN, /* type */
- 1, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- sh_elf_ignore_reloc, /* special_function */
- "R_SH_DIR8WPN", /* name */
- TRUE, /* partial_inplace */
- 0xff, /* src_mask */
- 0xff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* 12 bit PC relative branch divided by 2. */
- /* This cannot be partial_inplace because relaxation can't know the
- eventual value of a symbol. */
- HOWTO (R_SH_IND12W, /* type */
- 1, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 12, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- NULL, /* special_function */
- "R_SH_IND12W", /* name */
- FALSE, /* partial_inplace */
- 0x0, /* src_mask */
- 0xfff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* 8 bit unsigned PC relative divided by 4. */
- HOWTO (R_SH_DIR8WPL, /* type */
- 2, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_unsigned, /* complain_on_overflow */
- sh_elf_ignore_reloc, /* special_function */
- "R_SH_DIR8WPL", /* name */
- TRUE, /* partial_inplace */
- 0xff, /* src_mask */
- 0xff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* 8 bit unsigned PC relative divided by 2. */
- HOWTO (R_SH_DIR8WPZ, /* type */
- 1, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_unsigned, /* complain_on_overflow */
- sh_elf_ignore_reloc, /* special_function */
- "R_SH_DIR8WPZ", /* name */
- TRUE, /* partial_inplace */
- 0xff, /* src_mask */
- 0xff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* 8 bit GBR relative. FIXME: This only makes sense if we have some
- special symbol for the GBR relative area, and that is not
- implemented. */
- HOWTO (R_SH_DIR8BP, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_unsigned, /* complain_on_overflow */
- sh_elf_ignore_reloc, /* special_function */
- "R_SH_DIR8BP", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* 8 bit GBR relative divided by 2. FIXME: This only makes sense if
- we have some special symbol for the GBR relative area, and that
- is not implemented. */
- HOWTO (R_SH_DIR8W, /* type */
- 1, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_unsigned, /* complain_on_overflow */
- sh_elf_ignore_reloc, /* special_function */
- "R_SH_DIR8W", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* 8 bit GBR relative divided by 4. FIXME: This only makes sense if
- we have some special symbol for the GBR relative area, and that
- is not implemented. */
- HOWTO (R_SH_DIR8L, /* type */
- 2, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_unsigned, /* complain_on_overflow */
- sh_elf_ignore_reloc, /* special_function */
- "R_SH_DIR8L", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* 8 bit PC relative divided by 2 - but specified in a very odd way. */
- HOWTO (R_SH_LOOP_START, /* type */
- 1, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- sh_elf_ignore_reloc, /* special_function */
- "R_SH_LOOP_START", /* name */
- TRUE, /* partial_inplace */
- 0xff, /* src_mask */
- 0xff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* 8 bit PC relative divided by 2 - but specified in a very odd way. */
- HOWTO (R_SH_LOOP_END, /* type */
- 1, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- sh_elf_ignore_reloc, /* special_function */
- "R_SH_LOOP_END", /* name */
- TRUE, /* partial_inplace */
- 0xff, /* src_mask */
- 0xff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- EMPTY_HOWTO (12),
- EMPTY_HOWTO (13),
- EMPTY_HOWTO (14),
- EMPTY_HOWTO (15),
- EMPTY_HOWTO (16),
- EMPTY_HOWTO (17),
- EMPTY_HOWTO (18),
- EMPTY_HOWTO (19),
- EMPTY_HOWTO (20),
- EMPTY_HOWTO (21),
-
- /* The remaining relocs are a GNU extension used for relaxing. The
- final pass of the linker never needs to do anything with any of
- these relocs. Any required operations are handled by the
- relaxation code. */
-
- /* GNU extension to record C++ vtable hierarchy */
- HOWTO (R_SH_GNU_VTINHERIT, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- NULL, /* special_function */
- "R_SH_GNU_VTINHERIT", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* GNU extension to record C++ vtable member usage */
- HOWTO (R_SH_GNU_VTENTRY, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_elf_rel_vtable_reloc_fn, /* special_function */
- "R_SH_GNU_VTENTRY", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* An 8 bit switch table entry. This is generated for an expression
- such as ``.word L1 - L2''. The offset holds the difference
- between the reloc address and L2. */
- HOWTO (R_SH_SWITCH8, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_unsigned, /* complain_on_overflow */
- sh_elf_ignore_reloc, /* special_function */
- "R_SH_SWITCH8", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* A 16 bit switch table entry. This is generated for an expression
- such as ``.word L1 - L2''. The offset holds the difference
- between the reloc address and L2. */
- HOWTO (R_SH_SWITCH16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_unsigned, /* complain_on_overflow */
- sh_elf_ignore_reloc, /* special_function */
- "R_SH_SWITCH16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* A 32 bit switch table entry. This is generated for an expression
- such as ``.long L1 - L2''. The offset holds the difference
- between the reloc address and L2. */
- HOWTO (R_SH_SWITCH32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_unsigned, /* complain_on_overflow */
- sh_elf_ignore_reloc, /* special_function */
- "R_SH_SWITCH32", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* Indicates a .uses pseudo-op. The compiler will generate .uses
- pseudo-ops when it finds a function call which can be relaxed.
- The offset field holds the PC relative offset to the instruction
- which loads the register used in the function call. */
- HOWTO (R_SH_USES, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_unsigned, /* complain_on_overflow */
- sh_elf_ignore_reloc, /* special_function */
- "R_SH_USES", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* The assembler will generate this reloc for addresses referred to
- by the register loads associated with USES relocs. The offset
- field holds the number of times the address is referenced in the
- object file. */
- HOWTO (R_SH_COUNT, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_unsigned, /* complain_on_overflow */
- sh_elf_ignore_reloc, /* special_function */
- "R_SH_COUNT", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* Indicates an alignment statement. The offset field is the power
- of 2 to which subsequent portions of the object file must be
- aligned. */
- HOWTO (R_SH_ALIGN, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_unsigned, /* complain_on_overflow */
- sh_elf_ignore_reloc, /* special_function */
- "R_SH_ALIGN", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* The assembler will generate this reloc before a block of
- instructions. A section should be processed as assuming it
- contains data, unless this reloc is seen. */
- HOWTO (R_SH_CODE, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_unsigned, /* complain_on_overflow */
- sh_elf_ignore_reloc, /* special_function */
- "R_SH_CODE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* The assembler will generate this reloc after a block of
- instructions when it sees data that is not instructions. */
- HOWTO (R_SH_DATA, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_unsigned, /* complain_on_overflow */
- sh_elf_ignore_reloc, /* special_function */
- "R_SH_DATA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* The assembler generates this reloc for each label within a block
- of instructions. This permits the linker to avoid swapping
- instructions which are the targets of branches. */
- HOWTO (R_SH_LABEL, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_unsigned, /* complain_on_overflow */
- sh_elf_ignore_reloc, /* special_function */
- "R_SH_LABEL", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* The next 12 are only supported via linking in SHC-generated objects. */
- HOWTO (R_SH_DIR16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_DIR16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_SH_DIR8, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_DIR8", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_SH_DIR8UL, /* type */
- 2, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_unsigned, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_DIR8UL", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_SH_DIR8UW, /* type */
- 1, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_unsigned, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_DIR8UW", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_SH_DIR8U, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_unsigned, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_DIR8U", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_SH_DIR8SW, /* type */
- 1, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_DIR8SW", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_SH_DIR8S, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_DIR8S", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_SH_DIR4UL, /* type */
- 2, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 4, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_unsigned, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_DIR4UL", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0f, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_SH_DIR4UW, /* type */
- 1, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 4, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_unsigned, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_DIR4UW", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0f, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_SH_DIR4U, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 4, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_unsigned, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_DIR4U", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0f, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_SH_PSHA, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 7, /* bitsize */
- FALSE, /* pc_relative */
- 4, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_PSHA", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0f, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_SH_PSHL, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 7, /* bitsize */
- FALSE, /* pc_relative */
- 4, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_PSHL", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x0f, /* dst_mask */
- FALSE), /* pcrel_offset */
+#include "elf32-sh-relocs.h"
+};
-#ifdef INCLUDE_SHMEDIA
- /* Used in SHLLI.L and SHLRI.L. */
- HOWTO (R_SH_DIR5U, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 5, /* bitsize */
- FALSE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_unsigned, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_DIR5U", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xfc00, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used in SHARI, SHLLI et al. */
- HOWTO (R_SH_DIR6U, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 6, /* bitsize */
- FALSE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_unsigned, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_DIR6U", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xfc00, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used in BxxI, LDHI.L et al. */
- HOWTO (R_SH_DIR6S, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 6, /* bitsize */
- FALSE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_DIR6S", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xfc00, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used in ADDI, ANDI et al. */
- HOWTO (R_SH_DIR10S, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 10, /* bitsize */
- FALSE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_DIR10S", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffc00, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used in LD.UW, ST.W et al. */
- HOWTO (R_SH_DIR10SW, /* type */
- 1, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 11, /* bitsize */
- FALSE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_DIR10SW", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffc00, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used in LD.L, FLD.S et al. */
- HOWTO (R_SH_DIR10SL, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 12, /* bitsize */
- FALSE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_DIR10SL", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffc00, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used in FLD.D, FST.P et al. */
- HOWTO (R_SH_DIR10SQ, /* type */
- 3, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 13, /* bitsize */
- FALSE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_DIR10SQ", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffc00, /* dst_mask */
- FALSE), /* pcrel_offset */
+#define SH_PARTIAL32 FALSE
+#define SH_SRC_MASK32 0
+#define SH_ELF_RELOC bfd_elf_generic_reloc
+static reloc_howto_type sh_vxworks_howto_table[] =
+{
+#include "elf32-sh-relocs.h"
+};
+
+/* Return true if OUTPUT_BFD is a VxWorks object. */
+static bfd_boolean
+vxworks_object_p (bfd *abfd ATTRIBUTE_UNUSED)
+{
+#if !defined INCLUDE_SHMEDIA && !defined SH_TARGET_ALREADY_DEFINED
+ extern const bfd_target bfd_elf32_shlvxworks_vec;
+ extern const bfd_target bfd_elf32_shvxworks_vec;
+
+ return (abfd->xvec == &bfd_elf32_shlvxworks_vec
+ || abfd->xvec == &bfd_elf32_shvxworks_vec);
#else
- EMPTY_HOWTO (45),
- EMPTY_HOWTO (46),
- EMPTY_HOWTO (47),
- EMPTY_HOWTO (48),
- EMPTY_HOWTO (49),
- EMPTY_HOWTO (50),
- EMPTY_HOWTO (51),
+ return FALSE;
#endif
+}
- EMPTY_HOWTO (52),
-
- HOWTO (R_SH_DIR16S, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_DIR16S", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- EMPTY_HOWTO (54),
- EMPTY_HOWTO (55),
- EMPTY_HOWTO (56),
- EMPTY_HOWTO (57),
- EMPTY_HOWTO (58),
- EMPTY_HOWTO (59),
- EMPTY_HOWTO (60),
- EMPTY_HOWTO (61),
- EMPTY_HOWTO (62),
- EMPTY_HOWTO (63),
- EMPTY_HOWTO (64),
- EMPTY_HOWTO (65),
- EMPTY_HOWTO (66),
- EMPTY_HOWTO (67),
- EMPTY_HOWTO (68),
- EMPTY_HOWTO (69),
- EMPTY_HOWTO (70),
- EMPTY_HOWTO (71),
- EMPTY_HOWTO (72),
- EMPTY_HOWTO (73),
- EMPTY_HOWTO (74),
- EMPTY_HOWTO (75),
- EMPTY_HOWTO (76),
- EMPTY_HOWTO (77),
- EMPTY_HOWTO (78),
- EMPTY_HOWTO (79),
- EMPTY_HOWTO (80),
- EMPTY_HOWTO (81),
- EMPTY_HOWTO (82),
- EMPTY_HOWTO (83),
- EMPTY_HOWTO (84),
- EMPTY_HOWTO (85),
- EMPTY_HOWTO (86),
- EMPTY_HOWTO (87),
- EMPTY_HOWTO (88),
- EMPTY_HOWTO (89),
- EMPTY_HOWTO (90),
- EMPTY_HOWTO (91),
- EMPTY_HOWTO (92),
- EMPTY_HOWTO (93),
- EMPTY_HOWTO (94),
- EMPTY_HOWTO (95),
- EMPTY_HOWTO (96),
- EMPTY_HOWTO (97),
- EMPTY_HOWTO (98),
- EMPTY_HOWTO (99),
- EMPTY_HOWTO (100),
- EMPTY_HOWTO (101),
- EMPTY_HOWTO (102),
- EMPTY_HOWTO (103),
- EMPTY_HOWTO (104),
- EMPTY_HOWTO (105),
- EMPTY_HOWTO (106),
- EMPTY_HOWTO (107),
- EMPTY_HOWTO (108),
- EMPTY_HOWTO (109),
- EMPTY_HOWTO (110),
- EMPTY_HOWTO (111),
- EMPTY_HOWTO (112),
- EMPTY_HOWTO (113),
- EMPTY_HOWTO (114),
- EMPTY_HOWTO (115),
- EMPTY_HOWTO (116),
- EMPTY_HOWTO (117),
- EMPTY_HOWTO (118),
- EMPTY_HOWTO (119),
- EMPTY_HOWTO (120),
- EMPTY_HOWTO (121),
- EMPTY_HOWTO (122),
- EMPTY_HOWTO (123),
- EMPTY_HOWTO (124),
- EMPTY_HOWTO (125),
- EMPTY_HOWTO (126),
- EMPTY_HOWTO (127),
- EMPTY_HOWTO (128),
- EMPTY_HOWTO (129),
- EMPTY_HOWTO (130),
- EMPTY_HOWTO (131),
- EMPTY_HOWTO (132),
- EMPTY_HOWTO (133),
- EMPTY_HOWTO (134),
- EMPTY_HOWTO (135),
- EMPTY_HOWTO (136),
- EMPTY_HOWTO (137),
- EMPTY_HOWTO (138),
- EMPTY_HOWTO (139),
- EMPTY_HOWTO (140),
- EMPTY_HOWTO (141),
- EMPTY_HOWTO (142),
- EMPTY_HOWTO (143),
-
- HOWTO (R_SH_TLS_GD_32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* */
- "R_SH_TLS_GD_32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_SH_TLS_LD_32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* */
- "R_SH_TLS_LD_32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_SH_TLS_LDO_32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* */
- "R_SH_TLS_LDO_32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_SH_TLS_IE_32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* */
- "R_SH_TLS_IE_32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_SH_TLS_LE_32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* */
- "R_SH_TLS_LE_32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_SH_TLS_DTPMOD32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* */
- "R_SH_TLS_DTPMOD32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_SH_TLS_DTPOFF32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* */
- "R_SH_TLS_DTPOFF32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_SH_TLS_TPOFF32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* */
- "R_SH_TLS_TPOFF32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- EMPTY_HOWTO (152),
- EMPTY_HOWTO (153),
- EMPTY_HOWTO (154),
- EMPTY_HOWTO (155),
- EMPTY_HOWTO (156),
- EMPTY_HOWTO (157),
- EMPTY_HOWTO (158),
- EMPTY_HOWTO (159),
-
- HOWTO (R_SH_GOT32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* */
- "R_SH_GOT32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_SH_PLT32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* */
- "R_SH_PLT32", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- HOWTO (R_SH_COPY, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* */
- "R_SH_COPY", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_SH_GLOB_DAT, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* */
- "R_SH_GLOB_DAT", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_SH_JMP_SLOT, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* */
- "R_SH_JMP_SLOT", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_SH_RELATIVE, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* */
- "R_SH_RELATIVE", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_SH_GOTOFF, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* */
- "R_SH_GOTOFF", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_SH_GOTPC, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- TRUE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* */
- "R_SH_GOTPC", /* name */
- TRUE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- HOWTO (R_SH_GOTPLT32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* */
- "R_SH_GOTPLT32", /* name */
- FALSE, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
-
-#ifdef INCLUDE_SHMEDIA
- /* Used in MOVI and SHORI (x & 65536). */
- HOWTO (R_SH_GOT_LOW16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_GOT_LOW16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used in MOVI and SHORI ((x >> 16) & 65536). */
- HOWTO (R_SH_GOT_MEDLOW16, /* type */
- 16, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_GOT_MEDLOW16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used in MOVI and SHORI ((x >> 32) & 65536). */
- HOWTO (R_SH_GOT_MEDHI16, /* type */
- 32, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_GOT_MEDHI16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used in MOVI and SHORI ((x >> 48) & 65536). */
- HOWTO (R_SH_GOT_HI16, /* type */
- 48, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_GOT_HI16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used in MOVI and SHORI (x & 65536). */
- HOWTO (R_SH_GOTPLT_LOW16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_GOTPLT_LOW16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used in MOVI and SHORI ((x >> 16) & 65536). */
- HOWTO (R_SH_GOTPLT_MEDLOW16, /* type */
- 16, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_GOTPLT_MEDLOW16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used in MOVI and SHORI ((x >> 32) & 65536). */
- HOWTO (R_SH_GOTPLT_MEDHI16, /* type */
- 32, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_GOTPLT_MEDHI16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used in MOVI and SHORI ((x >> 48) & 65536). */
- HOWTO (R_SH_GOTPLT_HI16, /* type */
- 48, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_GOTPLT_HI16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used in MOVI and SHORI (x & 65536). */
- HOWTO (R_SH_PLT_LOW16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- TRUE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_PLT_LOW16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* Used in MOVI and SHORI ((x >> 16) & 65536). */
- HOWTO (R_SH_PLT_MEDLOW16, /* type */
- 16, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- TRUE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_PLT_MEDLOW16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* Used in MOVI and SHORI ((x >> 32) & 65536). */
- HOWTO (R_SH_PLT_MEDHI16, /* type */
- 32, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- TRUE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_PLT_MEDHI16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* Used in MOVI and SHORI ((x >> 48) & 65536). */
- HOWTO (R_SH_PLT_HI16, /* type */
- 48, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- TRUE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_PLT_HI16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* Used in MOVI and SHORI (x & 65536). */
- HOWTO (R_SH_GOTOFF_LOW16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_GOTOFF_LOW16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used in MOVI and SHORI ((x >> 16) & 65536). */
- HOWTO (R_SH_GOTOFF_MEDLOW16, /* type */
- 16, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_GOTOFF_MEDLOW16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used in MOVI and SHORI ((x >> 32) & 65536). */
- HOWTO (R_SH_GOTOFF_MEDHI16, /* type */
- 32, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_GOTOFF_MEDHI16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used in MOVI and SHORI ((x >> 48) & 65536). */
- HOWTO (R_SH_GOTOFF_HI16, /* type */
- 48, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_GOTOFF_HI16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used in MOVI and SHORI (x & 65536). */
- HOWTO (R_SH_GOTPC_LOW16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- TRUE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_GOTPC_LOW16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* Used in MOVI and SHORI ((x >> 16) & 65536). */
- HOWTO (R_SH_GOTPC_MEDLOW16, /* type */
- 16, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- TRUE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_GOTPC_MEDLOW16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* Used in MOVI and SHORI ((x >> 32) & 65536). */
- HOWTO (R_SH_GOTPC_MEDHI16, /* type */
- 32, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- TRUE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_GOTPC_MEDHI16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* Used in MOVI and SHORI ((x >> 48) & 65536). */
- HOWTO (R_SH_GOTPC_HI16, /* type */
- 48, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- TRUE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_GOTPC_HI16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* Used in LD.L, FLD.S et al. */
- HOWTO (R_SH_GOT10BY4, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 12, /* bitsize */
- FALSE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_GOT10BY4", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffc00, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used in LD.L, FLD.S et al. */
- HOWTO (R_SH_GOTPLT10BY4, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 12, /* bitsize */
- FALSE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_GOTPLT10BY4", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffc00, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used in FLD.D, FST.P et al. */
- HOWTO (R_SH_GOT10BY8, /* type */
- 3, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 13, /* bitsize */
- FALSE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_GOT10BY8", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffc00, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used in FLD.D, FST.P et al. */
- HOWTO (R_SH_GOTPLT10BY8, /* type */
- 3, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 13, /* bitsize */
- FALSE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_GOTPLT10BY8", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0xffc00, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_SH_COPY64, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_COPY64", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- ((bfd_vma) 0) - 1, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_SH_GLOB_DAT64, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_GLOB_DAT64", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- ((bfd_vma) 0) - 1, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_SH_JMP_SLOT64, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_JMP_SLOT64", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- ((bfd_vma) 0) - 1, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- HOWTO (R_SH_RELATIVE64, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_RELATIVE64", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- ((bfd_vma) 0) - 1, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- EMPTY_HOWTO (197),
- EMPTY_HOWTO (198),
- EMPTY_HOWTO (199),
- EMPTY_HOWTO (200),
- EMPTY_HOWTO (201),
- EMPTY_HOWTO (202),
- EMPTY_HOWTO (203),
- EMPTY_HOWTO (204),
- EMPTY_HOWTO (205),
- EMPTY_HOWTO (206),
- EMPTY_HOWTO (207),
- EMPTY_HOWTO (208),
- EMPTY_HOWTO (209),
- EMPTY_HOWTO (210),
- EMPTY_HOWTO (211),
- EMPTY_HOWTO (212),
- EMPTY_HOWTO (213),
- EMPTY_HOWTO (214),
- EMPTY_HOWTO (215),
- EMPTY_HOWTO (216),
- EMPTY_HOWTO (217),
- EMPTY_HOWTO (218),
- EMPTY_HOWTO (219),
- EMPTY_HOWTO (220),
- EMPTY_HOWTO (221),
- EMPTY_HOWTO (222),
- EMPTY_HOWTO (223),
- EMPTY_HOWTO (224),
- EMPTY_HOWTO (225),
- EMPTY_HOWTO (226),
- EMPTY_HOWTO (227),
- EMPTY_HOWTO (228),
- EMPTY_HOWTO (229),
- EMPTY_HOWTO (230),
- EMPTY_HOWTO (231),
- EMPTY_HOWTO (232),
- EMPTY_HOWTO (233),
- EMPTY_HOWTO (234),
- EMPTY_HOWTO (235),
- EMPTY_HOWTO (236),
- EMPTY_HOWTO (237),
- EMPTY_HOWTO (238),
- EMPTY_HOWTO (239),
- EMPTY_HOWTO (240),
- EMPTY_HOWTO (241),
-
- /* Relocations for SHmedia code. None of these are partial_inplace or
- use the field being relocated (except R_SH_PT_16). */
-
- /* The assembler will generate this reloc before a block of SHmedia
- instructions. A section should be processed as assuming it contains
- data, unless this reloc is seen. Note that a block of SHcompact
- instructions are instead preceded by R_SH_CODE.
- This is currently not implemented, but should be used for SHmedia
- linker relaxation. */
- HOWTO (R_SH_SHMEDIA_CODE, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_unsigned, /* complain_on_overflow */
- sh_elf_ignore_reloc, /* special_function */
- "R_SH_SHMEDIA_CODE", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* The assembler will generate this reloc at a PTA or PTB instruction,
- and the linker checks the right type of target, or changes a PTA to a
- PTB, if the original insn was PT. */
- HOWTO (R_SH_PT_16, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 18, /* bitsize */
- TRUE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_PT_16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* Used in unexpanded MOVI. */
- HOWTO (R_SH_IMMS16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_IMMS16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used in SHORI. */
- HOWTO (R_SH_IMMU16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- FALSE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_unsigned, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_IMMU16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used in MOVI and SHORI (x & 65536). */
- HOWTO (R_SH_IMM_LOW16, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_IMM_LOW16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used in MOVI and SHORI ((x - $) & 65536). */
- HOWTO (R_SH_IMM_LOW16_PCREL, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- TRUE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_IMM_LOW16_PCREL", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* Used in MOVI and SHORI ((x >> 16) & 65536). */
- HOWTO (R_SH_IMM_MEDLOW16, /* type */
- 16, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_IMM_MEDLOW16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used in MOVI and SHORI (((x - $) >> 16) & 65536). */
- HOWTO (R_SH_IMM_MEDLOW16_PCREL, /* type */
- 16, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- TRUE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_IMM_MEDLOW16_PCREL", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* Used in MOVI and SHORI ((x >> 32) & 65536). */
- HOWTO (R_SH_IMM_MEDHI16, /* type */
- 32, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_IMM_MEDHI16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used in MOVI and SHORI (((x - $) >> 32) & 65536). */
- HOWTO (R_SH_IMM_MEDHI16_PCREL, /* type */
- 32, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- TRUE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_IMM_MEDHI16_PCREL", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* Used in MOVI and SHORI ((x >> 48) & 65536). */
- HOWTO (R_SH_IMM_HI16, /* type */
- 48, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_IMM_HI16", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* Used in MOVI and SHORI (((x - $) >> 48) & 65536). */
- HOWTO (R_SH_IMM_HI16_PCREL, /* type */
- 48, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- TRUE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_IMM_HI16_PCREL", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- 0x3fffc00, /* dst_mask */
- TRUE), /* pcrel_offset */
-
- /* For the .uaquad pseudo. */
- HOWTO (R_SH_64, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- FALSE, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_64", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- ((bfd_vma) 0) - 1, /* dst_mask */
- FALSE), /* pcrel_offset */
-
- /* For the .uaquad pseudo, (x - $). */
- HOWTO (R_SH_64_PCREL, /* type */
- 48, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- TRUE, /* pc_relative */
- 10, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_SH_64_PCREL", /* name */
- FALSE, /* partial_inplace */
- 0, /* src_mask */
- ((bfd_vma) 0) - 1, /* dst_mask */
- TRUE), /* pcrel_offset */
+/* Return the howto table for ABFD. */
-#endif
-};
+static reloc_howto_type *
+get_howto_table (bfd *abfd)
+{
+ if (vxworks_object_p (abfd))
+ return sh_vxworks_howto_table;
+ return sh_elf_howto_table;
+}
static bfd_reloc_status_type
sh_elf_reloc_loop (int r_type ATTRIBUTE_UNUSED, bfd *input_bfd,
@@ -2057,18 +386,46 @@ static const struct elf_reloc_map sh_reloc_map[] =
};
/* Given a BFD reloc code, return the howto structure for the
- corresponding SH ELf reloc. */
+ corresponding SH ELF reloc. */
static reloc_howto_type *
-sh_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
- bfd_reloc_code_real_type code)
+sh_elf_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code)
{
unsigned int i;
for (i = 0; i < sizeof (sh_reloc_map) / sizeof (struct elf_reloc_map); i++)
{
if (sh_reloc_map[i].bfd_reloc_val == code)
- return &sh_elf_howto_table[(int) sh_reloc_map[i].elf_reloc_val];
+ return get_howto_table (abfd) + (int) sh_reloc_map[i].elf_reloc_val;
+ }
+
+ return NULL;
+}
+
+static reloc_howto_type *
+sh_elf_reloc_name_lookup (bfd *abfd, const char *r_name)
+{
+ unsigned int i;
+
+ if (vxworks_object_p (abfd))
+ {
+ for (i = 0;
+ i < (sizeof (sh_vxworks_howto_table)
+ / sizeof (sh_vxworks_howto_table[0]));
+ i++)
+ if (sh_vxworks_howto_table[i].name != NULL
+ && strcasecmp (sh_vxworks_howto_table[i].name, r_name) == 0)
+ return &sh_vxworks_howto_table[i];
+ }
+ else
+ {
+ for (i = 0;
+ i < (sizeof (sh_elf_howto_table)
+ / sizeof (sh_elf_howto_table[0]));
+ i++)
+ if (sh_elf_howto_table[i].name != NULL
+ && strcasecmp (sh_elf_howto_table[i].name, r_name) == 0)
+ return &sh_elf_howto_table[i];
}
return NULL;
@@ -2077,8 +434,7 @@ sh_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
/* Given an ELF reloc, fill in the howto field of a relent. */
static void
-sh_elf_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr,
- Elf_Internal_Rela *dst)
+sh_elf_info_to_howto (bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst)
{
unsigned int r;
@@ -2091,7 +447,7 @@ sh_elf_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr,
BFD_ASSERT (r < R_SH_FIRST_INVALID_RELOC_4 || r > R_SH_LAST_INVALID_RELOC_4);
BFD_ASSERT (r < R_SH_FIRST_INVALID_RELOC_5 || r > R_SH_LAST_INVALID_RELOC_5);
- cache_ptr->howto = &sh_elf_howto_table[r];
+ cache_ptr->howto = get_howto_table (abfd) + r;
}
/* This function handles relaxing for SH ELF. See the corresponding
@@ -2276,7 +632,10 @@ sh_elf_relax_section (bfd *abfd, asection *sec,
+ h->root.u.def.section->output_offset);
}
- symval += bfd_get_32 (abfd, contents + paddr);
+ if (get_howto_table (abfd)[R_SH_DIR32].partial_inplace)
+ symval += bfd_get_32 (abfd, contents + paddr);
+ else
+ symval += irelfn->r_addend;
/* See if this function call can be shortened. */
foff = (symval
@@ -2284,7 +643,11 @@ sh_elf_relax_section (bfd *abfd, asection *sec,
+ sec->output_section->vma
+ sec->output_offset
+ 4));
- if (foff < -0x1000 || foff >= 0x1000)
+ /* A branch to an address beyond ours might be increased by an
+ .align that doesn't move when bytes behind us are deleted.
+ So, we add some slop in this calculation to allow for
+ that. */
+ if (foff < -0x1000 || foff >= 0x1000 - 8)
{
/* After all that work, we can't shorten this function call. */
continue;
@@ -2322,6 +685,12 @@ sh_elf_relax_section (bfd *abfd, asection *sec,
irel->r_addend = -4;
+ /* When we calculated the symbol "value" we had an offset in the
+ DIR32's word in memory (we read and add it above). However,
+ the jsr we create does NOT have this offset encoded, so we
+ have to add it to the addend to preserve it. */
+ irel->r_addend += bfd_get_32 (abfd, contents + paddr);
+
/* See if there is another R_SH_USES reloc referring to the same
register load. */
for (irelscan = internal_relocs; irelscan < irelend; irelscan++)
@@ -2591,10 +960,19 @@ sh_elf_relax_delete_bytes (bfd *abfd, asection *sec, bfd_vma addr,
{
bfd_vma val;
- val = bfd_get_32 (abfd, contents + nraddr);
- val += isym->st_value;
- if (val > addr && val < toaddr)
- bfd_put_32 (abfd, val - count, contents + nraddr);
+ if (get_howto_table (abfd)[R_SH_DIR32].partial_inplace)
+ {
+ val = bfd_get_32 (abfd, contents + nraddr);
+ val += isym->st_value;
+ if (val > addr && val < toaddr)
+ bfd_put_32 (abfd, val - count, contents + nraddr);
+ }
+ else
+ {
+ val = isym->st_value + irel->r_addend;
+ if (val > addr && val < toaddr)
+ irel->r_addend -= count;
+ }
}
}
start = stop = addr;
@@ -3144,15 +1522,50 @@ sh_elf_swap_insns (bfd *abfd, asection *sec, void *relocs,
}
#endif /* defined SH64_ELF */
+/* Describes one of the various PLT styles. */
+
+struct elf_sh_plt_info
+{
+ /* The template for the first PLT entry, or NULL if there is no special
+ first entry. */
+ const bfd_byte *plt0_entry;
+
+ /* The size of PLT0_ENTRY in bytes, or 0 if PLT0_ENTRY is NULL. */
+ bfd_vma plt0_entry_size;
+
+ /* Index I is the offset into PLT0_ENTRY of a pointer to
+ _GLOBAL_OFFSET_TABLE_ + I * 4. The value is MINUS_ONE
+ if there is no such pointer. */
+ bfd_vma plt0_got_fields[3];
+
+ /* The template for a symbol's PLT entry. */
+ const bfd_byte *symbol_entry;
+
+ /* The size of SYMBOL_ENTRY in bytes. */
+ bfd_vma symbol_entry_size;
+
+ /* Byte offsets of fields in SYMBOL_ENTRY. Not all fields are used
+ on all targets. The comments by each member indicate the value
+ that the field must hold. */
+ struct {
+ bfd_vma got_entry; /* the address of the symbol's .got.plt entry */
+ bfd_vma plt; /* .plt (or a branch to .plt on VxWorks) */
+ bfd_vma reloc_offset; /* the offset of the symbol's JMP_SLOT reloc */
+ } symbol_fields;
+
+ /* The offset of the resolver stub from the start of SYMBOL_ENTRY. */
+ bfd_vma symbol_resolve_offset;
+};
+
#ifdef INCLUDE_SHMEDIA
/* The size in bytes of an entry in the procedure linkage table. */
-#define PLT_ENTRY_SIZE 64
+#define ELF_PLT_ENTRY_SIZE 64
/* First entry in an absolute procedure linkage table look like this. */
-static const bfd_byte elf_sh_plt0_entry_be[PLT_ENTRY_SIZE] =
+static const bfd_byte elf_sh_plt0_entry_be[ELF_PLT_ENTRY_SIZE] =
{
0xcc, 0x00, 0x01, 0x10, /* movi .got.plt >> 16, r17 */
0xc8, 0x00, 0x01, 0x10, /* shori .got.plt & 65535, r17 */
@@ -3172,7 +1585,7 @@ static const bfd_byte elf_sh_plt0_entry_be[PLT_ENTRY_SIZE] =
0x6f, 0xf0, 0xff, 0xf0, /* nop */
};
-static const bfd_byte elf_sh_plt0_entry_le[PLT_ENTRY_SIZE] =
+static const bfd_byte elf_sh_plt0_entry_le[ELF_PLT_ENTRY_SIZE] =
{
0x10, 0x01, 0x00, 0xcc, /* movi .got.plt >> 16, r17 */
0x10, 0x01, 0x00, 0xc8, /* shori .got.plt & 65535, r17 */
@@ -3195,7 +1608,7 @@ static const bfd_byte elf_sh_plt0_entry_le[PLT_ENTRY_SIZE] =
/* Sebsequent entries in an absolute procedure linkage table look like
this. */
-static const bfd_byte elf_sh_plt_entry_be[PLT_ENTRY_SIZE] =
+static const bfd_byte elf_sh_plt_entry_be[ELF_PLT_ENTRY_SIZE] =
{
0xcc, 0x00, 0x01, 0x90, /* movi nameN-in-GOT >> 16, r25 */
0xc8, 0x00, 0x01, 0x90, /* shori nameN-in-GOT & 65535, r25 */
@@ -3215,7 +1628,7 @@ static const bfd_byte elf_sh_plt_entry_be[PLT_ENTRY_SIZE] =
0x6f, 0xf0, 0xff, 0xf0, /* nop */
};
-static const bfd_byte elf_sh_plt_entry_le[PLT_ENTRY_SIZE] =
+static const bfd_byte elf_sh_plt_entry_le[ELF_PLT_ENTRY_SIZE] =
{
0x90, 0x01, 0x00, 0xcc, /* movi nameN-in-GOT >> 16, r25 */
0x90, 0x01, 0x00, 0xc8, /* shori nameN-in-GOT & 65535, r25 */
@@ -3237,7 +1650,7 @@ static const bfd_byte elf_sh_plt_entry_le[PLT_ENTRY_SIZE] =
/* Entries in a PIC procedure linkage table look like this. */
-static const bfd_byte elf_sh_pic_plt_entry_be[PLT_ENTRY_SIZE] =
+static const bfd_byte elf_sh_pic_plt_entry_be[ELF_PLT_ENTRY_SIZE] =
{
0xcc, 0x00, 0x01, 0x90, /* movi nameN@GOT >> 16, r25 */
0xc8, 0x00, 0x01, 0x90, /* shori nameN@GOT & 65535, r25 */
@@ -3257,7 +1670,7 @@ static const bfd_byte elf_sh_pic_plt_entry_be[PLT_ENTRY_SIZE] =
0x44, 0x01, 0xff, 0xf0, /* blink tr0, r63 */
};
-static const bfd_byte elf_sh_pic_plt_entry_le[PLT_ENTRY_SIZE] =
+static const bfd_byte elf_sh_pic_plt_entry_le[ELF_PLT_ENTRY_SIZE] =
{
0x90, 0x01, 0x00, 0xcc, /* movi nameN@GOT >> 16, r25 */
0x90, 0x01, 0x00, 0xc8, /* shori nameN@GOT & 65535, r25 */
@@ -3277,31 +1690,67 @@ static const bfd_byte elf_sh_pic_plt_entry_le[PLT_ENTRY_SIZE] =
0xf0, 0xff, 0x01, 0x44, /* blink tr0, r63 */
};
-static const bfd_byte *elf_sh_plt0_entry;
-static const bfd_byte *elf_sh_plt_entry;
-static const bfd_byte *elf_sh_pic_plt_entry;
-
-/* Return size of a PLT entry. */
-#define elf_sh_sizeof_plt(info) PLT_ENTRY_SIZE
-
-/* Return offset of the PLT0 address in an absolute PLT entry. */
-#define elf_sh_plt_plt0_offset(info) 32
+static const struct elf_sh_plt_info elf_sh_plts[2][2] = {
+ {
+ {
+ /* Big-endian non-PIC. */
+ elf_sh_plt0_entry_be,
+ ELF_PLT_ENTRY_SIZE,
+ { 0, MINUS_ONE, MINUS_ONE },
+ elf_sh_plt_entry_be,
+ ELF_PLT_ENTRY_SIZE,
+ { 0, 32, 48 },
+ 33 /* includes ISA encoding */
+ },
+ {
+ /* Little-endian non-PIC. */
+ elf_sh_plt0_entry_le,
+ ELF_PLT_ENTRY_SIZE,
+ { 0, MINUS_ONE, MINUS_ONE },
+ elf_sh_plt_entry_le,
+ ELF_PLT_ENTRY_SIZE,
+ { 0, 32, 48 },
+ 33 /* includes ISA encoding */
+ },
+ },
+ {
+ {
+ /* Big-endian PIC. */
+ elf_sh_plt0_entry_be,
+ ELF_PLT_ENTRY_SIZE,
+ { MINUS_ONE, MINUS_ONE, MINUS_ONE },
+ elf_sh_pic_plt_entry_be,
+ ELF_PLT_ENTRY_SIZE,
+ { 0, MINUS_ONE, 52 },
+ 33 /* includes ISA encoding */
+ },
+ {
+ /* Little-endian PIC. */
+ elf_sh_plt0_entry_le,
+ ELF_PLT_ENTRY_SIZE,
+ { MINUS_ONE, MINUS_ONE, MINUS_ONE },
+ elf_sh_pic_plt_entry_le,
+ ELF_PLT_ENTRY_SIZE,
+ { 0, MINUS_ONE, 52 },
+ 33 /* includes ISA encoding */
+ },
+ }
+};
/* Return offset of the linker in PLT0 entry. */
#define elf_sh_plt0_gotplt_offset(info) 0
-/* Return offset of the trampoline in PLT entry */
-#define elf_sh_plt_temp_offset(info) 33 /* Add one because it's SHmedia. */
+/* Install a 32-bit PLT field starting at ADDR, which occurs in OUTPUT_BFD.
+ VALUE is the field's value and CODE_P is true if VALUE refers to code,
+ not data.
-/* Return offset of the symbol in PLT entry. */
-#define elf_sh_plt_symbol_offset(info) 0
-
-/* Return offset of the relocation in PLT entry. */
-#define elf_sh_plt_reloc_offset(info) (info->shared ? 52 : 44)
+ On SH64, each 32-bit field is loaded by a movi/shori pair. */
inline static void
-movi_shori_putval (bfd *output_bfd, unsigned long value, bfd_byte *addr)
+install_plt_field (bfd *output_bfd, bfd_boolean code_p,
+ unsigned long value, bfd_byte *addr)
{
+ value |= code_p;
bfd_put_32 (output_bfd,
bfd_get_32 (output_bfd, addr)
| ((value >> 6) & 0x3fffc00),
@@ -3312,10 +1761,18 @@ movi_shori_putval (bfd *output_bfd, unsigned long value, bfd_byte *addr)
addr + 4);
}
+/* Return the type of PLT associated with ABFD. PIC_P is true if
+ the object is position-independent. */
+
+static const struct elf_sh_plt_info *
+get_plt_info (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean pic_p)
+{
+ return &elf_sh_plts[pic_p][!bfd_big_endian (abfd)];
+}
#else
/* The size in bytes of an entry in the procedure linkage table. */
-#define PLT_ENTRY_SIZE 28
+#define ELF_PLT_ENTRY_SIZE 28
/* First entry in an absolute procedure linkage table look like this. */
@@ -3327,7 +1784,7 @@ movi_shori_putval (bfd *output_bfd, unsigned long value, bfd_byte *addr)
ignores the type. Loaders can easily detect this difference however,
since the type will always be 0 or 8, and the GOT ids will always be
greater than or equal to 12. */
-static const bfd_byte elf_sh_plt0_entry_be[PLT_ENTRY_SIZE] =
+static const bfd_byte elf_sh_plt0_entry_be[ELF_PLT_ENTRY_SIZE] =
{
0xd0, 0x05, /* mov.l 2f,r0 */
0x60, 0x02, /* mov.l @r0,r0 */
@@ -3343,7 +1800,7 @@ static const bfd_byte elf_sh_plt0_entry_be[PLT_ENTRY_SIZE] =
0, 0, 0, 0, /* 2: replaced with address of .got.plt + 4. */
};
-static const bfd_byte elf_sh_plt0_entry_le[PLT_ENTRY_SIZE] =
+static const bfd_byte elf_sh_plt0_entry_le[ELF_PLT_ENTRY_SIZE] =
{
0x05, 0xd0, /* mov.l 2f,r0 */
0x02, 0x60, /* mov.l @r0,r0 */
@@ -3362,10 +1819,10 @@ static const bfd_byte elf_sh_plt0_entry_le[PLT_ENTRY_SIZE] =
/* Sebsequent entries in an absolute procedure linkage table look like
this. */
-static const bfd_byte elf_sh_plt_entry_be[PLT_ENTRY_SIZE] =
+static const bfd_byte elf_sh_plt_entry_be[ELF_PLT_ENTRY_SIZE] =
{
0xd0, 0x04, /* mov.l 1f,r0 */
- 0x60, 0x02, /* mov.l @r0,r0 */
+ 0x60, 0x02, /* mov.l @(r0,r12),r0 */
0xd1, 0x02, /* mov.l 0f,r1 */
0x40, 0x2b, /* jmp @r0 */
0x60, 0x13, /* mov r1,r0 */
@@ -3377,7 +1834,7 @@ static const bfd_byte elf_sh_plt_entry_be[PLT_ENTRY_SIZE] =
0, 0, 0, 0, /* 2: replaced with offset into relocation table. */
};
-static const bfd_byte elf_sh_plt_entry_le[PLT_ENTRY_SIZE] =
+static const bfd_byte elf_sh_plt_entry_le[ELF_PLT_ENTRY_SIZE] =
{
0x04, 0xd0, /* mov.l 1f,r0 */
0x02, 0x60, /* mov.l @r0,r0 */
@@ -3394,7 +1851,7 @@ static const bfd_byte elf_sh_plt_entry_le[PLT_ENTRY_SIZE] =
/* Entries in a PIC procedure linkage table look like this. */
-static const bfd_byte elf_sh_pic_plt_entry_be[PLT_ENTRY_SIZE] =
+static const bfd_byte elf_sh_pic_plt_entry_be[ELF_PLT_ENTRY_SIZE] =
{
0xd0, 0x04, /* mov.l 1f,r0 */
0x00, 0xce, /* mov.l @(r0,r12),r0 */
@@ -3410,7 +1867,7 @@ static const bfd_byte elf_sh_pic_plt_entry_be[PLT_ENTRY_SIZE] =
0, 0, 0, 0 /* 2: replaced with offset into relocation table. */
};
-static const bfd_byte elf_sh_pic_plt_entry_le[PLT_ENTRY_SIZE] =
+static const bfd_byte elf_sh_pic_plt_entry_le[ELF_PLT_ENTRY_SIZE] =
{
0x04, 0xd0, /* mov.l 1f,r0 */
0xce, 0x00, /* mov.l @(r0,r12),r0 */
@@ -3426,32 +1883,216 @@ static const bfd_byte elf_sh_pic_plt_entry_le[PLT_ENTRY_SIZE] =
0, 0, 0, 0 /* 2: replaced with offset into relocation table. */
};
-static const bfd_byte *elf_sh_plt0_entry;
-static const bfd_byte *elf_sh_plt_entry;
-static const bfd_byte *elf_sh_pic_plt_entry;
+static const struct elf_sh_plt_info elf_sh_plts[2][2] = {
+ {
+ {
+ /* Big-endian non-PIC. */
+ elf_sh_plt0_entry_be,
+ ELF_PLT_ENTRY_SIZE,
+ { MINUS_ONE, 24, 20 },
+ elf_sh_plt_entry_be,
+ ELF_PLT_ENTRY_SIZE,
+ { 20, 16, 24 },
+ 8
+ },
+ {
+ /* Little-endian non-PIC. */
+ elf_sh_plt0_entry_le,
+ ELF_PLT_ENTRY_SIZE,
+ { MINUS_ONE, 24, 20 },
+ elf_sh_plt_entry_le,
+ ELF_PLT_ENTRY_SIZE,
+ { 20, 16, 24 },
+ 8
+ },
+ },
+ {
+ {
+ /* Big-endian PIC. */
+ elf_sh_plt0_entry_be,
+ ELF_PLT_ENTRY_SIZE,
+ { MINUS_ONE, MINUS_ONE, MINUS_ONE },
+ elf_sh_pic_plt_entry_be,
+ ELF_PLT_ENTRY_SIZE,
+ { 20, MINUS_ONE, 24 },
+ 8
+ },
+ {
+ /* Little-endian PIC. */
+ elf_sh_plt0_entry_le,
+ ELF_PLT_ENTRY_SIZE,
+ { MINUS_ONE, MINUS_ONE, MINUS_ONE },
+ elf_sh_pic_plt_entry_le,
+ ELF_PLT_ENTRY_SIZE,
+ { 20, MINUS_ONE, 24 },
+ 8
+ },
+ }
+};
-/* Return size of a PLT entry. */
-#define elf_sh_sizeof_plt(info) PLT_ENTRY_SIZE
+#define VXWORKS_PLT_HEADER_SIZE 12
+#define VXWORKS_PLT_ENTRY_SIZE 24
-/* Return offset of the PLT0 address in an absolute PLT entry. */
-#define elf_sh_plt_plt0_offset(info) 16
+static const bfd_byte vxworks_sh_plt0_entry_be[VXWORKS_PLT_HEADER_SIZE] =
+{
+ 0xd1, 0x01, /* mov.l @(8,pc),r1 */
+ 0x61, 0x12, /* mov.l @r1,r1 */
+ 0x41, 0x2b, /* jmp @r1 */
+ 0x00, 0x09, /* nop */
+ 0, 0, 0, 0 /* 0: replaced with _GLOBAL_OFFSET_TABLE+8. */
+};
-/* Return offset of the linker in PLT0 entry. */
-#define elf_sh_plt0_linker_offset(info) 20
+static const bfd_byte vxworks_sh_plt0_entry_le[VXWORKS_PLT_HEADER_SIZE] =
+{
+ 0x01, 0xd1, /* mov.l @(8,pc),r1 */
+ 0x12, 0x61, /* mov.l @r1,r1 */
+ 0x2b, 0x41, /* jmp @r1 */
+ 0x09, 0x00, /* nop */
+ 0, 0, 0, 0 /* 0: replaced with _GLOBAL_OFFSET_TABLE+8. */
+};
+
+static const bfd_byte vxworks_sh_plt_entry_be[VXWORKS_PLT_ENTRY_SIZE] =
+{
+ 0xd0, 0x01, /* mov.l @(8,pc),r0 */
+ 0x60, 0x02, /* mov.l @r0,r0 */
+ 0x40, 0x2b, /* jmp @r0 */
+ 0x00, 0x09, /* nop */
+ 0, 0, 0, 0, /* 0: replaced with address of this symbol in .got. */
+ 0xd0, 0x01, /* mov.l @(8,pc),r0 */
+ 0xa0, 0x00, /* bra PLT (We need to fix the offset.) */
+ 0x00, 0x09, /* nop */
+ 0x00, 0x09, /* nop */
+ 0, 0, 0, 0, /* 1: replaced with offset into relocation table. */
+};
+
+static const bfd_byte vxworks_sh_plt_entry_le[VXWORKS_PLT_ENTRY_SIZE] =
+{
+ 0x01, 0xd0, /* mov.l @(8,pc),r0 */
+ 0x02, 0x60, /* mov.l @r0,r0 */
+ 0x2b, 0x40, /* jmp @r0 */
+ 0x09, 0x00, /* nop */
+ 0, 0, 0, 0, /* 0: replaced with address of this symbol in .got. */
+ 0x01, 0xd0, /* mov.l @(8,pc),r0 */
+ 0x00, 0xa0, /* bra PLT (We need to fix the offset.) */
+ 0x09, 0x00, /* nop */
+ 0x09, 0x00, /* nop */
+ 0, 0, 0, 0, /* 1: replaced with offset into relocation table. */
+};
+
+static const bfd_byte vxworks_sh_pic_plt_entry_be[VXWORKS_PLT_ENTRY_SIZE] =
+{
+ 0xd0, 0x01, /* mov.l @(8,pc),r0 */
+ 0x00, 0xce, /* mov.l @(r0,r12),r0 */
+ 0x40, 0x2b, /* jmp @r0 */
+ 0x00, 0x09, /* nop */
+ 0, 0, 0, 0, /* 0: replaced with offset of this symbol in .got. */
+ 0xd0, 0x01, /* mov.l @(8,pc),r0 */
+ 0x51, 0xc2, /* mov.l @(8,r12),r1 */
+ 0x41, 0x2b, /* jmp @r1 */
+ 0x00, 0x09, /* nop */
+ 0, 0, 0, 0, /* 1: replaced with offset into relocation table. */
+};
+
+static const bfd_byte vxworks_sh_pic_plt_entry_le[VXWORKS_PLT_ENTRY_SIZE] =
+{
+ 0x01, 0xd0, /* mov.l @(8,pc),r0 */
+ 0xce, 0x00, /* mov.l @(r0,r12),r0 */
+ 0x2b, 0x40, /* jmp @r0 */
+ 0x09, 0x00, /* nop */
+ 0, 0, 0, 0, /* 0: replaced with offset of this symbol in .got. */
+ 0x01, 0xd0, /* mov.l @(8,pc),r0 */
+ 0xc2, 0x51, /* mov.l @(8,r12),r1 */
+ 0x2b, 0x41, /* jmp @r1 */
+ 0x09, 0x00, /* nop */
+ 0, 0, 0, 0, /* 1: replaced with offset into relocation table. */
+};
+
+static const struct elf_sh_plt_info vxworks_sh_plts[2][2] = {
+ {
+ {
+ /* Big-endian non-PIC. */
+ vxworks_sh_plt0_entry_be,
+ VXWORKS_PLT_HEADER_SIZE,
+ { MINUS_ONE, MINUS_ONE, 8 },
+ vxworks_sh_plt_entry_be,
+ VXWORKS_PLT_ENTRY_SIZE,
+ { 8, 14, 20 },
+ 12
+ },
+ {
+ /* Little-endian non-PIC. */
+ vxworks_sh_plt0_entry_le,
+ VXWORKS_PLT_HEADER_SIZE,
+ { MINUS_ONE, MINUS_ONE, 8 },
+ vxworks_sh_plt_entry_le,
+ VXWORKS_PLT_ENTRY_SIZE,
+ { 8, 14, 20 },
+ 12
+ },
+ },
+ {
+ {
+ /* Big-endian PIC. */
+ NULL,
+ 0,
+ { MINUS_ONE, MINUS_ONE, MINUS_ONE },
+ vxworks_sh_pic_plt_entry_be,
+ VXWORKS_PLT_ENTRY_SIZE,
+ { 8, MINUS_ONE, 20 },
+ 12
+ },
+ {
+ /* Little-endian PIC. */
+ NULL,
+ 0,
+ { MINUS_ONE, MINUS_ONE, MINUS_ONE },
+ vxworks_sh_pic_plt_entry_le,
+ VXWORKS_PLT_ENTRY_SIZE,
+ { 8, MINUS_ONE, 20 },
+ 12
+ },
+ }
+};
-/* Return offset of the GOT id in PLT0 entry. */
-#define elf_sh_plt0_gotid_offset(info) 24
+/* Return the type of PLT associated with ABFD. PIC_P is true if
+ the object is position-independent. */
-/* Return offset of the temporary in PLT entry */
-#define elf_sh_plt_temp_offset(info) 8
+static const struct elf_sh_plt_info *
+get_plt_info (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean pic_p)
+{
+ if (vxworks_object_p (abfd))
+ return &vxworks_sh_plts[pic_p][!bfd_big_endian (abfd)];
+ return &elf_sh_plts[pic_p][!bfd_big_endian (abfd)];
+}
-/* Return offset of the symbol in PLT entry. */
-#define elf_sh_plt_symbol_offset(info) 20
+/* Install a 32-bit PLT field starting at ADDR, which occurs in OUTPUT_BFD.
+ VALUE is the field's value and CODE_P is true if VALUE refers to code,
+ not data. */
-/* Return offset of the relocation in PLT entry. */
-#define elf_sh_plt_reloc_offset(info) 24
+inline static void
+install_plt_field (bfd *output_bfd, bfd_boolean code_p ATTRIBUTE_UNUSED,
+ unsigned long value, bfd_byte *addr)
+{
+ bfd_put_32 (output_bfd, value, addr);
+}
#endif
+/* Return the index of the PLT entry at byte offset OFFSET. */
+
+static bfd_vma
+get_plt_index (const struct elf_sh_plt_info *info, bfd_vma offset)
+{
+ return (offset - info->plt0_entry_size) / info->symbol_entry_size;
+}
+
+/* Do the inverse operation. */
+
+static bfd_vma
+get_plt_offset (const struct elf_sh_plt_info *info, bfd_vma index)
+{
+ return info->plt0_entry_size + (index * info->symbol_entry_size);
+}
+
/* The sh 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
@@ -3518,11 +2159,14 @@ struct sh_elf_obj_tdata
static bfd_boolean
sh_elf_mkobject (bfd *abfd)
{
- bfd_size_type amt = sizeof (struct sh_elf_obj_tdata);
- abfd->tdata.any = bfd_zalloc (abfd, amt);
if (abfd->tdata.any == NULL)
- return FALSE;
- return TRUE;
+ {
+ bfd_size_type amt = sizeof (struct sh_elf_obj_tdata);
+ abfd->tdata.any = bfd_zalloc (abfd, amt);
+ if (abfd->tdata.any == NULL)
+ return FALSE;
+ }
+ return bfd_elf_mkobject (abfd);
}
/* sh ELF linker hash table. */
@@ -3540,6 +2184,9 @@ struct elf_sh_link_hash_table
asection *sdynbss;
asection *srelbss;
+ /* The (unloaded but important) VxWorks .rela.plt.unloaded section. */
+ asection *srelplt2;
+
/* Small local sym to section mapping cache. */
struct sym_sec_cache sym_sec;
@@ -3549,6 +2196,12 @@ struct elf_sh_link_hash_table
bfd_signed_vma refcount;
bfd_vma offset;
} tls_ldm_got;
+
+ /* The type of PLT to use. */
+ const struct elf_sh_plt_info *plt_info;
+
+ /* True if the target system is VxWorks. */
+ bfd_boolean vxworks_p;
};
/* Traverse an sh ELF linker hash table. */
@@ -3627,8 +2280,11 @@ sh_elf_link_hash_table_create (bfd *abfd)
ret->srelplt = NULL;
ret->sdynbss = NULL;
ret->srelbss = NULL;
+ ret->srelplt2 = NULL;
ret->sym_sec.abfd = NULL;
ret->tls_ldm_got.refcount = 0;
+ ret->plt_info = NULL;
+ ret->vxworks_p = vxworks_object_p (abfd);
return &ret->root.root;
}
@@ -3810,6 +2466,12 @@ sh_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
}
}
+ if (htab->vxworks_p)
+ {
+ if (!elf_vxworks_create_dynamic_sections (abfd, info, &htab->srelplt2))
+ return FALSE;
+ }
+
return TRUE;
}
@@ -3827,7 +2489,6 @@ sh_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
struct elf_sh_link_hash_entry *eh;
struct elf_sh_dyn_relocs *p;
asection *s;
- unsigned int power_of_two;
htab = sh_elf_hash_table (info);
@@ -3951,28 +2612,7 @@ sh_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
h->needs_copy = 1;
}
- /* We need to figure out the alignment required for this symbol. I
- have no idea how ELF linkers handle this. */
- power_of_two = bfd_log2 (h->size);
- if (power_of_two > 3)
- power_of_two = 3;
-
- /* Apply the required alignment. */
- s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two));
- if (power_of_two > bfd_get_section_alignment (htab->root.dynobj, s))
- {
- if (! bfd_set_section_alignment (htab->root.dynobj, s, power_of_two))
- return FALSE;
- }
-
- /* Define the symbol as being at this point in the section. */
- h->root.u.def.section = s;
- h->root.u.def.value = s->size;
-
- /* Increment the section size to make room for the symbol. */
- s->size += h->size;
-
- return TRUE;
+ return _bfd_elf_adjust_dynamic_copy (h, s);
}
/* Allocate space in .plt, .got and associated reloc sections for
@@ -4032,7 +2672,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
/* If this is the first .plt entry, make room for the special
first entry. */
if (s->size == 0)
- s->size += PLT_ENTRY_SIZE;
+ s->size += htab->plt_info->plt0_entry_size;
h->plt.offset = s->size;
@@ -4049,7 +2689,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
}
/* Make room for this entry. */
- s->size += PLT_ENTRY_SIZE;
+ s->size += htab->plt_info->symbol_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. */
@@ -4057,6 +2697,23 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
/* We also need to make an entry in the .rel.plt section. */
htab->srelplt->size += sizeof (Elf32_External_Rela);
+
+ if (htab->vxworks_p && !info->shared)
+ {
+ /* VxWorks executables have a second set of relocations
+ for each PLT entry. They go in a separate relocation
+ section, which is processed by the kernel loader. */
+
+ /* There is a relocation for the initial PLT entry:
+ an R_SH_DIR32 relocation for _GLOBAL_OFFSET_TABLE_. */
+ if (h->plt.offset == htab->plt_info->plt0_entry_size)
+ htab->srelplt2->size += sizeof (Elf32_External_Rela);
+
+ /* There are two extra relocations for each subsequent
+ PLT entry: an R_SH_DIR32 relocation for the GOT entry,
+ and an R_SH_DIR32 relocation for the PLT entry. */
+ htab->srelplt2->size += sizeof (Elf32_External_Rela) * 2;
+ }
}
else
{
@@ -4250,6 +2907,17 @@ readonly_dynrelocs (struct elf_link_hash_entry *h, void *inf)
return TRUE;
}
+/* This function is called after all the input files have been read,
+ and the input sections have been assigned to output sections.
+ It's a convenient place to determine the PLT style. */
+
+static bfd_boolean
+sh_elf_always_size_sections (bfd *output_bfd, struct bfd_link_info *info)
+{
+ sh_elf_hash_table (info)->plt_info = get_plt_info (output_bfd, info->shared);
+ return TRUE;
+}
+
/* Set the sizes of the dynamic sections. */
static bfd_boolean
@@ -4381,9 +3049,9 @@ sh_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
/* Strip this section if we don't need it; see the
comment below. */
}
- else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0)
+ else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela"))
{
- if (s->size != 0 && s != htab->srelplt)
+ if (s->size != 0 && s != htab->srelplt && s != htab->srelplt2)
relocs = TRUE;
/* We use the reloc_count field as a counter if we need
@@ -4554,7 +3222,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
return FALSE;
}
- howto = sh_elf_howto_table + r_type;
+ howto = get_howto_table (output_bfd) + r_type;
/* For relocs that aren't partial_inplace, we get the addend from
the relocation. */
@@ -4579,13 +3247,16 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
(info,
_("Unexpected STO_SH5_ISA32 on local symbol is not handled"),
input_bfd, input_section, rel->r_offset));
- if (info->relocatable)
+
+ if (sec != NULL && elf_discarded_section (sec))
+ /* Handled below. */
+ ;
+ else if (info->relocatable)
{
/* This is a relocatable link. We don't have to change
anything, unless the reloc is against a section symbol,
in which case we have to adjust according to where the
section symbol winds up in the output section. */
- sym = local_syms + r_symndx;
if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
{
if (! howto->partial_inplace)
@@ -4594,7 +3265,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
relocation, we need just to update the addend.
All real relocs are of type partial_inplace; this
code is mostly for completeness. */
- rel->r_addend += sec->output_offset + sym->st_value;
+ rel->r_addend += sec->output_offset;
continue;
}
@@ -4649,12 +3320,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
{
/* FIXME: Ought to make use of the RELOC_FOR_GLOBAL_SYMBOL macro. */
- /* Section symbol are never (?) placed in the hash table, so
- we can just ignore hash relocations when creating a
- relocatable object file. */
- if (info->relocatable)
- continue;
-
+ relocation = 0;
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
@@ -4725,8 +3391,17 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|| (sec->output_section == NULL
&& (sh_elf_hash_entry (h)->tls_type == GOT_TLS_IE
|| sh_elf_hash_entry (h)->tls_type == GOT_TLS_GD)))
- relocation = 0;
- else if (sec->output_section == NULL)
+ ;
+ else if (sec->output_section != NULL)
+ relocation = ((h->root.u.def.value
+ + sec->output_section->vma
+ + sec->output_offset)
+ /* A STO_SH5_ISA32 causes a "bitor 1" to the
+ symbol value, unless we've seen
+ STT_DATALABEL on the way to it. */
+ | ((h->other & STO_SH5_ISA32) != 0
+ && ! seen_stt_datalabel));
+ else if (!info->relocatable)
{
(*_bfd_error_handler)
(_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
@@ -4737,22 +3412,13 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
h->root.root.string);
return FALSE;
}
- else
- relocation = ((h->root.u.def.value
- + sec->output_section->vma
- + sec->output_offset)
- /* A STO_SH5_ISA32 causes a "bitor 1" to the
- symbol value, unless we've seen
- STT_DATALABEL on the way to it. */
- | ((h->other & STO_SH5_ISA32) != 0
- && ! seen_stt_datalabel));
}
else if (h->root.type == bfd_link_hash_undefweak)
- relocation = 0;
+ ;
else if (info->unresolved_syms_in_objects == RM_IGNORE
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
- relocation = 0;
- else
+ ;
+ else if (!info->relocatable)
{
if (! info->callbacks->undefined_symbol
(info, h->root.root.string, input_bfd,
@@ -4760,10 +3426,23 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
(info->unresolved_syms_in_objects == RM_GENERATE_ERROR
|| ELF_ST_VISIBILITY (h->other))))
return FALSE;
- relocation = 0;
}
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
switch ((int) r_type)
{
final_link_relocate:
@@ -4924,7 +3603,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (input_bfd,
input_section),
name + 5) == 0);
@@ -4953,7 +3632,9 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
BFD_ASSERT (h != NULL && h->dynindx != -1);
outrel.r_info = ELF32_R_INFO (h->dynindx, R_SH_REL32);
outrel.r_addend
- = bfd_get_32 (input_bfd, contents + rel->r_offset);
+ = (howto->partial_inplace
+ ? bfd_get_32 (input_bfd, contents + rel->r_offset)
+ : addend);
}
#ifdef INCLUDE_SHMEDIA
else if (r_type == R_SH_IMM_LOW16_PCREL
@@ -4974,20 +3655,19 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|| ((info->symbolic || h->dynindx == -1)
&& h->def_regular))
{
- relocate = TRUE;
+ relocate = howto->partial_inplace;
outrel.r_info = ELF32_R_INFO (0, R_SH_RELATIVE);
- outrel.r_addend
- = relocation + bfd_get_32 (input_bfd,
- contents + rel->r_offset);
}
else
{
BFD_ASSERT (h->dynindx != -1);
outrel.r_info = ELF32_R_INFO (h->dynindx, R_SH_DIR32);
- outrel.r_addend
- = relocation + bfd_get_32 (input_bfd,
- contents + rel->r_offset);
}
+ outrel.r_addend = relocation;
+ outrel.r_addend
+ += (howto->partial_inplace
+ ? bfd_get_32 (input_bfd, contents + rel->r_offset)
+ : addend);
}
loc = sreloc->contents;
@@ -5029,8 +3709,8 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
BFD_ASSERT (sgotplt != NULL);
relocation = (sgotplt->output_offset
- + ((h->plt.offset / elf_sh_sizeof_plt (info)
- - 1 + 3) * 4));
+ + (get_plt_index (htab->plt_info, h->plt.offset)
+ + 3) * 4);
#ifdef GOT_BIAS
relocation -= GOT_BIAS;
@@ -5649,7 +4329,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (input_bfd,
input_section),
name + 5) == 0);
@@ -5853,42 +4533,20 @@ tpoff (struct bfd_link_info *info, bfd_vma address)
static asection *
sh_elf_gc_mark_hook (asection *sec,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
- Elf_Internal_Rela *rel, struct elf_link_hash_entry *h,
+ struct bfd_link_info *info,
+ Elf_Internal_Rela *rel,
+ struct elf_link_hash_entry *h,
Elf_Internal_Sym *sym)
{
if (h != NULL)
- {
- switch (ELF32_R_TYPE (rel->r_info))
- {
- case R_SH_GNU_VTINHERIT:
- case R_SH_GNU_VTENTRY:
- break;
-
- default:
-#ifdef INCLUDE_SHMEDIA
- while (h->root.type == bfd_link_hash_indirect
- && h->root.u.i.link)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-#endif
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
+ switch (ELF32_R_TYPE (rel->r_info))
+ {
+ case R_SH_GNU_VTINHERIT:
+ case R_SH_GNU_VTENTRY:
+ return NULL;
+ }
- return NULL;
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
/* Update the got entry reference counts for the section being removed. */
@@ -6538,7 +5196,7 @@ sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (abfd, sec),
name + 5) == 0);
@@ -6698,6 +5356,9 @@ sh_elf_copy_private_data (bfd * ibfd, bfd * obfd)
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
return TRUE;
+ /* Copy object attributes. */
+ _bfd_elf_copy_obj_attributes (ibfd, obfd);
+
return sh_elf_set_private_flags (obfd, elf_elfheader (ibfd)->e_flags);
}
#endif /* not sh_elf_copy_private_data */
@@ -6799,7 +5460,7 @@ sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info,
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 / elf_sh_sizeof_plt (info) - 1;
+ plt_index = get_plt_index (htab->plt_info, h->plt.offset);
/* Get the offset into the .got table of the entry that
corresponds to this function. Each .got entry is 4 bytes.
@@ -6812,62 +5473,61 @@ sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info,
#endif
/* Fill in the entry in the procedure linkage table. */
- if (! info->shared)
+ memcpy (splt->contents + h->plt.offset,
+ htab->plt_info->symbol_entry,
+ htab->plt_info->symbol_entry_size);
+
+ if (info->shared)
+ install_plt_field (output_bfd, FALSE, got_offset,
+ (splt->contents
+ + h->plt.offset
+ + htab->plt_info->symbol_fields.got_entry));
+ else
{
- if (elf_sh_plt_entry == NULL)
- {
- elf_sh_plt_entry = (bfd_big_endian (output_bfd) ?
- elf_sh_plt_entry_be : elf_sh_plt_entry_le);
- }
- memcpy (splt->contents + h->plt.offset, elf_sh_plt_entry,
- elf_sh_sizeof_plt (info));
-#ifdef INCLUDE_SHMEDIA
- movi_shori_putval (output_bfd,
+ install_plt_field (output_bfd, FALSE,
(sgot->output_section->vma
+ sgot->output_offset
+ got_offset),
- (splt->contents + h->plt.offset
- + elf_sh_plt_symbol_offset (info)));
-
- /* Set bottom bit because its for a branch to SHmedia */
- movi_shori_putval (output_bfd,
- (splt->output_section->vma + splt->output_offset)
- | 1,
- (splt->contents + h->plt.offset
- + elf_sh_plt_plt0_offset (info)));
-#else
- bfd_put_32 (output_bfd,
- (sgot->output_section->vma
- + sgot->output_offset
- + got_offset),
- (splt->contents + h->plt.offset
- + elf_sh_plt_symbol_offset (info)));
-
- bfd_put_32 (output_bfd,
- (splt->output_section->vma + splt->output_offset),
- (splt->contents + h->plt.offset
- + elf_sh_plt_plt0_offset (info)));
-#endif
- }
- else
- {
- if (elf_sh_pic_plt_entry == NULL)
+ (splt->contents
+ + h->plt.offset
+ + htab->plt_info->symbol_fields.got_entry));
+ if (htab->vxworks_p)
{
- elf_sh_pic_plt_entry = (bfd_big_endian (output_bfd) ?
- elf_sh_pic_plt_entry_be :
- elf_sh_pic_plt_entry_le);
+ unsigned int reachable_plts, plts_per_4k;
+ int distance;
+
+ /* Divide the PLT into groups. The first group contains
+ REACHABLE_PLTS entries and the other groups contain
+ PLTS_PER_4K entries. Entries in the first group can
+ branch directly to .plt; those in later groups branch
+ to the last element of the previous group. */
+ /* ??? It would be better to create multiple copies of
+ the common resolver stub. */
+ reachable_plts = ((4096
+ - htab->plt_info->plt0_entry_size
+ - (htab->plt_info->symbol_fields.plt + 4))
+ / htab->plt_info->symbol_entry_size) + 1;
+ plts_per_4k = (4096 / htab->plt_info->symbol_entry_size);
+ if (plt_index < reachable_plts)
+ distance = -(h->plt.offset
+ + htab->plt_info->symbol_fields.plt);
+ else
+ distance = -(((plt_index - reachable_plts) % plts_per_4k + 1)
+ * htab->plt_info->symbol_entry_size);
+
+ /* Install the 'bra' with this offset. */
+ bfd_put_16 (output_bfd,
+ 0xa000 | (0x0fff & ((distance - 4) / 2)),
+ (splt->contents
+ + h->plt.offset
+ + htab->plt_info->symbol_fields.plt));
}
- memcpy (splt->contents + h->plt.offset, elf_sh_pic_plt_entry,
- elf_sh_sizeof_plt (info));
-#ifdef INCLUDE_SHMEDIA
- movi_shori_putval (output_bfd, got_offset,
- (splt->contents + h->plt.offset
- + elf_sh_plt_symbol_offset (info)));
-#else
- bfd_put_32 (output_bfd, got_offset,
- (splt->contents + h->plt.offset
- + elf_sh_plt_symbol_offset (info)));
-#endif
+ else
+ install_plt_field (output_bfd, TRUE,
+ splt->output_section->vma + splt->output_offset,
+ (splt->contents
+ + h->plt.offset
+ + htab->plt_info->symbol_fields.plt));
}
#ifdef GOT_BIAS
@@ -6875,23 +5535,18 @@ sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info,
got_offset += GOT_BIAS;
#endif
-#ifdef INCLUDE_SHMEDIA
- movi_shori_putval (output_bfd,
+ install_plt_field (output_bfd, FALSE,
plt_index * sizeof (Elf32_External_Rela),
- (splt->contents + h->plt.offset
- + elf_sh_plt_reloc_offset (info)));
-#else
- bfd_put_32 (output_bfd, plt_index * sizeof (Elf32_External_Rela),
- (splt->contents + h->plt.offset
- + elf_sh_plt_reloc_offset (info)));
-#endif
+ (splt->contents
+ + h->plt.offset
+ + htab->plt_info->symbol_fields.reloc_offset));
/* Fill in the entry in the global offset table. */
bfd_put_32 (output_bfd,
(splt->output_section->vma
+ splt->output_offset
+ h->plt.offset
- + elf_sh_plt_temp_offset (info)),
+ + htab->plt_info->symbol_resolve_offset),
sgot->contents + got_offset);
/* Fill in the entry in the .rela.plt section. */
@@ -6906,6 +5561,34 @@ sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info,
loc = srel->contents + plt_index * sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloca_out (output_bfd, &rel, loc);
+ if (htab->vxworks_p && !info->shared)
+ {
+ /* Create the .rela.plt.unloaded relocations for this PLT entry.
+ Begin by pointing LOC to the first such relocation. */
+ loc = (htab->srelplt2->contents
+ + (plt_index * 2 + 1) * sizeof (Elf32_External_Rela));
+
+ /* Create a .rela.plt.unloaded R_SH_DIR32 relocation
+ for the PLT entry's pointer to the .got.plt entry. */
+ rel.r_offset = (htab->splt->output_section->vma
+ + htab->splt->output_offset
+ + h->plt.offset
+ + htab->plt_info->symbol_fields.got_entry);
+ rel.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_SH_DIR32);
+ rel.r_addend = got_offset;
+ bfd_elf32_swap_reloca_out (output_bfd, &rel, loc);
+ loc += sizeof (Elf32_External_Rela);
+
+ /* Create a .rela.plt.unloaded R_SH_DIR32 relocation for
+ the .got.plt entry, which initially points to .plt. */
+ rel.r_offset = (htab->sgotplt->output_section->vma
+ + htab->sgotplt->output_offset
+ + got_offset);
+ rel.r_info = ELF32_R_INFO (htab->root.hplt->indx, R_SH_DIR32);
+ rel.r_addend = 0;
+ bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
+ }
+
if (!h->def_regular)
{
/* Mark the symbol as undefined, rather than as defined in
@@ -7035,9 +5718,11 @@ sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info,
bfd_elf32_swap_reloca_out (output_bfd, &rel, loc);
}
- /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
+ /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. On VxWorks,
+ _GLOBAL_OFFSET_TABLE_ is not absolute: it is relative to the
+ ".got" section. */
if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || h == htab->root.hgot)
+ || (!htab->vxworks_p && h == htab->root.hgot))
sym->st_shndx = SHN_ABS;
return TRUE;
@@ -7144,42 +5829,59 @@ sh_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
/* Fill in the first entry in the procedure linkage table. */
splt = htab->splt;
- if (splt && splt->size > 0)
+ if (splt && splt->size > 0 && htab->plt_info->plt0_entry)
{
- if (info->shared)
+ unsigned int i;
+
+ memcpy (splt->contents,
+ htab->plt_info->plt0_entry,
+ htab->plt_info->plt0_entry_size);
+ for (i = 0; i < ARRAY_SIZE (htab->plt_info->plt0_got_fields); i++)
+ if (htab->plt_info->plt0_got_fields[i] != MINUS_ONE)
+ install_plt_field (output_bfd, FALSE,
+ (sgot->output_section->vma
+ + sgot->output_offset
+ + (i * 4)),
+ (splt->contents
+ + htab->plt_info->plt0_got_fields[i]));
+
+ if (htab->vxworks_p)
{
- if (elf_sh_pic_plt_entry == NULL)
- {
- elf_sh_pic_plt_entry = (bfd_big_endian (output_bfd) ?
- elf_sh_pic_plt_entry_be :
- elf_sh_pic_plt_entry_le);
- }
- memcpy (splt->contents, elf_sh_pic_plt_entry,
- elf_sh_sizeof_plt (info));
- }
- else
- {
- if (elf_sh_plt0_entry == NULL)
+ /* Finalize the .rela.plt.unloaded contents. */
+ Elf_Internal_Rela rel;
+ bfd_byte *loc;
+
+ /* Create a .rela.plt.unloaded R_SH_DIR32 relocation for the
+ first PLT entry's pointer to _GLOBAL_OFFSET_TABLE_ + 8. */
+ loc = htab->srelplt2->contents;
+ rel.r_offset = (splt->output_section->vma
+ + splt->output_offset
+ + htab->plt_info->plt0_got_fields[2]);
+ rel.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_SH_DIR32);
+ rel.r_addend = 8;
+ bfd_elf32_swap_reloca_out (output_bfd, &rel, loc);
+ loc += sizeof (Elf32_External_Rela);
+
+ /* Fix up the remaining .rela.plt.unloaded relocations.
+ They may have the wrong symbol index for _G_O_T_ or
+ _P_L_T_ depending on the order in which symbols were
+ output. */
+ while (loc < htab->srelplt2->contents + htab->srelplt2->size)
{
- elf_sh_plt0_entry = (bfd_big_endian (output_bfd) ?
- elf_sh_plt0_entry_be :
- elf_sh_plt0_entry_le);
+ /* The PLT entry's pointer to the .got.plt slot. */
+ bfd_elf32_swap_reloc_in (output_bfd, loc, &rel);
+ rel.r_info = ELF32_R_INFO (htab->root.hgot->indx,
+ R_SH_DIR32);
+ bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
+ loc += sizeof (Elf32_External_Rela);
+
+ /* The .got.plt slot's pointer to .plt. */
+ bfd_elf32_swap_reloc_in (output_bfd, loc, &rel);
+ rel.r_info = ELF32_R_INFO (htab->root.hplt->indx,
+ R_SH_DIR32);
+ bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
+ loc += sizeof (Elf32_External_Rela);
}
- memcpy (splt->contents, elf_sh_plt0_entry, PLT_ENTRY_SIZE);
-#ifdef INCLUDE_SHMEDIA
- movi_shori_putval (output_bfd,
- sgot->output_section->vma
- + sgot->output_offset,
- splt->contents
- + elf_sh_plt0_gotplt_offset (info));
-#else
- bfd_put_32 (output_bfd,
- sgot->output_section->vma + sgot->output_offset + 4,
- splt->contents + elf_sh_plt0_gotid_offset (info));
- bfd_put_32 (output_bfd,
- sgot->output_section->vma + sgot->output_offset + 8,
- splt->contents + elf_sh_plt0_linker_offset (info));
-#endif
}
/* UnixWare sets the entsize of .plt to 4, although that doesn't
@@ -7294,7 +5996,10 @@ static bfd_vma
sh_elf_plt_sym_val (bfd_vma i, const asection *plt,
const arelent *rel ATTRIBUTE_UNUSED)
{
- return plt->vma + (i + 1) * PLT_ENTRY_SIZE;
+ const struct elf_sh_plt_info *plt_info;
+
+ plt_info = get_plt_info (plt->owner, (plt->owner->flags & DYNAMIC) != 0);
+ return plt->vma + get_plt_offset (plt_info, i);
}
#if !defined SH_TARGET_ALREADY_DEFINED
@@ -7315,6 +6020,8 @@ sh_elf_plt_sym_val (bfd_vma i, const asection *plt,
#define elf_symbol_leading_char '_'
#define bfd_elf32_bfd_reloc_type_lookup sh_elf_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup \
+ sh_elf_reloc_name_lookup
#define elf_info_to_howto sh_elf_info_to_howto
#define bfd_elf32_bfd_relax_section sh_elf_relax_section
#define elf_backend_relocate_section sh_elf_relocate_section
@@ -7340,8 +6047,12 @@ sh_elf_plt_sym_val (bfd_vma i, const asection *plt,
sh_elf_link_hash_table_create
#define elf_backend_adjust_dynamic_symbol \
sh_elf_adjust_dynamic_symbol
+#define elf_backend_always_size_sections \
+ sh_elf_always_size_sections
#define elf_backend_size_dynamic_sections \
sh_elf_size_dynamic_sections
+#define elf_backend_omit_section_dynsym \
+ ((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) bfd_true)
#define elf_backend_finish_dynamic_symbol \
sh_elf_finish_dynamic_symbol
#define elf_backend_finish_dynamic_sections \
@@ -7371,6 +6082,7 @@ sh_elf_plt_sym_val (bfd_vma i, const asection *plt,
#define TARGET_LITTLE_NAME "elf32-shl-nbsd"
#undef ELF_MAXPAGESIZE
#define ELF_MAXPAGESIZE 0x10000
+#undef ELF_COMMONPAGESIZE
#undef elf_symbol_leading_char
#define elf_symbol_leading_char 0
#undef elf32_bed
@@ -7388,6 +6100,8 @@ sh_elf_plt_sym_val (bfd_vma i, const asection *plt,
#define TARGET_LITTLE_SYM bfd_elf32_shlin_vec
#undef TARGET_LITTLE_NAME
#define TARGET_LITTLE_NAME "elf32-sh-linux"
+#undef ELF_COMMONPAGESIZE
+#define ELF_COMMONPAGESIZE 0x1000
#undef elf_backend_grok_prstatus
#define elf_backend_grok_prstatus elf32_shlin_grok_prstatus
@@ -7398,4 +6112,38 @@ sh_elf_plt_sym_val (bfd_vma i, const asection *plt,
#include "elf32-target.h"
+#undef TARGET_BIG_SYM
+#define TARGET_BIG_SYM bfd_elf32_shvxworks_vec
+#undef TARGET_BIG_NAME
+#define TARGET_BIG_NAME "elf32-sh-vxworks"
+#undef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM bfd_elf32_shlvxworks_vec
+#undef TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME "elf32-shl-vxworks"
+#undef elf32_bed
+#define elf32_bed elf32_sh_vxworks_bed
+
+#undef elf_backend_want_plt_sym
+#define elf_backend_want_plt_sym 1
+#undef elf_symbol_leading_char
+#define elf_symbol_leading_char '_'
+#define elf_backend_want_got_underscore 1
+#undef elf_backend_grok_prstatus
+#undef elf_backend_grok_psinfo
+#undef elf_backend_add_symbol_hook
+#define elf_backend_add_symbol_hook elf_vxworks_add_symbol_hook
+#undef elf_backend_link_output_symbol_hook
+#define elf_backend_link_output_symbol_hook \
+ elf_vxworks_link_output_symbol_hook
+#undef elf_backend_emit_relocs
+#define elf_backend_emit_relocs elf_vxworks_emit_relocs
+#undef elf_backend_final_write_processing
+#define elf_backend_final_write_processing \
+ elf_vxworks_final_write_processing
+#undef ELF_MAXPAGESIZE
+#define ELF_MAXPAGESIZE 0x1000
+#undef ELF_COMMONPAGESIZE
+
+#include "elf32-target.h"
+
#endif /* neither INCLUDE_SHMEDIA nor SH_TARGET_ALREADY_DEFINED */
diff --git a/bfd/elf32-sh64-com.c b/bfd/elf32-sh64-com.c
index 1b6a8f5aad29..1a30e0d371b2 100644
--- a/bfd/elf32-sh64-com.c
+++ b/bfd/elf32-sh64-com.c
@@ -1,5 +1,6 @@
/* SuperH SH64-specific support for 32-bit ELF
- Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002, 2003, 2004, 2007
+ Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -19,8 +20,8 @@
#define SH64_ELF
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/sh.h"
diff --git a/bfd/elf32-sh64.c b/bfd/elf32-sh64.c
index afafcfde88d0..2f85098c0ff2 100644
--- a/bfd/elf32-sh64.c
+++ b/bfd/elf32-sh64.c
@@ -1,5 +1,5 @@
/* SuperH SH64-specific support for 32-bit ELF
- Copyright 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -20,8 +20,8 @@
#define SH64_ELF
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "elf-bfd.h"
#include "../opcodes/sh64-opc.h"
#include "elf32-sh64.h"
@@ -115,13 +115,16 @@ static void sh64_find_section_for_address
static bfd_boolean
sh64_elf_new_section_hook (bfd *abfd, asection *sec)
{
- struct _sh64_elf_section_data *sdata;
- bfd_size_type amt = sizeof (*sdata);
+ if (!sec->used_by_bfd)
+ {
+ struct _sh64_elf_section_data *sdata;
+ bfd_size_type amt = sizeof (*sdata);
- sdata = (struct _sh64_elf_section_data *) bfd_zalloc (abfd, amt);
- if (sdata == NULL)
- return FALSE;
- sec->used_by_bfd = sdata;
+ sdata = bfd_zalloc (abfd, amt);
+ if (sdata == NULL)
+ return FALSE;
+ sec->used_by_bfd = sdata;
+ }
return _bfd_elf_new_section_hook (abfd, sec);
}
@@ -739,9 +742,9 @@ static void
sh64_elf_merge_symbol_attribute (struct elf_link_hash_entry *h,
const Elf_Internal_Sym *isym,
bfd_boolean definition,
- bfd_boolean dynamic)
+ bfd_boolean dynamic ATTRIBUTE_UNUSED)
{
- if (isym->st_other != 0 && dynamic)
+ if ((isym->st_other & ~ELF_ST_VISIBILITY (-1)) != 0)
{
unsigned char other;
@@ -756,8 +759,8 @@ sh64_elf_merge_symbol_attribute (struct elf_link_hash_entry *h,
static const struct bfd_elf_special_section sh64_elf_special_sections[] =
{
- { ".cranges", 8, 0, SHT_PROGBITS, 0 },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".cranges"), 0, SHT_PROGBITS, 0 },
+ { NULL, 0, 0, 0, 0 }
};
#undef TARGET_BIG_SYM
@@ -782,6 +785,7 @@ static const struct bfd_elf_special_section sh64_elf_special_sections[] =
#define TARGET_LITTLE_NAME "elf32-sh64l-nbsd"
#undef ELF_MAXPAGESIZE
#define ELF_MAXPAGESIZE 0x10000
+#undef ELF_COMMONPAGESIZE
#undef elf_symbol_leading_char
#define elf_symbol_leading_char 0
#undef elf32_bed
@@ -800,6 +804,8 @@ static const struct bfd_elf_special_section sh64_elf_special_sections[] =
#define TARGET_LITTLE_NAME "elf32-sh64-linux"
#undef elf32_bed
#define elf32_bed elf32_sh64_lin_bed
+#undef ELF_COMMONPAGESIZE
+#define ELF_COMMONPAGESIZE 0x1000
#include "elf32-target.h"
diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c
index 3bfb38a3d44a..f8a3bff196d4 100644
--- a/bfd/elf32-sparc.c
+++ b/bfd/elf32-sparc.c
@@ -1,6 +1,6 @@
/* SPARC-specific support for 32-bit ELF
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -172,6 +172,7 @@ elf32_sparc_reloc_type_class (const Elf_Internal_Rela *rela)
#define ELF_MACHINE_CODE EM_SPARC
#define ELF_MACHINE_ALT1 EM_SPARC32PLUS
#define ELF_MAXPAGESIZE 0x10000
+#define ELF_COMMONPAGESIZE 0x2000
#define bfd_elf32_bfd_merge_private_bfd_data \
elf32_sparc_merge_private_bfd_data
@@ -182,6 +183,8 @@ elf32_sparc_reloc_type_class (const Elf_Internal_Rela *rela)
#define elf_info_to_howto _bfd_sparc_elf_info_to_howto
#define bfd_elf32_bfd_reloc_type_lookup _bfd_sparc_elf_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup \
+ _bfd_sparc_elf_reloc_name_lookup
#define bfd_elf32_bfd_link_hash_table_create \
_bfd_sparc_elf_link_hash_table_create
#define bfd_elf32_bfd_relax_section _bfd_sparc_elf_relax_section
@@ -206,6 +209,7 @@ elf32_sparc_reloc_type_class (const Elf_Internal_Rela *rela)
#define elf_backend_gc_mark_hook _bfd_sparc_elf_gc_mark_hook
#define elf_backend_gc_sweep_hook _bfd_sparc_elf_gc_sweep_hook
#define elf_backend_plt_sym_val _bfd_sparc_elf_plt_sym_val
+#define elf_backend_init_index_section _bfd_elf_init_1_index_section
#define elf_backend_can_gc_sections 1
#define elf_backend_can_refcount 1
diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c
new file mode 100644
index 000000000000..d652117e2992
--- /dev/null
+++ b/bfd/elf32-spu.c
@@ -0,0 +1,3154 @@
+/* SPU specific support for 32-bit ELF
+
+ Copyright 2006, 2007 Free Software Foundation, Inc.
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "bfdlink.h"
+#include "libbfd.h"
+#include "elf-bfd.h"
+#include "elf/spu.h"
+#include "elf32-spu.h"
+
+/* We use RELA style relocs. Don't define USE_REL. */
+
+static bfd_reloc_status_type spu_elf_rel9 (bfd *, arelent *, asymbol *,
+ void *, asection *,
+ bfd *, char **);
+
+/* Values of type 'enum elf_spu_reloc_type' are used to index this
+ array, so it must be declared in the order of that type. */
+
+static reloc_howto_type elf_howto_table[] = {
+ HOWTO (R_SPU_NONE, 0, 0, 0, FALSE, 0, complain_overflow_dont,
+ bfd_elf_generic_reloc, "SPU_NONE",
+ FALSE, 0, 0x00000000, FALSE),
+ HOWTO (R_SPU_ADDR10, 4, 2, 10, FALSE, 14, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "SPU_ADDR10",
+ FALSE, 0, 0x00ffc000, FALSE),
+ HOWTO (R_SPU_ADDR16, 2, 2, 16, FALSE, 7, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "SPU_ADDR16",
+ FALSE, 0, 0x007fff80, FALSE),
+ HOWTO (R_SPU_ADDR16_HI, 16, 2, 16, FALSE, 7, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "SPU_ADDR16_HI",
+ FALSE, 0, 0x007fff80, FALSE),
+ HOWTO (R_SPU_ADDR16_LO, 0, 2, 16, FALSE, 7, complain_overflow_dont,
+ bfd_elf_generic_reloc, "SPU_ADDR16_LO",
+ FALSE, 0, 0x007fff80, FALSE),
+ HOWTO (R_SPU_ADDR18, 0, 2, 18, FALSE, 7, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "SPU_ADDR18",
+ FALSE, 0, 0x01ffff80, FALSE),
+ HOWTO (R_SPU_ADDR32, 0, 2, 32, FALSE, 0, complain_overflow_dont,
+ bfd_elf_generic_reloc, "SPU_ADDR32",
+ FALSE, 0, 0xffffffff, FALSE),
+ HOWTO (R_SPU_REL16, 2, 2, 16, TRUE, 7, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "SPU_REL16",
+ FALSE, 0, 0x007fff80, TRUE),
+ HOWTO (R_SPU_ADDR7, 0, 2, 7, FALSE, 14, complain_overflow_dont,
+ bfd_elf_generic_reloc, "SPU_ADDR7",
+ FALSE, 0, 0x001fc000, FALSE),
+ HOWTO (R_SPU_REL9, 2, 2, 9, TRUE, 0, complain_overflow_signed,
+ spu_elf_rel9, "SPU_REL9",
+ FALSE, 0, 0x0180007f, TRUE),
+ HOWTO (R_SPU_REL9I, 2, 2, 9, TRUE, 0, complain_overflow_signed,
+ spu_elf_rel9, "SPU_REL9I",
+ FALSE, 0, 0x0000c07f, TRUE),
+ HOWTO (R_SPU_ADDR10I, 0, 2, 10, FALSE, 14, complain_overflow_signed,
+ bfd_elf_generic_reloc, "SPU_ADDR10I",
+ FALSE, 0, 0x00ffc000, FALSE),
+ HOWTO (R_SPU_ADDR16I, 0, 2, 16, FALSE, 7, complain_overflow_signed,
+ bfd_elf_generic_reloc, "SPU_ADDR16I",
+ FALSE, 0, 0x007fff80, FALSE),
+ HOWTO (R_SPU_REL32, 0, 2, 32, TRUE, 0, complain_overflow_dont,
+ bfd_elf_generic_reloc, "SPU_REL32",
+ FALSE, 0, 0xffffffff, TRUE),
+ HOWTO (R_SPU_ADDR16X, 0, 2, 16, FALSE, 7, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "SPU_ADDR16X",
+ FALSE, 0, 0x007fff80, FALSE),
+ HOWTO (R_SPU_PPU32, 0, 2, 32, FALSE, 0, complain_overflow_dont,
+ bfd_elf_generic_reloc, "SPU_PPU32",
+ FALSE, 0, 0xffffffff, FALSE),
+ HOWTO (R_SPU_PPU64, 0, 4, 64, FALSE, 0, complain_overflow_dont,
+ bfd_elf_generic_reloc, "SPU_PPU64",
+ FALSE, 0, -1, FALSE),
+};
+
+static struct bfd_elf_special_section const spu_elf_special_sections[] = {
+ { ".toe", 4, 0, SHT_NOBITS, SHF_ALLOC },
+ { NULL, 0, 0, 0, 0 }
+};
+
+static enum elf_spu_reloc_type
+spu_elf_bfd_to_reloc_type (bfd_reloc_code_real_type code)
+{
+ switch (code)
+ {
+ default:
+ return R_SPU_NONE;
+ case BFD_RELOC_SPU_IMM10W:
+ return R_SPU_ADDR10;
+ case BFD_RELOC_SPU_IMM16W:
+ return R_SPU_ADDR16;
+ case BFD_RELOC_SPU_LO16:
+ return R_SPU_ADDR16_LO;
+ case BFD_RELOC_SPU_HI16:
+ return R_SPU_ADDR16_HI;
+ case BFD_RELOC_SPU_IMM18:
+ return R_SPU_ADDR18;
+ case BFD_RELOC_SPU_PCREL16:
+ return R_SPU_REL16;
+ case BFD_RELOC_SPU_IMM7:
+ return R_SPU_ADDR7;
+ case BFD_RELOC_SPU_IMM8:
+ return R_SPU_NONE;
+ case BFD_RELOC_SPU_PCREL9a:
+ return R_SPU_REL9;
+ case BFD_RELOC_SPU_PCREL9b:
+ return R_SPU_REL9I;
+ case BFD_RELOC_SPU_IMM10:
+ return R_SPU_ADDR10I;
+ case BFD_RELOC_SPU_IMM16:
+ return R_SPU_ADDR16I;
+ case BFD_RELOC_32:
+ return R_SPU_ADDR32;
+ case BFD_RELOC_32_PCREL:
+ return R_SPU_REL32;
+ case BFD_RELOC_SPU_PPU32:
+ return R_SPU_PPU32;
+ case BFD_RELOC_SPU_PPU64:
+ return R_SPU_PPU64;
+ }
+}
+
+static void
+spu_elf_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
+ arelent *cache_ptr,
+ Elf_Internal_Rela *dst)
+{
+ enum elf_spu_reloc_type r_type;
+
+ r_type = (enum elf_spu_reloc_type) ELF32_R_TYPE (dst->r_info);
+ BFD_ASSERT (r_type < R_SPU_max);
+ cache_ptr->howto = &elf_howto_table[(int) r_type];
+}
+
+static reloc_howto_type *
+spu_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_reloc_code_real_type code)
+{
+ enum elf_spu_reloc_type r_type = spu_elf_bfd_to_reloc_type (code);
+
+ if (r_type == R_SPU_NONE)
+ return NULL;
+
+ return elf_howto_table + r_type;
+}
+
+static reloc_howto_type *
+spu_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0; i < sizeof (elf_howto_table) / sizeof (elf_howto_table[0]); i++)
+ if (elf_howto_table[i].name != NULL
+ && strcasecmp (elf_howto_table[i].name, r_name) == 0)
+ return &elf_howto_table[i];
+
+ return NULL;
+}
+
+/* Apply R_SPU_REL9 and R_SPU_REL9I relocs. */
+
+static bfd_reloc_status_type
+spu_elf_rel9 (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
+ void *data, asection *input_section,
+ bfd *output_bfd, char **error_message)
+{
+ bfd_size_type octets;
+ bfd_vma val;
+ long insn;
+
+ /* If this is a relocatable link (output_bfd test tells us), just
+ call the generic function. Any adjustment will be done at final
+ link time. */
+ if (output_bfd != NULL)
+ return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
+ input_section, output_bfd, error_message);
+
+ if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
+ return bfd_reloc_outofrange;
+ octets = reloc_entry->address * bfd_octets_per_byte (abfd);
+
+ /* Get symbol value. */
+ val = 0;
+ if (!bfd_is_com_section (symbol->section))
+ val = symbol->value;
+ if (symbol->section->output_section)
+ val += symbol->section->output_section->vma;
+
+ val += reloc_entry->addend;
+
+ /* Make it pc-relative. */
+ val -= input_section->output_section->vma + input_section->output_offset;
+
+ val >>= 2;
+ if (val + 256 >= 512)
+ return bfd_reloc_overflow;
+
+ insn = bfd_get_32 (abfd, (bfd_byte *) data + octets);
+
+ /* Move two high bits of value to REL9I and REL9 position.
+ The mask will take care of selecting the right field. */
+ val = (val & 0x7f) | ((val & 0x180) << 7) | ((val & 0x180) << 16);
+ insn &= ~reloc_entry->howto->dst_mask;
+ insn |= val & reloc_entry->howto->dst_mask;
+ bfd_put_32 (abfd, insn, (bfd_byte *) data + octets);
+ return bfd_reloc_ok;
+}
+
+static bfd_boolean
+spu_elf_new_section_hook (bfd *abfd, asection *sec)
+{
+ if (!sec->used_by_bfd)
+ {
+ struct _spu_elf_section_data *sdata;
+
+ sdata = bfd_zalloc (abfd, sizeof (*sdata));
+ if (sdata == NULL)
+ return FALSE;
+ sec->used_by_bfd = sdata;
+ }
+
+ return _bfd_elf_new_section_hook (abfd, sec);
+}
+
+/* Specially mark defined symbols named _EAR_* with BSF_KEEP so that
+ strip --strip-unneeded will not remove them. */
+
+static void
+spu_elf_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED, asymbol *sym)
+{
+ if (sym->name != NULL
+ && sym->section != bfd_abs_section_ptr
+ && strncmp (sym->name, "_EAR_", 5) == 0)
+ sym->flags |= BSF_KEEP;
+}
+
+/* SPU ELF linker hash table. */
+
+struct spu_link_hash_table
+{
+ struct elf_link_hash_table elf;
+
+ /* The stub hash table. */
+ struct bfd_hash_table stub_hash_table;
+
+ /* Shortcuts to overlay sections. */
+ asection *stub;
+ asection *ovtab;
+
+ struct elf_link_hash_entry *ovly_load;
+
+ /* An array of two output sections per overlay region, chosen such that
+ the first section vma is the overlay buffer vma (ie. the section has
+ the lowest vma in the group that occupy the region), and the second
+ section vma+size specifies the end of the region. We keep pointers
+ to sections like this because section vmas may change when laying
+ them out. */
+ asection **ovl_region;
+
+ /* Number of overlay buffers. */
+ unsigned int num_buf;
+
+ /* Total number of overlays. */
+ unsigned int num_overlays;
+
+ /* Set if we should emit symbols for stubs. */
+ unsigned int emit_stub_syms:1;
+
+ /* Set if we want stubs on calls out of overlay regions to
+ non-overlay regions. */
+ unsigned int non_overlay_stubs : 1;
+
+ /* Set on error. */
+ unsigned int stub_overflow : 1;
+
+ /* Set if stack size analysis should be done. */
+ unsigned int stack_analysis : 1;
+
+ /* Set if __stack_* syms will be emitted. */
+ unsigned int emit_stack_syms : 1;
+};
+
+#define spu_hash_table(p) \
+ ((struct spu_link_hash_table *) ((p)->hash))
+
+struct spu_stub_hash_entry
+{
+ struct bfd_hash_entry root;
+
+ /* Destination of this stub. */
+ asection *target_section;
+ bfd_vma target_off;
+
+ /* Offset of entry in stub section. */
+ bfd_vma off;
+
+ /* Offset from this stub to stub that loads the overlay index. */
+ bfd_vma delta;
+};
+
+/* Create an entry in a spu stub hash table. */
+
+static struct bfd_hash_entry *
+stub_hash_newfunc (struct bfd_hash_entry *entry,
+ struct bfd_hash_table *table,
+ const char *string)
+{
+ /* Allocate the structure if it has not already been allocated by a
+ subclass. */
+ if (entry == NULL)
+ {
+ entry = bfd_hash_allocate (table, sizeof (struct spu_stub_hash_entry));
+ if (entry == NULL)
+ return entry;
+ }
+
+ /* Call the allocation method of the superclass. */
+ entry = bfd_hash_newfunc (entry, table, string);
+ if (entry != NULL)
+ {
+ struct spu_stub_hash_entry *sh = (struct spu_stub_hash_entry *) entry;
+
+ sh->target_section = NULL;
+ sh->target_off = 0;
+ sh->off = 0;
+ sh->delta = 0;
+ }
+
+ return entry;
+}
+
+/* Create a spu ELF linker hash table. */
+
+static struct bfd_link_hash_table *
+spu_elf_link_hash_table_create (bfd *abfd)
+{
+ struct spu_link_hash_table *htab;
+
+ htab = bfd_malloc (sizeof (*htab));
+ if (htab == NULL)
+ return NULL;
+
+ if (!_bfd_elf_link_hash_table_init (&htab->elf, abfd,
+ _bfd_elf_link_hash_newfunc,
+ sizeof (struct elf_link_hash_entry)))
+ {
+ free (htab);
+ return NULL;
+ }
+
+ /* Init the stub hash table too. */
+ if (!bfd_hash_table_init (&htab->stub_hash_table, stub_hash_newfunc,
+ sizeof (struct spu_stub_hash_entry)))
+ return NULL;
+
+ memset (&htab->stub, 0,
+ sizeof (*htab) - offsetof (struct spu_link_hash_table, stub));
+
+ return &htab->elf.root;
+}
+
+/* Free the derived linker hash table. */
+
+static void
+spu_elf_link_hash_table_free (struct bfd_link_hash_table *hash)
+{
+ struct spu_link_hash_table *ret = (struct spu_link_hash_table *) hash;
+
+ bfd_hash_table_free (&ret->stub_hash_table);
+ _bfd_generic_link_hash_table_free (hash);
+}
+
+/* Find the symbol for the given R_SYMNDX in IBFD and set *HP and *SYMP
+ to (hash, NULL) for global symbols, and (NULL, sym) for locals. Set
+ *SYMSECP to the symbol's section. *LOCSYMSP caches local syms. */
+
+static bfd_boolean
+get_sym_h (struct elf_link_hash_entry **hp,
+ Elf_Internal_Sym **symp,
+ asection **symsecp,
+ Elf_Internal_Sym **locsymsp,
+ unsigned long r_symndx,
+ bfd *ibfd)
+{
+ Elf_Internal_Shdr *symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
+
+ if (r_symndx >= symtab_hdr->sh_info)
+ {
+ struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (ibfd);
+ struct elf_link_hash_entry *h;
+
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ if (hp != NULL)
+ *hp = h;
+
+ if (symp != NULL)
+ *symp = NULL;
+
+ if (symsecp != NULL)
+ {
+ asection *symsec = NULL;
+ if (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ symsec = h->root.u.def.section;
+ *symsecp = symsec;
+ }
+ }
+ else
+ {
+ Elf_Internal_Sym *sym;
+ Elf_Internal_Sym *locsyms = *locsymsp;
+
+ if (locsyms == NULL)
+ {
+ locsyms = (Elf_Internal_Sym *) symtab_hdr->contents;
+ if (locsyms == NULL)
+ {
+ size_t symcount = symtab_hdr->sh_info;
+
+ /* If we are reading symbols into the contents, then
+ read the global syms too. This is done to cache
+ syms for later stack analysis. */
+ if ((unsigned char **) locsymsp == &symtab_hdr->contents)
+ symcount = symtab_hdr->sh_size / symtab_hdr->sh_entsize;
+ locsyms = bfd_elf_get_elf_syms (ibfd, symtab_hdr, symcount, 0,
+ NULL, NULL, NULL);
+ }
+ if (locsyms == NULL)
+ return FALSE;
+ *locsymsp = locsyms;
+ }
+ sym = locsyms + r_symndx;
+
+ if (hp != NULL)
+ *hp = NULL;
+
+ if (symp != NULL)
+ *symp = sym;
+
+ if (symsecp != NULL)
+ {
+ asection *symsec = NULL;
+ if ((sym->st_shndx != SHN_UNDEF
+ && sym->st_shndx < SHN_LORESERVE)
+ || sym->st_shndx > SHN_HIRESERVE)
+ symsec = bfd_section_from_elf_index (ibfd, sym->st_shndx);
+ *symsecp = symsec;
+ }
+ }
+
+ return TRUE;
+}
+
+/* Build a name for an entry in the stub hash table. We can't use a
+ local symbol name because ld -r might generate duplicate local symbols. */
+
+static char *
+spu_stub_name (const asection *sym_sec,
+ const struct elf_link_hash_entry *h,
+ const Elf_Internal_Rela *rel)
+{
+ char *stub_name;
+ bfd_size_type len;
+
+ if (h)
+ {
+ len = strlen (h->root.root.string) + 1 + 8 + 1;
+ stub_name = bfd_malloc (len);
+ if (stub_name == NULL)
+ return stub_name;
+
+ sprintf (stub_name, "%s+%x",
+ h->root.root.string,
+ (int) rel->r_addend & 0xffffffff);
+ len -= 8;
+ }
+ else
+ {
+ len = 8 + 1 + 8 + 1 + 8 + 1;
+ stub_name = bfd_malloc (len);
+ if (stub_name == NULL)
+ return stub_name;
+
+ sprintf (stub_name, "%x:%x+%x",
+ sym_sec->id & 0xffffffff,
+ (int) ELF32_R_SYM (rel->r_info) & 0xffffffff,
+ (int) rel->r_addend & 0xffffffff);
+ len = strlen (stub_name);
+ }
+
+ if (stub_name[len - 2] == '+'
+ && stub_name[len - 1] == '0'
+ && stub_name[len] == 0)
+ stub_name[len - 2] = 0;
+
+ return stub_name;
+}
+
+/* Create the note section if not already present. This is done early so
+ that the linker maps the sections to the right place in the output. */
+
+bfd_boolean
+spu_elf_create_sections (bfd *output_bfd,
+ struct bfd_link_info *info,
+ int stack_analysis,
+ int emit_stack_syms)
+{
+ bfd *ibfd;
+ struct spu_link_hash_table *htab = spu_hash_table (info);
+
+ /* Stash some options away where we can get at them later. */
+ htab->stack_analysis = stack_analysis;
+ htab->emit_stack_syms = emit_stack_syms;
+
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ if (bfd_get_section_by_name (ibfd, SPU_PTNOTE_SPUNAME) != NULL)
+ break;
+
+ if (ibfd == NULL)
+ {
+ /* Make SPU_PTNOTE_SPUNAME section. */
+ asection *s;
+ size_t name_len;
+ size_t size;
+ bfd_byte *data;
+ flagword flags;
+
+ ibfd = info->input_bfds;
+ flags = SEC_LOAD | SEC_READONLY | SEC_HAS_CONTENTS | SEC_IN_MEMORY;
+ s = bfd_make_section_anyway_with_flags (ibfd, SPU_PTNOTE_SPUNAME, flags);
+ if (s == NULL
+ || !bfd_set_section_alignment (ibfd, s, 4))
+ return FALSE;
+
+ name_len = strlen (bfd_get_filename (output_bfd)) + 1;
+ size = 12 + ((sizeof (SPU_PLUGIN_NAME) + 3) & -4);
+ size += (name_len + 3) & -4;
+
+ if (!bfd_set_section_size (ibfd, s, size))
+ return FALSE;
+
+ data = bfd_zalloc (ibfd, size);
+ if (data == NULL)
+ return FALSE;
+
+ bfd_put_32 (ibfd, sizeof (SPU_PLUGIN_NAME), data + 0);
+ bfd_put_32 (ibfd, name_len, data + 4);
+ bfd_put_32 (ibfd, 1, data + 8);
+ memcpy (data + 12, SPU_PLUGIN_NAME, sizeof (SPU_PLUGIN_NAME));
+ memcpy (data + 12 + ((sizeof (SPU_PLUGIN_NAME) + 3) & -4),
+ bfd_get_filename (output_bfd), name_len);
+ s->contents = data;
+ }
+
+ return TRUE;
+}
+
+/* qsort predicate to sort sections by vma. */
+
+static int
+sort_sections (const void *a, const void *b)
+{
+ const asection *const *s1 = a;
+ const asection *const *s2 = b;
+ bfd_signed_vma delta = (*s1)->vma - (*s2)->vma;
+
+ if (delta != 0)
+ return delta < 0 ? -1 : 1;
+
+ return (*s1)->index - (*s2)->index;
+}
+
+/* Identify overlays in the output bfd, and number them. */
+
+bfd_boolean
+spu_elf_find_overlays (bfd *output_bfd, struct bfd_link_info *info)
+{
+ struct spu_link_hash_table *htab = spu_hash_table (info);
+ asection **alloc_sec;
+ unsigned int i, n, ovl_index, num_buf;
+ asection *s;
+ bfd_vma ovl_end;
+
+ if (output_bfd->section_count < 2)
+ return FALSE;
+
+ alloc_sec = bfd_malloc (output_bfd->section_count * sizeof (*alloc_sec));
+ if (alloc_sec == NULL)
+ return FALSE;
+
+ /* Pick out all the alloced sections. */
+ for (n = 0, s = output_bfd->sections; s != NULL; s = s->next)
+ if ((s->flags & SEC_ALLOC) != 0
+ && (s->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) != SEC_THREAD_LOCAL
+ && s->size != 0)
+ alloc_sec[n++] = s;
+
+ if (n == 0)
+ {
+ free (alloc_sec);
+ return FALSE;
+ }
+
+ /* Sort them by vma. */
+ qsort (alloc_sec, n, sizeof (*alloc_sec), sort_sections);
+
+ /* Look for overlapping vmas. Any with overlap must be overlays.
+ Count them. Also count the number of overlay regions and for
+ each region save a section from that region with the lowest vma
+ and another section with the highest end vma. */
+ ovl_end = alloc_sec[0]->vma + alloc_sec[0]->size;
+ for (ovl_index = 0, num_buf = 0, i = 1; i < n; i++)
+ {
+ s = alloc_sec[i];
+ if (s->vma < ovl_end)
+ {
+ asection *s0 = alloc_sec[i - 1];
+
+ if (spu_elf_section_data (s0)->ovl_index == 0)
+ {
+ spu_elf_section_data (s0)->ovl_index = ++ovl_index;
+ alloc_sec[num_buf * 2] = s0;
+ alloc_sec[num_buf * 2 + 1] = s0;
+ num_buf++;
+ }
+ spu_elf_section_data (s)->ovl_index = ++ovl_index;
+ if (ovl_end < s->vma + s->size)
+ {
+ ovl_end = s->vma + s->size;
+ alloc_sec[num_buf * 2 - 1] = s;
+ }
+ }
+ else
+ ovl_end = s->vma + s->size;
+ }
+
+ htab->num_overlays = ovl_index;
+ htab->num_buf = num_buf;
+ if (ovl_index == 0)
+ {
+ free (alloc_sec);
+ return FALSE;
+ }
+
+ alloc_sec = bfd_realloc (alloc_sec, num_buf * 2 * sizeof (*alloc_sec));
+ if (alloc_sec == NULL)
+ return FALSE;
+
+ htab->ovl_region = alloc_sec;
+ return TRUE;
+}
+
+/* One of these per stub. */
+#define SIZEOF_STUB1 8
+#define ILA_79 0x4200004f /* ila $79,function_address */
+#define BR 0x32000000 /* br stub2 */
+
+/* One of these per overlay. */
+#define SIZEOF_STUB2 8
+#define ILA_78 0x4200004e /* ila $78,overlay_number */
+ /* br __ovly_load */
+#define NOP 0x40200000
+
+/* Return true for all relative and absolute branch instructions.
+ bra 00110000 0..
+ brasl 00110001 0..
+ br 00110010 0..
+ brsl 00110011 0..
+ brz 00100000 0..
+ brnz 00100001 0..
+ brhz 00100010 0..
+ brhnz 00100011 0.. */
+
+static bfd_boolean
+is_branch (const unsigned char *insn)
+{
+ return (insn[0] & 0xec) == 0x20 && (insn[1] & 0x80) == 0;
+}
+
+/* Return true for branch hint instructions.
+ hbra 0001000..
+ hbrr 0001001.. */
+
+static bfd_boolean
+is_hint (const unsigned char *insn)
+{
+ return (insn[0] & 0xfc) == 0x10;
+}
+
+/* Return TRUE if this reloc symbol should possibly go via an overlay stub. */
+
+static bfd_boolean
+needs_ovl_stub (const char *sym_name,
+ asection *sym_sec,
+ asection *input_section,
+ struct spu_link_hash_table *htab,
+ bfd_boolean is_branch)
+{
+ if (htab->num_overlays == 0)
+ return FALSE;
+
+ if (sym_sec == NULL
+ || sym_sec->output_section == NULL
+ || spu_elf_section_data (sym_sec->output_section) == NULL)
+ return FALSE;
+
+ /* setjmp always goes via an overlay stub, because then the return
+ and hence the longjmp goes via __ovly_return. That magically
+ makes setjmp/longjmp between overlays work. */
+ if (strncmp (sym_name, "setjmp", 6) == 0
+ && (sym_name[6] == '\0' || sym_name[6] == '@'))
+ return TRUE;
+
+ /* Usually, symbols in non-overlay sections don't need stubs. */
+ if (spu_elf_section_data (sym_sec->output_section)->ovl_index == 0
+ && !htab->non_overlay_stubs)
+ return FALSE;
+
+ /* A reference from some other section to a symbol in an overlay
+ section needs a stub. */
+ if (spu_elf_section_data (sym_sec->output_section)->ovl_index
+ != spu_elf_section_data (input_section->output_section)->ovl_index)
+ return TRUE;
+
+ /* If this insn isn't a branch then we are possibly taking the
+ address of a function and passing it out somehow. */
+ return !is_branch;
+}
+
+struct stubarr {
+ struct bfd_hash_table *stub_hash_table;
+ struct spu_stub_hash_entry **sh;
+ unsigned int count;
+ int err;
+};
+
+/* Called via elf_link_hash_traverse to allocate stubs for any _SPUEAR_
+ symbols. */
+
+static bfd_boolean
+allocate_spuear_stubs (struct elf_link_hash_entry *h, void *inf)
+{
+ /* Symbols starting with _SPUEAR_ need a stub because they may be
+ invoked by the PPU. */
+ if ((h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && h->def_regular
+ && strncmp (h->root.root.string, "_SPUEAR_", 8) == 0)
+ {
+ struct stubarr *stubs = inf;
+ static Elf_Internal_Rela zero_rel;
+ char *stub_name = spu_stub_name (h->root.u.def.section, h, &zero_rel);
+ struct spu_stub_hash_entry *sh;
+
+ if (stub_name == NULL)
+ {
+ stubs->err = 1;
+ return FALSE;
+ }
+
+ sh = (struct spu_stub_hash_entry *)
+ bfd_hash_lookup (stubs->stub_hash_table, stub_name, TRUE, FALSE);
+ if (sh == NULL)
+ {
+ free (stub_name);
+ return FALSE;
+ }
+
+ /* If this entry isn't new, we already have a stub. */
+ if (sh->target_section != NULL)
+ {
+ free (stub_name);
+ return TRUE;
+ }
+
+ sh->target_section = h->root.u.def.section;
+ sh->target_off = h->root.u.def.value;
+ stubs->count += 1;
+ }
+
+ return TRUE;
+}
+
+/* Called via bfd_hash_traverse to set up pointers to all symbols
+ in the stub hash table. */
+
+static bfd_boolean
+populate_stubs (struct bfd_hash_entry *bh, void *inf)
+{
+ struct stubarr *stubs = inf;
+
+ stubs->sh[--stubs->count] = (struct spu_stub_hash_entry *) bh;
+ return TRUE;
+}
+
+/* qsort predicate to sort stubs by overlay number. */
+
+static int
+sort_stubs (const void *a, const void *b)
+{
+ const struct spu_stub_hash_entry *const *sa = a;
+ const struct spu_stub_hash_entry *const *sb = b;
+ int i;
+ bfd_signed_vma d;
+
+ i = spu_elf_section_data ((*sa)->target_section->output_section)->ovl_index;
+ i -= spu_elf_section_data ((*sb)->target_section->output_section)->ovl_index;
+ if (i != 0)
+ return i;
+
+ d = ((*sa)->target_section->output_section->vma
+ + (*sa)->target_section->output_offset
+ + (*sa)->target_off
+ - (*sb)->target_section->output_section->vma
+ - (*sb)->target_section->output_offset
+ - (*sb)->target_off);
+ if (d != 0)
+ return d < 0 ? -1 : 1;
+
+ /* Two functions at the same address. Aliases perhaps. */
+ i = strcmp ((*sb)->root.string, (*sa)->root.string);
+ BFD_ASSERT (i != 0);
+ return i;
+}
+
+/* Allocate space for overlay call and return stubs. */
+
+bfd_boolean
+spu_elf_size_stubs (bfd *output_bfd,
+ struct bfd_link_info *info,
+ int non_overlay_stubs,
+ int stack_analysis,
+ asection **stub,
+ asection **ovtab,
+ asection **toe)
+{
+ struct spu_link_hash_table *htab = spu_hash_table (info);
+ bfd *ibfd;
+ struct stubarr stubs;
+ unsigned i, group;
+ flagword flags;
+
+ htab->non_overlay_stubs = non_overlay_stubs;
+ stubs.stub_hash_table = &htab->stub_hash_table;
+ stubs.count = 0;
+ stubs.err = 0;
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ {
+ extern const bfd_target bfd_elf32_spu_vec;
+ Elf_Internal_Shdr *symtab_hdr;
+ asection *section;
+ Elf_Internal_Sym *local_syms = NULL;
+ void *psyms;
+
+ if (ibfd->xvec != &bfd_elf32_spu_vec)
+ continue;
+
+ /* We'll need the symbol table in a second. */
+ symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
+ if (symtab_hdr->sh_info == 0)
+ continue;
+
+ /* Arrange to read and keep global syms for later stack analysis. */
+ psyms = &local_syms;
+ if (stack_analysis)
+ psyms = &symtab_hdr->contents;
+
+ /* Walk over each section attached to the input bfd. */
+ for (section = ibfd->sections; section != NULL; section = section->next)
+ {
+ Elf_Internal_Rela *internal_relocs, *irelaend, *irela;
+
+ /* If there aren't any relocs, then there's nothing more to do. */
+ if ((section->flags & SEC_RELOC) == 0
+ || (section->flags & SEC_ALLOC) == 0
+ || (section->flags & SEC_LOAD) == 0
+ || section->reloc_count == 0)
+ continue;
+
+ /* If this section is a link-once section that will be
+ discarded, then don't create any stubs. */
+ if (section->output_section == NULL
+ || section->output_section->owner != output_bfd)
+ continue;
+
+ /* Get the relocs. */
+ internal_relocs
+ = _bfd_elf_link_read_relocs (ibfd, section, NULL, NULL,
+ info->keep_memory);
+ if (internal_relocs == NULL)
+ goto error_ret_free_local;
+
+ /* Now examine each relocation. */
+ irela = internal_relocs;
+ irelaend = irela + section->reloc_count;
+ for (; irela < irelaend; irela++)
+ {
+ enum elf_spu_reloc_type r_type;
+ unsigned int r_indx;
+ asection *sym_sec;
+ Elf_Internal_Sym *sym;
+ struct elf_link_hash_entry *h;
+ const char *sym_name;
+ char *stub_name;
+ struct spu_stub_hash_entry *sh;
+ unsigned int sym_type;
+ enum _insn_type { non_branch, branch, call } insn_type;
+
+ r_type = ELF32_R_TYPE (irela->r_info);
+ r_indx = ELF32_R_SYM (irela->r_info);
+
+ if (r_type >= R_SPU_max)
+ {
+ bfd_set_error (bfd_error_bad_value);
+ goto error_ret_free_internal;
+ }
+
+ /* Determine the reloc target section. */
+ if (!get_sym_h (&h, &sym, &sym_sec, psyms, r_indx, ibfd))
+ goto error_ret_free_internal;
+
+ if (sym_sec == NULL
+ || sym_sec->output_section == NULL
+ || sym_sec->output_section->owner != output_bfd)
+ continue;
+
+ /* Ensure no stubs for user supplied overlay manager syms. */
+ if (h != NULL
+ && (strcmp (h->root.root.string, "__ovly_load") == 0
+ || strcmp (h->root.root.string, "__ovly_return") == 0))
+ continue;
+
+ insn_type = non_branch;
+ if (r_type == R_SPU_REL16
+ || r_type == R_SPU_ADDR16)
+ {
+ unsigned char insn[4];
+
+ if (!bfd_get_section_contents (ibfd, section, insn,
+ irela->r_offset, 4))
+ goto error_ret_free_internal;
+
+ if (is_branch (insn) || is_hint (insn))
+ {
+ insn_type = branch;
+ if ((insn[0] & 0xfd) == 0x31)
+ insn_type = call;
+ }
+ }
+
+ /* We are only interested in function symbols. */
+ if (h != NULL)
+ {
+ sym_type = h->type;
+ sym_name = h->root.root.string;
+ }
+ else
+ {
+ sym_type = ELF_ST_TYPE (sym->st_info);
+ sym_name = bfd_elf_sym_name (sym_sec->owner,
+ symtab_hdr,
+ sym,
+ sym_sec);
+ }
+ if (sym_type != STT_FUNC)
+ {
+ /* It's common for people to write assembly and forget
+ to give function symbols the right type. Handle
+ calls to such symbols, but warn so that (hopefully)
+ people will fix their code. We need the symbol
+ type to be correct to distinguish function pointer
+ initialisation from other pointer initialisation. */
+ if (insn_type == call)
+ (*_bfd_error_handler) (_("warning: call to non-function"
+ " symbol %s defined in %B"),
+ sym_sec->owner, sym_name);
+ else
+ continue;
+ }
+
+ if (!needs_ovl_stub (sym_name, sym_sec, section, htab,
+ insn_type != non_branch))
+ continue;
+
+ stub_name = spu_stub_name (sym_sec, h, irela);
+ if (stub_name == NULL)
+ goto error_ret_free_internal;
+
+ sh = (struct spu_stub_hash_entry *)
+ bfd_hash_lookup (&htab->stub_hash_table, stub_name,
+ TRUE, FALSE);
+ if (sh == NULL)
+ {
+ free (stub_name);
+ error_ret_free_internal:
+ if (elf_section_data (section)->relocs != internal_relocs)
+ free (internal_relocs);
+ error_ret_free_local:
+ if (local_syms != NULL
+ && (symtab_hdr->contents
+ != (unsigned char *) local_syms))
+ free (local_syms);
+ return FALSE;
+ }
+
+ /* If this entry isn't new, we already have a stub. */
+ if (sh->target_section != NULL)
+ {
+ free (stub_name);
+ continue;
+ }
+
+ sh->target_section = sym_sec;
+ if (h != NULL)
+ sh->target_off = h->root.u.def.value;
+ else
+ sh->target_off = sym->st_value;
+ sh->target_off += irela->r_addend;
+
+ stubs.count += 1;
+ }
+
+ /* We're done with the internal relocs, free them. */
+ if (elf_section_data (section)->relocs != internal_relocs)
+ free (internal_relocs);
+ }
+
+ if (local_syms != NULL
+ && symtab_hdr->contents != (unsigned char *) local_syms)
+ {
+ if (!info->keep_memory)
+ free (local_syms);
+ else
+ symtab_hdr->contents = (unsigned char *) local_syms;
+ }
+ }
+
+ elf_link_hash_traverse (&htab->elf, allocate_spuear_stubs, &stubs);
+ if (stubs.err)
+ return FALSE;
+
+ *stub = NULL;
+ if (stubs.count == 0)
+ return TRUE;
+
+ ibfd = info->input_bfds;
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_READONLY
+ | SEC_HAS_CONTENTS | SEC_IN_MEMORY);
+ htab->stub = bfd_make_section_anyway_with_flags (ibfd, ".stub", flags);
+ *stub = htab->stub;
+ if (htab->stub == NULL
+ || !bfd_set_section_alignment (ibfd, htab->stub, 2))
+ return FALSE;
+
+ flags = (SEC_ALLOC | SEC_LOAD
+ | SEC_HAS_CONTENTS | SEC_IN_MEMORY);
+ htab->ovtab = bfd_make_section_anyway_with_flags (ibfd, ".ovtab", flags);
+ *ovtab = htab->ovtab;
+ if (htab->ovtab == NULL
+ || !bfd_set_section_alignment (ibfd, htab->stub, 4))
+ return FALSE;
+
+ *toe = bfd_make_section_anyway_with_flags (ibfd, ".toe", SEC_ALLOC);
+ if (*toe == NULL
+ || !bfd_set_section_alignment (ibfd, *toe, 4))
+ return FALSE;
+ (*toe)->size = 16;
+
+ /* Retrieve all the stubs and sort. */
+ stubs.sh = bfd_malloc (stubs.count * sizeof (*stubs.sh));
+ if (stubs.sh == NULL)
+ return FALSE;
+ i = stubs.count;
+ bfd_hash_traverse (&htab->stub_hash_table, populate_stubs, &stubs);
+ BFD_ASSERT (stubs.count == 0);
+
+ stubs.count = i;
+ qsort (stubs.sh, stubs.count, sizeof (*stubs.sh), sort_stubs);
+
+ /* Now that the stubs are sorted, place them in the stub section.
+ Stubs are grouped per overlay
+ . ila $79,func1
+ . br 1f
+ . ila $79,func2
+ . br 1f
+ .
+ .
+ . ila $79,funcn
+ . nop
+ . 1:
+ . ila $78,ovl_index
+ . br __ovly_load */
+
+ group = 0;
+ for (i = 0; i < stubs.count; i++)
+ {
+ if (spu_elf_section_data (stubs.sh[group]->target_section
+ ->output_section)->ovl_index
+ != spu_elf_section_data (stubs.sh[i]->target_section
+ ->output_section)->ovl_index)
+ {
+ htab->stub->size += SIZEOF_STUB2;
+ for (; group != i; group++)
+ stubs.sh[group]->delta
+ = stubs.sh[i - 1]->off - stubs.sh[group]->off;
+ }
+ if (group == i
+ || ((stubs.sh[i - 1]->target_section->output_section->vma
+ + stubs.sh[i - 1]->target_section->output_offset
+ + stubs.sh[i - 1]->target_off)
+ != (stubs.sh[i]->target_section->output_section->vma
+ + stubs.sh[i]->target_section->output_offset
+ + stubs.sh[i]->target_off)))
+ {
+ stubs.sh[i]->off = htab->stub->size;
+ htab->stub->size += SIZEOF_STUB1;
+ }
+ else
+ stubs.sh[i]->off = stubs.sh[i - 1]->off;
+ }
+ if (group != i)
+ htab->stub->size += SIZEOF_STUB2;
+ for (; group != i; group++)
+ stubs.sh[group]->delta = stubs.sh[i - 1]->off - stubs.sh[group]->off;
+
+ /* htab->ovtab consists of two arrays.
+ . struct {
+ . u32 vma;
+ . u32 size;
+ . u32 file_off;
+ . u32 buf;
+ . } _ovly_table[];
+ .
+ . struct {
+ . u32 mapped;
+ . } _ovly_buf_table[]; */
+
+ htab->ovtab->alignment_power = 4;
+ htab->ovtab->size = htab->num_overlays * 16 + htab->num_buf * 4;
+
+ return TRUE;
+}
+
+/* Functions to handle embedded spu_ovl.o object. */
+
+static void *
+ovl_mgr_open (struct bfd *nbfd ATTRIBUTE_UNUSED, void *stream)
+{
+ return stream;
+}
+
+static file_ptr
+ovl_mgr_pread (struct bfd *abfd ATTRIBUTE_UNUSED,
+ void *stream,
+ void *buf,
+ file_ptr nbytes,
+ file_ptr offset)
+{
+ struct _ovl_stream *os;
+ size_t count;
+ size_t max;
+
+ os = (struct _ovl_stream *) stream;
+ max = (const char *) os->end - (const char *) os->start;
+
+ if ((ufile_ptr) offset >= max)
+ return 0;
+
+ count = nbytes;
+ if (count > max - offset)
+ count = max - offset;
+
+ memcpy (buf, (const char *) os->start + offset, count);
+ return count;
+}
+
+bfd_boolean
+spu_elf_open_builtin_lib (bfd **ovl_bfd, const struct _ovl_stream *stream)
+{
+ *ovl_bfd = bfd_openr_iovec ("builtin ovl_mgr",
+ "elf32-spu",
+ ovl_mgr_open,
+ (void *) stream,
+ ovl_mgr_pread,
+ NULL,
+ NULL);
+ return *ovl_bfd != NULL;
+}
+
+/* Fill in the ila and br for a stub. On the last stub for a group,
+ write the stub that sets the overlay number too. */
+
+static bfd_boolean
+write_one_stub (struct bfd_hash_entry *bh, void *inf)
+{
+ struct spu_stub_hash_entry *ent = (struct spu_stub_hash_entry *) bh;
+ struct spu_link_hash_table *htab = inf;
+ asection *sec = htab->stub;
+ asection *s = ent->target_section;
+ unsigned int ovl;
+ bfd_vma val;
+
+ val = ent->target_off + s->output_offset + s->output_section->vma;
+ bfd_put_32 (sec->owner, ILA_79 + ((val << 7) & 0x01ffff80),
+ sec->contents + ent->off);
+ val = ent->delta + 4;
+ bfd_put_32 (sec->owner, BR + ((val << 5) & 0x007fff80),
+ sec->contents + ent->off + 4);
+
+ /* If this is the last stub of this group, write stub2. */
+ if (ent->delta == 0)
+ {
+ bfd_put_32 (sec->owner, NOP,
+ sec->contents + ent->off + 4);
+
+ ovl = spu_elf_section_data (s->output_section)->ovl_index;
+ bfd_put_32 (sec->owner, ILA_78 + ((ovl << 7) & 0x01ffff80),
+ sec->contents + ent->off + 8);
+
+ val = (htab->ovly_load->root.u.def.section->output_section->vma
+ + htab->ovly_load->root.u.def.section->output_offset
+ + htab->ovly_load->root.u.def.value
+ - (sec->output_section->vma
+ + sec->output_offset
+ + ent->off + 12));
+
+ if (val + 0x20000 >= 0x40000)
+ htab->stub_overflow = TRUE;
+
+ bfd_put_32 (sec->owner, BR + ((val << 5) & 0x007fff80),
+ sec->contents + ent->off + 12);
+ }
+
+ if (htab->emit_stub_syms)
+ {
+ struct elf_link_hash_entry *h;
+ size_t len1, len2;
+ char *name;
+
+ len1 = sizeof ("00000000.ovl_call.") - 1;
+ len2 = strlen (ent->root.string);
+ name = bfd_malloc (len1 + len2 + 1);
+ if (name == NULL)
+ return FALSE;
+ memcpy (name, "00000000.ovl_call.", len1);
+ memcpy (name + len1, ent->root.string, len2 + 1);
+ h = elf_link_hash_lookup (&htab->elf, name, TRUE, TRUE, FALSE);
+ free (name);
+ if (h == NULL)
+ return FALSE;
+ if (h->root.type == bfd_link_hash_new)
+ {
+ h->root.type = bfd_link_hash_defined;
+ h->root.u.def.section = sec;
+ h->root.u.def.value = ent->off;
+ h->size = (ent->delta == 0
+ ? SIZEOF_STUB1 + SIZEOF_STUB2 : SIZEOF_STUB1);
+ h->type = STT_FUNC;
+ h->ref_regular = 1;
+ h->def_regular = 1;
+ h->ref_regular_nonweak = 1;
+ h->forced_local = 1;
+ h->non_elf = 0;
+ }
+ }
+
+ return TRUE;
+}
+
+/* Define an STT_OBJECT symbol. */
+
+static struct elf_link_hash_entry *
+define_ovtab_symbol (struct spu_link_hash_table *htab, const char *name)
+{
+ struct elf_link_hash_entry *h;
+
+ h = elf_link_hash_lookup (&htab->elf, name, TRUE, FALSE, FALSE);
+ if (h == NULL)
+ return NULL;
+
+ if (h->root.type != bfd_link_hash_defined
+ || !h->def_regular)
+ {
+ h->root.type = bfd_link_hash_defined;
+ h->root.u.def.section = htab->ovtab;
+ h->type = STT_OBJECT;
+ h->ref_regular = 1;
+ h->def_regular = 1;
+ h->ref_regular_nonweak = 1;
+ h->non_elf = 0;
+ }
+ else
+ {
+ (*_bfd_error_handler) (_("%B is not allowed to define %s"),
+ h->root.u.def.section->owner,
+ h->root.root.string);
+ bfd_set_error (bfd_error_bad_value);
+ return NULL;
+ }
+
+ return h;
+}
+
+/* Fill in all stubs and the overlay tables. */
+
+bfd_boolean
+spu_elf_build_stubs (struct bfd_link_info *info, int emit_syms, asection *toe)
+{
+ struct spu_link_hash_table *htab = spu_hash_table (info);
+ struct elf_link_hash_entry *h;
+ bfd_byte *p;
+ asection *s;
+ bfd *obfd;
+ unsigned int i;
+
+ htab->emit_stub_syms = emit_syms;
+ htab->stub->contents = bfd_zalloc (htab->stub->owner, htab->stub->size);
+ if (htab->stub->contents == NULL)
+ return FALSE;
+
+ h = elf_link_hash_lookup (&htab->elf, "__ovly_load", FALSE, FALSE, FALSE);
+ htab->ovly_load = h;
+ BFD_ASSERT (h != NULL
+ && (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && h->def_regular);
+
+ s = h->root.u.def.section->output_section;
+ if (spu_elf_section_data (s)->ovl_index)
+ {
+ (*_bfd_error_handler) (_("%s in overlay section"),
+ h->root.u.def.section->owner);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+
+ /* Write out all the stubs. */
+ bfd_hash_traverse (&htab->stub_hash_table, write_one_stub, htab);
+
+ if (htab->stub_overflow)
+ {
+ (*_bfd_error_handler) (_("overlay stub relocation overflow"));
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+
+ htab->ovtab->contents = bfd_zalloc (htab->ovtab->owner, htab->ovtab->size);
+ if (htab->ovtab->contents == NULL)
+ return FALSE;
+
+ /* Write out _ovly_table. */
+ p = htab->ovtab->contents;
+ obfd = htab->ovtab->output_section->owner;
+ for (s = obfd->sections; s != NULL; s = s->next)
+ {
+ unsigned int ovl_index = spu_elf_section_data (s)->ovl_index;
+
+ if (ovl_index != 0)
+ {
+ unsigned int lo, hi, mid;
+ unsigned long off = (ovl_index - 1) * 16;
+ bfd_put_32 (htab->ovtab->owner, s->vma, p + off);
+ bfd_put_32 (htab->ovtab->owner, (s->size + 15) & -16, p + off + 4);
+ /* file_off written later in spu_elf_modify_program_headers. */
+
+ lo = 0;
+ hi = htab->num_buf;
+ while (lo < hi)
+ {
+ mid = (lo + hi) >> 1;
+ if (htab->ovl_region[2 * mid + 1]->vma
+ + htab->ovl_region[2 * mid + 1]->size <= s->vma)
+ lo = mid + 1;
+ else if (htab->ovl_region[2 * mid]->vma > s->vma)
+ hi = mid;
+ else
+ {
+ bfd_put_32 (htab->ovtab->owner, mid + 1, p + off + 12);
+ break;
+ }
+ }
+ BFD_ASSERT (lo < hi);
+ }
+ }
+
+ /* Write out _ovly_buf_table. */
+ p = htab->ovtab->contents + htab->num_overlays * 16;
+ for (i = 0; i < htab->num_buf; i++)
+ {
+ bfd_put_32 (htab->ovtab->owner, 0, p);
+ p += 4;
+ }
+
+ h = define_ovtab_symbol (htab, "_ovly_table");
+ if (h == NULL)
+ return FALSE;
+ h->root.u.def.value = 0;
+ h->size = htab->num_overlays * 16;
+
+ h = define_ovtab_symbol (htab, "_ovly_table_end");
+ if (h == NULL)
+ return FALSE;
+ h->root.u.def.value = htab->num_overlays * 16;
+ h->size = 0;
+
+ h = define_ovtab_symbol (htab, "_ovly_buf_table");
+ if (h == NULL)
+ return FALSE;
+ h->root.u.def.value = htab->num_overlays * 16;
+ h->size = htab->num_buf * 4;
+
+ h = define_ovtab_symbol (htab, "_ovly_buf_table_end");
+ if (h == NULL)
+ return FALSE;
+ h->root.u.def.value = htab->num_overlays * 16 + htab->num_buf * 4;
+ h->size = 0;
+
+ h = define_ovtab_symbol (htab, "_EAR_");
+ if (h == NULL)
+ return FALSE;
+ h->root.u.def.section = toe;
+ h->root.u.def.value = 0;
+ h->size = 16;
+
+ return TRUE;
+}
+
+/* OFFSET in SEC (presumably) is the beginning of a function prologue.
+ Search for stack adjusting insns, and return the sp delta. */
+
+static int
+find_function_stack_adjust (asection *sec, bfd_vma offset)
+{
+ int unrecog;
+ int reg[128];
+
+ memset (reg, 0, sizeof (reg));
+ for (unrecog = 0; offset + 4 <= sec->size && unrecog < 32; offset += 4)
+ {
+ unsigned char buf[4];
+ int rt, ra;
+ int imm;
+
+ /* Assume no relocs on stack adjusing insns. */
+ if (!bfd_get_section_contents (sec->owner, sec, buf, offset, 4))
+ break;
+
+ if (buf[0] == 0x24 /* stqd */)
+ continue;
+
+ rt = buf[3] & 0x7f;
+ ra = ((buf[2] & 0x3f) << 1) | (buf[3] >> 7);
+ /* Partly decoded immediate field. */
+ imm = (buf[1] << 9) | (buf[2] << 1) | (buf[3] >> 7);
+
+ if (buf[0] == 0x1c /* ai */)
+ {
+ imm >>= 7;
+ imm = (imm ^ 0x200) - 0x200;
+ reg[rt] = reg[ra] + imm;
+
+ if (rt == 1 /* sp */)
+ {
+ if (imm > 0)
+ break;
+ return reg[rt];
+ }
+ }
+ else if (buf[0] == 0x18 && (buf[1] & 0xe0) == 0 /* a */)
+ {
+ int rb = ((buf[1] & 0x1f) << 2) | ((buf[2] & 0xc0) >> 6);
+
+ reg[rt] = reg[ra] + reg[rb];
+ if (rt == 1)
+ return reg[rt];
+ }
+ else if ((buf[0] & 0xfc) == 0x40 /* il, ilh, ilhu, ila */)
+ {
+ if (buf[0] >= 0x42 /* ila */)
+ imm |= (buf[0] & 1) << 17;
+ else
+ {
+ imm &= 0xffff;
+
+ if (buf[0] == 0x40 /* il */)
+ {
+ if ((buf[1] & 0x80) == 0)
+ goto unknown_insn;
+ imm = (imm ^ 0x8000) - 0x8000;
+ }
+ else if ((buf[1] & 0x80) == 0 /* ilhu */)
+ imm <<= 16;
+ }
+ reg[rt] = imm;
+ continue;
+ }
+ else if (buf[0] == 0x60 && (buf[1] & 0x80) != 0 /* iohl */)
+ {
+ reg[rt] |= imm & 0xffff;
+ continue;
+ }
+ else if (buf[0] == 0x04 /* ori */)
+ {
+ imm >>= 7;
+ imm = (imm ^ 0x200) - 0x200;
+ reg[rt] = reg[ra] | imm;
+ continue;
+ }
+ else if ((buf[0] == 0x33 && imm == 1 /* brsl .+4 */)
+ || (buf[0] == 0x08 && (buf[1] & 0xe0) == 0 /* sf */))
+ {
+ /* Used in pic reg load. Say rt is trashed. */
+ reg[rt] = 0;
+ continue;
+ }
+ else if (is_branch (buf))
+ /* If we hit a branch then we must be out of the prologue. */
+ break;
+ unknown_insn:
+ ++unrecog;
+ }
+
+ return 0;
+}
+
+/* qsort predicate to sort symbols by section and value. */
+
+static Elf_Internal_Sym *sort_syms_syms;
+static asection **sort_syms_psecs;
+
+static int
+sort_syms (const void *a, const void *b)
+{
+ Elf_Internal_Sym *const *s1 = a;
+ Elf_Internal_Sym *const *s2 = b;
+ asection *sec1,*sec2;
+ bfd_signed_vma delta;
+
+ sec1 = sort_syms_psecs[*s1 - sort_syms_syms];
+ sec2 = sort_syms_psecs[*s2 - sort_syms_syms];
+
+ if (sec1 != sec2)
+ return sec1->index - sec2->index;
+
+ delta = (*s1)->st_value - (*s2)->st_value;
+ if (delta != 0)
+ return delta < 0 ? -1 : 1;
+
+ delta = (*s2)->st_size - (*s1)->st_size;
+ if (delta != 0)
+ return delta < 0 ? -1 : 1;
+
+ return *s1 < *s2 ? -1 : 1;
+}
+
+struct call_info
+{
+ struct function_info *fun;
+ struct call_info *next;
+ int is_tail;
+};
+
+struct function_info
+{
+ /* List of functions called. Also branches to hot/cold part of
+ function. */
+ struct call_info *call_list;
+ /* For hot/cold part of function, point to owner. */
+ struct function_info *start;
+ /* Symbol at start of function. */
+ union {
+ Elf_Internal_Sym *sym;
+ struct elf_link_hash_entry *h;
+ } u;
+ /* Function section. */
+ asection *sec;
+ /* Address range of (this part of) function. */
+ bfd_vma lo, hi;
+ /* Stack usage. */
+ int stack;
+ /* Set if global symbol. */
+ unsigned int global : 1;
+ /* Set if known to be start of function (as distinct from a hunk
+ in hot/cold section. */
+ unsigned int is_func : 1;
+ /* Flags used during call tree traversal. */
+ unsigned int visit1 : 1;
+ unsigned int non_root : 1;
+ unsigned int visit2 : 1;
+ unsigned int marking : 1;
+ unsigned int visit3 : 1;
+};
+
+struct spu_elf_stack_info
+{
+ int num_fun;
+ int max_fun;
+ /* Variable size array describing functions, one per contiguous
+ address range belonging to a function. */
+ struct function_info fun[1];
+};
+
+/* Allocate a struct spu_elf_stack_info with MAX_FUN struct function_info
+ entries for section SEC. */
+
+static struct spu_elf_stack_info *
+alloc_stack_info (asection *sec, int max_fun)
+{
+ struct _spu_elf_section_data *sec_data = spu_elf_section_data (sec);
+ bfd_size_type amt;
+
+ amt = sizeof (struct spu_elf_stack_info);
+ amt += (max_fun - 1) * sizeof (struct function_info);
+ sec_data->stack_info = bfd_zmalloc (amt);
+ if (sec_data->stack_info != NULL)
+ sec_data->stack_info->max_fun = max_fun;
+ return sec_data->stack_info;
+}
+
+/* Add a new struct function_info describing a (part of a) function
+ starting at SYM_H. Keep the array sorted by address. */
+
+static struct function_info *
+maybe_insert_function (asection *sec,
+ void *sym_h,
+ bfd_boolean global,
+ bfd_boolean is_func)
+{
+ struct _spu_elf_section_data *sec_data = spu_elf_section_data (sec);
+ struct spu_elf_stack_info *sinfo = sec_data->stack_info;
+ int i;
+ bfd_vma off, size;
+
+ if (sinfo == NULL)
+ {
+ sinfo = alloc_stack_info (sec, 20);
+ if (sinfo == NULL)
+ return NULL;
+ }
+
+ if (!global)
+ {
+ Elf_Internal_Sym *sym = sym_h;
+ off = sym->st_value;
+ size = sym->st_size;
+ }
+ else
+ {
+ struct elf_link_hash_entry *h = sym_h;
+ off = h->root.u.def.value;
+ size = h->size;
+ }
+
+ for (i = sinfo->num_fun; --i >= 0; )
+ if (sinfo->fun[i].lo <= off)
+ break;
+
+ if (i >= 0)
+ {
+ /* Don't add another entry for an alias, but do update some
+ info. */
+ if (sinfo->fun[i].lo == off)
+ {
+ /* Prefer globals over local syms. */
+ if (global && !sinfo->fun[i].global)
+ {
+ sinfo->fun[i].global = TRUE;
+ sinfo->fun[i].u.h = sym_h;
+ }
+ if (is_func)
+ sinfo->fun[i].is_func = TRUE;
+ return &sinfo->fun[i];
+ }
+ /* Ignore a zero-size symbol inside an existing function. */
+ else if (sinfo->fun[i].hi > off && size == 0)
+ return &sinfo->fun[i];
+ }
+
+ if (++i < sinfo->num_fun)
+ memmove (&sinfo->fun[i + 1], &sinfo->fun[i],
+ (sinfo->num_fun - i) * sizeof (sinfo->fun[i]));
+ else if (i >= sinfo->max_fun)
+ {
+ bfd_size_type amt = sizeof (struct spu_elf_stack_info);
+ bfd_size_type old = amt;
+
+ old += (sinfo->max_fun - 1) * sizeof (struct function_info);
+ sinfo->max_fun += 20 + (sinfo->max_fun >> 1);
+ amt += (sinfo->max_fun - 1) * sizeof (struct function_info);
+ sinfo = bfd_realloc (sinfo, amt);
+ if (sinfo == NULL)
+ return NULL;
+ memset ((char *) sinfo + old, 0, amt - old);
+ sec_data->stack_info = sinfo;
+ }
+ sinfo->fun[i].is_func = is_func;
+ sinfo->fun[i].global = global;
+ sinfo->fun[i].sec = sec;
+ if (global)
+ sinfo->fun[i].u.h = sym_h;
+ else
+ sinfo->fun[i].u.sym = sym_h;
+ sinfo->fun[i].lo = off;
+ sinfo->fun[i].hi = off + size;
+ sinfo->fun[i].stack = -find_function_stack_adjust (sec, off);
+ sinfo->num_fun += 1;
+ return &sinfo->fun[i];
+}
+
+/* Return the name of FUN. */
+
+static const char *
+func_name (struct function_info *fun)
+{
+ asection *sec;
+ bfd *ibfd;
+ Elf_Internal_Shdr *symtab_hdr;
+
+ while (fun->start != NULL)
+ fun = fun->start;
+
+ if (fun->global)
+ return fun->u.h->root.root.string;
+
+ sec = fun->sec;
+ if (fun->u.sym->st_name == 0)
+ {
+ size_t len = strlen (sec->name);
+ char *name = bfd_malloc (len + 10);
+ if (name == NULL)
+ return "(null)";
+ sprintf (name, "%s+%lx", sec->name,
+ (unsigned long) fun->u.sym->st_value & 0xffffffff);
+ return name;
+ }
+ ibfd = sec->owner;
+ symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
+ return bfd_elf_sym_name (ibfd, symtab_hdr, fun->u.sym, sec);
+}
+
+/* Read the instruction at OFF in SEC. Return true iff the instruction
+ is a nop, lnop, or stop 0 (all zero insn). */
+
+static bfd_boolean
+is_nop (asection *sec, bfd_vma off)
+{
+ unsigned char insn[4];
+
+ if (off + 4 > sec->size
+ || !bfd_get_section_contents (sec->owner, sec, insn, off, 4))
+ return FALSE;
+ if ((insn[0] & 0xbf) == 0 && (insn[1] & 0xe0) == 0x20)
+ return TRUE;
+ if (insn[0] == 0 && insn[1] == 0 && insn[2] == 0 && insn[3] == 0)
+ return TRUE;
+ return FALSE;
+}
+
+/* Extend the range of FUN to cover nop padding up to LIMIT.
+ Return TRUE iff some instruction other than a NOP was found. */
+
+static bfd_boolean
+insns_at_end (struct function_info *fun, bfd_vma limit)
+{
+ bfd_vma off = (fun->hi + 3) & -4;
+
+ while (off < limit && is_nop (fun->sec, off))
+ off += 4;
+ if (off < limit)
+ {
+ fun->hi = off;
+ return TRUE;
+ }
+ fun->hi = limit;
+ return FALSE;
+}
+
+/* Check and fix overlapping function ranges. Return TRUE iff there
+ are gaps in the current info we have about functions in SEC. */
+
+static bfd_boolean
+check_function_ranges (asection *sec, struct bfd_link_info *info)
+{
+ struct _spu_elf_section_data *sec_data = spu_elf_section_data (sec);
+ struct spu_elf_stack_info *sinfo = sec_data->stack_info;
+ int i;
+ bfd_boolean gaps = FALSE;
+
+ if (sinfo == NULL)
+ return FALSE;
+
+ for (i = 1; i < sinfo->num_fun; i++)
+ if (sinfo->fun[i - 1].hi > sinfo->fun[i].lo)
+ {
+ /* Fix overlapping symbols. */
+ const char *f1 = func_name (&sinfo->fun[i - 1]);
+ const char *f2 = func_name (&sinfo->fun[i]);
+
+ info->callbacks->einfo (_("warning: %s overlaps %s\n"), f1, f2);
+ sinfo->fun[i - 1].hi = sinfo->fun[i].lo;
+ }
+ else if (insns_at_end (&sinfo->fun[i - 1], sinfo->fun[i].lo))
+ gaps = TRUE;
+
+ if (sinfo->num_fun == 0)
+ gaps = TRUE;
+ else
+ {
+ if (sinfo->fun[0].lo != 0)
+ gaps = TRUE;
+ if (sinfo->fun[sinfo->num_fun - 1].hi > sec->size)
+ {
+ const char *f1 = func_name (&sinfo->fun[sinfo->num_fun - 1]);
+
+ info->callbacks->einfo (_("warning: %s exceeds section size\n"), f1);
+ sinfo->fun[sinfo->num_fun - 1].hi = sec->size;
+ }
+ else if (insns_at_end (&sinfo->fun[sinfo->num_fun - 1], sec->size))
+ gaps = TRUE;
+ }
+ return gaps;
+}
+
+/* Search current function info for a function that contains address
+ OFFSET in section SEC. */
+
+static struct function_info *
+find_function (asection *sec, bfd_vma offset, struct bfd_link_info *info)
+{
+ struct _spu_elf_section_data *sec_data = spu_elf_section_data (sec);
+ struct spu_elf_stack_info *sinfo = sec_data->stack_info;
+ int lo, hi, mid;
+
+ lo = 0;
+ hi = sinfo->num_fun;
+ while (lo < hi)
+ {
+ mid = (lo + hi) / 2;
+ if (offset < sinfo->fun[mid].lo)
+ hi = mid;
+ else if (offset >= sinfo->fun[mid].hi)
+ lo = mid + 1;
+ else
+ return &sinfo->fun[mid];
+ }
+ info->callbacks->einfo (_("%A:0x%v not found in function table\n"),
+ sec, offset);
+ return NULL;
+}
+
+/* Add CALLEE to CALLER call list if not already present. */
+
+static bfd_boolean
+insert_callee (struct function_info *caller, struct call_info *callee)
+{
+ struct call_info *p;
+ for (p = caller->call_list; p != NULL; p = p->next)
+ if (p->fun == callee->fun)
+ {
+ /* Tail calls use less stack than normal calls. Retain entry
+ for normal call over one for tail call. */
+ if (p->is_tail > callee->is_tail)
+ p->is_tail = callee->is_tail;
+ return FALSE;
+ }
+ callee->next = caller->call_list;
+ caller->call_list = callee;
+ return TRUE;
+}
+
+/* Rummage through the relocs for SEC, looking for function calls.
+ If CALL_TREE is true, fill in call graph. If CALL_TREE is false,
+ mark destination symbols on calls as being functions. Also
+ look at branches, which may be tail calls or go to hot/cold
+ section part of same function. */
+
+static bfd_boolean
+mark_functions_via_relocs (asection *sec,
+ struct bfd_link_info *info,
+ int call_tree)
+{
+ Elf_Internal_Rela *internal_relocs, *irelaend, *irela;
+ Elf_Internal_Shdr *symtab_hdr = &elf_tdata (sec->owner)->symtab_hdr;
+ Elf_Internal_Sym *syms;
+ void *psyms;
+ static bfd_boolean warned;
+
+ internal_relocs = _bfd_elf_link_read_relocs (sec->owner, sec, NULL, NULL,
+ info->keep_memory);
+ if (internal_relocs == NULL)
+ return FALSE;
+
+ symtab_hdr = &elf_tdata (sec->owner)->symtab_hdr;
+ psyms = &symtab_hdr->contents;
+ syms = *(Elf_Internal_Sym **) psyms;
+ irela = internal_relocs;
+ irelaend = irela + sec->reloc_count;
+ for (; irela < irelaend; irela++)
+ {
+ enum elf_spu_reloc_type r_type;
+ unsigned int r_indx;
+ asection *sym_sec;
+ Elf_Internal_Sym *sym;
+ struct elf_link_hash_entry *h;
+ bfd_vma val;
+ unsigned char insn[4];
+ bfd_boolean is_call;
+ struct function_info *caller;
+ struct call_info *callee;
+
+ r_type = ELF32_R_TYPE (irela->r_info);
+ if (r_type != R_SPU_REL16
+ && r_type != R_SPU_ADDR16)
+ continue;
+
+ r_indx = ELF32_R_SYM (irela->r_info);
+ if (!get_sym_h (&h, &sym, &sym_sec, psyms, r_indx, sec->owner))
+ return FALSE;
+
+ if (sym_sec == NULL
+ || sym_sec->output_section == NULL
+ || sym_sec->output_section->owner != sec->output_section->owner)
+ continue;
+
+ if (!bfd_get_section_contents (sec->owner, sec, insn,
+ irela->r_offset, 4))
+ return FALSE;
+ if (!is_branch (insn))
+ continue;
+
+ if ((sym_sec->flags & (SEC_ALLOC | SEC_LOAD | SEC_CODE))
+ != (SEC_ALLOC | SEC_LOAD | SEC_CODE))
+ {
+ if (!call_tree)
+ warned = TRUE;
+ if (!call_tree || !warned)
+ info->callbacks->einfo (_("%B(%A+0x%v): call to non-code section"
+ " %B(%A), stack analysis incomplete\n"),
+ sec->owner, sec, irela->r_offset,
+ sym_sec->owner, sym_sec);
+ continue;
+ }
+
+ is_call = (insn[0] & 0xfd) == 0x31;
+
+ if (h)
+ val = h->root.u.def.value;
+ else
+ val = sym->st_value;
+ val += irela->r_addend;
+
+ if (!call_tree)
+ {
+ struct function_info *fun;
+
+ if (irela->r_addend != 0)
+ {
+ Elf_Internal_Sym *fake = bfd_zmalloc (sizeof (*fake));
+ if (fake == NULL)
+ return FALSE;
+ fake->st_value = val;
+ fake->st_shndx
+ = _bfd_elf_section_from_bfd_section (sym_sec->owner, sym_sec);
+ sym = fake;
+ }
+ if (sym)
+ fun = maybe_insert_function (sym_sec, sym, FALSE, is_call);
+ else
+ fun = maybe_insert_function (sym_sec, h, TRUE, is_call);
+ if (fun == NULL)
+ return FALSE;
+ if (irela->r_addend != 0
+ && fun->u.sym != sym)
+ free (sym);
+ continue;
+ }
+
+ caller = find_function (sec, irela->r_offset, info);
+ if (caller == NULL)
+ return FALSE;
+ callee = bfd_malloc (sizeof *callee);
+ if (callee == NULL)
+ return FALSE;
+
+ callee->fun = find_function (sym_sec, val, info);
+ if (callee->fun == NULL)
+ return FALSE;
+ callee->is_tail = !is_call;
+ if (!insert_callee (caller, callee))
+ free (callee);
+ else if (!is_call
+ && !callee->fun->is_func
+ && callee->fun->stack == 0)
+ {
+ /* This is either a tail call or a branch from one part of
+ the function to another, ie. hot/cold section. If the
+ destination has been called by some other function then
+ it is a separate function. We also assume that functions
+ are not split across input files. */
+ if (callee->fun->start != NULL
+ || sec->owner != sym_sec->owner)
+ {
+ callee->fun->start = NULL;
+ callee->fun->is_func = TRUE;
+ }
+ else
+ callee->fun->start = caller;
+ }
+ }
+
+ return TRUE;
+}
+
+/* Handle something like .init or .fini, which has a piece of a function.
+ These sections are pasted together to form a single function. */
+
+static bfd_boolean
+pasted_function (asection *sec, struct bfd_link_info *info)
+{
+ struct bfd_link_order *l;
+ struct _spu_elf_section_data *sec_data;
+ struct spu_elf_stack_info *sinfo;
+ Elf_Internal_Sym *fake;
+ struct function_info *fun, *fun_start;
+
+ fake = bfd_zmalloc (sizeof (*fake));
+ if (fake == NULL)
+ return FALSE;
+ fake->st_value = 0;
+ fake->st_size = sec->size;
+ fake->st_shndx
+ = _bfd_elf_section_from_bfd_section (sec->owner, sec);
+ fun = maybe_insert_function (sec, fake, FALSE, FALSE);
+ if (!fun)
+ return FALSE;
+
+ /* Find a function immediately preceding this section. */
+ fun_start = NULL;
+ for (l = sec->output_section->map_head.link_order; l != NULL; l = l->next)
+ {
+ if (l->u.indirect.section == sec)
+ {
+ if (fun_start != NULL)
+ {
+ if (fun_start->start)
+ fun_start = fun_start->start;
+ fun->start = fun_start;
+ }
+ return TRUE;
+ }
+ if (l->type == bfd_indirect_link_order
+ && (sec_data = spu_elf_section_data (l->u.indirect.section)) != NULL
+ && (sinfo = sec_data->stack_info) != NULL
+ && sinfo->num_fun != 0)
+ fun_start = &sinfo->fun[sinfo->num_fun - 1];
+ }
+
+ info->callbacks->einfo (_("%A link_order not found\n"), sec);
+ return FALSE;
+}
+
+/* We're only interested in code sections. */
+
+static bfd_boolean
+interesting_section (asection *s, bfd *obfd, struct spu_link_hash_table *htab)
+{
+ return (s != htab->stub
+ && s->output_section != NULL
+ && s->output_section->owner == obfd
+ && ((s->flags & (SEC_ALLOC | SEC_LOAD | SEC_CODE))
+ == (SEC_ALLOC | SEC_LOAD | SEC_CODE))
+ && s->size != 0);
+}
+
+/* Map address ranges in code sections to functions. */
+
+static bfd_boolean
+discover_functions (bfd *output_bfd, struct bfd_link_info *info)
+{
+ struct spu_link_hash_table *htab = spu_hash_table (info);
+ bfd *ibfd;
+ int bfd_idx;
+ Elf_Internal_Sym ***psym_arr;
+ asection ***sec_arr;
+ bfd_boolean gaps = FALSE;
+
+ bfd_idx = 0;
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ bfd_idx++;
+
+ psym_arr = bfd_zmalloc (bfd_idx * sizeof (*psym_arr));
+ if (psym_arr == NULL)
+ return FALSE;
+ sec_arr = bfd_zmalloc (bfd_idx * sizeof (*sec_arr));
+ if (sec_arr == NULL)
+ return FALSE;
+
+
+ for (ibfd = info->input_bfds, bfd_idx = 0;
+ ibfd != NULL;
+ ibfd = ibfd->link_next, bfd_idx++)
+ {
+ extern const bfd_target bfd_elf32_spu_vec;
+ Elf_Internal_Shdr *symtab_hdr;
+ asection *sec;
+ size_t symcount;
+ Elf_Internal_Sym *syms, *sy, **psyms, **psy;
+ asection **psecs, **p;
+
+ if (ibfd->xvec != &bfd_elf32_spu_vec)
+ continue;
+
+ /* Read all the symbols. */
+ symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
+ symcount = symtab_hdr->sh_size / symtab_hdr->sh_entsize;
+ if (symcount == 0)
+ continue;
+
+ syms = (Elf_Internal_Sym *) symtab_hdr->contents;
+ if (syms == NULL)
+ {
+ syms = bfd_elf_get_elf_syms (ibfd, symtab_hdr, symcount, 0,
+ NULL, NULL, NULL);
+ symtab_hdr->contents = (void *) syms;
+ if (syms == NULL)
+ return FALSE;
+ }
+
+ /* Select defined function symbols that are going to be output. */
+ psyms = bfd_malloc ((symcount + 1) * sizeof (*psyms));
+ if (psyms == NULL)
+ return FALSE;
+ psym_arr[bfd_idx] = psyms;
+ psecs = bfd_malloc (symcount * sizeof (*psecs));
+ if (psecs == NULL)
+ return FALSE;
+ sec_arr[bfd_idx] = psecs;
+ for (psy = psyms, p = psecs, sy = syms; sy < syms + symcount; ++p, ++sy)
+ if (ELF_ST_TYPE (sy->st_info) == STT_NOTYPE
+ || ELF_ST_TYPE (sy->st_info) == STT_FUNC)
+ {
+ asection *s;
+
+ *p = s = bfd_section_from_elf_index (ibfd, sy->st_shndx);
+ if (s != NULL && interesting_section (s, output_bfd, htab))
+ *psy++ = sy;
+ }
+ symcount = psy - psyms;
+ *psy = NULL;
+
+ /* Sort them by section and offset within section. */
+ sort_syms_syms = syms;
+ sort_syms_psecs = psecs;
+ qsort (psyms, symcount, sizeof (*psyms), sort_syms);
+
+ /* Now inspect the function symbols. */
+ for (psy = psyms; psy < psyms + symcount; )
+ {
+ asection *s = psecs[*psy - syms];
+ Elf_Internal_Sym **psy2;
+
+ for (psy2 = psy; ++psy2 < psyms + symcount; )
+ if (psecs[*psy2 - syms] != s)
+ break;
+
+ if (!alloc_stack_info (s, psy2 - psy))
+ return FALSE;
+ psy = psy2;
+ }
+
+ /* First install info about properly typed and sized functions.
+ In an ideal world this will cover all code sections, except
+ when partitioning functions into hot and cold sections,
+ and the horrible pasted together .init and .fini functions. */
+ for (psy = psyms; psy < psyms + symcount; ++psy)
+ {
+ sy = *psy;
+ if (ELF_ST_TYPE (sy->st_info) == STT_FUNC)
+ {
+ asection *s = psecs[sy - syms];
+ if (!maybe_insert_function (s, sy, FALSE, TRUE))
+ return FALSE;
+ }
+ }
+
+ for (sec = ibfd->sections; sec != NULL && !gaps; sec = sec->next)
+ if (interesting_section (sec, output_bfd, htab))
+ gaps |= check_function_ranges (sec, info);
+ }
+
+ if (gaps)
+ {
+ /* See if we can discover more function symbols by looking at
+ relocations. */
+ for (ibfd = info->input_bfds, bfd_idx = 0;
+ ibfd != NULL;
+ ibfd = ibfd->link_next, bfd_idx++)
+ {
+ asection *sec;
+
+ if (psym_arr[bfd_idx] == NULL)
+ continue;
+
+ for (sec = ibfd->sections; sec != NULL; sec = sec->next)
+ if (interesting_section (sec, output_bfd, htab)
+ && sec->reloc_count != 0)
+ {
+ if (!mark_functions_via_relocs (sec, info, FALSE))
+ return FALSE;
+ }
+ }
+
+ for (ibfd = info->input_bfds, bfd_idx = 0;
+ ibfd != NULL;
+ ibfd = ibfd->link_next, bfd_idx++)
+ {
+ Elf_Internal_Shdr *symtab_hdr;
+ asection *sec;
+ Elf_Internal_Sym *syms, *sy, **psyms, **psy;
+ asection **psecs;
+
+ if ((psyms = psym_arr[bfd_idx]) == NULL)
+ continue;
+
+ psecs = sec_arr[bfd_idx];
+
+ symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
+ syms = (Elf_Internal_Sym *) symtab_hdr->contents;
+
+ gaps = FALSE;
+ for (sec = ibfd->sections; sec != NULL && !gaps; sec = sec->next)
+ if (interesting_section (sec, output_bfd, htab))
+ gaps |= check_function_ranges (sec, info);
+ if (!gaps)
+ continue;
+
+ /* Finally, install all globals. */
+ for (psy = psyms; (sy = *psy) != NULL; ++psy)
+ {
+ asection *s;
+
+ s = psecs[sy - syms];
+
+ /* Global syms might be improperly typed functions. */
+ if (ELF_ST_TYPE (sy->st_info) != STT_FUNC
+ && ELF_ST_BIND (sy->st_info) == STB_GLOBAL)
+ {
+ if (!maybe_insert_function (s, sy, FALSE, FALSE))
+ return FALSE;
+ }
+ }
+
+ /* Some of the symbols we've installed as marking the
+ beginning of functions may have a size of zero. Extend
+ the range of such functions to the beginning of the
+ next symbol of interest. */
+ for (sec = ibfd->sections; sec != NULL; sec = sec->next)
+ if (interesting_section (sec, output_bfd, htab))
+ {
+ struct _spu_elf_section_data *sec_data;
+ struct spu_elf_stack_info *sinfo;
+
+ sec_data = spu_elf_section_data (sec);
+ sinfo = sec_data->stack_info;
+ if (sinfo != NULL)
+ {
+ int fun_idx;
+ bfd_vma hi = sec->size;
+
+ for (fun_idx = sinfo->num_fun; --fun_idx >= 0; )
+ {
+ sinfo->fun[fun_idx].hi = hi;
+ hi = sinfo->fun[fun_idx].lo;
+ }
+ }
+ /* No symbols in this section. Must be .init or .fini
+ or something similar. */
+ else if (!pasted_function (sec, info))
+ return FALSE;
+ }
+ }
+ }
+
+ for (ibfd = info->input_bfds, bfd_idx = 0;
+ ibfd != NULL;
+ ibfd = ibfd->link_next, bfd_idx++)
+ {
+ if (psym_arr[bfd_idx] == NULL)
+ continue;
+
+ free (psym_arr[bfd_idx]);
+ free (sec_arr[bfd_idx]);
+ }
+
+ free (psym_arr);
+ free (sec_arr);
+
+ return TRUE;
+}
+
+/* Mark nodes in the call graph that are called by some other node. */
+
+static void
+mark_non_root (struct function_info *fun)
+{
+ struct call_info *call;
+
+ fun->visit1 = TRUE;
+ for (call = fun->call_list; call; call = call->next)
+ {
+ call->fun->non_root = TRUE;
+ if (!call->fun->visit1)
+ mark_non_root (call->fun);
+ }
+}
+
+/* Remove cycles from the call graph. */
+
+static void
+call_graph_traverse (struct function_info *fun, struct bfd_link_info *info)
+{
+ struct call_info **callp, *call;
+
+ fun->visit2 = TRUE;
+ fun->marking = TRUE;
+
+ callp = &fun->call_list;
+ while ((call = *callp) != NULL)
+ {
+ if (!call->fun->visit2)
+ call_graph_traverse (call->fun, info);
+ else if (call->fun->marking)
+ {
+ const char *f1 = func_name (fun);
+ const char *f2 = func_name (call->fun);
+
+ info->callbacks->info (_("Stack analysis will ignore the call "
+ "from %s to %s\n"),
+ f1, f2);
+ *callp = call->next;
+ continue;
+ }
+ callp = &call->next;
+ }
+ fun->marking = FALSE;
+}
+
+/* Populate call_list for each function. */
+
+static bfd_boolean
+build_call_tree (bfd *output_bfd, struct bfd_link_info *info)
+{
+ struct spu_link_hash_table *htab = spu_hash_table (info);
+ bfd *ibfd;
+
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ {
+ extern const bfd_target bfd_elf32_spu_vec;
+ asection *sec;
+
+ if (ibfd->xvec != &bfd_elf32_spu_vec)
+ continue;
+
+ for (sec = ibfd->sections; sec != NULL; sec = sec->next)
+ {
+ if (!interesting_section (sec, output_bfd, htab)
+ || sec->reloc_count == 0)
+ continue;
+
+ if (!mark_functions_via_relocs (sec, info, TRUE))
+ return FALSE;
+ }
+
+ /* Transfer call info from hot/cold section part of function
+ to main entry. */
+ for (sec = ibfd->sections; sec != NULL; sec = sec->next)
+ {
+ struct _spu_elf_section_data *sec_data;
+ struct spu_elf_stack_info *sinfo;
+
+ if ((sec_data = spu_elf_section_data (sec)) != NULL
+ && (sinfo = sec_data->stack_info) != NULL)
+ {
+ int i;
+ for (i = 0; i < sinfo->num_fun; ++i)
+ {
+ if (sinfo->fun[i].start != NULL)
+ {
+ struct call_info *call = sinfo->fun[i].call_list;
+
+ while (call != NULL)
+ {
+ struct call_info *call_next = call->next;
+ if (!insert_callee (sinfo->fun[i].start, call))
+ free (call);
+ call = call_next;
+ }
+ sinfo->fun[i].call_list = NULL;
+ sinfo->fun[i].non_root = TRUE;
+ }
+ }
+ }
+ }
+ }
+
+ /* Find the call graph root(s). */
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ {
+ extern const bfd_target bfd_elf32_spu_vec;
+ asection *sec;
+
+ if (ibfd->xvec != &bfd_elf32_spu_vec)
+ continue;
+
+ for (sec = ibfd->sections; sec != NULL; sec = sec->next)
+ {
+ struct _spu_elf_section_data *sec_data;
+ struct spu_elf_stack_info *sinfo;
+
+ if ((sec_data = spu_elf_section_data (sec)) != NULL
+ && (sinfo = sec_data->stack_info) != NULL)
+ {
+ int i;
+ for (i = 0; i < sinfo->num_fun; ++i)
+ if (!sinfo->fun[i].visit1)
+ mark_non_root (&sinfo->fun[i]);
+ }
+ }
+ }
+
+ /* Remove cycles from the call graph. We start from the root node(s)
+ so that we break cycles in a reasonable place. */
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ {
+ extern const bfd_target bfd_elf32_spu_vec;
+ asection *sec;
+
+ if (ibfd->xvec != &bfd_elf32_spu_vec)
+ continue;
+
+ for (sec = ibfd->sections; sec != NULL; sec = sec->next)
+ {
+ struct _spu_elf_section_data *sec_data;
+ struct spu_elf_stack_info *sinfo;
+
+ if ((sec_data = spu_elf_section_data (sec)) != NULL
+ && (sinfo = sec_data->stack_info) != NULL)
+ {
+ int i;
+ for (i = 0; i < sinfo->num_fun; ++i)
+ if (!sinfo->fun[i].non_root)
+ call_graph_traverse (&sinfo->fun[i], info);
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+/* Descend the call graph for FUN, accumulating total stack required. */
+
+static bfd_vma
+sum_stack (struct function_info *fun,
+ struct bfd_link_info *info,
+ int emit_stack_syms)
+{
+ struct call_info *call;
+ struct function_info *max = NULL;
+ bfd_vma max_stack = fun->stack;
+ bfd_vma stack;
+ const char *f1;
+
+ if (fun->visit3)
+ return max_stack;
+
+ for (call = fun->call_list; call; call = call->next)
+ {
+ stack = sum_stack (call->fun, info, emit_stack_syms);
+ /* Include caller stack for normal calls, don't do so for
+ tail calls. fun->stack here is local stack usage for
+ this function. */
+ if (!call->is_tail)
+ stack += fun->stack;
+ if (max_stack < stack)
+ {
+ max_stack = stack;
+ max = call->fun;
+ }
+ }
+
+ f1 = func_name (fun);
+ info->callbacks->minfo (_("%s: 0x%v 0x%v\n"), f1, fun->stack, max_stack);
+
+ if (fun->call_list)
+ {
+ info->callbacks->minfo (_(" calls:\n"));
+ for (call = fun->call_list; call; call = call->next)
+ {
+ const char *f2 = func_name (call->fun);
+ const char *ann1 = call->fun == max ? "*" : " ";
+ const char *ann2 = call->is_tail ? "t" : " ";
+
+ info->callbacks->minfo (_(" %s%s %s\n"), ann1, ann2, f2);
+ }
+ }
+
+ /* Now fun->stack holds cumulative stack. */
+ fun->stack = max_stack;
+ fun->visit3 = TRUE;
+
+ if (emit_stack_syms)
+ {
+ struct spu_link_hash_table *htab = spu_hash_table (info);
+ char *name = bfd_malloc (18 + strlen (f1));
+ struct elf_link_hash_entry *h;
+
+ if (name != NULL)
+ {
+ if (fun->global || ELF_ST_BIND (fun->u.sym->st_info) == STB_GLOBAL)
+ sprintf (name, "__stack_%s", f1);
+ else
+ sprintf (name, "__stack_%x_%s", fun->sec->id & 0xffffffff, f1);
+
+ h = elf_link_hash_lookup (&htab->elf, name, TRUE, TRUE, FALSE);
+ free (name);
+ if (h != NULL
+ && (h->root.type == bfd_link_hash_new
+ || h->root.type == bfd_link_hash_undefined
+ || h->root.type == bfd_link_hash_undefweak))
+ {
+ h->root.type = bfd_link_hash_defined;
+ h->root.u.def.section = bfd_abs_section_ptr;
+ h->root.u.def.value = max_stack;
+ h->size = 0;
+ h->type = 0;
+ h->ref_regular = 1;
+ h->def_regular = 1;
+ h->ref_regular_nonweak = 1;
+ h->forced_local = 1;
+ h->non_elf = 0;
+ }
+ }
+ }
+
+ return max_stack;
+}
+
+/* Provide an estimate of total stack required. */
+
+static bfd_boolean
+spu_elf_stack_analysis (bfd *output_bfd,
+ struct bfd_link_info *info,
+ int emit_stack_syms)
+{
+ bfd *ibfd;
+ bfd_vma max_stack = 0;
+
+ if (!discover_functions (output_bfd, info))
+ return FALSE;
+
+ if (!build_call_tree (output_bfd, info))
+ return FALSE;
+
+ info->callbacks->info (_("Stack size for call graph root nodes.\n"));
+ info->callbacks->minfo (_("\nStack size for functions. "
+ "Annotations: '*' max stack, 't' tail call\n"));
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ {
+ extern const bfd_target bfd_elf32_spu_vec;
+ asection *sec;
+
+ if (ibfd->xvec != &bfd_elf32_spu_vec)
+ continue;
+
+ for (sec = ibfd->sections; sec != NULL; sec = sec->next)
+ {
+ struct _spu_elf_section_data *sec_data;
+ struct spu_elf_stack_info *sinfo;
+
+ if ((sec_data = spu_elf_section_data (sec)) != NULL
+ && (sinfo = sec_data->stack_info) != NULL)
+ {
+ int i;
+ for (i = 0; i < sinfo->num_fun; ++i)
+ {
+ if (!sinfo->fun[i].non_root)
+ {
+ bfd_vma stack;
+ const char *f1;
+
+ stack = sum_stack (&sinfo->fun[i], info,
+ emit_stack_syms);
+ f1 = func_name (&sinfo->fun[i]);
+ info->callbacks->info (_(" %s: 0x%v\n"),
+ f1, stack);
+ if (max_stack < stack)
+ max_stack = stack;
+ }
+ }
+ }
+ }
+ }
+
+ info->callbacks->info (_("Maximum stack required is 0x%v\n"), max_stack);
+ return TRUE;
+}
+
+/* Perform a final link. */
+
+static bfd_boolean
+spu_elf_final_link (bfd *output_bfd, struct bfd_link_info *info)
+{
+ struct spu_link_hash_table *htab = spu_hash_table (info);
+
+ if (htab->stack_analysis
+ && !spu_elf_stack_analysis (output_bfd, info, htab->emit_stack_syms))
+ info->callbacks->einfo ("%X%P: stack analysis error: %E\n");
+
+ return bfd_elf_final_link (output_bfd, info);
+}
+
+/* Called when not normally emitting relocs, ie. !info->relocatable
+ and !info->emitrelocations. Returns a count of special relocs
+ that need to be emitted. */
+
+static unsigned int
+spu_elf_count_relocs (asection *sec, Elf_Internal_Rela *relocs)
+{
+ unsigned int count = 0;
+ Elf_Internal_Rela *relend = relocs + sec->reloc_count;
+
+ for (; relocs < relend; relocs++)
+ {
+ int r_type = ELF32_R_TYPE (relocs->r_info);
+ if (r_type == R_SPU_PPU32 || r_type == R_SPU_PPU64)
+ ++count;
+ }
+
+ return count;
+}
+
+/* Apply RELOCS to CONTENTS of INPUT_SECTION from INPUT_BFD. */
+
+static bfd_boolean
+spu_elf_relocate_section (bfd *output_bfd,
+ struct bfd_link_info *info,
+ bfd *input_bfd,
+ asection *input_section,
+ bfd_byte *contents,
+ Elf_Internal_Rela *relocs,
+ Elf_Internal_Sym *local_syms,
+ asection **local_sections)
+{
+ Elf_Internal_Shdr *symtab_hdr;
+ struct elf_link_hash_entry **sym_hashes;
+ Elf_Internal_Rela *rel, *relend;
+ struct spu_link_hash_table *htab;
+ bfd_boolean ret = TRUE;
+ bfd_boolean emit_these_relocs = FALSE;
+
+ htab = spu_hash_table (info);
+ symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+ sym_hashes = (struct elf_link_hash_entry **) (elf_sym_hashes (input_bfd));
+
+ rel = relocs;
+ relend = relocs + input_section->reloc_count;
+ for (; rel < relend; rel++)
+ {
+ int r_type;
+ reloc_howto_type *howto;
+ unsigned long r_symndx;
+ Elf_Internal_Sym *sym;
+ asection *sec;
+ struct elf_link_hash_entry *h;
+ const char *sym_name;
+ bfd_vma relocation;
+ bfd_vma addend;
+ bfd_reloc_status_type r;
+ bfd_boolean unresolved_reloc;
+ bfd_boolean warned;
+ bfd_boolean branch;
+
+ r_symndx = ELF32_R_SYM (rel->r_info);
+ r_type = ELF32_R_TYPE (rel->r_info);
+ if (r_type == R_SPU_PPU32 || r_type == R_SPU_PPU64)
+ {
+ emit_these_relocs = TRUE;
+ continue;
+ }
+
+ howto = elf_howto_table + r_type;
+ unresolved_reloc = FALSE;
+ warned = FALSE;
+ h = NULL;
+ sym = NULL;
+ sec = NULL;
+ if (r_symndx < symtab_hdr->sh_info)
+ {
+ sym = local_syms + r_symndx;
+ sec = local_sections[r_symndx];
+ sym_name = bfd_elf_sym_name (input_bfd, symtab_hdr, sym, sec);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
+ }
+ else
+ {
+ RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
+ r_symndx, symtab_hdr, sym_hashes,
+ h, sec, relocation,
+ unresolved_reloc, warned);
+ sym_name = h->root.root.string;
+ }
+
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
+ if (unresolved_reloc)
+ {
+ (*_bfd_error_handler)
+ (_("%B(%s+0x%lx): unresolvable %s relocation against symbol `%s'"),
+ input_bfd,
+ bfd_get_section_name (input_bfd, input_section),
+ (long) rel->r_offset,
+ howto->name,
+ sym_name);
+ ret = FALSE;
+ }
+
+ /* If this symbol is in an overlay area, we may need to relocate
+ to the overlay stub. */
+ addend = rel->r_addend;
+ branch = (is_branch (contents + rel->r_offset)
+ || is_hint (contents + rel->r_offset));
+ if (needs_ovl_stub (sym_name, sec, input_section, htab, branch))
+ {
+ char *stub_name;
+ struct spu_stub_hash_entry *sh;
+
+ stub_name = spu_stub_name (sec, h, rel);
+ if (stub_name == NULL)
+ return FALSE;
+
+ sh = (struct spu_stub_hash_entry *)
+ bfd_hash_lookup (&htab->stub_hash_table, stub_name, FALSE, FALSE);
+ if (sh != NULL)
+ {
+ relocation = (htab->stub->output_section->vma
+ + htab->stub->output_offset
+ + sh->off);
+ addend = 0;
+ }
+ free (stub_name);
+ }
+
+ r = _bfd_final_link_relocate (howto,
+ input_bfd,
+ input_section,
+ contents,
+ rel->r_offset, relocation, addend);
+
+ if (r != bfd_reloc_ok)
+ {
+ const char *msg = (const char *) 0;
+
+ switch (r)
+ {
+ case bfd_reloc_overflow:
+ if (!((*info->callbacks->reloc_overflow)
+ (info, (h ? &h->root : NULL), sym_name, howto->name,
+ (bfd_vma) 0, input_bfd, input_section, rel->r_offset)))
+ return FALSE;
+ break;
+
+ case bfd_reloc_undefined:
+ if (!((*info->callbacks->undefined_symbol)
+ (info, sym_name, input_bfd, input_section,
+ rel->r_offset, TRUE)))
+ return FALSE;
+ break;
+
+ case bfd_reloc_outofrange:
+ msg = _("internal error: out of range error");
+ goto common_error;
+
+ case bfd_reloc_notsupported:
+ msg = _("internal error: unsupported relocation error");
+ goto common_error;
+
+ case bfd_reloc_dangerous:
+ msg = _("internal error: dangerous error");
+ goto common_error;
+
+ default:
+ msg = _("internal error: unknown error");
+ /* fall through */
+
+ common_error:
+ if (!((*info->callbacks->warning)
+ (info, msg, sym_name, input_bfd, input_section,
+ rel->r_offset)))
+ return FALSE;
+ break;
+ }
+ }
+ }
+
+ if (ret
+ && emit_these_relocs
+ && !info->relocatable
+ && !info->emitrelocations)
+ {
+ Elf_Internal_Rela *wrel;
+ Elf_Internal_Shdr *rel_hdr;
+
+ wrel = rel = relocs;
+ relend = relocs + input_section->reloc_count;
+ for (; rel < relend; rel++)
+ {
+ int r_type;
+
+ r_type = ELF32_R_TYPE (rel->r_info);
+ if (r_type == R_SPU_PPU32 || r_type == R_SPU_PPU64)
+ *wrel++ = *rel;
+ }
+ input_section->reloc_count = wrel - relocs;
+ /* Backflips for _bfd_elf_link_output_relocs. */
+ rel_hdr = &elf_section_data (input_section)->rel_hdr;
+ rel_hdr->sh_size = input_section->reloc_count * rel_hdr->sh_entsize;
+ ret = 2;
+ }
+
+ return ret;
+}
+
+/* Adjust _SPUEAR_ syms to point at their overlay stubs. */
+
+static bfd_boolean
+spu_elf_output_symbol_hook (struct bfd_link_info *info,
+ const char *sym_name ATTRIBUTE_UNUSED,
+ Elf_Internal_Sym *sym,
+ asection *sym_sec ATTRIBUTE_UNUSED,
+ struct elf_link_hash_entry *h)
+{
+ struct spu_link_hash_table *htab = spu_hash_table (info);
+
+ if (!info->relocatable
+ && htab->num_overlays != 0
+ && h != NULL
+ && (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && h->def_regular
+ && strncmp (h->root.root.string, "_SPUEAR_", 8) == 0)
+ {
+ static Elf_Internal_Rela zero_rel;
+ char *stub_name = spu_stub_name (h->root.u.def.section, h, &zero_rel);
+ struct spu_stub_hash_entry *sh;
+
+ if (stub_name == NULL)
+ return FALSE;
+ sh = (struct spu_stub_hash_entry *)
+ bfd_hash_lookup (&htab->stub_hash_table, stub_name, FALSE, FALSE);
+ free (stub_name);
+ if (sh == NULL)
+ return TRUE;
+ sym->st_shndx
+ = _bfd_elf_section_from_bfd_section (htab->stub->output_section->owner,
+ htab->stub->output_section);
+ sym->st_value = (htab->stub->output_section->vma
+ + htab->stub->output_offset
+ + sh->off);
+ }
+
+ return TRUE;
+}
+
+static int spu_plugin = 0;
+
+void
+spu_elf_plugin (int val)
+{
+ spu_plugin = val;
+}
+
+/* Set ELF header e_type for plugins. */
+
+static void
+spu_elf_post_process_headers (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
+{
+ if (spu_plugin)
+ {
+ Elf_Internal_Ehdr *i_ehdrp = elf_elfheader (abfd);
+
+ i_ehdrp->e_type = ET_DYN;
+ }
+}
+
+/* We may add an extra PT_LOAD segment for .toe. We also need extra
+ segments for overlays. */
+
+static int
+spu_elf_additional_program_headers (bfd *abfd, struct bfd_link_info *info)
+{
+ struct spu_link_hash_table *htab = spu_hash_table (info);
+ int extra = htab->num_overlays;
+ asection *sec;
+
+ if (extra)
+ ++extra;
+
+ sec = bfd_get_section_by_name (abfd, ".toe");
+ if (sec != NULL && (sec->flags & SEC_LOAD) != 0)
+ ++extra;
+
+ return extra;
+}
+
+/* Remove .toe section from other PT_LOAD segments and put it in
+ a segment of its own. Put overlays in separate segments too. */
+
+static bfd_boolean
+spu_elf_modify_segment_map (bfd *abfd, struct bfd_link_info *info)
+{
+ asection *toe, *s;
+ struct elf_segment_map *m;
+ unsigned int i;
+
+ if (info == NULL)
+ return TRUE;
+
+ toe = bfd_get_section_by_name (abfd, ".toe");
+ for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
+ if (m->p_type == PT_LOAD && m->count > 1)
+ for (i = 0; i < m->count; i++)
+ if ((s = m->sections[i]) == toe
+ || spu_elf_section_data (s)->ovl_index != 0)
+ {
+ struct elf_segment_map *m2;
+ bfd_vma amt;
+
+ if (i + 1 < m->count)
+ {
+ amt = sizeof (struct elf_segment_map);
+ amt += (m->count - (i + 2)) * sizeof (m->sections[0]);
+ m2 = bfd_zalloc (abfd, amt);
+ if (m2 == NULL)
+ return FALSE;
+ m2->count = m->count - (i + 1);
+ memcpy (m2->sections, m->sections + i + 1,
+ m2->count * sizeof (m->sections[0]));
+ m2->p_type = PT_LOAD;
+ m2->next = m->next;
+ m->next = m2;
+ }
+ m->count = 1;
+ if (i != 0)
+ {
+ m->count = i;
+ amt = sizeof (struct elf_segment_map);
+ m2 = bfd_zalloc (abfd, amt);
+ if (m2 == NULL)
+ return FALSE;
+ m2->p_type = PT_LOAD;
+ m2->count = 1;
+ m2->sections[0] = s;
+ m2->next = m->next;
+ m->next = m2;
+ }
+ break;
+ }
+
+ return TRUE;
+}
+
+/* Check that all loadable section VMAs lie in the range
+ LO .. HI inclusive. */
+
+asection *
+spu_elf_check_vma (bfd *abfd, bfd_vma lo, bfd_vma hi)
+{
+ struct elf_segment_map *m;
+ unsigned int i;
+
+ for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
+ if (m->p_type == PT_LOAD)
+ for (i = 0; i < m->count; i++)
+ if (m->sections[i]->size != 0
+ && (m->sections[i]->vma < lo
+ || m->sections[i]->vma > hi
+ || m->sections[i]->vma + m->sections[i]->size - 1 > hi))
+ return m->sections[i];
+
+ return NULL;
+}
+
+/* Tweak the section type of .note.spu_name. */
+
+static bfd_boolean
+spu_elf_fake_sections (bfd *obfd ATTRIBUTE_UNUSED,
+ Elf_Internal_Shdr *hdr,
+ asection *sec)
+{
+ if (strcmp (sec->name, SPU_PTNOTE_SPUNAME) == 0)
+ hdr->sh_type = SHT_NOTE;
+ return TRUE;
+}
+
+/* Tweak phdrs before writing them out. */
+
+static int
+spu_elf_modify_program_headers (bfd *abfd, struct bfd_link_info *info)
+{
+ const struct elf_backend_data *bed;
+ struct elf_obj_tdata *tdata;
+ Elf_Internal_Phdr *phdr, *last;
+ struct spu_link_hash_table *htab;
+ unsigned int count;
+ unsigned int i;
+
+ if (info == NULL)
+ return TRUE;
+
+ bed = get_elf_backend_data (abfd);
+ tdata = elf_tdata (abfd);
+ phdr = tdata->phdr;
+ count = tdata->program_header_size / bed->s->sizeof_phdr;
+ htab = spu_hash_table (info);
+ if (htab->num_overlays != 0)
+ {
+ struct elf_segment_map *m;
+ unsigned int o;
+
+ for (i = 0, m = elf_tdata (abfd)->segment_map; m; ++i, m = m->next)
+ if (m->count != 0
+ && (o = spu_elf_section_data (m->sections[0])->ovl_index) != 0)
+ {
+ /* Mark this as an overlay header. */
+ phdr[i].p_flags |= PF_OVERLAY;
+
+ if (htab->ovtab != NULL && htab->ovtab->size != 0)
+ {
+ bfd_byte *p = htab->ovtab->contents;
+ unsigned int off = (o - 1) * 16 + 8;
+
+ /* Write file_off into _ovly_table. */
+ bfd_put_32 (htab->ovtab->owner, phdr[i].p_offset, p + off);
+ }
+ }
+ }
+
+ /* Round up p_filesz and p_memsz of PT_LOAD segments to multiples
+ of 16. This should always be possible when using the standard
+ linker scripts, but don't create overlapping segments if
+ someone is playing games with linker scripts. */
+ last = NULL;
+ for (i = count; i-- != 0; )
+ if (phdr[i].p_type == PT_LOAD)
+ {
+ unsigned adjust;
+
+ adjust = -phdr[i].p_filesz & 15;
+ if (adjust != 0
+ && last != NULL
+ && phdr[i].p_offset + phdr[i].p_filesz > last->p_offset - adjust)
+ break;
+
+ adjust = -phdr[i].p_memsz & 15;
+ if (adjust != 0
+ && last != NULL
+ && phdr[i].p_filesz != 0
+ && phdr[i].p_vaddr + phdr[i].p_memsz > last->p_vaddr - adjust
+ && phdr[i].p_vaddr + phdr[i].p_memsz <= last->p_vaddr)
+ break;
+
+ if (phdr[i].p_filesz != 0)
+ last = &phdr[i];
+ }
+
+ if (i == (unsigned int) -1)
+ for (i = count; i-- != 0; )
+ if (phdr[i].p_type == PT_LOAD)
+ {
+ unsigned adjust;
+
+ adjust = -phdr[i].p_filesz & 15;
+ phdr[i].p_filesz += adjust;
+
+ adjust = -phdr[i].p_memsz & 15;
+ phdr[i].p_memsz += adjust;
+ }
+
+ return TRUE;
+}
+
+#define TARGET_BIG_SYM bfd_elf32_spu_vec
+#define TARGET_BIG_NAME "elf32-spu"
+#define ELF_ARCH bfd_arch_spu
+#define ELF_MACHINE_CODE EM_SPU
+/* This matches the alignment need for DMA. */
+#define ELF_MAXPAGESIZE 0x80
+#define elf_backend_rela_normal 1
+#define elf_backend_can_gc_sections 1
+
+#define bfd_elf32_bfd_reloc_type_lookup spu_elf_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup spu_elf_reloc_name_lookup
+#define elf_info_to_howto spu_elf_info_to_howto
+#define elf_backend_count_relocs spu_elf_count_relocs
+#define elf_backend_relocate_section spu_elf_relocate_section
+#define elf_backend_symbol_processing spu_elf_backend_symbol_processing
+#define elf_backend_link_output_symbol_hook spu_elf_output_symbol_hook
+#define bfd_elf32_new_section_hook spu_elf_new_section_hook
+#define bfd_elf32_bfd_link_hash_table_create spu_elf_link_hash_table_create
+#define bfd_elf32_bfd_link_hash_table_free spu_elf_link_hash_table_free
+
+#define elf_backend_additional_program_headers spu_elf_additional_program_headers
+#define elf_backend_modify_segment_map spu_elf_modify_segment_map
+#define elf_backend_modify_program_headers spu_elf_modify_program_headers
+#define elf_backend_post_process_headers spu_elf_post_process_headers
+#define elf_backend_fake_sections spu_elf_fake_sections
+#define elf_backend_special_sections spu_elf_special_sections
+#define bfd_elf32_bfd_final_link spu_elf_final_link
+
+#include "elf32-target.h"
diff --git a/bfd/elf32-spu.h b/bfd/elf32-spu.h
new file mode 100644
index 000000000000..b74c3102b8be
--- /dev/null
+++ b/bfd/elf32-spu.h
@@ -0,0 +1,57 @@
+/* SPU specific support for 32-bit ELF.
+
+ Copyright 2006, 2007 Free Software Foundation, Inc.
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+/* Extra info kept for SPU sections. */
+
+struct spu_elf_stack_info;
+
+struct _spu_elf_section_data
+{
+ struct bfd_elf_section_data elf;
+
+ /* Stack analysis info kept for this section. */
+
+ struct spu_elf_stack_info *stack_info;
+
+ /* Non-zero for overlay output sections. */
+ unsigned int ovl_index;
+};
+
+#define spu_elf_section_data(sec) \
+ ((struct _spu_elf_section_data *) elf_section_data (sec))
+
+struct _ovl_stream
+{
+ const void *start;
+ const void *end;
+};
+
+extern void spu_elf_plugin (int);
+extern bfd_boolean spu_elf_open_builtin_lib (bfd **,
+ const struct _ovl_stream *);
+extern bfd_boolean spu_elf_create_sections (bfd *,
+ struct bfd_link_info *, int, int);
+extern bfd_boolean spu_elf_find_overlays (bfd *, struct bfd_link_info *);
+extern bfd_boolean spu_elf_size_stubs (bfd *, struct bfd_link_info *, int, int,
+ asection **, asection **,
+ asection **);
+extern bfd_boolean spu_elf_build_stubs (struct bfd_link_info *, int,
+ asection *);
+extern asection *spu_elf_check_vma (bfd *, bfd_vma, bfd_vma);
diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c
index e2c29ee19220..e5f283a9d0c3 100644
--- a/bfd/elf32-v850.c
+++ b/bfd/elf32-v850.c
@@ -1,6 +1,6 @@
/* V850-specific support for 32-bit ELF
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+ 2006, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -22,8 +22,8 @@
/* XXX FIXME: This code is littered with 32bit int, 16bit short, 8bit char
dependencies. As is the gas & simulator code for the v850. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -33,6 +33,8 @@
/* Sign-extend a 24-bit number. */
#define SEXT24(x) ((((x) & 0xffffff) ^ 0x800000) - 0x800000)
+static reloc_howto_type v850_elf_howto_table[];
+
/* Look through the relocs for a section during the first phase, and
allocate space in the global offset table or procedure linkage
table. */
@@ -1337,6 +1339,22 @@ v850_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return NULL;
}
+
+static reloc_howto_type *
+v850_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (v850_elf_howto_table) / sizeof (v850_elf_howto_table[0]);
+ i++)
+ if (v850_elf_howto_table[i].name != NULL
+ && strcasecmp (v850_elf_howto_table[i].name, r_name) == 0)
+ return &v850_elf_howto_table[i];
+
+ return NULL;
+}
/* Set the howto pointer for an V850 ELF reloc. */
@@ -1565,9 +1583,6 @@ v850_elf_relocate_section (bfd *output_bfd,
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
- if (info->relocatable)
- return TRUE;
-
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
@@ -1596,7 +1611,6 @@ v850_elf_relocate_section (bfd *output_bfd,
|| r_type == R_V850_GNU_VTINHERIT)
continue;
- /* This is a final link. */
howto = v850_elf_howto_table + r_type;
h = NULL;
sym = NULL;
@@ -1629,6 +1643,20 @@ v850_elf_relocate_section (bfd *output_bfd,
unresolved_reloc, warned);
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
/* FIXME: We should use the addend, but the COFF relocations don't. */
r = v850_elf_final_link_relocate (howto, input_bfd, output_bfd,
input_section,
@@ -1709,50 +1737,22 @@ v850_elf_relocate_section (bfd *output_bfd,
return TRUE;
}
-static bfd_boolean
-v850_elf_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
- asection *sec ATTRIBUTE_UNUSED,
- const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED)
-{
- /* No got and plt entries for v850-elf. */
- return TRUE;
-}
-
static asection *
v850_elf_gc_mark_hook (asection *sec,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info,
Elf_Internal_Rela *rel,
struct elf_link_hash_entry *h,
Elf_Internal_Sym *sym)
{
if (h != NULL)
- {
- switch (ELF32_R_TYPE (rel->r_info))
+ switch (ELF32_R_TYPE (rel->r_info))
{
case R_V850_GNU_VTINHERIT:
case R_V850_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
+ return NULL;
+ }
- return NULL;
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
/* Set the right machine number. */
@@ -2115,6 +2115,12 @@ v850_elf_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED,
sym->st_shndx = SHN_V850_ZCOMMON;
}
+ /* The price we pay for using h->other unused bits as flags in the
+ linker is cleaning up after ourselves. */
+
+ sym->st_other &= ~(V850_OTHER_SDA | V850_OTHER_ZDA | V850_OTHER_TDA
+ | V850_OTHER_ERROR);
+
return TRUE;
}
@@ -3026,33 +3032,32 @@ v850_elf_relax_section (bfd *abfd,
static const struct bfd_elf_special_section v850_elf_special_sections[] =
{
- { ".call_table_data", 16, 0, SHT_PROGBITS, (SHF_ALLOC
- + SHF_WRITE) },
- { ".call_table_text", 16, 0, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE
- + SHF_EXECINSTR) },
- { ".rosdata", 8, -2, SHT_PROGBITS, (SHF_ALLOC
- + SHF_V850_GPREL) },
- { ".rozdata", 8, -2, SHT_PROGBITS, (SHF_ALLOC
- + SHF_V850_R0REL) },
- { ".sbss", 5, -2, SHT_NOBITS, (SHF_ALLOC + SHF_WRITE
- + SHF_V850_GPREL) },
- { ".scommon", 8, -2, SHT_V850_SCOMMON, (SHF_ALLOC + SHF_WRITE
- + SHF_V850_GPREL) },
- { ".sdata", 6, -2, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE
- + SHF_V850_GPREL) },
- { ".tbss", 5, -2, SHT_NOBITS, (SHF_ALLOC + SHF_WRITE
- + SHF_V850_EPREL) },
- { ".tcommon", 8, -2, SHT_V850_TCOMMON, (SHF_ALLOC + SHF_WRITE
- + SHF_V850_R0REL) },
- { ".tdata", 6, -2, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE
- + SHF_V850_EPREL) },
- { ".zbss", 5, -2, SHT_NOBITS, (SHF_ALLOC + SHF_WRITE
- + SHF_V850_R0REL) },
- { ".zcommon", 8, -2, SHT_V850_ZCOMMON, (SHF_ALLOC + SHF_WRITE
- + SHF_V850_R0REL) },
- { ".zdata", 6, -2, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE
- + SHF_V850_R0REL) },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".call_table_data"), 0, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE) },
+ { STRING_COMMA_LEN (".call_table_text"), 0, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE
+ + SHF_EXECINSTR) },
+ { STRING_COMMA_LEN (".rosdata"), -2, SHT_PROGBITS, (SHF_ALLOC
+ + SHF_V850_GPREL) },
+ { STRING_COMMA_LEN (".rozdata"), -2, SHT_PROGBITS, (SHF_ALLOC
+ + SHF_V850_R0REL) },
+ { STRING_COMMA_LEN (".sbss"), -2, SHT_NOBITS, (SHF_ALLOC + SHF_WRITE
+ + SHF_V850_GPREL) },
+ { STRING_COMMA_LEN (".scommon"), -2, SHT_V850_SCOMMON, (SHF_ALLOC + SHF_WRITE
+ + SHF_V850_GPREL) },
+ { STRING_COMMA_LEN (".sdata"), -2, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE
+ + SHF_V850_GPREL) },
+ { STRING_COMMA_LEN (".tbss"), -2, SHT_NOBITS, (SHF_ALLOC + SHF_WRITE
+ + SHF_V850_EPREL) },
+ { STRING_COMMA_LEN (".tcommon"), -2, SHT_V850_TCOMMON, (SHF_ALLOC + SHF_WRITE
+ + SHF_V850_R0REL) },
+ { STRING_COMMA_LEN (".tdata"), -2, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE
+ + SHF_V850_EPREL) },
+ { STRING_COMMA_LEN (".zbss"), -2, SHT_NOBITS, (SHF_ALLOC + SHF_WRITE
+ + SHF_V850_R0REL) },
+ { STRING_COMMA_LEN (".zcommon"), -2, SHT_V850_ZCOMMON, (SHF_ALLOC + SHF_WRITE
+ + SHF_V850_R0REL) },
+ { STRING_COMMA_LEN (".zdata"), -2, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE
+ + SHF_V850_R0REL) },
+ { NULL, 0, 0, 0, 0 }
};
#define TARGET_LITTLE_SYM bfd_elf32_v850_vec
@@ -3077,7 +3082,6 @@ static const struct bfd_elf_special_section v850_elf_special_sections[] =
#define elf_backend_section_from_shdr v850_elf_section_from_shdr
#define elf_backend_fake_sections v850_elf_fake_sections
#define elf_backend_gc_mark_hook v850_elf_gc_mark_hook
-#define elf_backend_gc_sweep_hook v850_elf_gc_sweep_hook
#define elf_backend_special_sections v850_elf_special_sections
#define elf_backend_can_gc_sections 1
@@ -3085,6 +3089,7 @@ static const struct bfd_elf_special_section v850_elf_special_sections[] =
#define bfd_elf32_bfd_is_local_label_name v850_elf_is_local_label_name
#define bfd_elf32_bfd_reloc_type_lookup v850_elf_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup v850_elf_reloc_name_lookup
#define bfd_elf32_bfd_merge_private_bfd_data v850_elf_merge_private_bfd_data
#define bfd_elf32_bfd_set_private_flags v850_elf_set_private_flags
#define bfd_elf32_bfd_print_private_bfd_data v850_elf_print_private_bfd_data
diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c
index bf481e459e75..aac81c11e5d0 100644
--- a/bfd/elf32-vax.c
+++ b/bfd/elf32-vax.c
@@ -1,6 +1,6 @@
/* VAX series support for 32-bit ELF
Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005, 2006 Free Software Foundation, Inc.
+ 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Contributed by Matt Thomas <matt@3am-software.com>.
This file is part of BFD, the Binary File Descriptor library.
@@ -19,8 +19,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -34,13 +34,6 @@ static struct bfd_hash_entry *elf_vax_link_hash_newfunc (struct bfd_hash_entry *
static struct bfd_link_hash_table *elf_vax_link_hash_table_create (bfd *);
static bfd_boolean elf_vax_check_relocs (bfd *, struct bfd_link_info *,
asection *, const Elf_Internal_Rela *);
-static asection *elf_vax_gc_mark_hook (asection *, struct bfd_link_info *,
- Elf_Internal_Rela *,
- struct elf_link_hash_entry *,
- Elf_Internal_Sym *);
-static bfd_boolean elf_vax_gc_sweep_hook (bfd *, struct bfd_link_info *,
- asection *,
- const Elf_Internal_Rela *);
static bfd_boolean elf_vax_adjust_dynamic_symbol (struct bfd_link_info *,
struct elf_link_hash_entry *);
static bfd_boolean elf_vax_size_dynamic_sections (bfd *, struct bfd_link_info *);
@@ -329,7 +322,22 @@ reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, bfd_reloc_code_real_type code)
return 0;
}
+static reloc_howto_type *
+reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0; i < sizeof (howto_table) / sizeof (howto_table[0]); i++)
+ if (howto_table[i].name != NULL
+ && strcasecmp (howto_table[i].name, r_name) == 0)
+ return &howto_table[i];
+
+ return NULL;
+}
+
#define bfd_elf32_bfd_reloc_type_lookup reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup reloc_name_lookup
#define ELF_ARCH bfd_arch_vax
/* end code generated by elf.el */
@@ -738,7 +746,7 @@ elf_vax_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (abfd, sec),
name + 5) == 0);
@@ -829,38 +837,20 @@ elf_vax_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
static asection *
elf_vax_gc_mark_hook (asection *sec,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info,
Elf_Internal_Rela *rel,
struct elf_link_hash_entry *h,
Elf_Internal_Sym *sym)
{
if (h != NULL)
- {
- switch (ELF32_R_TYPE (rel->r_info))
- {
- case R_VAX_GNU_VTINHERIT:
- case R_VAX_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- default:
- break;
-
- 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;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
-
- return NULL;
+ switch (ELF32_R_TYPE (rel->r_info))
+ {
+ case R_VAX_GNU_VTINHERIT:
+ case R_VAX_GNU_VTENTRY:
+ return NULL;
+ }
+
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
/* Update the got entry reference counts for the section being removed. */
@@ -935,7 +925,6 @@ elf_vax_adjust_dynamic_symbol (info, h)
{
bfd *dynobj;
asection *s;
- unsigned int power_of_two;
dynobj = elf_hash_table (info)->dynobj;
@@ -1089,28 +1078,7 @@ elf_vax_adjust_dynamic_symbol (info, h)
h->needs_copy = 1;
}
- /* We need to figure out the alignment required for this symbol. I
- have no idea how ELF linkers handle this. */
- power_of_two = bfd_log2 (h->size);
- if (power_of_two > 3)
- power_of_two = 3;
-
- /* Apply the required alignment. */
- s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two));
- if (power_of_two > bfd_get_section_alignment (dynobj, s))
- {
- if (!bfd_set_section_alignment (dynobj, s, power_of_two))
- return FALSE;
- }
-
- /* Define the symbol as being at this point in the section. */
- h->root.u.def.section = s;
- h->root.u.def.value = s->size;
-
- /* Increment the section size to make room for the symbol. */
- s->size += h->size;
-
- return TRUE;
+ return _bfd_elf_adjust_dynamic_copy (h, s);
}
/* Set the sizes of the dynamic sections. */
@@ -1194,7 +1162,7 @@ elf_vax_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
/* Remember whether there is a PLT. */
plt = s->size != 0;
}
- else if (strncmp (name, ".rela", 5) == 0)
+ else if (CONST_STRNEQ (name, ".rela"))
{
if (s->size != 0)
{
@@ -1226,7 +1194,7 @@ elf_vax_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
s->reloc_count = 0;
}
}
- else if (strncmp (name, ".got", 4) != 0
+ else if (! CONST_STRNEQ (name, ".got")
&& strcmp (name, ".dynbss") != 0)
{
/* It's not one of our sections, so don't allocate space. */
@@ -1402,9 +1370,6 @@ elf_vax_relocate_section (bfd *output_bfd,
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);
@@ -1436,7 +1401,6 @@ elf_vax_relocate_section (bfd *output_bfd,
}
howto = howto_table + r_type;
- /* This is a final link. */
r_symndx = ELF32_R_SYM (rel->r_info);
h = NULL;
sym = NULL;
@@ -1492,6 +1456,20 @@ elf_vax_relocate_section (bfd *output_bfd,
relocation = 0;
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
switch (r_type)
{
case R_VAX_GOT32:
@@ -1625,8 +1603,9 @@ elf_vax_relocate_section (bfd *output_bfd,
&& ((r_type != R_VAX_PC8
&& r_type != R_VAX_PC16
&& r_type != R_VAX_PC32)
- || (!info->symbolic
- || !h->def_regular)))
+ || ((input_section->flags & SEC_CODE)
+ && (!info->symbolic
+ || (!h->def_regular && h->type != STT_SECTION)))))
{
Elf_Internal_Rela outrel;
bfd_byte *loc;
@@ -1646,7 +1625,7 @@ elf_vax_relocate_section (bfd *output_bfd,
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (input_bfd,
input_section),
name + 5) == 0);
@@ -1705,9 +1684,21 @@ elf_vax_relocate_section (bfd *output_bfd,
{
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);
+ if (indx == 0)
+ {
+ struct elf_link_hash_table *htab;
+ htab = elf_hash_table (info);
+ osec = htab->text_index_section;
+ indx = elf_section_data (osec)->dynindx;
+ }
+ BFD_ASSERT (indx != 0);
}
outrel.r_info = ELF32_R_INFO (indx, r_type);
@@ -2087,6 +2078,7 @@ elf_vax_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
elf_vax_adjust_dynamic_symbol
#define elf_backend_size_dynamic_sections \
elf_vax_size_dynamic_sections
+#define elf_backend_init_index_section _bfd_elf_init_1_index_section
#define elf_backend_relocate_section elf_vax_relocate_section
#define elf_backend_finish_dynamic_symbol \
elf_vax_finish_dynamic_symbol
diff --git a/bfd/elf32-xc16x.c b/bfd/elf32-xc16x.c
index 1824302e8850..21d20a19a570 100644
--- a/bfd/elf32-xc16x.c
+++ b/bfd/elf32-xc16x.c
@@ -1,5 +1,5 @@
/* Infineon XC16X-specific support for 16-bit ELF.
- Copyright 2006 Free Software Foundation, Inc.
+ Copyright 2006, 2007 Free Software Foundation, Inc.
Contributed by KPIT Cummins Infosystems
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@
along with this program; if not, write to the Free Software
Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/xc16x.h"
@@ -205,6 +205,22 @@ xc16x_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return NULL;
}
+static reloc_howto_type *
+xc16x_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (xc16x_elf_howto_table) / sizeof (xc16x_elf_howto_table[0]);
+ i++)
+ if (xc16x_elf_howto_table[i].name != NULL
+ && strcasecmp (xc16x_elf_howto_table[i].name, r_name) == 0)
+ return &xc16x_elf_howto_table[i];
+
+ return NULL;
+}
+
/* For a particular operand this function is
called to finalise the type of relocation. */
@@ -328,9 +344,6 @@ elf32_xc16x_relocate_section (bfd *output_bfd,
struct elf_link_hash_entry **sym_hashes;
Elf_Internal_Rela *rel, *relend;
- if (info->relocatable)
- return TRUE;
-
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
@@ -368,11 +381,27 @@ elf32_xc16x_relocate_section (bfd *output_bfd,
unresolved_reloc, warned);
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ reloc_howto_type *howto;
+ howto = xc16x_reloc_type_lookup (input_bfd, r_type);
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
r = elf32_xc16x_final_link_relocate (r_type, input_bfd, output_bfd,
- input_section,
- contents, rel->r_offset,
- relocation, rel->r_addend,
- info, sec, h == NULL);
+ input_section,
+ contents, rel->r_offset,
+ relocation, rel->r_addend,
+ info, sec, h == NULL);
}
return TRUE;
@@ -441,6 +470,7 @@ elf32_xc16x_object_p (bfd *abfd)
#define elf_backend_object_p elf32_xc16x_object_p
#define elf_backend_can_gc_sections 1
#define bfd_elf32_bfd_reloc_type_lookup xc16x_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup xc16x_reloc_name_lookup
#define elf_info_to_howto elf32_xc16x_info_to_howto
#define elf_info_to_howto_rel elf32_xc16x_info_to_howto
#define elf_backend_relocate_section elf32_xc16x_relocate_section
diff --git a/bfd/elf32-xstormy16.c b/bfd/elf32-xstormy16.c
index 1341a4405ec9..0ef9afd26ceb 100644
--- a/bfd/elf32-xstormy16.c
+++ b/bfd/elf32-xstormy16.c
@@ -1,5 +1,6 @@
/* Xstormy16-specific support for 32-bit ELF.
- Copyright 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +19,8 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/xstormy16.h"
@@ -348,6 +349,31 @@ xstormy16_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
return NULL;
}
+static reloc_howto_type *
+xstormy16_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (xstormy16_elf_howto_table)
+ / sizeof (xstormy16_elf_howto_table[0]));
+ i++)
+ if (xstormy16_elf_howto_table[i].name != NULL
+ && strcasecmp (xstormy16_elf_howto_table[i].name, r_name) == 0)
+ return &xstormy16_elf_howto_table[i];
+
+ for (i = 0;
+ i < (sizeof (xstormy16_elf_howto_table2)
+ / sizeof (xstormy16_elf_howto_table2[0]));
+ i++)
+ if (xstormy16_elf_howto_table2[i].name != NULL
+ && strcasecmp (xstormy16_elf_howto_table2[i].name, r_name) == 0)
+ return &xstormy16_elf_howto_table2[i];
+
+ return NULL;
+}
+
/* Set the howto pointer for an XSTORMY16 ELF reloc. */
static void
@@ -754,9 +780,6 @@ xstormy16_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNU
bfd *dynobj;
asection *splt;
- if (info->relocatable)
- return TRUE;
-
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
relend = relocs + input_section->reloc_count;
@@ -806,6 +829,20 @@ xstormy16_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNU
unresolved_reloc, warned);
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
if (h != NULL)
name = h->root.root.string;
else
@@ -967,50 +1004,21 @@ xstormy16_elf_finish_dynamic_sections (bfd *abfd ATTRIBUTE_UNUSED,
relocation. */
static asection *
-xstormy16_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)
+xstormy16_elf_gc_mark_hook (asection *sec,
+ struct bfd_link_info *info,
+ Elf_Internal_Rela *rel,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
{
if (h != NULL)
- {
- switch (ELF32_R_TYPE (rel->r_info))
- {
- case R_XSTORMY16_GNU_VTINHERIT:
- case R_XSTORMY16_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
-
- return NULL;
-}
-
-/* Update the got entry reference counts for the section being removed. */
-
-static bfd_boolean
-xstormy16_elf_gc_sweep_hook (bfd * abfd ATTRIBUTE_UNUSED,
- struct bfd_link_info * info ATTRIBUTE_UNUSED,
- asection * sec ATTRIBUTE_UNUSED,
- const Elf_Internal_Rela * relocs ATTRIBUTE_UNUSED)
-{
- return TRUE;
+ switch (ELF32_R_TYPE (rel->r_info))
+ {
+ case R_XSTORMY16_GNU_VTINHERIT:
+ case R_XSTORMY16_GNU_VTENTRY:
+ return NULL;
+ }
+
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
#define ELF_ARCH bfd_arch_xstormy16
@@ -1024,10 +1032,11 @@ xstormy16_elf_gc_sweep_hook (bfd * abfd ATTRIBUTE_UNUSED,
#define elf_info_to_howto xstormy16_info_to_howto_rela
#define elf_backend_relocate_section xstormy16_elf_relocate_section
#define elf_backend_gc_mark_hook xstormy16_elf_gc_mark_hook
-#define elf_backend_gc_sweep_hook xstormy16_elf_gc_sweep_hook
#define elf_backend_check_relocs xstormy16_elf_check_relocs
#define elf_backend_always_size_sections \
xstormy16_elf_always_size_sections
+#define elf_backend_omit_section_dynsym \
+ ((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) bfd_true)
#define elf_backend_finish_dynamic_sections \
xstormy16_elf_finish_dynamic_sections
@@ -1035,6 +1044,8 @@ xstormy16_elf_gc_sweep_hook (bfd * abfd ATTRIBUTE_UNUSED,
#define elf_backend_rela_normal 1
#define bfd_elf32_bfd_reloc_type_lookup xstormy16_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup \
+ xstormy16_reloc_name_lookup
#define bfd_elf32_bfd_relax_section xstormy16_elf_relax_section
#include "elf32-target.h"
diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
index 7a41d6285771..a8ec37e5298d 100644
--- a/bfd/elf32-xtensa.c
+++ b/bfd/elf32-xtensa.c
@@ -1,5 +1,5 @@
/* Xtensa-specific support for 32-bit ELF.
- Copyright 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include <stdarg.h>
#include <strings.h>
@@ -35,7 +35,7 @@
/* Local helper functions. */
-static bfd_boolean add_extra_plt_sections (bfd *, int);
+static bfd_boolean add_extra_plt_sections (struct bfd_link_info *, int);
static char *vsprint_msg (const char *, const char *, int, ...) ATTRIBUTE_PRINTF(2,4);
static bfd_reloc_status_type bfd_elf_xtensa_reloc
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
@@ -94,8 +94,8 @@ static Elf_Internal_Sym *retrieve_local_syms (bfd *);
/* Miscellaneous utility functions. */
-static asection *elf_xtensa_get_plt_section (bfd *, int);
-static asection *elf_xtensa_get_gotplt_section (bfd *, int);
+static asection *elf_xtensa_get_plt_section (struct bfd_link_info *, int);
+static asection *elf_xtensa_get_gotplt_section (struct bfd_link_info *, int);
static asection *get_elf_r_symndx_section (bfd *, unsigned long);
static struct elf_link_hash_entry *get_elf_r_symndx_hash_entry
(bfd *, unsigned long);
@@ -103,10 +103,12 @@ static bfd_vma get_elf_r_symndx_offset (bfd *, unsigned long);
static bfd_boolean is_reloc_sym_weak (bfd *, Elf_Internal_Rela *);
static bfd_boolean pcrel_reloc_fits (xtensa_opcode, int, bfd_vma, bfd_vma);
static bfd_boolean xtensa_is_property_section (asection *);
+static bfd_boolean xtensa_is_insntable_section (asection *);
static bfd_boolean xtensa_is_littable_section (asection *);
+static bfd_boolean xtensa_is_proptable_section (asection *);
static int internal_reloc_compare (const void *, const void *);
static int internal_reloc_matches (const void *, const void *);
-extern char *xtensa_get_property_section_name (asection *, const char *);
+extern asection *xtensa_get_property_section (asection *, const char *);
static flagword xtensa_get_property_predef_flags (asection *);
/* Other functions called directly by the linker. */
@@ -132,16 +134,6 @@ int elf32xtensa_size_opt;
typedef struct xtensa_relax_info_struct xtensa_relax_info;
-/* Total count of PLT relocations seen during check_relocs.
- The actual PLT code must be split into multiple sections and all
- the sections have to be created before size_dynamic_sections,
- where we figure out the exact number of PLT entries that will be
- needed. It is OK if this count is an overestimate, e.g., some
- relocations may be removed by GC. */
-
-static int plt_reloc_count = 0;
-
-
/* The GNU tools do not easily allow extending interfaces to pass around
the pointer to the Xtensa ISA information, so instead we add a global
variable here (in BFD) that can be used by any of the tools that need
@@ -166,163 +158,132 @@ static reloc_howto_type elf_howto_table[] =
{
HOWTO (R_XTENSA_NONE, 0, 0, 0, FALSE, 0, complain_overflow_dont,
bfd_elf_xtensa_reloc, "R_XTENSA_NONE",
- FALSE, 0x00000000, 0x00000000, FALSE),
+ FALSE, 0, 0, FALSE),
HOWTO (R_XTENSA_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_xtensa_reloc, "R_XTENSA_32",
TRUE, 0xffffffff, 0xffffffff, FALSE),
+
/* Replace a 32-bit value with a value from the runtime linker (only
used by linker-generated stub functions). The r_addend value is
special: 1 means to substitute a pointer to the runtime linker's
dynamic resolver function; 2 means to substitute the link map for
the shared object. */
HOWTO (R_XTENSA_RTLD, 0, 2, 32, FALSE, 0, complain_overflow_dont,
- NULL, "R_XTENSA_RTLD",
- FALSE, 0x00000000, 0x00000000, FALSE),
+ NULL, "R_XTENSA_RTLD", FALSE, 0, 0, FALSE),
+
HOWTO (R_XTENSA_GLOB_DAT, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_XTENSA_GLOB_DAT",
- FALSE, 0xffffffff, 0xffffffff, FALSE),
+ FALSE, 0, 0xffffffff, FALSE),
HOWTO (R_XTENSA_JMP_SLOT, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_XTENSA_JMP_SLOT",
- FALSE, 0xffffffff, 0xffffffff, FALSE),
+ FALSE, 0, 0xffffffff, FALSE),
HOWTO (R_XTENSA_RELATIVE, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_XTENSA_RELATIVE",
- FALSE, 0xffffffff, 0xffffffff, FALSE),
+ FALSE, 0, 0xffffffff, FALSE),
HOWTO (R_XTENSA_PLT, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_xtensa_reloc, "R_XTENSA_PLT",
- FALSE, 0xffffffff, 0xffffffff, FALSE),
+ FALSE, 0, 0xffffffff, FALSE),
+
EMPTY_HOWTO (7),
+
+ /* Old relocations for backward compatibility. */
HOWTO (R_XTENSA_OP0, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_OP0",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_OP0", FALSE, 0, 0, TRUE),
HOWTO (R_XTENSA_OP1, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_OP1",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_OP1", FALSE, 0, 0, TRUE),
HOWTO (R_XTENSA_OP2, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_OP2",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_OP2", FALSE, 0, 0, TRUE),
+
/* Assembly auto-expansion. */
HOWTO (R_XTENSA_ASM_EXPAND, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_ASM_EXPAND",
- FALSE, 0x00000000, 0x00000000, FALSE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_ASM_EXPAND", FALSE, 0, 0, TRUE),
/* Relax assembly auto-expansion. */
HOWTO (R_XTENSA_ASM_SIMPLIFY, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_ASM_SIMPLIFY",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_ASM_SIMPLIFY", FALSE, 0, 0, TRUE),
+
EMPTY_HOWTO (13),
EMPTY_HOWTO (14),
+
/* GNU extension to record C++ vtable hierarchy. */
HOWTO (R_XTENSA_GNU_VTINHERIT, 0, 2, 0, FALSE, 0, complain_overflow_dont,
NULL, "R_XTENSA_GNU_VTINHERIT",
- FALSE, 0x00000000, 0x00000000, FALSE),
+ FALSE, 0, 0, FALSE),
/* GNU extension to record C++ vtable member usage. */
HOWTO (R_XTENSA_GNU_VTENTRY, 0, 2, 0, FALSE, 0, complain_overflow_dont,
_bfd_elf_rel_vtable_reloc_fn, "R_XTENSA_GNU_VTENTRY",
- FALSE, 0x00000000, 0x00000000, FALSE),
+ FALSE, 0, 0, FALSE),
/* Relocations for supporting difference of symbols. */
HOWTO (R_XTENSA_DIFF8, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_xtensa_reloc, "R_XTENSA_DIFF8",
- FALSE, 0xffffffff, 0xffffffff, FALSE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_DIFF8", FALSE, 0, 0xff, FALSE),
HOWTO (R_XTENSA_DIFF16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_xtensa_reloc, "R_XTENSA_DIFF16",
- FALSE, 0xffffffff, 0xffffffff, FALSE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_DIFF16", FALSE, 0, 0xffff, FALSE),
HOWTO (R_XTENSA_DIFF32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
- bfd_elf_xtensa_reloc, "R_XTENSA_DIFF32",
- FALSE, 0xffffffff, 0xffffffff, FALSE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_DIFF32", FALSE, 0, 0xffffffff, FALSE),
/* General immediate operand relocations. */
HOWTO (R_XTENSA_SLOT0_OP, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_SLOT0_OP",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_SLOT0_OP", FALSE, 0, 0, TRUE),
HOWTO (R_XTENSA_SLOT1_OP, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_SLOT1_OP",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_SLOT1_OP", FALSE, 0, 0, TRUE),
HOWTO (R_XTENSA_SLOT2_OP, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_SLOT2_OP",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_SLOT2_OP", FALSE, 0, 0, TRUE),
HOWTO (R_XTENSA_SLOT3_OP, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_SLOT3_OP",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_SLOT3_OP", FALSE, 0, 0, TRUE),
HOWTO (R_XTENSA_SLOT4_OP, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_SLOT4_OP",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_SLOT4_OP", FALSE, 0, 0, TRUE),
HOWTO (R_XTENSA_SLOT5_OP, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_SLOT5_OP",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_SLOT5_OP", FALSE, 0, 0, TRUE),
HOWTO (R_XTENSA_SLOT6_OP, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_SLOT6_OP",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_SLOT6_OP", FALSE, 0, 0, TRUE),
HOWTO (R_XTENSA_SLOT7_OP, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_SLOT7_OP",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_SLOT7_OP", FALSE, 0, 0, TRUE),
HOWTO (R_XTENSA_SLOT8_OP, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_SLOT8_OP",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_SLOT8_OP", FALSE, 0, 0, TRUE),
HOWTO (R_XTENSA_SLOT9_OP, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_SLOT9_OP",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_SLOT9_OP", FALSE, 0, 0, TRUE),
HOWTO (R_XTENSA_SLOT10_OP, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_SLOT10_OP",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_SLOT10_OP", FALSE, 0, 0, TRUE),
HOWTO (R_XTENSA_SLOT11_OP, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_SLOT11_OP",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_SLOT11_OP", FALSE, 0, 0, TRUE),
HOWTO (R_XTENSA_SLOT12_OP, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_SLOT12_OP",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_SLOT12_OP", FALSE, 0, 0, TRUE),
HOWTO (R_XTENSA_SLOT13_OP, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_SLOT13_OP",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_SLOT13_OP", FALSE, 0, 0, TRUE),
HOWTO (R_XTENSA_SLOT14_OP, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_SLOT14_OP",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_SLOT14_OP", FALSE, 0, 0, TRUE),
/* "Alternate" relocations. The meaning of these is opcode-specific. */
HOWTO (R_XTENSA_SLOT0_ALT, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_SLOT0_ALT",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_SLOT0_ALT", FALSE, 0, 0, TRUE),
HOWTO (R_XTENSA_SLOT1_ALT, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_SLOT1_ALT",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_SLOT1_ALT", FALSE, 0, 0, TRUE),
HOWTO (R_XTENSA_SLOT2_ALT, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_SLOT2_ALT",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_SLOT2_ALT", FALSE, 0, 0, TRUE),
HOWTO (R_XTENSA_SLOT3_ALT, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_SLOT3_ALT",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_SLOT3_ALT", FALSE, 0, 0, TRUE),
HOWTO (R_XTENSA_SLOT4_ALT, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_SLOT4_ALT",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_SLOT4_ALT", FALSE, 0, 0, TRUE),
HOWTO (R_XTENSA_SLOT5_ALT, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_SLOT5_ALT",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_SLOT5_ALT", FALSE, 0, 0, TRUE),
HOWTO (R_XTENSA_SLOT6_ALT, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_SLOT6_ALT",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_SLOT6_ALT", FALSE, 0, 0, TRUE),
HOWTO (R_XTENSA_SLOT7_ALT, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_SLOT7_ALT",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_SLOT7_ALT", FALSE, 0, 0, TRUE),
HOWTO (R_XTENSA_SLOT8_ALT, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_SLOT8_ALT",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_SLOT8_ALT", FALSE, 0, 0, TRUE),
HOWTO (R_XTENSA_SLOT9_ALT, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_SLOT9_ALT",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_SLOT9_ALT", FALSE, 0, 0, TRUE),
HOWTO (R_XTENSA_SLOT10_ALT, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_SLOT10_ALT",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_SLOT10_ALT", FALSE, 0, 0, TRUE),
HOWTO (R_XTENSA_SLOT11_ALT, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_SLOT11_ALT",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_SLOT11_ALT", FALSE, 0, 0, TRUE),
HOWTO (R_XTENSA_SLOT12_ALT, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_SLOT12_ALT",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_SLOT12_ALT", FALSE, 0, 0, TRUE),
HOWTO (R_XTENSA_SLOT13_ALT, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_SLOT13_ALT",
- FALSE, 0x00000000, 0x00000000, TRUE),
+ bfd_elf_xtensa_reloc, "R_XTENSA_SLOT13_ALT", FALSE, 0, 0, TRUE),
HOWTO (R_XTENSA_SLOT14_ALT, 0, 0, 0, TRUE, 0, complain_overflow_dont,
- bfd_elf_xtensa_reloc, "R_XTENSA_SLOT14_ALT",
- FALSE, 0x00000000, 0x00000000, TRUE)
+ bfd_elf_xtensa_reloc, "R_XTENSA_SLOT14_ALT", FALSE, 0, 0, TRUE),
};
#if DEBUG_GEN_RELOC
@@ -430,6 +391,20 @@ elf_xtensa_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return NULL;
}
+static reloc_howto_type *
+elf_xtensa_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0; i < sizeof (elf_howto_table) / sizeof (elf_howto_table[0]); i++)
+ if (elf_howto_table[i].name != NULL
+ && strcasecmp (elf_howto_table[i].name, r_name) == 0)
+ return &elf_howto_table[i];
+
+ return NULL;
+}
+
/* Given an ELF "rela" relocation, find the corresponding howto and record
it in the BFD internal arelent representation of the relocation. */
@@ -496,9 +471,70 @@ static const bfd_byte elf_xtensa_le_plt_entry[PLT_ENTRY_SIZE] =
0 /* unused */
};
+/* Xtensa ELF linker hash table. */
+
+struct elf_xtensa_link_hash_table
+{
+ struct elf_link_hash_table elf;
+
+ /* Short-cuts to get to dynamic linker sections. */
+ asection *sgot;
+ asection *sgotplt;
+ asection *srelgot;
+ asection *splt;
+ asection *srelplt;
+ asection *sgotloc;
+ asection *spltlittbl;
+
+ /* Total count of PLT relocations seen during check_relocs.
+ The actual PLT code must be split into multiple sections and all
+ the sections have to be created before size_dynamic_sections,
+ where we figure out the exact number of PLT entries that will be
+ needed. It is OK if this count is an overestimate, e.g., some
+ relocations may be removed by GC. */
+ int plt_reloc_count;
+};
+
+/* Get the Xtensa ELF linker hash table from a link_info structure. */
+
+#define elf_xtensa_hash_table(p) \
+ ((struct elf_xtensa_link_hash_table *) ((p)->hash))
+
+/* Create an Xtensa ELF linker hash table. */
+
+static struct bfd_link_hash_table *
+elf_xtensa_link_hash_table_create (bfd *abfd)
+{
+ struct elf_xtensa_link_hash_table *ret;
+ bfd_size_type amt = sizeof (struct elf_xtensa_link_hash_table);
+
+ ret = bfd_malloc (amt);
+ if (ret == NULL)
+ return NULL;
+
+ if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd,
+ _bfd_elf_link_hash_newfunc,
+ sizeof (struct elf_link_hash_entry)))
+ {
+ free (ret);
+ return NULL;
+ }
+
+ ret->sgot = NULL;
+ ret->sgotplt = NULL;
+ ret->srelgot = NULL;
+ ret->splt = NULL;
+ ret->srelplt = NULL;
+ ret->sgotloc = NULL;
+ ret->spltlittbl = NULL;
+
+ ret->plt_reloc_count = 0;
+
+ return &ret->elf.root;
+}
static inline bfd_boolean
-xtensa_elf_dynamic_symbol_p (struct elf_link_hash_entry *h,
+elf_xtensa_dynamic_symbol_p (struct elf_link_hash_entry *h,
struct bfd_link_info *info)
{
/* Check if we should do dynamic things to this symbol. The
@@ -571,16 +607,15 @@ xtensa_read_table_entries (bfd *abfd,
bfd_boolean output_addr)
{
asection *table_section;
- char *table_section_name;
bfd_size_type table_size = 0;
bfd_byte *table_data;
property_table_entry *blocks;
int blk, block_count;
bfd_size_type num_records;
- Elf_Internal_Rela *internal_relocs;
- bfd_vma section_addr;
+ Elf_Internal_Rela *internal_relocs, *irel, *rel_end;
+ bfd_vma section_addr, off;
flagword predef_flags;
- bfd_size_type table_entry_size;
+ bfd_size_type table_entry_size, section_limit;
if (!section
|| !(section->flags & SEC_ALLOC)
@@ -590,9 +625,7 @@ xtensa_read_table_entries (bfd *abfd,
return 0;
}
- table_section_name = xtensa_get_property_section_name (section, sec_name);
- table_section = bfd_get_section_by_name (abfd, table_section_name);
- free (table_section_name);
+ table_section = xtensa_get_property_section (section, sec_name);
if (table_section)
table_size = table_section->size;
@@ -618,67 +651,63 @@ xtensa_read_table_entries (bfd *abfd,
else
section_addr = section->vma;
- /* If the file has not yet been relocated, process the relocations
- and sort out the table entries that apply to the specified section. */
internal_relocs = retrieve_internal_relocs (abfd, table_section, TRUE);
if (internal_relocs && !table_section->reloc_done)
{
- unsigned i;
-
- for (i = 0; i < table_section->reloc_count; i++)
- {
- Elf_Internal_Rela *rel = &internal_relocs[i];
- unsigned long r_symndx;
+ qsort (internal_relocs, table_section->reloc_count,
+ sizeof (Elf_Internal_Rela), internal_reloc_compare);
+ irel = internal_relocs;
+ }
+ else
+ irel = NULL;
- if (ELF32_R_TYPE (rel->r_info) == R_XTENSA_NONE)
- continue;
+ section_limit = bfd_get_section_limit (abfd, section);
+ rel_end = internal_relocs + table_section->reloc_count;
- BFD_ASSERT (ELF32_R_TYPE (rel->r_info) == R_XTENSA_32);
- r_symndx = ELF32_R_SYM (rel->r_info);
+ for (off = 0; off < table_size; off += table_entry_size)
+ {
+ bfd_vma address = bfd_get_32 (abfd, table_data + off);
- if (get_elf_r_symndx_section (abfd, r_symndx) == section)
- {
- bfd_vma sym_off = get_elf_r_symndx_offset (abfd, r_symndx);
- BFD_ASSERT (sym_off == 0);
- blocks[block_count].address =
- (section_addr + sym_off + rel->r_addend
- + bfd_get_32 (abfd, table_data + rel->r_offset));
- blocks[block_count].size =
- bfd_get_32 (abfd, table_data + rel->r_offset + 4);
- if (predef_flags)
- blocks[block_count].flags = predef_flags;
- else
- blocks[block_count].flags =
- bfd_get_32 (abfd, table_data + rel->r_offset + 8);
- block_count++;
- }
+ /* Skip any relocations before the current offset. This should help
+ avoid confusion caused by unexpected relocations for the preceding
+ table entry. */
+ while (irel &&
+ (irel->r_offset < off
+ || (irel->r_offset == off
+ && ELF32_R_TYPE (irel->r_info) == R_XTENSA_NONE)))
+ {
+ irel += 1;
+ if (irel >= rel_end)
+ irel = 0;
}
- }
- else
- {
- /* The file has already been relocated and the addresses are
- already in the table. */
- bfd_vma off;
- bfd_size_type section_limit = bfd_get_section_limit (abfd, section);
- for (off = 0; off < table_size; off += table_entry_size)
+ if (irel && irel->r_offset == off)
{
- bfd_vma address = bfd_get_32 (abfd, table_data + off);
+ bfd_vma sym_off;
+ unsigned long r_symndx = ELF32_R_SYM (irel->r_info);
+ BFD_ASSERT (ELF32_R_TYPE (irel->r_info) == R_XTENSA_32);
- if (address >= section_addr
- && address < section_addr + section_limit)
- {
- blocks[block_count].address = address;
- blocks[block_count].size =
- bfd_get_32 (abfd, table_data + off + 4);
- if (predef_flags)
- blocks[block_count].flags = predef_flags;
- else
- blocks[block_count].flags =
- bfd_get_32 (abfd, table_data + off + 8);
- block_count++;
- }
+ if (get_elf_r_symndx_section (abfd, r_symndx) != section)
+ continue;
+
+ sym_off = get_elf_r_symndx_offset (abfd, r_symndx);
+ BFD_ASSERT (sym_off == 0);
+ address += (section_addr + sym_off + irel->r_addend);
}
+ else
+ {
+ if (address < section_addr
+ || address >= section_addr + section_limit)
+ continue;
+ }
+
+ blocks[block_count].address = address;
+ blocks[block_count].size = bfd_get_32 (abfd, table_data + off + 4);
+ if (predef_flags)
+ blocks[block_count].flags = predef_flags;
+ else
+ blocks[block_count].flags = bfd_get_32 (abfd, table_data + off + 8);
+ block_count++;
}
release_contents (table_section, table_data);
@@ -757,6 +786,7 @@ elf_xtensa_check_relocs (bfd *abfd,
asection *sec,
const Elf_Internal_Rela *relocs)
{
+ struct elf_xtensa_link_hash_table *htab;
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
const Elf_Internal_Rela *rel;
@@ -765,6 +795,7 @@ elf_xtensa_check_relocs (bfd *abfd,
if (info->relocatable)
return TRUE;
+ htab = elf_xtensa_hash_table (info);
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
@@ -829,12 +860,11 @@ elf_xtensa_check_relocs (bfd *abfd,
/* Keep track of the total PLT relocation count even if we
don't yet know whether the dynamic sections will be
created. */
- plt_reloc_count += 1;
+ htab->plt_reloc_count += 1;
if (elf_hash_table (info)->dynamic_sections_created)
{
- if (!add_extra_plt_sections (elf_hash_table (info)->dynobj,
- plt_reloc_count))
+ if (! add_extra_plt_sections (info, htab->plt_reloc_count))
return FALSE;
}
}
@@ -929,18 +959,19 @@ elf_xtensa_check_relocs (bfd *abfd,
static void
elf_xtensa_make_sym_local (struct bfd_link_info *info,
- struct elf_link_hash_entry *h)
+ struct elf_link_hash_entry *h)
{
if (info->shared)
{
if (h->plt.refcount > 0)
- {
- /* Will use RELATIVE relocs instead of JMP_SLOT relocs. */
- if (h->got.refcount < 0)
- h->got.refcount = 0;
- h->got.refcount += h->plt.refcount;
- h->plt.refcount = 0;
- }
+ {
+ /* For shared objects, there's no need for PLT entries for local
+ symbols (use RELATIVE relocs instead of JMP_SLOT relocs). */
+ if (h->got.refcount < 0)
+ h->got.refcount = 0;
+ h->got.refcount += h->plt.refcount;
+ h->plt.refcount = 0;
+ }
}
else
{
@@ -953,8 +984,8 @@ elf_xtensa_make_sym_local (struct bfd_link_info *info,
static void
elf_xtensa_hide_symbol (struct bfd_link_info *info,
- struct elf_link_hash_entry *h,
- bfd_boolean force_local)
+ struct elf_link_hash_entry *h,
+ bfd_boolean force_local)
{
/* For a shared link, move the plt refcount to the got refcount to leave
space for RELATIVE relocs. */
@@ -969,38 +1000,33 @@ elf_xtensa_hide_symbol (struct bfd_link_info *info,
static asection *
elf_xtensa_gc_mark_hook (asection *sec,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info,
Elf_Internal_Rela *rel,
struct elf_link_hash_entry *h,
Elf_Internal_Sym *sym)
{
- if (h)
- {
- switch (ELF32_R_TYPE (rel->r_info))
- {
- case R_XTENSA_GNU_VTINHERIT:
- case R_XTENSA_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
+ /* Property sections are marked "KEEP" in the linker scripts, but they
+ should not cause other sections to be marked. (This approach relies
+ on elf_xtensa_discard_info to remove property table entries that
+ describe discarded sections. Alternatively, it might be more
+ efficient to avoid using "KEEP" in the linker scripts and instead use
+ the gc_mark_extra_sections hook to mark only the property sections
+ that describe marked sections. That alternative does not work well
+ with the current property table sections, which do not correspond
+ one-to-one with the sections they describe, but that should be fixed
+ someday.) */
+ if (xtensa_is_property_section (sec))
+ return NULL;
- default:
- break;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
+ if (h != NULL)
+ switch (ELF32_R_TYPE (rel->r_info))
+ {
+ case R_XTENSA_GNU_VTINHERIT:
+ case R_XTENSA_GNU_VTENTRY:
+ return NULL;
+ }
- return NULL;
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
@@ -1077,16 +1103,22 @@ elf_xtensa_gc_sweep_hook (bfd *abfd,
static bfd_boolean
elf_xtensa_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
{
+ struct elf_xtensa_link_hash_table *htab;
flagword flags, noalloc_flags;
- asection *s;
+
+ htab = elf_xtensa_hash_table (info);
/* First do all the standard stuff. */
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->sgot = bfd_get_section_by_name (dynobj, ".got");
+ htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
/* Create any extra PLT sections in case check_relocs has already
been called on all the non-dynamic input files. */
- if (!add_extra_plt_sections (dynobj, plt_reloc_count))
+ if (! add_extra_plt_sections (info, htab->plt_reloc_count))
return FALSE;
noalloc_flags = (SEC_HAS_CONTENTS | SEC_IN_MEMORY
@@ -1094,28 +1126,27 @@ elf_xtensa_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
flags = noalloc_flags | SEC_ALLOC | SEC_LOAD;
/* Mark the ".got.plt" section READONLY. */
- s = bfd_get_section_by_name (dynobj, ".got.plt");
- if (s == NULL
- || ! bfd_set_section_flags (dynobj, s, flags))
+ if (htab->sgotplt == NULL
+ || ! bfd_set_section_flags (dynobj, htab->sgotplt, flags))
return FALSE;
/* Create ".rela.got". */
- s = bfd_make_section_with_flags (dynobj, ".rela.got", flags);
- if (s == NULL
- || ! bfd_set_section_alignment (dynobj, s, 2))
+ htab->srelgot = bfd_make_section_with_flags (dynobj, ".rela.got", flags);
+ if (htab->srelgot == NULL
+ || ! bfd_set_section_alignment (dynobj, htab->srelgot, 2))
return FALSE;
/* Create ".got.loc" (literal tables for use by dynamic linker). */
- s = bfd_make_section_with_flags (dynobj, ".got.loc", flags);
- if (s == NULL
- || ! bfd_set_section_alignment (dynobj, s, 2))
+ htab->sgotloc = bfd_make_section_with_flags (dynobj, ".got.loc", flags);
+ if (htab->sgotloc == NULL
+ || ! bfd_set_section_alignment (dynobj, htab->sgotloc, 2))
return FALSE;
/* Create ".xt.lit.plt" (literal table for ".got.plt*"). */
- s = bfd_make_section_with_flags (dynobj, ".xt.lit.plt",
- noalloc_flags);
- if (s == NULL
- || ! bfd_set_section_alignment (dynobj, s, 2))
+ htab->spltlittbl = bfd_make_section_with_flags (dynobj, ".xt.lit.plt",
+ noalloc_flags);
+ if (htab->spltlittbl == NULL
+ || ! bfd_set_section_alignment (dynobj, htab->spltlittbl, 2))
return FALSE;
return TRUE;
@@ -1123,8 +1154,9 @@ elf_xtensa_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
static bfd_boolean
-add_extra_plt_sections (bfd *dynobj, int count)
+add_extra_plt_sections (struct bfd_link_info *info, int count)
{
+ bfd *dynobj = elf_hash_table (info)->dynobj;
int chunk;
/* Iterate over all chunks except 0 which uses the standard ".plt" and
@@ -1136,7 +1168,7 @@ add_extra_plt_sections (bfd *dynobj, int count)
asection *s;
/* Stop when we find a section has already been created. */
- if (elf_xtensa_get_plt_section (dynobj, chunk))
+ if (elf_xtensa_get_plt_section (info, chunk))
break;
flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
@@ -1144,8 +1176,7 @@ add_extra_plt_sections (bfd *dynobj, int count)
sname = (char *) bfd_malloc (10);
sprintf (sname, ".plt.%u", chunk);
- s = bfd_make_section_with_flags (dynobj, sname,
- flags | SEC_CODE);
+ s = bfd_make_section_with_flags (dynobj, sname, flags | SEC_CODE);
if (s == NULL
|| ! bfd_set_section_alignment (dynobj, s, 2))
return FALSE;
@@ -1193,56 +1224,44 @@ elf_xtensa_adjust_dynamic_symbol (struct bfd_link_info *info ATTRIBUTE_UNUSED,
static bfd_boolean
-elf_xtensa_fix_refcounts (struct elf_link_hash_entry *h, void *arg)
+elf_xtensa_allocate_dynrelocs (struct elf_link_hash_entry *h, void *arg)
{
- struct bfd_link_info *info = (struct bfd_link_info *) arg;
-
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- if (! xtensa_elf_dynamic_symbol_p (h, info))
- elf_xtensa_make_sym_local (info, h);
-
- return TRUE;
-}
+ struct bfd_link_info *info;
+ struct elf_xtensa_link_hash_table *htab;
+ bfd_boolean is_dynamic;
-
-static bfd_boolean
-elf_xtensa_allocate_plt_size (struct elf_link_hash_entry *h, void *arg)
-{
- asection *srelplt = (asection *) arg;
+ 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->plt.refcount > 0)
- srelplt->size += (h->plt.refcount * sizeof (Elf32_External_Rela));
-
- return TRUE;
-}
+ info = (struct bfd_link_info *) arg;
+ htab = elf_xtensa_hash_table (info);
+ is_dynamic = elf_xtensa_dynamic_symbol_p (h, info);
-static bfd_boolean
-elf_xtensa_allocate_got_size (struct elf_link_hash_entry *h, void *arg)
-{
- asection *srelgot = (asection *) arg;
+ if (! is_dynamic)
+ elf_xtensa_make_sym_local (info, h);
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ if (h->plt.refcount > 0)
+ htab->srelplt->size += (h->plt.refcount * sizeof (Elf32_External_Rela));
if (h->got.refcount > 0)
- srelgot->size += (h->got.refcount * sizeof (Elf32_External_Rela));
+ htab->srelgot->size += (h->got.refcount * sizeof (Elf32_External_Rela));
return TRUE;
}
static void
-elf_xtensa_allocate_local_got_size (struct bfd_link_info *info,
- asection *srelgot)
+elf_xtensa_allocate_local_got_size (struct bfd_link_info *info)
{
+ struct elf_xtensa_link_hash_table *htab;
bfd *i;
+ htab = elf_xtensa_hash_table (info);
+
for (i = info->input_bfds; i; i = i->link_next)
{
bfd_signed_vma *local_got_refcounts;
@@ -1259,8 +1278,8 @@ elf_xtensa_allocate_local_got_size (struct bfd_link_info *info,
for (j = 0; j < cnt; ++j)
{
if (local_got_refcounts[j] > 0)
- srelgot->size += (local_got_refcounts[j]
- * sizeof (Elf32_External_Rela));
+ htab->srelgot->size += (local_got_refcounts[j]
+ * sizeof (Elf32_External_Rela));
}
}
}
@@ -1272,6 +1291,7 @@ static bfd_boolean
elf_xtensa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
struct bfd_link_info *info)
{
+ struct elf_xtensa_link_hash_table *htab;
bfd *dynobj, *abfd;
asection *s, *srelplt, *splt, *sgotplt, *srelgot, *spltlittbl, *sgotloc;
bfd_boolean relplt, relgot;
@@ -1279,14 +1299,22 @@ elf_xtensa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
plt_entries = 0;
plt_chunks = 0;
- srelgot = 0;
+ htab = elf_xtensa_hash_table (info);
dynobj = elf_hash_table (info)->dynobj;
if (dynobj == NULL)
abort ();
+ srelgot = htab->srelgot;
+ srelplt = htab->srelplt;
if (elf_hash_table (info)->dynamic_sections_created)
{
+ BFD_ASSERT (htab->srelgot != NULL
+ && htab->srelplt != NULL
+ && htab->sgot != NULL
+ && htab->spltlittbl != NULL
+ && htab->sgotloc != NULL);
+
/* Set the contents of the .interp section to the interpreter. */
if (info->executable)
{
@@ -1298,48 +1326,27 @@ elf_xtensa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
}
/* Allocate room for one word in ".got". */
- s = bfd_get_section_by_name (dynobj, ".got");
- if (s == NULL)
- abort ();
- s->size = 4;
+ htab->sgot->size = 4;
- /* Adjust refcounts for symbols that we now know are not "dynamic". */
+ /* Allocate space in ".rela.got" for literals that reference global
+ symbols and space in ".rela.plt" for literals that have PLT
+ entries. */
elf_link_hash_traverse (elf_hash_table (info),
- elf_xtensa_fix_refcounts,
+ elf_xtensa_allocate_dynrelocs,
(void *) info);
- /* Allocate space in ".rela.got" for literals that reference
- global symbols. */
- srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
- if (srelgot == NULL)
- abort ();
- elf_link_hash_traverse (elf_hash_table (info),
- elf_xtensa_allocate_got_size,
- (void *) srelgot);
-
/* If we are generating a shared object, we also need space in
".rela.got" for R_XTENSA_RELATIVE relocs for literals that
reference local symbols. */
if (info->shared)
- elf_xtensa_allocate_local_got_size (info, srelgot);
-
- /* Allocate space in ".rela.plt" for literals that have PLT entries. */
- srelplt = bfd_get_section_by_name (dynobj, ".rela.plt");
- if (srelplt == NULL)
- abort ();
- elf_link_hash_traverse (elf_hash_table (info),
- elf_xtensa_allocate_plt_size,
- (void *) srelplt);
+ elf_xtensa_allocate_local_got_size (info);
/* Allocate space in ".plt" to match the size of ".rela.plt". For
each PLT entry, we need the PLT code plus a 4-byte literal.
For each chunk of ".plt", we also need two more 4-byte
literals, two corresponding entries in ".rela.got", and an
8-byte entry in ".xt.lit.plt". */
- spltlittbl = bfd_get_section_by_name (dynobj, ".xt.lit.plt");
- if (spltlittbl == NULL)
- abort ();
-
+ spltlittbl = htab->spltlittbl;
plt_entries = srelplt->size / sizeof (Elf32_External_Rela);
plt_chunks =
(plt_entries + PLT_ENTRIES_PER_CHUNK - 1) / PLT_ENTRIES_PER_CHUNK;
@@ -1348,14 +1355,13 @@ elf_xtensa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
created earlier because the initial count of PLT relocations
was an overestimate. */
for (chunk = 0;
- (splt = elf_xtensa_get_plt_section (dynobj, chunk)) != NULL;
+ (splt = elf_xtensa_get_plt_section (info, chunk)) != NULL;
chunk++)
{
int chunk_entries;
- sgotplt = elf_xtensa_get_gotplt_section (dynobj, chunk);
- if (sgotplt == NULL)
- abort ();
+ sgotplt = elf_xtensa_get_gotplt_section (info, chunk);
+ BFD_ASSERT (sgotplt != NULL);
if (chunk < plt_chunks - 1)
chunk_entries = PLT_ENTRIES_PER_CHUNK;
@@ -1380,9 +1386,7 @@ elf_xtensa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
/* Allocate space in ".got.loc" to match the total size of all the
literal tables. */
- sgotloc = bfd_get_section_by_name (dynobj, ".got.loc");
- if (sgotloc == NULL)
- abort ();
+ sgotloc = htab->sgotloc;
sgotloc->size = spltlittbl->size;
for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link_next)
{
@@ -1412,7 +1416,7 @@ elf_xtensa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
of the dynobj section names depend upon the input files. */
name = bfd_get_section_name (dynobj, s);
- if (strncmp (name, ".rela", 5) == 0)
+ if (CONST_STRNEQ (name, ".rela"))
{
if (s->size != 0)
{
@@ -1426,8 +1430,8 @@ elf_xtensa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
s->reloc_count = 0;
}
}
- else if (strncmp (name, ".plt.", 5) != 0
- && strncmp (name, ".got.plt.", 9) != 0
+ else if (! CONST_STRNEQ (name, ".plt.")
+ && ! CONST_STRNEQ (name, ".got.plt.")
&& strcmp (name, ".got") != 0
&& strcmp (name, ".plt") != 0
&& strcmp (name, ".got.plt") != 0
@@ -1465,8 +1469,6 @@ elf_xtensa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
/* Add the special XTENSA_RTLD relocations now. The offsets won't be
known until finish_dynamic_sections, but we need to get the relocs
in place before they are sorted. */
- if (srelgot == NULL)
- abort ();
for (chunk = 0; chunk < plt_chunks; chunk++)
{
Elf_Internal_Rela irela;
@@ -1492,7 +1494,7 @@ elf_xtensa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
#define add_dynamic_entry(TAG, VAL) \
_bfd_elf_add_dynamic_entry (info, TAG, VAL)
- if (! info->shared)
+ if (info->executable)
{
if (!add_dynamic_entry (DT_DEBUG, 0))
return FALSE;
@@ -1525,31 +1527,6 @@ elf_xtensa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
}
-/* Remove any PT_LOAD segments with no allocated sections. Prior to
- binutils 2.13, this function used to remove the non-SEC_ALLOC
- sections from PT_LOAD segments, but that task has now been moved
- into elf.c. We still need this function to remove any empty
- segments that result, but there's nothing Xtensa-specific about
- this and it probably ought to be moved into elf.c as well. */
-
-static bfd_boolean
-elf_xtensa_modify_segment_map (bfd *abfd,
- struct bfd_link_info *info ATTRIBUTE_UNUSED)
-{
- struct elf_segment_map **m_p;
-
- m_p = &elf_tdata (abfd)->segment_map;
- while (*m_p)
- {
- if ((*m_p)->p_type == PT_LOAD && (*m_p)->count == 0)
- *m_p = (*m_p)->next;
- else
- m_p = &(*m_p)->next;
- }
- return TRUE;
-}
-
-
/* Perform the specified relocation. The instruction at (contents + address)
is modified to set one operand to represent the value in "relocation". The
operand position is determined by the relocation type recorded in the
@@ -1937,7 +1914,7 @@ bfd_elf_xtensa_reloc (bfd *abfd,
/* Set up an entry in the procedure linkage table. */
static bfd_vma
-elf_xtensa_create_plt_entry (bfd *dynobj,
+elf_xtensa_create_plt_entry (struct bfd_link_info *info,
bfd *output_bfd,
unsigned reloc_index)
{
@@ -1947,8 +1924,8 @@ elf_xtensa_create_plt_entry (bfd *dynobj,
int chunk;
chunk = reloc_index / PLT_ENTRIES_PER_CHUNK;
- splt = elf_xtensa_get_plt_section (dynobj, chunk);
- sgotplt = elf_xtensa_get_gotplt_section (dynobj, chunk);
+ splt = elf_xtensa_get_plt_section (info, chunk);
+ sgotplt = elf_xtensa_get_gotplt_section (info, chunk);
BFD_ASSERT (splt != NULL && sgotplt != NULL);
plt_base = splt->output_section->vma + splt->output_offset;
@@ -1995,12 +1972,11 @@ elf_xtensa_relocate_section (bfd *output_bfd,
Elf_Internal_Sym *local_syms,
asection **local_sections)
{
+ struct elf_xtensa_link_hash_table *htab;
Elf_Internal_Shdr *symtab_hdr;
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
struct elf_link_hash_entry **sym_hashes;
- asection *srelgot, *srelplt;
- bfd *dynobj;
property_table_entry *lit_table = 0;
int ltblsize = 0;
char *error_message = NULL;
@@ -2009,18 +1985,10 @@ elf_xtensa_relocate_section (bfd *output_bfd,
if (!xtensa_default_isa)
xtensa_default_isa = xtensa_isa_init (0, 0);
- dynobj = elf_hash_table (info)->dynobj;
+ htab = elf_xtensa_hash_table (info);
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
- srelgot = NULL;
- srelplt = NULL;
- if (dynobj)
- {
- srelgot = bfd_get_section_by_name (dynobj, ".rela.got");;
- srelplt = bfd_get_section_by_name (dynobj, ".rela.plt");
- }
-
if (elf_hash_table (info)->dynamic_sections_created)
{
ltblsize = xtensa_read_table_entries (input_bfd, input_section,
@@ -2062,6 +2030,53 @@ elf_xtensa_relocate_section (bfd *output_bfd,
r_symndx = ELF32_R_SYM (rel->r_info);
+ h = NULL;
+ sym = NULL;
+ sec = NULL;
+ is_weak_undef = FALSE;
+ unresolved_reloc = FALSE;
+ warned = FALSE;
+
+ if (howto->partial_inplace && !info->relocatable)
+ {
+ /* Because R_XTENSA_32 was made partial_inplace to fix some
+ problems with DWARF info in partial links, there may be
+ an addend stored in the contents. Take it out of there
+ and move it back into the addend field of the reloc. */
+ rel->r_addend += bfd_get_32 (input_bfd, contents + rel->r_offset);
+ bfd_put_32 (input_bfd, 0, contents + rel->r_offset);
+ }
+
+ if (r_symndx < symtab_hdr->sh_info)
+ {
+ sym = local_syms + r_symndx;
+ sec = local_sections[r_symndx];
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
+ }
+ else
+ {
+ RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
+ r_symndx, symtab_hdr, sym_hashes,
+ h, sec, relocation,
+ unresolved_reloc, warned);
+
+ if (relocation == 0
+ && !unresolved_reloc
+ && h->root.type == bfd_link_hash_undefweak)
+ is_weak_undef = TRUE;
+ }
+
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
if (info->relocatable)
{
/* This is a relocatable link.
@@ -2143,42 +2158,6 @@ elf_xtensa_relocate_section (bfd *output_bfd,
/* This is a final link. */
- h = NULL;
- sym = NULL;
- sec = NULL;
- is_weak_undef = FALSE;
- unresolved_reloc = FALSE;
- warned = FALSE;
-
- if (howto->partial_inplace)
- {
- /* Because R_XTENSA_32 was made partial_inplace to fix some
- problems with DWARF info in partial links, there may be
- an addend stored in the contents. Take it out of there
- and move it back into the addend field of the reloc. */
- rel->r_addend += bfd_get_32 (input_bfd, contents + rel->r_offset);
- bfd_put_32 (input_bfd, 0, contents + rel->r_offset);
- }
-
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
- sec = local_sections[r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
- }
- else
- {
- RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
- r_symndx, symtab_hdr, sym_hashes,
- h, sec, relocation,
- unresolved_reloc, warned);
-
- if (relocation == 0
- && !unresolved_reloc
- && h->root.type == bfd_link_hash_undefweak)
- is_weak_undef = TRUE;
- }
-
if (relaxing_section)
{
/* Check if this references a section in another input file. */
@@ -2204,7 +2183,7 @@ elf_xtensa_relocate_section (bfd *output_bfd,
/* Generate dynamic relocations. */
if (elf_hash_table (info)->dynamic_sections_created)
{
- bfd_boolean dynamic_symbol = xtensa_elf_dynamic_symbol_p (h, info);
+ bfd_boolean dynamic_symbol = elf_xtensa_dynamic_symbol_p (h, info);
if (dynamic_symbol && is_operand_relocation (r_type))
{
@@ -2228,9 +2207,9 @@ elf_xtensa_relocate_section (bfd *output_bfd,
asection *srel;
if (dynamic_symbol && r_type == R_XTENSA_PLT)
- srel = srelplt;
+ srel = htab->srelplt;
else
- srel = srelgot;
+ srel = htab->srelgot;
BFD_ASSERT (srel != NULL);
@@ -2279,7 +2258,7 @@ elf_xtensa_relocate_section (bfd *output_bfd,
contents of the literal entry to the address of
the PLT entry. */
relocation =
- elf_xtensa_create_plt_entry (dynobj, output_bfd,
+ elf_xtensa_create_plt_entry (info, output_bfd,
srel->reloc_count);
}
unresolved_reloc = FALSE;
@@ -2306,13 +2285,16 @@ elf_xtensa_relocate_section (bfd *output_bfd,
if (unresolved_reloc
&& !((input_section->flags & SEC_DEBUGGING) != 0
&& h->def_dynamic))
- (*_bfd_error_handler)
- (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
- input_bfd,
- input_section,
- (long) rel->r_offset,
- howto->name,
- h->root.root.string);
+ {
+ (*_bfd_error_handler)
+ (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
+ input_bfd,
+ input_section,
+ (long) rel->r_offset,
+ howto->name,
+ h->root.root.string);
+ return FALSE;
+ }
/* There's no point in calling bfd_perform_relocation here.
Just go directly to our "special function". */
@@ -2373,12 +2355,17 @@ elf_xtensa_finish_dynamic_symbol (bfd *output_bfd ATTRIBUTE_UNUSED,
struct elf_link_hash_entry *h,
Elf_Internal_Sym *sym)
{
- if (h->needs_plt
- && !h->def_regular)
+ if (h->needs_plt && !h->def_regular)
{
/* Mark the symbol as undefined, rather than as defined in
the .plt section. Leave the value alone. */
sym->st_shndx = SHN_UNDEF;
+ /* If the symbol is weak, we do need to clear the value.
+ Otherwise, the PLT entry would provide a definition for
+ the symbol even if the symbol wasn't defined anywhere,
+ and so the symbol would never be NULL. */
+ if (!h->ref_regular_nonweak)
+ sym->st_value = 0;
}
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
@@ -2509,6 +2496,7 @@ static bfd_boolean
elf_xtensa_finish_dynamic_sections (bfd *output_bfd,
struct bfd_link_info *info)
{
+ struct elf_xtensa_link_hash_table *htab;
bfd *dynobj;
asection *sdyn, *srelplt, *sgot, *sxtlit, *sgotloc;
Elf32_External_Dyn *dyncon, *dynconend;
@@ -2517,13 +2505,14 @@ elf_xtensa_finish_dynamic_sections (bfd *output_bfd,
if (! elf_hash_table (info)->dynamic_sections_created)
return TRUE;
+ htab = elf_xtensa_hash_table (info);
dynobj = elf_hash_table (info)->dynobj;
sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
BFD_ASSERT (sdyn != NULL);
/* Set the first entry in the global offset table to the address of
the dynamic section. */
- sgot = bfd_get_section_by_name (dynobj, ".got");
+ sgot = htab->sgot;
if (sgot)
{
BFD_ASSERT (sgot->size == 4);
@@ -2535,7 +2524,7 @@ elf_xtensa_finish_dynamic_sections (bfd *output_bfd,
sgot->contents);
}
- srelplt = bfd_get_section_by_name (dynobj, ".rela.plt");
+ srelplt = htab->srelplt;
if (srelplt && srelplt->size != 0)
{
asection *sgotplt, *srelgot, *spltlittbl;
@@ -2544,11 +2533,9 @@ elf_xtensa_finish_dynamic_sections (bfd *output_bfd,
bfd_byte *loc;
unsigned rtld_reloc;
- srelgot = bfd_get_section_by_name (dynobj, ".rela.got");;
- BFD_ASSERT (srelgot != NULL);
-
- spltlittbl = bfd_get_section_by_name (dynobj, ".xt.lit.plt");
- BFD_ASSERT (spltlittbl != NULL);
+ srelgot = htab->srelgot;
+ spltlittbl = htab->spltlittbl;
+ BFD_ASSERT (srelgot != NULL && spltlittbl != NULL);
/* Find the first XTENSA_RTLD relocation. Presumably the rest
of them follow immediately after.... */
@@ -2569,7 +2556,7 @@ elf_xtensa_finish_dynamic_sections (bfd *output_bfd,
{
int chunk_entries = 0;
- sgotplt = elf_xtensa_get_gotplt_section (dynobj, chunk);
+ sgotplt = elf_xtensa_get_gotplt_section (info, chunk);
BFD_ASSERT (sgotplt != NULL);
/* Emit special RTLD relocations for the first two entries in
@@ -2637,7 +2624,7 @@ elf_xtensa_finish_dynamic_sections (bfd *output_bfd,
/* Combine adjacent literal table entries. */
BFD_ASSERT (! info->relocatable);
sxtlit = bfd_get_section_by_name (output_bfd, ".xt.lit");
- sgotloc = bfd_get_section_by_name (dynobj, ".got.loc");
+ sgotloc = htab->sgotloc;
BFD_ASSERT (sxtlit && sgotloc);
num_xtlit_entries =
elf_xtensa_combine_prop_entries (output_bfd, sxtlit, sgotloc);
@@ -2649,8 +2636,6 @@ elf_xtensa_finish_dynamic_sections (bfd *output_bfd,
for (; dyncon < dynconend; dyncon++)
{
Elf_Internal_Dyn dyn;
- const char *name;
- asection *s;
bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn);
@@ -2664,23 +2649,19 @@ elf_xtensa_finish_dynamic_sections (bfd *output_bfd,
break;
case DT_XTENSA_GOT_LOC_OFF:
- name = ".got.loc";
- goto get_vma;
+ dyn.d_un.d_ptr = htab->sgotloc->vma;
+ break;
+
case DT_PLTGOT:
- name = ".got";
- goto get_vma;
+ dyn.d_un.d_ptr = htab->sgot->vma;
+ break;
+
case DT_JMPREL:
- name = ".rela.plt";
- get_vma:
- s = bfd_get_section_by_name (output_bfd, name);
- BFD_ASSERT (s);
- dyn.d_un.d_ptr = s->vma;
+ dyn.d_un.d_ptr = htab->srelplt->vma;
break;
case DT_PLTRELSZ:
- s = bfd_get_section_by_name (output_bfd, ".rela.plt");
- BFD_ASSERT (s);
- dyn.d_un.d_val = s->size;
+ dyn.d_un.d_val = htab->srelplt->size;
break;
case DT_RELASZ:
@@ -2690,9 +2671,8 @@ elf_xtensa_finish_dynamic_sections (bfd *output_bfd,
seems to be unresolved. Since the linker script arranges
for .rela.plt to follow all other relocation sections, we
don't have to worry about changing the DT_RELA entry. */
- s = bfd_get_section_by_name (output_bfd, ".rela.plt");
- if (s)
- dyn.d_un.d_val -= s->size;
+ if (htab->srelplt)
+ dyn.d_un.d_val -= htab->srelplt->size;
break;
}
@@ -2866,16 +2846,22 @@ elf_xtensa_discard_info_for_section (bfd *abfd,
bfd_byte *contents;
bfd_vma section_size;
bfd_vma offset, actual_offset;
- size_t removed_bytes = 0;
-
- section_size = sec->size;
- if (section_size == 0 || section_size % 8 != 0)
- return FALSE;
+ bfd_size_type removed_bytes = 0;
+ bfd_size_type entry_size;
if (sec->output_section
&& bfd_is_abs_section (sec->output_section))
return FALSE;
+ if (xtensa_is_proptable_section (sec))
+ entry_size = 12;
+ else
+ entry_size = 8;
+
+ section_size = sec->size;
+ if (section_size == 0 || section_size % entry_size != 0)
+ return FALSE;
+
contents = retrieve_contents (abfd, sec, info->keep_memory);
if (!contents)
return FALSE;
@@ -2887,10 +2873,15 @@ elf_xtensa_discard_info_for_section (bfd *abfd,
return FALSE;
}
+ /* Sort the relocations. They should already be in order when
+ relaxation is enabled, but it might not be. */
+ qsort (cookie->rels, sec->reloc_count, sizeof (Elf_Internal_Rela),
+ internal_reloc_compare);
+
cookie->rel = cookie->rels;
cookie->relend = cookie->rels + sec->reloc_count;
- for (offset = 0; offset < section_size; offset += 8)
+ for (offset = 0; offset < section_size; offset += entry_size)
{
actual_offset = offset - removed_bytes;
@@ -2914,11 +2905,11 @@ elf_xtensa_discard_info_for_section (bfd *abfd,
if (ELF32_R_TYPE (cookie->rel->r_info) != R_XTENSA_NONE)
{
/* Shift the contents up. */
- if (offset + 8 < section_size)
+ if (offset + entry_size < section_size)
memmove (&contents[actual_offset],
- &contents[actual_offset+8],
- section_size - offset - 8);
- removed_bytes += 8;
+ &contents[actual_offset + entry_size],
+ section_size - offset - entry_size);
+ removed_bytes += entry_size;
}
/* Remove this relocation. */
@@ -2961,14 +2952,9 @@ elf_xtensa_discard_info_for_section (bfd *abfd,
if (xtensa_is_littable_section (sec))
{
- bfd *dynobj = elf_hash_table (info)->dynobj;
- if (dynobj)
- {
- asection *sgotloc =
- bfd_get_section_by_name (dynobj, ".got.loc");
- if (sgotloc)
- sgotloc->size -= removed_bytes;
- }
+ asection *sgotloc = elf_xtensa_hash_table (info)->sgotloc;
+ if (sgotloc)
+ sgotloc->size -= removed_bytes;
}
}
else
@@ -3008,6 +2994,19 @@ elf_xtensa_ignore_discarded_relocs (asection *sec)
return xtensa_is_property_section (sec);
}
+
+static unsigned int
+elf_xtensa_action_discarded (asection *sec)
+{
+ if (strcmp (".xt_except_table", sec->name) == 0)
+ return 0;
+
+ if (strcmp (".xt_except_desc", sec->name) == 0)
+ return 0;
+
+ return _bfd_elf_default_action_discarded (sec);
+}
+
/* Support for core dump NOTE sections. */
@@ -3433,24 +3432,23 @@ check_loop_aligned (bfd_byte *contents,
bfd_vma address)
{
bfd_size_type loop_len, insn_len;
- xtensa_opcode opcode =
- insn_decode_opcode (contents, content_length, offset, 0);
- BFD_ASSERT (opcode != XTENSA_UNDEFINED);
- if (opcode != XTENSA_UNDEFINED)
- return FALSE;
- BFD_ASSERT (xtensa_opcode_is_loop (xtensa_default_isa, opcode));
- if (!xtensa_opcode_is_loop (xtensa_default_isa, opcode))
- return FALSE;
+ xtensa_opcode opcode;
+ opcode = insn_decode_opcode (contents, content_length, offset, 0);
+ if (opcode == XTENSA_UNDEFINED
+ || xtensa_opcode_is_loop (xtensa_default_isa, opcode) != 1)
+ {
+ BFD_ASSERT (FALSE);
+ return FALSE;
+ }
+
loop_len = insn_decode_len (contents, content_length, offset);
- BFD_ASSERT (loop_len != 0);
- if (loop_len == 0)
- return FALSE;
-
insn_len = insn_decode_len (contents, content_length, offset + loop_len);
- BFD_ASSERT (insn_len != 0);
- if (insn_len == 0)
- return FALSE;
+ if (loop_len == 0 || insn_len == 0)
+ {
+ BFD_ASSERT (FALSE);
+ return FALSE;
+ }
return check_branch_target_aligned_address (address + loop_len, insn_len);
}
@@ -3562,60 +3560,31 @@ struct string_pair widenable[] =
};
-/* Attempt to narrow an instruction. Return true if the narrowing is
- valid. If the do_it parameter is non-zero, then perform the action
- in-place directly into the contents. Otherwise, do not modify the
- contents. The set of valid narrowing are specified by a string table
+/* Check if an instruction can be "narrowed", i.e., changed from a standard
+ 3-byte instruction to a 2-byte "density" instruction. If it is valid,
+ return the instruction buffer holding the narrow instruction. Otherwise,
+ return 0. The set of valid narrowing are specified by a string table
but require some special case operand checks in some cases. */
-static bfd_boolean
-narrow_instruction (bfd_byte *contents,
- bfd_size_type content_length,
- bfd_size_type offset,
- bfd_boolean do_it)
+static xtensa_insnbuf
+can_narrow_instruction (xtensa_insnbuf slotbuf,
+ xtensa_format fmt,
+ xtensa_opcode opcode)
{
- xtensa_opcode opcode;
- bfd_size_type insn_len, opi;
xtensa_isa isa = xtensa_default_isa;
- xtensa_format fmt, o_fmt;
+ xtensa_format o_fmt;
+ unsigned opi;
- static xtensa_insnbuf insnbuf = NULL;
- static xtensa_insnbuf slotbuf = NULL;
static xtensa_insnbuf o_insnbuf = NULL;
static xtensa_insnbuf o_slotbuf = NULL;
- if (insnbuf == NULL)
+ if (o_insnbuf == NULL)
{
- insnbuf = xtensa_insnbuf_alloc (isa);
- slotbuf = xtensa_insnbuf_alloc (isa);
o_insnbuf = xtensa_insnbuf_alloc (isa);
o_slotbuf = xtensa_insnbuf_alloc (isa);
}
- BFD_ASSERT (offset < content_length);
-
- if (content_length < 2)
- return FALSE;
-
- /* We will hand-code a few of these for a little while.
- These have all been specified in the assembler aleady. */
- xtensa_insnbuf_from_chars (isa, insnbuf, &contents[offset],
- content_length - offset);
- fmt = xtensa_format_decode (isa, insnbuf);
- if (xtensa_format_num_slots (isa, fmt) != 1)
- return FALSE;
-
- if (xtensa_format_get_slot (isa, fmt, 0, insnbuf, slotbuf) != 0)
- return FALSE;
-
- opcode = xtensa_opcode_decode (isa, fmt, 0, slotbuf);
- if (opcode == XTENSA_UNDEFINED)
- return FALSE;
- insn_len = xtensa_format_length (isa, fmt);
- if (insn_len > content_length)
- return FALSE;
-
- for (opi = 0; opi < (sizeof (narrowable)/sizeof (struct string_pair)); ++opi)
+ for (opi = 0; opi < (sizeof (narrowable)/sizeof (struct string_pair)); opi++)
{
bfd_boolean is_or = (strcmp ("or", narrowable[opi].wide) == 0);
@@ -3631,47 +3600,41 @@ narrow_instruction (bfd_byte *contents,
o_opcode = xtensa_opcode_lookup (isa, narrowable[opi].narrow);
if (o_opcode == XTENSA_UNDEFINED)
- return FALSE;
+ return 0;
o_fmt = get_single_format (o_opcode);
if (o_fmt == XTENSA_UNDEFINED)
- return FALSE;
+ return 0;
if (xtensa_format_length (isa, fmt) != 3
|| xtensa_format_length (isa, o_fmt) != 2)
- return FALSE;
+ return 0;
xtensa_format_encode (isa, o_fmt, o_insnbuf);
operand_count = xtensa_opcode_num_operands (isa, opcode);
o_operand_count = xtensa_opcode_num_operands (isa, o_opcode);
if (xtensa_opcode_encode (isa, o_fmt, 0, o_slotbuf, o_opcode) != 0)
- return FALSE;
+ return 0;
if (!is_or)
{
if (xtensa_opcode_num_operands (isa, o_opcode) != operand_count)
- return FALSE;
+ return 0;
}
else
{
uint32 rawval0, rawval1, rawval2;
- if (o_operand_count + 1 != operand_count)
- return FALSE;
- if (xtensa_operand_get_field (isa, opcode, 0,
- fmt, 0, slotbuf, &rawval0) != 0)
- return FALSE;
- if (xtensa_operand_get_field (isa, opcode, 1,
- fmt, 0, slotbuf, &rawval1) != 0)
- return FALSE;
- if (xtensa_operand_get_field (isa, opcode, 2,
- fmt, 0, slotbuf, &rawval2) != 0)
- return FALSE;
-
- if (rawval1 != rawval2)
- return FALSE;
- if (rawval0 == rawval1) /* it is a nop */
- return FALSE;
+ if (o_operand_count + 1 != operand_count
+ || xtensa_operand_get_field (isa, opcode, 0,
+ fmt, 0, slotbuf, &rawval0) != 0
+ || xtensa_operand_get_field (isa, opcode, 1,
+ fmt, 0, slotbuf, &rawval1) != 0
+ || xtensa_operand_get_field (isa, opcode, 2,
+ fmt, 0, slotbuf, &rawval2) != 0
+ || rawval1 != rawval2
+ || rawval0 == rawval1 /* it is a nop */)
+ return 0;
}
for (i = 0; i < o_operand_count; ++i)
@@ -3679,7 +3642,7 @@ narrow_instruction (bfd_byte *contents,
if (xtensa_operand_get_field (isa, opcode, i, fmt, 0,
slotbuf, &value)
|| xtensa_operand_decode (isa, opcode, i, &value))
- return FALSE;
+ return 0;
/* PC-relative branches need adjustment, but
the PC-rel operand will always have a relocation. */
@@ -3689,52 +3652,41 @@ narrow_instruction (bfd_byte *contents,
|| xtensa_operand_encode (isa, o_opcode, i, &newval)
|| xtensa_operand_set_field (isa, o_opcode, i, o_fmt, 0,
o_slotbuf, newval))
- return FALSE;
+ return 0;
}
- if (xtensa_format_set_slot (isa, o_fmt, 0,
- o_insnbuf, o_slotbuf) != 0)
- return FALSE;
+ if (xtensa_format_set_slot (isa, o_fmt, 0, o_insnbuf, o_slotbuf))
+ return 0;
- if (do_it)
- xtensa_insnbuf_to_chars (isa, o_insnbuf, contents + offset,
- content_length - offset);
- return TRUE;
+ return o_insnbuf;
}
}
- return FALSE;
+ return 0;
}
-/* Attempt to widen an instruction. Return true if the widening is
- valid. If the do_it parameter is non-zero, then the action should
- be performed inplace into the contents. Otherwise, do not modify
- the contents. The set of valid widenings are specified by a string
- table but require some special case operand checks in some
- cases. */
+/* Attempt to narrow an instruction. If the narrowing is valid, perform
+ the action in-place directly into the contents and return TRUE. Otherwise,
+ the return value is FALSE and the contents are not modified. */
static bfd_boolean
-widen_instruction (bfd_byte *contents,
- bfd_size_type content_length,
- bfd_size_type offset,
- bfd_boolean do_it)
+narrow_instruction (bfd_byte *contents,
+ bfd_size_type content_length,
+ bfd_size_type offset)
{
xtensa_opcode opcode;
- bfd_size_type insn_len, opi;
+ bfd_size_type insn_len;
xtensa_isa isa = xtensa_default_isa;
- xtensa_format fmt, o_fmt;
+ xtensa_format fmt;
+ xtensa_insnbuf o_insnbuf;
static xtensa_insnbuf insnbuf = NULL;
static xtensa_insnbuf slotbuf = NULL;
- static xtensa_insnbuf o_insnbuf = NULL;
- static xtensa_insnbuf o_slotbuf = NULL;
if (insnbuf == NULL)
{
insnbuf = xtensa_insnbuf_alloc (isa);
slotbuf = xtensa_insnbuf_alloc (isa);
- o_insnbuf = xtensa_insnbuf_alloc (isa);
- o_slotbuf = xtensa_insnbuf_alloc (isa);
}
BFD_ASSERT (offset < content_length);
@@ -3742,7 +3694,7 @@ widen_instruction (bfd_byte *contents,
if (content_length < 2)
return FALSE;
- /* We will hand code a few of these for a little while.
+ /* We will hand-code a few of these for a little while.
These have all been specified in the assembler aleady. */
xtensa_insnbuf_from_chars (isa, insnbuf, &contents[offset],
content_length - offset);
@@ -3760,7 +3712,43 @@ widen_instruction (bfd_byte *contents,
if (insn_len > content_length)
return FALSE;
- for (opi = 0; opi < (sizeof (widenable)/sizeof (struct string_pair)); ++opi)
+ o_insnbuf = can_narrow_instruction (slotbuf, fmt, opcode);
+ if (o_insnbuf)
+ {
+ xtensa_insnbuf_to_chars (isa, o_insnbuf, contents + offset,
+ content_length - offset);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
+/* Check if an instruction can be "widened", i.e., changed from a 2-byte
+ "density" instruction to a standard 3-byte instruction. If it is valid,
+ return the instruction buffer holding the wide instruction. Otherwise,
+ return 0. The set of valid widenings are specified by a string table
+ but require some special case operand checks in some cases. */
+
+static xtensa_insnbuf
+can_widen_instruction (xtensa_insnbuf slotbuf,
+ xtensa_format fmt,
+ xtensa_opcode opcode)
+{
+ xtensa_isa isa = xtensa_default_isa;
+ xtensa_format o_fmt;
+ unsigned opi;
+
+ static xtensa_insnbuf o_insnbuf = NULL;
+ static xtensa_insnbuf o_slotbuf = NULL;
+
+ if (o_insnbuf == NULL)
+ {
+ o_insnbuf = xtensa_insnbuf_alloc (isa);
+ o_slotbuf = xtensa_insnbuf_alloc (isa);
+ }
+
+ for (opi = 0; opi < (sizeof (widenable)/sizeof (struct string_pair)); opi++)
{
bfd_boolean is_or = (strcmp ("or", widenable[opi].wide) == 0);
bfd_boolean is_branch = (strcmp ("beqz", widenable[opi].wide) == 0
@@ -3778,14 +3766,14 @@ widen_instruction (bfd_byte *contents,
o_opcode = xtensa_opcode_lookup (isa, widenable[opi].wide);
if (o_opcode == XTENSA_UNDEFINED)
- return FALSE;
+ return 0;
o_fmt = get_single_format (o_opcode);
if (o_fmt == XTENSA_UNDEFINED)
- return FALSE;
+ return 0;
if (xtensa_format_length (isa, fmt) != 2
|| xtensa_format_length (isa, o_fmt) != 3)
- return FALSE;
+ return 0;
xtensa_format_encode (isa, o_fmt, o_insnbuf);
operand_count = xtensa_opcode_num_operands (isa, opcode);
@@ -3793,32 +3781,29 @@ widen_instruction (bfd_byte *contents,
check_operand_count = o_operand_count;
if (xtensa_opcode_encode (isa, o_fmt, 0, o_slotbuf, o_opcode) != 0)
- return FALSE;
+ return 0;
if (!is_or)
{
if (xtensa_opcode_num_operands (isa, o_opcode) != operand_count)
- return FALSE;
+ return 0;
}
else
{
uint32 rawval0, rawval1;
- if (o_operand_count != operand_count + 1)
- return FALSE;
- if (xtensa_operand_get_field (isa, opcode, 0,
- fmt, 0, slotbuf, &rawval0) != 0)
- return FALSE;
- if (xtensa_operand_get_field (isa, opcode, 1,
- fmt, 0, slotbuf, &rawval1) != 0)
- return FALSE;
- if (rawval0 == rawval1) /* it is a nop */
- return FALSE;
+ if (o_operand_count != operand_count + 1
+ || xtensa_operand_get_field (isa, opcode, 0,
+ fmt, 0, slotbuf, &rawval0) != 0
+ || xtensa_operand_get_field (isa, opcode, 1,
+ fmt, 0, slotbuf, &rawval1) != 0
+ || rawval0 == rawval1 /* it is a nop */)
+ return 0;
}
if (is_branch)
check_operand_count--;
- for (i = 0; i < check_operand_count; ++i)
+ for (i = 0; i < check_operand_count; i++)
{
int new_i = i;
if (is_or && i == o_operand_count - 1)
@@ -3826,7 +3811,7 @@ widen_instruction (bfd_byte *contents,
if (xtensa_operand_get_field (isa, opcode, new_i, fmt, 0,
slotbuf, &value)
|| xtensa_operand_decode (isa, opcode, new_i, &value))
- return FALSE;
+ return 0;
/* PC-relative branches need adjustment, but
the PC-rel operand will always have a relocation. */
@@ -3836,18 +3821,73 @@ widen_instruction (bfd_byte *contents,
|| xtensa_operand_encode (isa, o_opcode, i, &newval)
|| xtensa_operand_set_field (isa, o_opcode, i, o_fmt, 0,
o_slotbuf, newval))
- return FALSE;
+ return 0;
}
if (xtensa_format_set_slot (isa, o_fmt, 0, o_insnbuf, o_slotbuf))
- return FALSE;
+ return 0;
- if (do_it)
- xtensa_insnbuf_to_chars (isa, o_insnbuf, contents + offset,
- content_length - offset);
- return TRUE;
+ return o_insnbuf;
}
}
+ return 0;
+}
+
+
+/* Attempt to widen an instruction. If the widening is valid, perform
+ the action in-place directly into the contents and return TRUE. Otherwise,
+ the return value is FALSE and the contents are not modified. */
+
+static bfd_boolean
+widen_instruction (bfd_byte *contents,
+ bfd_size_type content_length,
+ bfd_size_type offset)
+{
+ xtensa_opcode opcode;
+ bfd_size_type insn_len;
+ xtensa_isa isa = xtensa_default_isa;
+ xtensa_format fmt;
+ xtensa_insnbuf o_insnbuf;
+
+ static xtensa_insnbuf insnbuf = NULL;
+ static xtensa_insnbuf slotbuf = NULL;
+
+ if (insnbuf == NULL)
+ {
+ insnbuf = xtensa_insnbuf_alloc (isa);
+ slotbuf = xtensa_insnbuf_alloc (isa);
+ }
+
+ BFD_ASSERT (offset < content_length);
+
+ if (content_length < 2)
+ return FALSE;
+
+ /* We will hand-code a few of these for a little while.
+ These have all been specified in the assembler aleady. */
+ xtensa_insnbuf_from_chars (isa, insnbuf, &contents[offset],
+ content_length - offset);
+ fmt = xtensa_format_decode (isa, insnbuf);
+ if (xtensa_format_num_slots (isa, fmt) != 1)
+ return FALSE;
+
+ if (xtensa_format_get_slot (isa, fmt, 0, insnbuf, slotbuf) != 0)
+ return FALSE;
+
+ opcode = xtensa_opcode_decode (isa, fmt, 0, slotbuf);
+ if (opcode == XTENSA_UNDEFINED)
+ return FALSE;
+ insn_len = xtensa_format_length (isa, fmt);
+ if (insn_len > content_length)
+ return FALSE;
+
+ o_insnbuf = can_widen_instruction (slotbuf, fmt, opcode);
+ if (o_insnbuf)
+ {
+ xtensa_insnbuf_to_chars (isa, o_insnbuf, contents + offset,
+ content_length - offset);
+ return TRUE;
+ }
return FALSE;
}
@@ -5007,13 +5047,16 @@ struct elf_xtensa_section_data
static bfd_boolean
elf_xtensa_new_section_hook (bfd *abfd, asection *sec)
{
- struct elf_xtensa_section_data *sdata;
- bfd_size_type amt = sizeof (*sdata);
+ if (!sec->used_by_bfd)
+ {
+ struct elf_xtensa_section_data *sdata;
+ bfd_size_type amt = sizeof (*sdata);
- sdata = (struct elf_xtensa_section_data *) bfd_zalloc (abfd, amt);
- if (sdata == NULL)
- return FALSE;
- sec->used_by_bfd = (void *) sdata;
+ sdata = bfd_zalloc (abfd, amt);
+ if (sdata == NULL)
+ return FALSE;
+ sec->used_by_bfd = sdata;
+ }
return _bfd_elf_new_section_hook (abfd, sec);
}
@@ -5498,7 +5541,7 @@ extend_ebb_bounds_forward (ebb_t *ebb)
new_entry = &ebb->ptbl[ebb->end_ptbl_idx + 1];
if (((new_entry->flags & XTENSA_PROP_INSN) == 0)
- || ((new_entry->flags & XTENSA_PROP_INSN_NO_TRANSFORM) != 0)
+ || ((new_entry->flags & XTENSA_PROP_NO_TRANSFORM) != 0)
|| ((the_entry->flags & XTENSA_PROP_ALIGN) != 0))
break;
@@ -5571,7 +5614,7 @@ extend_ebb_bounds_backward (ebb_t *ebb)
new_entry = &ebb->ptbl[ebb->start_ptbl_idx - 1];
if ((new_entry->flags & XTENSA_PROP_INSN) == 0
- || ((new_entry->flags & XTENSA_PROP_INSN_NO_TRANSFORM) != 0)
+ || ((new_entry->flags & XTENSA_PROP_NO_TRANSFORM) != 0)
|| ((new_entry->flags & XTENSA_PROP_ALIGN) != 0))
return TRUE;
if (new_entry->address + new_entry->size != the_entry->address)
@@ -5779,7 +5822,8 @@ static bfd_boolean compute_removed_literals
static Elf_Internal_Rela *get_irel_at_offset
(asection *, Elf_Internal_Rela *, bfd_vma);
static bfd_boolean is_removable_literal
- (const source_reloc *, int, const source_reloc *, int);
+ (const source_reloc *, int, const source_reloc *, int, asection *,
+ property_table_entry *, int);
static bfd_boolean remove_dead_literal
(bfd *, asection *, struct bfd_link_info *, Elf_Internal_Rela *,
Elf_Internal_Rela *, source_reloc *, property_table_entry *, int);
@@ -5926,6 +5970,8 @@ analyze_relocations (struct bfd_link_info *link_info)
relax_info->src_relocs = (source_reloc *)
bfd_malloc (relax_info->src_count * sizeof (source_reloc));
}
+ else
+ relax_info->src_count = 0;
}
/* Collect info on relocations against each relaxable section. */
@@ -5969,6 +6015,7 @@ find_relaxable_sections (bfd *abfd,
bfd_boolean ok = TRUE;
unsigned i;
xtensa_relax_info *source_relax_info;
+ bfd_boolean is_l32r_reloc;
internal_relocs = retrieve_internal_relocs (abfd, sec,
link_info->keep_memory);
@@ -6019,13 +6066,21 @@ find_relaxable_sections (bfd *abfd,
/* Count PC-relative operand relocations against the target section.
Note: The conditions tested here must match the conditions under
which init_source_reloc is called in collect_source_relocs(). */
- if (is_operand_relocation (ELF32_R_TYPE (irel->r_info))
- && (!is_alt_relocation (ELF32_R_TYPE (irel->r_info))
- || is_l32r_relocation (abfd, sec, contents, irel)))
- target_relax_info->src_count++;
+ is_l32r_reloc = FALSE;
+ if (is_operand_relocation (ELF32_R_TYPE (irel->r_info)))
+ {
+ xtensa_opcode opcode =
+ get_relocation_opcode (abfd, sec, contents, irel);
+ if (opcode != XTENSA_UNDEFINED)
+ {
+ is_l32r_reloc = (opcode == get_l32r_opcode ());
+ if (!is_alt_relocation (ELF32_R_TYPE (irel->r_info))
+ || is_l32r_reloc)
+ target_relax_info->src_count++;
+ }
+ }
- if (is_l32r_relocation (abfd, sec, contents, irel)
- && r_reloc_is_defined (&r_rel))
+ if (is_l32r_reloc && r_reloc_is_defined (&r_rel))
{
/* Mark the target section as relaxable. */
target_relax_info->is_relaxable_literal_section = TRUE;
@@ -6346,14 +6401,12 @@ compute_text_actions (bfd *abfd,
property_table_entry *prop_table = 0;
int ptblsize = 0;
bfd_size_type sec_size;
- static bfd_boolean no_insn_move = FALSE;
-
- if (no_insn_move)
- return ok;
- /* Do nothing if the section contains no optimized longcalls. */
relax_info = get_xtensa_relax_info (sec);
BFD_ASSERT (relax_info);
+ BFD_ASSERT (relax_info->src_next == relax_info->src_count);
+
+ /* Do nothing if the section contains no optimized longcalls. */
if (!relax_info->is_relaxable_asm_section)
return ok;
@@ -6428,7 +6481,7 @@ compute_text_actions (bfd *abfd,
the_entry++;
}
- if (the_entry->flags & XTENSA_PROP_INSN_NO_TRANSFORM)
+ if (the_entry->flags & XTENSA_PROP_NO_TRANSFORM)
/* NO_REORDER is OK */
continue;
@@ -6492,6 +6545,23 @@ error_return:
}
+/* Do not widen an instruction if it is preceeded by a
+ loop opcode. It might cause misalignment. */
+
+static bfd_boolean
+prev_instr_is_a_loop (bfd_byte *contents,
+ bfd_size_type content_length,
+ bfd_size_type offset)
+{
+ xtensa_opcode prev_opcode;
+
+ if (offset < 3)
+ return FALSE;
+ prev_opcode = insn_decode_opcode (contents, content_length, offset-3, 0);
+ return (xtensa_opcode_is_loop (xtensa_default_isa, prev_opcode) == 1);
+}
+
+
/* Find all of the possible actions for an extended basic block. */
bfd_boolean
@@ -6500,13 +6570,24 @@ compute_ebb_proposed_actions (ebb_constraint *ebb_table)
const ebb_t *ebb = &ebb_table->ebb;
unsigned rel_idx = ebb->start_reloc_idx;
property_table_entry *entry, *start_entry, *end_entry;
+ bfd_vma offset = 0;
+ xtensa_isa isa = xtensa_default_isa;
+ xtensa_format fmt;
+ static xtensa_insnbuf insnbuf = NULL;
+ static xtensa_insnbuf slotbuf = NULL;
+
+ if (insnbuf == NULL)
+ {
+ insnbuf = xtensa_insnbuf_alloc (isa);
+ slotbuf = xtensa_insnbuf_alloc (isa);
+ }
start_entry = &ebb->ptbl[ebb->start_ptbl_idx];
end_entry = &ebb->ptbl[ebb->end_ptbl_idx];
for (entry = start_entry; entry <= end_entry; entry++)
{
- bfd_vma offset, start_offset, end_offset;
+ bfd_vma start_offset, end_offset;
bfd_size_type insn_len;
start_offset = entry->address - ebb->sec->vma;
@@ -6528,15 +6609,9 @@ compute_ebb_proposed_actions (ebb_constraint *ebb_table)
insn_len = insn_decode_len (ebb->contents, ebb->content_length,
offset);
-
- /* Propose no actions for a section with an undecodable offset. */
if (insn_len == 0)
- {
- (*_bfd_error_handler)
- (_("%B(%A+0x%lx): could not decode instruction; possible configuration mismatch"),
- ebb->sec->owner, ebb->sec, offset);
- return FALSE;
- }
+ goto decode_error;
+
if (check_branch_target_aligned_address (offset, insn_len))
align_type = EBB_REQUIRE_TGT_ALIGN;
@@ -6567,12 +6642,7 @@ compute_ebb_proposed_actions (ebb_constraint *ebb_table)
ebb->content_length,
irel->r_offset);
if (simplify_size == 0)
- {
- (*_bfd_error_handler)
- (_("%B(%A+0x%lx): could not decode instruction for XTENSA_ASM_SIMPLIFY relocation; possible configuration mismatch"),
- ebb->sec->owner, ebb->sec, offset);
- return FALSE;
- }
+ goto decode_error;
ebb_propose_action (ebb_table, EBB_NO_ALIGN, 0,
ta_convert_longcall, offset, 0, TRUE);
@@ -6581,47 +6651,50 @@ compute_ebb_proposed_actions (ebb_constraint *ebb_table)
continue;
}
- insn_len = insn_decode_len (ebb->contents, ebb->content_length,
- offset);
- /* If the instruction is undecodable, then report an error. */
- if (insn_len == 0)
+ if (offset + MIN_INSN_LENGTH > ebb->content_length)
+ goto decode_error;
+ xtensa_insnbuf_from_chars (isa, insnbuf, &ebb->contents[offset],
+ ebb->content_length - offset);
+ fmt = xtensa_format_decode (isa, insnbuf);
+ if (fmt == XTENSA_UNDEFINED)
+ goto decode_error;
+ insn_len = xtensa_format_length (isa, fmt);
+ if (insn_len == (bfd_size_type) XTENSA_UNDEFINED)
+ goto decode_error;
+
+ if (xtensa_format_num_slots (isa, fmt) != 1)
{
- (*_bfd_error_handler)
- (_("%B(%A+0x%lx): could not decode instruction; possible configuration mismatch"),
- ebb->sec->owner, ebb->sec, offset);
- return FALSE;
+ offset += insn_len;
+ continue;
}
-
+
+ xtensa_format_get_slot (isa, fmt, 0, insnbuf, slotbuf);
+ opcode = xtensa_opcode_decode (isa, fmt, 0, slotbuf);
+ if (opcode == XTENSA_UNDEFINED)
+ goto decode_error;
+
if ((entry->flags & XTENSA_PROP_INSN_NO_DENSITY) == 0
- && (entry->flags & XTENSA_PROP_INSN_NO_TRANSFORM) == 0
- && narrow_instruction (ebb->contents, ebb->content_length,
- offset, FALSE))
+ && (entry->flags & XTENSA_PROP_NO_TRANSFORM) == 0
+ && can_narrow_instruction (slotbuf, fmt, opcode) != 0)
{
/* Add an instruction narrow action. */
ebb_propose_action (ebb_table, EBB_NO_ALIGN, 0,
ta_narrow_insn, offset, 0, FALSE);
- offset += insn_len;
- continue;
}
- if ((entry->flags & XTENSA_PROP_INSN_NO_TRANSFORM) == 0
- && widen_instruction (ebb->contents, ebb->content_length,
- offset, FALSE))
+ else if ((entry->flags & XTENSA_PROP_NO_TRANSFORM) == 0
+ && can_widen_instruction (slotbuf, fmt, opcode) != 0
+ && ! prev_instr_is_a_loop (ebb->contents,
+ ebb->content_length, offset))
{
/* Add an instruction widen action. */
ebb_propose_action (ebb_table, EBB_NO_ALIGN, 0,
ta_widen_insn, offset, 0, FALSE);
- offset += insn_len;
- continue;
}
- opcode = insn_decode_opcode (ebb->contents, ebb->content_length,
- offset, 0);
- if (xtensa_opcode_is_loop (xtensa_default_isa, opcode))
+ else if (xtensa_opcode_is_loop (xtensa_default_isa, opcode) == 1)
{
/* Check for branch targets. */
ebb_propose_action (ebb_table, EBB_REQUIRE_LOOP_ALIGN, 0,
ta_none, offset, 0, TRUE);
- offset += insn_len;
- continue;
}
offset += insn_len;
@@ -6635,6 +6708,12 @@ compute_ebb_proposed_actions (ebb_constraint *ebb_table)
}
return TRUE;
+
+ decode_error:
+ (*_bfd_error_handler)
+ (_("%B(%A+0x%lx): could not decode instruction; possible configuration mismatch"),
+ ebb->sec->owner, ebb->sec, offset);
+ return FALSE;
}
@@ -7352,7 +7431,8 @@ compute_removed_literals (bfd *abfd,
/* Check if the relocation was from an L32R that is being removed
because a CALLX was converted to a direct CALL, and check if
there are no other relocations to the literal. */
- if (is_removable_literal (rel, i, src_relocs, relax_info->src_count))
+ if (is_removable_literal (rel, i, src_relocs, relax_info->src_count,
+ sec, prop_table, ptblsize))
{
if (!remove_dead_literal (abfd, sec, link_info, internal_relocs,
irel, rel, prop_table, ptblsize))
@@ -7436,12 +7516,22 @@ bfd_boolean
is_removable_literal (const source_reloc *rel,
int i,
const source_reloc *src_relocs,
- int src_count)
+ int src_count,
+ asection *sec,
+ property_table_entry *prop_table,
+ int ptblsize)
{
const source_reloc *curr_rel;
+ property_table_entry *entry;
+
if (!rel->is_null)
return FALSE;
+ entry = elf_xtensa_find_property_entry (prop_table, ptblsize,
+ sec->vma + rel->r_rel.target_offset);
+ if (entry && (entry->flags & XTENSA_PROP_NO_TRANSFORM))
+ return FALSE;
+
for (++i; i < src_count; ++i)
{
curr_rel = &src_relocs[i];
@@ -7731,7 +7821,7 @@ coalesce_shared_literal (asection *sec,
entry = elf_xtensa_find_property_entry
(prop_table, ptblsize, sec->vma + rel->r_rel.target_offset);
- if (entry && (entry->flags & XTENSA_PROP_INSN_NO_TRANSFORM))
+ if (entry && (entry->flags & XTENSA_PROP_NO_TRANSFORM))
return TRUE;
/* Mark that the literal will be coalesced. */
@@ -8247,7 +8337,7 @@ relax_section (bfd *abfd, asection *sec, struct bfd_link_info *link_info)
copy_size = 2;
memmove (scratch, &contents[orig_dot], orig_insn_size);
BFD_ASSERT (action->removed_bytes == 1);
- rv = narrow_instruction (scratch, final_size, 0, TRUE);
+ rv = narrow_instruction (scratch, final_size, 0);
BFD_ASSERT (rv);
memmove (&dup_contents[dup_dot], scratch, copy_size);
orig_dot += orig_insn_size;
@@ -8280,7 +8370,7 @@ relax_section (bfd *abfd, asection *sec, struct bfd_link_info *link_info)
copy_size = 3;
memmove (scratch, &contents[orig_dot], orig_insn_size);
BFD_ASSERT (action->removed_bytes == -1);
- rv = widen_instruction (scratch, final_size, 0, TRUE);
+ rv = widen_instruction (scratch, final_size, 0);
BFD_ASSERT (rv);
memmove (&dup_contents[dup_dot], scratch, copy_size);
orig_dot += orig_insn_size;
@@ -8557,6 +8647,7 @@ shrink_dynamic_reloc_sections (struct bfd_link_info *info,
asection *input_section,
Elf_Internal_Rela *rel)
{
+ struct elf_xtensa_link_hash_table *htab;
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
unsigned long r_symndx;
@@ -8564,6 +8655,7 @@ shrink_dynamic_reloc_sections (struct bfd_link_info *info,
struct elf_link_hash_entry *h;
bfd_boolean dynamic_symbol;
+ htab = elf_xtensa_hash_table (info);
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
@@ -8575,30 +8667,24 @@ shrink_dynamic_reloc_sections (struct bfd_link_info *info,
else
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- dynamic_symbol = xtensa_elf_dynamic_symbol_p (h, info);
+ dynamic_symbol = elf_xtensa_dynamic_symbol_p (h, info);
if ((r_type == R_XTENSA_32 || r_type == R_XTENSA_PLT)
&& (input_section->flags & SEC_ALLOC) != 0
&& (dynamic_symbol || info->shared))
{
- bfd *dynobj;
- const char *srel_name;
asection *srel;
bfd_boolean is_plt = FALSE;
- dynobj = elf_hash_table (info)->dynobj;
- BFD_ASSERT (dynobj != NULL);
-
if (dynamic_symbol && r_type == R_XTENSA_PLT)
{
- srel_name = ".rela.plt";
+ srel = htab->srelplt;
is_plt = TRUE;
}
else
- srel_name = ".rela.got";
+ srel = htab->srelgot;
/* Reduce size of the .rela.* section by one reloc. */
- srel = bfd_get_section_by_name (dynobj, srel_name);
BFD_ASSERT (srel != NULL);
BFD_ASSERT (srel->size >= sizeof (Elf32_External_Rela));
srel->size -= sizeof (Elf32_External_Rela);
@@ -8617,15 +8703,15 @@ shrink_dynamic_reloc_sections (struct bfd_link_info *info,
reloc_index = srel->size / sizeof (Elf32_External_Rela);
chunk = reloc_index / PLT_ENTRIES_PER_CHUNK;
- splt = elf_xtensa_get_plt_section (dynobj, chunk);
- sgotplt = elf_xtensa_get_gotplt_section (dynobj, chunk);
+ splt = elf_xtensa_get_plt_section (info, chunk);
+ sgotplt = elf_xtensa_get_gotplt_section (info, chunk);
BFD_ASSERT (splt != NULL && sgotplt != NULL);
/* Check if an entire PLT chunk has just been eliminated. */
if (reloc_index % PLT_ENTRIES_PER_CHUNK == 0)
{
/* The two magic GOT entries for that chunk can go away. */
- srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
+ srelgot = htab->srelgot;
BFD_ASSERT (srelgot != NULL);
srelgot->reloc_count -= 2;
srelgot->size -= 2 * sizeof (Elf32_External_Rela);
@@ -8794,12 +8880,13 @@ relax_property_section (bfd *abfd,
{
Elf_Internal_Rela *internal_relocs;
bfd_byte *contents;
- unsigned i, nexti;
+ unsigned i;
bfd_boolean ok = TRUE;
bfd_boolean is_full_prop_section;
size_t last_zfill_target_offset = 0;
asection *last_zfill_target_sec = NULL;
bfd_size_type sec_size;
+ bfd_size_type entry_size;
sec_size = bfd_get_section_limit (abfd, sec);
internal_relocs = retrieve_internal_relocs (abfd, sec,
@@ -8811,10 +8898,11 @@ relax_property_section (bfd *abfd,
goto error_return;
}
- is_full_prop_section =
- ((strcmp (sec->name, XTENSA_PROP_SEC_NAME) == 0)
- || (strncmp (sec->name, ".gnu.linkonce.prop.",
- sizeof ".gnu.linkonce.prop." - 1) == 0));
+ is_full_prop_section = xtensa_is_proptable_section (sec);
+ if (is_full_prop_section)
+ entry_size = 12;
+ else
+ entry_size = 8;
if (internal_relocs)
{
@@ -8843,12 +8931,8 @@ relax_property_section (bfd *abfd,
size_p = &contents[irel->r_offset + 4];
flags_p = NULL;
if (is_full_prop_section)
- {
- flags_p = &contents[irel->r_offset + 8];
- BFD_ASSERT (irel->r_offset + 12 <= sec_size);
- }
- else
- BFD_ASSERT (irel->r_offset + 8 <= sec_size);
+ flags_p = &contents[irel->r_offset + 8];
+ BFD_ASSERT (irel->r_offset + entry_size <= sec_size);
target_sec = r_reloc_get_section (&val.r_rel);
target_relax_info = get_xtensa_relax_info (target_sec);
@@ -8932,74 +9016,105 @@ relax_property_section (bfd *abfd,
reclaim the space in the output section, so we do this twice. */
if (internal_relocs && (!link_info->relocatable
- || strcmp (sec->name, XTENSA_LIT_SEC_NAME) == 0))
+ || xtensa_is_littable_section (sec)))
{
Elf_Internal_Rela *last_irel = NULL;
+ Elf_Internal_Rela *irel, *next_rel, *rel_end;
int removed_bytes = 0;
- bfd_vma offset, last_irel_offset;
+ bfd_vma offset;
bfd_vma section_size;
- bfd_size_type entry_size;
flagword predef_flags;
- if (is_full_prop_section)
- entry_size = 12;
- else
- entry_size = 8;
-
predef_flags = xtensa_get_property_predef_flags (sec);
- /* Walk over memory and irels at the same time.
+ /* Walk over memory and relocations at the same time.
This REQUIRES that the internal_relocs be sorted by offset. */
qsort (internal_relocs, sec->reloc_count, sizeof (Elf_Internal_Rela),
internal_reloc_compare);
- nexti = 0; /* Index into internal_relocs. */
pin_internal_relocs (sec, internal_relocs);
pin_contents (sec, contents);
- last_irel_offset = (bfd_vma) -1;
+ next_rel = internal_relocs;
+ rel_end = internal_relocs + sec->reloc_count;
+
section_size = sec->size;
BFD_ASSERT (section_size % entry_size == 0);
for (offset = 0; offset < section_size; offset += entry_size)
{
- Elf_Internal_Rela *irel, *next_irel;
+ Elf_Internal_Rela *offset_rel, *extra_rel;
bfd_vma bytes_to_remove, size, actual_offset;
- bfd_boolean remove_this_irel;
+ bfd_boolean remove_this_rel;
flagword flags;
- irel = NULL;
- next_irel = NULL;
-
- /* Find the next two relocations (if there are that many left),
- skipping over any R_XTENSA_NONE relocs. On entry, "nexti" is
- the starting reloc index. After these two loops, "i"
- is the index of the first non-NONE reloc past that starting
- index, and "nexti" is the index for the next non-NONE reloc
- after "i". */
+ /* Find the first relocation for the entry at the current offset.
+ Adjust the offsets of any extra relocations for the previous
+ entry. */
+ offset_rel = NULL;
+ if (next_rel)
+ {
+ for (irel = next_rel; irel < rel_end; irel++)
+ {
+ if ((irel->r_offset == offset
+ && ELF32_R_TYPE (irel->r_info) != R_XTENSA_NONE)
+ || irel->r_offset > offset)
+ {
+ offset_rel = irel;
+ break;
+ }
+ irel->r_offset -= removed_bytes;
+ }
+ }
- for (i = nexti; i < sec->reloc_count; i++)
+ /* Find the next relocation (if there are any left). */
+ extra_rel = NULL;
+ if (offset_rel)
{
- if (ELF32_R_TYPE (internal_relocs[i].r_info) != R_XTENSA_NONE)
+ for (irel = offset_rel + 1; irel < rel_end; irel++)
{
- irel = &internal_relocs[i];
- break;
+ if (ELF32_R_TYPE (irel->r_info) != R_XTENSA_NONE)
+ {
+ extra_rel = irel;
+ break;
+ }
}
- internal_relocs[i].r_offset -= removed_bytes;
}
- for (nexti = i + 1; nexti < sec->reloc_count; nexti++)
+ /* Check if there are relocations on the current entry. There
+ should usually be a relocation on the offset field. If there
+ are relocations on the size or flags, then we can't optimize
+ this entry. Also, find the next relocation to examine on the
+ next iteration. */
+ if (offset_rel)
{
- if (ELF32_R_TYPE (internal_relocs[nexti].r_info)
- != R_XTENSA_NONE)
+ if (offset_rel->r_offset >= offset + entry_size)
{
- next_irel = &internal_relocs[nexti];
- break;
+ next_rel = offset_rel;
+ /* There are no relocations on the current entry, but we
+ might still be able to remove it if the size is zero. */
+ offset_rel = NULL;
+ }
+ else if (offset_rel->r_offset > offset
+ || (extra_rel
+ && extra_rel->r_offset < offset + entry_size))
+ {
+ /* There is a relocation on the size or flags, so we can't
+ do anything with this entry. Continue with the next. */
+ next_rel = offset_rel;
+ continue;
+ }
+ else
+ {
+ BFD_ASSERT (offset_rel->r_offset == offset);
+ offset_rel->r_offset -= removed_bytes;
+ next_rel = offset_rel + 1;
}
- internal_relocs[nexti].r_offset -= removed_bytes;
}
+ else
+ next_rel = NULL;
- remove_this_irel = FALSE;
+ remove_this_rel = FALSE;
bytes_to_remove = 0;
actual_offset = offset - removed_bytes;
size = bfd_get_32 (abfd, &contents[actual_offset + 4]);
@@ -9009,90 +9124,64 @@ relax_property_section (bfd *abfd,
else
flags = predef_flags;
- /* Check that the irels are sorted by offset,
- with only one per address. */
- BFD_ASSERT (!irel || (int) irel->r_offset > (int) last_irel_offset);
- BFD_ASSERT (!next_irel || next_irel->r_offset > irel->r_offset);
-
- /* Make sure there aren't relocs on the size or flag fields. */
- if ((irel && irel->r_offset == offset + 4)
- || (is_full_prop_section
- && irel && irel->r_offset == offset + 8))
- {
- irel->r_offset -= removed_bytes;
- last_irel_offset = irel->r_offset;
- }
- else if (next_irel && (next_irel->r_offset == offset + 4
- || (is_full_prop_section
- && next_irel->r_offset == offset + 8)))
- {
- nexti += 1;
- irel->r_offset -= removed_bytes;
- next_irel->r_offset -= removed_bytes;
- last_irel_offset = next_irel->r_offset;
- }
- else if (size == 0 && (flags & XTENSA_PROP_ALIGN) == 0
- && (flags & XTENSA_PROP_UNREACHABLE) == 0)
+ if (size == 0
+ && (flags & XTENSA_PROP_ALIGN) == 0
+ && (flags & XTENSA_PROP_UNREACHABLE) == 0)
{
/* Always remove entries with zero size and no alignment. */
bytes_to_remove = entry_size;
- if (irel && irel->r_offset == offset)
- {
- remove_this_irel = TRUE;
-
- irel->r_offset -= removed_bytes;
- last_irel_offset = irel->r_offset;
- }
+ if (offset_rel)
+ remove_this_rel = TRUE;
}
- else if (irel && irel->r_offset == offset)
+ else if (offset_rel
+ && ELF32_R_TYPE (offset_rel->r_info) == R_XTENSA_32)
{
- if (ELF32_R_TYPE (irel->r_info) == R_XTENSA_32)
+ if (last_irel)
{
- if (last_irel)
+ flagword old_flags;
+ bfd_vma old_size =
+ bfd_get_32 (abfd, &contents[last_irel->r_offset + 4]);
+ bfd_vma old_address =
+ (last_irel->r_addend
+ + bfd_get_32 (abfd, &contents[last_irel->r_offset]));
+ bfd_vma new_address =
+ (offset_rel->r_addend
+ + bfd_get_32 (abfd, &contents[actual_offset]));
+ if (is_full_prop_section)
+ old_flags = bfd_get_32
+ (abfd, &contents[last_irel->r_offset + 8]);
+ else
+ old_flags = predef_flags;
+
+ if ((ELF32_R_SYM (offset_rel->r_info)
+ == ELF32_R_SYM (last_irel->r_info))
+ && old_address + old_size == new_address
+ && old_flags == flags
+ && (old_flags & XTENSA_PROP_INSN_BRANCH_TARGET) == 0
+ && (old_flags & XTENSA_PROP_INSN_LOOP_TARGET) == 0)
{
- flagword old_flags;
- bfd_vma old_size =
- bfd_get_32 (abfd, &contents[last_irel->r_offset + 4]);
- bfd_vma old_address =
- (last_irel->r_addend
- + bfd_get_32 (abfd, &contents[last_irel->r_offset]));
- bfd_vma new_address =
- (irel->r_addend
- + bfd_get_32 (abfd, &contents[actual_offset]));
- if (is_full_prop_section)
- old_flags = bfd_get_32
- (abfd, &contents[last_irel->r_offset + 8]);
- else
- old_flags = predef_flags;
-
- if ((ELF32_R_SYM (irel->r_info)
- == ELF32_R_SYM (last_irel->r_info))
- && old_address + old_size == new_address
- && old_flags == flags
- && (old_flags & XTENSA_PROP_INSN_BRANCH_TARGET) == 0
- && (old_flags & XTENSA_PROP_INSN_LOOP_TARGET) == 0)
- {
- /* Fix the old size. */
- bfd_put_32 (abfd, old_size + size,
- &contents[last_irel->r_offset + 4]);
- bytes_to_remove = entry_size;
- remove_this_irel = TRUE;
- }
- else
- last_irel = irel;
+ /* Fix the old size. */
+ bfd_put_32 (abfd, old_size + size,
+ &contents[last_irel->r_offset + 4]);
+ bytes_to_remove = entry_size;
+ remove_this_rel = TRUE;
}
else
- last_irel = irel;
+ last_irel = offset_rel;
}
-
- irel->r_offset -= removed_bytes;
- last_irel_offset = irel->r_offset;
+ else
+ last_irel = offset_rel;
}
- if (remove_this_irel)
+ if (remove_this_rel)
{
- irel->r_info = ELF32_R_INFO (0, R_XTENSA_NONE);
- irel->r_offset -= bytes_to_remove;
+ offset_rel->r_info = ELF32_R_INFO (0, R_XTENSA_NONE);
+ /* In case this is the last entry, move the relocation offset
+ to the previous entry, if there is one. */
+ if (offset_rel->r_offset >= bytes_to_remove)
+ offset_rel->r_offset -= bytes_to_remove;
+ else
+ offset_rel->r_offset = 0;
}
if (bytes_to_remove != 0)
@@ -9107,6 +9196,10 @@ relax_property_section (bfd *abfd,
if (removed_bytes)
{
+ /* Fix up any extra relocations on the last entry. */
+ for (irel = next_rel; irel < rel_end; irel++)
+ irel->r_offset -= removed_bytes;
+
/* Clear the removed bytes. */
memset (&contents[section_size - removed_bytes], 0, removed_bytes);
@@ -9114,14 +9207,9 @@ relax_property_section (bfd *abfd,
if (xtensa_is_littable_section (sec))
{
- bfd *dynobj = elf_hash_table (link_info)->dynobj;
- if (dynobj)
- {
- asection *sgotloc =
- bfd_get_section_by_name (dynobj, ".got.loc");
- if (sgotloc)
- sgotloc->size -= removed_bytes;
- }
+ asection *sgotloc = elf_xtensa_hash_table (link_info)->sgotloc;
+ if (sgotloc)
+ sgotloc->size -= removed_bytes;
}
}
}
@@ -9307,26 +9395,38 @@ do_fix_for_final_link (Elf_Internal_Rela *rel,
/* Miscellaneous utility functions.... */
static asection *
-elf_xtensa_get_plt_section (bfd *dynobj, int chunk)
+elf_xtensa_get_plt_section (struct bfd_link_info *info, int chunk)
{
+ struct elf_xtensa_link_hash_table *htab;
+ bfd *dynobj;
char plt_name[10];
if (chunk == 0)
- return bfd_get_section_by_name (dynobj, ".plt");
+ {
+ htab = elf_xtensa_hash_table (info);
+ return htab->splt;
+ }
+ dynobj = elf_hash_table (info)->dynobj;
sprintf (plt_name, ".plt.%u", chunk);
return bfd_get_section_by_name (dynobj, plt_name);
}
static asection *
-elf_xtensa_get_gotplt_section (bfd *dynobj, int chunk)
+elf_xtensa_get_gotplt_section (struct bfd_link_info *info, int chunk)
{
+ struct elf_xtensa_link_hash_table *htab;
+ bfd *dynobj;
char got_name[14];
if (chunk == 0)
- return bfd_get_section_by_name (dynobj, ".got.plt");
+ {
+ htab = elf_xtensa_hash_table (info);
+ return htab->sgotplt;
+ }
+ dynobj = elf_hash_table (info)->dynobj;
sprintf (got_name, ".got.plt.%u", chunk);
return bfd_get_section_by_name (dynobj, got_name);
}
@@ -9474,24 +9574,23 @@ pcrel_reloc_fits (xtensa_opcode opc,
}
-static int linkonce_len = sizeof (".gnu.linkonce.") - 1;
-static int insn_sec_len = sizeof (XTENSA_INSN_SEC_NAME) - 1;
-static int lit_sec_len = sizeof (XTENSA_LIT_SEC_NAME) - 1;
-static int prop_sec_len = sizeof (XTENSA_PROP_SEC_NAME) - 1;
-
-
static bfd_boolean
xtensa_is_property_section (asection *sec)
{
- if (strncmp (XTENSA_INSN_SEC_NAME, sec->name, insn_sec_len) == 0
- || strncmp (XTENSA_LIT_SEC_NAME, sec->name, lit_sec_len) == 0
- || strncmp (XTENSA_PROP_SEC_NAME, sec->name, prop_sec_len) == 0)
+ if (xtensa_is_insntable_section (sec)
+ || xtensa_is_littable_section (sec)
+ || xtensa_is_proptable_section (sec))
return TRUE;
- if (strncmp (".gnu.linkonce.", sec->name, linkonce_len) == 0
- && (strncmp (&sec->name[linkonce_len], "x.", 2) == 0
- || strncmp (&sec->name[linkonce_len], "p.", 2) == 0
- || strncmp (&sec->name[linkonce_len], "prop.", 5) == 0))
+ return FALSE;
+}
+
+
+static bfd_boolean
+xtensa_is_insntable_section (asection *sec)
+{
+ if (CONST_STRNEQ (sec->name, XTENSA_INSN_SEC_NAME)
+ || CONST_STRNEQ (sec->name, ".gnu.linkonce.x."))
return TRUE;
return FALSE;
@@ -9501,12 +9600,19 @@ xtensa_is_property_section (asection *sec)
static bfd_boolean
xtensa_is_littable_section (asection *sec)
{
- if (strncmp (XTENSA_LIT_SEC_NAME, sec->name, lit_sec_len) == 0)
+ if (CONST_STRNEQ (sec->name, XTENSA_LIT_SEC_NAME)
+ || CONST_STRNEQ (sec->name, ".gnu.linkonce.p."))
return TRUE;
- if (strncmp (".gnu.linkonce.", sec->name, linkonce_len) == 0
- && sec->name[linkonce_len] == 'p'
- && sec->name[linkonce_len + 1] == '.')
+ return FALSE;
+}
+
+
+static bfd_boolean
+xtensa_is_proptable_section (asection *sec)
+{
+ if (CONST_STRNEQ (sec->name, XTENSA_PROP_SEC_NAME)
+ || CONST_STRNEQ (sec->name, ".gnu.linkonce.prop."))
return TRUE;
return FALSE;
@@ -9548,13 +9654,44 @@ internal_reloc_matches (const void *ap, const void *bp)
}
-char *
-xtensa_get_property_section_name (asection *sec, const char *base_name)
+/* Predicate function used to look up a section in a particular group. */
+
+static bfd_boolean
+match_section_group (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *inf)
+{
+ const char *gname = inf;
+ const char *group_name = elf_group_name (sec);
+
+ return (group_name == gname
+ || (group_name != NULL
+ && gname != NULL
+ && strcmp (group_name, gname) == 0));
+}
+
+
+static int linkonce_len = sizeof (".gnu.linkonce.") - 1;
+
+asection *
+xtensa_get_property_section (asection *sec, const char *base_name)
{
- if (strncmp (sec->name, ".gnu.linkonce.", linkonce_len) == 0)
+ const char *suffix, *group_name;
+ char *prop_sec_name;
+ asection *prop_sec;
+
+ group_name = elf_group_name (sec);
+ if (group_name)
+ {
+ suffix = strrchr (sec->name, '.');
+ if (suffix == sec->name)
+ suffix = 0;
+ prop_sec_name = (char *) bfd_malloc (strlen (base_name) + 1
+ + (suffix ? strlen (suffix) : 0));
+ strcpy (prop_sec_name, base_name);
+ if (suffix)
+ strcat (prop_sec_name, suffix);
+ }
+ else if (strncmp (sec->name, ".gnu.linkonce.", linkonce_len) == 0)
{
- char *prop_sec_name;
- const char *suffix;
char *linkonce_kind = 0;
if (strcmp (base_name, XTENSA_INSN_SEC_NAME) == 0)
@@ -9574,30 +9711,48 @@ xtensa_get_property_section_name (asection *sec, const char *base_name)
suffix = sec->name + linkonce_len;
/* For backward compatibility, replace "t." instead of inserting
the new linkonce_kind (but not for "prop" sections). */
- if (strncmp (suffix, "t.", 2) == 0 && linkonce_kind[1] == '.')
+ if (CONST_STRNEQ (suffix, "t.") && linkonce_kind[1] == '.')
suffix += 2;
strcat (prop_sec_name + linkonce_len, suffix);
+ }
+ else
+ prop_sec_name = strdup (base_name);
+
+ /* Check if the section already exists. */
+ prop_sec = bfd_get_section_by_name_if (sec->owner, prop_sec_name,
+ match_section_group,
+ (void *) group_name);
+ /* If not, create it. */
+ if (! prop_sec)
+ {
+ flagword flags = (SEC_RELOC | SEC_HAS_CONTENTS | SEC_READONLY);
+ flags |= (bfd_get_section_flags (sec->owner, sec)
+ & (SEC_LINK_ONCE | SEC_LINK_DUPLICATES));
+
+ prop_sec = bfd_make_section_anyway_with_flags
+ (sec->owner, strdup (prop_sec_name), flags);
+ if (! prop_sec)
+ return 0;
- return prop_sec_name;
+ elf_group_name (prop_sec) = group_name;
}
- return strdup (base_name);
+ free (prop_sec_name);
+ return prop_sec;
}
flagword
xtensa_get_property_predef_flags (asection *sec)
{
- if (strcmp (sec->name, XTENSA_INSN_SEC_NAME) == 0
- || strncmp (sec->name, ".gnu.linkonce.x.",
- sizeof ".gnu.linkonce.x." - 1) == 0)
+ if (xtensa_is_insntable_section (sec))
return (XTENSA_PROP_INSN
- | XTENSA_PROP_INSN_NO_TRANSFORM
+ | XTENSA_PROP_NO_TRANSFORM
| XTENSA_PROP_INSN_NO_REORDER);
if (xtensa_is_littable_section (sec))
return (XTENSA_PROP_LITERAL
- | XTENSA_PROP_INSN_NO_TRANSFORM
+ | XTENSA_PROP_NO_TRANSFORM
| XTENSA_PROP_INSN_NO_REORDER);
return 0;
@@ -9624,7 +9779,7 @@ xtensa_callback_required_dependence (bfd *abfd,
/* ".plt*" sections have no explicit relocations but they contain L32R
instructions that reference the corresponding ".got.plt*" sections. */
if ((sec->flags & SEC_LINKER_CREATED) != 0
- && strncmp (sec->name, ".plt", 4) == 0)
+ && CONST_STRNEQ (sec->name, ".plt"))
{
asection *sgotplt;
@@ -9701,10 +9856,11 @@ xtensa_callback_required_dependence (bfd *abfd,
module loader so that the literals are not placed after the text. */
static const struct bfd_elf_special_section elf_xtensa_special_sections[] =
{
- { ".fini.literal", 13, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
- { ".init.literal", 13, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
- { ".literal", 8, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".fini.literal"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
+ { STRING_COMMA_LEN (".init.literal"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
+ { STRING_COMMA_LEN (".literal"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
+ { STRING_COMMA_LEN (".xtensa.info"), 0, SHT_NOTE, 0 },
+ { NULL, 0, 0, 0, 0 }
};
#ifndef ELF_ARCH
@@ -9738,7 +9894,10 @@ static const struct bfd_elf_special_section elf_xtensa_special_sections[] =
#define bfd_elf32_bfd_print_private_bfd_data elf_xtensa_print_private_bfd_data
#define bfd_elf32_bfd_relax_section elf_xtensa_relax_section
#define bfd_elf32_bfd_reloc_type_lookup elf_xtensa_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup \
+ elf_xtensa_reloc_name_lookup
#define bfd_elf32_bfd_set_private_flags elf_xtensa_set_private_flags
+#define bfd_elf32_bfd_link_hash_table_create elf_xtensa_link_hash_table_create
#define elf_backend_adjust_dynamic_symbol elf_xtensa_adjust_dynamic_symbol
#define elf_backend_check_relocs elf_xtensa_check_relocs
@@ -9753,11 +9912,13 @@ static const struct bfd_elf_special_section elf_xtensa_special_sections[] =
#define elf_backend_grok_prstatus elf_xtensa_grok_prstatus
#define elf_backend_grok_psinfo elf_xtensa_grok_psinfo
#define elf_backend_hide_symbol elf_xtensa_hide_symbol
-#define elf_backend_modify_segment_map elf_xtensa_modify_segment_map
#define elf_backend_object_p elf_xtensa_object_p
#define elf_backend_reloc_type_class elf_xtensa_reloc_type_class
#define elf_backend_relocate_section elf_xtensa_relocate_section
#define elf_backend_size_dynamic_sections elf_xtensa_size_dynamic_sections
+#define elf_backend_omit_section_dynsym \
+ ((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) bfd_true)
#define elf_backend_special_sections elf_xtensa_special_sections
+#define elf_backend_action_discarded elf_xtensa_action_discarded
#include "elf32-target.h"
diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c
index 76d0661a1165..3d4350d00820 100644
--- a/bfd/elf64-alpha.c
+++ b/bfd/elf64-alpha.c
@@ -1,6 +1,6 @@
/* Alpha specific support for 64-bit ELF
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- 2006 Free Software Foundation, Inc.
+ 2006, 2007 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@tamu.edu>.
This file is part of BFD, the Binary File Descriptor library.
@@ -22,8 +22,8 @@
/* We need a published ABI spec for this. Until one comes out, don't
assume this'll remain unchanged forever. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -184,6 +184,10 @@ struct alpha_elf_link_hash_table
/* The head of a list of .got subsections linked through
alpha_elf_tdata(abfd)->got_link_next. */
bfd *got_list;
+
+ /* The most recent relax pass that we've seen. The GOTs
+ should be regenerated if this doesn't match. */
+ int relax_trip;
};
/* Look up an entry in a Alpha ELF linker hash table. */
@@ -321,11 +325,14 @@ struct alpha_elf_obj_tdata
static bfd_boolean
elf64_alpha_mkobject (bfd *abfd)
{
- bfd_size_type amt = sizeof (struct alpha_elf_obj_tdata);
- abfd->tdata.any = bfd_zalloc (abfd, amt);
if (abfd->tdata.any == NULL)
- return FALSE;
- return TRUE;
+ {
+ bfd_size_type amt = sizeof (struct alpha_elf_obj_tdata);
+ abfd->tdata.any = bfd_zalloc (abfd, amt);
+ if (abfd->tdata.any == NULL)
+ return FALSE;
+ }
+ return bfd_elf_mkobject (abfd);
}
static bfd_boolean
@@ -1052,6 +1059,23 @@ elf64_alpha_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return 0;
}
+static reloc_howto_type *
+elf64_alpha_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (elf64_alpha_howto_table)
+ / sizeof (elf64_alpha_howto_table[0]));
+ i++)
+ if (elf64_alpha_howto_table[i].name != NULL
+ && strcasecmp (elf64_alpha_howto_table[i].name, r_name) == 0)
+ return &elf64_alpha_howto_table[i];
+
+ return NULL;
+}
+
/* Given an Alpha ELF reloc type, fill in an arelent structure. */
static void
@@ -1898,7 +1922,7 @@ elf64_alpha_check_relocs (bfd *abfd, struct bfd_link_info *info,
if (rel_sec_name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (rel_sec_name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (rel_sec_name, ".rela")
&& strcmp (bfd_get_section_name (abfd, sec),
rel_sec_name+5) == 0);
}
@@ -2032,6 +2056,19 @@ elf64_alpha_adjust_dynamic_symbol (struct bfd_link_info *info,
return TRUE;
}
+/* Record STO_ALPHA_NOPV and STO_ALPHA_STD_GPLOAD. */
+
+static void
+elf64_alpha_merge_symbol_attribute (struct elf_link_hash_entry *h,
+ const Elf_Internal_Sym *isym,
+ bfd_boolean definition,
+ bfd_boolean dynamic)
+{
+ if (!dynamic && definition)
+ h->other = ((h->other & ELF_ST_VISIBILITY (-1))
+ | (isym->st_other & ~ELF_ST_VISIBILITY (-1)));
+}
+
/* Symbol versioning can create new symbols, and make our old symbols
indirect to the new ones. Consolidate the got and reloc information
in these situations. */
@@ -2342,7 +2379,6 @@ static bfd_boolean
elf64_alpha_size_got_sections (struct bfd_link_info *info)
{
bfd *i, *got_list, *cur_got_obj = NULL;
- int something_changed = 0;
got_list = alpha_elf_hash_table (info)->got_list;
@@ -2380,9 +2416,6 @@ elf64_alpha_size_got_sections (struct bfd_link_info *info)
return TRUE;
alpha_elf_hash_table (info)->got_list = got_list;
-
- /* Force got offsets to be recalculated. */
- something_changed = 1;
}
cur_got_obj = got_list;
@@ -2396,8 +2429,6 @@ elf64_alpha_size_got_sections (struct bfd_link_info *info)
alpha_elf_tdata(i)->got->size = 0;
i = alpha_elf_tdata(i)->got_link_next;
alpha_elf_tdata(cur_got_obj)->got_link_next = i;
-
- something_changed = 1;
}
else
{
@@ -2408,8 +2439,7 @@ elf64_alpha_size_got_sections (struct bfd_link_info *info)
/* Once the gots have been merged, fill in the got offsets for
everything therein. */
- if (1 || something_changed)
- elf64_alpha_calc_got_offsets (info);
+ elf64_alpha_calc_got_offsets (info);
return TRUE;
}
@@ -2444,10 +2474,10 @@ elf64_alpha_size_plt_section_1 (struct alpha_elf_link_hash_entry *h, PTR data)
return TRUE;
}
-/* Called from relax_section to rebuild the PLT in light of
- potential changes in the function's status. */
+/* Called from relax_section to rebuild the PLT in light of potential changes
+ in the function's status. */
-static bfd_boolean
+static void
elf64_alpha_size_plt_section (struct bfd_link_info *info)
{
asection *splt, *spltrel, *sgotplt;
@@ -2457,7 +2487,7 @@ elf64_alpha_size_plt_section (struct bfd_link_info *info)
dynobj = elf_hash_table(info)->dynobj;
splt = bfd_get_section_by_name (dynobj, ".plt");
if (splt == NULL)
- return TRUE;
+ return;
splt->size = 0;
@@ -2466,6 +2496,7 @@ elf64_alpha_size_plt_section (struct bfd_link_info *info)
/* Every plt entry requires a JMP_SLOT relocation. */
spltrel = bfd_get_section_by_name (dynobj, ".rela.plt");
+ entries = 0;
if (splt->size)
{
if (elf64_alpha_use_secureplt)
@@ -2473,8 +2504,6 @@ elf64_alpha_size_plt_section (struct bfd_link_info *info)
else
entries = (splt->size - OLD_PLT_HEADER_SIZE) / OLD_PLT_ENTRY_SIZE;
}
- else
- entries = 0;
spltrel->size = entries * sizeof (Elf64_External_Rela);
/* When using the secureplt, we need two words somewhere in the data
@@ -2485,8 +2514,6 @@ elf64_alpha_size_plt_section (struct bfd_link_info *info)
sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
sgotplt->size = entries ? 16 : 0;
}
-
- return TRUE;
}
static bfd_boolean
@@ -2657,7 +2684,7 @@ elf64_alpha_size_rela_got_1 (struct alpha_elf_link_hash_entry *h,
/* Set the sizes of the dynamic relocation sections. */
-static bfd_boolean
+static void
elf64_alpha_size_rela_got_section (struct bfd_link_info *info)
{
unsigned long entries;
@@ -2696,15 +2723,13 @@ elf64_alpha_size_rela_got_section (struct bfd_link_info *info)
if (!srel)
{
BFD_ASSERT (entries == 0);
- return TRUE;
+ return;
}
srel->size = sizeof (Elf64_External_Rela) * entries;
/* Now do the non-local symbols. */
alpha_elf_link_hash_traverse (alpha_elf_hash_table (info),
elf64_alpha_size_rela_got_1, info);
-
- return TRUE;
}
/* Set the sizes of the dynamic sections. */
@@ -2758,7 +2783,7 @@ elf64_alpha_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
of the dynobj section names depend upon the input files. */
name = bfd_get_section_name (dynobj, s);
- if (strncmp (name, ".rela", 5) == 0)
+ if (CONST_STRNEQ (name, ".rela"))
{
if (s->size != 0)
{
@@ -2770,7 +2795,7 @@ elf64_alpha_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
s->reloc_count = 0;
}
}
- else if (strncmp (name, ".got", 4) != 0
+ else if (! CONST_STRNEQ (name, ".got")
&& strcmp (name, ".plt") != 0
&& strcmp (name, ".dynbss") != 0)
{
@@ -3576,7 +3601,7 @@ elf64_alpha_relax_section (bfd *abfd, asection *sec,
struct alpha_elf_got_entry **local_got_entries;
struct alpha_relax_info info;
- /* We are not currently changing any sizes, so only one pass. */
+ /* There's nothing to change, yet. */
*again = FALSE;
if (link_info->relocatable
@@ -3585,6 +3610,22 @@ elf64_alpha_relax_section (bfd *abfd, asection *sec,
|| sec->reloc_count == 0)
return TRUE;
+ /* Make sure our GOT and PLT tables are up-to-date. */
+ if (alpha_elf_hash_table(link_info)->relax_trip != link_info->relax_trip)
+ {
+ alpha_elf_hash_table(link_info)->relax_trip = link_info->relax_trip;
+
+ /* This should never fail after the initial round, since the only
+ error is GOT overflow, and relaxation only shrinks the table. */
+ if (!elf64_alpha_size_got_sections (link_info))
+ abort ();
+ if (elf_hash_table (link_info)->dynamic_sections_created)
+ {
+ elf64_alpha_size_plt_section (link_info);
+ elf64_alpha_size_rela_got_section (link_info);
+ }
+ }
+
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
local_got_entries = alpha_elf_tdata(abfd)->local_got_entries;
@@ -3794,13 +3835,6 @@ elf64_alpha_relax_section (bfd *abfd, asection *sec,
}
}
- if (!elf64_alpha_size_plt_section (link_info))
- return FALSE;
- if (!elf64_alpha_size_got_sections (link_info))
- return FALSE;
- if (!elf64_alpha_size_rela_got_section (link_info))
- return FALSE;
-
if (isymbuf != NULL
&& symtab_hdr->contents != (unsigned char *) isymbuf)
{
@@ -3896,9 +3930,11 @@ elf64_alpha_relocate_section_r (bfd *output_bfd ATTRIBUTE_UNUSED,
unsigned long symtab_hdr_sh_info;
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
+ struct elf_link_hash_entry **sym_hashes;
bfd_boolean ret_val = TRUE;
symtab_hdr_sh_info = elf_tdata (input_bfd)->symtab_hdr.sh_info;
+ sym_hashes = elf_sym_hashes (input_bfd);
relend = relocs + input_section->reloc_count;
for (rel = relocs; rel < relend; rel++)
@@ -3908,7 +3944,7 @@ elf64_alpha_relocate_section_r (bfd *output_bfd ATTRIBUTE_UNUSED,
asection *sec;
unsigned long r_type;
- r_type = ELF64_R_TYPE(rel->r_info);
+ r_type = ELF64_R_TYPE (rel->r_info);
if (r_type >= R_ALPHA_max)
{
(*_bfd_error_handler)
@@ -3919,22 +3955,49 @@ elf64_alpha_relocate_section_r (bfd *output_bfd ATTRIBUTE_UNUSED,
continue;
}
- r_symndx = ELF64_R_SYM(rel->r_info);
-
/* The symbol associated with GPDISP and LITUSE is
immaterial. Only the addend is significant. */
if (r_type == R_ALPHA_GPDISP || r_type == R_ALPHA_LITUSE)
continue;
+ r_symndx = ELF64_R_SYM (rel->r_info);
if (r_symndx < symtab_hdr_sh_info)
{
sym = local_syms + r_symndx;
- if (ELF_ST_TYPE(sym->st_info) == STT_SECTION)
- {
- sec = local_sections[r_symndx];
- rel->r_addend += sec->output_offset + sym->st_value;
- }
+ sec = local_sections[r_symndx];
}
+ else
+ {
+ struct elf_link_hash_entry *h;
+
+ h = sym_hashes[r_symndx - symtab_hdr_sh_info];
+
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ if (h->root.type != bfd_link_hash_defined
+ && h->root.type != bfd_link_hash_defweak)
+ continue;
+
+ sym = NULL;
+ sec = h->root.u.def.section;
+ }
+
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. */
+ _bfd_clear_contents (elf64_alpha_howto_table + r_type,
+ input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (sym != NULL && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ rel->r_addend += sec->output_offset;
}
return ret_val;
@@ -4134,6 +4197,17 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
gotent = h->got_entries;
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
addend = rel->r_addend;
value += addend;
@@ -4193,18 +4267,6 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
goto default_reloc;
case R_ALPHA_GPREL32:
- /* If the target section was a removed linkonce section,
- r_symndx will be zero. In this case, assume that the
- switch will not be used, so don't fill it in. If we
- do nothing here, we'll get relocation truncated messages,
- due to the placement of the application above 4GB. */
- if (r_symndx == 0)
- {
- r = bfd_reloc_ok;
- break;
- }
- /* FALLTHRU */
-
case R_ALPHA_GPREL16:
case R_ALPHA_GPRELLOW:
if (dynamic_symbol_p)
@@ -5145,9 +5207,9 @@ elf64_alpha_reloc_type_class (const Elf_Internal_Rela *rela)
static const struct bfd_elf_special_section elf64_alpha_special_sections[] =
{
- { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL },
- { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".sbss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL },
+ { STRING_COMMA_LEN (".sdata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL },
+ { NULL, 0, 0, 0, 0 }
};
/* ECOFF swapping routines. These are used when dealing with the
@@ -5231,12 +5293,15 @@ static const struct elf_size_info alpha_elf_size_info =
#define ELF_ARCH bfd_arch_alpha
#define ELF_MACHINE_CODE EM_ALPHA
#define ELF_MAXPAGESIZE 0x10000
+#define ELF_COMMONPAGESIZE 0x2000
#define bfd_elf64_bfd_link_hash_table_create \
elf64_alpha_bfd_link_hash_table_create
#define bfd_elf64_bfd_reloc_type_lookup \
elf64_alpha_bfd_reloc_type_lookup
+#define bfd_elf64_bfd_reloc_name_lookup \
+ elf64_alpha_bfd_reloc_name_lookup
#define elf_info_to_howto \
elf64_alpha_info_to_howto
@@ -5267,10 +5332,14 @@ static const struct elf_size_info alpha_elf_size_info =
elf64_alpha_create_dynamic_sections
#define elf_backend_adjust_dynamic_symbol \
elf64_alpha_adjust_dynamic_symbol
+#define elf_backend_merge_symbol_attribute \
+ elf64_alpha_merge_symbol_attribute
#define elf_backend_always_size_sections \
elf64_alpha_always_size_sections
#define elf_backend_size_dynamic_sections \
elf64_alpha_size_dynamic_sections
+#define elf_backend_omit_section_dynsym \
+ ((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) bfd_true)
#define elf_backend_relocate_section \
elf64_alpha_relocate_section
#define elf_backend_finish_dynamic_symbol \
@@ -5305,6 +5374,8 @@ static const struct elf_size_info alpha_elf_size_info =
#define TARGET_LITTLE_SYM bfd_elf64_alpha_freebsd_vec
#undef TARGET_LITTLE_NAME
#define TARGET_LITTLE_NAME "elf64-alpha-freebsd"
+#undef ELF_OSABI
+#define ELF_OSABI ELFOSABI_FREEBSD
/* The kernel recognizes executables as valid only if they carry a
"FreeBSD" label in the ELF header. So we put this label on all
@@ -5319,7 +5390,7 @@ elf64_alpha_fbsd_post_process_headers (bfd * abfd,
i_ehdrp = elf_elfheader (abfd);
/* Put an ABI label supported by FreeBSD >= 4.1. */
- i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
+ i_ehdrp->e_ident[EI_OSABI] = get_elf_backend_data (abfd)->elf_osabi;
#ifdef OLD_FREEBSD_ABI_LABEL
/* The ABI label supported by FreeBSD <= 4.0 is quite nonstandard. */
memcpy (&i_ehdrp->e_ident[EI_ABIVERSION], "FreeBSD", 8);
diff --git a/bfd/elf64-gen.c b/bfd/elf64-gen.c
index 49b8d9c55284..05a94f0650a2 100644
--- a/bfd/elf64-gen.c
+++ b/bfd/elf64-gen.c
@@ -1,5 +1,5 @@
/* Generic support for 64-bit ELF
- Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2004, 2005
+ Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2004, 2005, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -94,6 +94,7 @@ elf64_generic_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
#define ELF_MACHINE_CODE EM_NONE
#define ELF_MAXPAGESIZE 0x1
#define bfd_elf64_bfd_reloc_type_lookup bfd_default_reloc_type_lookup
+#define bfd_elf64_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup
#define bfd_elf64_bfd_link_add_symbols elf64_generic_link_add_symbols
#define elf_info_to_howto elf_generic_info_to_howto
#define elf_info_to_howto_rel elf_generic_info_to_howto_rel
diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c
index 58798ae37949..1f9c7f1f66e7 100644
--- a/bfd/elf64-hppa.c
+++ b/bfd/elf64-hppa.c
@@ -1,5 +1,5 @@
/* Support for HPPA 64-bit ELF
- Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -19,8 +19,8 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "alloca-conf.h"
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/hppa.h"
@@ -204,12 +204,6 @@ static bfd_boolean elf64_hppa_finish_dynamic_symbol
PARAMS ((bfd *, struct bfd_link_info *,
struct elf_link_hash_entry *, Elf_Internal_Sym *));
-static int elf64_hppa_additional_program_headers
- PARAMS ((bfd *));
-
-static bfd_boolean elf64_hppa_modify_segment_map
- PARAMS ((bfd *, struct bfd_link_info *));
-
static enum elf_reloc_type_class elf64_hppa_reloc_type_class
PARAMS ((const Elf_Internal_Rela *));
@@ -523,12 +517,12 @@ get_reloc_section (abfd, hppa_info, sec)
if (srel_name == NULL)
return FALSE;
- BFD_ASSERT ((strncmp (srel_name, ".rela", 5) == 0
+ BFD_ASSERT ((CONST_STRNEQ (srel_name, ".rela")
&& strcmp (bfd_get_section_name (abfd, sec),
- srel_name+5) == 0)
- || (strncmp (srel_name, ".rel", 4) == 0
+ srel_name + 5) == 0)
+ || (CONST_STRNEQ (srel_name, ".rel")
&& strcmp (bfd_get_section_name (abfd, sec),
- srel_name+4) == 0));
+ srel_name + 4) == 0));
dynobj = hppa_info->root.dynobj;
if (!dynobj)
@@ -1204,16 +1198,9 @@ elf64_hppa_post_process_headers (abfd, link_info)
Elf_Internal_Ehdr * i_ehdrp;
i_ehdrp = elf_elfheader (abfd);
-
- if (strcmp (bfd_get_target (abfd), "elf64-hppa-linux") == 0)
- {
- i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_LINUX;
- }
- else
- {
- i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_HPUX;
- i_ehdrp->e_ident[EI_ABIVERSION] = 1;
- }
+
+ i_ehdrp->e_ident[EI_OSABI] = get_elf_backend_data (abfd)->elf_osabi;
+ i_ehdrp->e_ident[EI_ABIVERSION] = 1;
}
/* Create function descriptor section (.opd). This section is called .opd
@@ -1719,13 +1706,13 @@ elf64_hppa_size_dynamic_sections (output_bfd, info)
plt = s->size != 0;
}
else if (strcmp (name, ".opd") == 0
- || strncmp (name, ".dlt", 4) == 0
+ || CONST_STRNEQ (name, ".dlt")
|| strcmp (name, ".stub") == 0
|| strcmp (name, ".got") == 0)
{
/* Strip this section if we don't need it; see the comment below. */
}
- else if (strncmp (name, ".rela", 5) == 0)
+ else if (CONST_STRNEQ (name, ".rela"))
{
if (s->size != 0)
{
@@ -2617,8 +2604,8 @@ elf64_hppa_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
existence of a .interp section. */
static int
-elf64_hppa_additional_program_headers (abfd)
- bfd *abfd;
+elf64_hppa_additional_program_headers (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
asection *s;
@@ -2644,9 +2631,8 @@ elf64_hppa_additional_program_headers (abfd)
existence of a .interp section. */
static bfd_boolean
-elf64_hppa_modify_segment_map (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
+elf64_hppa_modify_segment_map (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
struct elf_segment_map *m;
asection *s;
@@ -2759,14 +2745,14 @@ elf64_hppa_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int index,
static const struct bfd_elf_special_section elf64_hppa_special_sections[] =
{
- { ".fini", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".init", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".plt", 4, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_PARISC_SHORT },
- { ".dlt", 4, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_PARISC_SHORT },
- { ".sdata", 6, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_PARISC_SHORT },
- { ".sbss", 5, 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_PARISC_SHORT },
- { ".tbss", 5, 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_HP_TLS },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".fini"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".init"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".plt"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_PARISC_SHORT },
+ { STRING_COMMA_LEN (".dlt"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_PARISC_SHORT },
+ { STRING_COMMA_LEN (".sdata"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_PARISC_SHORT },
+ { STRING_COMMA_LEN (".sbss"), 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_PARISC_SHORT },
+ { STRING_COMMA_LEN (".tbss"), 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_HP_TLS },
+ { NULL, 0, 0, 0, 0 }
};
/* The hash bucket size is the standard one, namely 4. */
@@ -2807,7 +2793,10 @@ const struct elf_size_info hppa64_elf_size_info =
/* This is not strictly correct. The maximum page size for PA2.0 is
64M. But everything still uses 4k. */
#define ELF_MAXPAGESIZE 0x1000
+#define ELF_OSABI ELFOSABI_HPUX
+
#define bfd_elf64_bfd_reloc_type_lookup elf_hppa_reloc_type_lookup
+#define bfd_elf64_bfd_reloc_name_lookup elf_hppa_reloc_name_lookup
#define bfd_elf64_bfd_is_local_label_name elf_hppa_is_local_label_name
#define elf_info_to_howto elf_hppa_info_to_howto
#define elf_info_to_howto_rel elf_hppa_info_to_howto_rel
@@ -2827,6 +2816,8 @@ const struct elf_size_info hppa64_elf_size_info =
elf64_hppa_create_dynamic_sections
#define elf_backend_post_process_headers elf64_hppa_post_process_headers
+#define elf_backend_omit_section_dynsym \
+ ((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) bfd_true)
#define elf_backend_adjust_dynamic_symbol \
elf64_hppa_adjust_dynamic_symbol
@@ -2871,12 +2862,19 @@ const struct elf_size_info hppa64_elf_size_info =
#define elf_backend_action_discarded elf_hppa_action_discarded
#define elf_backend_section_from_phdr elf64_hppa_section_from_phdr
+#define elf64_bed elf64_hppa_hpux_bed
+
#include "elf64-target.h"
#undef TARGET_BIG_SYM
#define TARGET_BIG_SYM bfd_elf64_hppa_linux_vec
#undef TARGET_BIG_NAME
#define TARGET_BIG_NAME "elf64-hppa-linux"
+#undef ELF_OSABI
+#define ELF_OSABI ELFOSABI_LINUX
+#undef elf_backend_post_process_headers
+#define elf_backend_post_process_headers _bfd_elf_set_osabi
+#undef elf64_bed
+#define elf64_bed elf64_hppa_linux_bed
-#define INCLUDED_TARGET_FILE 1
#include "elf64-target.h"
diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c
index c8f3127e3c9e..e64b50caed01 100644
--- a/bfd/elf64-mips.c
+++ b/bfd/elf64-mips.c
@@ -1,6 +1,6 @@
/* MIPS-specific support for 64-bit ELF
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+ 2007 Free Software Foundation, Inc.
Ian Lance Taylor, Cygnus Support
Linker support added by Mark Mitchell, CodeSourcery, LLC.
<mark@codesourcery.com>
@@ -40,8 +40,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
. the OldABI version is still lying around and should be removed.
*/
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "aout/ar.h"
#include "bfdlink.h"
@@ -112,8 +112,6 @@ static bfd_reloc_status_type mips_elf64_gprel32_reloc
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
static bfd_reloc_status_type mips_elf64_shift6_reloc
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type mips16_jump_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
static bfd_reloc_status_type mips16_gprel_reloc
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
static bfd_boolean mips_elf64_assign_gp
@@ -791,6 +789,21 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
0x0000ffff, /* src_mask */
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
+
+ /* 32 bit relocation with no addend. */
+ HOWTO (R_MIPS_GLOB_DAT, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ _bfd_mips_elf_generic_reloc, /* special_function */
+ "R_MIPS_GLOB_DAT", /* name */
+ FALSE, /* partial_inplace */
+ 0x0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
};
/* The relocation table used for SHT_RELA sections. */
@@ -1314,7 +1327,20 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
EMPTY_HOWTO (R_MIPS_TLS_DTPMOD32),
EMPTY_HOWTO (R_MIPS_TLS_DTPREL32),
EMPTY_HOWTO (R_MIPS_TLS_DTPMOD64),
- EMPTY_HOWTO (R_MIPS_TLS_DTPREL64),
+
+ HOWTO (R_MIPS_TLS_DTPREL64, /* type */
+ 0, /* rightshift */
+ 4, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ _bfd_mips_elf_generic_reloc, /* special_function */
+ "R_MIPS_TLS_DTPREL64", /* name */
+ TRUE, /* partial_inplace */
+ MINUS_ONE, /* src_mask */
+ MINUS_ONE, /* dst_mask */
+ FALSE), /* pcrel_offset */
/* TLS general dynamic variable reference. */
HOWTO (R_MIPS_TLS_GD, /* type */
@@ -1423,6 +1449,21 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
0x0000ffff, /* src_mask */
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
+
+ /* 32 bit relocation with no addend. */
+ HOWTO (R_MIPS_GLOB_DAT, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ _bfd_mips_elf_generic_reloc, /* special_function */
+ "R_MIPS_GLOB_DAT", /* name */
+ FALSE, /* partial_inplace */
+ 0x0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
};
static reloc_howto_type mips16_elf64_howto_table_rel[] =
@@ -1438,7 +1479,7 @@ static reloc_howto_type mips16_elf64_howto_table_rel[] =
/* This needs complex overflow
detection, because the upper four
bits must match the PC. */
- mips16_jump_reloc, /* special_function */
+ _bfd_mips_elf_generic_reloc, /* special_function */
"R_MIPS16_26", /* name */
TRUE, /* partial_inplace */
0x3ffffff, /* src_mask */
@@ -1510,7 +1551,7 @@ static reloc_howto_type mips16_elf64_howto_table_rela[] =
/* This needs complex overflow
detection, because the upper four
bits must match the PC. */
- mips16_jump_reloc, /* special_function */
+ _bfd_mips_elf_generic_reloc, /* special_function */
"R_MIPS16_26", /* name */
FALSE, /* partial_inplace */
0x3ffffff, /* src_mask */
@@ -2044,37 +2085,6 @@ mips_elf64_shift6_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
error_message);
}
-/* Handle a mips16 jump. */
-
-static bfd_reloc_status_type
-mips16_jump_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry,
- asymbol *symbol, void *data ATTRIBUTE_UNUSED,
- asection *input_section, bfd *output_bfd,
- char **error_message ATTRIBUTE_UNUSED)
-{
- if (output_bfd != NULL
- && (symbol->flags & BSF_SECTION_SYM) == 0
- && (! reloc_entry->howto->partial_inplace
- || reloc_entry->addend == 0))
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- /* FIXME. */
- {
- static bfd_boolean warned;
-
- if (! warned)
- (*_bfd_error_handler)
- (_("Linking mips16 objects into %s format is not supported"),
- bfd_get_target (input_section->output_section->owner));
- warned = TRUE;
- }
-
- return bfd_reloc_undefined;
-}
-
/* Handle a mips16 GP relative reloc. */
static bfd_reloc_status_type
@@ -2227,6 +2237,39 @@ bfd_elf64_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
}
}
+static reloc_howto_type *
+bfd_elf64_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (mips_elf64_howto_table_rela)
+ / sizeof (mips_elf64_howto_table_rela[0])); i++)
+ if (mips_elf64_howto_table_rela[i].name != NULL
+ && strcasecmp (mips_elf64_howto_table_rela[i].name, r_name) == 0)
+ return &mips_elf64_howto_table_rela[i];
+
+ for (i = 0;
+ i < (sizeof (mips16_elf64_howto_table_rela)
+ / sizeof (mips16_elf64_howto_table_rela[0]));
+ i++)
+ if (mips16_elf64_howto_table_rela[i].name != NULL
+ && strcasecmp (mips16_elf64_howto_table_rela[i].name, r_name) == 0)
+ return &mips16_elf64_howto_table_rela[i];
+
+ if (strcasecmp (elf_mips_gnu_vtinherit_howto.name, r_name) == 0)
+ return &elf_mips_gnu_vtinherit_howto;
+ if (strcasecmp (elf_mips_gnu_vtentry_howto.name, r_name) == 0)
+ return &elf_mips_gnu_vtentry_howto;
+ if (strcasecmp (elf_mips_gnu_rel16_s2.name, r_name) == 0)
+ return &elf_mips_gnu_rel16_s2;
+ if (strcasecmp (elf_mips_gnu_rela16_s2.name, r_name) == 0)
+ return &elf_mips_gnu_rela16_s2;
+
+ return NULL;
+}
+
/* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */
static reloc_howto_type *
@@ -3059,12 +3102,15 @@ const struct elf_size_info mips_elf64_size_info =
#define elf_backend_create_dynamic_sections \
_bfd_mips_elf_create_dynamic_sections
#define elf_backend_check_relocs _bfd_mips_elf_check_relocs
+#define elf_backend_merge_symbol_attribute \
+ _bfd_mips_elf_merge_symbol_attribute
#define elf_backend_adjust_dynamic_symbol \
_bfd_mips_elf_adjust_dynamic_symbol
#define elf_backend_always_size_sections \
_bfd_mips_elf_always_size_sections
#define elf_backend_size_dynamic_sections \
_bfd_mips_elf_size_dynamic_sections
+#define elf_backend_init_index_section _bfd_elf_init_1_index_section
#define elf_backend_relocate_section _bfd_mips_elf_relocate_section
#define elf_backend_finish_dynamic_symbol \
_bfd_mips_elf_finish_dynamic_symbol
@@ -3152,10 +3198,8 @@ extern bfd_boolean bfd_elf64_archive_write_armap
#define TARGET_BIG_SYM bfd_elf64_bigmips_vec
#define TARGET_BIG_NAME "elf64-bigmips"
-/* The SVR4 MIPS ABI says that this should be 0x10000, but Irix 5 uses
- a value of 0x1000, and we are compatible.
- FIXME: How does this affect NewABI? */
-#define ELF_MAXPAGESIZE 0x1000
+#define ELF_MAXPAGESIZE 0x10000
+#define ELF_COMMONPAGESIZE 0x1000
#include "elf64-target.h"
@@ -3166,15 +3210,15 @@ extern bfd_boolean bfd_elf64_archive_write_armap
#undef TARGET_BIG_NAME
#undef ELF_MAXPAGESIZE
+#undef ELF_COMMONPAGESIZE
#define TARGET_LITTLE_SYM bfd_elf64_tradlittlemips_vec
#define TARGET_LITTLE_NAME "elf64-tradlittlemips"
#define TARGET_BIG_SYM bfd_elf64_tradbigmips_vec
#define TARGET_BIG_NAME "elf64-tradbigmips"
-/* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses
- page sizes of up to that limit, so we need to respect it. */
#define ELF_MAXPAGESIZE 0x10000
+#define ELF_COMMONPAGESIZE 0x1000
#define elf64_bed elf64_tradbed
/* Include the target file again for this target. */
diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c
index 6f88fe102f59..3f75042469a8 100644
--- a/bfd/elf64-mmix.c
+++ b/bfd/elf64-mmix.c
@@ -1,5 +1,6 @@
/* MMIX-specific support for 64-bit ELF.
- Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ Free Software Foundation, Inc.
Contributed by Hans-Peter Nilsson <hp@bitrange.com>
This file is part of BFD, the Binary File Descriptor library.
@@ -26,8 +27,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
- GETA stub relaxation (call a stub for out of range new
R_MMIX_GETA_STUBBABLE). */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/mmix.h"
@@ -186,14 +187,6 @@ static bfd_boolean mmix_elf_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
-static asection * mmix_elf_gc_mark_hook
- PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *, Elf_Internal_Sym *));
-
-static bfd_boolean mmix_elf_gc_sweep_hook
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- const Elf_Internal_Rela *));
-
static bfd_reloc_status_type mmix_final_link_relocate
PARAMS ((reloc_howto_type *, asection *, bfd_byte *,
bfd_vma, bfd_signed_vma, bfd_vma, const char *, asection *));
@@ -855,18 +848,37 @@ bfd_elf64_bfd_reloc_type_lookup (abfd, code)
return NULL;
}
+static reloc_howto_type *
+bfd_elf64_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (elf_mmix_howto_table) / sizeof (elf_mmix_howto_table[0]);
+ i++)
+ if (elf_mmix_howto_table[i].name != NULL
+ && strcasecmp (elf_mmix_howto_table[i].name, r_name) == 0)
+ return &elf_mmix_howto_table[i];
+
+ return NULL;
+}
+
static bfd_boolean
mmix_elf_new_section_hook (abfd, sec)
bfd *abfd;
asection *sec;
{
- struct _mmix_elf_section_data *sdata;
- bfd_size_type amt = sizeof (*sdata);
+ if (!sec->used_by_bfd)
+ {
+ struct _mmix_elf_section_data *sdata;
+ bfd_size_type amt = sizeof (*sdata);
- sdata = (struct _mmix_elf_section_data *) bfd_zalloc (abfd, amt);
- if (sdata == NULL)
- return FALSE;
- sec->used_by_bfd = (PTR) sdata;
+ sdata = bfd_zalloc (abfd, amt);
+ if (sdata == NULL)
+ return FALSE;
+ sec->used_by_bfd = sdata;
+ }
return _bfd_elf_new_section_hook (abfd, sec);
}
@@ -1369,22 +1381,53 @@ mmix_elf_relocate_section (output_bfd, info, input_bfd, input_section,
r_symndx = ELF64_R_SYM (rel->r_info);
+ howto = elf_mmix_howto_table + ELF64_R_TYPE (rel->r_info);
+ h = NULL;
+ sym = NULL;
+ sec = NULL;
+
+ if (r_symndx < symtab_hdr->sh_info)
+ {
+ sym = local_syms + r_symndx;
+ sec = local_sections [r_symndx];
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
+
+ name = bfd_elf_string_from_elf_section (input_bfd,
+ symtab_hdr->sh_link,
+ sym->st_name);
+ if (name == NULL)
+ name = bfd_section_name (input_bfd, sec);
+ }
+ else
+ {
+ 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, undefined_signalled);
+ name = h->root.root.string;
+ }
+
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
if (info->relocatable)
{
/* This is a relocatable link. For most relocs 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;
- }
- }
+ if (sym != NULL && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ rel->r_addend += sec->output_offset;
/* For PUSHJ stub relocs however, we may need to change the
reloc and the section contents, if the reloc doesn't reach
@@ -1458,35 +1501,6 @@ mmix_elf_relocate_section (output_bfd, info, input_bfd, input_section,
continue;
}
- /* This is a final link. */
- howto = elf_mmix_howto_table + ELF64_R_TYPE (rel->r_info);
- h = NULL;
- sym = NULL;
- sec = NULL;
-
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
- sec = local_sections [r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
-
- name = bfd_elf_string_from_elf_section (input_bfd,
- symtab_hdr->sh_link,
- sym->st_name);
- if (name == NULL)
- name = bfd_section_name (input_bfd, sec);
- }
- else
- {
- 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, undefined_signalled);
- name = h->root.root.string;
- }
-
r = mmix_final_link_relocate (howto, input_section,
contents, rel->r_offset,
rel->r_addend, relocation, name, sec);
@@ -1740,40 +1754,21 @@ mmix_final_link_relocate (howto, input_section, contents,
relocation. */
static asection *
-mmix_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;
+mmix_elf_gc_mark_hook (asection *sec,
+ struct bfd_link_info *info,
+ Elf_Internal_Rela *rel,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
{
if (h != NULL)
- {
- switch (ELF64_R_TYPE (rel->r_info))
- {
- case R_MMIX_GNU_VTINHERIT:
- case R_MMIX_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
+ switch (ELF64_R_TYPE (rel->r_info))
+ {
+ case R_MMIX_GNU_VTINHERIT:
+ case R_MMIX_GNU_VTENTRY:
+ return NULL;
+ }
- return NULL;
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
/* Update relocation info for a GC-excluded section. We could supposedly
@@ -1782,11 +1777,10 @@ mmix_elf_gc_mark_hook (sec, info, rel, h, sym)
present. Better to waste some memory and (perhaps) a little time. */
static bfd_boolean
-mmix_elf_gc_sweep_hook (abfd, info, sec, relocs)
- bfd *abfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- asection *sec ATTRIBUTE_UNUSED;
- const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED;
+mmix_elf_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ asection *sec,
+ const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED)
{
struct bpo_reloc_section_info *bpodata
= mmix_elf_section_data (sec)->bpo.reloc;
@@ -2189,8 +2183,7 @@ mmix_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
(*secp)->flags |= SEC_LINKER_CREATED;
}
else if ((*namep)[0] == '_' && (*namep)[1] == '_' && (*namep)[2] == '.'
- && strncmp (*namep, MMIX_LOC_SECTION_START_SYMBOL_PREFIX,
- strlen (MMIX_LOC_SECTION_START_SYMBOL_PREFIX)) == 0)
+ && CONST_STRNEQ (*namep, MMIX_LOC_SECTION_START_SYMBOL_PREFIX))
{
/* See if we have another one. */
struct bfd_link_hash_entry *h = bfd_link_hash_lookup (info->hash,
@@ -2941,6 +2934,8 @@ mmix_elf_relax_section (abfd, sec, link_info, again)
#define elf_backend_check_relocs mmix_elf_check_relocs
#define elf_backend_symbol_processing mmix_elf_symbol_processing
+#define elf_backend_omit_section_dynsym \
+ ((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) bfd_true)
#define bfd_elf64_bfd_is_local_label_name \
mmix_elf_is_local_label_name
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 33327f44cba9..0e4f725d1ffd 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -1,5 +1,5 @@
/* PowerPC64-specific support for 64-bit ELF.
- Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Linus Nordberg, Swox AB <info@swox.com>,
based on elf32-ppc.c by Ian Lance Taylor.
@@ -25,8 +25,9 @@
http://www.linuxbase.org/spec/ELF/ppc64/PPC-elf64abi.txt, and
http://www.linuxbase.org/spec/ELF/ppc64/spec/book1.html */
-#include "bfd.h"
#include "sysdep.h"
+#include <stdarg.h>
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -61,6 +62,7 @@ static bfd_vma opd_entry_value
#define ELF_ARCH bfd_arch_powerpc
#define ELF_MACHINE_CODE EM_PPC64
#define ELF_MAXPAGESIZE 0x10000
+#define ELF_COMMONPAGESIZE 0x1000
#define elf_info_to_howto ppc64_elf_info_to_howto
#define elf_backend_want_got_sym 0
@@ -71,9 +73,11 @@ static bfd_vma opd_entry_value
#define elf_backend_can_gc_sections 1
#define elf_backend_can_refcount 1
#define elf_backend_rela_normal 1
+#define elf_backend_default_execstack 0
#define bfd_elf64_mkobject ppc64_elf_mkobject
#define bfd_elf64_bfd_reloc_type_lookup ppc64_elf_reloc_type_lookup
+#define bfd_elf64_bfd_reloc_name_lookup ppc64_elf_reloc_name_lookup
#define bfd_elf64_bfd_merge_private_bfd_data ppc64_elf_merge_private_bfd_data
#define bfd_elf64_new_section_hook ppc64_elf_new_section_hook
#define bfd_elf64_bfd_link_hash_table_create ppc64_elf_link_hash_table_create
@@ -83,10 +87,12 @@ static bfd_vma opd_entry_value
#define elf_backend_object_p ppc64_elf_object_p
#define elf_backend_grok_prstatus ppc64_elf_grok_prstatus
#define elf_backend_grok_psinfo ppc64_elf_grok_psinfo
+#define elf_backend_write_core_note ppc64_elf_write_core_note
#define elf_backend_create_dynamic_sections ppc64_elf_create_dynamic_sections
#define elf_backend_copy_indirect_symbol ppc64_elf_copy_indirect_symbol
#define elf_backend_add_symbol_hook ppc64_elf_add_symbol_hook
#define elf_backend_check_directives ppc64_elf_check_directives
+#define elf_backend_as_needed_cleanup ppc64_elf_as_needed_cleanup
#define elf_backend_archive_symbol_lookup ppc64_elf_archive_symbol_lookup
#define elf_backend_check_relocs ppc64_elf_check_relocs
#define elf_backend_gc_mark_dynamic_ref ppc64_elf_gc_mark_dynamic_ref
@@ -96,6 +102,7 @@ static bfd_vma opd_entry_value
#define elf_backend_hide_symbol ppc64_elf_hide_symbol
#define elf_backend_always_size_sections ppc64_elf_func_desc_adjust
#define elf_backend_size_dynamic_sections ppc64_elf_size_dynamic_sections
+#define elf_backend_init_index_section _bfd_elf_init_2_index_sections
#define elf_backend_action_discarded ppc64_elf_action_discarded
#define elf_backend_relocate_section ppc64_elf_relocate_section
#define elf_backend_finish_dynamic_symbol ppc64_elf_finish_dynamic_symbol
@@ -134,30 +141,29 @@ static bfd_vma opd_entry_value
#define BCTR 0x4e800420 /* bctr */
+#define ADDIS_R12_R12 0x3d8c0000 /* addis %r12,%r12,off@ha */
#define ADDIS_R2_R2 0x3c420000 /* addis %r2,%r2,off@ha */
#define ADDI_R2_R2 0x38420000 /* addi %r2,%r2,off@l */
#define LD_R2_40R1 0xe8410028 /* ld %r2,40(%r1) */
-/* glink call stub instructions. We enter with the index in R0, and the
- address of glink entry in CTR. From that, we can calculate PLT0. */
+/* glink call stub instructions. We enter with the index in R0. */
#define GLINK_CALL_STUB_SIZE (16*4)
-#define MFCTR_R12 0x7d8902a6 /* mfctr %r12 */
-#define SLDI_R11_R0_3 0x780b1f24 /* sldi %r11,%r0,3 */
-#define ADDIC_R2_R0_32K 0x34408000 /* addic. %r2,%r0,-32768 */
-#define SUB_R12_R12_R11 0x7d8b6050 /* sub %r12,%r12,%r11 */
-#define SRADI_R2_R2_63 0x7c42fe76 /* sradi %r2,%r2,63 */
-#define SLDI_R11_R0_2 0x780b1764 /* sldi %r11,%r0,2 */
-#define AND_R2_R2_R11 0x7c425838 /* and %r2,%r2,%r11 */
- /* sub %r12,%r12,%r11 */
-#define ADD_R12_R12_R2 0x7d8c1214 /* add %r12,%r12,%r2 */
-#define ADDIS_R12_R12 0x3d8c0000 /* addis %r12,%r12,xxx@ha */
- /* ld %r11,xxx@l(%r12) */
-#define ADDI_R12_R12 0x398c0000 /* addi %r12,%r12,xxx@l */
- /* ld %r2,8(%r12) */
- /* mtctr %r11 */
- /* ld %r11,16(%r12) */
- /* bctr */
+ /* 0: */
+ /* .quad plt0-1f */
+ /* __glink: */
+#define MFLR_R12 0x7d8802a6 /* mflr %12 */
+#define BCL_20_31 0x429f0005 /* bcl 20,31,1f */
+ /* 1: */
+#define MFLR_R11 0x7d6802a6 /* mflr %11 */
+#define LD_R2_M16R11 0xe84bfff0 /* ld %2,(0b-1b)(%11) */
+#define MTLR_R12 0x7d8803a6 /* mtlr %12 */
+#define ADD_R12_R2_R11 0x7d825a14 /* add %12,%2,%11 */
+ /* ld %11,0(%12) */
+ /* ld %2,8(%12) */
+ /* mtctr %11 */
+ /* ld %11,16(%12) */
+ /* bctr */
/* Pad with this. */
#define NOP 0x60000000
@@ -1193,7 +1199,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
/* Like R_PPC64_PLTGOT16, but for instructions with a DS field. */
/* FIXME: R_PPC64_PLTGOT16_DS not implemented. */
- HOWTO (R_PPC64_PLTGOT16_DS, /* type */
+ HOWTO (R_PPC64_PLTGOT16_DS, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
@@ -2106,6 +2112,22 @@ ppc64_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return ppc64_elf_howto_table[r];
};
+static reloc_howto_type *
+ppc64_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (ppc64_elf_howto_raw) / sizeof (ppc64_elf_howto_raw[0]);
+ i++)
+ if (ppc64_elf_howto_raw[i].name != NULL
+ && strcasecmp (ppc64_elf_howto_raw[i].name, r_name) == 0)
+ return &ppc64_elf_howto_raw[i];
+
+ return NULL;
+}
+
/* Set the howto pointer for a PowerPC ELF reloc. */
static void
@@ -2376,14 +2398,9 @@ struct ppc64_elf_obj_tdata
asection *got;
asection *relgot;
- union {
- /* Used during garbage collection. We attach global symbols defined
- on removed .opd entries to this section so that the sym is removed. */
- asection *deleted_section;
-
- /* Used when adding symbols. */
- bfd_boolean has_dotsym;
- } u;
+ /* Used during garbage collection. We attach global symbols defined
+ on removed .opd entries to this section so that the sym is removed. */
+ asection *deleted_section;
/* TLS local dynamic got entry handling. Suppose for multiple GOT
sections means we potentially need one of these for each input bfd. */
@@ -2407,11 +2424,14 @@ struct ppc64_elf_obj_tdata
static bfd_boolean
ppc64_elf_mkobject (bfd *abfd)
{
- bfd_size_type amt = sizeof (struct ppc64_elf_obj_tdata);
- abfd->tdata.any = bfd_zalloc (abfd, amt);
if (abfd->tdata.any == NULL)
- return FALSE;
- return TRUE;
+ {
+ bfd_size_type amt = sizeof (struct ppc64_elf_obj_tdata);
+ abfd->tdata.any = bfd_zalloc (abfd, amt);
+ if (abfd->tdata.any == NULL)
+ return FALSE;
+ }
+ return bfd_elf_mkobject (abfd);
}
/* Return 1 if target is one of ours. */
@@ -2484,6 +2504,53 @@ ppc64_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
return TRUE;
}
+static char *
+ppc64_elf_write_core_note (bfd *abfd, char *buf, int *bufsiz, int note_type,
+ ...)
+{
+ switch (note_type)
+ {
+ default:
+ return NULL;
+
+ case NT_PRPSINFO:
+ {
+ char data[136];
+ va_list ap;
+
+ va_start (ap, note_type);
+ memset (data, 0, 40);
+ strncpy (data + 40, va_arg (ap, const char *), 16);
+ strncpy (data + 56, va_arg (ap, const char *), 80);
+ va_end (ap);
+ return elfcore_write_note (abfd, buf, bufsiz,
+ "CORE", note_type, data, sizeof (data));
+ }
+
+ case NT_PRSTATUS:
+ {
+ char data[504];
+ va_list ap;
+ long pid;
+ int cursig;
+ const void *greg;
+
+ va_start (ap, note_type);
+ memset (data, 0, 112);
+ pid = va_arg (ap, long);
+ bfd_put_32 (abfd, pid, data + 32);
+ cursig = va_arg (ap, int);
+ bfd_put_16 (abfd, cursig, data + 12);
+ greg = va_arg (ap, const void *);
+ memcpy (data + 112, greg, 384);
+ memset (data + 496, 0, 8);
+ va_end (ap);
+ return elfcore_write_note (abfd, buf, bufsiz,
+ "CORE", note_type, data, sizeof (data));
+ }
+ }
+}
+
/* Merge backend specific data from an object file to the output
object file when linking. */
@@ -2517,13 +2584,19 @@ ppc64_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
static const struct bfd_elf_special_section ppc64_elf_special_sections[]=
{
- { ".plt", 4, 0, SHT_NOBITS, 0 },
- { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
- { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".toc", 4, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".toc1", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".tocbss", 7, 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".plt"), 0, SHT_NOBITS, 0 },
+ { STRING_COMMA_LEN (".sbss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".sdata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".toc"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".toc1"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".tocbss"), 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
+ { NULL, 0, 0, 0, 0 }
+};
+
+enum _ppc64_sec_type {
+ sec_normal = 0,
+ sec_opd = 1,
+ sec_toc = 2
};
struct _ppc64_elf_section_data
@@ -2534,14 +2607,20 @@ struct _ppc64_elf_section_data
union
{
/* Points to the function code section for local opd entries. */
- asection **func_sec;
+ asection **opd_func_sec;
/* After editing .opd, adjust references to opd local syms. */
- long *adjust;
- } opd;
+ long *opd_adjust;
- /* An array for toc sections, indexed by offset/8.
- Specifies the relocation symbol index used at a given toc offset. */
- unsigned *t_symndx;
+ /* An array for toc sections, indexed by offset/8.
+ Specifies the relocation symbol index used at a given toc offset. */
+ unsigned *t_symndx;
+ } u;
+
+ enum _ppc64_sec_type sec_type:2;
+
+ /* Flag set when small branches are detected. Used to
+ select suitable defaults for the stub group size. */
+ unsigned int has_14bit_branch:1;
};
#define ppc64_elf_section_data(sec) \
@@ -2550,13 +2629,16 @@ struct _ppc64_elf_section_data
static bfd_boolean
ppc64_elf_new_section_hook (bfd *abfd, asection *sec)
{
- struct _ppc64_elf_section_data *sdata;
- bfd_size_type amt = sizeof (*sdata);
+ if (!sec->used_by_bfd)
+ {
+ struct _ppc64_elf_section_data *sdata;
+ bfd_size_type amt = sizeof (*sdata);
- sdata = bfd_zalloc (abfd, amt);
- if (sdata == NULL)
- return FALSE;
- sec->used_by_bfd = sdata;
+ sdata = bfd_zalloc (abfd, amt);
+ if (sdata == NULL)
+ return FALSE;
+ sec->used_by_bfd = sdata;
+ }
return _bfd_elf_new_section_hook (abfd, sec);
}
@@ -2566,8 +2648,8 @@ get_opd_info (asection * sec)
{
if (sec != NULL
&& ppc64_elf_section_data (sec) != NULL
- && ppc64_elf_section_data (sec)->opd.adjust != NULL)
- return ppc64_elf_section_data (sec)->opd.adjust;
+ && ppc64_elf_section_data (sec)->sec_type == sec_opd)
+ return ppc64_elf_section_data (sec)->u.opd_adjust;
return NULL;
}
@@ -3234,9 +3316,14 @@ struct ppc_link_hash_entry
{
struct elf_link_hash_entry elf;
- /* A pointer to the most recently used stub hash entry against this
- symbol. */
- struct ppc_stub_hash_entry *stub_cache;
+ union {
+ /* A pointer to the most recently used stub hash entry against this
+ symbol. */
+ struct ppc_stub_hash_entry *stub_cache;
+
+ /* A pointer to the next symbol starting with a '.' */
+ struct ppc_link_hash_entry *next_dot_sym;
+ } u;
/* Track dynamic relocs copied for this symbol. */
struct ppc_dyn_relocs *dyn_relocs;
@@ -3314,6 +3401,9 @@ struct ppc_link_hash_table
/* Highest output section index. */
int top_index;
+ /* Used when adding symbols. */
+ struct ppc_link_hash_entry *dot_syms;
+
/* List of input sections for each output section. */
asection **input_list;
@@ -3348,10 +3438,6 @@ struct ppc_link_hash_table
/* Set on error. */
unsigned int stub_error:1;
- /* Flag set when small branches are detected. Used to
- select suitable defaults for the stub group size. */
- unsigned int has_14bit_branch:1;
-
/* Temp used by ppc64_elf_check_directives. */
unsigned int twiddled_syms:1;
@@ -3470,9 +3556,34 @@ link_hash_newfunc (struct bfd_hash_entry *entry,
{
struct ppc_link_hash_entry *eh = (struct ppc_link_hash_entry *) entry;
- memset (&eh->stub_cache, 0,
+ memset (&eh->u.stub_cache, 0,
(sizeof (struct ppc_link_hash_entry)
- - offsetof (struct ppc_link_hash_entry, stub_cache)));
+ - offsetof (struct ppc_link_hash_entry, u.stub_cache)));
+
+ /* When making function calls, old ABI code references function entry
+ points (dot symbols), while new ABI code references the function
+ descriptor symbol. We need to make any combination of reference and
+ definition work together, without breaking archive linking.
+
+ For a defined function "foo" and an undefined call to "bar":
+ An old object defines "foo" and ".foo", references ".bar" (possibly
+ "bar" too).
+ A new object defines "foo" and references "bar".
+
+ A new object thus has no problem with its undefined symbols being
+ satisfied by definitions in an old object. On the other hand, the
+ old object won't have ".bar" satisfied by a new object.
+
+ Keep a list of newly added dot-symbols. */
+
+ if (string[0] == '.')
+ {
+ struct ppc_link_hash_table *htab;
+
+ htab = (struct ppc_link_hash_table *) table;
+ eh->u.next_dot_sym = htab->dot_syms;
+ htab->dot_syms = eh;
+ }
}
return entry;
@@ -3618,11 +3729,11 @@ ppc_get_stub_entry (const asection *input_section,
distinguish between them. */
id_sec = htab->stub_group[input_section->id].link_sec;
- if (h != NULL && h->stub_cache != NULL
- && h->stub_cache->h == h
- && h->stub_cache->id_sec == id_sec)
+ if (h != NULL && h->u.stub_cache != NULL
+ && h->u.stub_cache->h == h
+ && h->u.stub_cache->id_sec == id_sec)
{
- stub_entry = h->stub_cache;
+ stub_entry = h->u.stub_cache;
}
else
{
@@ -3635,7 +3746,7 @@ ppc_get_stub_entry (const asection *input_section,
stub_entry = ppc_stub_hash_lookup (&htab->stub_hash_table,
stub_name, FALSE, FALSE);
if (h != NULL)
- h->stub_cache = stub_entry;
+ h->u.stub_cache = stub_entry;
free (stub_name);
}
@@ -3721,49 +3832,26 @@ create_linkage_sections (bfd *dynobj, struct bfd_link_info *info)
htab->glink = bfd_make_section_anyway_with_flags (dynobj, ".glink",
flags);
if (htab->glink == NULL
- || ! bfd_set_section_alignment (dynobj, htab->glink, 2))
+ || ! bfd_set_section_alignment (dynobj, htab->glink, 3))
return FALSE;
/* Create branch lookup table for plt_branch stubs. */
- if (info->shared)
- {
- flags = (SEC_ALLOC | SEC_LOAD
- | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED);
- htab->brlt
- = bfd_make_section_anyway_with_flags (dynobj, ".data.rel.ro.brlt",
- flags);
- }
- else
- {
- flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY
- | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED);
- htab->brlt
- = bfd_make_section_anyway_with_flags (dynobj, ".rodata.brlt", flags);
- }
-
+ flags = (SEC_ALLOC | SEC_LOAD
+ | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED);
+ htab->brlt = bfd_make_section_anyway_with_flags (dynobj, ".branch_lt",
+ flags);
if (htab->brlt == NULL
|| ! bfd_set_section_alignment (dynobj, htab->brlt, 3))
return FALSE;
- if (info->shared)
- {
- flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY
- | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED);
- htab->relbrlt
- = bfd_make_section_anyway_with_flags (dynobj, ".rela.data.rel.ro.brlt",
- flags);
- }
- else if (info->emitrelocations)
- {
- flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY
- | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED);
- htab->relbrlt
- = bfd_make_section_anyway_with_flags (dynobj, ".rela.rodata.brlt",
- flags);
- }
- else
+ if (!info->shared)
return TRUE;
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY
+ | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED);
+ htab->relbrlt = bfd_make_section_anyway_with_flags (dynobj,
+ ".rela.branch_lt",
+ flags);
if (!htab->relbrlt
|| ! bfd_set_section_alignment (dynobj, htab->relbrlt, 3))
return FALSE;
@@ -4044,29 +4132,14 @@ make_fdh (struct bfd_link_info *info,
return fdh;
}
-/* Hacks to support old ABI code.
- When making function calls, old ABI code references function entry
- points (dot symbols), while new ABI code references the function
- descriptor symbol. We need to make any combination of reference and
- definition work together, without breaking archive linking.
-
- For a defined function "foo" and an undefined call to "bar":
- An old object defines "foo" and ".foo", references ".bar" (possibly
- "bar" too).
- A new object defines "foo" and references "bar".
-
- A new object thus has no problem with its undefined symbols being
- satisfied by definitions in an old object. On the other hand, the
- old object won't have ".bar" satisfied by a new object. */
-
/* Fix function descriptor symbols defined in .opd sections to be
function type. */
static bfd_boolean
-ppc64_elf_add_symbol_hook (bfd *ibfd,
+ppc64_elf_add_symbol_hook (bfd *ibfd ATTRIBUTE_UNUSED,
struct bfd_link_info *info ATTRIBUTE_UNUSED,
Elf_Internal_Sym *isym,
- const char **name,
+ const char **name ATTRIBUTE_UNUSED,
flagword *flags ATTRIBUTE_UNUSED,
asection **sec,
bfd_vma *value ATTRIBUTE_UNUSED)
@@ -4075,12 +4148,6 @@ ppc64_elf_add_symbol_hook (bfd *ibfd,
&& strcmp (bfd_get_section_name (ibfd, *sec), ".opd") == 0)
isym->st_info = ELF_ST_INFO (ELF_ST_BIND (isym->st_info), STT_FUNC);
- if ((*name)[0] == '.'
- && ELF_ST_BIND (isym->st_info) == STB_GLOBAL
- && ELF_ST_TYPE (isym->st_info) < STT_SECTION
- && is_ppc64_elf_target (ibfd->xvec))
- ppc64_elf_tdata (ibfd)->u.has_dotsym = 1;
-
return TRUE;
}
@@ -4129,35 +4196,25 @@ ppc64_elf_archive_symbol_lookup (bfd *abfd,
most restrictive visibility of the function descriptor and the
function entry symbol is used. */
-struct add_symbol_adjust_data
-{
- struct bfd_link_info *info;
- bfd_boolean ok;
-};
-
static bfd_boolean
-add_symbol_adjust (struct elf_link_hash_entry *h, void *inf)
+add_symbol_adjust (struct ppc_link_hash_entry *eh, struct bfd_link_info *info)
{
- struct add_symbol_adjust_data *data;
struct ppc_link_hash_table *htab;
- struct ppc_link_hash_entry *eh;
struct ppc_link_hash_entry *fdh;
- if (h->root.type == bfd_link_hash_indirect)
+ if (eh->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 (eh->elf.root.type == bfd_link_hash_warning)
+ eh = (struct ppc_link_hash_entry *) eh->elf.root.u.i.link;
- if (h->root.root.string[0] != '.')
- return TRUE;
+ if (eh->elf.root.root.string[0] != '.')
+ abort ();
- data = inf;
- htab = ppc_hash_table (data->info);
- eh = (struct ppc_link_hash_entry *) h;
+ htab = ppc_hash_table (info);
fdh = get_fdh (eh, htab);
if (fdh == NULL
- && !data->info->relocatable
+ && !info->relocatable
&& (eh->elf.root.type == bfd_link_hash_undefined
|| eh->elf.root.type == bfd_link_hash_undefweak)
&& eh->elf.ref_regular)
@@ -4165,9 +4222,9 @@ add_symbol_adjust (struct elf_link_hash_entry *h, void *inf)
/* Make an undefweak function descriptor sym, which is enough to
pull in an --as-needed shared lib, but won't cause link
errors. Archives are handled elsewhere. */
- fdh = make_fdh (data->info, eh);
+ fdh = make_fdh (info, eh);
if (fdh == NULL)
- data->ok = FALSE;
+ return FALSE;
else
fdh->elf.ref_regular = 1;
}
@@ -4193,26 +4250,37 @@ add_symbol_adjust (struct elf_link_hash_entry *h, void *inf)
return TRUE;
}
+/* Process list of dot-symbols we made in link_hash_newfunc. */
+
static bfd_boolean
-ppc64_elf_check_directives (bfd *abfd, struct bfd_link_info *info)
+ppc64_elf_check_directives (bfd *ibfd, struct bfd_link_info *info)
{
struct ppc_link_hash_table *htab;
- struct add_symbol_adjust_data data;
-
- if (!is_ppc64_elf_target (abfd->xvec))
- return TRUE;
-
- if (!ppc64_elf_tdata (abfd)->u.has_dotsym)
- return TRUE;
- ppc64_elf_tdata (abfd)->u.deleted_section = NULL;
+ struct ppc_link_hash_entry **p, *eh;
htab = ppc_hash_table (info);
if (!is_ppc64_elf_target (htab->elf.root.creator))
return TRUE;
- data.info = info;
- data.ok = TRUE;
- elf_link_hash_traverse (&htab->elf, add_symbol_adjust, &data);
+ if (is_ppc64_elf_target (ibfd->xvec))
+ {
+ p = &htab->dot_syms;
+ while ((eh = *p) != NULL)
+ {
+ *p = NULL;
+ if (!add_symbol_adjust (eh, info))
+ return FALSE;
+ p = &eh->u.next_dot_sym;
+ }
+ }
+
+ /* Clear the list for non-ppc64 input files. */
+ p = &htab->dot_syms;
+ while ((eh = *p) != NULL)
+ {
+ *p = NULL;
+ p = &eh->u.next_dot_sym;
+ }
/* We need to fix the undefs list for any syms we have twiddled to
undef_weak. */
@@ -4221,7 +4289,18 @@ ppc64_elf_check_directives (bfd *abfd, struct bfd_link_info *info)
bfd_link_repair_undef_list (&htab->elf.root);
htab->twiddled_syms = 0;
}
- return data.ok;
+ return TRUE;
+}
+
+/* Undo hash table changes when an --as-needed input file is determined
+ not to be needed. */
+
+static bfd_boolean
+ppc64_elf_as_needed_cleanup (bfd *ibfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info)
+{
+ ppc_hash_table (info)->dot_syms = NULL;
+ return TRUE;
}
static bfd_boolean
@@ -4358,7 +4437,9 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
opd_sym_map = bfd_zalloc (abfd, amt);
if (opd_sym_map == NULL)
return FALSE;
- ppc64_elf_section_data (sec)->opd.func_sec = opd_sym_map;
+ ppc64_elf_section_data (sec)->u.opd_func_sec = opd_sym_map;
+ BFD_ASSERT (ppc64_elf_section_data (sec)->sec_type == sec_normal);
+ ppc64_elf_section_data (sec)->sec_type = sec_opd;
}
if (htab->sfpr == NULL
@@ -4372,6 +4453,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
struct elf_link_hash_entry *h;
enum elf_ppc64_reloc_type r_type;
int tls_type = 0;
+ struct _ppc64_elf_section_data *ppc64_sec;
r_symndx = ELF64_R_SYM (rel->r_info);
if (r_symndx < symtab_hdr->sh_info)
@@ -4553,7 +4635,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
dest = bfd_section_from_r_symndx (abfd, &htab->sym_sec,
sec, r_symndx);
if (dest != sec)
- htab->has_14bit_branch = 1;
+ ppc64_elf_section_data (sec)->has_14bit_branch = 1;
}
/* Fall through. */
@@ -4569,7 +4651,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|| h == &htab->tls_get_addr_fd->elf)
sec->has_tls_reloc = 1;
else if (htab->tls_get_addr == NULL
- && !strncmp (h->root.root.string, ".__tls_get_addr", 15)
+ && CONST_STRNEQ (h->root.root.string, ".__tls_get_addr")
&& (h->root.root.string[15] == 0
|| h->root.root.string[15] == '@'))
{
@@ -4577,7 +4659,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
sec->has_tls_reloc = 1;
}
else if (htab->tls_get_addr_fd == NULL
- && !strncmp (h->root.root.string, "__tls_get_addr", 14)
+ && CONST_STRNEQ (h->root.root.string, "__tls_get_addr")
&& (h->root.root.string[14] == 0
|| h->root.root.string[14] == '@'))
{
@@ -4624,23 +4706,26 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
rel->r_addend, tls_type))
return FALSE;
- if (ppc64_elf_section_data (sec)->t_symndx == NULL)
+ ppc64_sec = ppc64_elf_section_data (sec);
+ if (ppc64_sec->sec_type != sec_toc)
{
/* One extra to simplify get_tls_mask. */
bfd_size_type amt = sec->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)
+ ppc64_sec->u.t_symndx = bfd_zalloc (abfd, amt);
+ if (ppc64_sec->u.t_symndx == NULL)
return FALSE;
+ BFD_ASSERT (ppc64_sec->sec_type == sec_normal);
+ ppc64_sec->sec_type = sec_toc;
}
BFD_ASSERT (rel->r_offset % 8 == 0);
- ppc64_elf_section_data (sec)->t_symndx[rel->r_offset / 8] = r_symndx;
+ ppc64_sec->u.t_symndx[rel->r_offset / 8] = r_symndx;
/* Mark the second slot of a GD or LD entry.
-1 to indicate GD and -2 to indicate LD. */
if (tls_type == (TLS_EXPLICIT | TLS_TLS | TLS_GD))
- ppc64_elf_section_data (sec)->t_symndx[rel->r_offset / 8 + 1] = -1;
+ ppc64_sec->u.t_symndx[rel->r_offset / 8 + 1] = -1;
else if (tls_type == (TLS_EXPLICIT | TLS_TLS | TLS_LD))
- ppc64_elf_section_data (sec)->t_symndx[rel->r_offset / 8 + 1] = -2;
+ ppc64_sec->u.t_symndx[rel->r_offset / 8 + 1] = -2;
goto dodyn;
case R_PPC64_TPREL16:
@@ -4770,7 +4855,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
if (name == NULL)
return FALSE;
- if (strncmp (name, ".rela", 5) != 0
+ if (! CONST_STRNEQ (name, ".rela")
|| strcmp (bfd_get_section_name (abfd, sec),
name + 5) != 0)
{
@@ -5714,7 +5799,6 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
{
struct ppc_link_hash_table *htab;
asection *s;
- unsigned int power_of_two;
htab = ppc_hash_table (info);
@@ -5766,6 +5850,10 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
if (!h->non_got_ref)
return TRUE;
+ /* Don't generate a copy reloc for symbols defined in the executable. */
+ if (!h->def_dynamic || !h->ref_regular || h->def_regular)
+ return TRUE;
+
if (ELIMINATE_COPY_RELOCS)
{
struct ppc_link_hash_entry * eh;
@@ -5831,29 +5919,9 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
h->needs_copy = 1;
}
- /* We need to figure out the alignment required for this symbol. I
- have no idea how ELF linkers handle this. */
- power_of_two = bfd_log2 (h->size);
- if (power_of_two > 4)
- power_of_two = 4;
-
- /* Apply the required alignment. */
s = htab->dynbss;
- s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two));
- if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s))
- {
- if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two))
- return FALSE;
- }
- /* Define the symbol as being at this point in the section. */
- h->root.u.def.section = s;
- h->root.u.def.value = s->size;
-
- /* Increment the section size to make room for the symbol. */
- s->size += h->size;
-
- return TRUE;
+ return _bfd_elf_adjust_dynamic_copy (h, s);
}
/* If given a function descriptor symbol, hide both the function code
@@ -6036,7 +6104,7 @@ get_tls_mask (char **tls_maskp, unsigned long *toc_symndx,
if ((*tls_maskp != NULL && **tls_maskp != 0)
|| sec == NULL
- || ppc64_elf_section_data (sec)->t_symndx == NULL)
+ || ppc64_elf_section_data (sec)->sec_type != sec_toc)
return 1;
/* Look inside a TOC section too. */
@@ -6049,8 +6117,8 @@ get_tls_mask (char **tls_maskp, unsigned long *toc_symndx,
off = sym->st_value;
off += rel->r_addend;
BFD_ASSERT (off % 8 == 0);
- r_symndx = ppc64_elf_section_data (sec)->t_symndx[off / 8];
- next_r = ppc64_elf_section_data (sec)->t_symndx[off / 8 + 1];
+ r_symndx = ppc64_elf_section_data (sec)->u.t_symndx[off / 8];
+ next_r = ppc64_elf_section_data (sec)->u.t_symndx[off / 8 + 1];
if (!get_sym_h (&h, &sym, &sec, tls_maskp, locsymsp, r_symndx, ibfd))
return 0;
if (toc_symndx != NULL)
@@ -6096,13 +6164,13 @@ adjust_opd_syms (struct elf_link_hash_entry *h, void *inf ATTRIBUTE_UNUSED)
if (adjust == -1)
{
/* This entry has been deleted. */
- asection *dsec = ppc64_elf_tdata (sym_sec->owner)->u.deleted_section;
+ asection *dsec = ppc64_elf_tdata (sym_sec->owner)->deleted_section;
if (dsec == NULL)
{
for (dsec = sym_sec->owner->sections; dsec; dsec = dsec->next)
if (elf_discarded_section (dsec))
{
- ppc64_elf_tdata (sym_sec->owner)->u.deleted_section = dsec;
+ ppc64_elf_tdata (sym_sec->owner)->deleted_section = dsec;
break;
}
}
@@ -6291,7 +6359,9 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info,
opd_adjust = bfd_alloc (obfd, amt);
if (opd_adjust == NULL)
return FALSE;
- ppc64_elf_section_data (sec)->opd.adjust = opd_adjust;
+ ppc64_elf_section_data (sec)->u.opd_adjust = opd_adjust;
+ BFD_ASSERT (ppc64_elf_section_data (sec)->sec_type == sec_normal);
+ ppc64_elf_section_data (sec)->sec_type = sec_opd;
}
memset (opd_adjust, 0, amt);
@@ -6601,7 +6671,7 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info,
sec->contents = new_contents;
}
- /* Fudge the size too, as this is used later in
+ /* Fudge the header size too, as this is used later in
elf_bfd_final_link if we are emitting relocs. */
elf_section_data (sec)->rel_hdr.sh_size
= sec->reloc_count * elf_section_data (sec)->rel_hdr.sh_entsize;
@@ -7907,7 +7977,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
/* Strip this section if we don't need it; see the
comment below. */
}
- else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0)
+ else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela"))
{
if (s->size != 0)
{
@@ -8302,6 +8372,33 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
rl += htab->relbrlt->reloc_count++ * sizeof (Elf64_External_Rela);
bfd_elf64_swap_reloca_out (htab->relbrlt->owner, &rela, rl);
}
+ else if (info->emitrelocations)
+ {
+ Elf_Internal_Rela *relocs, *r;
+ struct bfd_elf_section_data *elfsec_data;
+
+ elfsec_data = elf_section_data (htab->brlt);
+ relocs = elfsec_data->relocs;
+ if (relocs == NULL)
+ {
+ bfd_size_type relsize;
+ relsize = htab->brlt->reloc_count * sizeof (*relocs);
+ relocs = bfd_alloc (htab->brlt->owner, relsize);
+ if (relocs == NULL)
+ return FALSE;
+ elfsec_data->relocs = relocs;
+ elfsec_data->rel_hdr.sh_size = relsize;
+ elfsec_data->rel_hdr.sh_entsize = 24;
+ htab->brlt->reloc_count = 0;
+ }
+ r = relocs + htab->brlt->reloc_count;
+ htab->brlt->reloc_count += 1;
+ r->r_offset = (br_entry->offset
+ + htab->brlt->output_offset
+ + htab->brlt->output_section->vma);
+ r->r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE);
+ r->r_addend = off;
+ }
off = (br_entry->offset
+ htab->brlt->output_offset
@@ -8531,6 +8628,11 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
if (htab->relbrlt != NULL)
htab->relbrlt->size += sizeof (Elf64_External_Rela);
+ else if (info->emitrelocations)
+ {
+ htab->brlt->reloc_count += 1;
+ htab->brlt->flags |= SEC_RELOC;
+ }
}
stub_entry->stub_type += ppc_stub_plt_branch - ppc_stub_long_branch;
@@ -8538,11 +8640,11 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
if (stub_entry->stub_type != ppc_stub_plt_branch)
size = 28;
}
-
- if (info->emitrelocations
- && (stub_entry->stub_type == ppc_stub_long_branch
- || stub_entry->stub_type == ppc_stub_long_branch_r2off))
- stub_entry->stub_sec->reloc_count += 1;
+ else if (info->emitrelocations)
+ {
+ stub_entry->stub_sec->reloc_count += 1;
+ stub_entry->stub_sec->flags |= SEC_RELOC;
+ }
}
stub_entry->stub_sec->size += size;
@@ -8925,7 +9027,29 @@ group_sections (struct ppc_link_hash_table *htab,
bfd_size_type stub_group_size,
bfd_boolean stubs_always_before_branch)
{
- asection **list = htab->input_list + htab->top_index;
+ asection **list;
+ bfd_size_type stub14_group_size;
+ bfd_boolean suppress_size_errors;
+
+ suppress_size_errors = FALSE;
+ stub14_group_size = stub_group_size;
+ if (stub_group_size == 1)
+ {
+ /* Default values. */
+ if (stubs_always_before_branch)
+ {
+ stub_group_size = 0x1e00000;
+ stub14_group_size = 0x7800;
+ }
+ else
+ {
+ stub_group_size = 0x1c00000;
+ stub14_group_size = 0x7000;
+ }
+ suppress_size_errors = TRUE;
+ }
+
+ list = htab->input_list + htab->top_index;
do
{
asection *tail = *list;
@@ -8939,15 +9063,17 @@ group_sections (struct ppc_link_hash_table *htab,
curr = tail;
total = tail->size;
- big_sec = total > stub_group_size;
- if (big_sec)
+ big_sec = total > (ppc64_elf_section_data (tail)->has_14bit_branch
+ ? stub14_group_size : stub_group_size);
+ if (big_sec && !suppress_size_errors)
(*_bfd_error_handler) (_("%B section %A exceeds stub group size"),
tail->owner, tail);
curr_toc = htab->stub_group[tail->id].toc_off;
while ((prev = PREV_SEC (curr)) != NULL
&& ((total += curr->output_offset - prev->output_offset)
- < stub_group_size)
+ < (ppc64_elf_section_data (prev)->has_14bit_branch
+ ? stub14_group_size : stub_group_size))
&& htab->stub_group[prev->id].toc_off == curr_toc)
curr = prev;
@@ -8979,7 +9105,8 @@ group_sections (struct ppc_link_hash_table *htab,
total = 0;
while (prev != NULL
&& ((total += tail->output_offset - prev->output_offset)
- < stub_group_size)
+ < (ppc64_elf_section_data (prev)->has_14bit_branch
+ ? stub14_group_size : stub_group_size))
&& htab->stub_group[prev->id].toc_off == curr_toc)
{
tail = prev;
@@ -9020,22 +9147,6 @@ ppc64_elf_size_stubs (bfd *output_bfd,
stub_group_size = -group_size;
else
stub_group_size = group_size;
- if (stub_group_size == 1)
- {
- /* Default values. */
- if (stubs_always_before_branch)
- {
- stub_group_size = 0x1e00000;
- if (htab->has_14bit_branch)
- stub_group_size = 0x7800;
- }
- else
- {
- stub_group_size = 0x1c00000;
- if (htab->has_14bit_branch)
- stub_group_size = 0x7000;
- }
- }
group_sections (htab, stub_group_size, stubs_always_before_branch);
@@ -9073,6 +9184,9 @@ ppc64_elf_size_stubs (bfd *output_bfd,
/* If there aren't any relocs, then there's nothing more
to do. */
if ((section->flags & SEC_RELOC) == 0
+ || (section->flags & SEC_ALLOC) == 0
+ || (section->flags & SEC_LOAD) == 0
+ || (section->flags & SEC_CODE) == 0
|| section->reloc_count == 0)
continue;
@@ -9322,9 +9436,12 @@ ppc64_elf_size_stubs (bfd *output_bfd,
stub_sec->rawsize = stub_sec->size;
stub_sec->size = 0;
stub_sec->reloc_count = 0;
+ stub_sec->flags &= ~SEC_RELOC;
}
htab->brlt->size = 0;
+ htab->brlt->reloc_count = 0;
+ htab->brlt->flags &= ~SEC_RELOC;
if (htab->relbrlt != NULL)
htab->relbrlt->size = 0;
@@ -9442,24 +9559,12 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms,
stub_sec->size = 0;
}
- if (htab->plt != NULL)
+ if (htab->glink != NULL && htab->glink->size != 0)
{
unsigned int indx;
bfd_vma plt0;
/* Build the .glink plt call stub. */
- plt0 = (htab->plt->output_section->vma
- + htab->plt->output_offset
- - (htab->glink->output_section->vma
- + htab->glink->output_offset
- + GLINK_CALL_STUB_SIZE));
- if (plt0 + 0x80008000 > 0xffffffff)
- {
- (*_bfd_error_handler) (_(".glink and .plt too far apart"));
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
if (htab->emit_stub_syms)
{
struct elf_link_hash_entry *h;
@@ -9470,7 +9575,7 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms,
{
h->root.type = bfd_link_hash_defined;
h->root.u.def.section = htab->glink;
- h->root.u.def.value = 0;
+ h->root.u.def.value = 8;
h->ref_regular = 1;
h->def_regular = 1;
h->ref_regular_nonweak = 1;
@@ -9479,29 +9584,26 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms,
}
}
p = htab->glink->contents;
- bfd_put_32 (htab->glink->owner, MFCTR_R12, p);
- p += 4;
- bfd_put_32 (htab->glink->owner, SLDI_R11_R0_3, p);
- p += 4;
- bfd_put_32 (htab->glink->owner, ADDIC_R2_R0_32K, p);
- p += 4;
- bfd_put_32 (htab->glink->owner, SUB_R12_R12_R11, p);
- p += 4;
- bfd_put_32 (htab->glink->owner, SRADI_R2_R2_63, p);
- p += 4;
- bfd_put_32 (htab->glink->owner, SLDI_R11_R0_2, p);
+ plt0 = (htab->plt->output_section->vma
+ + htab->plt->output_offset
+ - (htab->glink->output_section->vma
+ + htab->glink->output_offset
+ + 16));
+ bfd_put_64 (htab->glink->owner, plt0, p);
+ p += 8;
+ bfd_put_32 (htab->glink->owner, MFLR_R12, p);
p += 4;
- bfd_put_32 (htab->glink->owner, AND_R2_R2_R11, p);
+ bfd_put_32 (htab->glink->owner, BCL_20_31, p);
p += 4;
- bfd_put_32 (htab->glink->owner, SUB_R12_R12_R11, p);
+ bfd_put_32 (htab->glink->owner, MFLR_R11, p);
p += 4;
- bfd_put_32 (htab->glink->owner, ADD_R12_R12_R2, p);
+ bfd_put_32 (htab->glink->owner, LD_R2_M16R11, p);
p += 4;
- bfd_put_32 (htab->glink->owner, ADDIS_R12_R12 | PPC_HA (plt0), p);
+ bfd_put_32 (htab->glink->owner, MTLR_R12, p);
p += 4;
- bfd_put_32 (htab->glink->owner, LD_R11_0R12 | PPC_LO (plt0), p);
+ bfd_put_32 (htab->glink->owner, ADD_R12_R2_R11, p);
p += 4;
- bfd_put_32 (htab->glink->owner, ADDI_R12_R12 | PPC_LO (plt0), p);
+ bfd_put_32 (htab->glink->owner, LD_R11_0R12, p);
p += 4;
bfd_put_32 (htab->glink->owner, LD_R2_0R12 | 8, p);
p += 4;
@@ -9511,6 +9613,11 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms,
p += 4;
bfd_put_32 (htab->glink->owner, BCTR, p);
p += 4;
+ while (p - htab->glink->contents < GLINK_CALL_STUB_SIZE)
+ {
+ bfd_put_32 (htab->glink->owner, NOP, p);
+ p += 4;
+ }
/* Build the .glink lazy link call stubs. */
indx = 0;
@@ -9529,7 +9636,7 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms,
p += 4;
}
bfd_put_32 (htab->glink->owner,
- B_DOT | ((htab->glink->contents - p) & 0x3fffffc), p);
+ B_DOT | ((htab->glink->contents - p + 8) & 0x3fffffc), p);
indx++;
p += 4;
}
@@ -9554,6 +9661,9 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms,
/* Build the stubs as directed by the stub hash table. */
bfd_hash_traverse (&htab->stub_hash_table, ppc_build_one_stub, info);
+ if (htab->relbrlt != NULL)
+ htab->relbrlt->reloc_count = 0;
+
for (stub_sec = htab->stub_bfd->sections;
stub_sec != NULL;
stub_sec = stub_sec->next)
@@ -9695,6 +9805,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
bfd_boolean is_opd;
/* Disabled until we sort out how ld should choose 'y' vs 'at'. */
bfd_boolean is_power4 = FALSE;
+ bfd_vma d_offset = (bfd_big_endian (output_bfd) ? 2 : 0);
/* Initialize howto table if needed. */
if (!ppc64_elf_howto_table[R_PPC64_ADDR32])
@@ -9710,7 +9821,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
TOCstart = elf_gp (output_bfd);
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
- is_opd = ppc64_elf_section_data (input_section)->opd.adjust != NULL;
+ is_opd = ppc64_elf_section_data (input_section)->sec_type == sec_opd;
rel = relocs;
relend = relocs + input_section->reloc_count;
@@ -9785,13 +9896,9 @@ ppc64_elf_relocate_section (bfd *output_bfd,
relocation += adjust;
}
}
- if (info->relocatable)
- continue;
}
else
{
- if (info->relocatable)
- continue;
RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
r_symndx, symtab_hdr, sym_hashes,
h_elf, sec, relocation,
@@ -9801,6 +9908,21 @@ ppc64_elf_relocate_section (bfd *output_bfd,
}
h = (struct ppc_link_hash_entry *) h_elf;
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (ppc64_elf_howto_table[r_type], input_bfd,
+ contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
/* TLS optimizations. Replace instruction sequences and relocs
based on information we collected in tls_optimize. We edit
RELOCS so that --emit-relocs will output something sensible
@@ -9924,10 +10046,10 @@ ppc64_elf_relocate_section (bfd *output_bfd,
&& (tls_mask & TLS_TPREL) == 0)
{
toctprel:
- insn = bfd_get_32 (output_bfd, contents + rel->r_offset - 2);
+ insn = bfd_get_32 (output_bfd, contents + rel->r_offset - d_offset);
insn &= 31 << 21;
insn |= 0x3c0d0000; /* addis 0,13,0 */
- bfd_put_32 (output_bfd, insn, contents + rel->r_offset - 2);
+ bfd_put_32 (output_bfd, insn, contents + rel->r_offset - d_offset);
r_type = R_PPC64_TPREL16_HA;
if (toc_symndx != 0)
{
@@ -9979,8 +10101,8 @@ ppc64_elf_relocate_section (bfd *output_bfd,
insn |= rtra;
bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
/* Was PPC64_TLS which sits on insn boundary, now
- PPC64_TPREL16_LO which is at insn+2. */
- rel->r_offset += 2;
+ PPC64_TPREL16_LO which is at low-order half-word. */
+ rel->r_offset += d_offset;
r_type = R_PPC64_TPREL16_LO;
if (toc_symndx != 0)
{
@@ -10013,7 +10135,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
else
{
bfd_put_32 (output_bfd, NOP, contents + rel->r_offset);
- rel->r_offset -= 2;
+ rel->r_offset -= d_offset;
r_type = R_PPC64_NONE;
}
rel->r_info = ELF64_R_INFO (r_symndx, r_type);
@@ -10062,7 +10184,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
/* OK, it checks out. Replace the call. */
offset = rel[1].r_offset;
insn1 = bfd_get_32 (output_bfd,
- contents + rel->r_offset - 2);
+ contents + rel->r_offset - d_offset);
insn3 = bfd_get_32 (output_bfd,
contents + offset + 4);
if ((tls_mask & tls_gd) != 0)
@@ -10097,7 +10219,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
rel->r_info = ELF64_R_INFO (r_symndx, r_type);
rel[1].r_info = ELF64_R_INFO (r_symndx,
R_PPC64_TPREL16_LO);
- rel[1].r_offset += 2;
+ rel[1].r_offset += d_offset;
}
if (insn3 == NOP
|| insn3 == CROR_151515 || insn3 == CROR_313131)
@@ -10106,7 +10228,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
insn2 = NOP;
rel[1].r_offset += 4;
}
- bfd_put_32 (output_bfd, insn1, contents + rel->r_offset - 2);
+ bfd_put_32 (output_bfd, insn1, contents + rel->r_offset - d_offset);
bfd_put_32 (output_bfd, insn2, contents + offset);
bfd_put_32 (output_bfd, insn3, contents + offset + 4);
if (tls_gd == 0 || toc_symndx != 0)
@@ -10620,7 +10742,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
relocation += htab->stub_group[sec->id].toc_off;
else
unresolved_reloc = TRUE;
- goto dodyn2;
+ goto dodyn;
/* TOC16 relocs. We want the offset relative to the TOC base,
which is the address of the start of the TOC plus 0x8000.
@@ -10720,15 +10842,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
case R_PPC64_UADDR16:
case R_PPC64_UADDR32:
case R_PPC64_UADDR64:
- /* r_symndx will be zero only for relocs against symbols
- from removed linkonce sections, or sections discarded by
- a linker script. */
dodyn:
- if (r_symndx == 0)
- break;
- /* Fall thru. */
-
- dodyn2:
if ((input_section->flags & SEC_ALLOC) == 0)
break;
@@ -10838,6 +10952,17 @@ ppc64_elf_relocate_section (bfd *output_bfd,
osec = sec->output_section;
indx = elf_section_data (osec)->dynindx;
+ if (indx == 0)
+ {
+ if ((osec->flags & SEC_READONLY) == 0
+ && htab->elf.data_index_section != NULL)
+ osec = htab->elf.data_index_section;
+ else
+ osec = htab->elf.text_index_section;
+ indx = elf_section_data (osec)->dynindx;
+ }
+ BFD_ASSERT (indx != 0);
+
/* We are turning this relocation into one
against a section symbol, so subtract out
the output section's address but not the
@@ -10926,17 +11051,10 @@ ppc64_elf_relocate_section (bfd *output_bfd,
case R_PPC64_ADDR16_HA:
case R_PPC64_ADDR16_HIGHERA:
case R_PPC64_ADDR16_HIGHESTA:
- case R_PPC64_GOT16_HA:
- case R_PPC64_PLTGOT16_HA:
- case R_PPC64_PLT16_HA:
case R_PPC64_TOC16_HA:
case R_PPC64_SECTOFF_HA:
case R_PPC64_TPREL16_HA:
case R_PPC64_DTPREL16_HA:
- case R_PPC64_GOT_TLSGD16_HA:
- case R_PPC64_GOT_TLSLD16_HA:
- case R_PPC64_GOT_TPREL16_HA:
- case R_PPC64_GOT_DTPREL16_HA:
case R_PPC64_TPREL16_HIGHER:
case R_PPC64_TPREL16_HIGHERA:
case R_PPC64_TPREL16_HIGHEST:
@@ -10949,10 +11067,20 @@ ppc64_elf_relocate_section (bfd *output_bfd,
that's not actually defined anywhere. In that case,
'sec' would be NULL, and we should leave the symbol
alone (it will be set to zero elsewhere in the link). */
- if (sec != NULL)
- /* Add 0x10000 if sign bit in 0:15 is set.
- Bits 0:15 are not used. */
- addend += 0x8000;
+ if (sec == NULL)
+ break;
+ /* Fall thru */
+
+ case R_PPC64_GOT16_HA:
+ case R_PPC64_PLTGOT16_HA:
+ case R_PPC64_PLT16_HA:
+ case R_PPC64_GOT_TLSGD16_HA:
+ case R_PPC64_GOT_TLSLD16_HA:
+ case R_PPC64_GOT_TPREL16_HA:
+ case R_PPC64_GOT_DTPREL16_HA:
+ /* Add 0x10000 if sign bit in 0:15 is set.
+ Bits 0:15 are not used. */
+ addend += 0x8000;
break;
case R_PPC64_ADDR16_DS:
@@ -11125,13 +11253,11 @@ ppc64_elf_finish_dynamic_symbol (bfd *output_bfd,
Elf_Internal_Sym *sym)
{
struct ppc_link_hash_table *htab;
- bfd *dynobj;
struct plt_entry *ent;
Elf_Internal_Rela rela;
bfd_byte *loc;
htab = ppc_hash_table (info);
- dynobj = htab->elf.dynobj;
for (ent = h->plt.plist; ent != NULL; ent = ent->next)
if (ent->plt.offset != (bfd_vma) -1)
@@ -11328,6 +11454,17 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd,
= PLT_ENTRY_SIZE;
}
+ /* brlt is SEC_LINKER_CREATED, so we need to write out relocs for
+ brlt ourselves if emitrelocations. */
+ if (htab->brlt != NULL
+ && htab->brlt->reloc_count != 0
+ && !_bfd_elf_link_output_relocs (output_bfd,
+ htab->brlt,
+ &elf_section_data (htab->brlt)->rel_hdr,
+ elf_section_data (htab->brlt)->relocs,
+ NULL))
+ return FALSE;
+
/* We need to handle writing out multiple GOT sections ourselves,
since we didn't add them to DYNOBJ. We know dynobj is the first
bfd. */
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index 1fe0c6ca915c..47fbff6bed9e 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -1,5 +1,5 @@
/* IBM S/390-specific support for 64-bit ELF
- Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Contributed Martin Schwidefsky (schwidefsky@de.ibm.com).
@@ -20,8 +20,8 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -46,12 +46,6 @@ static void elf_s390_copy_indirect_symbol
static bfd_boolean elf_s390_check_relocs
PARAMS ((bfd *, struct bfd_link_info *, asection *,
const Elf_Internal_Rela *));
-static asection *elf_s390_gc_mark_hook
- PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *, Elf_Internal_Sym *));
-static bfd_boolean elf_s390_gc_sweep_hook
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- const Elf_Internal_Rela *));
struct elf_s390_link_hash_entry;
static void elf_s390_adjust_gotplt
PARAMS ((struct elf_s390_link_hash_entry *));
@@ -73,8 +67,6 @@ static enum elf_reloc_type_class elf_s390_reloc_type_class
PARAMS ((const Elf_Internal_Rela *));
static bfd_boolean elf_s390_finish_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean elf_s390_mkobject
- PARAMS ((bfd *));
static bfd_boolean elf_s390_object_p
PARAMS ((bfd *));
static int elf_s390_tls_transition
@@ -364,6 +356,27 @@ elf_s390_reloc_type_lookup (abfd, code)
return 0;
}
+static reloc_howto_type *
+elf_s390_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (elf_howto_table) / sizeof (elf_howto_table[0]);
+ i++)
+ if (elf_howto_table[i].name != NULL
+ && strcasecmp (elf_howto_table[i].name, r_name) == 0)
+ return &elf_howto_table[i];
+
+ if (strcasecmp (elf64_s390_vtinherit_howto.name, r_name) == 0)
+ return &elf64_s390_vtinherit_howto;
+ if (strcasecmp (elf64_s390_vtentry_howto.name, r_name) == 0)
+ return &elf64_s390_vtentry_howto;
+
+ return NULL;
+}
+
/* We need to use ELF64_R_TYPE so we have our own copy of this function,
and elf64-s390.c has its own copy. */
@@ -631,14 +644,16 @@ struct elf_s390_obj_tdata
(elf_s390_tdata (abfd)->local_got_tls_type)
static bfd_boolean
-elf_s390_mkobject (abfd)
- bfd *abfd;
+elf_s390_mkobject (bfd *abfd)
{
- bfd_size_type amt = sizeof (struct elf_s390_obj_tdata);
- abfd->tdata.any = bfd_zalloc (abfd, amt);
if (abfd->tdata.any == NULL)
- return FALSE;
- return TRUE;
+ {
+ bfd_size_type amt = sizeof (struct elf_s390_obj_tdata);
+ abfd->tdata.any = bfd_zalloc (abfd, amt);
+ if (abfd->tdata.any == NULL)
+ return FALSE;
+ }
+ return bfd_elf_mkobject (abfd);
}
static bfd_boolean
@@ -1238,7 +1253,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
if (name == NULL)
return FALSE;
- if (strncmp (name, ".rela", 5) != 0
+ if (! CONST_STRNEQ (name, ".rela")
|| strcmp (bfd_get_section_name (abfd, sec),
name + 5) != 0)
{
@@ -1345,50 +1360,30 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
relocation. */
static asection *
-elf_s390_gc_mark_hook (sec, info, rel, h, sym)
- asection *sec;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- Elf_Internal_Rela *rel;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
+elf_s390_gc_mark_hook (asection *sec,
+ struct bfd_link_info *info,
+ Elf_Internal_Rela *rel,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
{
if (h != NULL)
- {
- switch (ELF64_R_TYPE (rel->r_info))
- {
- case R_390_GNU_VTINHERIT:
- case R_390_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
-
- return NULL;
+ switch (ELF64_R_TYPE (rel->r_info))
+ {
+ case R_390_GNU_VTINHERIT:
+ case R_390_GNU_VTENTRY:
+ return NULL;
+ }
+
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
/* Update the got entry reference counts for the section being removed. */
static bfd_boolean
-elf_s390_gc_sweep_hook (abfd, info, sec, relocs)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *sec;
- const Elf_Internal_Rela *relocs;
+elf_s390_gc_sweep_hook (bfd *abfd,
+ struct bfd_link_info *info,
+ asection *sec,
+ const Elf_Internal_Rela *relocs)
{
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
@@ -1562,7 +1557,6 @@ elf_s390_adjust_dynamic_symbol (info, h)
{
struct elf_s390_link_hash_table *htab;
asection *s;
- unsigned int power_of_two;
/* If this is a function, put it in the procedure linkage table. We
will fill in the contents of the procedure linkage table later
@@ -1683,29 +1677,9 @@ elf_s390_adjust_dynamic_symbol (info, h)
h->needs_copy = 1;
}
- /* We need to figure out the alignment required for this symbol. I
- have no idea how ELF linkers handle this. */
- power_of_two = bfd_log2 (h->size);
- if (power_of_two > 3)
- power_of_two = 3;
-
- /* Apply the required alignment. */
s = htab->sdynbss;
- s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two));
- if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s))
- {
- if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two))
- return FALSE;
- }
-
- /* Define the symbol as being at this point in the section. */
- h->root.u.def.section = s;
- h->root.u.def.value = s->size;
- /* Increment the section size to make room for the symbol. */
- s->size += h->size;
-
- return TRUE;
+ return _bfd_elf_adjust_dynamic_copy (h, s);
}
/* Allocate space in .plt, .got and associated reloc sections for
@@ -2098,7 +2072,7 @@ elf_s390_size_dynamic_sections (output_bfd, info)
/* Strip this section if we don't need it; see the
comment below. */
}
- else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0)
+ else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela"))
{
if (s->size != 0 && s != htab->srelplt)
relocs = TRUE;
@@ -2240,6 +2214,7 @@ invalid_tls_insn (input_bfd, input_section, rel)
input_section,
(long) rel->r_offset,
howto->name);
+ bfd_set_error (bfd_error_bad_value);
}
/* Relocate a 390 ELF section. */
@@ -2263,9 +2238,6 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
- if (info->relocatable)
- return TRUE;
-
htab = elf_s390_hash_table (info);
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
@@ -2300,7 +2272,6 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
howto = elf_howto_table + r_type;
r_symndx = ELF64_R_SYM (rel->r_info);
- /* This is a final link. */
h = NULL;
sym = NULL;
sec = NULL;
@@ -2321,6 +2292,20 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
unresolved_reloc, warned);
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
switch (r_type)
{
case R_390_GOTPLT12:
@@ -2544,11 +2529,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
case R_390_PC32:
case R_390_PC32DBL:
case R_390_PC64:
- /* r_symndx will be zero only for relocs against symbols
- from removed linkonce sections, or sections discarded by
- a linker script. */
- if (r_symndx == 0
- || (input_section->flags & SEC_ALLOC) == 0)
+ if ((input_section->flags & SEC_ALLOC) == 0)
break;
if ((info->shared
@@ -2636,14 +2617,19 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
osec = sec->output_section;
sindx = elf_section_data (osec)->dynindx;
- BFD_ASSERT (sindx > 0);
+
+ if (sindx == 0)
+ {
+ osec = htab->elf.text_index_section;
+ sindx = elf_section_data (osec)->dynindx;
+ }
+ BFD_ASSERT (sindx != 0);
/* We are turning this relocation into one
against a section symbol, so subtract out
the output section's address but not the
offset of the input section in the output
section. */
-
outrel.r_addend -= osec->vma;
}
outrel.r_info = ELF64_R_INFO (sindx, r_type);
@@ -2908,7 +2894,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
continue;
case R_390_TLS_LDO64:
- if (info->shared || (input_section->flags & SEC_CODE) == 0)
+ if (info->shared)
relocation -= dtpoff_base (info);
else
/* When converting LDO to LE, we must negate. */
@@ -3462,6 +3448,7 @@ const struct elf_size_info s390_elf64_size_info =
#define bfd_elf64_bfd_is_local_label_name elf_s390_is_local_label_name
#define bfd_elf64_bfd_link_hash_table_create elf_s390_link_hash_table_create
#define bfd_elf64_bfd_reloc_type_lookup elf_s390_reloc_type_lookup
+#define bfd_elf64_bfd_reloc_name_lookup elf_s390_reloc_name_lookup
#define elf_backend_adjust_dynamic_symbol elf_s390_adjust_dynamic_symbol
#define elf_backend_check_relocs elf_s390_check_relocs
@@ -3474,6 +3461,7 @@ const struct elf_size_info s390_elf64_size_info =
#define elf_backend_reloc_type_class elf_s390_reloc_type_class
#define elf_backend_relocate_section elf_s390_relocate_section
#define elf_backend_size_dynamic_sections elf_s390_size_dynamic_sections
+#define elf_backend_init_index_section _bfd_elf_init_1_index_section
#define elf_backend_reloc_type_class elf_s390_reloc_type_class
#define elf_backend_plt_sym_val elf_s390_plt_sym_val
diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c
index 4d6d8d5645fa..6d343b78bff8 100644
--- a/bfd/elf64-sh64.c
+++ b/bfd/elf64-sh64.c
@@ -1,5 +1,5 @@
/* SuperH SH64-specific support for 64-bit ELF
- Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -20,8 +20,8 @@
#define SH64_ELF64
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -1392,6 +1392,22 @@ sh_elf64_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return NULL;
}
+static reloc_howto_type *
+sh_elf64_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (sh_elf64_howto_table) / sizeof (sh_elf64_howto_table[0]);
+ i++)
+ if (sh_elf64_howto_table[i].name != NULL
+ && strcasecmp (sh_elf64_howto_table[i].name, r_name) == 0)
+ return &sh_elf64_howto_table[i];
+
+ return NULL;
+}
+
/* Given an ELF reloc, fill in the howto field of a relent.
See sh_elf_info_to_howto in elf32-sh.c for the original. */
@@ -1487,10 +1503,10 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
howto = sh_elf64_howto_table + r_type;
- /* This is a final link. */
h = NULL;
sym = NULL;
sec = NULL;
+ relocation = 0;
if (r_symndx < symtab_hdr->sh_info)
{
sym = local_syms + r_symndx;
@@ -1509,13 +1525,15 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
_("Unexpected STO_SH5_ISA32 on local symbol is not handled"),
input_bfd, input_section, rel->r_offset));
- if (info->relocatable)
+ if (sec != NULL && elf_discarded_section (sec))
+ /* Handled below. */
+ ;
+ else if (info->relocatable)
{
/* This is a relocatable link. We don't have to change
anything, unless the reloc is against a section symbol,
in which case we have to adjust according to where the
section symbol winds up in the output section. */
- sym = local_syms + r_symndx;
if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
goto final_link_relocate;
@@ -1554,12 +1572,6 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
{
/* ??? Could we use the RELOC_FOR_GLOBAL_SYMBOL macro here ? */
- /* Section symbols are never (?) placed in the hash table, so
- we can just ignore hash relocations when creating a
- relocatable object file. */
- if (info->relocatable)
- continue;
-
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
@@ -1619,8 +1631,17 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|| (sec->output_section == NULL
&& ((input_section->flags & SEC_DEBUGGING) != 0
&& h->def_dynamic)))
- relocation = 0;
- else if (sec->output_section == NULL)
+ ;
+ else if (sec->output_section != NULL)
+ relocation = ((h->root.u.def.value
+ + sec->output_section->vma
+ + sec->output_offset)
+ /* A STO_SH5_ISA32 causes a "bitor 1" to the
+ symbol value, unless we've seen
+ STT_DATALABEL on the way to it. */
+ | ((h->other & STO_SH5_ISA32) != 0
+ && ! seen_stt_datalabel));
+ else if (!info->relocatable)
{
(*_bfd_error_handler)
(_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
@@ -1629,24 +1650,14 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
(long) rel->r_offset,
howto->name,
h->root.root.string);
- relocation = 0;
}
- else
- relocation = ((h->root.u.def.value
- + sec->output_section->vma
- + sec->output_offset)
- /* A STO_SH5_ISA32 causes a "bitor 1" to the
- symbol value, unless we've seen
- STT_DATALABEL on the way to it. */
- | ((h->other & STO_SH5_ISA32) != 0
- && ! seen_stt_datalabel));
}
else if (h->root.type == bfd_link_hash_undefweak)
- relocation = 0;
+ ;
else if (info->unresolved_syms_in_objects == RM_IGNORE
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
- relocation = 0;
- else
+ ;
+ else if (!info->relocatable)
{
if (! ((*info->callbacks->undefined_symbol)
(info, h->root.root.string, input_bfd,
@@ -1654,10 +1665,23 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
(info->unresolved_syms_in_objects == RM_GENERATE_ERROR
|| ELF_ST_VISIBILITY (h->other)))))
return FALSE;
- relocation = 0;
}
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
disp = (relocation
- input_section->output_section->vma
- input_section->output_offset
@@ -1709,7 +1733,7 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (input_bfd,
input_section),
name + 5) == 0);
@@ -2292,6 +2316,9 @@ sh_elf64_copy_private_data_internal (bfd *ibfd, bfd *obfd)
}
}
+ /* Copy object attributes. */
+ _bfd_elf_copy_obj_attributes (ibfd, obfd);
+
return sh_elf64_set_private_flags (obfd, elf_elfheader (ibfd)->e_flags);
}
@@ -2366,53 +2393,20 @@ sh_elf64_merge_private_data (bfd *ibfd, bfd *obfd)
static asection *
sh_elf64_gc_mark_hook (asection *sec,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info,
Elf_Internal_Rela *rel,
struct elf_link_hash_entry *h,
Elf_Internal_Sym *sym)
{
if (h != NULL)
- {
- switch (ELF64_R_TYPE (rel->r_info))
- {
- case R_SH_GNU_VTINHERIT:
- case R_SH_GNU_VTENTRY:
- break;
-
- default:
- while (h->root.type == bfd_link_hash_indirect
- && h->root.u.i.link)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
-
- return NULL;
-}
-
-/* Update the got entry reference counts for the section being removed. */
+ switch (ELF64_R_TYPE (rel->r_info))
+ {
+ case R_SH_GNU_VTINHERIT:
+ case R_SH_GNU_VTENTRY:
+ return NULL;
+ }
-static bfd_boolean
-sh_elf64_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
- asection *sec ATTRIBUTE_UNUSED,
- const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED)
-{
- /* No got and plt entries for 64-bit SH at present. */
- return TRUE;
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
/* Look through the relocs for a section during the first phase.
@@ -2731,7 +2725,7 @@ sh_elf64_check_relocs (bfd *abfd, struct bfd_link_info *info,
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (abfd, sec),
name + 5) == 0);
@@ -3333,7 +3327,6 @@ sh64_elf64_adjust_dynamic_symbol (struct bfd_link_info *info,
{
bfd *dynobj;
asection *s;
- unsigned int power_of_two;
dynobj = elf_hash_table (info)->dynobj;
@@ -3473,28 +3466,7 @@ sh64_elf64_adjust_dynamic_symbol (struct bfd_link_info *info,
h->needs_copy = 1;
}
- /* We need to figure out the alignment required for this symbol. I
- have no idea how ELF linkers handle this. */
- power_of_two = bfd_log2 (h->size);
- if (power_of_two > 3)
- power_of_two = 3;
-
- /* Apply the required alignment. */
- s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two));
- if (power_of_two > bfd_get_section_alignment (dynobj, s))
- {
- if (! bfd_set_section_alignment (dynobj, s, power_of_two))
- return FALSE;
- }
-
- /* Define the symbol as being at this point in the section. */
- h->root.u.def.section = s;
- h->root.u.def.value = s->size;
-
- /* Increment the section size to make room for the symbol. */
- s->size += h->size;
-
- return TRUE;
+ return _bfd_elf_adjust_dynamic_copy (h, s);
}
/* This function is called via sh_elf_link_hash_traverse if we are
@@ -3591,7 +3563,7 @@ sh64_elf64_size_dynamic_sections (bfd *output_bfd,
/* Remember whether there is a PLT. */
plt = s->size != 0;
}
- else if (strncmp (name, ".rela", 5) == 0)
+ else if (CONST_STRNEQ (name, ".rela"))
{
if (s->size != 0)
{
@@ -3624,7 +3596,7 @@ sh64_elf64_size_dynamic_sections (bfd *output_bfd,
s->reloc_count = 0;
}
}
- else if (strncmp (name, ".got", 4) != 0
+ else if (! CONST_STRNEQ (name, ".got")
&& strcmp (name, ".dynbss") != 0)
{
/* It's not one of our sections, so don't allocate space. */
@@ -4053,9 +4025,9 @@ static void
sh64_elf64_merge_symbol_attribute (struct elf_link_hash_entry *h,
const Elf_Internal_Sym *isym,
bfd_boolean definition,
- bfd_boolean dynamic)
+ bfd_boolean dynamic ATTRIBUTE_UNUSED)
{
- if (isym->st_other != 0 && dynamic)
+ if ((isym->st_other & ~ELF_ST_VISIBILITY (-1)) != 0)
{
unsigned char other;
@@ -4070,8 +4042,8 @@ sh64_elf64_merge_symbol_attribute (struct elf_link_hash_entry *h,
static const struct bfd_elf_special_section sh64_elf64_special_sections[]=
{
- { ".cranges", 8, 0, SHT_PROGBITS, 0 },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".cranges"), 0, SHT_PROGBITS, 0 },
+ { NULL, 0, 0, 0, 0 }
};
#define TARGET_BIG_SYM bfd_elf64_sh64_vec
@@ -4085,6 +4057,8 @@ static const struct bfd_elf_special_section sh64_elf64_special_sections[]=
#define elf_symbol_leading_char '_'
#define bfd_elf64_bfd_reloc_type_lookup sh_elf64_reloc_type_lookup
+#define bfd_elf64_bfd_reloc_name_lookup \
+ sh_elf64_reloc_name_lookup
#define elf_info_to_howto sh_elf64_info_to_howto
/* Note: there's no relaxation at present. */
@@ -4102,7 +4076,6 @@ static const struct bfd_elf_special_section sh64_elf64_special_sections[]=
#define elf_backend_fake_sections sh64_elf64_fake_sections
#define elf_backend_gc_mark_hook sh_elf64_gc_mark_hook
-#define elf_backend_gc_sweep_hook sh_elf64_gc_sweep_hook
#define elf_backend_check_relocs sh_elf64_check_relocs
#define elf_backend_can_gc_sections 1
@@ -4128,6 +4101,8 @@ static const struct bfd_elf_special_section sh64_elf64_special_sections[]=
sh64_elf64_adjust_dynamic_symbol
#define elf_backend_size_dynamic_sections \
sh64_elf64_size_dynamic_sections
+#define elf_backend_omit_section_dynsym \
+ ((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) bfd_true)
#define elf_backend_finish_dynamic_symbol \
sh64_elf64_finish_dynamic_symbol
#define elf_backend_finish_dynamic_sections \
@@ -4168,6 +4143,7 @@ static const struct bfd_elf_special_section sh64_elf64_special_sections[]=
#define TARGET_LITTLE_SYM bfd_elf64_sh64lin_vec
#undef TARGET_LITTLE_NAME
#define TARGET_LITTLE_NAME "elf64-sh64-linux"
+#undef elf64_bed
+#define elf64_bed elf64_sh64_linux_bed
-#define INCLUDED_TARGET_FILE
#include "elf64-target.h"
diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c
index dd1c302174af..2adddd994463 100644
--- a/bfd/elf64-sparc.c
+++ b/bfd/elf64-sparc.c
@@ -1,6 +1,6 @@
/* SPARC-specific support for 64-bit ELF
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/sparc.h"
@@ -814,6 +814,7 @@ const struct elf_size_info elf64_sparc_size_info =
#define TARGET_BIG_NAME "elf64-sparc"
#define ELF_ARCH bfd_arch_sparc
#define ELF_MAXPAGESIZE 0x100000
+#define ELF_COMMONPAGESIZE 0x2000
/* This is the official ABI value. */
#define ELF_MACHINE_CODE EM_SPARCV9
@@ -858,6 +859,8 @@ const struct elf_size_info elf64_sparc_size_info =
_bfd_sparc_elf_copy_indirect_symbol
#define bfd_elf64_bfd_reloc_type_lookup \
_bfd_sparc_elf_reloc_type_lookup
+#define bfd_elf64_bfd_reloc_name_lookup \
+ _bfd_sparc_elf_reloc_name_lookup
#define bfd_elf64_bfd_relax_section \
_bfd_sparc_elf_relax_section
#define bfd_elf64_new_section_hook \
@@ -888,6 +891,8 @@ const struct elf_size_info elf64_sparc_size_info =
_bfd_sparc_elf_gc_mark_hook
#define elf_backend_gc_sweep_hook \
_bfd_sparc_elf_gc_sweep_hook
+#define elf_backend_init_index_section \
+ _bfd_elf_init_1_index_section
#define elf_backend_can_gc_sections 1
#define elf_backend_can_refcount 1
@@ -901,3 +906,19 @@ const struct elf_size_info elf64_sparc_size_info =
#define elf_backend_plt_alignment 8
#include "elf64-target.h"
+
+/* FreeBSD support */
+#undef TARGET_BIG_SYM
+#define TARGET_BIG_SYM bfd_elf64_sparc_freebsd_vec
+#undef TARGET_BIG_NAME
+#define TARGET_BIG_NAME "elf64-sparc-freebsd"
+#undef ELF_OSABI
+#define ELF_OSABI ELFOSABI_FREEBSD
+
+#undef elf_backend_post_process_headers
+#define elf_backend_post_process_headers _bfd_elf_set_osabi
+#undef elf64_bed
+#define elf64_bed elf64_sparc_fbsd_bed
+
+#include "elf64-target.h"
+
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 9befd69c5df6..0ee75ce9947a 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -1,5 +1,5 @@
/* X86-64 specific support for 64-bit ELF
- Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Contributed by Jan Hubicka <jh@suse.cz>.
@@ -19,8 +19,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -246,6 +246,23 @@ elf64_x86_64_reloc_type_lookup (bfd *abfd,
return 0;
}
+static reloc_howto_type *
+elf64_x86_64_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (x86_64_elf_howto_table)
+ / sizeof (x86_64_elf_howto_table[0]));
+ i++)
+ if (x86_64_elf_howto_table[i].name != NULL
+ && strcasecmp (x86_64_elf_howto_table[i].name, r_name) == 0)
+ return &x86_64_elf_howto_table[i];
+
+ return NULL;
+}
+
/* Given an x86_64 ELF reloc type, fill in an arelent structure. */
static void
@@ -350,7 +367,7 @@ static const bfd_byte elf64_x86_64_plt0_entry[PLT_ENTRY_SIZE] =
{
0xff, 0x35, 8, 0, 0, 0, /* pushq GOT+8(%rip) */
0xff, 0x25, 16, 0, 0, 0, /* jmpq *GOT+16(%rip) */
- 0x90, 0x90, 0x90, 0x90 /* pad out to 16 bytes with nops. */
+ 0x0f, 0x1f, 0x40, 0x00 /* nopl 0(%rax) */
};
/* Subsequent entries in a procedure linkage table look like this. */
@@ -676,11 +693,14 @@ elf64_x86_64_copy_indirect_symbol (struct bfd_link_info *info,
static bfd_boolean
elf64_x86_64_mkobject (bfd *abfd)
{
- bfd_size_type amt = sizeof (struct elf64_x86_64_obj_tdata);
- abfd->tdata.any = bfd_zalloc (abfd, amt);
if (abfd->tdata.any == NULL)
- return FALSE;
- return TRUE;
+ {
+ bfd_size_type amt = sizeof (struct elf64_x86_64_obj_tdata);
+ abfd->tdata.any = bfd_zalloc (abfd, amt);
+ if (abfd->tdata.any == NULL)
+ return FALSE;
+ }
+ return bfd_elf_mkobject (abfd);
}
static bfd_boolean
@@ -994,7 +1014,7 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
&& (r_type != R_X86_64_PC32)
&& (r_type != R_X86_64_PC64))
|| (h != NULL
- && (! info->symbolic
+ && (! SYMBOLIC_BIND (info, h)
|| h->root.type == bfd_link_hash_defweak
|| !h->def_regular))))
|| (ELIMINATE_COPY_RELOCS
@@ -1022,7 +1042,7 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
if (name == NULL)
return FALSE;
- if (strncmp (name, ".rela", 5) != 0
+ if (! CONST_STRNEQ (name, ".rela")
|| strcmp (bfd_get_section_name (abfd, sec),
name + 5) != 0)
{
@@ -1131,38 +1151,20 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
static asection *
elf64_x86_64_gc_mark_hook (asection *sec,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info,
Elf_Internal_Rela *rel,
struct elf_link_hash_entry *h,
Elf_Internal_Sym *sym)
{
if (h != NULL)
- {
- switch (ELF64_R_TYPE (rel->r_info))
- {
- case R_X86_64_GNU_VTINHERIT:
- case R_X86_64_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
-
- return NULL;
+ switch (ELF64_R_TYPE (rel->r_info))
+ {
+ case R_X86_64_GNU_VTINHERIT:
+ case R_X86_64_GNU_VTENTRY:
+ return NULL;
+ }
+
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
/* Update the got entry reference counts for the section being removed. */
@@ -1285,7 +1287,6 @@ elf64_x86_64_adjust_dynamic_symbol (struct bfd_link_info *info,
{
struct elf64_x86_64_link_hash_table *htab;
asection *s;
- unsigned int power_of_two;
/* If this is a function, put it in the procedure linkage table. We
will fill in the contents of the procedure linkage table later,
@@ -1403,32 +1404,9 @@ elf64_x86_64_adjust_dynamic_symbol (struct bfd_link_info *info,
h->needs_copy = 1;
}
- /* We need to figure out the alignment required for this symbol. I
- have no idea how ELF linkers handle this. 16-bytes is the size
- of the largest type that requires hard alignment -- long double. */
- /* FIXME: This is VERY ugly. Should be fixed for all architectures using
- this construct. */
- power_of_two = bfd_log2 (h->size);
- if (power_of_two > 4)
- power_of_two = 4;
-
- /* Apply the required alignment. */
s = htab->sdynbss;
- s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two));
- if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s))
- {
- if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two))
- return FALSE;
- }
-
- /* Define the symbol as being at this point in the section. */
- h->root.u.def.section = s;
- h->root.u.def.value = s->size;
-
- /* Increment the section size to make room for the symbol. */
- s->size += h->size;
- return TRUE;
+ return _bfd_elf_adjust_dynamic_copy (h, s);
}
/* Allocate space in .plt, .got and associated reloc sections for
@@ -1880,7 +1858,7 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
/* Strip this section if we don't need it; see the
comment below. */
}
- else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0)
+ else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela"))
{
if (s->size != 0 && s != htab->srelplt)
relocs = TRUE;
@@ -2077,9 +2055,6 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
- if (info->relocatable)
- return TRUE;
-
htab = elf64_x86_64_hash_table (info);
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
@@ -2135,6 +2110,21 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
h, sec, relocation,
unresolved_reloc, warned);
}
+
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
/* When generating a shared object, the relocations handled here are
copied into the output file to be resolved at run time. */
switch (r_type)
@@ -2382,11 +2372,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
/* FIXME: The ABI says the linker should make sure the value is
the same when it's zeroextended to 64 bit. */
- /* r_symndx will be zero only for relocs against symbols
- from removed linkonce sections, or sections discarded by
- a linker script. */
- if (r_symndx == 0
- || (input_section->flags & SEC_ALLOC) == 0)
+ if ((input_section->flags & SEC_ALLOC) == 0)
break;
if ((info->shared
@@ -2442,7 +2428,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|| r_type == R_X86_64_PC32
|| r_type == R_X86_64_PC64
|| !info->shared
- || !info->symbolic
+ || !SYMBOLIC_BIND (info, h)
|| !h->def_regular))
{
outrel.r_info = ELF64_R_INFO (h->dynindx, r_type);
@@ -2472,9 +2458,19 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
{
asection *osec;
+ /* We are turning this relocation into one
+ against a section symbol. It would be
+ proper to subtract the symbol's value,
+ osec->vma, from the emitted reloc addend,
+ but ld.so expects buggy relocs. */
osec = sec->output_section;
sindx = elf_section_data (osec)->dynindx;
- BFD_ASSERT (sindx > 0);
+ if (sindx == 0)
+ {
+ asection *oi = htab->elf.text_index_section;
+ sindx = elf_section_data (oi)->dynindx;
+ }
+ BFD_ASSERT (sindx != 0);
}
outrel.r_info = ELF64_R_INFO (sindx, r_type);
@@ -2614,8 +2610,9 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
val = bfd_get_8 (input_bfd, contents + roff + 1);
BFD_ASSERT (val == 0x10);
- /* Now modify the instruction as appropriate. */
- bfd_put_8 (output_bfd, 0x90, contents + roff);
+ /* Now modify the instruction as appropriate. Use
+ xchg %ax,%ax instead of 2 nops. */
+ bfd_put_8 (output_bfd, 0x66, contents + roff);
bfd_put_8 (output_bfd, 0x90, contents + roff + 1);
continue;
}
@@ -2907,8 +2904,9 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
val = bfd_get_8 (input_bfd, contents + roff + 1);
BFD_ASSERT (val == 0x10);
- /* Now modify the instruction as appropriate. */
- bfd_put_8 (output_bfd, 0x90, contents + roff);
+ /* Now modify the instruction as appropriate. Use
+ xchg %ax,%ax instead of 2 nops. */
+ bfd_put_8 (output_bfd, 0x66, contents + roff);
bfd_put_8 (output_bfd, 0x90, contents + roff + 1);
continue;
@@ -3030,12 +3028,6 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
if (r == bfd_reloc_overflow)
{
- if (h != NULL
- && h->root.type == bfd_link_hash_undefweak
- && howto->pc_relative)
- /* Ignore reloc overflow on branches to undefweak syms. */
- continue;
-
if (! ((*info->callbacks->reloc_overflow)
(info, (h ? &h->root : NULL), name, howto->name,
(bfd_vma) 0, input_bfd, input_section,
@@ -3594,7 +3586,8 @@ elf64_x86_64_merge_symbol (struct bfd_link_info *info ATTRIBUTE_UNUSED,
}
static int
-elf64_x86_64_additional_program_headers (bfd *abfd)
+elf64_x86_64_additional_program_headers (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
asection *s;
int count = 0;
@@ -3614,23 +3607,38 @@ elf64_x86_64_additional_program_headers (bfd *abfd)
return count;
}
+/* Return TRUE if symbol should be hashed in the `.gnu.hash' section. */
+
+static bfd_boolean
+elf64_x86_64_hash_symbol (struct elf_link_hash_entry *h)
+{
+ if (h->plt.offset != (bfd_vma) -1
+ && !h->def_regular
+ && !h->pointer_equality_needed)
+ return FALSE;
+
+ return _bfd_elf_hash_symbol (h);
+}
+
static const struct bfd_elf_special_section
elf64_x86_64_special_sections[]=
{
- { ".gnu.linkonce.lb", 16, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_X86_64_LARGE},
- { ".gnu.linkonce.lr", 16, -2, SHT_PROGBITS, SHF_ALLOC + SHF_X86_64_LARGE},
- { ".gnu.linkonce.lt", 16, -2, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR + SHF_X86_64_LARGE},
- { ".lbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_X86_64_LARGE},
- { ".ldata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_X86_64_LARGE},
- { ".lrodata", 8, -2, SHT_PROGBITS, SHF_ALLOC + SHF_X86_64_LARGE},
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".gnu.linkonce.lb"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_X86_64_LARGE},
+ { STRING_COMMA_LEN (".gnu.linkonce.lr"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_X86_64_LARGE},
+ { STRING_COMMA_LEN (".gnu.linkonce.lt"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR + SHF_X86_64_LARGE},
+ { STRING_COMMA_LEN (".lbss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_X86_64_LARGE},
+ { STRING_COMMA_LEN (".ldata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_X86_64_LARGE},
+ { STRING_COMMA_LEN (".lrodata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_X86_64_LARGE},
+ { NULL, 0, 0, 0, 0 }
};
#define TARGET_LITTLE_SYM bfd_elf64_x86_64_vec
#define TARGET_LITTLE_NAME "elf64-x86-64"
#define ELF_ARCH bfd_arch_i386
#define ELF_MACHINE_CODE EM_X86_64
-#define ELF_MAXPAGESIZE 0x100000
+#define ELF_MAXPAGESIZE 0x200000
+#define ELF_MINPAGESIZE 0x1000
+#define ELF_COMMONPAGESIZE 0x1000
#define elf_backend_can_gc_sections 1
#define elf_backend_can_refcount 1
@@ -3645,6 +3653,8 @@ static const struct bfd_elf_special_section
#define bfd_elf64_bfd_link_hash_table_create \
elf64_x86_64_link_hash_table_create
#define bfd_elf64_bfd_reloc_type_lookup elf64_x86_64_reloc_type_lookup
+#define bfd_elf64_bfd_reloc_name_lookup \
+ elf64_x86_64_reloc_name_lookup
#define elf_backend_adjust_dynamic_symbol elf64_x86_64_adjust_dynamic_symbol
#define elf_backend_check_relocs elf64_x86_64_check_relocs
@@ -3660,6 +3670,7 @@ static const struct bfd_elf_special_section
#define elf_backend_relocate_section elf64_x86_64_relocate_section
#define elf_backend_size_dynamic_sections elf64_x86_64_size_dynamic_sections
#define elf_backend_always_size_sections elf64_x86_64_always_size_sections
+#define elf_backend_init_index_section _bfd_elf_init_1_index_section
#define elf_backend_plt_sym_val elf64_x86_64_plt_sym_val
#define elf_backend_object_p elf64_x86_64_elf_object_p
#define bfd_elf64_mkobject elf64_x86_64_mkobject
@@ -3685,5 +3696,25 @@ static const struct bfd_elf_special_section
elf64_x86_64_special_sections
#define elf_backend_additional_program_headers \
elf64_x86_64_additional_program_headers
+#define elf_backend_hash_symbol \
+ elf64_x86_64_hash_symbol
+
+#include "elf64-target.h"
+
+/* FreeBSD support. */
+
+#undef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM bfd_elf64_x86_64_freebsd_vec
+#undef TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME "elf64-x86-64-freebsd"
+
+#undef ELF_OSABI
+#define ELF_OSABI ELFOSABI_FREEBSD
+
+#undef elf_backend_post_process_headers
+#define elf_backend_post_process_headers _bfd_elf_set_osabi
+
+#undef elf64_bed
+#define elf64_bed elf64_x86_64_fbsd_bed
#include "elf64-target.h"
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index 1f8ec2b2b2cb..191e124d770e 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -1,6 +1,7 @@
/* ELF executable support for BFD.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ Free Software Foundation, Inc.
Written by Fred Fish @ Cygnus Support, from information published
in "UNIX System V Release 4, Programmers Guide: ANSI C and
@@ -64,8 +65,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
it's cast in stone.
*/
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libiberty.h"
#include "bfdlink.h"
#include "libbfd.h"
@@ -139,10 +140,11 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
#define LOG_FILE_ALIGN 2
#endif
-#ifdef DEBUG
+#if DEBUG & 2
static void elf_debug_section (int, Elf_Internal_Shdr *);
+#endif
+#if DEBUG & 1
static void elf_debug_file (Elf_Internal_Ehdr *);
-static char *elf_symbol_flags (flagword);
#endif
/* Structure swapping routines */
@@ -165,7 +167,7 @@ static char *elf_symbol_flags (flagword);
/* Translate an ELF symbol in external format into an ELF symbol in internal
format. */
-void
+bfd_boolean
elf_swap_symbol_in (bfd *abfd,
const void *psrc,
const void *pshn,
@@ -187,9 +189,10 @@ elf_swap_symbol_in (bfd *abfd,
if (dst->st_shndx == SHN_XINDEX)
{
if (shndx == NULL)
- abort ();
+ return FALSE;
dst->st_shndx = H_GET_32 (abfd, shndx->est_shndx);
}
+ return TRUE;
}
/* Translate an ELF symbol in internal format into an ELF symbol in external
@@ -498,6 +501,8 @@ elf_object_p (bfd *abfd)
struct bfd_preserve preserve;
asection *s;
bfd_size_type amt;
+ const bfd_target *target;
+ const bfd_target * const *target_ptr;
preserve.marker = NULL;
@@ -541,10 +546,12 @@ elf_object_p (bfd *abfd)
if (!bfd_preserve_save (abfd, &preserve))
goto got_no_match;
+ target = abfd->xvec;
+
/* Allocate an instance of the elf_obj_tdata structure and hook it up to
the tdata pointer in the bfd. */
- if (! (*abfd->xvec->_bfd_set_format[bfd_object]) (abfd))
+ if (! (*target->_bfd_set_format[bfd_object]) (abfd))
goto got_no_match;
preserve.marker = elf_tdata (abfd);
@@ -584,8 +591,6 @@ elf_object_p (bfd *abfd)
&& (ebd->elf_machine_alt2 == 0
|| i_ehdrp->e_machine != ebd->elf_machine_alt2))
{
- const bfd_target * const *target_ptr;
-
if (ebd->elf_machine_code != EM_NONE)
goto got_wrong_format_error;
@@ -626,6 +631,45 @@ elf_object_p (bfd *abfd)
goto got_no_match;
}
+ if (ebd->elf_machine_code != EM_NONE
+ && i_ehdrp->e_ident[EI_OSABI] != ebd->elf_osabi)
+ {
+ if (ebd->elf_osabi != ELFOSABI_NONE)
+ goto got_wrong_format_error;
+
+ /* This is an ELFOSABI_NONE ELF target. Let it match any ELF
+ target of the compatible machine for which we do not have a
+ backend with matching ELFOSABI. */
+ for (target_ptr = bfd_target_vector;
+ *target_ptr != NULL;
+ target_ptr++)
+ {
+ const struct elf_backend_data *back;
+
+ /* Skip this target and targets with incompatible byte
+ order. */
+ if (*target_ptr == target
+ || (*target_ptr)->flavour != bfd_target_elf_flavour
+ || (*target_ptr)->byteorder != target->byteorder
+ || ((*target_ptr)->header_byteorder
+ != target->header_byteorder))
+ continue;
+
+ back = (const struct elf_backend_data *) (*target_ptr)->backend_data;
+ if (back->elf_osabi == i_ehdrp->e_ident[EI_OSABI]
+ && (back->elf_machine_code == i_ehdrp->e_machine
+ || (back->elf_machine_alt1 != 0
+ && back->elf_machine_alt1 == i_ehdrp->e_machine)
+ || (back->elf_machine_alt2 != 0
+ && back->elf_machine_alt2 == i_ehdrp->e_machine)))
+ {
+ /* target_ptr is an ELF backend which matches this
+ object file, so reject the ELFOSABI_NONE ELF target. */
+ goto got_wrong_format_error;
+ }
+ }
+ }
+
if (i_ehdrp->e_shoff != 0)
{
bfd_signed_vma where = i_ehdrp->e_shoff;
@@ -846,7 +890,7 @@ elf_object_p (bfd *abfd)
}
bfd_preserve_finish (abfd, &preserve);
- return abfd->xvec;
+ return target;
got_wrong_format_error:
/* There is way too much undoing of half-known state here. The caller,
@@ -1235,6 +1279,12 @@ elf_slurp_symbol_table (bfd *abfd, asymbol **symptrs, bfd_boolean dynamic)
case STT_TLS:
sym->symbol.flags |= BSF_THREAD_LOCAL;
break;
+ case STT_RELC:
+ sym->symbol.flags |= BSF_RELC;
+ break;
+ case STT_SRELC:
+ sym->symbol.flags |= BSF_SRELC;
+ break;
}
if (dynamic)
@@ -1462,7 +1512,7 @@ elf_slurp_reloc_table (bfd *abfd,
return TRUE;
}
-#ifdef DEBUG
+#if DEBUG & 2
static void
elf_debug_section (int num, Elf_Internal_Shdr *hdr)
{
@@ -1488,7 +1538,9 @@ elf_debug_section (int num, Elf_Internal_Shdr *hdr)
(long) hdr->sh_entsize);
fflush (stderr);
}
+#endif
+#if DEBUG & 1
static void
elf_debug_file (Elf_Internal_Ehdr *ehdrp)
{
@@ -1500,77 +1552,6 @@ elf_debug_file (Elf_Internal_Ehdr *ehdrp)
fprintf (stderr, "e_shnum = %ld\n", (long) ehdrp->e_shnum);
fprintf (stderr, "e_shentsize = %ld\n", (long) ehdrp->e_shentsize);
}
-
-static char *
-elf_symbol_flags (flagword flags)
-{
- static char buffer[1024];
-
- buffer[0] = '\0';
- if (flags & BSF_LOCAL)
- strcat (buffer, " local");
-
- if (flags & BSF_GLOBAL)
- strcat (buffer, " global");
-
- if (flags & BSF_DEBUGGING)
- strcat (buffer, " debug");
-
- if (flags & BSF_FUNCTION)
- strcat (buffer, " function");
-
- if (flags & BSF_KEEP)
- strcat (buffer, " keep");
-
- if (flags & BSF_KEEP_G)
- strcat (buffer, " keep_g");
-
- if (flags & BSF_WEAK)
- strcat (buffer, " weak");
-
- if (flags & BSF_SECTION_SYM)
- strcat (buffer, " section-sym");
-
- if (flags & BSF_OLD_COMMON)
- strcat (buffer, " old-common");
-
- if (flags & BSF_NOT_AT_END)
- strcat (buffer, " not-at-end");
-
- if (flags & BSF_CONSTRUCTOR)
- strcat (buffer, " constructor");
-
- if (flags & BSF_WARNING)
- strcat (buffer, " warning");
-
- if (flags & BSF_INDIRECT)
- strcat (buffer, " indirect");
-
- if (flags & BSF_FILE)
- strcat (buffer, " file");
-
- if (flags & DYNAMIC)
- strcat (buffer, " dynamic");
-
- if (flags & ~(BSF_LOCAL
- | BSF_GLOBAL
- | BSF_DEBUGGING
- | BSF_FUNCTION
- | BSF_KEEP
- | BSF_KEEP_G
- | BSF_WEAK
- | BSF_SECTION_SYM
- | BSF_OLD_COMMON
- | BSF_NOT_AT_END
- | BSF_CONSTRUCTOR
- | BSF_WARNING
- | BSF_INDIRECT
- | BSF_FILE
- | BSF_DYNAMIC))
- strcat (buffer, " unknown-bits");
-
- return buffer;
-}
#endif
/* Create a new BFD as if by bfd_openr. Rather than opening a file,
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 59d9c3f1389a..9f0efa5b4b7f 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -1,6 +1,6 @@
/* ELF linking support for BFD.
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006 Free Software Foundation, Inc.
+ 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#define ARCH_SIZE 0
@@ -185,16 +185,6 @@ _bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
return FALSE;
}
- if (! info->traditional_format)
- {
- s = bfd_make_section_with_flags (abfd, ".eh_frame_hdr",
- flags | SEC_READONLY);
- if (s == NULL
- || ! bfd_set_section_alignment (abfd, s, 2))
- return FALSE;
- elf_hash_table (info)->eh_info.hdr_sec = s;
- }
-
/* Create sections to hold version informations. These are removed
if they are not needed. */
s = bfd_make_section_with_flags (abfd, ".gnu.version_d",
@@ -240,12 +230,30 @@ _bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
if (!_bfd_elf_define_linkage_sym (abfd, info, s, "_DYNAMIC"))
return FALSE;
- s = bfd_make_section_with_flags (abfd, ".hash",
- flags | SEC_READONLY);
- if (s == NULL
- || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
- return FALSE;
- elf_section_data (s)->this_hdr.sh_entsize = bed->s->sizeof_hash_entry;
+ if (info->emit_hash)
+ {
+ s = bfd_make_section_with_flags (abfd, ".hash", flags | SEC_READONLY);
+ if (s == NULL
+ || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
+ return FALSE;
+ elf_section_data (s)->this_hdr.sh_entsize = bed->s->sizeof_hash_entry;
+ }
+
+ if (info->emit_gnu_hash)
+ {
+ s = bfd_make_section_with_flags (abfd, ".gnu.hash",
+ flags | SEC_READONLY);
+ if (s == NULL
+ || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
+ return FALSE;
+ /* For 64-bit ELF, .gnu.hash is a non-uniform entity size section:
+ 4 32-bit words followed by variable count of 64-bit words, then
+ variable count of 32-bit words. */
+ if (bed->s->arch_size == 64)
+ elf_section_data (s)->this_hdr.sh_entsize = 0;
+ else
+ elf_section_data (s)->this_hdr.sh_entsize = 4;
+ }
/* Let the backend create the rest of the sections. This lets the
backend set the right flags. The backend will normally create
@@ -426,6 +434,29 @@ bfd_elf_link_record_dynamic_symbol (struct bfd_link_info *info,
return TRUE;
}
+/* Mark a symbol dynamic. */
+
+void
+bfd_elf_link_mark_dynamic_symbol (struct bfd_link_info *info,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
+{
+ struct bfd_elf_dynamic_list *d = info->dynamic_list;
+
+ /* It may be called more than once on the same H. */
+ if(h->dynamic || info->relocatable)
+ return;
+
+ if ((info->dynamic_data
+ && (h->type == STT_OBJECT
+ || (sym != NULL
+ && ELF_ST_TYPE (sym->st_info) == STT_OBJECT)))
+ || (d != NULL
+ && h->root.type == bfd_link_hash_new
+ && (*d->match) (&d->head, NULL, h->root.root.string)))
+ h->dynamic = 1;
+}
+
/* Record an assignment to a symbol made by a linker script. We need
this in case some dynamic object refers to this symbol. */
@@ -459,7 +490,10 @@ bfd_elf_record_link_assignment (bfd *output_bfd,
}
if (h->root.type == bfd_link_hash_new)
- h->non_elf = 0;
+ {
+ bfd_elf_link_mark_dynamic_symbol (info, h, NULL);
+ h->non_elf = 0;
+ }
/* If this symbol is being provided by the linker script, and it is
currently defined by a dynamic object, but not by a regular
@@ -676,6 +710,8 @@ _bfd_elf_link_omit_section_dynsym (bfd *output_bfd ATTRIBUTE_UNUSED,
struct bfd_link_info *info,
asection *p)
{
+ struct elf_link_hash_table *htab;
+
switch (elf_section_data (p)->this_hdr.sh_type)
{
case SHT_PROGBITS:
@@ -683,15 +719,21 @@ _bfd_elf_link_omit_section_dynsym (bfd *output_bfd ATTRIBUTE_UNUSED,
/* If sh_type is yet undecided, assume it could be
SHT_PROGBITS/SHT_NOBITS. */
case SHT_NULL:
+ htab = elf_hash_table (info);
+ if (p == htab->tls_sec)
+ return FALSE;
+
+ if (htab->text_index_section != NULL)
+ return p != htab->text_index_section && p != htab->data_index_section;
+
if (strcmp (p->name, ".got") == 0
|| strcmp (p->name, ".got.plt") == 0
|| strcmp (p->name, ".plt") == 0)
{
asection *ip;
- bfd *dynobj = elf_hash_table (info)->dynobj;
- if (dynobj != NULL
- && (ip = bfd_get_section_by_name (dynobj, p->name)) != NULL
+ if (htab->dynobj != NULL
+ && (ip = bfd_get_section_by_name (htab->dynobj, p->name)) != NULL
&& (ip->flags & SEC_LINKER_CREATED)
&& ip->output_section == p)
return TRUE;
@@ -727,6 +769,8 @@ _bfd_elf_link_renumber_dynsyms (bfd *output_bfd,
&& (p->flags & SEC_ALLOC) != 0
&& !(*bed->elf_backend_omit_section_dynsym) (output_bfd, info, p))
elf_section_data (p)->dynindx = ++dynsymcount;
+ else
+ elf_section_data (p)->dynindx = 0;
}
*section_sym_count = dynsymcount;
@@ -796,6 +840,15 @@ _bfd_elf_merge_symbol (bfd *abfd,
sec = *psec;
bind = ELF_ST_BIND (sym->st_info);
+ /* Silently discard TLS symbols from --just-syms. There's no way to
+ combine a static TLS block with a new TLS block for this executable. */
+ if (ELF_ST_TYPE (sym->st_info) == STT_TLS
+ && sec->sec_info_type == ELF_INFO_TYPE_JUST_SYMS)
+ {
+ *skip = TRUE;
+ return TRUE;
+ }
+
if (! bfd_is_und_section (sec))
h = elf_link_hash_lookup (elf_hash_table (info), name, TRUE, FALSE, FALSE);
else
@@ -816,6 +869,11 @@ _bfd_elf_merge_symbol (bfd *abfd,
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ /* We have to check it for every instance since the first few may be
+ refereences and not all compilers emit symbol type for undefined
+ symbols. */
+ bfd_elf_link_mark_dynamic_symbol (info, h, sym);
+
/* If we just created the symbol, mark it as being an ELF symbol.
Other than that, there is nothing to do--there is no merge issue
with a newly defined symbol--so we just return. */
@@ -889,6 +947,7 @@ _bfd_elf_merge_symbol (bfd *abfd,
&& h->root.type != bfd_link_hash_undefweak
&& h->root.type != bfd_link_hash_common);
+ bed = get_elf_backend_data (abfd);
/* When we try to create a default indirect symbol from the dynamic
definition with the default version, we skip it if its type and
the type of existing regular definition mismatch. We only do it
@@ -903,7 +962,9 @@ _bfd_elf_merge_symbol (bfd *abfd,
&& (olddef || h->root.type == bfd_link_hash_common)
&& ELF_ST_TYPE (sym->st_info) != h->type
&& ELF_ST_TYPE (sym->st_info) != STT_NOTYPE
- && h->type != STT_NOTYPE)
+ && h->type != STT_NOTYPE
+ && !(bed->is_function_type (ELF_ST_TYPE (sym->st_info))
+ && bed->is_function_type (h->type)))
{
*skip = TRUE;
return TRUE;
@@ -1007,7 +1068,41 @@ _bfd_elf_merge_symbol (bfd *abfd,
relocatable file and the old definition comes from a dynamic
object, we remove the old definition. */
if ((*sym_hash)->root.type == bfd_link_hash_indirect)
- h = *sym_hash;
+ {
+ /* Handle the case where the old dynamic definition is
+ default versioned. We need to copy the symbol info from
+ the symbol with default version to the normal one if it
+ was referenced before. */
+ if (h->ref_regular)
+ {
+ const struct elf_backend_data *bed
+ = get_elf_backend_data (abfd);
+ struct elf_link_hash_entry *vh = *sym_hash;
+ vh->root.type = h->root.type;
+ h->root.type = bfd_link_hash_indirect;
+ (*bed->elf_backend_copy_indirect_symbol) (info, vh, h);
+ /* Protected symbols will override the dynamic definition
+ with default version. */
+ if (ELF_ST_VISIBILITY (sym->st_other) == STV_PROTECTED)
+ {
+ h->root.u.i.link = (struct bfd_link_hash_entry *) vh;
+ vh->dynamic_def = 1;
+ vh->ref_dynamic = 1;
+ }
+ else
+ {
+ h->root.type = vh->root.type;
+ vh->ref_dynamic = 0;
+ /* We have to hide it here since it was made dynamic
+ global with extra bits when the symbol info was
+ copied from the old dynamic definition. */
+ (*bed->elf_backend_hide_symbol) (info, vh, TRUE);
+ }
+ h = vh;
+ }
+ else
+ h = *sym_hash;
+ }
if ((h->root.u.undef.next || info->hash->undefs_tail == &h->root)
&& bfd_is_und_section (sec))
@@ -1060,6 +1155,11 @@ _bfd_elf_merge_symbol (bfd *abfd,
if (olddef && newdyn)
oldweak = FALSE;
+ /* Allow changes between different types of funciton symbol. */
+ if (bed->is_function_type (ELF_ST_TYPE (sym->st_info))
+ && bed->is_function_type (h->type))
+ *type_change_ok = TRUE;
+
/* It's OK to change the type if either the existing symbol or the
new symbol is weak. A type change is also OK if the old symbol
is undefined and the new symbol is defined. */
@@ -1106,7 +1206,7 @@ _bfd_elf_merge_symbol (bfd *abfd,
&& (sec->flags & SEC_ALLOC) != 0
&& (sec->flags & SEC_LOAD) == 0
&& sym->st_size > 0
- && ELF_ST_TYPE (sym->st_info) != STT_FUNC)
+ && !bed->is_function_type (ELF_ST_TYPE (sym->st_info)))
newdyncommon = TRUE;
else
newdyncommon = FALSE;
@@ -1118,14 +1218,13 @@ _bfd_elf_merge_symbol (bfd *abfd,
&& (h->root.u.def.section->flags & SEC_ALLOC) != 0
&& (h->root.u.def.section->flags & SEC_LOAD) == 0
&& h->size > 0
- && h->type != STT_FUNC)
+ && !bed->is_function_type (h->type))
olddyncommon = TRUE;
else
olddyncommon = FALSE;
/* We now know everything about the old and new symbols. We ask the
backend to check if we can merge them. */
- bed = get_elf_backend_data (abfd);
if (bed->merge_symbol
&& !bed->merge_symbol (info, sym_hash, h, sym, psec, pvalue,
pold_alignment, skip, override,
@@ -1180,7 +1279,7 @@ _bfd_elf_merge_symbol (bfd *abfd,
&& (olddef
|| (h->root.type == bfd_link_hash_common
&& (newweak
- || ELF_ST_TYPE (sym->st_info) == STT_FUNC))))
+ || bed->is_function_type (ELF_ST_TYPE (sym->st_info))))))
{
*override = TRUE;
newdef = FALSE;
@@ -1235,7 +1334,7 @@ _bfd_elf_merge_symbol (bfd *abfd,
&& (newdef
|| (bfd_is_com_section (sec)
&& (oldweak
- || h->type == STT_FUNC)))
+ || bed->is_function_type (h->type))))
&& olddyn
&& olddef
&& h->def_dynamic)
@@ -1464,6 +1563,10 @@ _bfd_elf_add_default_symbol (bfd *abfd,
hi = h;
}
+ /* Check if HI is a warning symbol. */
+ if (hi->root.type == bfd_link_hash_warning)
+ hi = (struct elf_link_hash_entry *) hi->root.u.i.link;
+
/* If there is a duplicate definition somewhere, then HI may not
point to an indirect symbol. We will have reported an error to
the user in that case. */
@@ -1574,6 +1677,10 @@ _bfd_elf_export_symbol (struct elf_link_hash_entry *h, void *data)
{
struct elf_info_failed *eif = data;
+ /* Ignore this if we won't export it. */
+ if (!eif->info->export_dynamic && !h->dynamic)
+ return TRUE;
+
/* Ignore indirect symbols. These are added by the versioning code. */
if (h->root.type == bfd_link_hash_indirect)
return TRUE;
@@ -1840,7 +1947,7 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data)
/* We could not find the version for a symbol when
generating a shared archive. Return an error. */
(*_bfd_error_handler)
- (_("%B: undefined versioned symbol name %s"),
+ (_("%B: version node not found for symbol %s"),
sinfo->output_bfd, h->root.root.string);
bfd_set_error (bfd_error_bad_value);
sinfo->failed = TRUE;
@@ -2327,7 +2434,7 @@ _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h,
if (h->needs_plt
&& eif->info->shared
&& is_elf_hash_table (eif->info->hash)
- && (eif->info->symbolic
+ && (SYMBOLIC_BIND (eif->info, h)
|| ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
&& h->def_regular)
{
@@ -2502,6 +2609,52 @@ _bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *h, void *data)
return TRUE;
}
+/* Adjust the dynamic symbol, H, for copy in the dynamic bss section,
+ DYNBSS. */
+
+bfd_boolean
+_bfd_elf_adjust_dynamic_copy (struct elf_link_hash_entry *h,
+ asection *dynbss)
+{
+ unsigned int power_of_two;
+ bfd_vma mask;
+ asection *sec = h->root.u.def.section;
+
+ /* The section aligment of definition is the maximum alignment
+ requirement of symbols defined in the section. Since we don't
+ know the symbol alignment requirement, we start with the
+ maximum alignment and check low bits of the symbol address
+ for the minimum alignment. */
+ power_of_two = bfd_get_section_alignment (sec->owner, sec);
+ mask = ((bfd_vma) 1 << power_of_two) - 1;
+ while ((h->root.u.def.value & mask) != 0)
+ {
+ mask >>= 1;
+ --power_of_two;
+ }
+
+ if (power_of_two > bfd_get_section_alignment (dynbss->owner,
+ dynbss))
+ {
+ /* Adjust the section alignment if needed. */
+ if (! bfd_set_section_alignment (dynbss->owner, dynbss,
+ power_of_two))
+ return FALSE;
+ }
+
+ /* We make sure that the symbol will be aligned properly. */
+ dynbss->size = BFD_ALIGN (dynbss->size, mask + 1);
+
+ /* Define the symbol as being at this point in DYNBSS. */
+ h->root.u.def.section = dynbss;
+ h->root.u.def.value = dynbss->size;
+
+ /* Increment the size of DYNBSS to make room for the symbol. */
+ dynbss->size += h->size;
+
+ return TRUE;
+}
+
/* Adjust all external symbols pointing into SEC_MERGE sections
to reflect the object merging within the sections. */
@@ -2540,6 +2693,8 @@ _bfd_elf_dynamic_symbol_p (struct elf_link_hash_entry *h,
bfd_boolean ignore_protected)
{
bfd_boolean binding_stays_local_p;
+ const struct elf_backend_data *bed;
+ struct elf_link_hash_table *hash_table;
if (h == NULL)
return FALSE;
@@ -2556,7 +2711,7 @@ _bfd_elf_dynamic_symbol_p (struct elf_link_hash_entry *h,
/* Identify the cases where name binding rules say that a
visible symbol resolves locally. */
- binding_stays_local_p = info->executable || info->symbolic;
+ binding_stays_local_p = info->executable || SYMBOLIC_BIND (info, h);
switch (ELF_ST_VISIBILITY (h->other))
{
@@ -2565,10 +2720,16 @@ _bfd_elf_dynamic_symbol_p (struct elf_link_hash_entry *h,
return FALSE;
case STV_PROTECTED:
+ hash_table = elf_hash_table (info);
+ if (!is_elf_hash_table (hash_table))
+ return FALSE;
+
+ bed = get_elf_backend_data (hash_table->dynobj);
+
/* Proper resolution for function pointer equality may require
that these symbols perhaps be resolved dynamically, even though
we should be resolving them to the current module. */
- if (!ignore_protected || h->type != STT_FUNC)
+ if (!ignore_protected || !bed->is_function_type (h->type))
binding_stays_local_p = TRUE;
break;
@@ -2595,6 +2756,9 @@ _bfd_elf_symbol_refs_local_p (struct elf_link_hash_entry *h,
struct bfd_link_info *info,
bfd_boolean local_protected)
{
+ const struct elf_backend_data *bed;
+ struct elf_link_hash_table *hash_table;
+
/* If it's a local sym, of course we resolve locally. */
if (h == NULL)
return TRUE;
@@ -2619,7 +2783,7 @@ _bfd_elf_symbol_refs_local_p (struct elf_link_hash_entry *h,
/* At this point, we know the symbol is defined and dynamic. In an
executable it must resolve locally, likewise when building symbolic
shared libraries. */
- if (info->executable || info->symbolic)
+ if (info->executable || SYMBOLIC_BIND (info, h))
return TRUE;
/* Now deal with defined dynamic symbols in shared libraries. Ones
@@ -2631,8 +2795,14 @@ _bfd_elf_symbol_refs_local_p (struct elf_link_hash_entry *h,
if (ELF_ST_VISIBILITY (h->other) != STV_PROTECTED)
return TRUE;
+ hash_table = elf_hash_table (info);
+ if (!is_elf_hash_table (hash_table))
+ return TRUE;
+
+ bed = get_elf_backend_data (hash_table->dynobj);
+
/* STV_PROTECTED non-function symbols are local. */
- if (h->type != STT_FUNC)
+ if (!bed->is_function_type (h->type))
return TRUE;
/* Function pointer equality tests may require that STV_PROTECTED
@@ -2681,8 +2851,9 @@ is_global_data_symbol_definition (bfd *abfd ATTRIBUTE_UNUSED,
&& ELF_ST_BIND (sym->st_info) < STB_LOOS)
return FALSE;
+ bed = get_elf_backend_data (abfd);
/* Function symbols do not count. */
- if (ELF_ST_TYPE (sym->st_info) == STT_FUNC)
+ if (bed->is_function_type (ELF_ST_TYPE (sym->st_info)))
return FALSE;
/* If the section is undefined, then so is the symbol. */
@@ -2691,7 +2862,6 @@ is_global_data_symbol_definition (bfd *abfd ATTRIBUTE_UNUSED,
/* If the symbol is defined in the common section, then
it is a common definition and so does not count. */
- bed = get_elf_backend_data (abfd);
if (bed->common_definition (sym))
return FALSE;
@@ -3080,6 +3250,9 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
struct elf_link_hash_table *htab;
bfd_size_type amt;
void *alloc_mark = NULL;
+ struct bfd_hash_entry **old_table = NULL;
+ unsigned int old_size = 0;
+ unsigned int old_count = 0;
void *old_tab = NULL;
void *old_hash;
void *old_ent;
@@ -3126,7 +3299,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
const char *name;
name = bfd_get_section_name (abfd, s);
- if (strncmp (name, ".gnu.warning.", sizeof ".gnu.warning." - 1) == 0)
+ if (CONST_STRNEQ (name, ".gnu.warning."))
{
char *msg;
bfd_size_type sz;
@@ -3511,6 +3684,9 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
memcpy (old_hash, sym_hash, hashsize);
old_undefs = htab->root.undefs;
old_undefs_tail = htab->root.undefs_tail;
+ old_table = htab->root.table.table;
+ old_size = htab->root.table.size;
+ old_count = htab->root.table.count;
old_dynsymcount = htab->dynsymcount;
for (i = 0; i < htab->root.table.size; i++)
@@ -3592,12 +3768,10 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
sec = bfd_abs_section_ptr;
else if (sec->kept_section)
{
- /* Symbols from discarded section are undefined, and have
- default visibility. */
+ /* Symbols from discarded section are undefined. We keep
+ its visibility. */
sec = bfd_und_section_ptr;
isym->st_shndx = SHN_UNDEF;
- isym->st_other = (STV_DEFAULT
- | (isym->st_other & ~ ELF_ST_VISIBILITY (-1)));
}
else if ((abfd->flags & (EXEC_P | DYNAMIC)) != 0)
value -= sec->vma;
@@ -3622,7 +3796,8 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
goto error_free_vers;
if (isym->st_shndx == SHN_COMMON
- && ELF_ST_TYPE (isym->st_info) == STT_TLS)
+ && ELF_ST_TYPE (isym->st_info) == STT_TLS
+ && !info->relocatable)
{
asection *tcomm = bfd_get_section_by_name (abfd, ".tcommon");
@@ -3694,8 +3869,9 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
if it is not a function, because it might be the version
symbol itself. FIXME: What if it isn't? */
if ((iver.vs_vers & VERSYM_HIDDEN) != 0
- || (vernum > 1 && (! bfd_is_abs_section (sec)
- || ELF_ST_TYPE (isym->st_info) == STT_FUNC)))
+ || (vernum > 1
+ && (!bfd_is_abs_section (sec)
+ || bed->is_function_type (ELF_ST_TYPE (isym->st_info)))))
{
const char *verstr;
size_t namelen, verlen, newlen;
@@ -3842,7 +4018,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
if (dynamic
&& definition
&& (flags & BSF_WEAK) != 0
- && ELF_ST_TYPE (isym->st_info) != STT_FUNC
+ && !bed->is_function_type (ELF_ST_TYPE (isym->st_info))
&& is_elf_hash_table (htab)
&& h->u.weakdef == NULL)
{
@@ -3929,18 +4105,30 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
}
if (normal_align < common_align)
- (*_bfd_error_handler)
- (_("Warning: alignment %u of symbol `%s' in %B"
- " is smaller than %u in %B"),
- normal_bfd, common_bfd,
- 1 << normal_align, name, 1 << common_align);
+ {
+ /* PR binutils/2735 */
+ if (normal_bfd == NULL)
+ (*_bfd_error_handler)
+ (_("Warning: alignment %u of common symbol `%s' in %B"
+ " is greater than the alignment (%u) of its section %A"),
+ common_bfd, h->root.u.def.section,
+ 1 << common_align, name, 1 << normal_align);
+ else
+ (*_bfd_error_handler)
+ (_("Warning: alignment %u of symbol `%s' in %B"
+ " is smaller than %u in %B"),
+ normal_bfd, common_bfd,
+ 1 << normal_align, name, 1 << common_align);
+ }
}
- /* Remember the symbol size and type. */
- if (isym->st_size != 0
+ /* Remember the symbol size if it isn't undefined. */
+ if ((isym->st_size != 0 && isym->st_shndx != SHN_UNDEF)
&& (definition || h->size == 0))
{
- if (h->size != 0 && h->size != isym->st_size && ! size_change_ok)
+ if (h->size != 0
+ && h->size != isym->st_size
+ && ! size_change_ok)
(*_bfd_error_handler)
(_("Warning: size of symbol `%s' changed"
" from %lu in %B to %lu in %B"),
@@ -3955,7 +4143,8 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
to be the size of the common symbol. The code just above
won't fix the size if a common symbol becomes larger. We
don't warn about a size change here, because that is
- covered by --warn-common. */
+ covered by --warn-common. Allow changed between different
+ function types. */
if (h->root.type == bfd_link_hash_common)
h->size = h->root.u.c.size;
@@ -3989,13 +4178,13 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
isym->st_other = (STV_HIDDEN
| (isym->st_other & ~ELF_ST_VISIBILITY (-1)));
- if (isym->st_other != 0 && !dynamic)
+ if (ELF_ST_VISIBILITY (isym->st_other) != 0 && !dynamic)
{
unsigned char hvis, symvis, other, nvis;
- /* Take the balance of OTHER from the definition. */
- other = (definition ? isym->st_other : h->other);
- other &= ~ ELF_ST_VISIBILITY (-1);
+ /* Only merge the visibility. Leave the remainder of the
+ st_other field to elf_backend_merge_symbol_attribute. */
+ other = h->other & ~ELF_ST_VISIBILITY (-1);
/* Combine visibilities, using the most constraining one. */
hvis = ELF_ST_VISIBILITY (h->other);
@@ -4045,6 +4234,13 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
dynsym = TRUE;
}
+ if (definition && (sec->flags & SEC_DEBUGGING))
+ {
+ /* We don't want to make debug symbol dynamic. */
+ (*bed->elf_backend_hide_symbol) (info, h, TRUE);
+ dynsym = FALSE;
+ }
+
/* Check to see if we need to add an indirect symbol for
the default name. */
if (definition || h->root.type == bfd_link_hash_common)
@@ -4145,9 +4341,14 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
unsigned int i;
/* Restore the symbol table. */
+ if (bed->as_needed_cleanup)
+ (*bed->as_needed_cleanup) (abfd, info);
old_hash = (char *) old_tab + tabsize;
old_ent = (char *) old_hash + hashsize;
sym_hash = elf_sym_hashes (abfd);
+ htab->root.table.table = old_table;
+ htab->root.table.size = old_size;
+ htab->root.table.count = old_count;
memcpy (htab->root.table.table, old_tab, tabsize);
memcpy (sym_hash, old_hash, hashsize);
htab->root.undefs = old_undefs;
@@ -4285,7 +4486,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
h = *hpp;
if (h != NULL
&& h->root.type == bfd_link_hash_defined
- && h->type != STT_FUNC)
+ && !bed->is_function_type (h->type))
{
*sym_hash = h;
sym_hash++;
@@ -4457,7 +4658,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
asection *stab;
for (stab = abfd->sections; stab; stab = stab->next)
- if (strncmp (".stab", stab->name, 5) == 0
+ if (CONST_STRNEQ (stab->name, ".stab")
&& (!stab->name[5] ||
(stab->name[5] == '.' && ISDIGIT (stab->name[6])))
&& (stab->flags & SEC_MERGE) == 0
@@ -4807,6 +5008,131 @@ elf_collect_hash_codes (struct elf_link_hash_entry *h, void *data)
return TRUE;
}
+struct collect_gnu_hash_codes
+{
+ bfd *output_bfd;
+ const struct elf_backend_data *bed;
+ unsigned long int nsyms;
+ unsigned long int maskbits;
+ unsigned long int *hashcodes;
+ unsigned long int *hashval;
+ unsigned long int *indx;
+ unsigned long int *counts;
+ bfd_vma *bitmask;
+ bfd_byte *contents;
+ long int min_dynindx;
+ unsigned long int bucketcount;
+ unsigned long int symindx;
+ long int local_indx;
+ long int shift1, shift2;
+ unsigned long int mask;
+};
+
+/* This function will be called though elf_link_hash_traverse to store
+ all hash value of the exported symbols in an array. */
+
+static bfd_boolean
+elf_collect_gnu_hash_codes (struct elf_link_hash_entry *h, void *data)
+{
+ struct collect_gnu_hash_codes *s = data;
+ const char *name;
+ char *p;
+ unsigned long ha;
+ char *alc = NULL;
+
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ /* Ignore indirect symbols. These are added by the versioning code. */
+ if (h->dynindx == -1)
+ return TRUE;
+
+ /* Ignore also local symbols and undefined symbols. */
+ if (! (*s->bed->elf_hash_symbol) (h))
+ return TRUE;
+
+ name = h->root.root.string;
+ p = strchr (name, ELF_VER_CHR);
+ if (p != NULL)
+ {
+ alc = bfd_malloc (p - name + 1);
+ memcpy (alc, name, p - name);
+ alc[p - name] = '\0';
+ name = alc;
+ }
+
+ /* Compute the hash value. */
+ ha = bfd_elf_gnu_hash (name);
+
+ /* Store the found hash value in the array for compute_bucket_count,
+ and also for .dynsym reordering purposes. */
+ s->hashcodes[s->nsyms] = ha;
+ s->hashval[h->dynindx] = ha;
+ ++s->nsyms;
+ if (s->min_dynindx < 0 || s->min_dynindx > h->dynindx)
+ s->min_dynindx = h->dynindx;
+
+ if (alc != NULL)
+ free (alc);
+
+ return TRUE;
+}
+
+/* This function will be called though elf_link_hash_traverse to do
+ final dynaminc symbol renumbering. */
+
+static bfd_boolean
+elf_renumber_gnu_hash_syms (struct elf_link_hash_entry *h, void *data)
+{
+ struct collect_gnu_hash_codes *s = data;
+ unsigned long int bucket;
+ unsigned long int val;
+
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ /* Ignore indirect symbols. */
+ if (h->dynindx == -1)
+ return TRUE;
+
+ /* Ignore also local symbols and undefined symbols. */
+ if (! (*s->bed->elf_hash_symbol) (h))
+ {
+ if (h->dynindx >= s->min_dynindx)
+ h->dynindx = s->local_indx++;
+ return TRUE;
+ }
+
+ bucket = s->hashval[h->dynindx] % s->bucketcount;
+ val = (s->hashval[h->dynindx] >> s->shift1)
+ & ((s->maskbits >> s->shift1) - 1);
+ s->bitmask[val] |= ((bfd_vma) 1) << (s->hashval[h->dynindx] & s->mask);
+ s->bitmask[val]
+ |= ((bfd_vma) 1) << ((s->hashval[h->dynindx] >> s->shift2) & s->mask);
+ val = s->hashval[h->dynindx] & ~(unsigned long int) 1;
+ if (s->counts[bucket] == 1)
+ /* Last element terminates the chain. */
+ val |= 1;
+ bfd_put_32 (s->output_bfd, val,
+ s->contents + (s->indx[bucket] - s->symindx) * 4);
+ --s->counts[bucket];
+ h->dynindx = s->indx[bucket]++;
+ return TRUE;
+}
+
+/* Return TRUE if symbol should be hashed in the `.gnu.hash' section. */
+
+bfd_boolean
+_bfd_elf_hash_symbol (struct elf_link_hash_entry *h)
+{
+ return !(h->forced_local
+ || h->root.type == bfd_link_hash_undefined
+ || h->root.type == bfd_link_hash_undefweak
+ || ((h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && h->root.u.def.section->output_section == NULL));
+}
+
/* Array used to determine the number of hash table buckets to use
based on the number of symbols there are. If there are fewer than
3 symbols we use 1 bucket, fewer than 17 symbols we use 3 buckets,
@@ -4828,42 +5154,26 @@ static const size_t elf_buckets[] =
Therefore the result is always a good payoff between few collisions
(= short chain lengths) and table size. */
static size_t
-compute_bucket_count (struct bfd_link_info *info)
+compute_bucket_count (struct bfd_link_info *info, unsigned long int *hashcodes,
+ unsigned long int nsyms, int gnu_hash)
{
size_t dynsymcount = elf_hash_table (info)->dynsymcount;
size_t best_size = 0;
- unsigned long int *hashcodes;
- unsigned long int *hashcodesp;
unsigned long int i;
bfd_size_type amt;
- /* Compute the hash values for all exported symbols. At the same
- time store the values in an array so that we could use them for
- optimizations. */
- amt = dynsymcount;
- amt *= sizeof (unsigned long int);
- hashcodes = bfd_malloc (amt);
- if (hashcodes == NULL)
- return 0;
- hashcodesp = hashcodes;
-
- /* Put all hash values in HASHCODES. */
- elf_link_hash_traverse (elf_hash_table (info),
- elf_collect_hash_codes, &hashcodesp);
-
/* We have a problem here. The following code to optimize the table
size requires an integer type with more the 32 bits. If
BFD_HOST_U_64_BIT is set we know about such a type. */
#ifdef BFD_HOST_U_64_BIT
if (info->optimize)
{
- unsigned long int nsyms = hashcodesp - hashcodes;
size_t minsize;
size_t maxsize;
BFD_HOST_U_64_BIT best_chlen = ~((BFD_HOST_U_64_BIT) 0);
- unsigned long int *counts ;
bfd *dynobj = elf_hash_table (info)->dynobj;
const struct elf_backend_data *bed = get_elf_backend_data (dynobj);
+ unsigned long int *counts;
/* Possible optimization parameters: if we have NSYMS symbols we say
that the hashing table must at least have NSYMS/4 and at most
@@ -4872,6 +5182,13 @@ compute_bucket_count (struct bfd_link_info *info)
if (minsize == 0)
minsize = 1;
best_size = maxsize = nsyms * 2;
+ if (gnu_hash)
+ {
+ if (minsize < 2)
+ minsize = 2;
+ if ((best_size & 31) == 0)
+ ++best_size;
+ }
/* Create array where we count the collisions in. We must use bfd_malloc
since the size could be large. */
@@ -4879,10 +5196,7 @@ compute_bucket_count (struct bfd_link_info *info)
amt *= sizeof (unsigned long int);
counts = bfd_malloc (amt);
if (counts == NULL)
- {
- free (hashcodes);
- return 0;
- }
+ return 0;
/* Compute the "optimal" size for the hash table. The criteria is a
minimal chain length. The minor criteria is (of course) the size
@@ -4894,6 +5208,9 @@ compute_bucket_count (struct bfd_link_info *info)
unsigned long int j;
unsigned long int fact;
+ if (gnu_hash && (i & 31) == 0)
+ continue;
+
memset (counts, '\0', i * sizeof (unsigned long int));
/* Determine how often each hash bucket is used. */
@@ -4909,9 +5226,9 @@ compute_bucket_count (struct bfd_link_info *info)
# define BFD_TARGET_PAGESIZE (4096)
# endif
- /* We in any case need 2 + NSYMS entries for the size values and
- the chains. */
- max = (2 + nsyms) * (bed->s->arch_size / 8);
+ /* We in any case need 2 + DYNSYMCOUNT entries for the size values
+ and the chains. */
+ max = (2 + dynsymcount) * bed->s->sizeof_hash_entry;
# if 1
/* Variant 1: optimize for short chains. We add the squares
@@ -4921,7 +5238,7 @@ compute_bucket_count (struct bfd_link_info *info)
max += counts[j] * counts[j];
/* This adds penalties for the overall size of the table. */
- fact = i / (BFD_TARGET_PAGESIZE / (bed->s->arch_size / 8)) + 1;
+ fact = i / (BFD_TARGET_PAGESIZE / bed->s->sizeof_hash_entry) + 1;
max *= fact * fact;
# else
/* Variant 2: Optimize a lot more for small table. Here we
@@ -4932,7 +5249,7 @@ compute_bucket_count (struct bfd_link_info *info)
/* The overall size of the table is considered, but not as
strong as in variant 1, where it is squared. */
- fact = i / (BFD_TARGET_PAGESIZE / (bed->s->arch_size / 8)) + 1;
+ fact = i / (BFD_TARGET_PAGESIZE / bed->s->sizeof_hash_entry) + 1;
max *= fact;
# endif
@@ -4955,14 +5272,13 @@ compute_bucket_count (struct bfd_link_info *info)
for (i = 0; elf_buckets[i] != 0; i++)
{
best_size = elf_buckets[i];
- if (dynsymcount < elf_buckets[i + 1])
+ if (nsyms < elf_buckets[i + 1])
break;
}
+ if (gnu_hash && best_size < 2)
+ best_size = 2;
}
- /* Free the arrays we needed. */
- free (hashcodes);
-
return best_size;
}
@@ -4993,6 +5309,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
if (!is_elf_hash_table (info->hash))
return TRUE;
+ bed = get_elf_backend_data (output_bfd);
elf_tdata (output_bfd)->relro = info->relro;
if (info->execstack)
elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
@@ -5019,7 +5336,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
exec = PF_X;
notesec = s;
}
- else
+ else if (bed->default_execstack)
exec = PF_X;
}
if (notesec)
@@ -5040,11 +5357,13 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
/* The backend may have to create some sections regardless of whether
we're dynamic or not. */
- bed = get_elf_backend_data (output_bfd);
if (bed->elf_backend_always_size_sections
&& ! (*bed->elf_backend_always_size_sections) (output_bfd, info))
return FALSE;
+ if (! _bfd_elf_maybe_strip_eh_frame_hdr (info))
+ return FALSE;
+
dynobj = elf_hash_table (info)->dynobj;
/* If there were no dynamic objects in the link, there is nothing to
@@ -5052,9 +5371,6 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
if (dynobj == NULL)
return TRUE;
- if (! _bfd_elf_maybe_strip_eh_frame_hdr (info))
- return FALSE;
-
if (elf_hash_table (info)->dynamic_sections_created)
{
struct elf_info_failed eif;
@@ -5135,7 +5451,8 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
/* If we are supposed to export all symbols into the dynamic symbol
table (this is not the normal case), then do so. */
- if (info->export_dynamic)
+ if (info->export_dynamic
+ || (info->executable && info->dynamic))
{
elf_link_hash_traverse (elf_hash_table (info),
_bfd_elf_export_symbol,
@@ -5277,15 +5594,16 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
for (sub = info->input_bfds; sub != NULL;
sub = sub->link_next)
- for (o = sub->sections; o != NULL; o = o->next)
- if (elf_section_data (o)->this_hdr.sh_type
- == SHT_PREINIT_ARRAY)
- {
- (*_bfd_error_handler)
- (_("%B: .preinit_array section is not allowed in DSO"),
- sub);
- break;
- }
+ if (bfd_get_flavour (sub) == bfd_target_elf_flavour)
+ for (o = sub->sections; o != NULL; o = o->next)
+ if (elf_section_data (o)->this_hdr.sh_type
+ == SHT_PREINIT_ARRAY)
+ {
+ (*_bfd_error_handler)
+ (_("%B: .preinit_array section is not allowed in DSO"),
+ sub);
+ break;
+ }
bfd_set_error (bfd_error_nonrepresentable_section);
return FALSE;
@@ -5320,7 +5638,10 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
bfd_size_type strsize;
strsize = _bfd_elf_strtab_size (elf_hash_table (info)->dynstr);
- if (!_bfd_elf_add_dynamic_entry (info, DT_HASH, 0)
+ if ((info->emit_hash
+ && !_bfd_elf_add_dynamic_entry (info, DT_HASH, 0))
+ || (info->emit_gnu_hash
+ && !_bfd_elf_add_dynamic_entry (info, DT_GNU_HASH, 0))
|| !_bfd_elf_add_dynamic_entry (info, DT_STRTAB, 0)
|| !_bfd_elf_add_dynamic_entry (info, DT_SYMTAB, 0)
|| !_bfd_elf_add_dynamic_entry (info, DT_STRSZ, strsize)
@@ -5709,21 +6030,68 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
return TRUE;
}
+/* Find the first non-excluded output section. We'll use its
+ section symbol for some emitted relocs. */
+void
+_bfd_elf_init_1_index_section (bfd *output_bfd, struct bfd_link_info *info)
+{
+ asection *s;
+
+ for (s = output_bfd->sections; s != NULL; s = s->next)
+ if ((s->flags & (SEC_EXCLUDE | SEC_ALLOC)) == SEC_ALLOC
+ && !_bfd_elf_link_omit_section_dynsym (output_bfd, info, s))
+ {
+ elf_hash_table (info)->text_index_section = s;
+ break;
+ }
+}
+
+/* Find two non-excluded output sections, one for code, one for data.
+ We'll use their section symbols for some emitted relocs. */
+void
+_bfd_elf_init_2_index_sections (bfd *output_bfd, struct bfd_link_info *info)
+{
+ asection *s;
+
+ for (s = output_bfd->sections; s != NULL; s = s->next)
+ if (((s->flags & (SEC_EXCLUDE | SEC_ALLOC | SEC_READONLY))
+ == (SEC_ALLOC | SEC_READONLY))
+ && !_bfd_elf_link_omit_section_dynsym (output_bfd, info, s))
+ {
+ elf_hash_table (info)->text_index_section = s;
+ break;
+ }
+
+ for (s = output_bfd->sections; s != NULL; s = s->next)
+ if (((s->flags & (SEC_EXCLUDE | SEC_ALLOC | SEC_READONLY)) == SEC_ALLOC)
+ && !_bfd_elf_link_omit_section_dynsym (output_bfd, info, s))
+ {
+ elf_hash_table (info)->data_index_section = s;
+ break;
+ }
+
+ if (elf_hash_table (info)->text_index_section == NULL)
+ elf_hash_table (info)->text_index_section
+ = elf_hash_table (info)->data_index_section;
+}
+
bfd_boolean
bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info)
{
+ const struct elf_backend_data *bed;
+
if (!is_elf_hash_table (info->hash))
return TRUE;
+ bed = get_elf_backend_data (output_bfd);
+ (*bed->elf_backend_init_index_section) (output_bfd, info);
+
if (elf_hash_table (info)->dynamic_sections_created)
{
bfd *dynobj;
- const struct elf_backend_data *bed;
asection *s;
bfd_size_type dynsymcount;
unsigned long section_sym_count;
- size_t bucketcount = 0;
- size_t hash_entry_size;
unsigned int dtagcount;
dynobj = elf_hash_table (info)->dynobj;
@@ -5759,7 +6127,6 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info)
section as we went along in elf_link_add_object_symbols. */
s = bfd_get_section_by_name (dynobj, ".dynsym");
BFD_ASSERT (s != NULL);
- bed = get_elf_backend_data (output_bfd);
s->size = dynsymcount * bed->s->sizeof_sym;
if (dynsymcount != 0)
@@ -5774,23 +6141,215 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info)
memset (s->contents, 0, section_sym_count * bed->s->sizeof_sym);
}
+ elf_hash_table (info)->bucketcount = 0;
+
/* Compute the size of the hashing table. As a side effect this
computes the hash values for all the names we export. */
- bucketcount = compute_bucket_count (info);
+ if (info->emit_hash)
+ {
+ unsigned long int *hashcodes;
+ unsigned long int *hashcodesp;
+ bfd_size_type amt;
+ unsigned long int nsyms;
+ size_t bucketcount;
+ size_t hash_entry_size;
+
+ /* Compute the hash values for all exported symbols. At the same
+ time store the values in an array so that we could use them for
+ optimizations. */
+ amt = dynsymcount * sizeof (unsigned long int);
+ hashcodes = bfd_malloc (amt);
+ if (hashcodes == NULL)
+ return FALSE;
+ hashcodesp = hashcodes;
- s = bfd_get_section_by_name (dynobj, ".hash");
- BFD_ASSERT (s != NULL);
- hash_entry_size = elf_section_data (s)->this_hdr.sh_entsize;
- s->size = ((2 + bucketcount + dynsymcount) * hash_entry_size);
- s->contents = bfd_zalloc (output_bfd, s->size);
- if (s->contents == NULL)
- return FALSE;
+ /* Put all hash values in HASHCODES. */
+ elf_link_hash_traverse (elf_hash_table (info),
+ elf_collect_hash_codes, &hashcodesp);
- 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);
+ nsyms = hashcodesp - hashcodes;
+ bucketcount
+ = compute_bucket_count (info, hashcodes, nsyms, 0);
+ free (hashcodes);
- elf_hash_table (info)->bucketcount = bucketcount;
+ if (bucketcount == 0)
+ return FALSE;
+
+ elf_hash_table (info)->bucketcount = bucketcount;
+
+ s = bfd_get_section_by_name (dynobj, ".hash");
+ BFD_ASSERT (s != NULL);
+ hash_entry_size = elf_section_data (s)->this_hdr.sh_entsize;
+ s->size = ((2 + bucketcount + dynsymcount) * hash_entry_size);
+ s->contents = bfd_zalloc (output_bfd, s->size);
+ if (s->contents == NULL)
+ return FALSE;
+
+ bfd_put (8 * hash_entry_size, output_bfd, bucketcount, s->contents);
+ bfd_put (8 * hash_entry_size, output_bfd, dynsymcount,
+ s->contents + hash_entry_size);
+ }
+
+ if (info->emit_gnu_hash)
+ {
+ size_t i, cnt;
+ unsigned char *contents;
+ struct collect_gnu_hash_codes cinfo;
+ bfd_size_type amt;
+ size_t bucketcount;
+
+ memset (&cinfo, 0, sizeof (cinfo));
+
+ /* Compute the hash values for all exported symbols. At the same
+ time store the values in an array so that we could use them for
+ optimizations. */
+ amt = dynsymcount * 2 * sizeof (unsigned long int);
+ cinfo.hashcodes = bfd_malloc (amt);
+ if (cinfo.hashcodes == NULL)
+ return FALSE;
+
+ cinfo.hashval = cinfo.hashcodes + dynsymcount;
+ cinfo.min_dynindx = -1;
+ cinfo.output_bfd = output_bfd;
+ cinfo.bed = bed;
+
+ /* Put all hash values in HASHCODES. */
+ elf_link_hash_traverse (elf_hash_table (info),
+ elf_collect_gnu_hash_codes, &cinfo);
+
+ bucketcount
+ = compute_bucket_count (info, cinfo.hashcodes, cinfo.nsyms, 1);
+
+ if (bucketcount == 0)
+ {
+ free (cinfo.hashcodes);
+ return FALSE;
+ }
+
+ s = bfd_get_section_by_name (dynobj, ".gnu.hash");
+ BFD_ASSERT (s != NULL);
+
+ if (cinfo.nsyms == 0)
+ {
+ /* Empty .gnu.hash section is special. */
+ BFD_ASSERT (cinfo.min_dynindx == -1);
+ free (cinfo.hashcodes);
+ s->size = 5 * 4 + bed->s->arch_size / 8;
+ contents = bfd_zalloc (output_bfd, s->size);
+ if (contents == NULL)
+ return FALSE;
+ s->contents = contents;
+ /* 1 empty bucket. */
+ bfd_put_32 (output_bfd, 1, contents);
+ /* SYMIDX above the special symbol 0. */
+ bfd_put_32 (output_bfd, 1, contents + 4);
+ /* Just one word for bitmask. */
+ bfd_put_32 (output_bfd, 1, contents + 8);
+ /* Only hash fn bloom filter. */
+ bfd_put_32 (output_bfd, 0, contents + 12);
+ /* No hashes are valid - empty bitmask. */
+ bfd_put (bed->s->arch_size, output_bfd, 0, contents + 16);
+ /* No hashes in the only bucket. */
+ bfd_put_32 (output_bfd, 0,
+ contents + 16 + bed->s->arch_size / 8);
+ }
+ else
+ {
+ unsigned long int maskwords, maskbitslog2;
+ BFD_ASSERT (cinfo.min_dynindx != -1);
+
+ maskbitslog2 = bfd_log2 (cinfo.nsyms) + 1;
+ if (maskbitslog2 < 3)
+ maskbitslog2 = 5;
+ else if ((1 << (maskbitslog2 - 2)) & cinfo.nsyms)
+ maskbitslog2 = maskbitslog2 + 3;
+ else
+ maskbitslog2 = maskbitslog2 + 2;
+ if (bed->s->arch_size == 64)
+ {
+ if (maskbitslog2 == 5)
+ maskbitslog2 = 6;
+ cinfo.shift1 = 6;
+ }
+ else
+ cinfo.shift1 = 5;
+ cinfo.mask = (1 << cinfo.shift1) - 1;
+ cinfo.shift2 = maskbitslog2;
+ cinfo.maskbits = 1 << maskbitslog2;
+ maskwords = 1 << (maskbitslog2 - cinfo.shift1);
+ amt = bucketcount * sizeof (unsigned long int) * 2;
+ amt += maskwords * sizeof (bfd_vma);
+ cinfo.bitmask = bfd_malloc (amt);
+ if (cinfo.bitmask == NULL)
+ {
+ free (cinfo.hashcodes);
+ return FALSE;
+ }
+
+ cinfo.counts = (void *) (cinfo.bitmask + maskwords);
+ cinfo.indx = cinfo.counts + bucketcount;
+ cinfo.symindx = dynsymcount - cinfo.nsyms;
+ memset (cinfo.bitmask, 0, maskwords * sizeof (bfd_vma));
+
+ /* Determine how often each hash bucket is used. */
+ memset (cinfo.counts, 0, bucketcount * sizeof (cinfo.counts[0]));
+ for (i = 0; i < cinfo.nsyms; ++i)
+ ++cinfo.counts[cinfo.hashcodes[i] % bucketcount];
+
+ for (i = 0, cnt = cinfo.symindx; i < bucketcount; ++i)
+ if (cinfo.counts[i] != 0)
+ {
+ cinfo.indx[i] = cnt;
+ cnt += cinfo.counts[i];
+ }
+ BFD_ASSERT (cnt == dynsymcount);
+ cinfo.bucketcount = bucketcount;
+ cinfo.local_indx = cinfo.min_dynindx;
+
+ s->size = (4 + bucketcount + cinfo.nsyms) * 4;
+ s->size += cinfo.maskbits / 8;
+ contents = bfd_zalloc (output_bfd, s->size);
+ if (contents == NULL)
+ {
+ free (cinfo.bitmask);
+ free (cinfo.hashcodes);
+ return FALSE;
+ }
+
+ s->contents = contents;
+ bfd_put_32 (output_bfd, bucketcount, contents);
+ bfd_put_32 (output_bfd, cinfo.symindx, contents + 4);
+ bfd_put_32 (output_bfd, maskwords, contents + 8);
+ bfd_put_32 (output_bfd, cinfo.shift2, contents + 12);
+ contents += 16 + cinfo.maskbits / 8;
+
+ for (i = 0; i < bucketcount; ++i)
+ {
+ if (cinfo.counts[i] == 0)
+ bfd_put_32 (output_bfd, 0, contents);
+ else
+ bfd_put_32 (output_bfd, cinfo.indx[i], contents);
+ contents += 4;
+ }
+
+ cinfo.contents = contents;
+
+ /* Renumber dynamic symbols, populate .gnu.hash section. */
+ elf_link_hash_traverse (elf_hash_table (info),
+ elf_renumber_gnu_hash_syms, &cinfo);
+
+ contents = s->contents + 16;
+ for (i = 0; i < maskwords; ++i)
+ {
+ bfd_put (bed->s->arch_size, output_bfd, cinfo.bitmask[i],
+ contents);
+ contents += bed->s->arch_size / 8;
+ }
+
+ free (cinfo.bitmask);
+ free (cinfo.hashcodes);
+ }
+ }
s = bfd_get_section_by_name (dynobj, ".dynstr");
BFD_ASSERT (s != NULL);
@@ -5866,6 +6425,719 @@ struct elf_outext_info
struct elf_final_link_info *finfo;
};
+
+/* Support for evaluating a complex relocation.
+
+ Complex relocations are generalized, self-describing relocations. The
+ implementation of them consists of two parts: complex symbols, and the
+ relocations themselves.
+
+ The relocations are use a reserved elf-wide relocation type code (R_RELC
+ external / BFD_RELOC_RELC internal) and an encoding of relocation field
+ information (start bit, end bit, word width, etc) into the addend. This
+ information is extracted from CGEN-generated operand tables within gas.
+
+ Complex symbols are mangled symbols (BSF_RELC external / STT_RELC
+ internal) representing prefix-notation expressions, including but not
+ limited to those sorts of expressions normally encoded as addends in the
+ addend field. The symbol mangling format is:
+
+ <node> := <literal>
+ | <unary-operator> ':' <node>
+ | <binary-operator> ':' <node> ':' <node>
+ ;
+
+ <literal> := 's' <digits=N> ':' <N character symbol name>
+ | 'S' <digits=N> ':' <N character section name>
+ | '#' <hexdigits>
+ ;
+
+ <binary-operator> := as in C
+ <unary-operator> := as in C, plus "0-" for unambiguous negation. */
+
+static void
+set_symbol_value (bfd * bfd_with_globals,
+ struct elf_final_link_info * finfo,
+ int symidx,
+ bfd_vma val)
+{
+ bfd_boolean is_local;
+ Elf_Internal_Sym * sym;
+ struct elf_link_hash_entry ** sym_hashes;
+ struct elf_link_hash_entry * h;
+
+ sym_hashes = elf_sym_hashes (bfd_with_globals);
+ sym = finfo->internal_syms + symidx;
+ is_local = ELF_ST_BIND(sym->st_info) == STB_LOCAL;
+
+ if (is_local)
+ {
+ /* It is a local symbol: move it to the
+ "absolute" section and give it a value. */
+ sym->st_shndx = SHN_ABS;
+ sym->st_value = val;
+ }
+ else
+ {
+ /* It is a global symbol: set its link type
+ to "defined" and give it a value. */
+ h = sym_hashes [symidx];
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ h->root.type = bfd_link_hash_defined;
+ h->root.u.def.value = val;
+ h->root.u.def.section = bfd_abs_section_ptr;
+ }
+}
+
+static bfd_boolean
+resolve_symbol (const char * name,
+ bfd * input_bfd,
+ struct elf_final_link_info * finfo,
+ bfd_vma * result,
+ size_t locsymcount)
+{
+ Elf_Internal_Sym * sym;
+ struct bfd_link_hash_entry * global_entry;
+ const char * candidate = NULL;
+ Elf_Internal_Shdr * symtab_hdr;
+ asection * sec = NULL;
+ size_t i;
+
+ symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
+
+ for (i = 0; i < locsymcount; ++ i)
+ {
+ sym = finfo->internal_syms + i;
+ sec = finfo->sections [i];
+
+ if (ELF_ST_BIND (sym->st_info) != STB_LOCAL)
+ continue;
+
+ candidate = bfd_elf_string_from_elf_section (input_bfd,
+ symtab_hdr->sh_link,
+ sym->st_name);
+#ifdef DEBUG
+ printf ("Comparing string: '%s' vs. '%s' = 0x%x\n",
+ name, candidate, (unsigned int)sym->st_value);
+#endif
+ if (candidate && strcmp (candidate, name) == 0)
+ {
+ * result = sym->st_value;
+
+ if (sym->st_shndx > SHN_UNDEF &&
+ sym->st_shndx < SHN_LORESERVE)
+ {
+#ifdef DEBUG
+ printf ("adjusting for sec '%s' @ 0x%x + 0x%x\n",
+ sec->output_section->name,
+ (unsigned int)sec->output_section->vma,
+ (unsigned int)sec->output_offset);
+#endif
+ * result += sec->output_offset + sec->output_section->vma;
+ }
+#ifdef DEBUG
+ printf ("Found symbol with effective value %8.8x\n", (unsigned int)* result);
+#endif
+ return TRUE;
+ }
+ }
+
+ /* Hmm, haven't found it yet. perhaps it is a global. */
+ global_entry = bfd_link_hash_lookup (finfo->info->hash, name, FALSE, FALSE, TRUE);
+ if (!global_entry)
+ return FALSE;
+
+ if (global_entry->type == bfd_link_hash_defined
+ || global_entry->type == bfd_link_hash_defweak)
+ {
+ * result = global_entry->u.def.value
+ + global_entry->u.def.section->output_section->vma
+ + global_entry->u.def.section->output_offset;
+#ifdef DEBUG
+ printf ("Found GLOBAL symbol '%s' with value %8.8x\n",
+ global_entry->root.string, (unsigned int)*result);
+#endif
+ return TRUE;
+ }
+
+ if (global_entry->type == bfd_link_hash_common)
+ {
+ *result = global_entry->u.def.value +
+ bfd_com_section_ptr->output_section->vma +
+ bfd_com_section_ptr->output_offset;
+#ifdef DEBUG
+ printf ("Found COMMON symbol '%s' with value %8.8x\n",
+ global_entry->root.string, (unsigned int)*result);
+#endif
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static bfd_boolean
+resolve_section (const char * name,
+ asection * sections,
+ bfd_vma * result)
+{
+ asection * curr;
+ unsigned int len;
+
+ for (curr = sections; curr; curr = curr->next)
+ if (strcmp (curr->name, name) == 0)
+ {
+ *result = curr->vma;
+ return TRUE;
+ }
+
+ /* Hmm. still haven't found it. try pseudo-section names. */
+ for (curr = sections; curr; curr = curr->next)
+ {
+ len = strlen (curr->name);
+ if (len > strlen (name))
+ continue;
+
+ if (strncmp (curr->name, name, len) == 0)
+ {
+ if (strncmp (".end", name + len, 4) == 0)
+ {
+ *result = curr->vma + curr->size;
+ return TRUE;
+ }
+
+ /* Insert more pseudo-section names here, if you like. */
+ }
+ }
+
+ return FALSE;
+}
+
+static void
+undefined_reference (const char * reftype,
+ const char * name)
+{
+ _bfd_error_handler (_("undefined %s reference in complex symbol: %s"), reftype, name);
+}
+
+static bfd_boolean
+eval_symbol (bfd_vma * result,
+ char * sym,
+ char ** advanced,
+ bfd * input_bfd,
+ struct elf_final_link_info * finfo,
+ bfd_vma addr,
+ bfd_vma section_offset,
+ size_t locsymcount,
+ int signed_p)
+{
+ int len;
+ int symlen;
+ bfd_vma a;
+ bfd_vma b;
+ const int bufsz = 4096;
+ char symbuf [bufsz];
+ const char * symend;
+ bfd_boolean symbol_is_section = FALSE;
+
+ len = strlen (sym);
+ symend = sym + len;
+
+ if (len < 1 || len > bufsz)
+ {
+ bfd_set_error (bfd_error_invalid_operation);
+ return FALSE;
+ }
+
+ switch (* sym)
+ {
+ case '.':
+ * result = addr + section_offset;
+ * advanced = sym + 1;
+ return TRUE;
+
+ case '#':
+ ++ sym;
+ * result = strtoul (sym, advanced, 16);
+ return TRUE;
+
+ case 'S':
+ symbol_is_section = TRUE;
+ case 's':
+ ++ sym;
+ symlen = strtol (sym, &sym, 10);
+ ++ sym; /* Skip the trailing ':'. */
+
+ if ((symend < sym) || ((symlen + 1) > bufsz))
+ {
+ bfd_set_error (bfd_error_invalid_operation);
+ return FALSE;
+ }
+
+ memcpy (symbuf, sym, symlen);
+ symbuf [symlen] = '\0';
+ * advanced = sym + symlen;
+
+ /* Is it always possible, with complex symbols, that gas "mis-guessed"
+ the symbol as a section, or vice-versa. so we're pretty liberal in our
+ interpretation here; section means "try section first", not "must be a
+ section", and likewise with symbol. */
+
+ if (symbol_is_section)
+ {
+ if ((resolve_section (symbuf, finfo->output_bfd->sections, result) != TRUE)
+ && (resolve_symbol (symbuf, input_bfd, finfo, result, locsymcount) != TRUE))
+ {
+ undefined_reference ("section", symbuf);
+ return FALSE;
+ }
+ }
+ else
+ {
+ if ((resolve_symbol (symbuf, input_bfd, finfo, result, locsymcount) != TRUE)
+ && (resolve_section (symbuf, finfo->output_bfd->sections,
+ result) != TRUE))
+ {
+ undefined_reference ("symbol", symbuf);
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+
+ /* All that remains are operators. */
+
+#define UNARY_OP(op) \
+ if (strncmp (sym, #op, strlen (#op)) == 0) \
+ { \
+ sym += strlen (#op); \
+ if (* sym == ':') \
+ ++ sym; \
+ if (eval_symbol (& a, sym, & sym, input_bfd, finfo, addr, \
+ section_offset, locsymcount, signed_p) \
+ != TRUE) \
+ return FALSE; \
+ if (signed_p) \
+ * result = op ((signed)a); \
+ else \
+ * result = op a; \
+ * advanced = sym; \
+ return TRUE; \
+ }
+
+#define BINARY_OP(op) \
+ if (strncmp (sym, #op, strlen (#op)) == 0) \
+ { \
+ sym += strlen (#op); \
+ if (* sym == ':') \
+ ++ sym; \
+ if (eval_symbol (& a, sym, & sym, input_bfd, finfo, addr, \
+ section_offset, locsymcount, signed_p) \
+ != TRUE) \
+ return FALSE; \
+ ++ sym; \
+ if (eval_symbol (& b, sym, & sym, input_bfd, finfo, addr, \
+ section_offset, locsymcount, signed_p) \
+ != TRUE) \
+ return FALSE; \
+ if (signed_p) \
+ * result = ((signed) a) op ((signed) b); \
+ else \
+ * result = a op b; \
+ * advanced = sym; \
+ return TRUE; \
+ }
+
+ default:
+ UNARY_OP (0-);
+ BINARY_OP (<<);
+ BINARY_OP (>>);
+ BINARY_OP (==);
+ BINARY_OP (!=);
+ BINARY_OP (<=);
+ BINARY_OP (>=);
+ BINARY_OP (&&);
+ BINARY_OP (||);
+ UNARY_OP (~);
+ UNARY_OP (!);
+ BINARY_OP (*);
+ BINARY_OP (/);
+ BINARY_OP (%);
+ BINARY_OP (^);
+ BINARY_OP (|);
+ BINARY_OP (&);
+ BINARY_OP (+);
+ BINARY_OP (-);
+ BINARY_OP (<);
+ BINARY_OP (>);
+#undef UNARY_OP
+#undef BINARY_OP
+ _bfd_error_handler (_("unknown operator '%c' in complex symbol"), * sym);
+ bfd_set_error (bfd_error_invalid_operation);
+ return FALSE;
+ }
+}
+
+/* Entry point to evaluator, called from elf_link_input_bfd. */
+
+static bfd_boolean
+evaluate_complex_relocation_symbols (bfd * input_bfd,
+ struct elf_final_link_info * finfo,
+ size_t locsymcount)
+{
+ const struct elf_backend_data * bed;
+ Elf_Internal_Shdr * symtab_hdr;
+ struct elf_link_hash_entry ** sym_hashes;
+ asection * reloc_sec;
+ bfd_boolean result = TRUE;
+
+ /* For each section, we're going to check and see if it has any
+ complex relocations, and we're going to evaluate any of them
+ we can. */
+
+ if (finfo->info->relocatable)
+ return TRUE;
+
+ symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
+ sym_hashes = elf_sym_hashes (input_bfd);
+ bed = get_elf_backend_data (input_bfd);
+
+ for (reloc_sec = input_bfd->sections; reloc_sec; reloc_sec = reloc_sec->next)
+ {
+ Elf_Internal_Rela * internal_relocs;
+ unsigned long i;
+
+ /* This section was omitted from the link. */
+ if (! reloc_sec->linker_mark)
+ continue;
+
+ /* Only process sections containing relocs. */
+ if ((reloc_sec->flags & SEC_RELOC) == 0)
+ continue;
+
+ if (reloc_sec->reloc_count == 0)
+ continue;
+
+ /* Read in the relocs for this section. */
+ internal_relocs
+ = _bfd_elf_link_read_relocs (input_bfd, reloc_sec, NULL,
+ (Elf_Internal_Rela *) NULL,
+ FALSE);
+ if (internal_relocs == NULL)
+ continue;
+
+ for (i = reloc_sec->reloc_count; i--;)
+ {
+ Elf_Internal_Rela * rel;
+ char * sym_name;
+ bfd_vma index;
+ Elf_Internal_Sym * sym;
+ bfd_vma result;
+ bfd_vma section_offset;
+ bfd_vma addr;
+ int signed_p = 0;
+
+ rel = internal_relocs + i;
+ section_offset = reloc_sec->output_section->vma
+ + reloc_sec->output_offset;
+ addr = rel->r_offset;
+
+ index = ELF32_R_SYM (rel->r_info);
+ if (bed->s->arch_size == 64)
+ index >>= 24;
+
+ if (index == STN_UNDEF)
+ continue;
+
+ if (index < locsymcount)
+ {
+ /* The symbol is local. */
+ sym = finfo->internal_syms + index;
+
+ /* We're only processing STT_RELC or STT_SRELC type symbols. */
+ if ((ELF_ST_TYPE (sym->st_info) != STT_RELC) &&
+ (ELF_ST_TYPE (sym->st_info) != STT_SRELC))
+ continue;
+
+ sym_name = bfd_elf_string_from_elf_section
+ (input_bfd, symtab_hdr->sh_link, sym->st_name);
+
+ signed_p = (ELF_ST_TYPE (sym->st_info) == STT_SRELC);
+ }
+ else
+ {
+ /* The symbol is global. */
+ struct elf_link_hash_entry * h;
+
+ if (elf_bad_symtab (input_bfd))
+ continue;
+
+ h = sym_hashes [index - locsymcount];
+ while ( h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ if (h->type != STT_RELC && h->type != STT_SRELC)
+ continue;
+
+ signed_p = (h->type == STT_SRELC);
+ sym_name = (char *) h->root.root.string;
+ }
+#ifdef DEBUG
+ printf ("Encountered a complex symbol!");
+ printf (" (input_bfd %s, section %s, reloc %ld\n",
+ input_bfd->filename, reloc_sec->name, i);
+ printf (" symbol: idx %8.8lx, name %s\n",
+ index, sym_name);
+ printf (" reloc : info %8.8lx, addr %8.8lx\n",
+ rel->r_info, addr);
+ printf (" Evaluating '%s' ...\n ", sym_name);
+#endif
+ if (eval_symbol (& result, sym_name, & sym_name, input_bfd,
+ finfo, addr, section_offset, locsymcount,
+ signed_p))
+ /* Symbol evaluated OK. Update to absolute value. */
+ set_symbol_value (input_bfd, finfo, index, result);
+
+ else
+ result = FALSE;
+ }
+
+ if (internal_relocs != elf_section_data (reloc_sec)->relocs)
+ free (internal_relocs);
+ }
+
+ /* If nothing went wrong, then we adjusted
+ everything we wanted to adjust. */
+ return result;
+}
+
+static void
+put_value (bfd_vma size,
+ unsigned long chunksz,
+ bfd * input_bfd,
+ bfd_vma x,
+ bfd_byte * location)
+{
+ location += (size - chunksz);
+
+ for (; size; size -= chunksz, location -= chunksz, x >>= (chunksz * 8))
+ {
+ switch (chunksz)
+ {
+ default:
+ case 0:
+ abort ();
+ case 1:
+ bfd_put_8 (input_bfd, x, location);
+ break;
+ case 2:
+ bfd_put_16 (input_bfd, x, location);
+ break;
+ case 4:
+ bfd_put_32 (input_bfd, x, location);
+ break;
+ case 8:
+#ifdef BFD64
+ bfd_put_64 (input_bfd, x, location);
+#else
+ abort ();
+#endif
+ break;
+ }
+ }
+}
+
+static bfd_vma
+get_value (bfd_vma size,
+ unsigned long chunksz,
+ bfd * input_bfd,
+ bfd_byte * location)
+{
+ bfd_vma x = 0;
+
+ for (; size; size -= chunksz, location += chunksz)
+ {
+ switch (chunksz)
+ {
+ default:
+ case 0:
+ abort ();
+ case 1:
+ x = (x << (8 * chunksz)) | bfd_get_8 (input_bfd, location);
+ break;
+ case 2:
+ x = (x << (8 * chunksz)) | bfd_get_16 (input_bfd, location);
+ break;
+ case 4:
+ x = (x << (8 * chunksz)) | bfd_get_32 (input_bfd, location);
+ break;
+ case 8:
+#ifdef BFD64
+ x = (x << (8 * chunksz)) | bfd_get_64 (input_bfd, location);
+#else
+ abort ();
+#endif
+ break;
+ }
+ }
+ return x;
+}
+
+static void
+decode_complex_addend
+ (unsigned long * start, /* in bits */
+ unsigned long * oplen, /* in bits */
+ unsigned long * len, /* in bits */
+ unsigned long * wordsz, /* in bytes */
+ unsigned long * chunksz, /* in bytes */
+ unsigned long * lsb0_p,
+ unsigned long * signed_p,
+ unsigned long * trunc_p,
+ unsigned long encoded)
+{
+ * start = encoded & 0x3F;
+ * len = (encoded >> 6) & 0x3F;
+ * oplen = (encoded >> 12) & 0x3F;
+ * wordsz = (encoded >> 18) & 0xF;
+ * chunksz = (encoded >> 22) & 0xF;
+ * lsb0_p = (encoded >> 27) & 1;
+ * signed_p = (encoded >> 28) & 1;
+ * trunc_p = (encoded >> 29) & 1;
+}
+
+void
+bfd_elf_perform_complex_relocation
+ (bfd * output_bfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info * info,
+ bfd * input_bfd,
+ asection * input_section,
+ bfd_byte * contents,
+ Elf_Internal_Rela * rel,
+ Elf_Internal_Sym * local_syms,
+ asection ** local_sections)
+{
+ const struct elf_backend_data * bed;
+ Elf_Internal_Shdr * symtab_hdr;
+ asection * sec;
+ bfd_vma relocation = 0, shift, x;
+ bfd_vma r_symndx;
+ bfd_vma mask;
+ unsigned long start, oplen, len, wordsz,
+ chunksz, lsb0_p, signed_p, trunc_p;
+
+ /* Perform this reloc, since it is complex.
+ (this is not to say that it necessarily refers to a complex
+ symbol; merely that it is a self-describing CGEN based reloc.
+ i.e. the addend has the complete reloc information (bit start, end,
+ word size, etc) encoded within it.). */
+ r_symndx = ELF32_R_SYM (rel->r_info);
+ bed = get_elf_backend_data (input_bfd);
+ if (bed->s->arch_size == 64)
+ r_symndx >>= 24;
+
+#ifdef DEBUG
+ printf ("Performing complex relocation %ld...\n", r_symndx);
+#endif
+
+ symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
+ if (r_symndx < symtab_hdr->sh_info)
+ {
+ /* The symbol is local. */
+ Elf_Internal_Sym * sym;
+
+ sym = local_syms + r_symndx;
+ sec = local_sections [r_symndx];
+ relocation = sym->st_value;
+ if (sym->st_shndx > SHN_UNDEF &&
+ sym->st_shndx < SHN_LORESERVE)
+ relocation += (sec->output_offset +
+ sec->output_section->vma);
+ }
+ else
+ {
+ /* The symbol is global. */
+ struct elf_link_hash_entry **sym_hashes;
+ struct elf_link_hash_entry * h;
+
+ sym_hashes = elf_sym_hashes (input_bfd);
+ h = sym_hashes [r_symndx];
+
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ if (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ {
+ sec = h->root.u.def.section;
+ relocation = h->root.u.def.value;
+
+ if (! bfd_is_abs_section (sec))
+ relocation += (sec->output_section->vma
+ + sec->output_offset);
+ }
+ if (h->root.type == bfd_link_hash_undefined
+ && !((*info->callbacks->undefined_symbol)
+ (info, h->root.root.string, input_bfd,
+ input_section, rel->r_offset,
+ info->unresolved_syms_in_objects == RM_GENERATE_ERROR
+ || ELF_ST_VISIBILITY (h->other))))
+ return;
+ }
+
+ decode_complex_addend (& start, & oplen, & len, & wordsz,
+ & chunksz, & lsb0_p, & signed_p,
+ & trunc_p, rel->r_addend);
+
+ mask = (((1L << (len - 1)) - 1) << 1) | 1;
+
+ if (lsb0_p)
+ shift = (start + 1) - len;
+ else
+ shift = (8 * wordsz) - (start + len);
+
+ x = get_value (wordsz, chunksz, input_bfd, contents + rel->r_offset);
+
+#ifdef DEBUG
+ printf ("Doing complex reloc: "
+ "lsb0? %ld, signed? %ld, trunc? %ld, wordsz %ld, "
+ "chunksz %ld, start %ld, len %ld, oplen %ld\n"
+ " dest: %8.8lx, mask: %8.8lx, reloc: %8.8lx\n",
+ lsb0_p, signed_p, trunc_p, wordsz, chunksz, start, len,
+ oplen, x, mask, relocation);
+#endif
+
+ if (! trunc_p)
+ {
+ /* Now do an overflow check. */
+ if (bfd_check_overflow ((signed_p ?
+ complain_overflow_signed :
+ complain_overflow_unsigned),
+ len, 0, (8 * wordsz),
+ relocation) == bfd_reloc_overflow)
+ (*_bfd_error_handler)
+ ("%s (%s + 0x%lx): relocation overflow: 0x%lx %sdoes not fit "
+ "within 0x%lx",
+ input_bfd->filename, input_section->name, rel->r_offset,
+ relocation, (signed_p ? "(signed) " : ""), mask);
+ }
+
+ /* Do the deed. */
+ x = (x & ~(mask << shift)) | ((relocation & mask) << shift);
+
+#ifdef DEBUG
+ printf (" relocation: %8.8lx\n"
+ " shifted mask: %8.8lx\n"
+ " shifted/masked reloc: %8.8lx\n"
+ " result: %8.8lx\n",
+ relocation, (mask << shift),
+ ((relocation & mask) << shift), x);
+#endif
+ put_value (wordsz, chunksz, input_bfd, x, contents + rel->r_offset);
+}
+
/* When performing a relocatable link, the input relocations are
preserved. But, if they reference global symbols, the indices
referenced must be updated. Update all the relocations in
@@ -5994,7 +7266,9 @@ elf_link_sort_cmp2 (const void *A, const void *B)
static size_t
elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec)
{
- asection *reldyn;
+ asection *dynamic_relocs;
+ asection *rela_dyn;
+ asection *rel_dyn;
bfd_size_type count, size;
size_t i, ret, sort_elt, ext_size;
bfd_byte *sort, *s_non_relative, *p;
@@ -6005,39 +7279,170 @@ elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec)
void (*swap_out) (bfd *, const Elf_Internal_Rela *, bfd_byte *);
struct bfd_link_order *lo;
bfd_vma r_sym_mask;
+ bfd_boolean use_rela;
- reldyn = bfd_get_section_by_name (abfd, ".rela.dyn");
- if (reldyn == NULL || reldyn->size == 0)
+ /* Find a dynamic reloc section. */
+ rela_dyn = bfd_get_section_by_name (abfd, ".rela.dyn");
+ rel_dyn = bfd_get_section_by_name (abfd, ".rel.dyn");
+ if (rela_dyn != NULL && rela_dyn->size > 0
+ && rel_dyn != NULL && rel_dyn->size > 0)
{
- reldyn = bfd_get_section_by_name (abfd, ".rel.dyn");
- if (reldyn == NULL || reldyn->size == 0)
- return 0;
- ext_size = bed->s->sizeof_rel;
- swap_in = bed->s->swap_reloc_in;
- swap_out = bed->s->swap_reloc_out;
+ bfd_boolean use_rela_initialised = FALSE;
+
+ /* This is just here to stop gcc from complaining.
+ It's initialization checking code is not perfect. */
+ use_rela = TRUE;
+
+ /* Both sections are present. Examine the sizes
+ of the indirect sections to help us choose. */
+ for (lo = rela_dyn->map_head.link_order; lo != NULL; lo = lo->next)
+ if (lo->type == bfd_indirect_link_order)
+ {
+ asection *o = lo->u.indirect.section;
+
+ if ((o->size % bed->s->sizeof_rela) == 0)
+ {
+ if ((o->size % bed->s->sizeof_rel) == 0)
+ /* Section size is divisible by both rel and rela sizes.
+ It is of no help to us. */
+ ;
+ else
+ {
+ /* Section size is only divisible by rela. */
+ if (use_rela_initialised && (use_rela == FALSE))
+ {
+ _bfd_error_handler
+ (_("%B: Unable to sort relocs - they are in more than one size"), abfd);
+ bfd_set_error (bfd_error_invalid_operation);
+ return 0;
+ }
+ else
+ {
+ use_rela = TRUE;
+ use_rela_initialised = TRUE;
+ }
+ }
+ }
+ else if ((o->size % bed->s->sizeof_rel) == 0)
+ {
+ /* Section size is only divisible by rel. */
+ if (use_rela_initialised && (use_rela == TRUE))
+ {
+ _bfd_error_handler
+ (_("%B: Unable to sort relocs - they are in more than one size"), abfd);
+ bfd_set_error (bfd_error_invalid_operation);
+ return 0;
+ }
+ else
+ {
+ use_rela = FALSE;
+ use_rela_initialised = TRUE;
+ }
+ }
+ else
+ {
+ /* The section size is not divisible by either - something is wrong. */
+ _bfd_error_handler
+ (_("%B: Unable to sort relocs - they are of an unknown size"), abfd);
+ bfd_set_error (bfd_error_invalid_operation);
+ return 0;
+ }
+ }
+
+ for (lo = rel_dyn->map_head.link_order; lo != NULL; lo = lo->next)
+ if (lo->type == bfd_indirect_link_order)
+ {
+ asection *o = lo->u.indirect.section;
+
+ if ((o->size % bed->s->sizeof_rela) == 0)
+ {
+ if ((o->size % bed->s->sizeof_rel) == 0)
+ /* Section size is divisible by both rel and rela sizes.
+ It is of no help to us. */
+ ;
+ else
+ {
+ /* Section size is only divisible by rela. */
+ if (use_rela_initialised && (use_rela == FALSE))
+ {
+ _bfd_error_handler
+ (_("%B: Unable to sort relocs - they are in more than one size"), abfd);
+ bfd_set_error (bfd_error_invalid_operation);
+ return 0;
+ }
+ else
+ {
+ use_rela = TRUE;
+ use_rela_initialised = TRUE;
+ }
+ }
+ }
+ else if ((o->size % bed->s->sizeof_rel) == 0)
+ {
+ /* Section size is only divisible by rel. */
+ if (use_rela_initialised && (use_rela == TRUE))
+ {
+ _bfd_error_handler
+ (_("%B: Unable to sort relocs - they are in more than one size"), abfd);
+ bfd_set_error (bfd_error_invalid_operation);
+ return 0;
+ }
+ else
+ {
+ use_rela = FALSE;
+ use_rela_initialised = TRUE;
+ }
+ }
+ else
+ {
+ /* The section size is not divisible by either - something is wrong. */
+ _bfd_error_handler
+ (_("%B: Unable to sort relocs - they are of an unknown size"), abfd);
+ bfd_set_error (bfd_error_invalid_operation);
+ return 0;
+ }
+ }
+
+ if (! use_rela_initialised)
+ /* Make a guess. */
+ use_rela = TRUE;
}
+ else if (rela_dyn != NULL && rela_dyn->size > 0)
+ use_rela = TRUE;
+ else if (rel_dyn != NULL && rel_dyn->size > 0)
+ use_rela = FALSE;
else
+ return 0;
+
+ if (use_rela)
{
+ dynamic_relocs = rela_dyn;
ext_size = bed->s->sizeof_rela;
swap_in = bed->s->swap_reloca_in;
swap_out = bed->s->swap_reloca_out;
}
- count = reldyn->size / ext_size;
+ else
+ {
+ dynamic_relocs = rel_dyn;
+ ext_size = bed->s->sizeof_rel;
+ swap_in = bed->s->swap_reloc_in;
+ swap_out = bed->s->swap_reloc_out;
+ }
size = 0;
- for (lo = reldyn->map_head.link_order; lo != NULL; lo = lo->next)
+ for (lo = dynamic_relocs->map_head.link_order; lo != NULL; lo = lo->next)
if (lo->type == bfd_indirect_link_order)
- {
- asection *o = lo->u.indirect.section;
- size += o->size;
- }
+ size += lo->u.indirect.section->size;
- if (size != reldyn->size)
+ if (size != dynamic_relocs->size)
return 0;
sort_elt = (sizeof (struct elf_link_sort_rela)
+ (i2e - 1) * sizeof (Elf_Internal_Rela));
+
+ count = dynamic_relocs->size / ext_size;
sort = bfd_zmalloc (sort_elt * count);
+
if (sort == NULL)
{
(*info->callbacks->warning)
@@ -6050,7 +7455,7 @@ elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec)
else
r_sym_mask = ~(bfd_vma) 0xffffffff;
- for (lo = reldyn->map_head.link_order; lo != NULL; lo = lo->next)
+ for (lo = dynamic_relocs->map_head.link_order; lo != NULL; lo = lo->next)
if (lo->type == bfd_indirect_link_order)
{
bfd_byte *erel, *erelend;
@@ -6067,9 +7472,11 @@ elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec)
erel = o->contents;
erelend = o->contents + o->size;
p = sort + o->output_offset / ext_size * sort_elt;
+
while (erel < erelend)
{
struct elf_link_sort_rela *s = (struct elf_link_sort_rela *) p;
+
(*swap_in) (abfd, erel, s->rela);
s->type = (*bed->elf_backend_reloc_type_class) (s->rela);
s->u.sym_mask = r_sym_mask;
@@ -6100,7 +7507,7 @@ elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec)
qsort (s_non_relative, count - ret, sort_elt, elf_link_sort_cmp2);
- for (lo = reldyn->map_head.link_order; lo != NULL; lo = lo->next)
+ for (lo = dynamic_relocs->map_head.link_order; lo != NULL; lo = lo->next)
if (lo->type == bfd_indirect_link_order)
{
bfd_byte *erel, *erelend;
@@ -6119,7 +7526,7 @@ elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec)
}
free (sort);
- *psec = reldyn;
+ *psec = dynamic_relocs;
return ret;
}
@@ -6657,11 +8064,6 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
if (h->dynindx != -1
&& elf_hash_table (finfo->info)->dynamic_sections_created)
{
- size_t bucketcount;
- size_t bucket;
- size_t hash_entry_size;
- bfd_byte *bucketpos;
- bfd_vma chain;
bfd_byte *esym;
sym.st_name = h->dynstr_index;
@@ -6673,17 +8075,27 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
}
bed->s->swap_symbol_out (finfo->output_bfd, &sym, esym, 0);
- bucketcount = elf_hash_table (finfo->info)->bucketcount;
- bucket = h->u.elf_hash_value % bucketcount;
- hash_entry_size
- = elf_section_data (finfo->hash_sec)->this_hdr.sh_entsize;
- bucketpos = ((bfd_byte *) finfo->hash_sec->contents
- + (bucket + 2) * hash_entry_size);
- chain = bfd_get (8 * hash_entry_size, finfo->output_bfd, bucketpos);
- bfd_put (8 * hash_entry_size, finfo->output_bfd, h->dynindx, bucketpos);
- bfd_put (8 * hash_entry_size, finfo->output_bfd, chain,
- ((bfd_byte *) finfo->hash_sec->contents
- + (bucketcount + 2 + h->dynindx) * hash_entry_size));
+ if (finfo->hash_sec != NULL)
+ {
+ size_t hash_entry_size;
+ bfd_byte *bucketpos;
+ bfd_vma chain;
+ size_t bucketcount;
+ size_t bucket;
+
+ bucketcount = elf_hash_table (finfo->info)->bucketcount;
+ bucket = h->u.elf_hash_value % bucketcount;
+
+ hash_entry_size
+ = elf_section_data (finfo->hash_sec)->this_hdr.sh_entsize;
+ bucketpos = ((bfd_byte *) finfo->hash_sec->contents
+ + (bucket + 2) * hash_entry_size);
+ chain = bfd_get (8 * hash_entry_size, finfo->output_bfd, bucketpos);
+ bfd_put (8 * hash_entry_size, finfo->output_bfd, h->dynindx, bucketpos);
+ bfd_put (8 * hash_entry_size, finfo->output_bfd, chain,
+ ((bfd_byte *) finfo->hash_sec->contents
+ + (bucketcount + 2 + h->dynindx) * hash_entry_size));
+ }
if (finfo->symver_sec != NULL && finfo->symver_sec->contents != NULL)
{
@@ -6784,14 +8196,15 @@ _bfd_elf_default_action_discarded (asection *sec)
/* Find a match between a section and a member of a section group. */
static asection *
-match_group_member (asection *sec, asection *group)
+match_group_member (asection *sec, asection *group,
+ struct bfd_link_info *info)
{
asection *first = elf_next_in_group (group);
asection *s = first;
while (s != NULL)
{
- if (bfd_elf_match_symbols_in_sections (s, sec))
+ if (bfd_elf_match_symbols_in_sections (s, sec, info))
return s;
s = elf_next_in_group (s);
@@ -6803,21 +8216,22 @@ match_group_member (asection *sec, asection *group)
}
/* Check if the kept section of a discarded section SEC can be used
- to replace it. Return the replacement if it is OK. Otherwise return
- NULL. */
+ to replace it. Return the replacement if it is OK. Otherwise return
+ NULL. */
asection *
-_bfd_elf_check_kept_section (asection *sec)
+_bfd_elf_check_kept_section (asection *sec, struct bfd_link_info *info)
{
asection *kept;
kept = sec->kept_section;
if (kept != NULL)
{
- if (elf_sec_group (sec) != NULL)
- kept = match_group_member (sec, kept);
+ if ((kept->flags & SEC_GROUP) != 0)
+ kept = match_group_member (sec, kept, info);
if (kept != NULL && sec->size != kept->size)
kept = NULL;
+ sec->kept_section = kept;
}
return kept;
}
@@ -6830,7 +8244,7 @@ _bfd_elf_check_kept_section (asection *sec)
static bfd_boolean
elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
{
- bfd_boolean (*relocate_section)
+ int (*relocate_section)
(bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **);
bfd *output_bfd;
@@ -6844,7 +8258,6 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
asection **ppsection;
asection *o;
const struct elf_backend_data *bed;
- bfd_boolean emit_relocs;
struct elf_link_hash_entry **sym_hashes;
output_bfd = finfo->output_bfd;
@@ -6857,9 +8270,6 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
if ((input_bfd->flags & DYNAMIC) != 0)
return TRUE;
- emit_relocs = (finfo->info->relocatable
- || finfo->info->emitrelocations);
-
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
if (elf_bad_symtab (input_bfd))
{
@@ -6883,6 +8293,15 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
if (isymbuf == NULL)
return FALSE;
}
+ /* evaluate_complex_relocation_symbols looks for symbols in
+ finfo->internal_syms. */
+ else if (isymbuf != NULL && locsymcount != 0)
+ {
+ bfd_elf_get_elf_syms (input_bfd, symtab_hdr, locsymcount, 0,
+ finfo->internal_syms,
+ finfo->external_syms,
+ finfo->locsym_shndx);
+ }
/* Find local symbol sections and adjust values of symbols in
SEC_MERGE sections. Write out those local symbols we know are
@@ -7020,6 +8439,9 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
return FALSE;
}
+ if (! evaluate_complex_relocation_symbols (input_bfd, finfo, locsymcount))
+ return FALSE;
+
/* Relocate the contents of each section. */
sym_hashes = elf_sym_hashes (input_bfd);
for (o = input_bfd->sections; o != NULL; o = o->next)
@@ -7063,6 +8485,7 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
Elf_Internal_Rela *internal_relocs;
bfd_vma r_type_mask;
int r_sym_shift;
+ int ret;
/* Get the swapped relocs. */
internal_relocs
@@ -7168,23 +8591,14 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
{
asection *kept;
- kept = _bfd_elf_check_kept_section (sec);
+ kept = _bfd_elf_check_kept_section (sec,
+ finfo->info);
if (kept != NULL)
{
*ps = kept;
continue;
}
}
-
- /* Remove the symbol reference from the reloc, but
- don't kill the reloc completely. This is so that
- a zero value will be written into the section,
- which may have non-zero contents put there by the
- assembler. Zero in things like an eh_frame fde
- pc_begin allows stack unwinders to recognize the
- fde as bogus. */
- rel->r_info &= r_type_mask;
- rel->r_addend = 0;
}
}
}
@@ -7209,14 +8623,17 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
corresponding to the output section, which will require
the addend to be adjusted. */
- if (! (*relocate_section) (output_bfd, finfo->info,
+ ret = (*relocate_section) (output_bfd, finfo->info,
input_bfd, o, contents,
internal_relocs,
isymbuf,
- finfo->sections))
+ finfo->sections);
+ if (!ret)
return FALSE;
- if (emit_relocs)
+ if (ret == 2
+ || finfo->info->relocatable
+ || finfo->info->emitrelocations)
{
Elf_Internal_Rela *irela;
Elf_Internal_Rela *irelaend;
@@ -7263,7 +8680,7 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
/* This is a reloc for a deleted entry or somesuch.
Turn it into an R_*_NONE reloc, at the same
offset as the last reloc. elf_eh_frame.c and
- elf_bfd_discard_info rely on reloc offsets
+ bfd_elf_discard_info rely on reloc offsets
being ordered. */
irela->r_offset = last_offset;
irela->r_info = 0;
@@ -7338,8 +8755,10 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
/* If we have discarded a section, the output
section will be the absolute section. In
- case of discarded link-once and discarded
- SEC_MERGE sections, use the kept section. */
+ case of discarded SEC_MERGE sections, use
+ the kept section. relocate_section should
+ have already handled discarded linkonce
+ sections. */
if (bfd_is_abs_section (osec)
&& sec->kept_section != NULL
&& sec->kept_section->output_section != NULL)
@@ -7351,6 +8770,24 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
if (!bfd_is_abs_section (osec))
{
r_symndx = osec->target_index;
+ if (r_symndx == 0)
+ {
+ struct elf_link_hash_table *htab;
+ asection *oi;
+
+ htab = elf_hash_table (finfo->info);
+ oi = htab->text_index_section;
+ if ((osec->flags & SEC_READONLY) == 0
+ && htab->data_index_section != NULL)
+ oi = htab->data_index_section;
+
+ if (oi != NULL)
+ {
+ irela->r_addend += osec->vma - oi->vma;
+ r_symndx = oi->target_index;
+ }
+ }
+
BFD_ASSERT (r_symndx != 0);
}
}
@@ -7446,7 +8883,8 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
/* Write out the modified section contents. */
if (bed->elf_backend_write_section
- && (*bed->elf_backend_write_section) (output_bfd, o, contents))
+ && (*bed->elf_backend_write_section) (output_bfd, finfo->info, o,
+ contents))
{
/* Section written out. */
}
@@ -7828,6 +9266,9 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
size_t relativecount = 0;
asection *reldyn = 0;
bfd_size_type amt;
+ asection *attr_section = NULL;
+ bfd_vma attr_size = 0;
+ const char *std_attrs_section;
if (! is_elf_hash_table (info->hash))
return FALSE;
@@ -7857,7 +9298,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
{
finfo.dynsym_sec = bfd_get_section_by_name (dynobj, ".dynsym");
finfo.hash_sec = bfd_get_section_by_name (dynobj, ".hash");
- BFD_ASSERT (finfo.dynsym_sec != NULL && finfo.hash_sec != NULL);
+ BFD_ASSERT (finfo.dynsym_sec != NULL);
finfo.symver_sec = bfd_get_section_by_name (dynobj, ".gnu.version");
/* Note that it is OK if symver_sec is NULL. */
}
@@ -7875,6 +9316,40 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
finfo.symbuf_count = 0;
finfo.shndxbuf_size = 0;
+ /* The object attributes have been merged. Remove the input
+ sections from the link, and set the contents of the output
+ secton. */
+ std_attrs_section = get_elf_backend_data (abfd)->obj_attrs_section;
+ for (o = abfd->sections; o != NULL; o = o->next)
+ {
+ if ((std_attrs_section && strcmp (o->name, std_attrs_section) == 0)
+ || strcmp (o->name, ".gnu.attributes") == 0)
+ {
+ for (p = o->map_head.link_order; p != NULL; p = p->next)
+ {
+ asection *input_section;
+
+ if (p->type != bfd_indirect_link_order)
+ continue;
+ input_section = p->u.indirect.section;
+ /* Hack: reset the SEC_HAS_CONTENTS flag so that
+ elf_link_input_bfd ignores this section. */
+ input_section->flags &= ~SEC_HAS_CONTENTS;
+ }
+
+ attr_size = bfd_elf_obj_attr_size (abfd);
+ if (attr_size)
+ {
+ bfd_set_section_size (abfd, o, attr_size);
+ attr_section = o;
+ /* Skip this section later on. */
+ o->map_head.link_order = NULL;
+ }
+ else
+ o->flags |= SEC_EXCLUDE;
+ }
+ }
+
/* Count up the number of relocations we will output for each output
section, so that we know the sizes of the reloc sections. We
also figure out some maximum sizes. */
@@ -7920,13 +9395,18 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
{
Elf_Internal_Rela * relocs;
- relocs = _bfd_elf_link_read_relocs (abfd, sec, NULL, NULL,
+ relocs = _bfd_elf_link_read_relocs (sec->owner, sec,
+ NULL, NULL,
info->keep_memory);
- reloc_count = (*bed->elf_backend_count_relocs) (sec, relocs);
+ if (relocs != NULL)
+ {
+ reloc_count
+ = (*bed->elf_backend_count_relocs) (sec, relocs);
- if (elf_section_data (o)->relocs != relocs)
- free (relocs);
+ if (elf_section_data (sec)->relocs != relocs)
+ free (relocs);
+ }
}
if (sec->rawsize > max_contents_size)
@@ -8141,18 +9621,19 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
elfsym.st_size = 0;
elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
elfsym.st_other = 0;
+ elfsym.st_value = 0;
for (i = 1; i < elf_numsections (abfd); i++)
{
o = bfd_section_from_elf_index (abfd, i);
if (o != NULL)
- o->target_index = bfd_get_symcount (abfd);
- elfsym.st_shndx = i;
- if (info->relocatable || o == NULL)
- elfsym.st_value = 0;
- else
- elfsym.st_value = o->vma;
- if (! elf_link_output_sym (&finfo, NULL, &elfsym, o, NULL))
- goto error_return;
+ {
+ o->target_index = bfd_get_symcount (abfd);
+ elfsym.st_shndx = i;
+ if (!info->relocatable)
+ elfsym.st_value = o->vma;
+ if (!elf_link_output_sym (&finfo, NULL, &elfsym, o, NULL))
+ goto error_return;
+ }
if (i == SHN_LORESERVE - 1)
i += SHN_HIRESERVE + 1 - SHN_LORESERVE;
}
@@ -8298,6 +9779,18 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
}
}
+ /* Free symbol buffer if needed. */
+ if (!info->reduce_memory_overheads)
+ {
+ for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
+ if (bfd_get_flavour (sub) == bfd_target_elf_flavour
+ && elf_tdata (sub)->symbuf)
+ {
+ free (elf_tdata (sub)->symbuf);
+ elf_tdata (sub)->symbuf = NULL;
+ }
+ }
+
/* Output any global symbols that got converted to local in a
version script or due to symbol visibility. We do this in a
separate step since ELF requires all local symbols to appear
@@ -8312,6 +9805,19 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
if (eoinfo.failed)
return FALSE;
+ /* If backend needs to output some local symbols not present in the hash
+ table, do it now. */
+ if (bed->elf_backend_output_arch_local_syms)
+ {
+ typedef bfd_boolean (*out_sym_func)
+ (void *, const char *, Elf_Internal_Sym *, asection *,
+ struct elf_link_hash_entry *);
+
+ if (! ((*bed->elf_backend_output_arch_local_syms)
+ (abfd, info, &finfo, (out_sym_func) elf_link_output_sym)))
+ return FALSE;
+ }
+
/* That wrote out all the local symbols. Finish up the symbol table
with the global symbols. Even if we want to strip everything we
can, we still need to deal with those global symbols that got
@@ -8603,6 +10109,9 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
case DT_HASH:
name = ".hash";
goto get_vma;
+ case DT_GNU_HASH:
+ name = ".gnu.hash";
+ goto get_vma;
case DT_STRTAB:
name = ".dynstr";
goto get_vma;
@@ -8686,8 +10195,8 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
if (dyn.d_tag == DT_TEXTREL)
{
- _bfd_error_handler
- (_("warning: creating a DT_TEXTREL in a shared object."));
+ info->callbacks->einfo
+ (_("%P: warning: creating a DT_TEXTREL in a shared object.\n"));
break;
}
}
@@ -8785,6 +10294,16 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
elf_tdata (abfd)->linker = TRUE;
+ if (attr_section)
+ {
+ bfd_byte *contents = bfd_malloc (attr_size);
+ if (contents == NULL)
+ goto error_return;
+ bfd_elf_set_obj_attr_contents (abfd, contents, attr_size);
+ bfd_set_section_contents (abfd, attr_section, contents, 0, attr_size);
+ free (contents);
+ }
+
return TRUE;
error_return:
@@ -8822,18 +10341,44 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
/* Garbage collect unused sections. */
+/* Default gc_mark_hook. */
+
+asection *
+_bfd_elf_gc_mark_hook (asection *sec,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ Elf_Internal_Rela *rel ATTRIBUTE_UNUSED,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
+{
+ if (h != NULL)
+ {
+ switch (h->root.type)
+ {
+ case bfd_link_hash_defined:
+ case bfd_link_hash_defweak:
+ return h->root.u.def.section;
+
+ case bfd_link_hash_common:
+ return h->root.u.c.p->section;
+
+ default:
+ break;
+ }
+ }
+ else
+ return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
+
+ return NULL;
+}
+
/* The mark phase of garbage collection. For a given section, mark
it and any sections in this section's group, and all the sections
which define symbols to which it refers. */
-typedef asection * (*gc_mark_hook_fn)
- (asection *, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *, Elf_Internal_Sym *);
-
bfd_boolean
_bfd_elf_gc_mark (struct bfd_link_info *info,
asection *sec,
- gc_mark_hook_fn gc_mark_hook)
+ elf_gc_mark_hook_fn gc_mark_hook)
{
bfd_boolean ret;
bfd_boolean is_eh;
@@ -8954,7 +10499,8 @@ _bfd_elf_gc_mark (struct bfd_link_info *info,
/* Sweep symbols in swept sections. Called via elf_link_hash_traverse. */
-struct elf_gc_sweep_symbol_info {
+struct elf_gc_sweep_symbol_info
+{
struct bfd_link_info *info;
void (*hide_symbol) (struct bfd_link_info *, struct elf_link_hash_entry *,
bfd_boolean);
@@ -9017,6 +10563,9 @@ elf_gc_sweep (bfd *abfd, struct bfd_link_info *info)
to remove a section from the output. */
o->flags |= SEC_EXCLUDE;
+ if (info->print_gc_sections && o->size != 0)
+ _bfd_error_handler (_("Removing unused section '%s' in file '%B'"), sub, o->name);
+
/* But we also have to update some of the relocation
info we collected before. */
if (gc_sweep_hook
@@ -9198,9 +10747,7 @@ bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info)
{
bfd_boolean ok = TRUE;
bfd *sub;
- asection * (*gc_mark_hook)
- (asection *, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *h, Elf_Internal_Sym *);
+ elf_gc_mark_hook_fn gc_mark_hook;
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
if (!bed->can_gc_sections
@@ -9242,11 +10789,15 @@ bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info)
continue;
for (o = sub->sections; o != NULL; o = o->next)
- if ((o->flags & SEC_KEEP) != 0 && !o->gc_mark)
+ if ((o->flags & (SEC_EXCLUDE | SEC_KEEP)) == SEC_KEEP && !o->gc_mark)
if (!_bfd_elf_gc_mark (info, o, gc_mark_hook))
return FALSE;
}
+ /* Allow the backend to mark additional target specific sections. */
+ if (bed->gc_mark_extra_sections)
+ bed->gc_mark_extra_sections(info, gc_mark_hook);
+
/* ... again for sections marked from eh_frame. */
for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
{
@@ -9262,30 +10813,38 @@ bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info)
easily due to needing special relocs to handle the
difference of two symbols in separate sections.
Don't keep code sections referenced by .eh_frame. */
+#define TEXT_PREFIX ".text."
+#define TEXT_PREFIX2 ".gnu.linkonce.t."
+#define GCC_EXCEPT_TABLE_PREFIX ".gcc_except_table."
for (o = sub->sections; o != NULL; o = o->next)
if (!o->gc_mark && o->gc_mark_from_eh && (o->flags & SEC_CODE) == 0)
{
- if (strncmp (o->name, ".gcc_except_table.", 18) == 0)
+ if (CONST_STRNEQ (o->name, GCC_EXCEPT_TABLE_PREFIX))
{
- unsigned long len;
char *fn_name;
+ const char *sec_name;
asection *fn_text;
-
- len = strlen (o->name + 18) + 1;
- fn_name = bfd_malloc (len + 16);
+ unsigned o_name_prefix_len , fn_name_prefix_len, tmp;
+
+ o_name_prefix_len = strlen (GCC_EXCEPT_TABLE_PREFIX);
+ sec_name = o->name + o_name_prefix_len;
+ fn_name_prefix_len = strlen (TEXT_PREFIX);
+ tmp = strlen (TEXT_PREFIX2);
+ if (tmp > fn_name_prefix_len)
+ fn_name_prefix_len = tmp;
+ fn_name
+ = bfd_malloc (fn_name_prefix_len + strlen (sec_name) + 1);
if (fn_name == NULL)
return FALSE;
/* Try the first prefix. */
- memcpy (fn_name, ".text.", 6);
- memcpy (fn_name + 6, o->name + 18, len);
+ sprintf (fn_name, "%s%s", TEXT_PREFIX, sec_name);
fn_text = bfd_get_section_by_name (sub, fn_name);
/* Try the second prefix. */
if (fn_text == NULL)
{
- memcpy (fn_name, ".gnu.linkonce.t.", 16);
- memcpy (fn_name + 16, o->name + 18, len);
+ sprintf (fn_name, "%s%s", TEXT_PREFIX2, sec_name);
fn_text = bfd_get_section_by_name (sub, fn_name);
}
@@ -9637,12 +11196,15 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info)
if ((abfd->flags & DYNAMIC) != 0)
continue;
- eh = bfd_get_section_by_name (abfd, ".eh_frame");
- if (info->relocatable
- || (eh != NULL
+ eh = NULL;
+ if (!info->relocatable)
+ {
+ eh = bfd_get_section_by_name (abfd, ".eh_frame");
+ if (eh != NULL
&& (eh->size == 0
- || bfd_is_abs_section (eh->output_section))))
- eh = NULL;
+ || bfd_is_abs_section (eh->output_section)))
+ eh = NULL;
+ }
stab = bfd_get_section_by_name (abfd, ".stab");
if (stab != NULL
@@ -9683,7 +11245,10 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info)
cookie.locsymcount, 0,
NULL, NULL, NULL);
if (cookie.locsyms == NULL)
- return FALSE;
+ {
+ info->callbacks->einfo (_("%P%X: can not read symbols: %E\n"));
+ return FALSE;
+ }
}
if (stab != NULL)
@@ -9753,39 +11318,28 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info)
}
void
-_bfd_elf_section_already_linked (bfd *abfd, struct bfd_section * sec)
+_bfd_elf_section_already_linked (bfd *abfd, struct bfd_section *sec,
+ struct bfd_link_info *info)
{
flagword flags;
const char *name, *p;
struct bfd_section_already_linked *l;
struct bfd_section_already_linked_hash_entry *already_linked_list;
- asection *group;
- /* A single member comdat group section may be discarded by a
- linkonce section. See below. */
if (sec->output_section == bfd_abs_section_ptr)
return;
flags = sec->flags;
- /* Check if it belongs to a section group. */
- group = elf_sec_group (sec);
-
- /* Return if it isn't a linkonce section nor a member of a group. A
- comdat group section also has SEC_LINK_ONCE set. */
- if ((flags & SEC_LINK_ONCE) == 0 && group == NULL)
+ /* Return if it isn't a linkonce section. A comdat group section
+ also has SEC_LINK_ONCE set. */
+ if ((flags & SEC_LINK_ONCE) == 0)
return;
- if (group)
- {
- /* If this is the member of a single member comdat group, check if
- the group should be discarded. */
- if (elf_next_in_group (sec) == sec
- && (group->flags & SEC_LINK_ONCE) != 0)
- sec = group;
- else
- return;
- }
+ /* Don't put group member sections on our list of already linked
+ sections. They are handled as a group via their group section. */
+ if (elf_sec_group (sec) != NULL)
+ return;
/* FIXME: When doing a relocatable link, we may have trouble
copying relocations in other sections that refer to local symbols
@@ -9806,7 +11360,7 @@ _bfd_elf_section_already_linked (bfd *abfd, struct bfd_section * sec)
name = bfd_get_section_name (abfd, sec);
- if (strncmp (name, ".gnu.linkonce.", sizeof (".gnu.linkonce.") - 1) == 0
+ if (CONST_STRNEQ (name, ".gnu.linkonce.")
&& (p = strchr (name + sizeof (".gnu.linkonce.") - 1, '.')) != NULL)
p++;
else
@@ -9816,11 +11370,8 @@ _bfd_elf_section_already_linked (bfd *abfd, struct bfd_section * sec)
for (l = already_linked_list->entry; l != NULL; l = l->next)
{
- /* We may have 3 different sections on the list: group section,
- comdat section and linkonce section. SEC may be a linkonce or
- group section. We match a group section with a group section,
- a linkonce section with a linkonce section, and ignore comdat
- section. */
+ /* We may have 2 different types of sections on the list: group
+ sections and linkonce sections. Match like sections. */
if ((flags & SEC_GROUP) == (l->sec->flags & SEC_GROUP)
&& strcmp (name, l->sec->name) == 0
&& bfd_coff_get_comdat_section (l->sec->owner, l->sec) == NULL)
@@ -9908,31 +11459,28 @@ _bfd_elf_section_already_linked (bfd *abfd, struct bfd_section * sec)
}
}
- if (group)
+ /* A single member comdat group section may be discarded by a
+ linkonce section and vice versa. */
+
+ if ((flags & SEC_GROUP) != 0)
{
- /* If this is the member of a single member comdat group and the
- group hasn't be discarded, we check if it matches a linkonce
- section. We only record the discarded comdat group. Otherwise
- the undiscarded group will be discarded incorrectly later since
- itself has been recorded. */
- for (l = already_linked_list->entry; l != NULL; l = l->next)
- if ((l->sec->flags & SEC_GROUP) == 0
- && bfd_coff_get_comdat_section (l->sec->owner, l->sec) == NULL
- && bfd_elf_match_symbols_in_sections (l->sec,
- elf_next_in_group (sec)))
- {
- elf_next_in_group (sec)->output_section = bfd_abs_section_ptr;
- elf_next_in_group (sec)->kept_section = l->sec;
- group->output_section = bfd_abs_section_ptr;
- break;
- }
- if (l == NULL)
- return;
+ asection *first = elf_next_in_group (sec);
+
+ if (first != NULL && elf_next_in_group (first) == first)
+ /* Check this single member group against linkonce sections. */
+ for (l = already_linked_list->entry; l != NULL; l = l->next)
+ if ((l->sec->flags & SEC_GROUP) == 0
+ && bfd_coff_get_comdat_section (l->sec->owner, l->sec) == NULL
+ && bfd_elf_match_symbols_in_sections (l->sec, first, info))
+ {
+ first->output_section = bfd_abs_section_ptr;
+ first->kept_section = l->sec;
+ sec->output_section = bfd_abs_section_ptr;
+ break;
+ }
}
else
- /* There is no direct match. But for linkonce section, we should
- check if there is a match with comdat group member. We always
- record the linkonce section, discarded or not. */
+ /* Check this linkonce section against single member groups. */
for (l = already_linked_list->entry; l != NULL; l = l->next)
if (l->sec->flags & SEC_GROUP)
{
@@ -9940,10 +11488,10 @@ _bfd_elf_section_already_linked (bfd *abfd, struct bfd_section * sec)
if (first != NULL
&& elf_next_in_group (first) == first
- && bfd_elf_match_symbols_in_sections (first, sec))
+ && bfd_elf_match_symbols_in_sections (first, sec, info))
{
sec->output_section = bfd_abs_section_ptr;
- sec->kept_section = l->sec;
+ sec->kept_section = first;
break;
}
}
diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c
index b1211f0c65e5..e0994a0dd068 100644
--- a/bfd/elfn32-mips.c
+++ b/bfd/elfn32-mips.c
@@ -1,6 +1,6 @@
/* MIPS-specific support for 32-bit ELF
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
Most of the information added by Ian Lance Taylor, Cygnus Support,
<ian@cygnus.com>.
@@ -29,8 +29,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
different MIPS ELF from other targets. This matters when linking.
This file supports both, switching at runtime. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "bfdlink.h"
#include "genlink.h"
@@ -61,8 +61,6 @@ static bfd_reloc_status_type gprel32_with_gp
(bfd *, asymbol *, arelent *, asection *, bfd_boolean, void *, bfd_vma);
static bfd_reloc_status_type mips_elf_shift6_reloc
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type mips16_jump_reloc
- (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
static bfd_reloc_status_type mips16_gprel_reloc
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
@@ -756,6 +754,21 @@ static reloc_howto_type elf_mips_howto_table_rel[] =
0x0000ffff, /* src_mask */
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
+
+ /* 32 bit relocation with no addend. */
+ HOWTO (R_MIPS_GLOB_DAT, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ _bfd_mips_elf_generic_reloc, /* special_function */
+ "R_MIPS_GLOB_DAT", /* name */
+ FALSE, /* partial_inplace */
+ 0x0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
};
/* The relocation table used for SHT_RELA sections. */
@@ -1429,6 +1442,21 @@ static reloc_howto_type elf_mips_howto_table_rela[] =
0x0000ffff, /* src_mask */
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
+
+ /* 32 bit relocation with no addend. */
+ HOWTO (R_MIPS_GLOB_DAT, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ _bfd_mips_elf_generic_reloc, /* special_function */
+ "R_MIPS_GLOB_DAT", /* name */
+ FALSE, /* partial_inplace */
+ 0x0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
};
static reloc_howto_type elf_mips16_howto_table_rel[] =
@@ -1444,7 +1472,7 @@ static reloc_howto_type elf_mips16_howto_table_rel[] =
/* This needs complex overflow
detection, because the upper four
bits must match the PC. */
- mips16_jump_reloc, /* special_function */
+ _bfd_mips_elf_generic_reloc, /* special_function */
"R_MIPS16_26", /* name */
TRUE, /* partial_inplace */
0x3ffffff, /* src_mask */
@@ -1516,7 +1544,7 @@ static reloc_howto_type elf_mips16_howto_table_rela[] =
/* This needs complex overflow
detection, because the upper four
bits must match the PC. */
- mips16_jump_reloc, /* special_function */
+ _bfd_mips_elf_generic_reloc, /* special_function */
"R_MIPS16_26", /* name */
FALSE, /* partial_inplace */
0x3ffffff, /* src_mask */
@@ -1901,28 +1929,6 @@ mips_elf_shift6_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
error_message);
}
-/* Handle a mips16 jump. */
-
-static bfd_reloc_status_type
-mips16_jump_reloc (bfd *abfd ATTRIBUTE_UNUSED,
- arelent *reloc_entry ATTRIBUTE_UNUSED,
- asymbol *symbol ATTRIBUTE_UNUSED,
- void *data ATTRIBUTE_UNUSED,
- asection *input_section, bfd *output_bfd ATTRIBUTE_UNUSED,
- char **error_message ATTRIBUTE_UNUSED)
-{
- static bfd_boolean warned = FALSE;
-
- /* FIXME. */
- if (! warned)
- (*_bfd_error_handler)
- (_("Linking mips16 objects into %s format is not supported"),
- bfd_get_target (input_section->output_section->owner));
- warned = TRUE;
-
- return bfd_reloc_undefined;
-}
-
/* Handle a mips16 GP relative reloc. */
static bfd_reloc_status_type
@@ -2075,6 +2081,40 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
}
}
+static reloc_howto_type *
+bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (elf_mips_howto_table_rela)
+ / sizeof (elf_mips_howto_table_rela[0]));
+ i++)
+ if (elf_mips_howto_table_rela[i].name != NULL
+ && strcasecmp (elf_mips_howto_table_rela[i].name, r_name) == 0)
+ return &elf_mips_howto_table_rela[i];
+
+ for (i = 0;
+ i < (sizeof (elf_mips16_howto_table_rela)
+ / sizeof (elf_mips16_howto_table_rela[0]));
+ i++)
+ if (elf_mips16_howto_table_rela[i].name != NULL
+ && strcasecmp (elf_mips16_howto_table_rela[i].name, r_name) == 0)
+ return &elf_mips16_howto_table_rela[i];
+
+ if (strcasecmp (elf_mips_gnu_vtinherit_howto.name, r_name) == 0)
+ return &elf_mips_gnu_vtinherit_howto;
+ if (strcasecmp (elf_mips_gnu_vtentry_howto.name, r_name) == 0)
+ return &elf_mips_gnu_vtentry_howto;
+ if (strcasecmp (elf_mips_gnu_rel16_s2.name, r_name) == 0)
+ return &elf_mips_gnu_rel16_s2;
+ if (strcasecmp (elf_mips_gnu_rela16_s2.name, r_name) == 0)
+ return &elf_mips_gnu_rela16_s2;
+
+ return NULL;
+}
+
/* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */
static reloc_howto_type *
@@ -2317,12 +2357,15 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
#define elf_backend_create_dynamic_sections \
_bfd_mips_elf_create_dynamic_sections
#define elf_backend_check_relocs _bfd_mips_elf_check_relocs
+#define elf_backend_merge_symbol_attribute \
+ _bfd_mips_elf_merge_symbol_attribute
#define elf_backend_adjust_dynamic_symbol \
_bfd_mips_elf_adjust_dynamic_symbol
#define elf_backend_always_size_sections \
_bfd_mips_elf_always_size_sections
#define elf_backend_size_dynamic_sections \
_bfd_mips_elf_size_dynamic_sections
+#define elf_backend_init_index_section _bfd_elf_init_1_index_section
#define elf_backend_relocate_section _bfd_mips_elf_relocate_section
#define elf_backend_finish_dynamic_symbol \
_bfd_mips_elf_finish_dynamic_symbol
@@ -2380,10 +2423,8 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
#define TARGET_BIG_SYM bfd_elf32_nbigmips_vec
#define TARGET_BIG_NAME "elf32-nbigmips"
-/* The SVR4 MIPS ABI says that this should be 0x10000, but Irix 5 uses
- a value of 0x1000, and we are compatible.
- FIXME: How does this affect NewABI? */
-#define ELF_MAXPAGESIZE 0x1000
+#define ELF_MAXPAGESIZE 0x10000
+#define ELF_COMMONPAGESIZE 0x1000
#include "elf32-target.h"
@@ -2394,15 +2435,15 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
#undef TARGET_BIG_NAME
#undef ELF_MAXPAGESIZE
+#undef ELF_COMMONPAGESIZE
#define TARGET_LITTLE_SYM bfd_elf32_ntradlittlemips_vec
#define TARGET_LITTLE_NAME "elf32-ntradlittlemips"
#define TARGET_BIG_SYM bfd_elf32_ntradbigmips_vec
#define TARGET_BIG_NAME "elf32-ntradbigmips"
-/* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses
- page sizes of up to that limit, so we need to respect it. */
#define ELF_MAXPAGESIZE 0x10000
+#define ELF_COMMONPAGESIZE 0x1000
#define elf32_bed elf32_tradbed
/* Include the target file again for this target. */
diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c
index 6b3257afdf13..68f2010c6192 100644
--- a/bfd/elfxx-ia64.c
+++ b/bfd/elfxx-ia64.c
@@ -1,5 +1,5 @@
/* IA-64 support for 64-bit ELF
- Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
@@ -19,8 +19,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "opcode/ia64.h"
@@ -215,10 +215,6 @@ static bfd_boolean elfNN_ia64_add_symbol_hook
PARAMS ((bfd *abfd, struct bfd_link_info *info, Elf_Internal_Sym *sym,
const char **namep, flagword *flagsp, asection **secp,
bfd_vma *valp));
-static int elfNN_ia64_additional_program_headers
- PARAMS ((bfd *abfd));
-static bfd_boolean elfNN_ia64_modify_segment_map
- PARAMS ((bfd *, struct bfd_link_info *));
static bfd_boolean elfNN_ia64_is_local_label_name
PARAMS ((bfd *abfd, const char *name));
static bfd_boolean elfNN_ia64_dynamic_symbol_p
@@ -617,6 +613,22 @@ elfNN_ia64_reloc_type_lookup (abfd, bfd_code)
return lookup_howto (rtype);
}
+static reloc_howto_type *
+elfNN_ia64_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (ia64_howto_table) / sizeof (ia64_howto_table[0]);
+ i++)
+ if (ia64_howto_table[i].name != NULL
+ && strcasecmp (ia64_howto_table[i].name, r_name) == 0)
+ return &ia64_howto_table[i];
+
+ return NULL;
+}
+
/* Given a ELF reloc, return the matching HOWTO structure. */
static void
@@ -1428,22 +1440,15 @@ elfNN_ia64_relax_ldxmov (contents, off)
/* Return TRUE if NAME is an unwind table section name. */
static inline bfd_boolean
-is_unwind_section_name (abfd, name)
- bfd *abfd;
- const char *name;
+is_unwind_section_name (bfd *abfd, const char *name)
{
- size_t len1, len2, len3;
-
if (elfNN_ia64_hpux_vec (abfd->xvec)
&& !strcmp (name, ELF_STRING_ia64_unwind_hdr))
return FALSE;
- len1 = sizeof (ELF_STRING_ia64_unwind) - 1;
- len2 = sizeof (ELF_STRING_ia64_unwind_info) - 1;
- len3 = sizeof (ELF_STRING_ia64_unwind_once) - 1;
- return ((strncmp (name, ELF_STRING_ia64_unwind, len1) == 0
- && strncmp (name, ELF_STRING_ia64_unwind_info, len2) != 0)
- || strncmp (name, ELF_STRING_ia64_unwind_once, len3) == 0);
+ return ((CONST_STRNEQ (name, ELF_STRING_ia64_unwind)
+ && ! CONST_STRNEQ (name, ELF_STRING_ia64_unwind_info))
+ || CONST_STRNEQ (name, ELF_STRING_ia64_unwind_once));
}
/* Handle an IA-64 specific section when reading an object file. This
@@ -1637,8 +1642,8 @@ elfNN_ia64_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
/* Return the number of additional phdrs we will need. */
static int
-elfNN_ia64_additional_program_headers (abfd)
- bfd *abfd;
+elfNN_ia64_additional_program_headers (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
asection *s;
int ret = 0;
@@ -1657,9 +1662,8 @@ elfNN_ia64_additional_program_headers (abfd)
}
static bfd_boolean
-elfNN_ia64_modify_segment_map (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
+elfNN_ia64_modify_segment_map (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
struct elf_segment_map *m, **pm;
Elf_Internal_Shdr *hdr;
@@ -1742,17 +1746,30 @@ elfNN_ia64_modify_segment_map (abfd, info)
}
}
- /* Turn on PF_IA_64_NORECOV if needed. This involves traversing all of
- the input sections for each output section in the segment and testing
- for SHF_IA_64_NORECOV on each. */
- for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
+ return TRUE;
+}
+
+/* Turn on PF_IA_64_NORECOV if needed. This involves traversing all of
+ the input sections for each output section in the segment and testing
+ for SHF_IA_64_NORECOV on each. */
+
+static bfd_boolean
+elfNN_ia64_modify_program_headers (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
+{
+ struct elf_obj_tdata *tdata = elf_tdata (abfd);
+ struct elf_segment_map *m;
+ Elf_Internal_Phdr *p;
+
+ for (p = tdata->phdr, m = tdata->segment_map; m != NULL; m = m->next, p++)
if (m->p_type == PT_LOAD)
{
int i;
for (i = m->count - 1; i >= 0; --i)
{
struct bfd_link_order *order = m->sections[i]->map_head.link_order;
- while (order)
+
+ while (order != NULL)
{
if (order->type == bfd_indirect_link_order)
{
@@ -1760,7 +1777,7 @@ elfNN_ia64_modify_segment_map (abfd, info)
bfd_vma flags = elf_section_data(is)->this_hdr.sh_flags;
if (flags & SHF_IA_64_NORECOV)
{
- m->p_flags |= PF_IA_64_NORECOV;
+ p->p_flags |= PF_IA_64_NORECOV;
goto found;
}
}
@@ -2208,7 +2225,7 @@ addend_compare (const void *xp, const void *yp)
const struct elfNN_ia64_dyn_sym_info *y
= (const struct elfNN_ia64_dyn_sym_info *) yp;
- return x->addend - y->addend;
+ return x->addend < y->addend ? -1 : x->addend > y->addend ? 1 : 0;
}
/* Sort elfNN_ia64_dyn_sym_info array and remove duplicates. */
@@ -2217,37 +2234,62 @@ static unsigned int
sort_dyn_sym_info (struct elfNN_ia64_dyn_sym_info *info,
unsigned int count)
{
- bfd_vma curr, prev;
- unsigned int i, dup, diff, dest, src, len;
+ bfd_vma curr, prev, got_offset;
+ unsigned int i, kept, dup, diff, dest, src, len;
qsort (info, count, sizeof (*info), addend_compare);
/* Find the first duplicate. */
prev = info [0].addend;
+ got_offset = info [0].got_offset;
for (i = 1; i < count; i++)
{
curr = info [i].addend;
if (curr == prev)
- break;
+ {
+ /* For duplicates, make sure that GOT_OFFSET is valid. */
+ if (got_offset == (bfd_vma) -1)
+ got_offset = info [i].got_offset;
+ break;
+ }
+ got_offset = info [i].got_offset;
prev = curr;
}
+ /* We may move a block of elements to here. */
+ dest = i++;
+
/* Remove duplicates. */
if (i < count)
{
- /* We need to move a block of elements to here. */
- dest = i++;
while (i < count)
{
+ /* For duplicates, make sure that the kept one has a valid
+ got_offset. */
+ kept = dest - 1;
+ if (got_offset != (bfd_vma) -1)
+ info [kept].got_offset = got_offset;
+
curr = info [i].addend;
+ got_offset = info [i].got_offset;
/* Move a block of elements whose first one is different from
the previous. */
if (curr == prev)
{
for (src = i + 1; src < count; src++)
- if (info [src].addend != curr)
- break;
+ {
+ if (info [src].addend != curr)
+ break;
+ /* For duplicates, make sure that GOT_OFFSET is
+ valid. */
+ if (got_offset == (bfd_vma) -1)
+ got_offset = info [src].got_offset;
+ }
+
+ /* Make sure that the kept one has a valid got_offset. */
+ if (got_offset != (bfd_vma) -1)
+ info [kept].got_offset = got_offset;
}
else
src = i;
@@ -2255,13 +2297,25 @@ sort_dyn_sym_info (struct elfNN_ia64_dyn_sym_info *info,
if (src >= count)
break;
- /* Find the next duplicate. */
+ /* Find the next duplicate. SRC will be kept. */
prev = info [src].addend;
+ got_offset = info [src].got_offset;
for (dup = src + 1; dup < count; dup++)
{
curr = info [dup].addend;
if (curr == prev)
- break;
+ {
+ /* Make sure that got_offset is valid. */
+ if (got_offset == (bfd_vma) -1)
+ got_offset = info [dup].got_offset;
+
+ /* For duplicates, make sure that the kept one has
+ a valid got_offset. */
+ if (got_offset != (bfd_vma) -1)
+ info [dup - 1].got_offset = got_offset;
+ break;
+ }
+ got_offset = info [dup].got_offset;
prev = curr;
}
@@ -2272,20 +2326,41 @@ sort_dyn_sym_info (struct elfNN_ia64_dyn_sym_info *info,
if (len == 1 && dup < count)
{
/* If we only move 1 element, we combine it with the next
- one. Find the next different one. */
+ one. There must be at least a duplicate. Find the
+ next different one. */
for (diff = dup + 1, src++; diff < count; diff++, src++)
- if (info [diff].addend != curr)
- break;
+ {
+ if (info [diff].addend != curr)
+ break;
+ /* Make sure that got_offset is valid. */
+ if (got_offset == (bfd_vma) -1)
+ got_offset = info [diff].got_offset;
+ }
+
+ /* Makre sure that the last duplicated one has an valid
+ offset. */
+ BFD_ASSERT (curr == prev);
+ if (got_offset != (bfd_vma) -1)
+ info [diff - 1].got_offset = got_offset;
if (diff < count)
{
- /* Find the next duplicate. */
+ /* Find the next duplicate. Track the current valid
+ offset. */
prev = info [diff].addend;
+ got_offset = info [diff].got_offset;
for (dup = diff + 1; dup < count; dup++)
{
curr = info [dup].addend;
if (curr == prev)
- break;
+ {
+ /* For duplicates, make sure that GOT_OFFSET
+ is valid. */
+ if (got_offset == (bfd_vma) -1)
+ got_offset = info [dup].got_offset;
+ break;
+ }
+ got_offset = info [dup].got_offset;
prev = curr;
diff++;
}
@@ -2302,6 +2377,19 @@ sort_dyn_sym_info (struct elfNN_ia64_dyn_sym_info *info,
count = dest;
}
+ else
+ {
+ /* When we get here, either there is no duplicate at all or
+ the only duplicate is the last element. */
+ if (dest < count)
+ {
+ /* If the last element is a duplicate, make sure that the
+ kept one has a valid got_offset. We also update count. */
+ if (got_offset != (bfd_vma) -1)
+ info [dest - 1].got_offset = got_offset;
+ count = dest;
+ }
+ }
return count;
}
@@ -2424,6 +2512,7 @@ has_space:
/* Append the new one to the array. */
dyn_i = info + count;
memset (dyn_i, 0, sizeof (*dyn_i));
+ dyn_i->got_offset = (bfd_vma) -1;
dyn_i->addend = addend;
/* We increment count only since the new ones are unsorted and
@@ -2613,10 +2702,10 @@ get_reloc_section (abfd, ia64_info, sec, create)
if (srel_name == NULL)
return NULL;
- BFD_ASSERT ((strncmp (srel_name, ".rela", 5) == 0
+ BFD_ASSERT ((CONST_STRNEQ (srel_name, ".rela")
&& strcmp (bfd_get_section_name (abfd, sec),
srel_name+5) == 0)
- || (strncmp (srel_name, ".rel", 4) == 0
+ || (CONST_STRNEQ (srel_name, ".rel")
&& strcmp (bfd_get_section_name (abfd, sec),
srel_name+4) == 0));
@@ -2733,7 +2822,7 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
have yet been processed. Do something with what we know, as
this may help reduce memory usage and processing time later. */
maybe_dynamic = (h && ((!info->executable
- && (!info->symbolic
+ && (!SYMBOLIC_BIND (info, h)
|| info->unresolved_syms_in_shared_libs == RM_IGNORE))
|| !h->def_regular
|| h->root.type == bfd_link_hash_defweak));
@@ -2905,7 +2994,7 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
have yet been processed. Do something with what we know, as
this may help reduce memory usage and processing time later. */
maybe_dynamic = (h && ((!info->executable
- && (!info->symbolic
+ && (!SYMBOLIC_BIND (info, h)
|| info->unresolved_syms_in_shared_libs == RM_IGNORE))
|| !h->def_regular
|| h->root.type == bfd_link_hash_defweak));
@@ -3694,7 +3783,7 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
if (strcmp (name, ".got.plt") == 0)
strip = FALSE;
- else if (strncmp (name, ".rel", 4) == 0)
+ else if (CONST_STRNEQ (name, ".rel"))
{
if (!strip)
{
@@ -4358,7 +4447,7 @@ elfNN_ia64_choose_gp (abfd, info)
continue;
lo = os->vma;
- hi = os->vma + os->size;
+ hi = os->vma + (os->rawsize ? os->rawsize : os->size);
if (hi < lo)
hi = (bfd_vma) -1;
@@ -4556,7 +4645,6 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
elf_section_data(input_section->output_section)
->this_hdr.sh_flags |= flags;
- return TRUE;
}
gp_val = _bfd_get_gp_value (output_bfd);
@@ -4605,7 +4693,8 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
sym_sec = local_sections[r_symndx];
msec = sym_sec;
value = _bfd_elf_rela_local_sym (output_bfd, sym, &msec, rel);
- if ((sym_sec->flags & SEC_MERGE)
+ if (!info->relocatable
+ && (sym_sec->flags & SEC_MERGE) != 0
&& ELF_ST_TYPE (sym->st_info) == STT_SECTION
&& sym_sec->sec_info_type == ELF_INFO_TYPE_MERGE)
{
@@ -4634,9 +4723,15 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
- sym_sec->output_section->vma
- sym_sec->output_offset;
}
-
- qsort (loc_h->info, loc_h->count,
- sizeof (*loc_h->info), addend_compare);
+
+ /* We may have introduced duplicated entries. We need
+ to remove them properly. */
+ count = sort_dyn_sym_info (loc_h->info, loc_h->count);
+ if (count != loc_h->count)
+ {
+ loc_h->count = count;
+ loc_h->sorted_count = count;
+ }
loc_h->sec_merge_done = 1;
}
@@ -4659,6 +4754,20 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
continue;
}
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ if (sym_sec != NULL && elf_discarded_section (sym_sec))
+ {
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
hit_addr = contents + rel->r_offset;
value += rel->r_addend;
dynamic_symbol_p = elfNN_ia64_dynamic_symbol_p (h, info, r_type);
@@ -4990,13 +5099,6 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
case R_IA64_SEGREL32LSB:
case R_IA64_SEGREL64MSB:
case R_IA64_SEGREL64LSB:
- if (r_symndx == 0)
- {
- /* If the input section was discarded from the output, then
- do nothing. */
- r = bfd_reloc_ok;
- }
- else
{
struct elf_segment_map *m;
Elf_Internal_Phdr *p;
@@ -5561,9 +5663,9 @@ elfNN_ia64_reloc_type_class (rela)
static const struct bfd_elf_special_section elfNN_ia64_special_sections[] =
{
- { ".sbss", 5, -1, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT },
- { ".sdata", 6, -1, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".sbss"), -1, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT },
+ { STRING_COMMA_LEN (".sdata"), -1, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT },
+ { NULL, 0, 0, 0, 0 }
};
static bfd_boolean
@@ -5590,7 +5692,7 @@ elfNN_ia64_object_p (bfd *abfd)
if (elf_sec_group (sec) == NULL
&& ((sec->flags & (SEC_LINK_ONCE | SEC_CODE | SEC_GROUP))
== (SEC_LINK_ONCE | SEC_CODE))
- && strncmp (sec->name, ".gnu.linkonce.t.", 16) == 0)
+ && CONST_STRNEQ (sec->name, ".gnu.linkonce.t."))
{
name = sec->name + 16;
@@ -5673,7 +5775,7 @@ elfNN_hpux_post_process_headers (abfd, info)
{
Elf_Internal_Ehdr *i_ehdrp = elf_elfheader (abfd);
- i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_HPUX;
+ i_ehdrp->e_ident[EI_OSABI] = get_elf_backend_data (abfd)->elf_osabi;
i_ehdrp->e_ident[EI_ABIVERSION] = 1;
}
@@ -5717,6 +5819,7 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED,
#define ELF_MACHINE_ALT1 1999 /* EAS2.3 */
#define ELF_MACHINE_ALT2 1998 /* EAS2.2 */
#define ELF_MAXPAGESIZE 0x10000 /* 64KB */
+#define ELF_COMMONPAGESIZE 0x4000 /* 16KB */
#define elf_backend_section_from_shdr \
elfNN_ia64_section_from_shdr
@@ -5732,11 +5835,15 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED,
elfNN_ia64_additional_program_headers
#define elf_backend_modify_segment_map \
elfNN_ia64_modify_segment_map
+#define elf_backend_modify_program_headers \
+ elfNN_ia64_modify_program_headers
#define elf_info_to_howto \
elfNN_ia64_info_to_howto
#define bfd_elfNN_bfd_reloc_type_lookup \
elfNN_ia64_reloc_type_lookup
+#define bfd_elfNN_bfd_reloc_name_lookup \
+ elfNN_ia64_reloc_name_lookup
#define bfd_elfNN_bfd_is_local_label_name \
elfNN_ia64_is_local_label_name
#define bfd_elfNN_bfd_relax_section \
@@ -5758,6 +5865,8 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED,
elfNN_ia64_adjust_dynamic_symbol
#define elf_backend_size_dynamic_sections \
elfNN_ia64_size_dynamic_sections
+#define elf_backend_omit_section_dynsym \
+ ((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) bfd_true)
#define elf_backend_relocate_section \
elfNN_ia64_relocate_section
#define elf_backend_finish_dynamic_symbol \
@@ -5789,6 +5898,7 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED,
#define elf_backend_reloc_type_class elfNN_ia64_reloc_type_class
#define elf_backend_rela_normal 1
#define elf_backend_special_sections elfNN_ia64_special_sections
+#define elf_backend_default_execstack 0
/* FIXME: PR 290: The Intel C compiler generates SHT_IA_64_UNWIND with
SHF_LINK_ORDER. But it doesn't set the sh_link or sh_info fields.
@@ -5823,7 +5933,10 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED,
#define elf_backend_want_p_paddr_set_to_zero 1
#undef ELF_MAXPAGESIZE
-#define ELF_MAXPAGESIZE 0x1000 /* 1K */
+#define ELF_MAXPAGESIZE 0x1000 /* 4K */
+#undef ELF_COMMONPAGESIZE
+#undef ELF_OSABI
+#define ELF_OSABI ELFOSABI_HPUX
#undef elfNN_bed
#define elfNN_bed elfNN_ia64_hpux_bed
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 39420a63ae74..28a4e8b333be 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -1,6 +1,6 @@
/* MIPS-specific support for ELF
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Most of the information added by Ian Lance Taylor, Cygnus Support,
<ian@cygnus.com>.
@@ -27,8 +27,8 @@
/* This file handles functionality common to the different MIPS ABI's. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "libiberty.h"
#include "elf-bfd.h"
@@ -488,12 +488,12 @@ typedef struct runtime_pdr {
static struct mips_got_entry *mips_elf_create_local_got_entry
(bfd *, struct bfd_link_info *, bfd *, struct mips_got_info *, asection *,
- asection *, bfd_vma, unsigned long, struct mips_elf_link_hash_entry *, int);
+ bfd_vma, unsigned long, struct mips_elf_link_hash_entry *, int);
static bfd_boolean mips_elf_sort_hash_table_f
(struct mips_elf_link_hash_entry *, void *);
static bfd_vma mips_elf_high
(bfd_vma);
-static bfd_boolean mips_elf_stub_section_p
+static bfd_boolean mips16_stub_section_p
(bfd *, asection *);
static bfd_boolean mips_elf_create_dynamic_relocation
(bfd *, struct bfd_link_info *, const Elf_Internal_Rela *,
@@ -709,6 +709,10 @@ static bfd *reldyn_sorting_bfd;
#define FN_STUB ".mips16.fn."
#define CALL_STUB ".mips16.call."
#define CALL_FP_STUB ".mips16.call.fp."
+
+#define FN_STUB_P(name) CONST_STRNEQ (name, FN_STUB)
+#define CALL_STUB_P(name) CONST_STRNEQ (name, CALL_STUB)
+#define CALL_FP_STUB_P(name) CONST_STRNEQ (name, CALL_FP_STUB)
/* The format of the first PLT entry in a VxWorks executable. */
static const bfd_vma mips_vxworks_exec_plt0_entry[] = {
@@ -838,13 +842,16 @@ mips_elf_link_hash_newfunc (struct bfd_hash_entry *entry,
bfd_boolean
_bfd_mips_elf_new_section_hook (bfd *abfd, asection *sec)
{
- struct _mips_elf_section_data *sdata;
- bfd_size_type amt = sizeof (*sdata);
+ if (!sec->used_by_bfd)
+ {
+ struct _mips_elf_section_data *sdata;
+ bfd_size_type amt = sizeof (*sdata);
- sdata = bfd_zalloc (abfd, amt);
- if (sdata == NULL)
- return FALSE;
- sec->used_by_bfd = sdata;
+ sdata = bfd_zalloc (abfd, amt);
+ if (sdata == NULL)
+ return FALSE;
+ sec->used_by_bfd = sdata;
+ }
return _bfd_elf_new_section_hook (abfd, sec);
}
@@ -1689,11 +1696,20 @@ sort_dynamic_relocs (const void *arg1, const void *arg2)
{
Elf_Internal_Rela int_reloc1;
Elf_Internal_Rela int_reloc2;
+ int diff;
bfd_elf32_swap_reloc_in (reldyn_sorting_bfd, arg1, &int_reloc1);
bfd_elf32_swap_reloc_in (reldyn_sorting_bfd, arg2, &int_reloc2);
- return ELF32_R_SYM (int_reloc1.r_info) - ELF32_R_SYM (int_reloc2.r_info);
+ diff = ELF32_R_SYM (int_reloc1.r_info) - ELF32_R_SYM (int_reloc2.r_info);
+ if (diff != 0)
+ return diff;
+
+ if (int_reloc1.r_offset < int_reloc2.r_offset)
+ return -1;
+ if (int_reloc1.r_offset > int_reloc2.r_offset)
+ return 1;
+ return 0;
}
/* Like sort_dynamic_relocs, but used for elf64 relocations. */
@@ -1711,8 +1727,16 @@ sort_dynamic_relocs_64 (const void *arg1 ATTRIBUTE_UNUSED,
(*get_elf_backend_data (reldyn_sorting_bfd)->s->swap_reloc_in)
(reldyn_sorting_bfd, arg2, int_reloc2);
- return (ELF64_R_SYM (int_reloc1[0].r_info)
- - ELF64_R_SYM (int_reloc2[0].r_info));
+ if (ELF64_R_SYM (int_reloc1[0].r_info) < ELF64_R_SYM (int_reloc2[0].r_info))
+ return -1;
+ if (ELF64_R_SYM (int_reloc1[0].r_info) > ELF64_R_SYM (int_reloc2[0].r_info))
+ return 1;
+
+ if (int_reloc1[0].r_offset < int_reloc2[0].r_offset)
+ return -1;
+ if (int_reloc1[0].r_offset > int_reloc2[0].r_offset)
+ return 1;
+ return 0;
#else
abort ();
#endif
@@ -2389,16 +2413,14 @@ mips_elf_gotplt_index (struct bfd_link_info *info,
return got_address - got_value;
}
-/* Return the GOT offset for address VALUE, which was derived from
- a symbol belonging to INPUT_SECTION. If there is not yet a GOT
+/* Return the GOT offset for address VALUE. If there is not yet a GOT
entry for this value, create one. If R_SYMNDX refers to a TLS symbol,
create a TLS GOT entry instead. Return -1 if no satisfactory GOT
offset can be found. */
static bfd_vma
mips_elf_local_got_index (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
- asection *input_section, bfd_vma value,
- unsigned long r_symndx,
+ bfd_vma value, unsigned long r_symndx,
struct mips_elf_link_hash_entry *h, int r_type)
{
asection *sgot;
@@ -2408,8 +2430,7 @@ mips_elf_local_got_index (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
g = mips_elf_got_info (elf_hash_table (info)->dynobj, &sgot);
entry = mips_elf_create_local_got_entry (abfd, info, ibfd, g, sgot,
- input_section, value,
- r_symndx, h, r_type);
+ value, r_symndx, h, r_type);
if (!entry)
return MINUS_ONE;
@@ -2510,16 +2531,15 @@ mips_elf_global_got_index (bfd *abfd, bfd *ibfd, struct elf_link_hash_entry *h,
return index;
}
-/* Find a GOT page entry that points to within 32KB of VALUE, which was
- calculated from a symbol belonging to INPUT_SECTION. These entries
- are supposed to be placed at small offsets in the GOT, i.e., within
- 32KB of GP. Return the index of the GOT entry, or -1 if no entry
- could be created. If OFFSETP is nonnull, use it to return the
+/* Find a GOT page entry that points to within 32KB of VALUE. These
+ entries are supposed to be placed at small offsets in the GOT, i.e.,
+ within 32KB of GP. Return the index of the GOT entry, or -1 if no
+ entry could be created. If OFFSETP is nonnull, use it to return the
offset of the GOT entry from VALUE. */
static bfd_vma
mips_elf_got_page (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
- asection *input_section, bfd_vma value, bfd_vma *offsetp)
+ bfd_vma value, bfd_vma *offsetp)
{
asection *sgot;
struct mips_got_info *g;
@@ -2530,8 +2550,7 @@ mips_elf_got_page (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
page = (value + 0x8000) & ~(bfd_vma) 0xffff;
entry = mips_elf_create_local_got_entry (abfd, info, ibfd, g, sgot,
- input_section, page, 0,
- NULL, R_MIPS_GOT_PAGE);
+ page, 0, NULL, R_MIPS_GOT_PAGE);
if (!entry)
return MINUS_ONE;
@@ -2544,15 +2563,13 @@ mips_elf_got_page (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
return index;
}
-/* Find a local GOT entry for an R_MIPS_GOT16 relocation against VALUE,
- which was calculated from a symbol belonging to INPUT_SECTION.
+/* Find a local GOT entry for an R_MIPS_GOT16 relocation against VALUE.
EXTERNAL is true if the relocation was against a global symbol
that has been forced local. */
static bfd_vma
mips_elf_got16_entry (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
- asection *input_section, bfd_vma value,
- bfd_boolean external)
+ bfd_vma value, bfd_boolean external)
{
asection *sgot;
struct mips_got_info *g;
@@ -2568,8 +2585,7 @@ mips_elf_got16_entry (bfd *abfd, bfd *ibfd, struct bfd_link_info *info,
g = mips_elf_got_info (elf_hash_table (info)->dynobj, &sgot);
entry = mips_elf_create_local_got_entry (abfd, info, ibfd, g, sgot,
- input_section, value, 0,
- NULL, R_MIPS_GOT16);
+ value, 0, NULL, R_MIPS_GOT16);
if (entry)
return entry->gotidx;
else
@@ -2602,8 +2618,8 @@ mips_elf_got_offset_from_index (bfd *dynobj, bfd *output_bfd,
static struct mips_got_entry *
mips_elf_create_local_got_entry (bfd *abfd, struct bfd_link_info *info,
bfd *ibfd, struct mips_got_info *gg,
- asection *sgot, asection *input_section,
- bfd_vma value, unsigned long r_symndx,
+ asection *sgot, bfd_vma value,
+ unsigned long r_symndx,
struct mips_elf_link_hash_entry *h,
int r_type)
{
@@ -2684,30 +2700,23 @@ mips_elf_create_local_got_entry (bfd *abfd, struct bfd_link_info *info,
MIPS_ELF_PUT_WORD (abfd, value,
(sgot->contents + entry.gotidx));
- /* These GOT entries need a dynamic relocation on VxWorks. Because
- the offset between segments is not fixed, the relocation must be
- against a symbol in the same segment as the original symbol.
- The easiest way to do this is to take INPUT_SECTION's output
- section and emit a relocation against its section symbol. */
+ /* These GOT entries need a dynamic relocation on VxWorks. */
if (htab->is_vxworks)
{
Elf_Internal_Rela outrel;
- asection *s, *output_section;
+ asection *s;
bfd_byte *loc;
bfd_vma got_address;
- int dynindx;
s = mips_elf_rel_dyn_section (info, FALSE);
- output_section = input_section->output_section;
- dynindx = elf_section_data (output_section)->dynindx;
got_address = (sgot->output_section->vma
+ sgot->output_offset
+ entry.gotidx);
loc = s->contents + (s->reloc_count++ * sizeof (Elf32_External_Rela));
outrel.r_offset = got_address;
- outrel.r_info = ELF32_R_INFO (dynindx, R_MIPS_32);
- outrel.r_addend = value - output_section->vma;
+ outrel.r_info = ELF32_R_INFO (STN_UNDEF, R_MIPS_32);
+ outrel.r_addend = value;
bfd_elf32_swap_reloca_out (abfd, &outrel, loc);
}
@@ -3085,8 +3094,7 @@ mips_elf_merge_gots (void **bfd2got_, void *p)
if (tcount > 0)
{
unsigned int primary_total = lcount + tcount + arg->global_count;
- if (primary_total * MIPS_ELF_GOT_SIZE (bfd2got->bfd)
- >= MIPS_ELF_GOT_MAX_SIZE (arg->info))
+ if (primary_total > maxcnt)
too_many_for_tls = TRUE;
}
@@ -3178,6 +3186,7 @@ mips_elf_initialize_tls_index (void **entryp, void *p)
struct mips_got_entry *entry = (struct mips_got_entry *)*entryp;
struct mips_got_info *g = p;
bfd_vma next_index;
+ unsigned char tls_type;
/* We're only interested in TLS symbols. */
if (entry->tls_type == 0)
@@ -3193,6 +3202,7 @@ mips_elf_initialize_tls_index (void **entryp, void *p)
return 1;
entry->d.h->tls_type |= GOT_TLS_OFFSET_DONE;
entry->d.h->tls_got_offset = next_index;
+ tls_type = entry->d.h->tls_type;
}
else
{
@@ -3209,12 +3219,13 @@ mips_elf_initialize_tls_index (void **entryp, void *p)
g->tls_ldm_offset = next_index;
}
entry->gotidx = next_index;
+ tls_type = entry->tls_type;
}
/* Account for the entries we've just allocated. */
- if (entry->tls_type & (GOT_TLS_GD | GOT_TLS_LDM))
+ if (tls_type & (GOT_TLS_GD | GOT_TLS_LDM))
g->tls_assigned_gotno += 2;
- if (entry->tls_type & GOT_TLS_IE)
+ if (tls_type & GOT_TLS_IE)
g->tls_assigned_gotno += 1;
return 1;
@@ -3580,16 +3591,18 @@ mips_elf_next_relocation (bfd *abfd ATTRIBUTE_UNUSED, unsigned int r_type,
const Elf_Internal_Rela *relocation,
const Elf_Internal_Rela *relend)
{
+ unsigned long r_symndx = ELF_R_SYM (abfd, relocation->r_info);
+
while (relocation < relend)
{
- if (ELF_R_TYPE (abfd, relocation->r_info) == r_type)
+ if (ELF_R_TYPE (abfd, relocation->r_info) == r_type
+ && ELF_R_SYM (abfd, relocation->r_info) == r_symndx)
return relocation;
++relocation;
}
/* We didn't find it. */
- bfd_set_error (bfd_error_bad_value);
return NULL;
}
@@ -4056,9 +4069,10 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
a stub. */
if (r_type != R_MIPS16_26 && !info->relocatable
&& ((h != NULL && h->fn_stub != NULL)
- || (local_p && elf_tdata (input_bfd)->local_stubs != NULL
+ || (local_p
+ && elf_tdata (input_bfd)->local_stubs != NULL
&& elf_tdata (input_bfd)->local_stubs[r_symndx] != NULL))
- && !mips_elf_stub_section_p (input_bfd, input_section))
+ && !mips16_stub_section_p (input_bfd, input_section))
{
/* This is a 32- or 64-bit call to a 16-bit function. We should
have already noticed that we were going to need the
@@ -4072,38 +4086,46 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
}
symbol = sec->output_section->vma + sec->output_offset;
+ /* The target is 16-bit, but the stub isn't. */
+ target_is_16_bit_code_p = FALSE;
}
/* If this is a 16-bit call to a 32- or 64-bit function with a stub, we
need to redirect the call to the stub. */
else if (r_type == R_MIPS16_26 && !info->relocatable
- && h != NULL
- && (h->call_stub != NULL || h->call_fp_stub != NULL)
+ && ((h != NULL && (h->call_stub != NULL || h->call_fp_stub != NULL))
+ || (local_p
+ && elf_tdata (input_bfd)->local_call_stubs != NULL
+ && elf_tdata (input_bfd)->local_call_stubs[r_symndx] != NULL))
&& !target_is_16_bit_code_p)
{
- /* If both call_stub and call_fp_stub are defined, we can figure
- out which one to use by seeing which one appears in the input
- file. */
- if (h->call_stub != NULL && h->call_fp_stub != NULL)
+ if (local_p)
+ sec = elf_tdata (input_bfd)->local_call_stubs[r_symndx];
+ else
{
- asection *o;
-
- sec = NULL;
- for (o = input_bfd->sections; o != NULL; o = o->next)
+ /* If both call_stub and call_fp_stub are defined, we can figure
+ out which one to use by checking which one appears in the input
+ file. */
+ if (h->call_stub != NULL && h->call_fp_stub != NULL)
{
- if (strncmp (bfd_get_section_name (input_bfd, o),
- CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0)
+ asection *o;
+
+ sec = NULL;
+ for (o = input_bfd->sections; o != NULL; o = o->next)
{
- sec = h->call_fp_stub;
- break;
+ if (CALL_FP_STUB_P (bfd_get_section_name (input_bfd, o)))
+ {
+ sec = h->call_fp_stub;
+ break;
+ }
}
+ if (sec == NULL)
+ sec = h->call_stub;
}
- if (sec == NULL)
+ else if (h->call_stub != NULL)
sec = h->call_stub;
- }
- else if (h->call_stub != NULL)
- sec = h->call_stub;
- else
- sec = h->call_fp_stub;
+ else
+ sec = h->call_fp_stub;
+ }
BFD_ASSERT (sec->size > 0);
symbol = sec->output_section->vma + sec->output_offset;
@@ -4145,7 +4167,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
if (r_type == R_MIPS_TLS_LDM)
{
g = mips_elf_local_got_index (abfd, input_bfd, info,
- sec, 0, 0, NULL, r_type);
+ 0, 0, NULL, r_type);
if (g == MINUS_ONE)
return bfd_reloc_outofrange;
}
@@ -4191,7 +4213,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
break;
else
{
- g = mips_elf_local_got_index (abfd, input_bfd, info, sec,
+ g = mips_elf_local_got_index (abfd, input_bfd, info,
symbol + addend, r_symndx, h, r_type);
if (g == MINUS_ONE)
return bfd_reloc_outofrange;
@@ -4240,6 +4262,13 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
outrel.r_info = ELF32_R_INFO (h->root.dynindx, r_type);
outrel.r_addend = addend;
bfd_elf32_swap_reloca_out (abfd, &outrel, loc);
+
+ /* If we've written this relocation for a readonly section,
+ we need to set DF_TEXTREL again, so that we do not delete the
+ DT_TEXTREL tag. */
+ if (MIPS_ELF_READONLY_SECTION (input_section))
+ info->flags |= DF_TEXTREL;
+
*valuep = 0;
return bfd_reloc_ok;
}
@@ -4326,6 +4355,8 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
break;
case R_MIPS_TLS_DTPREL_LO16:
+ case R_MIPS_TLS_DTPREL32:
+ case R_MIPS_TLS_DTPREL64:
value = (symbol + addend - dtprel_base (info)) & howto->dst_mask;
break;
@@ -4435,7 +4466,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
forced = ! mips_elf_local_relocation_p (input_bfd, relocation,
local_sections, FALSE);
- value = mips_elf_got16_entry (abfd, input_bfd, info, sec,
+ value = mips_elf_got16_entry (abfd, input_bfd, info,
symbol + addend, forced);
if (value == MINUS_ONE)
return bfd_reloc_outofrange;
@@ -4466,7 +4497,8 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
case R_MIPS_GNU_REL16_S2:
value = symbol + _bfd_mips_elf_sign_extend (addend, 18) - p;
overflowed_p = mips_elf_overflow_p (value, 18);
- value = (value >> 2) & howto->dst_mask;
+ value >>= howto->rightshift;
+ value &= howto->dst_mask;
break;
case R_MIPS_GOT_HI16:
@@ -4490,8 +4522,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
0. */
if (! local_p)
goto got_disp;
- value = mips_elf_got_page (abfd, input_bfd, info, sec,
- symbol + addend, NULL);
+ value = mips_elf_got_page (abfd, input_bfd, info, symbol + addend, NULL);
if (value == MINUS_ONE)
return bfd_reloc_outofrange;
value = mips_elf_got_offset_from_index (dynobj, abfd, input_bfd, value);
@@ -4500,8 +4531,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
case R_MIPS_GOT_OFST:
if (local_p)
- mips_elf_got_page (abfd, input_bfd, info, sec,
- symbol + addend, &value);
+ mips_elf_got_page (abfd, input_bfd, info, symbol + addend, &value);
else
value = addend;
overflowed_p = mips_elf_overflow_p (value, 16);
@@ -4677,13 +4707,11 @@ mips_elf_perform_relocation (struct bfd_link_info *info,
/* Returns TRUE if SECTION is a MIPS16 stub section. */
static bfd_boolean
-mips_elf_stub_section_p (bfd *abfd ATTRIBUTE_UNUSED, asection *section)
+mips16_stub_section_p (bfd *abfd ATTRIBUTE_UNUSED, asection *section)
{
const char *name = bfd_get_section_name (abfd, section);
- return (strncmp (name, FN_STUB, sizeof FN_STUB - 1) == 0
- || strncmp (name, CALL_STUB, sizeof CALL_STUB - 1) == 0
- || strncmp (name, CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0);
+ return FN_STUB_P (name) || CALL_STUB_P (name) || CALL_FP_STUB_P (name);
}
/* Add room for N relocations to the .rel(a).dyn section in ABFD. */
@@ -4745,10 +4773,13 @@ mips_elf_create_dynamic_relocation (bfd *output_bfd,
outrel[0].r_offset =
_bfd_elf_section_offset (output_bfd, info, input_section, rel[0].r_offset);
- outrel[1].r_offset =
- _bfd_elf_section_offset (output_bfd, info, input_section, rel[1].r_offset);
- outrel[2].r_offset =
- _bfd_elf_section_offset (output_bfd, info, input_section, rel[2].r_offset);
+ if (ABI_64_P (output_bfd))
+ {
+ outrel[1].r_offset =
+ _bfd_elf_section_offset (output_bfd, info, input_section, rel[1].r_offset);
+ outrel[2].r_offset =
+ _bfd_elf_section_offset (output_bfd, info, input_section, rel[2].r_offset);
+ }
if (outrel[0].r_offset == MINUS_ONE)
/* The relocation field has been deleted. */
@@ -4792,6 +4823,11 @@ mips_elf_create_dynamic_relocation (bfd *output_bfd,
{
indx = elf_section_data (sec->output_section)->dynindx;
if (indx == 0)
+ {
+ asection *osec = htab->root.text_index_section;
+ indx = elf_section_data (osec)->dynindx;
+ }
+ if (indx == 0)
abort ();
}
@@ -4973,39 +5009,30 @@ _bfd_elf_mips_mach (flagword flags)
default:
case E_MIPS_ARCH_1:
return bfd_mach_mips3000;
- break;
case E_MIPS_ARCH_2:
return bfd_mach_mips6000;
- break;
case E_MIPS_ARCH_3:
return bfd_mach_mips4000;
- break;
case E_MIPS_ARCH_4:
return bfd_mach_mips8000;
- break;
case E_MIPS_ARCH_5:
return bfd_mach_mips5;
- break;
case E_MIPS_ARCH_32:
return bfd_mach_mipsisa32;
- break;
case E_MIPS_ARCH_64:
return bfd_mach_mipsisa64;
- break;
case E_MIPS_ARCH_32R2:
return bfd_mach_mipsisa32r2;
- break;
case E_MIPS_ARCH_64R2:
return bfd_mach_mipsisa64r2;
- break;
}
}
@@ -5095,6 +5122,7 @@ _bfd_mips_elf_symbol_processing (bfd *abfd, asymbol *asym)
/* Common symbols less than the GP size are automatically
treated as SHN_MIPS_SCOMMON symbols on IRIX5. */
if (asym->value > elf_gp_size (abfd)
+ || ELF_ST_TYPE (elfsym->internal_elf_sym.st_info) == STT_TLS
|| IRIX_COMPAT (abfd) == ict_irix6)
break;
/* Fall through. */
@@ -5406,7 +5434,7 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd,
return FALSE;
break;
case SHT_MIPS_GPTAB:
- if (strncmp (name, ".gptab.", sizeof ".gptab." - 1) != 0)
+ if (! CONST_STRNEQ (name, ".gptab."))
return FALSE;
break;
case SHT_MIPS_UCODE:
@@ -5429,7 +5457,7 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd,
return FALSE;
break;
case SHT_MIPS_CONTENT:
- if (strncmp (name, ".MIPS.content", sizeof ".MIPS.content" - 1) != 0)
+ if (! CONST_STRNEQ (name, ".MIPS.content"))
return FALSE;
break;
case SHT_MIPS_OPTIONS:
@@ -5437,7 +5465,7 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd,
return FALSE;
break;
case SHT_MIPS_DWARF:
- if (strncmp (name, ".debug_", sizeof ".debug_" - 1) != 0)
+ if (! CONST_STRNEQ (name, ".debug_"))
return FALSE;
break;
case SHT_MIPS_SYMBOL_LIB:
@@ -5445,9 +5473,8 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd,
return FALSE;
break;
case SHT_MIPS_EVENTS:
- if (strncmp (name, ".MIPS.events", sizeof ".MIPS.events" - 1) != 0
- && strncmp (name, ".MIPS.post_rel",
- sizeof ".MIPS.post_rel" - 1) != 0)
+ if (! CONST_STRNEQ (name, ".MIPS.events")
+ && ! CONST_STRNEQ (name, ".MIPS.post_rel"))
return FALSE;
break;
default:
@@ -5553,11 +5580,7 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd,
bfd_boolean
_bfd_mips_elf_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec)
{
- register const char *name;
- unsigned int sh_type;
-
- name = bfd_get_section_name (abfd, sec);
- sh_type = hdr->sh_type;
+ const char *name = bfd_get_section_name (abfd, sec);
if (strcmp (name, ".liblist") == 0)
{
@@ -5567,7 +5590,7 @@ _bfd_mips_elf_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec)
}
else if (strcmp (name, ".conflict") == 0)
hdr->sh_type = SHT_MIPS_CONFLICT;
- else if (strncmp (name, ".gptab.", sizeof ".gptab." - 1) == 0)
+ else if (CONST_STRNEQ (name, ".gptab."))
{
hdr->sh_type = SHT_MIPS_GPTAB;
hdr->sh_entsize = sizeof (Elf32_External_gptab);
@@ -5624,7 +5647,7 @@ _bfd_mips_elf_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec)
hdr->sh_type = SHT_MIPS_IFACE;
hdr->sh_flags |= SHF_MIPS_NOSTRIP;
}
- else if (strncmp (name, ".MIPS.content", strlen (".MIPS.content")) == 0)
+ else if (CONST_STRNEQ (name, ".MIPS.content"))
{
hdr->sh_type = SHT_MIPS_CONTENT;
hdr->sh_flags |= SHF_MIPS_NOSTRIP;
@@ -5636,7 +5659,7 @@ _bfd_mips_elf_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec)
hdr->sh_entsize = 1;
hdr->sh_flags |= SHF_MIPS_NOSTRIP;
}
- else if (strncmp (name, ".debug_", sizeof ".debug_" - 1) == 0)
+ else if (CONST_STRNEQ (name, ".debug_"))
hdr->sh_type = SHT_MIPS_DWARF;
else if (strcmp (name, ".MIPS.symlib") == 0)
{
@@ -5644,9 +5667,8 @@ _bfd_mips_elf_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec)
/* The sh_link and sh_info fields are set in
final_write_processing. */
}
- else if (strncmp (name, ".MIPS.events", sizeof ".MIPS.events" - 1) == 0
- || strncmp (name, ".MIPS.post_rel",
- sizeof ".MIPS.post_rel" - 1) == 0)
+ else if (CONST_STRNEQ (name, ".MIPS.events")
+ || CONST_STRNEQ (name, ".MIPS.post_rel"))
{
hdr->sh_type = SHT_MIPS_EVENTS;
hdr->sh_flags |= SHF_MIPS_NOSTRIP;
@@ -5659,12 +5681,6 @@ _bfd_mips_elf_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec)
hdr->sh_entsize = 8;
}
- /* In the unlikely event a special section is empty it has to lose its
- special meaning. This may happen e.g. when using `strip' with the
- "--only-keep-debug" option. */
- if (sec->size > 0 && !(sec->flags & SEC_HAS_CONTENTS))
- hdr->sh_type = sh_type;
-
/* The generic elf_fake_sections will set up REL_HDR using the default
kind of relocations. We used to set up a second header for the
non-default kind of relocations here, but only NewABI would use
@@ -5735,6 +5751,7 @@ _bfd_mips_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
/* Common symbols less than the GP size are automatically
treated as SHN_MIPS_SCOMMON symbols. */
if (sym->st_size > elf_gp_size (abfd)
+ || ELF_ST_TYPE (sym->st_info) == STT_TLS
|| IRIX_COMPAT (abfd) == ict_irix6)
break;
/* Fall through. */
@@ -6116,7 +6133,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
/* Check for the mips16 stub sections. */
name = bfd_get_section_name (abfd, sec);
- if (strncmp (name, FN_STUB, sizeof FN_STUB - 1) == 0)
+ if (FN_STUB_P (name))
{
unsigned long r_symndx;
@@ -6141,12 +6158,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
/* We can ignore stub sections when looking for relocs. */
if ((o->flags & SEC_RELOC) == 0
|| o->reloc_count == 0
- || strncmp (bfd_get_section_name (abfd, o), FN_STUB,
- sizeof FN_STUB - 1) == 0
- || strncmp (bfd_get_section_name (abfd, o), CALL_STUB,
- sizeof CALL_STUB - 1) == 0
- || strncmp (bfd_get_section_name (abfd, o), CALL_FP_STUB,
- sizeof CALL_FP_STUB - 1) == 0)
+ || mips16_stub_section_p (abfd, o))
continue;
sec_relocs
@@ -6198,6 +6210,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
elf_tdata (abfd)->local_stubs = n;
}
+ sec->flags |= SEC_KEEP;
elf_tdata (abfd)->local_stubs[r_symndx] = sec;
/* We don't need to set mips16_stubs_seen in this case.
@@ -6218,12 +6231,23 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
/* H is the symbol this stub is for. */
+ /* If we already have an appropriate stub for this function, we
+ don't need another one, so we can discard this one. Since
+ this function is called before the linker maps input sections
+ to output sections, we can easily discard it by setting the
+ SEC_EXCLUDE flag. */
+ if (h->fn_stub != NULL)
+ {
+ sec->flags |= SEC_EXCLUDE;
+ return TRUE;
+ }
+
+ sec->flags |= SEC_KEEP;
h->fn_stub = sec;
mips_elf_hash_table (info)->mips16_stubs_seen = TRUE;
}
}
- else if (strncmp (name, CALL_STUB, sizeof CALL_STUB - 1) == 0
- || strncmp (name, CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0)
+ else if (CALL_STUB_P (name) || CALL_FP_STUB_P (name))
{
unsigned long r_symndx;
struct mips_elf_link_hash_entry *h;
@@ -6237,42 +6261,106 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
if (r_symndx < extsymoff
|| sym_hashes[r_symndx - extsymoff] == NULL)
{
- /* This stub was actually built for a static symbol defined
- in the same file. We assume that all static symbols in
- mips16 code are themselves mips16, so we can simply
- discard this stub. Since this function is called before
- the linker maps input sections to output sections, we can
- easily discard it by setting the SEC_EXCLUDE flag. */
- sec->flags |= SEC_EXCLUDE;
- return TRUE;
- }
+ asection *o;
- h = ((struct mips_elf_link_hash_entry *)
- sym_hashes[r_symndx - extsymoff]);
+ /* This stub is for a local symbol. This stub will only be
+ needed if there is some relocation (R_MIPS16_26) in this BFD
+ that refers to this symbol. */
+ for (o = abfd->sections; o != NULL; o = o->next)
+ {
+ Elf_Internal_Rela *sec_relocs;
+ const Elf_Internal_Rela *r, *rend;
+
+ /* We can ignore stub sections when looking for relocs. */
+ if ((o->flags & SEC_RELOC) == 0
+ || o->reloc_count == 0
+ || mips16_stub_section_p (abfd, o))
+ continue;
- /* H is the symbol this stub is for. */
+ sec_relocs
+ = _bfd_elf_link_read_relocs (abfd, o, NULL, NULL,
+ info->keep_memory);
+ if (sec_relocs == NULL)
+ return FALSE;
- if (strncmp (name, CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0)
- loc = &h->call_fp_stub;
- else
- loc = &h->call_stub;
-
- /* If we already have an appropriate stub for this function, we
- don't need another one, so we can discard this one. Since
- this function is called before the linker maps input sections
- to output sections, we can easily discard it by setting the
- SEC_EXCLUDE flag. We can also discard this section if we
- happen to already know that this is a mips16 function; it is
- not necessary to check this here, as it is checked later, but
- it is slightly faster to check now. */
- if (*loc != NULL || h->root.other == STO_MIPS16)
- {
- sec->flags |= SEC_EXCLUDE;
- return TRUE;
+ rend = sec_relocs + o->reloc_count;
+ for (r = sec_relocs; r < rend; r++)
+ if (ELF_R_SYM (abfd, r->r_info) == r_symndx
+ && ELF_R_TYPE (abfd, r->r_info) == R_MIPS16_26)
+ break;
+
+ if (elf_section_data (o)->relocs != sec_relocs)
+ free (sec_relocs);
+
+ if (r < rend)
+ break;
+ }
+
+ if (o == NULL)
+ {
+ /* There is no non-call reloc for this stub, so we do
+ not need it. Since this function is called before
+ the linker maps input sections to output sections, we
+ can easily discard it by setting the SEC_EXCLUDE
+ flag. */
+ sec->flags |= SEC_EXCLUDE;
+ return TRUE;
+ }
+
+ /* Record this stub in an array of local symbol call_stubs for
+ this BFD. */
+ if (elf_tdata (abfd)->local_call_stubs == NULL)
+ {
+ unsigned long symcount;
+ asection **n;
+ bfd_size_type amt;
+
+ if (elf_bad_symtab (abfd))
+ symcount = NUM_SHDR_ENTRIES (symtab_hdr);
+ else
+ symcount = symtab_hdr->sh_info;
+ amt = symcount * sizeof (asection *);
+ n = bfd_zalloc (abfd, amt);
+ if (n == NULL)
+ return FALSE;
+ elf_tdata (abfd)->local_call_stubs = n;
+ }
+
+ sec->flags |= SEC_KEEP;
+ elf_tdata (abfd)->local_call_stubs[r_symndx] = sec;
+
+ /* We don't need to set mips16_stubs_seen in this case.
+ That flag is used to see whether we need to look through
+ the global symbol table for stubs. We don't need to set
+ it here, because we just have a local stub. */
}
+ else
+ {
+ h = ((struct mips_elf_link_hash_entry *)
+ sym_hashes[r_symndx - extsymoff]);
+
+ /* H is the symbol this stub is for. */
+
+ if (CALL_FP_STUB_P (name))
+ loc = &h->call_fp_stub;
+ else
+ loc = &h->call_stub;
+
+ /* If we already have an appropriate stub for this function, we
+ don't need another one, so we can discard this one. Since
+ this function is called before the linker maps input sections
+ to output sections, we can easily discard it by setting the
+ SEC_EXCLUDE flag. */
+ if (*loc != NULL)
+ {
+ sec->flags |= SEC_EXCLUDE;
+ return TRUE;
+ }
- *loc = sec;
- mips_elf_hash_table (info)->mips16_stubs_seen = TRUE;
+ sec->flags |= SEC_KEEP;
+ *loc = sec;
+ mips_elf_hash_table (info)->mips16_stubs_seen = TRUE;
+ }
}
if (dynobj == NULL)
@@ -6392,6 +6480,10 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
return FALSE;
}
mips_elf_allocate_dynamic_relocations (dynobj, info, 1);
+ if (MIPS_ELF_READONLY_SECTION (sec))
+ /* We tell the dynamic linker that there are
+ relocations against the text segment. */
+ info->flags |= DF_TEXTREL;
}
}
else if (r_type == R_MIPS_CALL_LO16
@@ -6637,12 +6729,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
References from a stub section do not count. */
if (h != NULL
&& r_type != R_MIPS16_26
- && strncmp (bfd_get_section_name (abfd, sec), FN_STUB,
- sizeof FN_STUB - 1) != 0
- && strncmp (bfd_get_section_name (abfd, sec), CALL_STUB,
- sizeof CALL_STUB - 1) != 0
- && strncmp (bfd_get_section_name (abfd, sec), CALL_FP_STUB,
- sizeof CALL_FP_STUB - 1) != 0)
+ && !mips16_stub_section_p (abfd, sec))
{
struct mips_elf_link_hash_entry *mh;
@@ -6935,7 +7022,6 @@ _bfd_mips_vxworks_adjust_dynamic_symbol (struct bfd_link_info *info,
bfd *dynobj;
struct mips_elf_link_hash_entry *hmips;
struct mips_elf_link_hash_table *htab;
- unsigned int power_of_two;
htab = mips_elf_hash_table (info);
dynobj = elf_hash_table (info)->dynobj;
@@ -7058,26 +7144,7 @@ _bfd_mips_vxworks_adjust_dynamic_symbol (struct bfd_link_info *info,
h->needs_copy = 1;
}
- /* We need to figure out the alignment required for this symbol. */
- power_of_two = bfd_log2 (h->size);
- if (power_of_two > 4)
- power_of_two = 4;
-
- /* Apply the required alignment. */
- htab->sdynbss->size = BFD_ALIGN (htab->sdynbss->size,
- (bfd_size_type) 1 << power_of_two);
- if (power_of_two > bfd_get_section_alignment (dynobj, htab->sdynbss)
- && !bfd_set_section_alignment (dynobj, htab->sdynbss, power_of_two))
- return FALSE;
-
- /* Define the symbol as being at this point in the section. */
- h->root.u.def.section = htab->sdynbss;
- h->root.u.def.value = htab->sdynbss->size;
-
- /* Increment the section size to make room for the symbol. */
- htab->sdynbss->size += h->size;
-
- return TRUE;
+ return _bfd_elf_adjust_dynamic_copy (h, htab->sdynbss);
}
/* Return the number of dynamic section symbols required by OUTPUT_BFD.
@@ -7091,7 +7158,7 @@ count_section_dynsyms (bfd *output_bfd, struct bfd_link_info *info)
bfd_size_type count;
count = 0;
- if (info->shared)
+ if (info->shared || elf_hash_table (info)->is_relocatable_executable)
{
asection *p;
const struct elf_backend_data *bed;
@@ -7290,7 +7357,7 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
if ((s->flags & SEC_LINKER_CREATED) == 0)
continue;
- if (strncmp (name, ".rel", 4) == 0)
+ if (CONST_STRNEQ (name, ".rel"))
{
if (s->size != 0)
{
@@ -7342,7 +7409,7 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
mips_elf_allocate_dynamic_relocations (dynobj, info, count);
}
}
- else if (!htab->is_vxworks && strncmp (name, ".got", 4) == 0)
+ else if (!htab->is_vxworks && CONST_STRNEQ (name, ".got"))
{
/* _bfd_mips_elf_always_size_sections() has already done
most of the work, but some symbols may have been mapped
@@ -7418,16 +7485,16 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
}
else if (! info->shared
&& ! mips_elf_hash_table (info)->use_rld_obj_head
- && strncmp (name, ".rld_map", 8) == 0)
+ && CONST_STRNEQ (name, ".rld_map"))
{
/* We add a room for __rld_map. It will be filled in by the
rtld to contain a pointer to the _r_debug structure. */
s->size += 4;
}
else if (SGI_COMPAT (output_bfd)
- && strncmp (name, ".compact_rel", 12) == 0)
+ && CONST_STRNEQ (name, ".compact_rel"))
s->size += mips_elf_hash_table (info)->compact_rel_size;
- else if (strncmp (name, ".init", 5) != 0
+ else if (! CONST_STRNEQ (name, ".init")
&& s != htab->sgotplt
&& s != htab->splt)
{
@@ -7477,29 +7544,22 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
/* Add some entries to the .dynamic section. We fill in the
values later, in _bfd_mips_elf_finish_dynamic_sections, but we
must add the entries now so that we get the correct size for
- the .dynamic section. The DT_DEBUG entry is filled in by the
- dynamic linker and used by the debugger. */
- if (! info->shared)
- {
- /* SGI object has the equivalence of DT_DEBUG in the
- DT_MIPS_RLD_MAP entry. */
- if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_MAP, 0))
- return FALSE;
- if (!SGI_COMPAT (output_bfd))
- {
- if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0))
- return FALSE;
- }
- }
- else
- {
- /* Shared libraries on traditional mips have DT_DEBUG. */
- if (!SGI_COMPAT (output_bfd))
- {
- if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0))
- return FALSE;
- }
- }
+ the .dynamic section. */
+
+ /* SGI object has the equivalence of DT_DEBUG in the
+ DT_MIPS_RLD_MAP entry. This must come first because glibc
+ only fills in DT_MIPS_RLD_MAP (not DT_DEBUG) and GDB only
+ looks at the first one it sees. */
+ if (!info->shared
+ && !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_MAP, 0))
+ return FALSE;
+
+ /* The DT_DEBUG entry may be filled in by the dynamic linker and
+ used by the debugger. */
+ if (info->executable
+ && !SGI_COMPAT (output_bfd)
+ && !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0))
+ return FALSE;
if (reltext && (SGI_COMPAT (output_bfd) || htab->is_vxworks))
info->flags |= DF_TEXTREL;
@@ -7666,8 +7726,54 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
bfd_boolean rela_relocation_p = TRUE;
unsigned int r_type = ELF_R_TYPE (output_bfd, rel->r_info);
const char *msg;
+ unsigned long r_symndx;
+ asection *sec;
+ Elf_Internal_Shdr *symtab_hdr;
+ struct elf_link_hash_entry *h;
/* Find the relocation howto for this relocation. */
+ howto = MIPS_ELF_RTYPE_TO_HOWTO (input_bfd, r_type,
+ NEWABI_P (input_bfd)
+ && (MIPS_RELOC_RELA_P
+ (input_bfd, input_section,
+ rel - relocs)));
+
+ r_symndx = ELF_R_SYM (input_bfd, rel->r_info);
+ symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+ if (mips_elf_local_relocation_p (input_bfd, rel, local_sections, FALSE))
+ {
+ sec = local_sections[r_symndx];
+ h = NULL;
+ }
+ else
+ {
+ unsigned long extsymoff;
+
+ extsymoff = 0;
+ if (!elf_bad_symtab (input_bfd))
+ extsymoff = symtab_hdr->sh_info;
+ h = elf_sym_hashes (input_bfd) [r_symndx - extsymoff];
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ sec = NULL;
+ if (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ sec = h->root.u.def.section;
+ }
+
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
if (r_type == R_MIPS_64 && ! NEWABI_P (input_bfd))
{
/* Some 32-bit code uses R_MIPS_64. In particular, people use
@@ -7683,13 +7789,6 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
if (bfd_big_endian (input_bfd))
rel->r_offset += 4;
}
- else
- /* NewABI defaults to RELA relocations. */
- howto = MIPS_ELF_RTYPE_TO_HOWTO (input_bfd, r_type,
- NEWABI_P (input_bfd)
- && (MIPS_RELOC_RELA_P
- (input_bfd, input_section,
- rel - relocs)));
if (!use_saved_addend_p)
{
@@ -7730,10 +7829,8 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
&& mips_elf_local_relocation_p (input_bfd, rel,
local_sections, FALSE)))
{
- bfd_vma l;
const Elf_Internal_Rela *lo16_relocation;
reloc_howto_type *lo16_howto;
- bfd_byte *lo16_location;
int lo16_type;
if (r_type == R_MIPS16_HI16)
@@ -7756,32 +7853,56 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
several relocations for the same address. In
that case, the R_MIPS_LO16 relocation may occur
as one of these. We permit a similar extension
- in general, as that is useful for GCC. */
+ in general, as that is useful for GCC.
+
+ In some cases GCC dead code elimination removes
+ the LO16 but keeps the corresponding HI16. This
+ is strictly speaking a violation of the ABI but
+ not immediately harmful. */
lo16_relocation = mips_elf_next_relocation (input_bfd,
lo16_type,
rel, relend);
if (lo16_relocation == NULL)
- return FALSE;
-
- lo16_location = contents + lo16_relocation->r_offset;
-
- /* Obtain the addend kept there. */
- lo16_howto = MIPS_ELF_RTYPE_TO_HOWTO (input_bfd,
- lo16_type, FALSE);
- _bfd_mips16_elf_reloc_unshuffle (input_bfd, lo16_type, FALSE,
- lo16_location);
- l = mips_elf_obtain_contents (lo16_howto, lo16_relocation,
- input_bfd, contents);
- _bfd_mips16_elf_reloc_shuffle (input_bfd, lo16_type, FALSE,
- lo16_location);
- l &= lo16_howto->src_mask;
- l <<= lo16_howto->rightshift;
- l = _bfd_mips_elf_sign_extend (l, 16);
-
- addend <<= 16;
-
- /* Compute the combined addend. */
- addend += l;
+ {
+ const char *name;
+
+ if (h)
+ name = h->root.root.string;
+ else
+ name = bfd_elf_sym_name (input_bfd, symtab_hdr,
+ local_syms + r_symndx,
+ sec);
+ (*_bfd_error_handler)
+ (_("%B: Can't find matching LO16 reloc against `%s' for %s at 0x%lx in section `%A'"),
+ input_bfd, input_section, name, howto->name,
+ rel->r_offset);
+ }
+ else
+ {
+ bfd_byte *lo16_location;
+ bfd_vma l;
+
+ lo16_location = contents + lo16_relocation->r_offset;
+
+ /* Obtain the addend kept there. */
+ lo16_howto = MIPS_ELF_RTYPE_TO_HOWTO (input_bfd,
+ lo16_type, FALSE);
+ _bfd_mips16_elf_reloc_unshuffle (input_bfd, lo16_type,
+ FALSE, lo16_location);
+ l = mips_elf_obtain_contents (lo16_howto,
+ lo16_relocation,
+ input_bfd, contents);
+ _bfd_mips16_elf_reloc_shuffle (input_bfd, lo16_type,
+ FALSE, lo16_location);
+ l &= lo16_howto->src_mask;
+ l <<= lo16_howto->rightshift;
+ l = _bfd_mips_elf_sign_extend (l, 16);
+
+ addend <<= 16;
+
+ /* Compute the combined addend. */
+ addend += l;
+ }
}
else
addend <<= howto->rightshift;
@@ -8789,11 +8910,10 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd,
MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0x80000000,
sgot->contents + MIPS_ELF_GOT_SIZE (output_bfd));
}
- }
- if (sgot != NULL)
- elf_section_data (sgot->output_section)->this_hdr.sh_entsize
- = MIPS_ELF_GOT_SIZE (output_bfd);
+ elf_section_data (sgot->output_section)->this_hdr.sh_entsize
+ = MIPS_ELF_GOT_SIZE (output_bfd);
+ }
/* Generate dynamic relocations for the non-primary gots. */
if (gg != NULL && gg->next)
@@ -8867,6 +8987,10 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd,
* (ABI_64_P (output_bfd)
? sizeof (Elf64_Mips_External_Rel)
: sizeof (Elf32_External_Rel)));
+ /* Adjust the section size too. Tools like the prelinker
+ can reasonably expect the values to the same. */
+ elf_section_data (s->output_section)->this_hdr.sh_size
+ = dyn.d_un.d_val;
break;
default:
@@ -9088,7 +9212,7 @@ _bfd_mips_elf_final_write_processing (bfd *abfd,
BFD_ASSERT ((*hdrpp)->bfd_section != NULL);
name = bfd_get_section_name (abfd, (*hdrpp)->bfd_section);
BFD_ASSERT (name != NULL
- && strncmp (name, ".gptab.", sizeof ".gptab." - 1) == 0);
+ && CONST_STRNEQ (name, ".gptab."));
sec = bfd_get_section_by_name (abfd, name + sizeof ".gptab" - 1);
BFD_ASSERT (sec != NULL);
(*hdrpp)->sh_info = elf_section_data (sec)->this_idx;
@@ -9098,8 +9222,7 @@ _bfd_mips_elf_final_write_processing (bfd *abfd,
BFD_ASSERT ((*hdrpp)->bfd_section != NULL);
name = bfd_get_section_name (abfd, (*hdrpp)->bfd_section);
BFD_ASSERT (name != NULL
- && strncmp (name, ".MIPS.content",
- sizeof ".MIPS.content" - 1) == 0);
+ && CONST_STRNEQ (name, ".MIPS.content"));
sec = bfd_get_section_by_name (abfd,
name + sizeof ".MIPS.content" - 1);
BFD_ASSERT (sec != NULL);
@@ -9119,13 +9242,12 @@ _bfd_mips_elf_final_write_processing (bfd *abfd,
BFD_ASSERT ((*hdrpp)->bfd_section != NULL);
name = bfd_get_section_name (abfd, (*hdrpp)->bfd_section);
BFD_ASSERT (name != NULL);
- if (strncmp (name, ".MIPS.events", sizeof ".MIPS.events" - 1) == 0)
+ if (CONST_STRNEQ (name, ".MIPS.events"))
sec = bfd_get_section_by_name (abfd,
name + sizeof ".MIPS.events" - 1);
else
{
- BFD_ASSERT (strncmp (name, ".MIPS.post_rel",
- sizeof ".MIPS.post_rel" - 1) == 0);
+ BFD_ASSERT (CONST_STRNEQ (name, ".MIPS.post_rel"));
sec = bfd_get_section_by_name (abfd,
(name
+ sizeof ".MIPS.post_rel" - 1));
@@ -9142,7 +9264,8 @@ _bfd_mips_elf_final_write_processing (bfd *abfd,
segments. */
int
-_bfd_mips_elf_additional_program_headers (bfd *abfd)
+_bfd_mips_elf_additional_program_headers (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
asection *s;
int ret = 0;
@@ -9164,6 +9287,12 @@ _bfd_mips_elf_additional_program_headers (bfd *abfd)
&& bfd_get_section_by_name (abfd, ".mdebug"))
++ret;
+ /* Allocate a PT_NULL header in dynamic objects. See
+ _bfd_mips_elf_modify_segment_map for details. */
+ if (!SGI_COMPAT (abfd)
+ && bfd_get_section_by_name (abfd, ".dynamic"))
+ ++ret;
+
return ret;
}
@@ -9233,15 +9362,18 @@ _bfd_mips_elf_modify_segment_map (bfd *abfd,
|| (*pm)->p_type == PT_INTERP))
pm = &(*pm)->next;
- amt = sizeof (struct elf_segment_map);
- options_segment = bfd_zalloc (abfd, amt);
- options_segment->next = *pm;
- options_segment->p_type = PT_MIPS_OPTIONS;
- options_segment->p_flags = PF_R;
- options_segment->p_flags_valid = TRUE;
- options_segment->count = 1;
- options_segment->sections[0] = s;
- *pm = options_segment;
+ if (*pm == NULL || (*pm)->p_type != PT_MIPS_OPTIONS)
+ {
+ amt = sizeof (struct elf_segment_map);
+ options_segment = bfd_zalloc (abfd, amt);
+ options_segment->next = *pm;
+ options_segment->p_type = PT_MIPS_OPTIONS;
+ options_segment->p_flags = PF_R;
+ options_segment->p_flags_valid = TRUE;
+ options_segment->count = 1;
+ options_segment->sections[0] = s;
+ *pm = options_segment;
+ }
}
}
else
@@ -9311,8 +9443,18 @@ _bfd_mips_elf_modify_segment_map (bfd *abfd,
m->p_flags_valid = 1;
}
}
- if (m != NULL
- && m->count == 1 && strcmp (m->sections[0]->name, ".dynamic") == 0)
+ /* GNU/Linux binaries do not need the extended PT_DYNAMIC section.
+ glibc's dynamic linker has traditionally derived the number of
+ tags from the p_filesz field, and sometimes allocates stack
+ arrays of that size. An overly-big PT_DYNAMIC segment can
+ be actively harmful in such cases. Making PT_DYNAMIC contain
+ other sections can also make life hard for the prelinker,
+ which might move one of the other sections to a different
+ PT_LOAD segment. */
+ if (SGI_COMPAT (abfd)
+ && m != NULL
+ && m->count == 1
+ && strcmp (m->sections[0]->name, ".dynamic") == 0)
{
static const char *sec_names[] =
{
@@ -9369,6 +9511,38 @@ _bfd_mips_elf_modify_segment_map (bfd *abfd,
}
}
+ /* Allocate a spare program header in dynamic objects so that tools
+ like the prelinker can add an extra PT_LOAD entry.
+
+ If the prelinker needs to make room for a new PT_LOAD entry, its
+ standard procedure is to move the first (read-only) sections into
+ the new (writable) segment. However, the MIPS ABI requires
+ .dynamic to be in a read-only segment, and the section will often
+ start within sizeof (ElfNN_Phdr) bytes of the last program header.
+
+ Although the prelinker could in principle move .dynamic to a
+ writable segment, it seems better to allocate a spare program
+ header instead, and avoid the need to move any sections.
+ There is a long tradition of allocating spare dynamic tags,
+ so allocating a spare program header seems like a natural
+ extension. */
+ if (!SGI_COMPAT (abfd)
+ && bfd_get_section_by_name (abfd, ".dynamic"))
+ {
+ for (pm = &elf_tdata (abfd)->segment_map; *pm != NULL; pm = &(*pm)->next)
+ if ((*pm)->p_type == PT_NULL)
+ break;
+ if (*pm == NULL)
+ {
+ m = bfd_zalloc (abfd, sizeof (*m));
+ if (m == NULL)
+ return FALSE;
+
+ m->p_type = PT_NULL;
+ *pm = m;
+ }
+ }
+
return TRUE;
}
@@ -9377,7 +9551,7 @@ _bfd_mips_elf_modify_segment_map (bfd *abfd,
asection *
_bfd_mips_elf_gc_mark_hook (asection *sec,
- struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info,
Elf_Internal_Rela *rel,
struct elf_link_hash_entry *h,
Elf_Internal_Sym *sym)
@@ -9385,32 +9559,14 @@ _bfd_mips_elf_gc_mark_hook (asection *sec,
/* ??? Do mips16 stub sections need to be handled special? */
if (h != NULL)
- {
- switch (ELF_R_TYPE (sec->owner, rel->r_info))
- {
- case R_MIPS_GNU_VTINHERIT:
- case R_MIPS_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
- }
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
+ switch (ELF_R_TYPE (sec->owner, rel->r_info))
+ {
+ case R_MIPS_GNU_VTINHERIT:
+ case R_MIPS_GNU_VTENTRY:
+ return NULL;
+ }
- return NULL;
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
/* Update the got entry reference counts for the section being removed. */
@@ -9505,7 +9661,7 @@ _bfd_mips_elf_hide_symbol (struct bfd_link_info *info,
dynobj = elf_hash_table (info)->dynobj;
if (dynobj != NULL && force_local && h->root.type != STT_TLS
- && (got = mips_elf_got_section (dynobj, FALSE)) != NULL
+ && (got = mips_elf_got_section (dynobj, TRUE)) != NULL
&& (g = mips_elf_section_data (got)->u.got_info) != NULL)
{
if (g->next)
@@ -9630,8 +9786,9 @@ _bfd_mips_elf_ignore_discarded_relocs (asection *sec)
}
bfd_boolean
-_bfd_mips_elf_write_section (bfd *output_bfd, asection *sec,
- bfd_byte *contents)
+_bfd_mips_elf_write_section (bfd *output_bfd,
+ struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
+ asection *sec, bfd_byte *contents)
{
bfd_byte *to, *from, *end;
int i;
@@ -10430,7 +10587,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
mdebug_sec = o;
}
- if (strncmp (o->name, ".gptab.", sizeof ".gptab." - 1) == 0)
+ if (CONST_STRNEQ (o->name, ".gptab."))
{
const char *subname;
unsigned int c;
@@ -10805,6 +10962,112 @@ mips_32bit_flags_p (flagword flags)
}
+/* Merge object attributes from IBFD into OBFD. Raise an error if
+ there are conflicting attributes. */
+static bfd_boolean
+mips_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
+{
+ obj_attribute *in_attr;
+ obj_attribute *out_attr;
+
+ if (!elf_known_obj_attributes_proc (obfd)[0].i)
+ {
+ /* This is the first object. Copy the attributes. */
+ _bfd_elf_copy_obj_attributes (ibfd, obfd);
+
+ /* Use the Tag_null value to indicate the attributes have been
+ initialized. */
+ elf_known_obj_attributes_proc (obfd)[0].i = 1;
+
+ return TRUE;
+ }
+
+ /* Check for conflicting Tag_GNU_MIPS_ABI_FP attributes and merge
+ non-conflicting ones. */
+ in_attr = elf_known_obj_attributes (ibfd)[OBJ_ATTR_GNU];
+ out_attr = elf_known_obj_attributes (obfd)[OBJ_ATTR_GNU];
+ if (in_attr[Tag_GNU_MIPS_ABI_FP].i != out_attr[Tag_GNU_MIPS_ABI_FP].i)
+ {
+ out_attr[Tag_GNU_MIPS_ABI_FP].type = 1;
+ if (out_attr[Tag_GNU_MIPS_ABI_FP].i == 0)
+ out_attr[Tag_GNU_MIPS_ABI_FP].i = in_attr[Tag_GNU_MIPS_ABI_FP].i;
+ else if (in_attr[Tag_GNU_MIPS_ABI_FP].i == 0)
+ ;
+ else if (in_attr[Tag_GNU_MIPS_ABI_FP].i > 3)
+ _bfd_error_handler
+ (_("Warning: %B uses unknown floating point ABI %d"), ibfd,
+ in_attr[Tag_GNU_MIPS_ABI_FP].i);
+ else if (out_attr[Tag_GNU_MIPS_ABI_FP].i > 3)
+ _bfd_error_handler
+ (_("Warning: %B uses unknown floating point ABI %d"), obfd,
+ out_attr[Tag_GNU_MIPS_ABI_FP].i);
+ else
+ switch (out_attr[Tag_GNU_MIPS_ABI_FP].i)
+ {
+ case 1:
+ switch (in_attr[Tag_GNU_MIPS_ABI_FP].i)
+ {
+ case 2:
+ _bfd_error_handler
+ (_("Warning: %B uses -msingle-float, %B uses -mdouble-float"),
+ obfd, ibfd);
+
+ case 3:
+ _bfd_error_handler
+ (_("Warning: %B uses hard float, %B uses soft float"),
+ obfd, ibfd);
+ break;
+
+ default:
+ abort ();
+ }
+ break;
+
+ case 2:
+ switch (in_attr[Tag_GNU_MIPS_ABI_FP].i)
+ {
+ case 1:
+ _bfd_error_handler
+ (_("Warning: %B uses -msingle-float, %B uses -mdouble-float"),
+ ibfd, obfd);
+
+ case 3:
+ _bfd_error_handler
+ (_("Warning: %B uses hard float, %B uses soft float"),
+ obfd, ibfd);
+ break;
+
+ default:
+ abort ();
+ }
+ break;
+
+ case 3:
+ switch (in_attr[Tag_GNU_MIPS_ABI_FP].i)
+ {
+ case 1:
+ case 2:
+ _bfd_error_handler
+ (_("Warning: %B uses hard float, %B uses soft float"),
+ ibfd, obfd);
+ break;
+
+ default:
+ abort ();
+ }
+ break;
+
+ default:
+ abort ();
+ }
+ }
+
+ /* Merge Tag_compatibility attributes and any common GNU ones. */
+ _bfd_elf_merge_object_attributes (ibfd, obfd);
+
+ return TRUE;
+}
+
/* Merge backend specific data from an object file to the output
object file when linking. */
@@ -10838,6 +11101,9 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
return FALSE;
}
+ if (!mips_elf_merge_obj_attributes (ibfd, obfd))
+ return FALSE;
+
new_flags = elf_elfheader (ibfd)->e_flags;
elf_elfheader (obfd)->e_flags |= new_flags & EF_MIPS_NOREORDER;
old_flags = elf_elfheader (obfd)->e_flags;
@@ -10850,7 +11116,9 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
= elf_elfheader (ibfd)->e_ident[EI_CLASS];
if (bfd_get_arch (obfd) == bfd_get_arch (ibfd)
- && bfd_get_arch_info (obfd)->the_default)
+ && (bfd_get_arch_info (obfd)->the_default
+ || mips_mach_extends_p (bfd_get_mach (obfd),
+ bfd_get_mach (ibfd))))
{
if (! bfd_set_arch_mach (obfd, bfd_get_arch (ibfd),
bfd_get_mach (ibfd)))
@@ -11061,37 +11329,52 @@ _bfd_mips_elf_print_private_bfd_data (bfd *abfd, void *ptr)
fprintf (file, _(" [no abi set]"));
if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_1)
- fprintf (file, _(" [mips1]"));
+ fprintf (file, " [mips1]");
else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_2)
- fprintf (file, _(" [mips2]"));
+ fprintf (file, " [mips2]");
else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_3)
- fprintf (file, _(" [mips3]"));
+ fprintf (file, " [mips3]");
else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_4)
- fprintf (file, _(" [mips4]"));
+ fprintf (file, " [mips4]");
else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_5)
- fprintf (file, _(" [mips5]"));
+ fprintf (file, " [mips5]");
else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_32)
- fprintf (file, _(" [mips32]"));
+ fprintf (file, " [mips32]");
else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_64)
- fprintf (file, _(" [mips64]"));
+ fprintf (file, " [mips64]");
else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_32R2)
- fprintf (file, _(" [mips32r2]"));
+ fprintf (file, " [mips32r2]");
else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_64R2)
- fprintf (file, _(" [mips64r2]"));
+ fprintf (file, " [mips64r2]");
else
fprintf (file, _(" [unknown ISA]"));
if (elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH_ASE_MDMX)
- fprintf (file, _(" [mdmx]"));
+ fprintf (file, " [mdmx]");
if (elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH_ASE_M16)
- fprintf (file, _(" [mips16]"));
+ fprintf (file, " [mips16]");
if (elf_elfheader (abfd)->e_flags & EF_MIPS_32BITMODE)
- fprintf (file, _(" [32bitmode]"));
+ fprintf (file, " [32bitmode]");
else
fprintf (file, _(" [not 32bitmode]"));
+ if (elf_elfheader (abfd)->e_flags & EF_MIPS_NOREORDER)
+ fprintf (file, " [noreorder]");
+
+ if (elf_elfheader (abfd)->e_flags & EF_MIPS_PIC)
+ fprintf (file, " [PIC]");
+
+ if (elf_elfheader (abfd)->e_flags & EF_MIPS_CPIC)
+ fprintf (file, " [CPIC]");
+
+ if (elf_elfheader (abfd)->e_flags & EF_MIPS_XGOT)
+ fprintf (file, " [XGOT]");
+
+ if (elf_elfheader (abfd)->e_flags & EF_MIPS_UCODE)
+ fprintf (file, " [UCODE]");
+
fputc ('\n', file);
return TRUE;
@@ -11099,24 +11382,34 @@ _bfd_mips_elf_print_private_bfd_data (bfd *abfd, void *ptr)
const struct bfd_elf_special_section _bfd_mips_elf_special_sections[] =
{
- { ".lit4", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
- { ".lit8", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
- { ".mdebug", 7, 0, SHT_MIPS_DEBUG, 0 },
- { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
- { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
- { ".ucode", 6, 0, SHT_MIPS_UCODE, 0 },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".lit4"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
+ { STRING_COMMA_LEN (".lit8"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
+ { STRING_COMMA_LEN (".mdebug"), 0, SHT_MIPS_DEBUG, 0 },
+ { STRING_COMMA_LEN (".sbss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
+ { STRING_COMMA_LEN (".sdata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
+ { STRING_COMMA_LEN (".ucode"), 0, SHT_MIPS_UCODE, 0 },
+ { NULL, 0, 0, 0, 0 }
};
-/* Ensure that the STO_OPTIONAL flag is copied into h->other,
- even if this is not a defintion of the symbol. */
+/* Merge non visibility st_other attributes. Ensure that the
+ STO_OPTIONAL flag is copied into h->other, even if this is not a
+ definiton of the symbol. */
void
_bfd_mips_elf_merge_symbol_attribute (struct elf_link_hash_entry *h,
const Elf_Internal_Sym *isym,
bfd_boolean definition,
bfd_boolean dynamic ATTRIBUTE_UNUSED)
{
- if (! definition
+ if ((isym->st_other & ~ELF_ST_VISIBILITY (-1)) != 0)
+ {
+ unsigned char other;
+
+ other = (definition ? isym->st_other : h->other);
+ other &= ~ELF_ST_VISIBILITY (-1);
+ h->other = other | ELF_ST_VISIBILITY (h->other);
+ }
+
+ if (!definition
&& ELF_MIPS_IS_OPTIONAL (isym->st_other))
h->other |= STO_OPTIONAL;
}
@@ -11128,3 +11421,11 @@ _bfd_mips_elf_ignore_undef_symbol (struct elf_link_hash_entry *h)
{
return ELF_MIPS_IS_OPTIONAL (h->other) ? TRUE : FALSE;
}
+
+bfd_boolean
+_bfd_mips_elf_common_definition (Elf_Internal_Sym *sym)
+{
+ return (sym->st_shndx == SHN_COMMON
+ || sym->st_shndx == SHN_MIPS_ACOMMON
+ || sym->st_shndx == SHN_MIPS_SCOMMON);
+}
diff --git a/bfd/elfxx-mips.h b/bfd/elfxx-mips.h
index 6c3c9a30f6e5..3e97cc04ab62 100644
--- a/bfd/elfxx-mips.h
+++ b/bfd/elfxx-mips.h
@@ -1,5 +1,6 @@
/* MIPS ELF specific backend routines.
- Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright 2002, 2003, 2004, 2005, 2006
+ Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -68,7 +69,7 @@ extern bfd_boolean _bfd_mips_elf_finish_dynamic_sections
extern void _bfd_mips_elf_final_write_processing
(bfd *, bfd_boolean);
extern int _bfd_mips_elf_additional_program_headers
- (bfd *);
+ (bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_mips_elf_modify_segment_map
(bfd *, struct bfd_link_info *);
extern asection * _bfd_mips_elf_gc_mark_hook
@@ -108,7 +109,7 @@ extern bfd_boolean _bfd_mips_elf_print_private_bfd_data
extern bfd_boolean _bfd_mips_elf_discard_info
(bfd *, struct elf_reloc_cookie *, struct bfd_link_info *);
extern bfd_boolean _bfd_mips_elf_write_section
- (bfd *, asection *, bfd_byte *);
+ (bfd *, struct bfd_link_info *, asection *, bfd_byte *);
extern bfd_boolean _bfd_mips_elf_read_ecoff_info
(bfd *, asection *, struct ecoff_debug_info *);
@@ -141,6 +142,9 @@ extern bfd_boolean _bfd_mips_elf_ignore_undef_symbol
extern const struct bfd_elf_special_section _bfd_mips_elf_special_sections [];
+extern bfd_boolean _bfd_mips_elf_common_definition (Elf_Internal_Sym *);
+
+#define elf_backend_common_definition _bfd_mips_elf_common_definition
#define elf_backend_name_local_section_symbols \
_bfd_mips_elf_name_local_section_symbols
#define elf_backend_special_sections _bfd_mips_elf_special_sections
diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c
index ef7ff482d2ed..708af290e3c4 100644
--- a/bfd/elfxx-sparc.c
+++ b/bfd/elfxx-sparc.c
@@ -1,5 +1,5 @@
/* SPARC-specific support for ELF
- Copyright 2005, 2006 Free Software Foundation, Inc.
+ Copyright 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -19,8 +19,8 @@
/* This file handles functionality common to the different SPARC ABI's. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "libiberty.h"
@@ -385,6 +385,30 @@ _bfd_sparc_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
}
reloc_howto_type *
+_bfd_sparc_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < (sizeof (_bfd_sparc_elf_howto_table)
+ / sizeof (_bfd_sparc_elf_howto_table[0]));
+ i++)
+ if (_bfd_sparc_elf_howto_table[i].name != NULL
+ && strcasecmp (_bfd_sparc_elf_howto_table[i].name, r_name) == 0)
+ return &_bfd_sparc_elf_howto_table[i];
+
+ if (strcasecmp (sparc_vtinherit_howto.name, r_name) == 0)
+ return &sparc_vtinherit_howto;
+ if (strcasecmp (sparc_vtentry_howto.name, r_name) == 0)
+ return &sparc_vtentry_howto;
+ if (strcasecmp (sparc_rev32_howto.name, r_name) == 0)
+ return &sparc_rev32_howto;
+
+ return NULL;
+}
+
+reloc_howto_type *
_bfd_sparc_elf_info_to_howto_ptr (unsigned int r_type)
{
switch (r_type)
@@ -487,11 +511,14 @@ struct _bfd_sparc_elf_obj_tdata
bfd_boolean
_bfd_sparc_elf_mkobject (bfd *abfd)
{
- bfd_size_type amt = sizeof (struct _bfd_sparc_elf_obj_tdata);
- abfd->tdata.any = bfd_zalloc (abfd, amt);
if (abfd->tdata.any == NULL)
- return FALSE;
- return TRUE;
+ {
+ bfd_size_type amt = sizeof (struct _bfd_sparc_elf_obj_tdata);
+ abfd->tdata.any = bfd_zalloc (abfd, amt);
+ if (abfd->tdata.any == NULL)
+ return FALSE;
+ }
+ return bfd_elf_mkobject (abfd);
}
static void
@@ -507,27 +534,14 @@ sparc_put_word_64 (bfd *bfd, bfd_vma val, void *ptr)
}
static void
-sparc_elf_append_rela_64 (bfd *abfd ATTRIBUTE_UNUSED,
- asection *s ATTRIBUTE_UNUSED,
- Elf_Internal_Rela *rel ATTRIBUTE_UNUSED)
+sparc_elf_append_rela (bfd *abfd, asection *s, Elf_Internal_Rela *rel)
{
-#ifdef BFD64
- Elf64_External_Rela *loc64;
-
- loc64 = (Elf64_External_Rela *) s->contents;
- loc64 += s->reloc_count++;
- bfd_elf64_swap_reloca_out (abfd, rel, (bfd_byte *) loc64);
-#endif
-}
-
-static void
-sparc_elf_append_rela_32 (bfd *abfd, asection *s, Elf_Internal_Rela *rel)
-{
- Elf32_External_Rela *loc32;
+ const struct elf_backend_data *bed;
+ bfd_byte *loc;
- loc32 = (Elf32_External_Rela *) s->contents;
- loc32 += s->reloc_count++;
- bfd_elf32_swap_reloca_out (abfd, rel, (bfd_byte *) loc32);
+ bed = get_elf_backend_data (abfd);
+ loc = s->contents + (s->reloc_count++ * bed->s->sizeof_rela);
+ bed->s->swap_reloca_out (abfd, rel, loc);
}
static bfd_vma
@@ -746,9 +760,6 @@ static const bfd_vma sparc_vxworks_shared_plt_entry[] =
#define SPARC_ELF_PUT_WORD(htab, bfd, val, ptr) \
htab->put_word(bfd, val, ptr)
-#define SPARC_ELF_APPEND_RELA(htab, bfd, sec, rela) \
- htab->append_rela(bfd, sec, rela)
-
#define SPARC_ELF_R_INFO(htab, in_rel, index, type) \
htab->r_info(in_rel, index, type)
@@ -824,7 +835,6 @@ _bfd_sparc_elf_link_hash_table_create (bfd *abfd)
if (ABI_64_P (abfd))
{
ret->put_word = sparc_put_word_64;
- ret->append_rela = sparc_elf_append_rela_64;
ret->r_info = sparc_elf_r_info_64;
ret->r_symndx = sparc_elf_r_symndx_64;
ret->dtpoff_reloc = R_SPARC_TLS_DTPOFF64;
@@ -840,7 +850,6 @@ _bfd_sparc_elf_link_hash_table_create (bfd *abfd)
else
{
ret->put_word = sparc_put_word_32;
- ret->append_rela = sparc_elf_append_rela_32;
ret->r_info = sparc_elf_r_info_32;
ret->r_symndx = sparc_elf_r_symndx_32;
ret->dtpoff_reloc = R_SPARC_TLS_DTPOFF32;
@@ -1427,7 +1436,7 @@ _bfd_sparc_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (abfd, sec),
name + 5) == 0);
@@ -1529,35 +1538,14 @@ _bfd_sparc_elf_gc_mark_hook (asection *sec,
Elf_Internal_Sym *sym)
{
if (h != NULL)
- {
- struct _bfd_sparc_elf_link_hash_table *htab;
-
- htab = _bfd_sparc_elf_hash_table (info);
- switch (SPARC_ELF_R_TYPE (rel->r_info))
+ switch (SPARC_ELF_R_TYPE (rel->r_info))
{
case R_SPARC_GNU_VTINHERIT:
case R_SPARC_GNU_VTENTRY:
- break;
-
- default:
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
-
- default:
- break;
- }
+ return NULL;
}
- }
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
- return NULL;
+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
/* Update the got entry reference counts for the section being removed. */
@@ -1713,7 +1701,6 @@ _bfd_sparc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
struct _bfd_sparc_elf_link_hash_entry * eh;
struct _bfd_sparc_elf_dyn_relocs *p;
asection *s;
- unsigned int power_of_two;
htab = _bfd_sparc_elf_hash_table (info);
@@ -1830,29 +1817,9 @@ _bfd_sparc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
h->needs_copy = 1;
}
- /* We need to figure out the alignment required for this symbol. I
- have no idea how ELF linkers handle this. */
- power_of_two = bfd_log2 (h->size);
- if (power_of_two > htab->align_power_max)
- power_of_two = htab->align_power_max;
-
- /* Apply the required alignment. */
s = htab->sdynbss;
- s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two));
- if (power_of_two > bfd_get_section_alignment (dynobj, s))
- {
- if (! bfd_set_section_alignment (dynobj, s, power_of_two))
- return FALSE;
- }
-
- /* Define the symbol as being at this point in the section. */
- h->root.u.def.section = s;
- h->root.u.def.value = s->size;
-
- /* Increment the section size to make room for the symbol. */
- s->size += h->size;
- return TRUE;
+ return _bfd_elf_adjust_dynamic_copy (h, s);
}
/* Allocate space in .plt, .got and associated reloc sections for
@@ -2287,7 +2254,7 @@ _bfd_sparc_elf_size_dynamic_sections (bfd *output_bfd,
/* Strip this section if we don't need it; see the
comment below. */
}
- else if (strncmp (s->name, ".rela", 5) == 0)
+ else if (CONST_STRNEQ (s->name, ".rela"))
{
if (s->size != 0)
{
@@ -2434,13 +2401,16 @@ _bfd_sparc_elf_size_dynamic_sections (bfd *output_bfd,
bfd_boolean
_bfd_sparc_elf_new_section_hook (bfd *abfd, asection *sec)
{
- struct _bfd_sparc_elf_section_data *sdata;
- bfd_size_type amt = sizeof (*sdata);
+ if (!sec->used_by_bfd)
+ {
+ struct _bfd_sparc_elf_section_data *sdata;
+ bfd_size_type amt = sizeof (*sdata);
- sdata = (struct _bfd_sparc_elf_section_data *) bfd_zalloc (abfd, amt);
- if (sdata == NULL)
- return FALSE;
- sec->used_by_bfd = (PTR) sdata;
+ sdata = bfd_zalloc (abfd, amt);
+ if (sdata == NULL)
+ return FALSE;
+ sec->used_by_bfd = sdata;
+ }
return _bfd_elf_new_section_hook (abfd, sec);
}
@@ -2486,10 +2456,14 @@ tpoff (struct bfd_link_info *info, bfd_vma address)
/* Relocate a SPARC ELF section. */
bfd_boolean
-_bfd_sparc_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
- bfd *input_bfd, asection *input_section,
- bfd_byte *contents, Elf_Internal_Rela *relocs,
- Elf_Internal_Sym *local_syms, asection **local_sections)
+_bfd_sparc_elf_relocate_section (bfd *output_bfd,
+ struct bfd_link_info *info,
+ bfd *input_bfd,
+ asection *input_section,
+ bfd_byte *contents,
+ Elf_Internal_Rela *relocs,
+ Elf_Internal_Sym *local_syms,
+ asection **local_sections)
{
struct _bfd_sparc_elf_link_hash_table *htab;
Elf_Internal_Shdr *symtab_hdr;
@@ -2501,9 +2475,6 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
Elf_Internal_Rela *relend;
int num_relocs;
- if (info->relocatable)
- return TRUE;
-
htab = _bfd_sparc_elf_hash_table (info);
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
@@ -2547,7 +2518,6 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
}
howto = _bfd_sparc_elf_howto_table + r_type;
- /* This is a final link. */
r_symndx = SPARC_ELF_R_SYMNDX (htab, rel->r_info);
h = NULL;
sym = NULL;
@@ -2579,6 +2549,21 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
}
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce
+ sections, or sections discarded by a linker script, we
+ just want the section contents zeroed. Avoid any
+ special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
switch (r_type)
{
case R_SPARC_GOT10:
@@ -2660,7 +2645,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
0, R_SPARC_RELATIVE);
outrel.r_addend = relocation;
relocation = 0;
- SPARC_ELF_APPEND_RELA (htab, output_bfd, s, &outrel);
+ sparc_elf_append_rela (output_bfd, s, &outrel);
}
SPARC_ELF_PUT_WORD (htab, output_bfd, relocation,
@@ -2767,11 +2752,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
case R_SPARC_L44:
case R_SPARC_UA64:
r_sparc_plt32:
- /* r_symndx will be zero only for relocs against symbols
- from removed linkonce sections, or sections discarded by
- a linker script. */
- if (r_symndx == 0
- || (input_section->flags & SEC_ALLOC) == 0)
+ if ((input_section->flags & SEC_ALLOC) == 0)
break;
if ((info->shared
@@ -2879,6 +2860,8 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
{
long indx;
+ outrel.r_addend = relocation + rel->r_addend;
+
if (is_plt)
sec = htab->splt;
@@ -2893,9 +2876,20 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
{
asection *osec;
+ /* We are turning this relocation into one
+ against a section symbol. It would be
+ proper to subtract the symbol's value,
+ osec->vma, from the emitted reloc addend,
+ but ld.so expects buggy relocs. */
osec = sec->output_section;
indx = elf_section_data (osec)->dynindx;
+ if (indx == 0)
+ {
+ osec = htab->elf.text_index_section;
+ indx = elf_section_data (osec)->dynindx;
+ }
+
/* FIXME: we really should be able to link non-pic
shared libraries. */
if (indx == 0)
@@ -2909,12 +2903,12 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
}
}
- outrel.r_info = SPARC_ELF_R_INFO (htab, rel, indx, r_type);
- outrel.r_addend = relocation + rel->r_addend;
+ outrel.r_info = SPARC_ELF_R_INFO (htab, rel, indx,
+ r_type);
}
}
- SPARC_ELF_APPEND_RELA (htab, output_bfd, sreloc, &outrel);
+ sparc_elf_append_rela (output_bfd, sreloc, &outrel);
/* This reloc will be computed at runtime, so there's no
need to do anything now. */
@@ -3022,7 +3016,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
else
outrel.r_addend = 0;
outrel.r_info = SPARC_ELF_R_INFO (htab, NULL, indx, dr_type);
- SPARC_ELF_APPEND_RELA (htab, output_bfd, htab->srelgot, &outrel);
+ sparc_elf_append_rela (output_bfd, htab->srelgot, &outrel);
if (r_type == R_SPARC_TLS_GD_HI22
|| r_type == R_SPARC_TLS_GD_LO10)
@@ -3043,7 +3037,8 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
outrel.r_info = SPARC_ELF_R_INFO (htab, NULL, indx,
SPARC_ELF_DTPOFF_RELOC (htab));
outrel.r_offset += SPARC_ELF_WORD_BYTES (htab);
- SPARC_ELF_APPEND_RELA (htab, output_bfd, htab->srelgot, &outrel);
+ sparc_elf_append_rela (output_bfd, htab->srelgot,
+ &outrel);
}
}
else if (dr_type == SPARC_ELF_DTPMOD_RELOC (htab))
@@ -3112,7 +3107,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
+ rel->r_addend;
}
- SPARC_ELF_APPEND_RELA (htab, output_bfd, sreloc, &outrel);
+ sparc_elf_append_rela (output_bfd, sreloc, &outrel);
continue;
}
relocation = tpoff (info, relocation);
@@ -3633,9 +3628,11 @@ _bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd,
{
bfd *dynobj;
struct _bfd_sparc_elf_link_hash_table *htab;
+ const struct elf_backend_data *bed;
htab = _bfd_sparc_elf_hash_table (info);
dynobj = htab->elf.dynobj;
+ bed = get_elf_backend_data (output_bfd);
if (h->plt.offset != (bfd_vma) -1)
{
@@ -3705,18 +3702,8 @@ _bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd,
thus .plt[4] has corresponding .rela.plt[0] and so on. */
loc = srela->contents;
-#ifdef BFD64
- if (ABI_64_P (output_bfd))
- {
- loc += rela_index * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
- }
- else
-#endif
- {
- loc += rela_index * sizeof (Elf32_External_Rela);
- bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
- }
+ loc += rela_index * bed->s->sizeof_rela;
+ bed->s->swap_reloca_out (output_bfd, &rela, loc);
if (!h->def_regular)
{
@@ -3773,7 +3760,7 @@ _bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd,
SPARC_ELF_PUT_WORD (htab, output_bfd, 0,
sgot->contents + (h->got.offset & ~(bfd_vma) 1));
- SPARC_ELF_APPEND_RELA (htab, output_bfd, srela, &rela);
+ sparc_elf_append_rela (output_bfd, srela, &rela);
}
if (h->needs_copy)
@@ -3793,7 +3780,7 @@ _bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd,
+ h->root.u.def.section->output_offset);
rela.r_info = SPARC_ELF_R_INFO (htab, NULL, h->dynindx, R_SPARC_COPY);
rela.r_addend = 0;
- SPARC_ELF_APPEND_RELA (htab, output_bfd, s, &rela);
+ sparc_elf_append_rela (output_bfd, s, &rela);
}
/* Mark some specially defined symbols as absolute. On VxWorks,
@@ -3809,83 +3796,30 @@ _bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd,
/* Finish up the dynamic sections. */
-#ifdef BFD64
static bfd_boolean
-sparc64_finish_dyn (bfd *output_bfd, struct bfd_link_info *info,
- bfd *dynobj, asection *sdyn,
- asection *splt ATTRIBUTE_UNUSED)
+sparc_finish_dyn (bfd *output_bfd, struct bfd_link_info *info,
+ bfd *dynobj, asection *sdyn,
+ asection *splt ATTRIBUTE_UNUSED)
{
- Elf64_External_Dyn *dyncon, *dynconend;
- int stt_regidx = -1;
-
- dyncon = (Elf64_External_Dyn *) sdyn->contents;
- dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->size);
- for (; dyncon < dynconend; dyncon++)
- {
- Elf_Internal_Dyn dyn;
- const char *name;
- bfd_boolean size;
-
- bfd_elf64_swap_dyn_in (dynobj, dyncon, &dyn);
-
- switch (dyn.d_tag)
- {
- case DT_PLTGOT: name = ".plt"; size = FALSE; break;
- case DT_PLTRELSZ: name = ".rela.plt"; size = TRUE; break;
- case DT_JMPREL: name = ".rela.plt"; size = FALSE; break;
- case DT_SPARC_REGISTER:
- if (stt_regidx == -1)
- {
- stt_regidx =
- _bfd_elf_link_lookup_local_dynindx (info, output_bfd, -1);
- if (stt_regidx == -1)
- return FALSE;
- }
- dyn.d_un.d_val = stt_regidx++;
- bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon);
- /* fallthrough */
- default: name = NULL; size = FALSE; break;
- }
-
- if (name != NULL)
- {
- asection *s;
-
- s = bfd_get_section_by_name (output_bfd, name);
- if (s == NULL)
- dyn.d_un.d_val = 0;
- else
- {
- if (! size)
- dyn.d_un.d_ptr = s->vma;
- else
- dyn.d_un.d_val = s->size;
- }
- bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon);
- }
- }
- return TRUE;
-}
-#endif
-
-static bfd_boolean
-sparc32_finish_dyn (bfd *output_bfd, struct bfd_link_info *info,
- bfd *dynobj, asection *sdyn,
- asection *splt ATTRIBUTE_UNUSED)
-{
- Elf32_External_Dyn *dyncon, *dynconend;
struct _bfd_sparc_elf_link_hash_table *htab;
+ const struct elf_backend_data *bed;
+ bfd_byte *dyncon, *dynconend;
+ size_t dynsize;
+ int stt_regidx = -1;
+ bfd_boolean abi_64_p;
htab = _bfd_sparc_elf_hash_table (info);
- dyncon = (Elf32_External_Dyn *) sdyn->contents;
- dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->size);
- for (; dyncon < dynconend; dyncon++)
+ bed = get_elf_backend_data (output_bfd);
+ dynsize = bed->s->sizeof_dyn;
+ dynconend = sdyn->contents + sdyn->size;
+ abi_64_p = ABI_64_P (output_bfd);
+ for (dyncon = sdyn->contents; dyncon < dynconend; dyncon += dynsize)
{
Elf_Internal_Dyn dyn;
const char *name;
bfd_boolean size;
- bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn);
+ bed->s->swap_dyn_in (dynobj, dyncon, &dyn);
if (htab->is_vxworks && dyn.d_tag == DT_RELASZ)
{
@@ -3894,7 +3828,7 @@ sparc32_finish_dyn (bfd *output_bfd, struct bfd_link_info *info,
if (htab->srelplt)
{
dyn.d_un.d_val -= htab->srelplt->size;
- bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+ bed->s->swap_dyn_out (output_bfd, &dyn, dyncon);
}
}
else if (htab->is_vxworks && dyn.d_tag == DT_PLTGOT)
@@ -3905,9 +3839,21 @@ sparc32_finish_dyn (bfd *output_bfd, struct bfd_link_info *info,
{
dyn.d_un.d_val = (htab->sgotplt->output_section->vma
+ htab->sgotplt->output_offset);
- bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+ bed->s->swap_dyn_out (output_bfd, &dyn, dyncon);
}
}
+ else if (abi_64_p && dyn.d_tag == DT_SPARC_REGISTER)
+ {
+ if (stt_regidx == -1)
+ {
+ stt_regidx =
+ _bfd_elf_link_lookup_local_dynindx (info, output_bfd, -1);
+ if (stt_regidx == -1)
+ return FALSE;
+ }
+ dyn.d_un.d_val = stt_regidx++;
+ bed->s->swap_dyn_out (output_bfd, &dyn, dyncon);
+ }
else
{
switch (dyn.d_tag)
@@ -3915,7 +3861,7 @@ sparc32_finish_dyn (bfd *output_bfd, struct bfd_link_info *info,
case DT_PLTGOT: name = ".plt"; size = FALSE; break;
case DT_PLTRELSZ: name = ".rela.plt"; size = TRUE; break;
case DT_JMPREL: name = ".rela.plt"; size = FALSE; break;
- default: name = NULL; size = FALSE; break;
+ default: name = NULL; size = FALSE; break;
}
if (name != NULL)
@@ -3932,7 +3878,7 @@ sparc32_finish_dyn (bfd *output_bfd, struct bfd_link_info *info,
else
dyn.d_un.d_val = s->size;
}
- bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+ bed->s->swap_dyn_out (output_bfd, &dyn, dyncon);
}
}
}
@@ -4046,20 +3992,12 @@ _bfd_sparc_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *i
if (elf_hash_table (info)->dynamic_sections_created)
{
asection *splt;
- bfd_boolean ret;
splt = bfd_get_section_by_name (dynobj, ".plt");
BFD_ASSERT (splt != NULL && sdyn != NULL);
-#ifdef BFD64
- if (ABI_64_P (output_bfd))
- ret = sparc64_finish_dyn (output_bfd, info, dynobj, sdyn, splt);
- else
-#endif
- ret = sparc32_finish_dyn (output_bfd, info, dynobj, sdyn, splt);
-
- if (ret != TRUE)
- return ret;
+ if (!sparc_finish_dyn (output_bfd, info, dynobj, sdyn, splt))
+ return FALSE;
/* Initialize the contents of the .plt section. */
if (splt->size > 0)
@@ -4081,7 +4019,8 @@ _bfd_sparc_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *i
}
elf_section_data (splt->output_section)->this_hdr.sh_entsize
- = htab->plt_entry_size;
+ = (htab->is_vxworks || !ABI_64_P (output_bfd))
+ ? 0 : htab->plt_entry_size;
}
/* Set the first entry in the global offset table to the address of
diff --git a/bfd/elfxx-sparc.h b/bfd/elfxx-sparc.h
index 0a5a88b6fe36..787fd33c6d7c 100644
--- a/bfd/elfxx-sparc.h
+++ b/bfd/elfxx-sparc.h
@@ -1,5 +1,5 @@
/* SPARC ELF specific backend routines.
- Copyright 2005 Free Software Foundation, Inc.
+ Copyright 2005, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -71,7 +71,6 @@ struct _bfd_sparc_elf_link_hash_table
asection *sgotplt;
void (*put_word) (bfd *, bfd_vma, void *);
- void (*append_rela) (bfd *, asection *, Elf_Internal_Rela *);
bfd_vma (*r_info) (Elf_Internal_Rela *, bfd_vma, bfd_vma);
bfd_vma (*r_symndx) (bfd_vma);
int (*build_plt_entry) (bfd *, asection *, bfd_vma, bfd_vma, bfd_vma *);
@@ -97,6 +96,8 @@ struct _bfd_sparc_elf_link_hash_table
extern reloc_howto_type *_bfd_sparc_elf_reloc_type_lookup
(bfd *, bfd_reloc_code_real_type);
+extern reloc_howto_type *_bfd_sparc_elf_reloc_name_lookup
+ (bfd *, const char *);
extern void _bfd_sparc_elf_info_to_howto
(bfd *, arelent *, Elf_Internal_Rela *);
extern reloc_howto_type *_bfd_sparc_elf_info_to_howto_ptr
diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h
index 503726d2b866..be0cfecfde03 100644
--- a/bfd/elfxx-target.h
+++ b/bfd/elfxx-target.h
@@ -29,7 +29,9 @@
#ifndef bfd_elfNN_close_and_cleanup
#define bfd_elfNN_close_and_cleanup _bfd_elf_close_and_cleanup
#endif
-#define bfd_elfNN_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
+#ifndef bfd_elfNN_bfd_free_cached_info
+#define bfd_elfNN_bfd_free_cached_info _bfd_free_cached_info
+#endif
#ifndef bfd_elfNN_get_section_contents
#define bfd_elfNN_get_section_contents _bfd_generic_get_section_contents
#endif
@@ -101,6 +103,9 @@
#ifndef elf_backend_want_p_paddr_set_to_zero
#define elf_backend_want_p_paddr_set_to_zero 0
#endif
+#ifndef elf_backend_default_execstack
+#define elf_backend_default_execstack 1
+#endif
#define bfd_elfNN_bfd_debug_info_start bfd_void
#define bfd_elfNN_bfd_debug_info_end bfd_void
@@ -129,7 +134,10 @@
#define elf_backend_gc_mark_dynamic_ref bfd_elf_gc_mark_dynamic_ref_symbol
#endif
#ifndef elf_backend_gc_mark_hook
-#define elf_backend_gc_mark_hook NULL
+#define elf_backend_gc_mark_hook _bfd_elf_gc_mark_hook
+#endif
+#ifndef elf_backend_gc_mark_extra_sections
+#define elf_backend_gc_mark_extra_sections NULL
#endif
#ifndef elf_backend_gc_sweep_hook
#define elf_backend_gc_sweep_hook NULL
@@ -283,6 +291,10 @@
#define elf_info_to_howto_rel 0
#endif
+#ifndef ELF_OSABI
+#define ELF_OSABI ELFOSABI_NONE
+#endif
+
#ifndef ELF_MAXPAGESIZE
#error ELF_MAXPAGESIZE is not defined
#define ELF_MAXPAGESIZE 1
@@ -292,6 +304,10 @@
#define ELF_MINPAGESIZE ELF_MAXPAGESIZE
#endif
+#ifndef ELF_COMMONPAGESIZE
+#define ELF_COMMONPAGESIZE ELF_MAXPAGESIZE
+#endif
+
#ifndef ELF_DYNAMIC_SEC_FLAGS
/* Note that we set the SEC_IN_MEMORY flag for these sections. */
#define ELF_DYNAMIC_SEC_FLAGS \
@@ -366,6 +382,9 @@
#ifndef elf_backend_check_directives
#define elf_backend_check_directives 0
#endif
+#ifndef elf_backend_as_needed_cleanup
+#define elf_backend_as_needed_cleanup 0
+#endif
#ifndef elf_backend_adjust_dynamic_symbol
#define elf_backend_adjust_dynamic_symbol 0
#endif
@@ -375,6 +394,10 @@
#ifndef elf_backend_size_dynamic_sections
#define elf_backend_size_dynamic_sections 0
#endif
+#ifndef elf_backend_init_index_section
+#define elf_backend_init_index_section \
+ ((void (*) (bfd *, struct bfd_link_info *)) bfd_void)
+#endif
#ifndef elf_backend_relocate_section
#define elf_backend_relocate_section 0
#endif
@@ -396,6 +419,9 @@
#ifndef elf_backend_modify_segment_map
#define elf_backend_modify_segment_map 0
#endif
+#ifndef elf_backend_modify_program_headers
+#define elf_backend_modify_program_headers 0
+#endif
#ifndef elf_backend_ecoff_debug_swap
#define elf_backend_ecoff_debug_swap 0
#endif
@@ -405,12 +431,27 @@
#ifndef elf_backend_got_header_size
#define elf_backend_got_header_size 0
#endif
+#ifndef elf_backend_obj_attrs_vendor
+#define elf_backend_obj_attrs_vendor NULL
+#endif
+#ifndef elf_backend_obj_attrs_section
+#define elf_backend_obj_attrs_section NULL
+#endif
+#ifndef elf_backend_obj_attrs_arg_type
+#define elf_backend_obj_attrs_arg_type NULL
+#endif
+#ifndef elf_backend_obj_attrs_section_type
+#define elf_backend_obj_attrs_section_type SHT_GNU_ATTRIBUTES
+#endif
#ifndef elf_backend_post_process_headers
#define elf_backend_post_process_headers NULL
#endif
#ifndef elf_backend_print_symbol_all
#define elf_backend_print_symbol_all NULL
#endif
+#ifndef elf_backend_output_arch_local_syms
+#define elf_backend_output_arch_local_syms NULL
+#endif
#ifndef elf_backend_output_arch_syms
#define elf_backend_output_arch_syms NULL
#endif
@@ -441,6 +482,9 @@
#ifndef elf_backend_grok_psinfo
#define elf_backend_grok_psinfo NULL
#endif
+#ifndef elf_backend_write_core_note
+#define elf_backend_write_core_note NULL
+#endif
#ifndef elf_backend_sprintf_vma
#define elf_backend_sprintf_vma _bfd_elf_sprintf_vma
#endif
@@ -551,15 +595,24 @@
#define elf_backend_merge_symbol NULL
#endif
+#ifndef elf_backend_hash_symbol
+#define elf_backend_hash_symbol _bfd_elf_hash_symbol
+#endif
+
+#ifndef elf_backend_is_function_type
+#define elf_backend_is_function_type _bfd_elf_is_function_type
+#endif
+
extern const struct elf_size_info _bfd_elfNN_size_info;
-#ifndef INCLUDED_TARGET_FILE
-static const struct elf_backend_data elfNN_bed =
+static struct elf_backend_data elfNN_bed =
{
ELF_ARCH, /* arch */
ELF_MACHINE_CODE, /* elf_machine_code */
+ ELF_OSABI, /* elf_osabi */
ELF_MAXPAGESIZE, /* maxpagesize */
ELF_MINPAGESIZE, /* minpagesize */
+ ELF_COMMONPAGESIZE, /* commonpagesize */
ELF_DYNAMIC_SEC_FLAGS, /* dynamic_sec_flags */
elf_info_to_howto,
elf_info_to_howto_rel,
@@ -583,9 +636,11 @@ static const struct elf_backend_data elfNN_bed =
elf_backend_omit_section_dynsym,
elf_backend_check_relocs,
elf_backend_check_directives,
+ elf_backend_as_needed_cleanup,
elf_backend_adjust_dynamic_symbol,
elf_backend_always_size_sections,
elf_backend_size_dynamic_sections,
+ elf_backend_init_index_section,
elf_backend_relocate_section,
elf_backend_finish_dynamic_symbol,
elf_backend_finish_dynamic_sections,
@@ -593,11 +648,14 @@ static const struct elf_backend_data elfNN_bed =
elf_backend_final_write_processing,
elf_backend_additional_program_headers,
elf_backend_modify_segment_map,
+ elf_backend_modify_program_headers,
elf_backend_gc_mark_dynamic_ref,
elf_backend_gc_mark_hook,
+ elf_backend_gc_mark_extra_sections,
elf_backend_gc_sweep_hook,
elf_backend_post_process_headers,
elf_backend_print_symbol_all,
+ elf_backend_output_arch_local_syms,
elf_backend_output_arch_syms,
elf_backend_copy_indirect_symbol,
elf_backend_hide_symbol,
@@ -608,6 +666,7 @@ static const struct elf_backend_data elfNN_bed =
elf_backend_count_relocs,
elf_backend_grok_prstatus,
elf_backend_grok_psinfo,
+ elf_backend_write_core_note,
elf_backend_sprintf_vma,
elf_backend_fprintf_vma,
elf_backend_reloc_type_class,
@@ -628,6 +687,8 @@ static const struct elf_backend_data elfNN_bed =
elf_backend_common_section_index,
elf_backend_common_section,
elf_backend_merge_symbol,
+ elf_backend_hash_symbol,
+ elf_backend_is_function_type,
elf_backend_link_order_error_handler,
elf_backend_relplt_name,
ELF_MACHINE_ALT1,
@@ -635,6 +696,10 @@ static const struct elf_backend_data elfNN_bed =
&elf_backend_size_info,
elf_backend_special_sections,
elf_backend_got_header_size,
+ elf_backend_obj_attrs_vendor,
+ elf_backend_obj_attrs_section,
+ elf_backend_obj_attrs_arg_type,
+ elf_backend_obj_attrs_section_type,
elf_backend_collect,
elf_backend_type_change_ok,
elf_backend_may_use_rel_p,
@@ -651,9 +716,9 @@ static const struct elf_backend_data elfNN_bed =
elf_backend_can_refcount,
elf_backend_want_got_sym,
elf_backend_want_dynbss,
- elf_backend_want_p_paddr_set_to_zero
+ elf_backend_want_p_paddr_set_to_zero,
+ elf_backend_default_execstack
};
-#endif
/* Forward declaration for use when initialising alternative_target field. */
#ifdef TARGET_LITTLE_SYM
diff --git a/bfd/format.c b/bfd/format.c
index 6a34dd2bea48..514389843530 100644
--- a/bfd/format.c
+++ b/bfd/format.c
@@ -1,6 +1,6 @@
/* Generic BFD support for file formats.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002,
- 2003, 2005 Free Software Foundation, Inc.
+ 2003, 2005, 2007 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -42,8 +42,8 @@ SUBSECTION
File format functions
*/
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
/* IMPORT from targets.c. */
diff --git a/bfd/freebsd.h b/bfd/freebsd.h
index 6d577ea4afbc..e453b4b21c3b 100644
--- a/bfd/freebsd.h
+++ b/bfd/freebsd.h
@@ -1,5 +1,5 @@
/* BFD back-end definitions used by all FreeBSD targets.
- Copyright 1990, 1991, 1992, 1996, 1997, 2000, 2001, 2002, 2005
+ Copyright 1990, 1991, 1992, 1996, 1997, 2000, 2001, 2002, 2005, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -51,8 +51,8 @@
((exec).a_info = \
((exec).a_info & 0x03ffffff) | ((flags & 0x03f) << 26))
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "libaout.h"
diff --git a/bfd/gen-aout.c b/bfd/gen-aout.c
index c81d3d0027b5..80e90c05eaea 100644
--- a/bfd/gen-aout.c
+++ b/bfd/gen-aout.c
@@ -1,5 +1,5 @@
/* Generate parameters for an a.out system.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2001, 2002
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2001, 2002, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -99,8 +99,8 @@ main (argc, argv)
printf("\n#define MY(OP) CONCAT2 (%s_,OP)\n\n", target);
printf("#define TARGETNAME \"a.out-%s\"\n\n", target);
- printf("#include \"bfd.h\"\n");
printf("#include \"sysdep.h\"\n");
+ printf("#include \"bfd.h\"\n");
printf("#include \"libbfd.h\"\n");
printf("#include \"libaout.h\"\n");
printf("\n#include \"aout-target.h\"\n");
diff --git a/bfd/hash.c b/bfd/hash.c
index ce9ba5c6297f..2b67dc5eb020 100644
--- a/bfd/hash.c
+++ b/bfd/hash.c
@@ -1,6 +1,6 @@
/* hash.c -- hash table routines for BFD
Copyright 1993, 1994, 1995, 1997, 1999, 2001, 2002, 2003, 2004, 2005,
- 2006 Free Software Foundation, Inc.
+ 2006, 2007 Free Software Foundation, Inc.
Written by Steve Chamberlain <sac@cygnus.com>
This file is part of BFD, the Binary File Descriptor library.
@@ -19,8 +19,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "objalloc.h"
#include "libiberty.h"
@@ -299,6 +299,58 @@ SUBSUBSECTION
/* The default number of entries to use when creating a hash table. */
#define DEFAULT_SIZE 4051
+
+/* The following function returns a nearest prime number which is
+ greater than N, and near a power of two. Copied from libiberty.
+ Returns zero for ridiculously large N to signify an error. */
+
+static unsigned long
+higher_prime_number (unsigned long n)
+{
+ /* These are primes that are near, but slightly smaller than, a
+ power of two. */
+ static const unsigned long primes[] = {
+ (unsigned long) 127,
+ (unsigned long) 2039,
+ (unsigned long) 32749,
+ (unsigned long) 65521,
+ (unsigned long) 131071,
+ (unsigned long) 262139,
+ (unsigned long) 524287,
+ (unsigned long) 1048573,
+ (unsigned long) 2097143,
+ (unsigned long) 4194301,
+ (unsigned long) 8388593,
+ (unsigned long) 16777213,
+ (unsigned long) 33554393,
+ (unsigned long) 67108859,
+ (unsigned long) 134217689,
+ (unsigned long) 268435399,
+ (unsigned long) 536870909,
+ (unsigned long) 1073741789,
+ (unsigned long) 2147483647,
+ /* 4294967291L */
+ ((unsigned long) 2147483647) + ((unsigned long) 2147483644),
+ };
+
+ const unsigned long *low = &primes[0];
+ const unsigned long *high = &primes[sizeof (primes) / sizeof (primes[0])];
+
+ while (low != high)
+ {
+ const unsigned long *mid = low + (high - low) / 2;
+ if (n >= *mid)
+ low = mid + 1;
+ else
+ high = mid;
+ }
+
+ if (n >= *low)
+ return 0;
+
+ return *low;
+}
+
static size_t bfd_default_hash_table_size = DEFAULT_SIZE;
/* Create a new hash table, given a number of entries. */
@@ -330,6 +382,8 @@ bfd_hash_table_init_n (struct bfd_hash_table *table,
memset ((void *) table->table, 0, alloc);
table->size = size;
table->entsize = entsize;
+ table->count = 0;
+ table->frozen = 0;
table->newfunc = newfunc;
return TRUE;
}
@@ -416,6 +470,45 @@ bfd_hash_lookup (struct bfd_hash_table *table,
hashp->hash = hash;
hashp->next = table->table[index];
table->table[index] = hashp;
+ table->count++;
+
+ if (!table->frozen && table->count > table->size * 3 / 4)
+ {
+ unsigned long newsize = higher_prime_number (table->size);
+ struct bfd_hash_entry **newtable;
+ unsigned int hi;
+ unsigned long alloc = newsize * sizeof (struct bfd_hash_entry *);
+
+ /* If we can't find a higher prime, or we can't possibly alloc
+ that much memory, don't try to grow the table. */
+ if (newsize == 0 || alloc / sizeof (struct bfd_hash_entry *) != newsize)
+ {
+ table->frozen = 1;
+ return hashp;
+ }
+
+ newtable = ((struct bfd_hash_entry **)
+ objalloc_alloc ((struct objalloc *) table->memory, alloc));
+ memset ((PTR) newtable, 0, alloc);
+
+ for (hi = 0; hi < table->size; hi ++)
+ while (table->table[hi])
+ {
+ struct bfd_hash_entry *chain = table->table[hi];
+ struct bfd_hash_entry *chain_end = chain;
+ int index;
+
+ while (chain_end->next && chain_end->next->hash == chain->hash)
+ chain_end = chain_end->next;
+
+ table->table[hi] = chain_end->next;
+ index = chain->hash % newsize;
+ chain_end->next = newtable[index];
+ newtable[index] = chain;
+ }
+ table->table = newtable;
+ table->size = newsize;
+ }
return hashp;
}
@@ -480,14 +573,17 @@ bfd_hash_traverse (struct bfd_hash_table *table,
{
unsigned int i;
+ table->frozen = 1;
for (i = 0; i < table->size; i++)
{
struct bfd_hash_entry *p;
for (p = table->table[i]; p != NULL; p = p->next)
if (! (*func) (p, info))
- return;
+ goto out;
}
+ out:
+ table->frozen = 0;
}
void
diff --git a/bfd/host-aout.c b/bfd/host-aout.c
index 902a0206696c..12e59510d86c 100644
--- a/bfd/host-aout.c
+++ b/bfd/host-aout.c
@@ -1,5 +1,5 @@
/* BFD backend for local host's a.out binaries
- Copyright 1990, 1991, 1992, 1994, 1995, 2001
+ Copyright 1990, 1991, 1992, 1994, 1995, 2001, 2007
Free Software Foundation, Inc.
Written by Cygnus Support. Probably John Gilmore's fault.
@@ -19,8 +19,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#define ARCH_SIZE 32
diff --git a/bfd/hp300bsd.c b/bfd/hp300bsd.c
index 91d994cc3ae5..43a6caf45c18 100644
--- a/bfd/hp300bsd.c
+++ b/bfd/hp300bsd.c
@@ -1,5 +1,6 @@
/* BFD back-end for HP 9000/300 (68000-based) machines running BSD Unix.
- Copyright 1992, 1994, 1995, 2001, 2003 Free Software Foundation, Inc.
+ Copyright 1992, 1994, 1995, 2001, 2003, 2007
+ Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -32,8 +33,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
#define MY(OP) CONCAT2 (hp300bsd_,OP)
#define TARGETNAME "a.out-hp300bsd"
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "libaout.h"
diff --git a/bfd/hppabsd-core.c b/bfd/hppabsd-core.c
index 67627e7a6664..7de1c0199bee 100644
--- a/bfd/hppabsd-core.c
+++ b/bfd/hppabsd-core.c
@@ -1,6 +1,6 @@
/* BFD back-end for HPPA BSD core files.
- Copyright 1993, 1994, 1995, 1998, 1999, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1998, 1999, 2001, 2002, 2003, 2004, 2005,
+ 2006, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -33,8 +33,8 @@
I would not expect this to be of use to any other host/target, but
you never know. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#if defined (HOST_HPPABSD)
@@ -90,11 +90,10 @@ make_bfd_asection (abfd, name, flags, size, offset, alignment_power)
{
asection *asect;
- asect = bfd_make_section (abfd, name);
+ asect = bfd_make_section_with_flags (abfd, name, flags);
if (!asect)
return NULL;
- asect->flags = flags;
asect->size = size;
asect->filepos = offset;
asect->alignment_power = alignment_power;
diff --git a/bfd/hpux-core.c b/bfd/hpux-core.c
index 08adcd3a1e6d..64ce41703e6e 100644
--- a/bfd/hpux-core.c
+++ b/bfd/hpux-core.c
@@ -1,6 +1,6 @@
/* BFD back-end for HP/UX core files.
- Copyright 1993, 1994, 1996, 1998, 1999, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1996, 1998, 1999, 2001, 2002, 2003, 2004, 2006,
+ 2007 Free Software Foundation, Inc.
Written by Stu Grossman, Cygnus Support.
Converted to back-end form by Ian Lance Taylor, Cygnus SUpport
@@ -23,8 +23,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
/* This file can only be compiled on systems which use HP/UX style
core files. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#if defined (HOST_HPPAHPUX) || defined (HOST_HP300HPUX) || defined (HOST_HPPAMPEIX)
@@ -124,11 +124,10 @@ make_bfd_asection (bfd *abfd, const char *name, flagword flags,
strcpy (newname, name);
- asect = bfd_make_section_anyway (abfd, newname);
+ asect = bfd_make_section_anyway_with_flags (abfd, newname, flags);
if (!asect)
return NULL;
- asect->flags = flags;
asect->size = size;
asect->vma = vma;
asect->filepos = bfd_tell (abfd);
@@ -145,7 +144,7 @@ thread_section_p (bfd *abfd ATTRIBUTE_UNUSED,
asection *sect,
void *obj ATTRIBUTE_UNUSED)
{
- return (strncmp (sect->name, ".reg/", 5) == 0);
+ return CONST_STRNEQ (sect->name, ".reg/");
}
/* this function builds a bfd target if the file is a corefile.
diff --git a/bfd/i386aout.c b/bfd/i386aout.c
index 128e9d20dc04..936ffb21de15 100644
--- a/bfd/i386aout.c
+++ b/bfd/i386aout.c
@@ -1,6 +1,6 @@
/* BFD back-end for i386 a.out binaries.
- Copyright 1990, 1991, 1992, 1994, 1996, 1997, 2001, 2002, 2003, 2005
- Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1992, 1994, 1996, 1997, 2001, 2002, 2003, 2005,
+ 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -39,8 +39,8 @@
#define TARGETNAME "a.out-i386"
#define NO_WRITE_HEADER_KLUDGE 1
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "aout/aout64.h"
#include "libaout.h"
diff --git a/bfd/i386bsd.c b/bfd/i386bsd.c
index 3f98ee4025cb..f8b109edae7b 100644
--- a/bfd/i386bsd.c
+++ b/bfd/i386bsd.c
@@ -1,5 +1,5 @@
/* BFD back-end for i386 a.out binaries under BSD.
- Copyright 1990, 1991, 1992, 1993, 1994, 2001
+ Copyright 1990, 1991, 1992, 1993, 1994, 2001, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -42,8 +42,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
#define MY(OP) CONCAT2 (i386bsd_,OP)
#define TARGETNAME "a.out-i386-bsd"
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "libaout.h"
diff --git a/bfd/i386linux.c b/bfd/i386linux.c
index 17c618006ff3..83f9965a3c36 100644
--- a/bfd/i386linux.c
+++ b/bfd/i386linux.c
@@ -1,6 +1,6 @@
/* BFD back-end for linux flavored i386 a.out binaries.
Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2001, 2002, 2003,
- 2004, 2006 Free Software Foundation, Inc.
+ 2004, 2006, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -26,8 +26,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
#define MACHTYPE_OK(mtype) ((mtype) == M_386 || (mtype) == M_UNKNOWN)
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "aout/aout64.h"
#include "aout/stab_gnu.h"
@@ -93,8 +93,7 @@ i386linux_write_object_contents (abfd)
#define GOT_REF_PREFIX "__GOT_"
#endif
-#define IS_GOT_SYM(name) \
- (strncmp (name, GOT_REF_PREFIX, sizeof GOT_REF_PREFIX - 1) == 0)
+#define IS_GOT_SYM(name) (CONST_STRNEQ (name, GOT_REF_PREFIX))
/* See if a symbol name is a reference to the procedure linkage table. */
@@ -102,8 +101,7 @@ i386linux_write_object_contents (abfd)
#define PLT_REF_PREFIX "__PLT_"
#endif
-#define IS_PLT_SYM(name) \
- (strncmp (name, PLT_REF_PREFIX, sizeof PLT_REF_PREFIX - 1) == 0)
+#define IS_PLT_SYM(name) (CONST_STRNEQ (name, PLT_REF_PREFIX))
/* This string is used to generate specialized error messages. */
@@ -312,9 +310,8 @@ linux_link_create_dynamic_sections (abfd, info)
/* We choose to use the name ".linux-dynamic" for the fixup table.
Why not? */
- s = bfd_make_section (abfd, ".linux-dynamic");
+ s = bfd_make_section_with_flags (abfd, ".linux-dynamic", flags);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags)
|| ! bfd_set_section_alignment (abfd, s, 2))
return FALSE;
s->size = 0;
@@ -442,8 +439,7 @@ linux_tally_symbols (h, data)
h = (struct linux_link_hash_entry *) h->root.root.u.i.link;
if (h->root.root.type == bfd_link_hash_undefined
- && strncmp (h->root.root.root.string, NEEDS_SHRLIB,
- sizeof NEEDS_SHRLIB - 1) == 0)
+ && CONST_STRNEQ (h->root.root.root.string, NEEDS_SHRLIB))
{
const char *name;
char *p;
diff --git a/bfd/i386lynx.c b/bfd/i386lynx.c
index 856c0fd20694..a1a45169c2bc 100644
--- a/bfd/i386lynx.c
+++ b/bfd/i386lynx.c
@@ -1,6 +1,6 @@
/* BFD back-end for i386 a.out binaries under LynxOS.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2001, 2002,
- 2003 Free Software Foundation, Inc.
+ 2003, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -31,8 +31,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
#define MY(OP) CONCAT2 (i386lynx_aout_,OP)
#define TARGETNAME "a.out-i386-lynx"
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#ifndef WRITE_HEADERS
diff --git a/bfd/i386mach3.c b/bfd/i386mach3.c
index 15137c7e9ed9..9e1beb175917 100644
--- a/bfd/i386mach3.c
+++ b/bfd/i386mach3.c
@@ -1,5 +1,5 @@
/* BFD back-end for i386 a.out binaries.
- Copyright 1990, 1991, 1993, 1994, 1995, 1997, 2001, 2002, 2003
+ Copyright 1990, 1991, 1993, 1994, 1995, 1997, 2001, 2002, 2003, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -33,8 +33,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
#define N_TXTSIZE(x) ((x).a_text)
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "aout/aout64.h"
#include "aout/stab_gnu.h"
diff --git a/bfd/i386msdos.c b/bfd/i386msdos.c
index bb25acd7324e..ceb0244fadee 100644
--- a/bfd/i386msdos.c
+++ b/bfd/i386msdos.c
@@ -1,6 +1,6 @@
/* BFD back-end for MS-DOS executables.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002,
- 2003, 2004, 2005 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Written by Bryan Ford of the University of Utah.
Contributed by the Center for Software Science at the
@@ -23,8 +23,8 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "libaout.h"
@@ -33,24 +33,15 @@
#define EXE_LOAD_LOW 0xffff
#define EXE_PAGE_SIZE 512
-static int msdos_sizeof_headers
- PARAMS ((bfd *, bfd_boolean));
-static bfd_boolean msdos_write_object_contents
- PARAMS ((bfd *));
-static bfd_boolean msdos_set_section_contents
- PARAMS ((bfd *, sec_ptr, const PTR, file_ptr, bfd_size_type));
-
static int
-msdos_sizeof_headers (abfd, exec)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_boolean exec ATTRIBUTE_UNUSED;
+msdos_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
return 0;
}
static bfd_boolean
-msdos_write_object_contents (abfd)
- bfd *abfd;
+msdos_write_object_contents (bfd *abfd)
{
static char hdr[EXE_PAGE_SIZE];
file_ptr outfile_size = sizeof(hdr);
@@ -112,12 +103,11 @@ msdos_write_object_contents (abfd)
}
static bfd_boolean
-msdos_set_section_contents (abfd, section, location, offset, count)
- bfd *abfd;
- sec_ptr section;
- const PTR location;
- file_ptr offset;
- bfd_size_type count;
+msdos_set_section_contents (bfd *abfd,
+ sec_ptr section,
+ const void *location,
+ file_ptr offset,
+ bfd_size_type count)
{
if (count == 0)
@@ -140,6 +130,7 @@ msdos_set_section_contents (abfd, section, location, offset, count)
#define msdos_mkobject aout_32_mkobject
#define msdos_make_empty_symbol aout_32_make_empty_symbol
#define msdos_bfd_reloc_type_lookup aout_32_reloc_type_lookup
+#define msdos_bfd_reloc_name_lookup aout_32_reloc_name_lookup
#define msdos_close_and_cleanup _bfd_generic_close_and_cleanup
#define msdos_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
diff --git a/bfd/i386os9k.c b/bfd/i386os9k.c
index f825bc620736..f5b49cf28e21 100644
--- a/bfd/i386os9k.c
+++ b/bfd/i386os9k.c
@@ -1,6 +1,6 @@
/* BFD back-end for os9000 i386 binaries.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001, 2002,
- 2004, 2005 Free Software Foundation, Inc.
+ 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -20,29 +20,19 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "bfdlink.h"
#include "libaout.h" /* BFD a.out internal data structures */
#include "os9k.h"
-static const bfd_target * os9k_callback
- PARAMS ((bfd *));
-static const bfd_target * os9k_object_p
- PARAMS ((bfd *));
-static int os9k_sizeof_headers
- PARAMS ((bfd *, bfd_boolean));
-bfd_boolean os9k_swap_exec_header_in
- PARAMS ((bfd *, mh_com *, struct internal_exec *));
-
/* Swaps the information in an executable header taken from a raw byte
stream memory image, into the internal exec_header structure. */
-bfd_boolean
-os9k_swap_exec_header_in (abfd, raw_bytes, execp)
- bfd *abfd;
- mh_com *raw_bytes;
- struct internal_exec *execp;
+static bfd_boolean
+os9k_swap_exec_header_in (bfd *abfd,
+ mh_com *raw_bytes,
+ struct internal_exec *execp)
{
mh_com *bytes = (mh_com *) raw_bytes;
unsigned int dload, dmemsize, dmemstart;
@@ -77,44 +67,12 @@ os9k_swap_exec_header_in (abfd, raw_bytes, execp)
return TRUE;
}
-static const bfd_target *
-os9k_object_p (abfd)
- bfd *abfd;
-{
- struct internal_exec anexec;
- mh_com exec_bytes;
-
- if (bfd_bread ((PTR) &exec_bytes, (bfd_size_type) MHCOM_BYTES_SIZE, abfd)
- != MHCOM_BYTES_SIZE)
- {
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_wrong_format);
- return 0;
- }
-
- anexec.a_info = H_GET_16 (abfd, exec_bytes.m_sync);
- if (N_BADMAG (anexec))
- {
- bfd_set_error (bfd_error_wrong_format);
- return 0;
- }
-
- if (! os9k_swap_exec_header_in (abfd, &exec_bytes, &anexec))
- {
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
- return aout_32_some_aout_object_p (abfd, &anexec, os9k_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 *
-os9k_callback (abfd)
- bfd *abfd;
+os9k_callback (bfd *abfd)
{
struct internal_exec *execp = exec_hdr (abfd);
unsigned long bss_start;
@@ -156,10 +114,39 @@ os9k_callback (abfd)
return abfd->xvec;
}
+static const bfd_target *
+os9k_object_p (bfd *abfd)
+{
+ struct internal_exec anexec;
+ mh_com exec_bytes;
+
+ if (bfd_bread ((PTR) &exec_bytes, (bfd_size_type) MHCOM_BYTES_SIZE, abfd)
+ != MHCOM_BYTES_SIZE)
+ {
+ if (bfd_get_error () != bfd_error_system_call)
+ bfd_set_error (bfd_error_wrong_format);
+ return 0;
+ }
+
+ anexec.a_info = H_GET_16 (abfd, exec_bytes.m_sync);
+ if (N_BADMAG (anexec))
+ {
+ bfd_set_error (bfd_error_wrong_format);
+ return 0;
+ }
+
+ if (! os9k_swap_exec_header_in (abfd, &exec_bytes, &anexec))
+ {
+ if (bfd_get_error () != bfd_error_system_call)
+ bfd_set_error (bfd_error_wrong_format);
+ return NULL;
+ }
+ return aout_32_some_aout_object_p (abfd, &anexec, os9k_callback);
+}
+
static int
-os9k_sizeof_headers (ignore_abfd, ignore)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
- bfd_boolean ignore ATTRIBUTE_UNUSED;
+os9k_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
return sizeof (struct internal_exec);
}
@@ -171,6 +158,7 @@ os9k_sizeof_headers (ignore_abfd, ignore)
#define aout_32_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
#define aout_32_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
+#define aout_32_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup
#define aout_32_get_section_contents_in_window \
_bfd_generic_get_section_contents_in_window
diff --git a/bfd/ieee.c b/bfd/ieee.c
index be8455c617f8..727869e669cb 100644
--- a/bfd/ieee.c
+++ b/bfd/ieee.c
@@ -1,6 +1,6 @@
/* BFD back-end for ieee-695 objects.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support.
@@ -27,8 +27,8 @@
token (which is one byte in this lexicon) lookahead recursive decent
parser. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "ieee.h"
#include "libieee.h"
@@ -370,7 +370,7 @@ parse_int (common_header_type *ieee, bfd_vma *value_ptr)
static int
parse_i (common_header_type *ieee, bfd_boolean *ok)
{
- bfd_vma x;
+ bfd_vma x = 0;
*ok = parse_int (ieee, &x);
return x;
}
@@ -378,7 +378,7 @@ parse_i (common_header_type *ieee, bfd_boolean *ok)
static bfd_vma
must_parse_int (common_header_type *ieee)
{
- bfd_vma result;
+ bfd_vma result = 0;
BFD_ASSERT (parse_int (ieee, &result));
return result;
}
@@ -767,7 +767,7 @@ ieee_slurp_external_symbols (bfd *abfd)
unsigned int symbol_name_index;
unsigned int symbol_type_index;
unsigned int symbol_attribute_def;
- bfd_vma value;
+ bfd_vma value = 0;
switch (read_2bytes (&ieee->h))
{
@@ -1080,7 +1080,6 @@ get_section_entry (bfd *abfd, ieee_data_type *ieee, unsigned int index)
sprintf (tmp, " fsec%4d", index);
section = bfd_make_section (abfd, tmp);
ieee->section_table[index] = section;
- section->flags = SEC_NO_FLAGS;
section->target_index = index;
ieee->section_table[index] = section;
}
@@ -1268,14 +1267,15 @@ ieee_slurp_debug (bfd *abfd)
ieee_data_type *ieee = IEEE_DATA (abfd);
asection *sec;
file_ptr debug_end;
+ flagword flags;
if (ieee->w.r.debug_information_part == 0)
return TRUE;
- sec = bfd_make_section (abfd, ".debug");
+ flags = SEC_DEBUGGING | SEC_HAS_CONTENTS;
+ sec = bfd_make_section_with_flags (abfd, ".debug", flags);
if (sec == NULL)
return FALSE;
- sec->flags |= SEC_DEBUGGING | SEC_HAS_CONTENTS;
sec->filepos = ieee->w.r.debug_information_part;
debug_end = ieee_part_after (ieee, ieee->w.r.debug_information_part);
@@ -1875,8 +1875,8 @@ ieee_object_p (bfd *abfd)
family[9] = '\0';
}
}
- else if ((strncmp (processor, "cpu32", 5) == 0) /* CPU32 and CPU32+ */
- || (strncmp (processor, "CPU32", 5) == 0))
+ else if ((CONST_STRNEQ (processor, "cpu32")) /* CPU32 and CPU32+ */
+ || (CONST_STRNEQ (processor, "CPU32")))
strcpy (family, "68332");
else
{
@@ -2014,12 +2014,15 @@ ieee_print_symbol (bfd *abfd,
static bfd_boolean
ieee_new_section_hook (bfd *abfd, asection *newsect)
{
- newsect->used_by_bfd = bfd_alloc (abfd, (bfd_size_type) sizeof (ieee_per_section_type));
if (!newsect->used_by_bfd)
- return FALSE;
+ {
+ newsect->used_by_bfd = bfd_alloc (abfd, sizeof (ieee_per_section_type));
+ if (!newsect->used_by_bfd)
+ return FALSE;
+ }
ieee_per_section (newsect)->data = NULL;
ieee_per_section (newsect)->section = newsect;
- return TRUE;
+ return _bfd_generic_new_section_hook (abfd, newsect);
}
static long
@@ -3712,7 +3715,7 @@ ieee_generic_stat_arch_elt (bfd *abfd, struct stat *buf)
static int
ieee_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
- bfd_boolean x ATTRIBUTE_UNUSED)
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
return 0;
}
@@ -3744,6 +3747,7 @@ ieee_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
#define ieee_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
#define ieee_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
+#define ieee_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup
#define ieee_set_arch_mach _bfd_generic_set_arch_mach
diff --git a/bfd/ihex.c b/bfd/ihex.c
index fb2ab96c99ed..9f765b33f770 100644
--- a/bfd/ihex.c
+++ b/bfd/ihex.c
@@ -1,6 +1,6 @@
/* BFD back-end for Intel Hex objects.
- Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
+ Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+ 2006, 2007 Free Software Foundation, Inc.
Written by Ian Lance Taylor of Cygnus Support <ian@cygnus.com>.
This file is part of BFD, the Binary File Descriptor library.
@@ -118,8 +118,8 @@ The MRI compiler uses this, which is a repeat of type 5:
18..19 Checksum in hex notation
20..21 Carriage return, line feed. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "libiberty.h"
#include "safe-ctype.h"
@@ -355,6 +355,7 @@ ihex_scan (bfd *abfd)
char secbuf[20];
char *secname;
bfd_size_type amt;
+ flagword flags;
sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1);
amt = strlen (secbuf) + 1;
@@ -362,10 +363,10 @@ ihex_scan (bfd *abfd)
if (secname == NULL)
goto error_return;
strcpy (secname, secbuf);
- sec = bfd_make_section (abfd, secname);
+ flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC;
+ sec = bfd_make_section_with_flags (abfd, secname, flags);
if (sec == NULL)
goto error_return;
- sec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC;
sec->vma = extbase + segbase + addr;
sec->lma = extbase + segbase + addr;
sec->size = len;
@@ -553,7 +554,6 @@ ihex_read_section (bfd *abfd, asection *section, bfd_byte *contents)
{
char hdr[8];
unsigned int len;
- bfd_vma addr;
unsigned int type;
unsigned int i;
@@ -568,7 +568,6 @@ ihex_read_section (bfd *abfd, asection *section, bfd_byte *contents)
goto error_return;
len = HEX2 (hdr);
- addr = HEX4 (hdr + 2);
type = HEX2 (hdr + 6);
/* We should only see type 0 records here. */
@@ -900,7 +899,8 @@ ihex_set_arch_mach (bfd *abfd,
/* Get the size of the headers, for the linker. */
static int
-ihex_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean exec ATTRIBUTE_UNUSED)
+ihex_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
return 0;
}
@@ -924,9 +924,6 @@ ihex_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean exec ATTRIBUTE_UNUS
#define ihex_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
#define ihex_read_minisymbols _bfd_nosymbols_read_minisymbols
#define ihex_minisymbol_to_symbol _bfd_nosymbols_minisymbol_to_symbol
-#define ihex_get_reloc_upper_bound ((long (*) (bfd *, asection *)) bfd_0l)
-#define ihex_canonicalize_reloc ((long (*) (bfd *, asection *, arelent **, asymbol **)) bfd_0l)
-#define ihex_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
#define ihex_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
#define ihex_bfd_relax_section bfd_generic_relax_section
#define ihex_bfd_gc_sections bfd_generic_gc_sections
@@ -985,7 +982,7 @@ const bfd_target ihex_vec =
BFD_JUMP_TABLE_CORE (_bfd_nocore),
BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
BFD_JUMP_TABLE_SYMBOLS (ihex),
- BFD_JUMP_TABLE_RELOCS (ihex),
+ BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
BFD_JUMP_TABLE_WRITE (ihex),
BFD_JUMP_TABLE_LINK (ihex),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
diff --git a/bfd/init.c b/bfd/init.c
index a34acbf9faf5..49f5533f2e21 100644
--- a/bfd/init.c
+++ b/bfd/init.c
@@ -1,5 +1,5 @@
/* bfd initialization stuff
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2003
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2003, 2007
Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support.
@@ -19,8 +19,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
/*
diff --git a/bfd/irix-core.c b/bfd/irix-core.c
index e6331454c445..5b982e276c79 100644
--- a/bfd/irix-core.c
+++ b/bfd/irix-core.c
@@ -1,5 +1,5 @@
/* BFD back-end for Irix core files.
- Copyright 1993, 1994, 1996, 1999, 2001, 2002, 2004
+ Copyright 1993, 1994, 1996, 1999, 2001, 2002, 2004, 2006, 2007
Free Software Foundation, Inc.
Written by Stu Grossman, Cygnus Support.
Converted to back-end form by Ian Lance Taylor, Cygnus Support
@@ -23,8 +23,8 @@
/* This file can only be compiled on systems which use Irix style core
files (namely, Irix 4 and Irix 5, so far). */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#ifdef IRIX_CORE
@@ -152,11 +152,10 @@ make_bfd_asection (bfd *abfd,
{
asection *asect;
- asect = bfd_make_section_anyway (abfd, name);
+ asect = bfd_make_section_anyway_with_flags (abfd, name, flags);
if (!asect)
return NULL;
- asect->flags = flags;
asect->size = size;
asect->vma = vma;
asect->filepos = filepos;
diff --git a/bfd/libaout.h b/bfd/libaout.h
index bb3ee8082674..879de1380bd6 100644
--- a/bfd/libaout.h
+++ b/bfd/libaout.h
@@ -1,6 +1,6 @@
/* BFD back-end data structures for a.out (and similar) files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -525,6 +525,9 @@ extern void NAME (aout, swap_std_reloc_in)
extern reloc_howto_type * NAME (aout, reloc_type_lookup)
(bfd *, bfd_reloc_code_real_type);
+extern reloc_howto_type * NAME (aout, reloc_name_lookup)
+ (bfd *, const char *);
+
extern bfd_boolean NAME (aout, slurp_reloc_table)
(bfd *, sec_ptr, asymbol **);
@@ -557,7 +560,7 @@ extern asymbol * NAME (aout, minisymbol_to_symbol)
(bfd *, bfd_boolean, const void *, asymbol *);
extern int NAME (aout, sizeof_headers)
- (bfd *, bfd_boolean);
+ (bfd *, struct bfd_link_info *);
extern bfd_boolean NAME (aout, adjust_sizes_and_vmas)
(bfd *, bfd_size_type *, file_ptr *);
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
index ee2484f25c12..3555e6a8eefd 100644
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
@@ -2,7 +2,7 @@
(This include file is not for users of the library.)
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -155,6 +155,8 @@ bfd * _bfd_new_bfd
(void);
void _bfd_delete_bfd
(bfd *);
+bfd_boolean _bfd_free_cached_info
+ (bfd *);
bfd_boolean bfd_false
(bfd *ignore);
@@ -215,8 +217,8 @@ int bfd_generic_stat_arch_elt
#define _bfd_generic_close_and_cleanup bfd_true
#define _bfd_generic_bfd_free_cached_info bfd_true
-#define _bfd_generic_new_section_hook \
- ((bfd_boolean (*) (bfd *, asection *)) bfd_true)
+extern bfd_boolean _bfd_generic_new_section_hook
+ (bfd *, asection *);
extern bfd_boolean _bfd_generic_get_section_contents
(bfd *, asection *, void *, file_ptr, bfd_size_type);
extern bfd_boolean _bfd_generic_get_section_contents_in_window
@@ -346,12 +348,13 @@ extern bfd_boolean _bfd_archive_coff_construct_extended_name_table
/* Routines to use for BFD_JUMP_TABLE_RELOCS when there is no reloc
support. Use BFD_JUMP_TABLE_RELOCS (_bfd_norelocs). */
-#define _bfd_norelocs_get_reloc_upper_bound \
- ((long (*) (bfd *, asection *)) _bfd_n1)
-#define _bfd_norelocs_canonicalize_reloc \
- ((long (*) (bfd *, asection *, arelent **, asymbol **)) _bfd_n1)
+extern long _bfd_norelocs_get_reloc_upper_bound (bfd *, asection *);
+extern long _bfd_norelocs_canonicalize_reloc (bfd *, asection *,
+ arelent **, asymbol **);
#define _bfd_norelocs_bfd_reloc_type_lookup \
((reloc_howto_type *(*) (bfd *, bfd_reloc_code_real_type)) bfd_nullvoidptr)
+#define _bfd_norelocs_bfd_reloc_name_lookup \
+ ((reloc_howto_type *(*) (bfd *, const char *)) bfd_nullvoidptr)
/* Routines to use for BFD_JUMP_TABLE_WRITE for targets which may not
be written. Use BFD_JUMP_TABLE_WRITE (_bfd_nowrite). */
@@ -373,7 +376,8 @@ extern bfd_boolean _bfd_generic_set_section_contents
/* Routines to use for BFD_JUMP_TABLE_LINK for targets which do not
support linking. Use BFD_JUMP_TABLE_LINK (_bfd_nolink). */
-#define _bfd_nolink_sizeof_headers ((int (*) (bfd *, bfd_boolean)) bfd_0)
+#define _bfd_nolink_sizeof_headers \
+ ((int (*) (bfd *, struct bfd_link_info *)) bfd_0)
#define _bfd_nolink_bfd_get_relocated_section_contents \
((bfd_byte *(*) (bfd *, struct bfd_link_info *, struct bfd_link_order *, \
bfd_byte *, bfd_boolean, asymbol **)) \
@@ -407,7 +411,7 @@ extern bfd_boolean _bfd_generic_set_section_contents
#define _bfd_nolink_bfd_link_split_section \
((bfd_boolean (*) (bfd *, struct bfd_section *)) bfd_false)
#define _bfd_nolink_section_already_linked \
- ((void (*) (bfd *, struct bfd_section *)) bfd_void)
+ ((void (*) (bfd *, struct bfd_section *, struct bfd_link_info *)) bfd_void)
/* Routines to use for BFD_JUMP_TABLE_DYNAMIC for targets which do not
have dynamic symbols or relocs. Use BFD_JUMP_TABLE_DYNAMIC
@@ -521,7 +525,7 @@ extern bfd_boolean _bfd_generic_link_split_section
(bfd *, struct bfd_section *);
extern void _bfd_generic_section_already_linked
- (bfd *, struct bfd_section *);
+ (bfd *, struct bfd_section *, struct bfd_link_info *);
/* Generic reloc_link_order processing routine. */
extern bfd_boolean _bfd_generic_reloc_link_order
@@ -544,6 +548,10 @@ extern bfd_reloc_status_type _bfd_final_link_relocate
extern bfd_reloc_status_type _bfd_relocate_contents
(reloc_howto_type *, bfd *, bfd_vma, bfd_byte *);
+/* Clear a given location using a given howto. */
+extern void _bfd_clear_contents (reloc_howto_type *howto, bfd *input_bfd,
+ bfd_byte *location);
+
/* Link stabs in sections in the first pass. */
extern bfd_boolean _bfd_link_section_stabs
diff --git a/bfd/libbfd.c b/bfd/libbfd.c
index 57cfabcd460e..7dada1cbf531 100644
--- a/bfd/libbfd.c
+++ b/bfd/libbfd.c
@@ -1,6 +1,6 @@
/* Assorted BFD support routines, only used internally.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005
+ 2000, 2001, 2002, 2003, 2004, 2005, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -20,8 +20,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#ifndef HAVE_GETPAGESIZE
@@ -103,6 +103,23 @@ bfd_void (bfd *ignore ATTRIBUTE_UNUSED)
{
}
+long
+_bfd_norelocs_get_reloc_upper_bound (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *sec ATTRIBUTE_UNUSED)
+{
+ return sizeof (arelent *);
+}
+
+long
+_bfd_norelocs_canonicalize_reloc (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *sec ATTRIBUTE_UNUSED,
+ arelent **relptr,
+ asymbol **symbols ATTRIBUTE_UNUSED)
+{
+ *relptr = NULL;
+ return 0;
+}
+
bfd_boolean
_bfd_nocore_core_file_matches_executable_p
(bfd *ignore_core_bfd ATTRIBUTE_UNUSED,
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index 2a590a395a51..4c1414f826fa 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -7,7 +7,7 @@
(This include file is not for users of the library.)
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -160,6 +160,8 @@ bfd * _bfd_new_bfd
(void);
void _bfd_delete_bfd
(bfd *);
+bfd_boolean _bfd_free_cached_info
+ (bfd *);
bfd_boolean bfd_false
(bfd *ignore);
@@ -220,8 +222,8 @@ int bfd_generic_stat_arch_elt
#define _bfd_generic_close_and_cleanup bfd_true
#define _bfd_generic_bfd_free_cached_info bfd_true
-#define _bfd_generic_new_section_hook \
- ((bfd_boolean (*) (bfd *, asection *)) bfd_true)
+extern bfd_boolean _bfd_generic_new_section_hook
+ (bfd *, asection *);
extern bfd_boolean _bfd_generic_get_section_contents
(bfd *, asection *, void *, file_ptr, bfd_size_type);
extern bfd_boolean _bfd_generic_get_section_contents_in_window
@@ -351,12 +353,13 @@ extern bfd_boolean _bfd_archive_coff_construct_extended_name_table
/* Routines to use for BFD_JUMP_TABLE_RELOCS when there is no reloc
support. Use BFD_JUMP_TABLE_RELOCS (_bfd_norelocs). */
-#define _bfd_norelocs_get_reloc_upper_bound \
- ((long (*) (bfd *, asection *)) _bfd_n1)
-#define _bfd_norelocs_canonicalize_reloc \
- ((long (*) (bfd *, asection *, arelent **, asymbol **)) _bfd_n1)
+extern long _bfd_norelocs_get_reloc_upper_bound (bfd *, asection *);
+extern long _bfd_norelocs_canonicalize_reloc (bfd *, asection *,
+ arelent **, asymbol **);
#define _bfd_norelocs_bfd_reloc_type_lookup \
((reloc_howto_type *(*) (bfd *, bfd_reloc_code_real_type)) bfd_nullvoidptr)
+#define _bfd_norelocs_bfd_reloc_name_lookup \
+ ((reloc_howto_type *(*) (bfd *, const char *)) bfd_nullvoidptr)
/* Routines to use for BFD_JUMP_TABLE_WRITE for targets which may not
be written. Use BFD_JUMP_TABLE_WRITE (_bfd_nowrite). */
@@ -378,7 +381,8 @@ extern bfd_boolean _bfd_generic_set_section_contents
/* Routines to use for BFD_JUMP_TABLE_LINK for targets which do not
support linking. Use BFD_JUMP_TABLE_LINK (_bfd_nolink). */
-#define _bfd_nolink_sizeof_headers ((int (*) (bfd *, bfd_boolean)) bfd_0)
+#define _bfd_nolink_sizeof_headers \
+ ((int (*) (bfd *, struct bfd_link_info *)) bfd_0)
#define _bfd_nolink_bfd_get_relocated_section_contents \
((bfd_byte *(*) (bfd *, struct bfd_link_info *, struct bfd_link_order *, \
bfd_byte *, bfd_boolean, asymbol **)) \
@@ -412,7 +416,7 @@ extern bfd_boolean _bfd_generic_set_section_contents
#define _bfd_nolink_bfd_link_split_section \
((bfd_boolean (*) (bfd *, struct bfd_section *)) bfd_false)
#define _bfd_nolink_section_already_linked \
- ((void (*) (bfd *, struct bfd_section *)) bfd_void)
+ ((void (*) (bfd *, struct bfd_section *, struct bfd_link_info *)) bfd_void)
/* Routines to use for BFD_JUMP_TABLE_DYNAMIC for targets which do not
have dynamic symbols or relocs. Use BFD_JUMP_TABLE_DYNAMIC
@@ -526,7 +530,7 @@ extern bfd_boolean _bfd_generic_link_split_section
(bfd *, struct bfd_section *);
extern void _bfd_generic_section_already_linked
- (bfd *, struct bfd_section *);
+ (bfd *, struct bfd_section *, struct bfd_link_info *);
/* Generic reloc_link_order processing routine. */
extern bfd_boolean _bfd_generic_reloc_link_order
@@ -549,6 +553,10 @@ extern bfd_reloc_status_type _bfd_final_link_relocate
extern bfd_reloc_status_type _bfd_relocate_contents
(reloc_howto_type *, bfd *, bfd_vma, bfd_byte *);
+/* Clear a given location using a given howto. */
+extern void _bfd_clear_contents (reloc_howto_type *howto, bfd *input_bfd,
+ bfd_byte *location);
+
/* Link stabs in sections in the first pass. */
extern bfd_boolean _bfd_link_section_stabs
@@ -899,6 +907,20 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_SPARC_TLS_DTPOFF64",
"BFD_RELOC_SPARC_TLS_TPOFF32",
"BFD_RELOC_SPARC_TLS_TPOFF64",
+ "BFD_RELOC_SPU_IMM7",
+ "BFD_RELOC_SPU_IMM8",
+ "BFD_RELOC_SPU_IMM10",
+ "BFD_RELOC_SPU_IMM10W",
+ "BFD_RELOC_SPU_IMM16",
+ "BFD_RELOC_SPU_IMM16W",
+ "BFD_RELOC_SPU_IMM18",
+ "BFD_RELOC_SPU_PCREL9a",
+ "BFD_RELOC_SPU_PCREL9b",
+ "BFD_RELOC_SPU_PCREL16",
+ "BFD_RELOC_SPU_LO16",
+ "BFD_RELOC_SPU_HI16",
+ "BFD_RELOC_SPU_PPU32",
+ "BFD_RELOC_SPU_PPU64",
"BFD_RELOC_ALPHA_GPDISP_HI16",
"BFD_RELOC_ALPHA_GPDISP_LO16",
"BFD_RELOC_ALPHA_GPDISP",
@@ -1206,6 +1228,14 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_ARM_SBREL32",
"BFD_RELOC_ARM_TARGET2",
"BFD_RELOC_ARM_PREL31",
+ "BFD_RELOC_ARM_MOVW",
+ "BFD_RELOC_ARM_MOVT",
+ "BFD_RELOC_ARM_MOVW_PCREL",
+ "BFD_RELOC_ARM_MOVT_PCREL",
+ "BFD_RELOC_ARM_THUMB_MOVW",
+ "BFD_RELOC_ARM_THUMB_MOVT",
+ "BFD_RELOC_ARM_THUMB_MOVW_PCREL",
+ "BFD_RELOC_ARM_THUMB_MOVT_PCREL",
"BFD_RELOC_ARM_JUMP_SLOT",
"BFD_RELOC_ARM_GLOB_DAT",
"BFD_RELOC_ARM_GOT32",
@@ -1221,9 +1251,38 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_ARM_TLS_TPOFF32",
"BFD_RELOC_ARM_TLS_IE32",
"BFD_RELOC_ARM_TLS_LE32",
+ "BFD_RELOC_ARM_ALU_PC_G0_NC",
+ "BFD_RELOC_ARM_ALU_PC_G0",
+ "BFD_RELOC_ARM_ALU_PC_G1_NC",
+ "BFD_RELOC_ARM_ALU_PC_G1",
+ "BFD_RELOC_ARM_ALU_PC_G2",
+ "BFD_RELOC_ARM_LDR_PC_G0",
+ "BFD_RELOC_ARM_LDR_PC_G1",
+ "BFD_RELOC_ARM_LDR_PC_G2",
+ "BFD_RELOC_ARM_LDRS_PC_G0",
+ "BFD_RELOC_ARM_LDRS_PC_G1",
+ "BFD_RELOC_ARM_LDRS_PC_G2",
+ "BFD_RELOC_ARM_LDC_PC_G0",
+ "BFD_RELOC_ARM_LDC_PC_G1",
+ "BFD_RELOC_ARM_LDC_PC_G2",
+ "BFD_RELOC_ARM_ALU_SB_G0_NC",
+ "BFD_RELOC_ARM_ALU_SB_G0",
+ "BFD_RELOC_ARM_ALU_SB_G1_NC",
+ "BFD_RELOC_ARM_ALU_SB_G1",
+ "BFD_RELOC_ARM_ALU_SB_G2",
+ "BFD_RELOC_ARM_LDR_SB_G0",
+ "BFD_RELOC_ARM_LDR_SB_G1",
+ "BFD_RELOC_ARM_LDR_SB_G2",
+ "BFD_RELOC_ARM_LDRS_SB_G0",
+ "BFD_RELOC_ARM_LDRS_SB_G1",
+ "BFD_RELOC_ARM_LDRS_SB_G2",
+ "BFD_RELOC_ARM_LDC_SB_G0",
+ "BFD_RELOC_ARM_LDC_SB_G1",
+ "BFD_RELOC_ARM_LDC_SB_G2",
"BFD_RELOC_ARM_IMMEDIATE",
"BFD_RELOC_ARM_ADRL_IMMEDIATE",
"BFD_RELOC_ARM_T32_IMMEDIATE",
+ "BFD_RELOC_ARM_T32_ADD_IMM",
"BFD_RELOC_ARM_T32_IMM12",
"BFD_RELOC_ARM_T32_ADD_PC12",
"BFD_RELOC_ARM_SHIFT_IMM",
@@ -1473,6 +1532,27 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_MCORE_PCREL_32",
"BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2",
"BFD_RELOC_MCORE_RVA",
+ "BFD_RELOC_MEP_8",
+ "BFD_RELOC_MEP_16",
+ "BFD_RELOC_MEP_32",
+ "BFD_RELOC_MEP_PCREL8A2",
+ "BFD_RELOC_MEP_PCREL12A2",
+ "BFD_RELOC_MEP_PCREL17A2",
+ "BFD_RELOC_MEP_PCREL24A2",
+ "BFD_RELOC_MEP_PCABS24A2",
+ "BFD_RELOC_MEP_LOW16",
+ "BFD_RELOC_MEP_HI16U",
+ "BFD_RELOC_MEP_HI16S",
+ "BFD_RELOC_MEP_GPREL",
+ "BFD_RELOC_MEP_TPREL",
+ "BFD_RELOC_MEP_TPREL7",
+ "BFD_RELOC_MEP_TPREL7A2",
+ "BFD_RELOC_MEP_TPREL7A4",
+ "BFD_RELOC_MEP_UIMM24",
+ "BFD_RELOC_MEP_ADDR24A4",
+ "BFD_RELOC_MEP_GNU_VTINHERIT",
+ "BFD_RELOC_MEP_GNU_VTENTRY",
+
"BFD_RELOC_MMIX_GETA",
"BFD_RELOC_MMIX_GETA_1",
"BFD_RELOC_MMIX_GETA_2",
@@ -1509,7 +1589,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_AVR_HH8_LDI_NEG",
"BFD_RELOC_AVR_MS8_LDI_NEG",
"BFD_RELOC_AVR_LO8_LDI_PM",
+ "BFD_RELOC_AVR_LO8_LDI_GS",
"BFD_RELOC_AVR_HI8_LDI_PM",
+ "BFD_RELOC_AVR_HI8_LDI_GS",
"BFD_RELOC_AVR_HH8_LDI_PM",
"BFD_RELOC_AVR_LO8_LDI_PM_NEG",
"BFD_RELOC_AVR_HI8_LDI_PM_NEG",
@@ -1568,6 +1650,17 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_390_GOT20",
"BFD_RELOC_390_GOTPLT20",
"BFD_RELOC_390_TLS_GOTIE20",
+ "BFD_RELOC_SCORE_DUMMY1",
+ "BFD_RELOC_SCORE_GPREL15",
+ "BFD_RELOC_SCORE_DUMMY2",
+ "BFD_RELOC_SCORE_JMP",
+ "BFD_RELOC_SCORE_BRANCH",
+ "BFD_RELOC_SCORE16_JMP",
+ "BFD_RELOC_SCORE16_BRANCH",
+ "BFD_RELOC_SCORE_GOT15",
+ "BFD_RELOC_SCORE_GOT_LO16",
+ "BFD_RELOC_SCORE_CALL15",
+ "BFD_RELOC_SCORE_DUMMY_HI16",
"BFD_RELOC_IP2K_FR9",
"BFD_RELOC_IP2K_BANK",
"BFD_RELOC_IP2K_ADDR16CJP",
@@ -1712,6 +1805,33 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_16C_IMM24_C",
"BFD_RELOC_16C_IMM32",
"BFD_RELOC_16C_IMM32_C",
+ "BFD_RELOC_CR16_NUM8",
+ "BFD_RELOC_CR16_NUM16",
+ "BFD_RELOC_CR16_NUM32",
+ "BFD_RELOC_CR16_NUM32a",
+ "BFD_RELOC_CR16_REGREL0",
+ "BFD_RELOC_CR16_REGREL4",
+ "BFD_RELOC_CR16_REGREL4a",
+ "BFD_RELOC_CR16_REGREL14",
+ "BFD_RELOC_CR16_REGREL14a",
+ "BFD_RELOC_CR16_REGREL16",
+ "BFD_RELOC_CR16_REGREL20",
+ "BFD_RELOC_CR16_REGREL20a",
+ "BFD_RELOC_CR16_ABS20",
+ "BFD_RELOC_CR16_ABS24",
+ "BFD_RELOC_CR16_IMM4",
+ "BFD_RELOC_CR16_IMM8",
+ "BFD_RELOC_CR16_IMM16",
+ "BFD_RELOC_CR16_IMM20",
+ "BFD_RELOC_CR16_IMM24",
+ "BFD_RELOC_CR16_IMM32",
+ "BFD_RELOC_CR16_IMM32a",
+ "BFD_RELOC_CR16_DISP4",
+ "BFD_RELOC_CR16_DISP8",
+ "BFD_RELOC_CR16_DISP16",
+ "BFD_RELOC_CR16_DISP20",
+ "BFD_RELOC_CR16_DISP24",
+ "BFD_RELOC_CR16_DISP24a",
"BFD_RELOC_CRX_REL4",
"BFD_RELOC_CRX_REL8",
"BFD_RELOC_CRX_REL8_CMP",
@@ -1796,6 +1916,8 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_XSTORMY16_12",
"BFD_RELOC_XSTORMY16_24",
"BFD_RELOC_XSTORMY16_FPTR16",
+ "BFD_RELOC_RELC",
+
"BFD_RELOC_XC16X_PAG",
"BFD_RELOC_XC16X_POF",
"BFD_RELOC_XC16X_SEG",
diff --git a/bfd/libcoff-in.h b/bfd/libcoff-in.h
index f2bc264b3b9f..fdb1a59b8141 100644
--- a/bfd/libcoff-in.h
+++ b/bfd/libcoff-in.h
@@ -348,7 +348,7 @@ extern bfd_boolean coff_find_nearest_line
extern bfd_boolean coff_find_inliner_info
(bfd *, const char **, const char **, unsigned int *);
extern int coff_sizeof_headers
- (bfd *, bfd_boolean);
+ (bfd *, struct bfd_link_info *);
extern bfd_boolean bfd_coff_reloc16_relax_section
(bfd *, asection *, struct bfd_link_info *, bfd_boolean *);
extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents
diff --git a/bfd/libcoff.h b/bfd/libcoff.h
index f756f30b1bf6..e26fce06415e 100644
--- a/bfd/libcoff.h
+++ b/bfd/libcoff.h
@@ -352,7 +352,7 @@ extern bfd_boolean coff_find_nearest_line
extern bfd_boolean coff_find_inliner_info
(bfd *, const char **, const char **, unsigned int *);
extern int coff_sizeof_headers
- (bfd *, bfd_boolean);
+ (bfd *, struct bfd_link_info *);
extern bfd_boolean bfd_coff_reloc16_relax_section
(bfd *, asection *, struct bfd_link_info *, bfd_boolean *);
extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents
diff --git a/bfd/libecoff.h b/bfd/libecoff.h
index 8c5e218ee58d..165e75585a30 100644
--- a/bfd/libecoff.h
+++ b/bfd/libecoff.h
@@ -1,6 +1,6 @@
/* BFD ECOFF object file private structure.
Copyright 1993, 1994, 1995, 1996, 1999, 2001, 2002, 2003, 2004,
- 2005 Free Software Foundation, Inc.
+ 2005, 2006 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -301,7 +301,7 @@ extern bfd_boolean _bfd_ecoff_set_arch_mach
extern bfd_boolean _bfd_ecoff_set_section_contents
(bfd *, asection *, const void * location, file_ptr, bfd_size_type);
-extern int _bfd_ecoff_sizeof_headers (bfd *, bfd_boolean);
+extern int _bfd_ecoff_sizeof_headers (bfd *, struct bfd_link_info *);
/* ecoff_bfd_get_relocated_section_contents defined by backend. */
/* ecoff_bfd_relax_section defined by backend. */
extern struct bfd_link_hash_table *_bfd_ecoff_bfd_link_hash_table_create
diff --git a/bfd/libpei.h b/bfd/libpei.h
index f0f6580fe4ba..0e08e039bc04 100644
--- a/bfd/libpei.h
+++ b/bfd/libpei.h
@@ -1,5 +1,5 @@
/* Support for the generic parts of PE/PEI; common header information.
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006
Free Software Foundation, Inc.
Written by Cygnus Solutions.
@@ -204,7 +204,38 @@
#define PUT_SCNHDR_LNNOPTR H_PUT_32
#endif
-#ifdef COFF_WITH_pep
+#ifdef COFF_WITH_pex64
+
+#define GET_OPTHDR_IMAGE_BASE H_GET_64
+#define PUT_OPTHDR_IMAGE_BASE H_PUT_64
+#define GET_OPTHDR_SIZE_OF_STACK_RESERVE H_GET_64
+#define PUT_OPTHDR_SIZE_OF_STACK_RESERVE H_PUT_64
+#define GET_OPTHDR_SIZE_OF_STACK_COMMIT H_GET_64
+#define PUT_OPTHDR_SIZE_OF_STACK_COMMIT H_PUT_64
+#define GET_OPTHDR_SIZE_OF_HEAP_RESERVE H_GET_64
+#define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE H_PUT_64
+#define GET_OPTHDR_SIZE_OF_HEAP_COMMIT H_GET_64
+#define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT H_PUT_64
+#define GET_PDATA_ENTRY bfd_get_32
+
+#define _bfd_XX_bfd_copy_private_bfd_data_common _bfd_pex64_bfd_copy_private_bfd_data_common
+#define _bfd_XX_bfd_copy_private_section_data _bfd_pex64_bfd_copy_private_section_data
+#define _bfd_XX_get_symbol_info _bfd_pex64_get_symbol_info
+#define _bfd_XX_only_swap_filehdr_out _bfd_pex64_only_swap_filehdr_out
+#define _bfd_XX_print_private_bfd_data_common _bfd_pex64_print_private_bfd_data_common
+#define _bfd_XXi_final_link_postscript _bfd_pex64i_final_link_postscript
+#define _bfd_XXi_only_swap_filehdr_out _bfd_pex64i_only_swap_filehdr_out
+#define _bfd_XXi_swap_aouthdr_in _bfd_pex64i_swap_aouthdr_in
+#define _bfd_XXi_swap_aouthdr_out _bfd_pex64i_swap_aouthdr_out
+#define _bfd_XXi_swap_aux_in _bfd_pex64i_swap_aux_in
+#define _bfd_XXi_swap_aux_out _bfd_pex64i_swap_aux_out
+#define _bfd_XXi_swap_lineno_in _bfd_pex64i_swap_lineno_in
+#define _bfd_XXi_swap_lineno_out _bfd_pex64i_swap_lineno_out
+#define _bfd_XXi_swap_scnhdr_out _bfd_pex64i_swap_scnhdr_out
+#define _bfd_XXi_swap_sym_in _bfd_pex64i_swap_sym_in
+#define _bfd_XXi_swap_sym_out _bfd_pex64i_swap_sym_out
+
+#elif defined COFF_WITH_pep
#define GET_OPTHDR_IMAGE_BASE H_GET_64
#define PUT_OPTHDR_IMAGE_BASE H_PUT_64
@@ -224,7 +255,6 @@
#define _bfd_XX_only_swap_filehdr_out _bfd_pep_only_swap_filehdr_out
#define _bfd_XX_print_private_bfd_data_common _bfd_pep_print_private_bfd_data_common
#define _bfd_XXi_final_link_postscript _bfd_pepi_final_link_postscript
-#define _bfd_XXi_final_link_postscript _bfd_pepi_final_link_postscript
#define _bfd_XXi_only_swap_filehdr_out _bfd_pepi_only_swap_filehdr_out
#define _bfd_XXi_swap_aouthdr_in _bfd_pepi_swap_aouthdr_in
#define _bfd_XXi_swap_aouthdr_out _bfd_pepi_swap_aouthdr_out
@@ -256,7 +286,6 @@
#define _bfd_XX_only_swap_filehdr_out _bfd_pe_only_swap_filehdr_out
#define _bfd_XX_print_private_bfd_data_common _bfd_pe_print_private_bfd_data_common
#define _bfd_XXi_final_link_postscript _bfd_pei_final_link_postscript
-#define _bfd_XXi_final_link_postscript _bfd_pei_final_link_postscript
#define _bfd_XXi_only_swap_filehdr_out _bfd_pei_only_swap_filehdr_out
#define _bfd_XXi_swap_aouthdr_in _bfd_pei_swap_aouthdr_in
#define _bfd_XXi_swap_aouthdr_out _bfd_pei_swap_aouthdr_out
@@ -270,10 +299,27 @@
#endif /* !COFF_WITH_pep */
-/* 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)
+/* Returns true if the target is a PE executable target. */
+#define bfd_target_pei_p(xvec) \
+ (CONST_STRNEQ ((xvec)->name, "pei-"))
+
+/* Return the arch string of a PE executable target. */
+#define bfd_target_pei_arch(xvec) \
+ ((xvec)->name + sizeof ("pei-") - 1)
+
+/* Returns true if the target is an EFI target. */
+#define bfd_target_efi_p(xvec) \
+ (CONST_STRNEQ ((xvec)->name, "efi-app-"))
+
+/* Return the arch string of an EFI target. */
+#define bfd_target_efi_arch(xvec) \
+ ((xvec)->name + sizeof ("efi-app-") - 1)
+
+/* Macro: Returns true if the bfd is a PE executable as opposed to a
+ PE object file. */
+#define bfd_pe_executable_p(abfd) \
+ (bfd_target_pei_p ((abfd)->xvec) \
+ || bfd_target_efi_p ((abfd)->xvec))
/* These functions are architecture dependent, and are in peicode.h:
coff_swap_reloc_in
diff --git a/bfd/linker.c b/bfd/linker.c
index 14eeae4df0c8..497b5c235565 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -1,6 +1,7 @@
/* linker.c -- BFD linker routines
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2006, 2007
+ Free Software Foundation, Inc.
Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support
This file is part of BFD, the Binary File Descriptor library.
@@ -19,8 +20,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "bfdlink.h"
#include "genlink.h"
@@ -562,11 +563,11 @@ bfd_wrapped_link_hash_lookup (bfd *abfd,
#undef WRAP
-#undef REAL
+#undef REAL
#define REAL "__real_"
if (*l == '_'
- && strncmp (l, REAL, sizeof REAL - 1) == 0
+ && CONST_STRNEQ (l, REAL)
&& bfd_hash_lookup (info->wrap_hash, l + sizeof REAL - 1,
FALSE, FALSE) != NULL)
{
@@ -1659,8 +1660,7 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info,
s = name + 1;
while (*s == '_')
++s;
- if (s[0] == 'G'
- && strncmp (s, CONS_PREFIX, CONS_PREFIX_LEN - 1) == 0)
+ if (s[0] == 'G' && CONST_STRNEQ (s, CONS_PREFIX))
{
char c;
@@ -2877,14 +2877,15 @@ FUNCTION
bfd_section_already_linked
SYNOPSIS
- void bfd_section_already_linked (bfd *abfd, asection *sec);
+ void bfd_section_already_linked (bfd *abfd, asection *sec,
+ struct bfd_link_info *info);
DESCRIPTION
Check if @var{sec} has been already linked during a reloceatable
or final link.
-.#define bfd_section_already_linked(abfd, sec) \
-. BFD_SEND (abfd, _section_already_linked, (abfd, sec))
+.#define bfd_section_already_linked(abfd, sec, info) \
+. BFD_SEND (abfd, _section_already_linked, (abfd, sec, info))
.
*/
@@ -2970,7 +2971,8 @@ bfd_section_already_linked_table_free (void)
/* This is used on non-ELF inputs. */
void
-_bfd_generic_section_already_linked (bfd *abfd, asection *sec)
+_bfd_generic_section_already_linked (bfd *abfd, asection *sec,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
flagword flags;
const char *name;
@@ -3074,7 +3076,7 @@ _bfd_generic_section_already_linked (bfd *abfd, asection *sec)
bfd_section_already_linked_table_insert (already_linked_list, sec);
}
-/* Convert symbols in excluded output sections to absolute. */
+/* Convert symbols in excluded output sections to use a kept section. */
static bfd_boolean
fix_syms (struct bfd_link_hash_entry *h, void *data)
@@ -3093,8 +3095,64 @@ fix_syms (struct bfd_link_hash_entry *h, void *data)
&& (s->output_section->flags & SEC_EXCLUDE) != 0
&& bfd_section_removed_from_list (obfd, s->output_section))
{
+ asection *op, *op1;
+
h->u.def.value += s->output_offset + s->output_section->vma;
- h->u.def.section = bfd_abs_section_ptr;
+
+ /* Find preceding kept section. */
+ for (op1 = s->output_section->prev; op1 != NULL; op1 = op1->prev)
+ if ((op1->flags & SEC_EXCLUDE) == 0
+ && !bfd_section_removed_from_list (obfd, op1))
+ break;
+
+ /* Find following kept section. Start at prev->next because
+ other sections may have been added after S was removed. */
+ if (s->output_section->prev != NULL)
+ op = s->output_section->prev->next;
+ else
+ op = s->output_section->owner->sections;
+ for (; op != NULL; op = op->next)
+ if ((op->flags & SEC_EXCLUDE) == 0
+ && !bfd_section_removed_from_list (obfd, op))
+ break;
+
+ /* Choose better of two sections, based on flags. The idea
+ is to choose a section that will be in the same segment
+ as S would have been if it was kept. */
+ if (op1 == NULL)
+ {
+ if (op == NULL)
+ op = bfd_abs_section_ptr;
+ }
+ else if (op == NULL)
+ op = op1;
+ else if (((op1->flags ^ op->flags)
+ & (SEC_ALLOC | SEC_THREAD_LOCAL)) != 0)
+ {
+ if (((op->flags ^ s->flags)
+ & (SEC_ALLOC | SEC_THREAD_LOCAL)) != 0)
+ op = op1;
+ }
+ else if (((op1->flags ^ op->flags) & SEC_READONLY) != 0)
+ {
+ if (((op->flags ^ s->flags) & SEC_READONLY) != 0)
+ op = op1;
+ }
+ else if (((op1->flags ^ op->flags) & SEC_CODE) != 0)
+ {
+ if (((op->flags ^ s->flags) & SEC_CODE) != 0)
+ op = op1;
+ }
+ else
+ {
+ /* Flags we care about are the same. Prefer the following
+ section if that will result in a positive valued sym. */
+ if (h->u.def.value < op->vma)
+ op = op1;
+ }
+
+ h->u.def.value -= op->vma;
+ h->u.def.section = op;
}
}
diff --git a/bfd/lynx-core.c b/bfd/lynx-core.c
index ef243fbef195..55f0a0c9804b 100644
--- a/bfd/lynx-core.c
+++ b/bfd/lynx-core.c
@@ -1,5 +1,5 @@
/* BFD back end for Lynx core files
- Copyright 1993, 1994, 1995, 2001, 2002, 2004
+ Copyright 1993, 1994, 1995, 2001, 2002, 2004, 2006, 2007
Free Software Foundation, Inc.
Written by Stu Grossman of Cygnus Support.
@@ -19,8 +19,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#ifdef LYNX_CORE
@@ -73,11 +73,10 @@ make_bfd_asection (abfd, name, flags, size, vma, filepos)
strcpy (newname, name);
- asect = bfd_make_section (abfd, newname);
+ asect = bfd_make_section_with_flags (abfd, newname, flags);
if (!asect)
return NULL;
- asect->flags = flags;
asect->size = size;
asect->vma = vma;
asect->filepos = filepos;
diff --git a/bfd/m68klinux.c b/bfd/m68klinux.c
index 2c12a7c776e7..316947717607 100644
--- a/bfd/m68klinux.c
+++ b/bfd/m68klinux.c
@@ -1,6 +1,6 @@
/* BFD back-end for linux flavored m68k a.out binaries.
Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002,
- 2003, 2004, 2006 Free Software Foundation, Inc.
+ 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -26,8 +26,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
#define MACHTYPE_OK(mtype) ((mtype) == M_68020 || (mtype) == M_UNKNOWN)
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "aout/aout64.h"
#include "aout/stab_gnu.h"
@@ -94,8 +94,7 @@ m68klinux_write_object_contents (abfd)
#define GOT_REF_PREFIX "__GOT_"
#endif
-#define IS_GOT_SYM(name) \
- (strncmp (name, GOT_REF_PREFIX, sizeof GOT_REF_PREFIX - 1) == 0)
+#define IS_GOT_SYM(name) (CONST_STRNEQ (name, GOT_REF_PREFIX))
/* See if a symbol name is a reference to the procedure linkage table. */
@@ -103,8 +102,7 @@ m68klinux_write_object_contents (abfd)
#define PLT_REF_PREFIX "__PLT_"
#endif
-#define IS_PLT_SYM(name) \
- (strncmp (name, PLT_REF_PREFIX, sizeof PLT_REF_PREFIX - 1) == 0)
+#define IS_PLT_SYM(name) (CONST_STRNEQ (name, PLT_REF_PREFIX))
/* This string is used to generate specialized error messages. */
@@ -316,9 +314,8 @@ linux_link_create_dynamic_sections (abfd, info)
/* We choose to use the name ".linux-dynamic" for the fixup table.
Why not? */
- s = bfd_make_section (abfd, ".linux-dynamic");
+ s = bfd_make_section_with_flags (abfd, ".linux-dynamic", flags);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags)
|| ! bfd_set_section_alignment (abfd, s, 2))
return FALSE;
s->size = 0;
@@ -446,8 +443,7 @@ linux_tally_symbols (h, data)
h = (struct linux_link_hash_entry *) h->root.root.u.i.link;
if (h->root.root.type == bfd_link_hash_undefined
- && strncmp (h->root.root.root.string, NEEDS_SHRLIB,
- sizeof NEEDS_SHRLIB - 1) == 0)
+ && CONST_STRNEQ (h->root.root.root.string, NEEDS_SHRLIB))
{
const char *name;
char *p;
diff --git a/bfd/m88kmach3.c b/bfd/m88kmach3.c
index ec2ae75554c3..a94425c7fd1f 100644
--- a/bfd/m88kmach3.c
+++ b/bfd/m88kmach3.c
@@ -1,5 +1,5 @@
/* BFD back-end for Motorola m88k a.out (Mach 3) binaries.
- Copyright 1990, 1991, 1993, 1994, 1995, 2001, 2003
+ Copyright 1990, 1991, 1993, 1994, 1995, 2001, 2003, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -26,8 +26,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
#define N_TXTSIZE(x) ((x).a_text)
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "libaout.h"
diff --git a/bfd/mach-o-target.c b/bfd/mach-o-target.c
index 103142a08dd9..76bed2e002d2 100644
--- a/bfd/mach-o-target.c
+++ b/bfd/mach-o-target.c
@@ -1,5 +1,5 @@
/* Mach-O support for BFD.
- Copyright 1999, 2000, 2001, 2002
+ Copyright 1999, 2000, 2001, 2002, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -105,7 +105,7 @@ const bfd_target TARGET_NAME =
BFD_JUMP_TABLE_CORE (bfd_mach_o),
BFD_JUMP_TABLE_ARCHIVE (bfd_mach_o),
BFD_JUMP_TABLE_SYMBOLS (bfd_mach_o),
- BFD_JUMP_TABLE_RELOCS (bfd_mach_o),
+ BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
BFD_JUMP_TABLE_WRITE (bfd_mach_o),
BFD_JUMP_TABLE_LINK (bfd_mach_o),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
diff --git a/bfd/mach-o.c b/bfd/mach-o.c
index 03a714495bb3..d4abbeccd2d0 100644
--- a/bfd/mach-o.c
+++ b/bfd/mach-o.c
@@ -1,5 +1,5 @@
/* Mach-O support for BFD.
- Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,9 +18,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+#include "sysdep.h"
#include "mach-o.h"
#include "bfd.h"
-#include "sysdep.h"
#include "libbfd.h"
#include "libiberty.h"
#include <ctype.h>
@@ -52,9 +52,6 @@
#define bfd_mach_o_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
#define bfd_mach_o_read_minisymbols _bfd_generic_read_minisymbols
#define bfd_mach_o_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
-#define bfd_mach_o_get_reloc_upper_bound _bfd_norelocs_get_reloc_upper_bound
-#define bfd_mach_o_canonicalize_reloc _bfd_norelocs_canonicalize_reloc
-#define bfd_mach_o_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
#define bfd_mach_o_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
#define bfd_mach_o_bfd_relax_section bfd_generic_relax_section
#define bfd_mach_o_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
@@ -568,7 +565,7 @@ bfd_mach_o_write_contents (bfd *abfd)
static int
bfd_mach_o_sizeof_headers (bfd *a ATTRIBUTE_UNUSED,
- bfd_boolean b ATTRIBUTE_UNUSED)
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
return 0;
}
@@ -634,6 +631,7 @@ bfd_mach_o_make_bfd_section (bfd *abfd, bfd_mach_o_section *section)
char *sname;
const char *prefix = "LC_SEGMENT";
unsigned int snamelen;
+ flagword flags;
snamelen = strlen (prefix) + 1
+ strlen (section->segname) + 1
@@ -644,7 +642,10 @@ bfd_mach_o_make_bfd_section (bfd *abfd, bfd_mach_o_section *section)
return NULL;
sprintf (sname, "%s.%s.%s", prefix, section->segname, section->sectname);
- bfdsec = bfd_make_section_anyway (abfd, sname);
+ flags = SEC_ALLOC;
+ if (!(section->flags & BFD_MACH_O_S_ZEROFILL))
+ flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_CODE;
+ bfdsec = bfd_make_section_anyway_with_flags (abfd, sname, flags);
if (bfdsec == NULL)
return NULL;
@@ -654,11 +655,6 @@ bfd_mach_o_make_bfd_section (bfd *abfd, bfd_mach_o_section *section)
bfdsec->filepos = section->offset;
bfdsec->alignment_power = section->align;
- if (section->flags & BFD_MACH_O_S_ZEROFILL)
- bfdsec->flags = SEC_ALLOC;
- else
- bfdsec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_CODE;
-
return bfdsec;
}
@@ -966,7 +962,7 @@ bfd_mach_o_scan_read_dylinker (bfd *abfd,
return -1;
strcpy (sname, prefix);
- bfdsec = bfd_make_section_anyway (abfd, sname);
+ bfdsec = bfd_make_section_anyway_with_flags (abfd, sname, SEC_HAS_CONTENTS);
if (bfdsec == NULL)
return -1;
@@ -975,7 +971,6 @@ bfd_mach_o_scan_read_dylinker (bfd *abfd,
bfdsec->size = command->len - 8;
bfdsec->filepos = command->offset + 8;
bfdsec->alignment_power = 0;
- bfdsec->flags = SEC_HAS_CONTENTS;
cmd->section = bfdsec;
@@ -1022,7 +1017,7 @@ bfd_mach_o_scan_read_dylib (bfd *abfd, bfd_mach_o_load_command *command)
return -1;
strcpy (sname, prefix);
- bfdsec = bfd_make_section_anyway (abfd, sname);
+ bfdsec = bfd_make_section_anyway_with_flags (abfd, sname, SEC_HAS_CONTENTS);
if (bfdsec == NULL)
return -1;
@@ -1031,7 +1026,6 @@ bfd_mach_o_scan_read_dylib (bfd *abfd, bfd_mach_o_load_command *command)
bfdsec->size = command->len - 8;
bfdsec->filepos = command->offset + 8;
bfdsec->alignment_power = 0;
- bfdsec->flags = SEC_HAS_CONTENTS;
cmd->section = bfdsec;
@@ -1142,14 +1136,13 @@ bfd_mach_o_scan_read_thread (bfd *abfd, bfd_mach_o_load_command *command)
j++;
}
- bfdsec = bfd_make_section (abfd, sname);
+ bfdsec = bfd_make_section_with_flags (abfd, sname, SEC_HAS_CONTENTS);
bfdsec->vma = 0;
bfdsec->lma = 0;
bfdsec->size = cmd->flavours[i].size;
bfdsec->filepos = cmd->flavours[i].offset;
bfdsec->alignment_power = 0x0;
- bfdsec->flags = SEC_HAS_CONTENTS;
cmd->section = bfdsec;
}
@@ -1218,7 +1211,7 @@ bfd_mach_o_scan_read_symtab (bfd *abfd, bfd_mach_o_load_command *command)
return -1;
strcpy (sname, prefix);
- bfdsec = bfd_make_section_anyway (abfd, sname);
+ bfdsec = bfd_make_section_anyway_with_flags (abfd, sname, SEC_HAS_CONTENTS);
if (bfdsec == NULL)
return -1;
@@ -1227,7 +1220,6 @@ bfd_mach_o_scan_read_symtab (bfd *abfd, bfd_mach_o_load_command *command)
bfdsec->size = seg->nsyms * 12;
bfdsec->filepos = seg->symoff;
bfdsec->alignment_power = 0;
- bfdsec->flags = SEC_HAS_CONTENTS;
seg->stabs_segment = bfdsec;
@@ -1237,7 +1229,7 @@ bfd_mach_o_scan_read_symtab (bfd *abfd, bfd_mach_o_load_command *command)
return -1;
strcpy (sname, prefix);
- bfdsec = bfd_make_section_anyway (abfd, sname);
+ bfdsec = bfd_make_section_anyway_with_flags (abfd, sname, SEC_HAS_CONTENTS);
if (bfdsec == NULL)
return -1;
@@ -1246,7 +1238,6 @@ bfd_mach_o_scan_read_symtab (bfd *abfd, bfd_mach_o_load_command *command)
bfdsec->size = seg->strsize;
bfdsec->filepos = seg->stroff;
bfdsec->alignment_power = 0;
- bfdsec->flags = SEC_HAS_CONTENTS;
seg->stabstr_segment = bfdsec;
@@ -1263,6 +1254,7 @@ bfd_mach_o_scan_read_segment (bfd *abfd, bfd_mach_o_load_command *command)
char *sname;
const char *prefix = "LC_SEGMENT";
unsigned int snamelen;
+ flagword flags;
BFD_ASSERT (command->type == BFD_MACH_O_LC_SEGMENT);
@@ -1286,7 +1278,8 @@ bfd_mach_o_scan_read_segment (bfd *abfd, bfd_mach_o_load_command *command)
return -1;
sprintf (sname, "%s.%s", prefix, seg->segname);
- bfdsec = bfd_make_section_anyway (abfd, sname);
+ flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_CODE;
+ bfdsec = bfd_make_section_anyway_with_flags (abfd, sname, flags);
if (bfdsec == NULL)
return -1;
@@ -1295,7 +1288,6 @@ bfd_mach_o_scan_read_segment (bfd *abfd, bfd_mach_o_load_command *command)
bfdsec->size = seg->filesize;
bfdsec->filepos = seg->fileoff;
bfdsec->alignment_power = 0x0;
- bfdsec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_CODE;
seg->segment = bfdsec;
diff --git a/bfd/mep-relocs.pl b/bfd/mep-relocs.pl
new file mode 100755
index 000000000000..d227b8252c0c
--- /dev/null
+++ b/bfd/mep-relocs.pl
@@ -0,0 +1,274 @@
+#!/usr/bin/perl
+# -*- perl -*-
+#
+# Toshiba MeP Media Engine Relocation Generator
+# Copyright (C) 2001, 2007 Free Software Foundation, Inc.
+# This file is part of BFD.
+# Originally written by DJ Delorie <dj@redhat.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+
+# Usage: Run this anywhere inside your source tree. It will read
+# include/elf/mep.h and scan the comments therein. It will renumber
+# the relocs to be sequential (this is needed so that bfd/elf32-mep.h
+# works) if needed. It will then update the reloc list in bfd/reloc.c
+# and the howto, mapping, and apply routines in bfd/elf32-mep.c. You
+# can then regenerate bfd-in2.h and check everything in.
+
+# FIXME: After the relocation list is finalized, change this to
+# *verify* the reloc list, rather than resequence it.
+
+while (! -f "include/elf/mep.h" && ! -f "bfd/reloc.c") {
+ chdir "..";
+ $pwd = `pwd`;
+ if ($pwd !~ m@/.*/@) {
+ print STDERR "Cannot find include/elf/mep.h or bfd/reloc.h\n";
+ exit 1;
+ }
+}
+$pwd = `pwd`;
+print "srctop is $pwd";
+
+printf "Reading include/elf/mep.h ...\n";
+open(MEPH, "include/elf/mep.h");
+open(MEPHO, "> include/elf/mep.h.new") || die("mep.h.new create: $!");
+$val = 0;
+while (<MEPH>) {
+ if (($pre,$rel,$rest) = /(.*RELOC_NUMBER \()([^,]+), *\d+(.*)/) {
+ $rest =~ s/[\r\n]+$//;
+ print (MEPHO "$pre$rel, $val$rest\n") || die("mep.h.new write: $!");
+ $val ++;
+ $rel =~ s/R_MEP_//;
+ push(@relocs, $rel);
+
+ $rest =~ s@.*/\* @@;
+ ($pattern, $sign, $attrs) = $rest =~ m@(.*) ([US]) (.*)\*/@;
+ $pattern =~ s/ //g;
+ push(@pattern, $pattern);
+ push(@sign, $sign);
+ push(@attrs, $attrs);
+
+ printf "%4d $rel p=`$pattern' s=`$sign' a=`$attrs'\n", $#pattern;
+
+ } else {
+ print(MEPHO) || die("mep.h.new write: $!");
+ }
+}
+close(MEPH);
+close(MEPHO) || die("mep.h.new close: $!");
+
+&swapfile("include/elf/mep.h");
+
+redo_file ("bfd/reloc.c",
+ "",
+ "ENUMDOC\n Toshiba Media Processor Relocations.\n\nCOMMENT\n",
+ "ENUM\n BFD_RELOC_MEP_%s\n",
+ "");
+
+$autogen = " /* This section generated from bfd/mep-relocs.pl from include/elf/mep.h. */\n";
+
+redo_file ("bfd/elf32-mep.c",
+ "MEPRELOC:HOWTO",
+ $autogen,
+ "MEPRELOC:END",
+ "",
+ "&emit_howto();",
+ "MEPRELOC:MAP",
+ $autogen,
+ "MEPRELOC:END",
+ "",
+ " MAP(%s);\n",
+ "MEPRELOC:APPLY",
+ $autogen,
+ "MEPRELOC:END",
+ "",
+ "&emit_apply();",
+ );
+
+sub mask2shifts {
+ my ($mask) = @_;
+ my ($bits, $left, $right, $ci, $c, $cv);
+ $bits = 0;
+ $left = 0;
+ $right = 32;
+ for ($ci=0; $ci<length($mask); $ci++) {
+ $c = substr($mask, $ci, 1);
+ $left++;
+ next if $c eq '-';
+ $left = 0;
+ $cv = ord($c) - ord('0');
+ $cv -= ord('a') - ord('9') - 1 if $cv > 9;
+ $right = $cv unless $right < $cv;
+ $bits = $cv+1 unless $bits > $cv+1;
+ }
+ $mask =~ tr/-/1/c;
+ $mask =~ tr/-/0/;
+ ($rmask = $mask) =~ tr/01/10/;
+ $mask = unpack("H*", pack("B*", $mask));
+ $rmask = unpack("H*", pack("B*", $rmask));
+ return ($bits, $left, $right, $mask, $rmask);
+}
+
+sub emit_howto {
+ for ($i=2; $i<=$#relocs; $i++) {
+ $mask = $pattern[$i];
+
+ if (length($mask) == 8) { $bytesize = 0; }
+ elsif (length($mask) == 16) { $bytesize = 1; }
+ elsif (length($mask) == 32) { $bytesize = 2; }
+
+ ($bits, $left, $right, $mask) = mask2shifts ($mask);
+ $bits[$i] = $bits;
+ $pcrel = 0;
+ $pcrel = 1 if $attrs[$i] =~ /pc-rel/i;
+ $overflow = $sign[$i];
+ $overflow = 'N' if $attrs[$i] =~ /no-overflow/;
+
+ $c = "$relocs[$i],";
+ printf(NEW " MEPREL (R_MEP_%-10s%d,%3d,%2d,%2d,%2d,%2s, 0x%s),\n",
+ $c, $bytesize, $bits, $left, $right, $pcrel, $overflow, $mask);
+ }
+}
+
+sub emit_apply {
+ for ($i=2; $i<=$#relocs; $i++) {
+ $v = "u";
+ $v = "s" if $sign[$i] =~ /S/;
+ if (length($pattern[$i]) == 8) {
+ $e = ''; # no endian swap for bytes
+ } elsif ($pattern[$i] =~ /-/ || length($pattern[$i]) == 16) {
+ $e = '^e2'; # endian swap - 2byte words only
+ } else {
+ $e = '^e4' # endian swap for data
+ }
+ print NEW " case R_MEP_$relocs[$i]: /* $pattern[$i] */\n";
+ if ($attrs[$i] =~ /tp-rel/i) {
+ print NEW " $v -= mep_tpoff_base(rel->r_offset);\n";
+ }
+ if ($attrs[$i] =~ /gp-rel/i) {
+ print NEW " $v -= mep_sdaoff_base(rel->r_offset);\n";
+ }
+ if ($attrs[$i] !~ /no-overflow/ && $bits[$i] < 32) {
+ if ($v eq "u") {
+ $max = (1 << $bits[$i]) - 1;
+ print NEW " if (u > $max) r = bfd_reloc_overflow;\n";
+ } else {
+ $min = -(1 << ($bits[$i]-1));
+ $max = (1 << ($bits[$i]-1)) - 1;
+ print NEW " if ($min > s || s > $max) r = bfd_reloc_overflow;\n";
+ }
+ }
+ for ($b=0; $b<length($pattern[$i]); $b += 8) {
+ $mask = substr($pattern[$i], $b, 8);
+ ($bits, $left, $right, $mask, $rmask) = mask2shifts ($mask);
+ if ($left > $right) { $left -= $right; $right = 0; }
+ else { $right -= $left; $left = 0; }
+
+ if ($mask ne "00") {
+ $bb = $b / 8;
+ print NEW " byte[$bb$e] = ";
+ print NEW "(byte[$bb$e] & 0x$rmask) | " if $rmask ne "00";
+ if ($left) {
+ print NEW "(($v << $left) & 0x$mask)";
+ } elsif ($right) {
+ print NEW "(($v >> $right) & 0x$mask)";
+ } else {
+ print NEW "($v & 0x$mask)";
+ }
+ print NEW ";\n";
+ }
+ }
+ print NEW " break;\n";
+ }
+}
+
+
+#-----------------------------------------------------------------------------
+
+sub redo_file {
+ my ($file, @control) = @_;
+ open(OLD, $file);
+ open(NEW, "> $file.new") || die("$file.new create: $!");
+
+ print "Scanning file $file ...\n";
+
+ while (1) {
+ $start = shift @control;
+ $prefix = shift @control;
+ $end = shift @control;
+ $suffix = shift @control;
+ $pattern = shift @control;
+
+ if (!$start) {
+ print NEW while <OLD>;
+ last;
+ }
+
+ print " looking for $start\n";
+ while (<OLD>) {
+ print NEW;
+ last if /\Q$start\E/;
+ }
+ print "can't find $start\n" unless $_;
+ last unless $_;
+
+ print NEW $prefix;
+ if ($pattern =~ /^\&/) {
+ eval $pattern;
+ die("$pattern: $@") if $@;
+ } else {
+ for $i (2..$#relocs) {
+ printf (NEW "$pattern", $relocs[$i]) || die("$file.new write: $!");
+ $pattern =~ s/^ENUM\n/ENUMX\n/;
+ }
+ }
+ print NEW $suffix;
+ while (<OLD>) {
+ last if /\Q$end\E/;
+ }
+ print NEW;
+ }
+
+ close(OLD);
+ close(NEW) || die("$file.new close: $!");
+ &swapfile($file);
+}
+
+#-----------------------------------------------------------------------------
+
+sub swapfile {
+ my ($f) = @_;
+ if ( ! -f "$f.save") {
+ system "cp $f $f.save";
+ }
+ open(ORIG, $f);
+ open(NEW, "$f.new");
+ while (<ORIG>) {
+ $n = <NEW>;
+ if ($n ne $_) {
+ close(ORIG);
+ close(NEW);
+ print " Updating $f\n";
+ rename "$f", "$f.old";
+ rename "$f.new", "$f";
+ return;
+ }
+ }
+ close(ORIG);
+ close(NEW);
+ print " No change to $f\n";
+ unlink "$f.new";
+}
diff --git a/bfd/merge.c b/bfd/merge.c
index c1795d29112f..71b31d378b50 100644
--- a/bfd/merge.c
+++ b/bfd/merge.c
@@ -1,5 +1,5 @@
/* SEC_MERGE support.
- Copyright 2001, 2002, 2003, 2004, 2005, 2006
+ Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Jakub Jelinek <jakub@redhat.com>.
@@ -22,8 +22,8 @@
/* This file contains support for merging duplicate entities within sections,
as used in ELF SHF_MERGE. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "hashtab.h"
#include "libiberty.h"
@@ -766,7 +766,7 @@ _bfd_merge_sections (bfd *abfd ATTRIBUTE_UNUSED,
the hash table at all. */
for (secinfo = sinfo->chain; secinfo; secinfo = secinfo->next)
if (secinfo->first_str == NULL)
- secinfo->sec->flags |= SEC_EXCLUDE;
+ secinfo->sec->flags |= SEC_EXCLUDE | SEC_KEEP;
}
return TRUE;
diff --git a/bfd/mipsbsd.c b/bfd/mipsbsd.c
index b8621e486ae1..6edb9728361c 100644
--- a/bfd/mipsbsd.c
+++ b/bfd/mipsbsd.c
@@ -1,6 +1,6 @@
/* BFD backend for MIPS BSD (a.out) binaries.
- Copyright 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+ 2007 Free Software Foundation, Inc.
Written by Ralph Campbell.
This file is part of BFD, the Binary File Descriptor library.
@@ -40,8 +40,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
the tokens. */
#define MY(OP) CONCAT2 (mipsbsd_,OP)
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "libaout.h"
@@ -56,7 +56,8 @@ static bfd_boolean MY(write_object_contents) PARAMS ((bfd *abfd));
/* We can't use MY(x) here because it leads to a recursive call to CONCAT2
when expanded inside JUMP_TABLE. */
-#define MY_bfd_reloc_type_lookup mipsbsd_reloc_howto_type_lookup
+#define MY_bfd_reloc_type_lookup mipsbsd_reloc_type_lookup
+#define MY_bfd_reloc_name_lookup mipsbsd_reloc_name_lookup
#define MY_canonicalize_reloc mipsbsd_canonicalize_reloc
#define MY_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
@@ -72,8 +73,6 @@ static bfd_boolean MY(write_object_contents) PARAMS ((bfd *abfd));
static bfd_reloc_status_type mips_fix_jmp_addr
PARAMS ((bfd *, arelent *, struct bfd_symbol *, PTR, asection *,
bfd *, char **));
-static reloc_howto_type *MY(reloc_howto_type_lookup)
- PARAMS ((bfd *, bfd_reloc_code_real_type));
long MY(canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
@@ -302,9 +301,7 @@ static reloc_howto_type mips_howto_table_ext[] = {
};
static reloc_howto_type *
-MY(reloc_howto_type_lookup) (abfd, code)
- bfd *abfd;
- bfd_reloc_code_real_type code;
+MY(reloc_type_lookup) (bfd *abfd, bfd_reloc_code_real_type code)
{
if (bfd_get_arch (abfd) != bfd_arch_mips)
@@ -330,6 +327,22 @@ MY(reloc_howto_type_lookup) (abfd, code)
}
}
+static reloc_howto_type *
+MY(reloc_name_lookup) (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (mips_howto_table_ext) / sizeof (mips_howto_table_ext[0]);
+ i++)
+ if (mips_howto_table_ext[i].name != NULL
+ && strcasecmp (mips_howto_table_ext[i].name, r_name) == 0)
+ return &mips_howto_table_ext[i];
+
+ return NULL;
+}
+
/* This is just like the standard aoutx.h version but we need to do our
own mapping of external reloc type values to howto entries. */
long
diff --git a/bfd/mmo.c b/bfd/mmo.c
index 091b341810be..380a0429d3b6 100644
--- a/bfd/mmo.c
+++ b/bfd/mmo.c
@@ -1,5 +1,5 @@
/* BFD back-end for mmo objects (MMIX-specific object-format).
- Copyright 2001, 2002, 2003, 2004, 2005
+ Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Hans-Peter Nilsson (hp@bitrange.com).
Infrastructure and other bits originally copied from srec.c and
@@ -195,8 +195,8 @@ EXAMPLE
| 0x81000000
| 0x980c0005 - lop_end; symbol table contained five 32-bit words. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "libiberty.h"
#include "elf/mmix.h"
@@ -387,8 +387,7 @@ static void mmo_print_symbol (bfd *, void *, asymbol *,
bfd_print_symbol_type);
static bfd_boolean mmo_set_section_contents (bfd *, sec_ptr, const void *,
file_ptr, bfd_size_type);
-static int mmo_sizeof_headers (bfd *, bfd_boolean);
-static long mmo_get_reloc_upper_bound (bfd *, asection *);
+static int mmo_sizeof_headers (bfd *, struct bfd_link_info *);
static bfd_boolean mmo_internal_write_header (bfd *);
static bfd_boolean mmo_internal_write_post (bfd *, int, asection *);
static bfd_boolean mmo_internal_add_3_sym (bfd *, struct mmo_symbol_trie *,
@@ -415,7 +414,6 @@ static void mmo_write_byte (bfd *, bfd_byte);
static bfd_boolean mmo_new_section_hook (bfd *, asection *);
static int mmo_sort_mmo_symbols (const void *, const void *);
static bfd_boolean mmo_write_object_contents (bfd *);
-static long mmo_canonicalize_reloc (bfd *, sec_ptr, arelent **, asymbol **);
static bfd_boolean mmo_write_section_description (bfd *, asection *);
static bfd_boolean mmo_has_leading_or_trailing_zero_tetra_p (bfd *,
asection *);
@@ -1917,7 +1915,7 @@ mmo_scan (bfd *abfd)
/* This must be the last 32-bit word in an mmo file.
Let's find out. */
struct stat statbuf;
- long curpos = bfd_tell (abfd);
+ file_ptr curpos = bfd_tell (abfd);
if (bfd_stat (abfd, &statbuf) < 0)
goto error_return;
@@ -2007,19 +2005,21 @@ mmo_scan (bfd *abfd)
we point out the shape of allocated section contents. */
static bfd_boolean
-mmo_new_section_hook (bfd *abfd ATTRIBUTE_UNUSED, asection *newsect)
+mmo_new_section_hook (bfd *abfd, asection *newsect)
{
- /* We zero-fill all fields and assume NULL is represented by an all
- zero-bit pattern. */
- newsect->used_by_bfd =
- bfd_zalloc (abfd, sizeof (struct mmo_section_data_struct));
-
if (!newsect->used_by_bfd)
- return FALSE;
+ {
+ /* We zero-fill all fields and assume NULL is represented by an all
+ zero-bit pattern. */
+ newsect->used_by_bfd
+ = bfd_zalloc (abfd, sizeof (struct mmo_section_data_struct));
+ if (!newsect->used_by_bfd)
+ return FALSE;
+ }
/* Always align to at least 32-bit words. */
newsect->alignment_power = 2;
- return TRUE;
+ return _bfd_generic_new_section_hook (abfd, newsect);
}
/* We already have section contents loaded for sections that have
@@ -2229,7 +2229,7 @@ mmo_print_symbol (bfd *abfd, void *afile, asymbol *symbol,
static int
mmo_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
- bfd_boolean exec ATTRIBUTE_UNUSED)
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
return 0;
}
@@ -2419,10 +2419,10 @@ mmo_internal_write_section (bfd *abfd, asection *sec)
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
- else if (strncmp (sec->name, MMIX_OTHER_SPEC_SECTION_PREFIX,
- strlen (MMIX_OTHER_SPEC_SECTION_PREFIX)) == 0)
+ else if (CONST_STRNEQ (sec->name, MMIX_OTHER_SPEC_SECTION_PREFIX))
{
int n = atoi (sec->name + strlen (MMIX_OTHER_SPEC_SECTION_PREFIX));
+
mmo_write_tetra_raw (abfd, (LOP << 24) | (LOP_SPEC << 16) | n);
return (! abfd->tdata.mmo_data->have_error
&& mmo_write_chunk_list (abfd, mmo_section_data (sec)->head));
@@ -3159,28 +3159,6 @@ mmo_write_object_contents (bfd *abfd)
return mmo_write_symbols_and_terminator (abfd);
}
-/* Return the size of a NULL pointer, so we support linking in an mmo
- object. */
-
-static long
-mmo_get_reloc_upper_bound (bfd *abfd ATTRIBUTE_UNUSED,
- asection *sec ATTRIBUTE_UNUSED)
-{
- return sizeof (void *);
-}
-
-/* Similarly canonicalize relocs to empty, filling in the terminating NULL
- pointer. */
-
-long
-mmo_canonicalize_reloc (bfd *abfd ATTRIBUTE_UNUSED,
- sec_ptr section ATTRIBUTE_UNUSED, arelent **relptr,
- asymbol **symbols ATTRIBUTE_UNUSED)
-{
- *relptr = NULL;
- return 0;
-}
-
/* If there's anything in particular in a mmo bfd that we want to free,
make this a real function. Only do this if you see major memory
thrashing; zealous free:ing will cause unwanted behavior, especially if
@@ -3232,18 +3210,6 @@ mmo_canonicalize_reloc (bfd *abfd ATTRIBUTE_UNUSED,
#define mmo_section_already_linked \
_bfd_generic_section_already_linked
-/* objcopy will be upset if we return -1 from bfd_get_reloc_upper_bound by
- using BFD_JUMP_TABLE_RELOCS (_bfd_norelocs) rather than 0. FIXME: Most
- likely a bug in the _bfd_norelocs definition.
-
- On the other hand, we smuggle in an mmo object (because setting up ELF
- is too cumbersome) when linking (from other formats, presumably ELF) to
- represent the g255 entry. We need to link that object, so need to say
- it has no relocs. Upper bound for the size of the relocation table is
- the size of a NULL pointer, and we support "canonicalization" for that
- pointer. */
-#define mmo_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
-
/* We want to copy time of creation, otherwise we'd use
BFD_JUMP_TABLE_COPY (_bfd_generic). */
#define mmo_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
@@ -3303,9 +3269,7 @@ const bfd_target bfd_mmo_vec =
BFD_JUMP_TABLE_CORE (_bfd_nocore),
BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
BFD_JUMP_TABLE_SYMBOLS (mmo),
- /* We have to provide a valid method for getting relocs, returning zero,
- so we can't say BFD_JUMP_TABLE_RELOCS (_bfd_norelocs). */
- BFD_JUMP_TABLE_RELOCS (mmo),
+ BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
BFD_JUMP_TABLE_WRITE (mmo),
BFD_JUMP_TABLE_LINK (mmo),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
diff --git a/bfd/netbsd-core.c b/bfd/netbsd-core.c
index e9111a985010..913e862f9a4b 100644
--- a/bfd/netbsd-core.c
+++ b/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, 2003, 2004, 2005
+ 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Paul Kranenburg, EUR
@@ -20,8 +20,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "libaout.h" /* BFD a.out internal data structures. */
@@ -126,11 +126,10 @@ netbsd_core_file_p (bfd *abfd)
flags = SEC_ALLOC + SEC_HAS_CONTENTS;
break;
}
- asect = bfd_make_section_anyway (abfd, sname);
+ asect = bfd_make_section_anyway_with_flags (abfd, sname, flags);
if (asect == NULL)
goto punt;
- asect->flags = flags;
asect->size = coreseg.c_size;
asect->vma = coreseg.c_addr;
asect->filepos = offset;
@@ -159,11 +158,12 @@ netbsd_core_file_p (bfd *abfd)
asect->size = wcookie_offset;
/* And create the .wcookie section. */
- asect = bfd_make_section_anyway (abfd, ".wcookie");
+ flags = SEC_ALLOC + SEC_HAS_CONTENTS;
+ asect = bfd_make_section_anyway_with_flags (abfd, ".wcookie",
+ flags);
if (asect == NULL)
goto punt;
- asect->flags = SEC_ALLOC + SEC_HAS_CONTENTS;
asect->size = coreseg.c_size - wcookie_offset;
asect->vma = 0;
asect->filepos = offset + wcookie_offset;
diff --git a/bfd/netbsd.h b/bfd/netbsd.h
index 92f6a7d2fd19..7182eda90475 100644
--- a/bfd/netbsd.h
+++ b/bfd/netbsd.h
@@ -1,6 +1,6 @@
/* BFD back-end definitions used by all NetBSD targets.
- Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 2000, 2002, 2005
- Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 2000, 2002,
+ 2005, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -50,8 +50,8 @@
((exec).a_info = \
((exec).a_info & 0x03ffffff) | ((flags & 0x03f) << 26))
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "libaout.h"
diff --git a/bfd/newsos3.c b/bfd/newsos3.c
index 46f1d76054a1..9270c2398c7d 100644
--- a/bfd/newsos3.c
+++ b/bfd/newsos3.c
@@ -1,5 +1,5 @@
/* BFD back-end for NewsOS3 (Sony, 68k) binaries.
- Copyright 1990, 1991, 1994, 1995, 2000, 2001, 2003
+ Copyright 1990, 1991, 1994, 1995, 2000, 2001, 2003, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -33,8 +33,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
#define TARGET_IS_BIG_ENDIAN_P
#define N_HEADER_IN_TEXT(x) 0
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "aout/aout64.h"
#include "aout/stab_gnu.h"
diff --git a/bfd/nlm-target.h b/bfd/nlm-target.h
index 3358aef8e75e..7556112b5bd1 100644
--- a/bfd/nlm-target.h
+++ b/bfd/nlm-target.h
@@ -1,6 +1,6 @@
/* Target definitions for 32/64-bit NLM (NetWare Loadable Module)
Copyright 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005 Free Software Foundation, Inc.
+ 2005, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -37,6 +37,7 @@
#define nlm_get_reloc_upper_bound nlmNAME (get_reloc_upper_bound)
#define nlm_canonicalize_reloc nlmNAME (canonicalize_reloc)
#define nlm_bfd_reloc_type_lookup bfd_default_reloc_type_lookup
+#define nlm_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup
#define nlm_set_section_contents nlmNAME (set_section_contents)
#define nlm_sizeof_headers _bfd_nolink_sizeof_headers
diff --git a/bfd/nlm.c b/bfd/nlm.c
index 44599b595f29..4919d6c8dbb1 100644
--- a/bfd/nlm.c
+++ b/bfd/nlm.c
@@ -1,5 +1,5 @@
/* NLM (NetWare Loadable Module) executable support for BFD.
- Copyright 1993, 1994, 2001, 2002, 2003, 2005
+ Copyright 1993, 1994, 2001, 2002, 2003, 2005, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "libnlm.h"
diff --git a/bfd/nlm32-alpha.c b/bfd/nlm32-alpha.c
index 87d80c159a85..384c0169a7ff 100644
--- a/bfd/nlm32-alpha.c
+++ b/bfd/nlm32-alpha.c
@@ -1,5 +1,5 @@
/* Support for 32-bit Alpha NLM (NetWare Loadable Module)
- Copyright 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2007
Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
@@ -23,8 +23,8 @@
that an Alpha chip would use a 64 bit format, but, for some reason,
it doesn't. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#define ARCH_SIZE 32
diff --git a/bfd/nlm32-i386.c b/bfd/nlm32-i386.c
index fcdfc645640b..c3a5d7e1eb90 100644
--- a/bfd/nlm32-i386.c
+++ b/bfd/nlm32-i386.c
@@ -1,5 +1,5 @@
/* Support for 32-bit i386 NLM (NetWare Loadable Module)
- Copyright 1993, 1994, 2000, 2001, 2002, 2003, 2005
+ Copyright 1993, 1994, 2000, 2001, 2002, 2003, 2005, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#define ARCH_SIZE 32
diff --git a/bfd/nlm32-ppc.c b/bfd/nlm32-ppc.c
index 8b0d4009df83..a09df98c2a61 100644
--- a/bfd/nlm32-ppc.c
+++ b/bfd/nlm32-ppc.c
@@ -1,6 +1,6 @@
/* Support for 32-bit PowerPC NLM (NetWare Loadable Module)
- Copyright 1994, 1995, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005 Free Software Foundation, Inc.
+ Copyright 1994, 1995, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+ 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
diff --git a/bfd/nlm32-sparc.c b/bfd/nlm32-sparc.c
index e647ad082aa5..4acf791c1fbe 100644
--- a/bfd/nlm32-sparc.c
+++ b/bfd/nlm32-sparc.c
@@ -1,6 +1,6 @@
/* Support for 32-bit SPARC NLM (NetWare Loadable Module)
- Copyright 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#define ARCH_SIZE 32
@@ -123,8 +123,9 @@ nlm_sparc_read_reloc (bfd *abfd,
}
#ifdef DEBUG
- fprintf (stderr, "%s: address = %08lx, addend = %08lx, type = %d, howto = %08lx\n",
- __FUNCTION__, rel->address, rel->addend, type, rel->howto);
+ fprintf (stderr, "%s: address = %08lx, addend = %08lx, type = %u, howto = %p\n",
+ __FUNCTION__, (unsigned long) rel->address,
+ (unsigned long) rel->addend, type, rel->howto);
#endif
return TRUE;
@@ -176,8 +177,9 @@ nlm_sparc_write_reloc (bfd * abfd, asection * sec, arelent * rel)
val = bfd_get_section_vma (abfd, sec) + rel->address;
#ifdef DEBUG
- fprintf (stderr, "%s: val = %08lx, addend = %08lx, type = %d\n",
- __FUNCTION__, val, rel->addend, rel->howto->type);
+ fprintf (stderr, "%s: val = %08lx, addend = %08lx, type = %u\n",
+ __FUNCTION__, (unsigned long) val, (unsigned long) rel->addend,
+ rel->howto->type);
#endif
bfd_put_32 (abfd, val, tmp_reloc.offset);
bfd_put_32 (abfd, rel->addend, tmp_reloc.addend);
@@ -280,8 +282,8 @@ nlm_sparc_write_import (bfd * abfd, asection * sec, arelent * rel)
base = 0;
#ifdef DEBUG
- fprintf (stderr, "%s: <%x, 1>\n\t",
- __FUNCTION__, base + (*rel->sym_ptr_ptr)->value);
+ fprintf (stderr, "%s: <%lx, 1>\n\t",
+ __FUNCTION__, (unsigned long) (base + (*rel->sym_ptr_ptr)->value));
#endif
bfd_put_32 (abfd, base + (*rel->sym_ptr_ptr)->value, temp);
if (bfd_bwrite (temp, (bfd_size_type) 4, abfd) != 4)
@@ -330,8 +332,8 @@ nlm_sparc_write_export (bfd * abfd, asymbol * sym, bfd_vma value)
bfd_byte temp[4];
#ifdef DEBUG
- fprintf (stderr, "%s: <%x, %d, %s>\n",
- __FUNCTION__, value, strlen (sym->name), sym->name);
+ fprintf (stderr, "%s: <%lx, %u, %s>\n",
+ __FUNCTION__, (unsigned long) value, strlen (sym->name), sym->name);
#endif
bfd_put_32 (abfd, value, temp);
len = strlen (sym->name);
diff --git a/bfd/nlmcode.h b/bfd/nlmcode.h
index 4773061138fa..d4a0d983b981 100644
--- a/bfd/nlmcode.h
+++ b/bfd/nlmcode.h
@@ -1,6 +1,6 @@
/* NLM (NetWare Loadable Module) executable support for BFD.
Copyright 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005 Free Software Foundation, Inc.
+ 2005, 2006, 2007 Free Software Foundation, Inc.
Written by Fred Fish @ Cygnus Support, using ELF support as the
template.
@@ -21,8 +21,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "libnlm.h"
@@ -138,14 +138,13 @@ add_bfd_section (bfd *abfd,
{
asection *newsect;
- newsect = bfd_make_section (abfd, name);
+ newsect = bfd_make_section_with_flags (abfd, name, flags);
if (newsect == NULL)
return FALSE;
newsect->vma = 0; /* NLM's are relocatable. */
newsect->size = size;
newsect->filepos = offset;
- newsect->flags = flags;
newsect->alignment_power = bfd_log2 ((bfd_vma) 0); /* FIXME */
return TRUE;
@@ -175,7 +174,7 @@ nlm_swap_auxiliary_headers_in (bfd *abfd)
return FALSE;
if (bfd_seek (abfd, position, SEEK_SET) != 0)
return FALSE;
- if (strncmp (tempstr, "VeRsIoN#", 8) == 0)
+ if (CONST_STRNEQ (tempstr, "VeRsIoN#"))
{
Nlm_External_Version_Header thdr;
@@ -197,7 +196,7 @@ nlm_swap_auxiliary_headers_in (bfd *abfd)
nlm_version_header (abfd)->day =
get_word (abfd, (bfd_byte *) thdr.day);
}
- else if (strncmp (tempstr, "MeSsAgEs", 8) == 0)
+ else if (CONST_STRNEQ (tempstr, "MeSsAgEs"))
{
Nlm_External_Extended_Header thdr;
@@ -265,7 +264,7 @@ nlm_swap_auxiliary_headers_in (bfd *abfd)
nlm_extended_header (abfd)->reserved5 =
get_word (abfd, (bfd_byte *) thdr.reserved5);
}
- else if (strncmp (tempstr, "CoPyRiGhT=", 10) == 0)
+ else if (CONST_STRNEQ (tempstr, "CoPyRiGhT="))
{
amt = sizeof (nlm_copyright_header (abfd)->stamp);
if (bfd_bread ((void *) nlm_copyright_header (abfd)->stamp,
@@ -281,7 +280,7 @@ nlm_swap_auxiliary_headers_in (bfd *abfd)
amt, abfd) != amt)
return FALSE;
}
- else if (strncmp (tempstr, "CuStHeAd", 8) == 0)
+ else if (CONST_STRNEQ (tempstr, "CuStHeAd"))
{
Nlm_External_Custom_Header thdr;
bfd_size_type hdrLength;
@@ -346,7 +345,7 @@ nlm_swap_auxiliary_headers_in (bfd *abfd)
/* If we have found a Cygnus header, process it. Otherwise,
just save the associated data without trying to interpret
it. */
- if (strncmp (dataStamp, "CyGnUsEx", 8) == 0)
+ if (CONST_STRNEQ (dataStamp, "CyGnUsEx"))
{
file_ptr pos;
bfd_byte *contents;
@@ -365,7 +364,7 @@ nlm_swap_auxiliary_headers_in (bfd *abfd)
if (bfd_seek (abfd, pos, SEEK_SET) != 0)
return FALSE;
- memcpy (nlm_cygnus_ext_header (abfd), "CyGnUsEx", 8);
+ LITMEMCPY (nlm_cygnus_ext_header (abfd), "CyGnUsEx");
nlm_cygnus_ext_header (abfd)->offset = dataOffset;
nlm_cygnus_ext_header (abfd)->length = dataLength;
@@ -646,7 +645,7 @@ nlm_swap_auxiliary_headers_out (bfd *abfd)
{
Nlm_External_Version_Header thdr;
- memcpy (thdr.stamp, "VeRsIoN#", 8);
+ LITMEMCPY (thdr.stamp, "VeRsIoN#");
put_word (abfd, (bfd_vma) nlm_version_header (abfd)->majorVersion,
(bfd_byte *) thdr.majorVersion);
put_word (abfd, (bfd_vma) nlm_version_header (abfd)->minorVersion,
@@ -673,7 +672,7 @@ nlm_swap_auxiliary_headers_out (bfd *abfd)
{
Nlm_External_Copyright_Header thdr;
- memcpy (thdr.stamp, "CoPyRiGhT=", 10);
+ LITMEMCPY (thdr.stamp, "CoPyRiGhT=");
amt = sizeof (thdr.stamp);
if (bfd_bwrite ((void *) thdr.stamp, amt, abfd) != amt)
return FALSE;
@@ -695,7 +694,7 @@ nlm_swap_auxiliary_headers_out (bfd *abfd)
{
Nlm_External_Extended_Header thdr;
- memcpy (thdr.stamp, "MeSsAgEs", 8);
+ LITMEMCPY (thdr.stamp, "MeSsAgEs");
put_word (abfd,
(bfd_vma) nlm_extended_header (abfd)->languageID,
(bfd_byte *) thdr.languageID);
@@ -798,7 +797,7 @@ nlm_swap_auxiliary_headers_out (bfd *abfd)
ds = find_nonzero (nlm_custom_header (abfd)->dataStamp,
sizeof (nlm_custom_header (abfd)->dataStamp));
- memcpy (thdr.stamp, "CuStHeAd", 8);
+ LITMEMCPY (thdr.stamp, "CuStHeAd");
hdrLength = (2 * NLM_TARGET_LONG_SIZE + (ds ? 8 : 0)
+ nlm_custom_header (abfd)->hdrLength);
put_word (abfd, hdrLength, thdr.length);
@@ -832,14 +831,14 @@ nlm_swap_auxiliary_headers_out (bfd *abfd)
{
Nlm_External_Custom_Header thdr;
- memcpy (thdr.stamp, "CuStHeAd", 8);
+ LITMEMCPY (thdr.stamp, "CuStHeAd");
put_word (abfd, (bfd_vma) 2 * NLM_TARGET_LONG_SIZE + 8,
(bfd_byte *) thdr.length);
put_word (abfd, (bfd_vma) nlm_cygnus_ext_header (abfd)->offset,
(bfd_byte *) thdr.dataOffset);
put_word (abfd, (bfd_vma) nlm_cygnus_ext_header (abfd)->length,
(bfd_byte *) thdr.dataLength);
- memcpy (thdr.dataStamp, "CyGnUsEx", 8);
+ LITMEMCPY (thdr.dataStamp, "CyGnUsEx");
amt = sizeof (thdr);
if (bfd_bwrite ((void *) &thdr, amt, abfd) != amt)
return FALSE;
diff --git a/bfd/oasys.c b/bfd/oasys.c
index 74d2c310a037..972455d877d9 100644
--- a/bfd/oasys.c
+++ b/bfd/oasys.c
@@ -1,6 +1,6 @@
/* BFD back-end for oasys objects.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2001,
- 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support, <sac@cygnus.com>.
This file is part of BFD, the Binary File Descriptor library.
@@ -20,8 +20,8 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#define UNDERSCORE_HACK 1
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "safe-ctype.h"
#include "libbfd.h"
#include "oasys.h"
@@ -685,9 +685,13 @@ oasys_print_symbol (bfd *abfd, void * afile, asymbol *symbol, bfd_print_symbol_t
static bfd_boolean
oasys_new_section_hook (bfd *abfd, asection *newsect)
{
- newsect->used_by_bfd = bfd_alloc (abfd, (bfd_size_type) sizeof (oasys_per_section_type));
if (!newsect->used_by_bfd)
- return FALSE;
+ {
+ newsect->used_by_bfd
+ = bfd_alloc (abfd, (bfd_size_type) sizeof (oasys_per_section_type));
+ if (!newsect->used_by_bfd)
+ return FALSE;
+ }
oasys_per_section (newsect)->data = NULL;
oasys_per_section (newsect)->section = newsect;
oasys_per_section (newsect)->offset = 0;
@@ -697,7 +701,7 @@ oasys_new_section_hook (bfd *abfd, asection *newsect)
/* Turn the section string into an index. */
sscanf (newsect->name, "%u", &newsect->target_index);
- return TRUE;
+ return _bfd_generic_new_section_hook (abfd, newsect);
}
@@ -1160,7 +1164,8 @@ oasys_generic_stat_arch_elt (bfd *abfd, struct stat *buf)
}
static int
-oasys_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean exec ATTRIBUTE_UNUSED)
+oasys_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
return 0;
}
@@ -1182,6 +1187,7 @@ oasys_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean exec ATTRIBUTE_UNU
#define oasys_read_minisymbols _bfd_generic_read_minisymbols
#define oasys_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
#define oasys_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
+#define oasys_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup
#define oasys_set_arch_mach bfd_default_set_arch_mach
#define oasys_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
#define oasys_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
diff --git a/bfd/opncls.c b/bfd/opncls.c
index b02b137889a1..4457a797cf4e 100644
--- a/bfd/opncls.c
+++ b/bfd/opncls.c
@@ -1,6 +1,6 @@
/* opncls.c -- open and close a BFD.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
- 2001, 2002, 2003, 2004, 2005, 2006
+ 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -21,8 +21,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "objalloc.h"
#include "libbfd.h"
#include "libiberty.h"
@@ -115,11 +115,35 @@ _bfd_new_bfd_contained_in (bfd *obfd)
void
_bfd_delete_bfd (bfd *abfd)
{
- bfd_hash_table_free (&abfd->section_htab);
- objalloc_free ((struct objalloc *) abfd->memory);
+ if (abfd->memory)
+ {
+ bfd_hash_table_free (&abfd->section_htab);
+ objalloc_free ((struct objalloc *) abfd->memory);
+ }
free (abfd);
}
+/* Free objalloc memory. */
+
+bfd_boolean
+_bfd_free_cached_info (bfd *abfd)
+{
+ if (abfd->memory)
+ {
+ bfd_hash_table_free (&abfd->section_htab);
+ objalloc_free ((struct objalloc *) abfd->memory);
+
+ abfd->sections = NULL;
+ abfd->section_last = NULL;
+ abfd->outsymbols = NULL;
+ abfd->tdata.any = NULL;
+ abfd->usrdata = NULL;
+ abfd->memory = NULL;
+ }
+
+ return TRUE;
+}
+
/*
SECTION
Opening and closing BFDs
@@ -360,7 +384,10 @@ SYNOPSIS
file_ptr nbytes,
file_ptr offset),
int (*close) (struct bfd *nbfd,
- void *stream));
+ void *stream),
+ int (*stat) (struct bfd *abfd,
+ void *stream,
+ struct stat *sb));
DESCRIPTION
@@ -387,6 +414,10 @@ DESCRIPTION
<<bfd_close>>. @var{close} either succeeds returning 0, or
fails returning -1 (setting <<bfd_error>>).
+ Calls @var{stat} to fill in a stat structure for bfd_stat,
+ bfd_get_size, and bfd_get_mtime calls. @var{stat} returns 0
+ on success, or returns -1 on failure (setting <<bfd_error>>).
+
If <<bfd_openr_iovec>> returns <<NULL>> then an error has
occurred. Possible errors are <<bfd_error_no_memory>>,
<<bfd_error_invalid_target>> and <<bfd_error_system_call>>.
@@ -399,6 +430,7 @@ struct opncls
file_ptr (*pread) (struct bfd *abfd, void *stream, void *buf,
file_ptr nbytes, file_ptr offset);
int (*close) (struct bfd *abfd, void *stream);
+ int (*stat) (struct bfd *abfd, void *stream, struct stat *sb);
file_ptr where;
};
@@ -461,10 +493,15 @@ opncls_bflush (struct bfd *abfd ATTRIBUTE_UNUSED)
}
static int
-opncls_bstat (struct bfd *abfd ATTRIBUTE_UNUSED, struct stat *sb)
+opncls_bstat (struct bfd *abfd, struct stat *sb)
{
+ struct opncls *vec = abfd->iostream;
+
memset (sb, 0, sizeof (*sb));
- return 0;
+ if (vec->stat == NULL)
+ return 0;
+
+ return (vec->stat) (abfd, vec->stream, sb);
}
static const struct bfd_iovec opncls_iovec = {
@@ -483,7 +520,10 @@ bfd_openr_iovec (const char *filename, const char *target,
file_ptr nbytes,
file_ptr offset),
int (*close) (struct bfd *nbfd,
- void *stream))
+ void *stream),
+ int (*stat) (struct bfd *abfd,
+ void *stream,
+ struct stat *sb))
{
bfd *nbfd;
const bfd_target *target_vec;
@@ -515,6 +555,7 @@ bfd_openr_iovec (const char *filename, const char *target,
vec->stream = stream;
vec->pread = pread;
vec->close = close;
+ vec->stat = stat;
nbfd->iovec = &opncls_iovec;
nbfd->iostream = vec;
@@ -1321,6 +1362,7 @@ bfd_create_gnu_debuglink_section (bfd *abfd, const char *filename)
{
asection *sect;
bfd_size_type debuglink_size;
+ flagword flags;
if (abfd == NULL || filename == NULL)
{
@@ -1339,16 +1381,11 @@ bfd_create_gnu_debuglink_section (bfd *abfd, const char *filename)
return NULL;
}
- sect = bfd_make_section (abfd, GNU_DEBUGLINK);
+ flags = SEC_HAS_CONTENTS | SEC_READONLY | SEC_DEBUGGING;
+ sect = bfd_make_section_with_flags (abfd, GNU_DEBUGLINK, flags);
if (sect == NULL)
return NULL;
- if (! bfd_set_section_flags (abfd, sect,
- SEC_HAS_CONTENTS | SEC_READONLY | SEC_DEBUGGING))
- /* XXX Should we delete the section from the bfd ? */
- return NULL;
-
-
debuglink_size = strlen (filename) + 1;
debuglink_size += 3;
debuglink_size &= ~3;
diff --git a/bfd/osf-core.c b/bfd/osf-core.c
index cc6c4dccd002..b9472abe3904 100644
--- a/bfd/osf-core.c
+++ b/bfd/osf-core.c
@@ -1,6 +1,6 @@
/* BFD back-end for OSF/1 core files.
- Copyright 1993, 1994, 1995, 1998, 1999, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1998, 1999, 2001, 2002, 2003, 2004, 2006,
+ 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -21,8 +21,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
/* This file can only be compiled on systems which use OSF/1 style
core files. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include <sys/user.h>
@@ -67,11 +67,10 @@ make_bfd_asection (abfd, name, flags, size, vma, filepos)
{
asection *asect;
- asect = bfd_make_section_anyway (abfd, name);
+ asect = bfd_make_section_anyway_with_flags (abfd, name, flags);
if (!asect)
return NULL;
- asect->flags = flags;
asect->size = size;
asect->vma = vma;
asect->filepos = filepos;
@@ -95,7 +94,7 @@ osf_core_core_file_p (abfd)
if (val != sizeof core_header)
return NULL;
- if (strncmp (core_header.magic, "Core", 4) != 0)
+ if (! CONST_STRNEQ (core_header.magic, "Core"))
return NULL;
core_hdr (abfd) = (struct osf_core_struct *)
diff --git a/bfd/pc532-mach.c b/bfd/pc532-mach.c
index 70ca8613cc3d..6dc1de13a596 100644
--- a/bfd/pc532-mach.c
+++ b/bfd/pc532-mach.c
@@ -1,5 +1,5 @@
/* BFD back-end for Mach3/532 a.out-ish binaries.
- Copyright 1990, 1991, 1992, 1994, 1995, 2000, 2001, 2002
+ Copyright 1990, 1991, 1992, 1994, 1995, 2000, 2001, 2002, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -60,8 +60,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
#define TARGETNAME "a.out-pc532-mach"
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libaout.h"
#include "libbfd.h"
#include "aout/aout64.h"
diff --git a/bfd/pdp11.c b/bfd/pdp11.c
index 37f960f1992a..c3fbb41df0ec 100644
--- a/bfd/pdp11.c
+++ b/bfd/pdp11.c
@@ -1,5 +1,5 @@
/* BFD back-end for PDP-11 a.out binaries.
- Copyright 2001, 2002, 2003, 2004, 2005, 2006
+ Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -70,6 +70,7 @@
&& ((x).a_info != A_MAGIC5) \
&& ((x).a_info != A_MAGIC6))
+#include "sysdep.h"
#include "bfd.h"
#define external_exec pdp11_external_exec
@@ -123,7 +124,6 @@ struct pdp11_external_nlist
#define WRITE_HEADERS(abfd, execp) pdp11_aout_write_headers (abfd, execp)
-#include "sysdep.h"
#include "libbfd.h"
#include "libaout.h"
@@ -277,6 +277,22 @@ NAME (aout, reloc_type_lookup) (bfd * abfd ATTRIBUTE_UNUSED,
}
}
+reloc_howto_type *
+NAME (aout, reloc_name_lookup) (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (howto_table_pdp11) / sizeof (howto_table_pdp11[0]);
+ i++)
+ if (howto_table_pdp11[i].name != NULL
+ && strcasecmp (howto_table_pdp11[i].name, r_name) == 0)
+ return &howto_table_pdp11[i];
+
+ return NULL;
+}
+
static int
pdp11_aout_write_headers (bfd *abfd, struct internal_exec *execp)
{
@@ -1111,32 +1127,27 @@ NAME (aout, new_section_hook) (bfd *abfd, asection *newsect)
if (bfd_get_format (abfd) == bfd_object)
{
if (obj_textsec (abfd) == NULL
- && ! strcmp (newsect->name, ".text"))
+ && !strcmp (newsect->name, ".text"))
{
obj_textsec(abfd)= newsect;
newsect->target_index = N_TEXT;
- return TRUE;
}
-
- if (obj_datasec (abfd) == NULL
- && ! strcmp (newsect->name, ".data"))
- {
- obj_datasec (abfd) = newsect;
- newsect->target_index = N_DATA;
- return TRUE;
- }
-
- if (obj_bsssec (abfd) == NULL
- && !strcmp (newsect->name, ".bss"))
- {
- obj_bsssec (abfd) = newsect;
- newsect->target_index = N_BSS;
- return TRUE;
- }
- }
+ else if (obj_datasec (abfd) == NULL
+ && !strcmp (newsect->name, ".data"))
+ {
+ obj_datasec (abfd) = newsect;
+ newsect->target_index = N_DATA;
+ }
+ else if (obj_bsssec (abfd) == NULL
+ && !strcmp (newsect->name, ".bss"))
+ {
+ obj_bsssec (abfd) = newsect;
+ newsect->target_index = N_BSS;
+ }
+ }
/* We allow more than three sections internally. */
- return TRUE;
+ return _bfd_generic_new_section_hook (abfd, newsect);
}
bfd_boolean
@@ -2376,7 +2387,8 @@ NAME (aout, find_nearest_line) (bfd *abfd,
}
int
-NAME (aout, sizeof_headers) (bfd *abfd, bfd_boolean execable ATTRIBUTE_UNUSED)
+NAME (aout, sizeof_headers) (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
return adata (abfd).exec_bytes_size;
}
diff --git a/bfd/pe-arm-wince.c b/bfd/pe-arm-wince.c
new file mode 100644
index 000000000000..a13594fd8949
--- /dev/null
+++ b/bfd/pe-arm-wince.c
@@ -0,0 +1,37 @@
+/* BFD back-end for ARM WINCE PE files.
+ Copyright 2006 Free Software Foundation, Inc.
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define TARGET_UNDERSCORE 0
+#define USER_LABEL_PREFIX ""
+
+#define TARGET_LITTLE_SYM arm_wince_pe_little_vec
+#define TARGET_LITTLE_NAME "pe-arm-wince-little"
+#define TARGET_BIG_SYM arm_wince_pe_big_vec
+#define TARGET_BIG_NAME "pe-arm-wince-big"
+
+#define bfd_arm_allocate_interworking_sections \
+ bfd_arm_wince_pe_allocate_interworking_sections
+#define bfd_arm_get_bfd_for_interworking \
+ bfd_arm_wince_pe_get_bfd_for_interworking
+#define bfd_arm_process_before_allocation \
+ bfd_arm_wince_pe_process_before_allocation
+
+#define LOCAL_LABEL_PREFIX "."
+
+#include "pe-arm.c"
diff --git a/bfd/pe-arm.c b/bfd/pe-arm.c
index dba9c1b40e48..5700e2382a80 100644
--- a/bfd/pe-arm.c
+++ b/bfd/pe-arm.c
@@ -1,5 +1,6 @@
/* BFD back-end for ARM PECOFF files.
- Copyright 1995, 1996, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1995, 1996, 1999, 2000, 2001, 2002, 2007
+ Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,8 +18,19 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
+/* Do this before including bfd.h, so we prototype the right functions. */
+
+#ifndef bfd_arm_allocate_interworking_sections
+#define bfd_arm_allocate_interworking_sections \
+ bfd_armpe_allocate_interworking_sections
+#define bfd_arm_get_bfd_for_interworking \
+ bfd_armpe_get_bfd_for_interworking
+#define bfd_arm_process_before_allocation \
+ bfd_armpe_process_before_allocation
+#endif
+
#include "sysdep.h"
+#include "bfd.h"
#ifndef TARGET_LITTLE_SYM
#define TARGET_LITTLE_SYM armpe_little_vec
@@ -31,17 +43,22 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
#define PCRELOFFSET TRUE
#define COFF_LONG_SECTION_NAMES
-#ifndef bfd_arm_allocate_interworking_sections
-#define bfd_arm_allocate_interworking_sections \
- bfd_arm_pe_allocate_interworking_sections
-#define bfd_arm_get_bfd_for_interworking \
- bfd_arm_pe_get_bfd_for_interworking
-#define bfd_arm_process_before_allocation \
- bfd_arm_pe_process_before_allocation
-#endif
-
-#ifdef ARM_WINCE
-#define TARGET_UNDERSCORE 0
-#endif
+#define COFF_SECTION_ALIGNMENT_ENTRIES \
+{ COFF_SECTION_NAME_EXACT_MATCH (".bss"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".data"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".rdata"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".text"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".idata"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".pdata"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".debug"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }, \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi."), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }
#include "coff-arm.c"
diff --git a/bfd/pe-i386.c b/bfd/pe-i386.c
index 7c102b42de84..72aacf0a8936 100644
--- a/bfd/pe-i386.c
+++ b/bfd/pe-i386.c
@@ -1,5 +1,6 @@
/* BFD back-end for Intel 386 PECOFF files.
- Copyright 1995, 1996, 1999, 2001, 2002, 2004 Free Software Foundation, Inc.
+ Copyright 1995, 1996, 1999, 2001, 2002, 2004, 2007
+ Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,8 +18,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#define TARGET_SYM i386pe_vec
#define TARGET_NAME "pe-i386"
@@ -34,10 +35,16 @@
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
{ COFF_SECTION_NAME_EXACT_MATCH (".data"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".data$"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
{ COFF_SECTION_NAME_EXACT_MATCH (".rdata"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".rdata$"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
{ COFF_SECTION_NAME_EXACT_MATCH (".text"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".text$"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
{ COFF_SECTION_NAME_PARTIAL_MATCH (".idata"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
{ COFF_SECTION_NAME_EXACT_MATCH (".pdata"), \
diff --git a/bfd/pe-mcore.c b/bfd/pe-mcore.c
index 1f8a41460740..4dcf0765c542 100644
--- a/bfd/pe-mcore.c
+++ b/bfd/pe-mcore.c
@@ -1,5 +1,5 @@
/* BFD back-end for MCore PECOFF files.
- Copyright 1999, 2002 Free Software Foundation, Inc.
+ Copyright 1999, 2002, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#ifndef TARGET_BIG_SYM
#define TARGET_BIG_SYM mcore_pe_big_vec
diff --git a/bfd/pe-mips.c b/bfd/pe-mips.c
index 03d6beca981c..628cecf9a71b 100644
--- a/bfd/pe-mips.c
+++ b/bfd/pe-mips.c
@@ -1,6 +1,6 @@
/* BFD back-end for MIPS PE COFF files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ 2000, 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
Modified from coff-i386.c by DJ Delorie, dj@cygnus.com
This file is part of BFD, the Binary File Descriptor library.
@@ -23,8 +23,8 @@
#define COFF_LONG_SECTION_NAMES
#define PCRELOFFSET TRUE
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "coff/mipspe.h"
#include "coff/internal.h"
@@ -453,6 +453,7 @@ coff_mips_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
#define coff_rtype_to_howto coff_mips_rtype_to_howto
#define coff_bfd_reloc_type_lookup coff_mips_reloc_type_lookup
+#define coff_bfd_reloc_name_lookup coff_mips_reloc_name_lookup
/* Get the howto structure for a generic reloc type. */
@@ -496,6 +497,22 @@ coff_mips_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return & howto_table [mips_type];
}
+static reloc_howto_type *
+coff_mips_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (howto_table) / sizeof (howto_table[0]);
+ i++)
+ if (howto_table[i].name != NULL
+ && strcasecmp (howto_table[i].name, r_name) == 0)
+ return &howto_table[i];
+
+ return NULL;
+}
+
static void
mips_swap_reloc_in (bfd * abfd, void * src, void * dst)
{
diff --git a/bfd/pe-ppc.c b/bfd/pe-ppc.c
index 93cf6367c6e7..fa6404e4a34c 100644
--- a/bfd/pe-ppc.c
+++ b/bfd/pe-ppc.c
@@ -1,5 +1,5 @@
/* BFD back-end for PowerPC PECOFF files.
- Copyright 1995, 1996, 1999, 2001 Free Software Foundation, Inc.
+ Copyright 1995, 1996, 1999, 2001, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@ along with this program; if not, write to the Free Software
Foundation, 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#define E_FILENMLEN 18
diff --git a/bfd/pe-sh.c b/bfd/pe-sh.c
index c0f81933b4df..d8f61b7d3163 100644
--- a/bfd/pe-sh.c
+++ b/bfd/pe-sh.c
@@ -1,5 +1,5 @@
/* BFD back-end for SH PECOFF files.
- Copyright 1995, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1995, 2000, 2001, 2002, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#define TARGET_SHL_SYM shlpe_vec
#define TARGET_SHL_NAME "pe-shl"
diff --git a/bfd/pe-x86_64.c b/bfd/pe-x86_64.c
new file mode 100644
index 000000000000..0c6badf1a36b
--- /dev/null
+++ b/bfd/pe-x86_64.c
@@ -0,0 +1,53 @@
+/* BFD back-end for Intel/AMD x86_64 PECOFF files.
+ Copyright 2006, 2007 Free Software Foundation, Inc.
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+
+ Written by Kai Tietz, OneVision Software GmbH&CoKg. */
+
+#include "sysdep.h"
+#include "bfd.h"
+
+#define TARGET_SYM x86_64pe_vec
+#define TARGET_NAME "pe-x86-64"
+#define COFF_WITH_PE
+#define COFF_WITH_pex64
+#define PCRELOFFSET TRUE
+#define TARGET_UNDERSCORE '_'
+#define COFF_LONG_SECTION_NAMES
+#define COFF_SUPPORT_GNU_LINKONCE
+#define COFF_LONG_FILENAMES
+
+#define COFF_SECTION_ALIGNMENT_ENTRIES \
+{ COFF_SECTION_NAME_EXACT_MATCH (".bss"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".data"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".rdata"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".text"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".idata"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".pdata"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".debug"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }, \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi."), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }
+
+#include "coff-x86_64.c"
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index 71300219d303..f96825f687e8 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -1,6 +1,6 @@
/* Support for the generic parts of PE/PEI; the common executable parts.
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006 Free Software Foundation, Inc.
+ 2005, 2006, 2007 Free Software Foundation, Inc.
Written by Cygnus Solutions.
This file is part of BFD, the Binary File Descriptor library.
@@ -52,12 +52,12 @@
on this code has a chance of getting something accomplished without
wasting too much time. */
-/* This expands into COFF_WITH_pe or COFF_WITH_pep depending on whether
- we're compiling for straight PE or PE+. */
+/* This expands into COFF_WITH_pe, COFF_WITH_pep, or COFF_WITH_pex64
+ depending on whether we're compiling for straight PE or PE+. */
#define COFF_WITH_XX
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "coff/internal.h"
@@ -67,7 +67,9 @@
within PE/PEI, so we get them from there. FIXME: The lack of
variance is an assumption which may prove to be incorrect if new
PE/PEI targets are created. */
-#ifdef COFF_WITH_pep
+#if defined COFF_WITH_pex64
+# include "coff/x86_64.h"
+#elif defined COFF_WITH_pep
# include "coff/ia64.h"
#else
# include "coff/i386.h"
@@ -77,7 +79,7 @@
#include "libcoff.h"
#include "libpei.h"
-#ifdef COFF_WITH_pep
+#if defined COFF_WITH_pep || defined COFF_WITH_pex64
# undef AOUTSZ
# define AOUTSZ PEPAOUTSZ
# define PEAOUTHDR PEPAOUTHDR
@@ -147,6 +149,7 @@ _bfd_XXi_swap_sym_in (bfd * abfd, void * ext1, void * in1)
int unused_section_number = 0;
asection *sec;
char *name;
+ flagword flags;
for (sec = abfd->sections; sec; sec = sec->next)
if (unused_section_number <= sec->target_index)
@@ -156,7 +159,8 @@ _bfd_XXi_swap_sym_in (bfd * abfd, void * ext1, void * in1)
if (name == NULL)
return;
strcpy (name, in->n_name);
- sec = bfd_make_section_anyway (abfd, name);
+ flags = SEC_HAS_CONTENTS | SEC_ALLOC | SEC_DATA | SEC_LOAD;
+ sec = bfd_make_section_anyway_with_flags (abfd, name, flags);
sec->vma = 0;
sec->lma = 0;
@@ -169,7 +173,6 @@ _bfd_XXi_swap_sym_in (bfd * abfd, void * ext1, void * in1)
sec->userdata = NULL;
sec->next = NULL;
sec->alignment_power = 2;
- sec->flags = SEC_HAS_CONTENTS | SEC_ALLOC | SEC_DATA | SEC_LOAD;
sec->target_index = unused_section_number;
@@ -385,10 +388,11 @@ _bfd_XXi_swap_aouthdr_in (bfd * abfd,
void * aouthdr_ext1,
void * aouthdr_int1)
{
- struct internal_extra_pe_aouthdr *a;
- PEAOUTHDR * src = (PEAOUTHDR *) (aouthdr_ext1);
+ PEAOUTHDR * src = (PEAOUTHDR *) aouthdr_ext1;
AOUTHDR * aouthdr_ext = (AOUTHDR *) aouthdr_ext1;
- struct internal_aouthdr *aouthdr_int = (struct internal_aouthdr *)aouthdr_int1;
+ struct internal_aouthdr *aouthdr_int
+ = (struct internal_aouthdr *) aouthdr_int1;
+ struct internal_extra_pe_aouthdr *a = &aouthdr_int->pe;
aouthdr_int->magic = H_GET_16 (abfd, aouthdr_ext->magic);
aouthdr_int->vstamp = H_GET_16 (abfd, aouthdr_ext->vstamp);
@@ -398,13 +402,21 @@ _bfd_XXi_swap_aouthdr_in (bfd * abfd,
aouthdr_int->entry = GET_AOUTHDR_ENTRY (abfd, aouthdr_ext->entry);
aouthdr_int->text_start =
GET_AOUTHDR_TEXT_START (abfd, aouthdr_ext->text_start);
-#ifndef COFF_WITH_pep
+#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
/* PE32+ does not have data_start member! */
aouthdr_int->data_start =
GET_AOUTHDR_DATA_START (abfd, aouthdr_ext->data_start);
+ a->BaseOfData = aouthdr_int->data_start;
#endif
- a = &aouthdr_int->pe;
+ a->Magic = aouthdr_int->magic;
+ a->MajorLinkerVersion = H_GET_8 (abfd, aouthdr_ext->vstamp);
+ a->MinorLinkerVersion = H_GET_8 (abfd, aouthdr_ext->vstamp + 1);
+ a->SizeOfCode = aouthdr_int->tsize ;
+ a->SizeOfInitializedData = aouthdr_int->dsize ;
+ a->SizeOfUninitializedData = aouthdr_int->bsize ;
+ a->AddressOfEntryPoint = aouthdr_int->entry;
+ a->BaseOfCode = aouthdr_int->text_start;
a->ImageBase = GET_OPTHDR_IMAGE_BASE (abfd, src->ImageBase);
a->SectionAlignment = H_GET_32 (abfd, src->SectionAlignment);
a->FileAlignment = H_GET_32 (abfd, src->FileAlignment);
@@ -441,6 +453,7 @@ _bfd_XXi_swap_aouthdr_in (bfd * abfd,
/* If data directory is empty, rva also should be 0. */
int size =
H_GET_32 (abfd, src->DataDirectory[idx][1]);
+
a->DataDirectory[idx].Size = size;
if (size)
@@ -454,7 +467,7 @@ _bfd_XXi_swap_aouthdr_in (bfd * abfd,
if (aouthdr_int->entry)
{
aouthdr_int->entry += a->ImageBase;
-#ifndef COFF_WITH_pep
+#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
aouthdr_int->entry &= 0xffffffff;
#endif
}
@@ -462,12 +475,12 @@ _bfd_XXi_swap_aouthdr_in (bfd * abfd,
if (aouthdr_int->tsize)
{
aouthdr_int->text_start += a->ImageBase;
-#ifndef COFF_WITH_pep
+#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
aouthdr_int->text_start &= 0xffffffff;
#endif
}
-#ifndef COFF_WITH_pep
+#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
/* PE32+ does not have data_start member! */
if (aouthdr_int->dsize)
{
@@ -480,9 +493,9 @@ _bfd_XXi_swap_aouthdr_in (bfd * abfd,
/* These three fields are normally set up by ppc_relocate_section.
In the case of reading a file in, we can pick them up from the
DataDirectory. */
- first_thunk_address = a->DataDirectory[12].VirtualAddress;
- thunk_size = a->DataDirectory[12].Size;
- import_table_size = a->DataDirectory[1].Size;
+ first_thunk_address = a->DataDirectory[PE_IMPORT_ADDRESS_TABLE].VirtualAddress;
+ thunk_size = a->DataDirectory[PE_IMPORT_ADDRESS_TABLE].Size;
+ import_table_size = a->DataDirectory[PE_IMPORT_TABLE].Size;
#endif
}
@@ -540,14 +553,14 @@ _bfd_XXi_swap_aouthdr_out (bfd * abfd, void * in, void * out)
fa = extra->FileAlignment;
ib = extra->ImageBase;
- idata2 = pe->pe_opthdr.DataDirectory[1];
- idata5 = pe->pe_opthdr.DataDirectory[12];
- tls = pe->pe_opthdr.DataDirectory[9];
+ idata2 = pe->pe_opthdr.DataDirectory[PE_IMPORT_TABLE];
+ idata5 = pe->pe_opthdr.DataDirectory[PE_IMPORT_ADDRESS_TABLE];
+ tls = pe->pe_opthdr.DataDirectory[PE_TLS_TABLE];
if (aouthdr_in->tsize)
{
aouthdr_in->text_start -= ib;
-#ifndef COFF_WITH_pep
+#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
aouthdr_in->text_start &= 0xffffffff;
#endif
}
@@ -555,7 +568,7 @@ _bfd_XXi_swap_aouthdr_out (bfd * abfd, void * in, void * out)
if (aouthdr_in->dsize)
{
aouthdr_in->data_start -= ib;
-#ifndef COFF_WITH_pep
+#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
aouthdr_in->data_start &= 0xffffffff;
#endif
}
@@ -563,7 +576,7 @@ _bfd_XXi_swap_aouthdr_out (bfd * abfd, void * in, void * out)
if (aouthdr_in->entry)
{
aouthdr_in->entry -= ib;
-#ifndef COFF_WITH_pep
+#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
aouthdr_in->entry &= 0xffffffff;
#endif
}
@@ -592,11 +605,11 @@ _bfd_XXi_swap_aouthdr_out (bfd * abfd, void * in, void * out)
So - we copy the input values into the output values, and then, if
a final link is going to be performed, it can overwrite them. */
- extra->DataDirectory[1] = idata2;
- extra->DataDirectory[12] = idata5;
- extra->DataDirectory[9] = tls;
+ extra->DataDirectory[PE_IMPORT_TABLE] = idata2;
+ extra->DataDirectory[PE_IMPORT_ADDRESS_TABLE] = idata5;
+ extra->DataDirectory[PE_TLS_TABLE] = tls;
- if (extra->DataDirectory[1].VirtualAddress == 0)
+ if (extra->DataDirectory[PE_IMPORT_TABLE].VirtualAddress == 0)
/* Until other .idata fixes are made (pending patch), the entry for
.idata is needed for backwards compatibility. FIXME. */
add_data_entry (abfd, extra, 1, ".idata", ib);
@@ -632,16 +645,22 @@ _bfd_XXi_swap_aouthdr_out (bfd * abfd, void * in, void * out)
in the virt_size field). Files have been seen (from MSVC
5.0 link.exe) where the file size of the .data segment is
quite small compared to the virtual size. Without this
- fix, strip munges the file. */
+ fix, strip munges the file.
+
+ FIXME: We need to handle holes between sections, which may
+ happpen when we covert from another format. We just use
+ the virtual address and virtual size of the last section
+ for the image size. */
if (coff_section_data (abfd, sec) != NULL
&& pei_section_data (abfd, sec) != NULL)
- isize += SA (FA (pei_section_data (abfd, sec)->virt_size));
+ isize = (sec->vma - extra->ImageBase
+ + SA (FA (pei_section_data (abfd, sec)->virt_size)));
}
aouthdr_in->dsize = dsize;
aouthdr_in->tsize = tsize;
extra->SizeOfHeaders = hsize;
- extra->SizeOfImage = SA (hsize) + isize;
+ extra->SizeOfImage = isize;
}
H_PUT_16 (abfd, aouthdr_in->magic, aouthdr_out->standard.magic);
@@ -660,7 +679,7 @@ _bfd_XXi_swap_aouthdr_out (bfd * abfd, void * in, void * out)
PUT_AOUTHDR_TEXT_START (abfd, aouthdr_in->text_start,
aouthdr_out->standard.text_start);
-#ifndef COFF_WITH_pep
+#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
/* PE32+ does not have data_start member! */
PUT_AOUTHDR_DATA_START (abfd, aouthdr_in->data_start,
aouthdr_out->standard.data_start);
@@ -1017,7 +1036,7 @@ static char * dir_names[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] =
N_("Bound Import Directory"),
N_("Import Address Table Directory"),
N_("Delay Import Directory"),
- N_("Reserved"),
+ N_("CLR Runtime Header"),
N_("Reserved")
};
@@ -1051,9 +1070,9 @@ pe_print_idata (bfd * abfd, void * vfile)
bfd_vma addr;
- addr = extra->DataDirectory[1].VirtualAddress;
+ addr = extra->DataDirectory[PE_IMPORT_TABLE].VirtualAddress;
- if (addr == 0 && extra->DataDirectory[1].Size == 0)
+ if (addr == 0 && extra->DataDirectory[PE_IMPORT_TABLE].Size == 0)
{
/* Maybe the extra header isn't there. Look for the section. */
section = bfd_get_section_by_name (abfd, ".idata");
@@ -1171,7 +1190,7 @@ pe_print_idata (bfd * abfd, void * vfile)
bfd_size_type j;
char *dll;
- /* Print (i + extra->DataDirectory[1].VirtualAddress). */
+ /* Print (i + extra->DataDirectory[PE_IMPORT_TABLE].VirtualAddress). */
fprintf (file, " %08lx\t", (unsigned long) (i + adj + dataoff));
hint_addr = bfd_get_32 (abfd, data + i + dataoff);
time_stamp = bfd_get_32 (abfd, data + i + 4 + dataoff);
@@ -1212,8 +1231,8 @@ pe_print_idata (bfd * abfd, void * vfile)
ft_data = data;
ft_idx = first_thunk - adj;
ft_allocated = 0;
-
- if (first_thunk != hint_addr)
+
+ if (first_thunk != hint_addr)
{
/* Find the section which contains the first thunk. */
for (ft_section = abfd->sections;
@@ -1261,6 +1280,38 @@ pe_print_idata (bfd * abfd, void * vfile)
}
/* Print HintName vector entries. */
+#ifdef COFF_WITH_pex64
+ for (j = 0; j < datasize; j += 8)
+ {
+ unsigned long member = bfd_get_32 (abfd, data + idx + j);
+ unsigned long member_high = bfd_get_32 (abfd, data + idx + j + 4);
+
+ if (!member && !member_high)
+ break;
+
+ if (member_high & 0x80000000)
+ fprintf (file, "\t%lx%08lx\t %4lx%08lx <none>",
+ member_high,member, member_high & 0x7fffffff, member);
+ else
+ {
+ int ordinal;
+ char *member_name;
+
+ ordinal = bfd_get_16 (abfd, data + member - adj);
+ member_name = (char *) data + member - adj + 2;
+ fprintf (file, "\t%04lx\t %4d %s",member, ordinal, member_name);
+ }
+
+ /* If the time stamp is not zero, the import address
+ table holds actual addresses. */
+ if (time_stamp != 0
+ && first_thunk != 0
+ && first_thunk != hint_addr)
+ fprintf (file, "\t%04lx",
+ (long) bfd_get_32 (abfd, ft_data + ft_idx + j));
+ fprintf (file, "\n");
+ }
+#else
for (j = 0; j < datasize; j += 4)
{
unsigned long member = bfd_get_32 (abfd, data + idx + j);
@@ -1293,7 +1344,7 @@ pe_print_idata (bfd * abfd, void * vfile)
fprintf (file, "\n");
}
-
+#endif
if (ft_allocated)
free (ft_data);
}
@@ -1336,9 +1387,9 @@ pe_print_edata (bfd * abfd, void * vfile)
bfd_vma addr;
- addr = extra->DataDirectory[0].VirtualAddress;
+ addr = extra->DataDirectory[PE_EXPORT_TABLE].VirtualAddress;
- if (addr == 0 && extra->DataDirectory[0].Size == 0)
+ if (addr == 0 && extra->DataDirectory[PE_EXPORT_TABLE].Size == 0)
{
/* Maybe the extra header isn't there. Look for the section. */
section = bfd_get_section_by_name (abfd, ".edata");
@@ -1367,7 +1418,7 @@ pe_print_edata (bfd * abfd, void * vfile)
}
dataoff = addr - section->vma;
- datasize = extra->DataDirectory[0].Size;
+ datasize = extra->DataDirectory[PE_EXPORT_TABLE].Size;
if (datasize > section->size - dataoff)
{
fprintf (file,
@@ -1533,10 +1584,10 @@ pe_print_edata (bfd * abfd, void * vfile)
static bfd_boolean
pe_print_pdata (bfd * abfd, void * vfile)
{
-#ifdef COFF_WITH_pep
-# define PDATA_ROW_SIZE (3*8)
+#if defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
+# define PDATA_ROW_SIZE (3 * 8)
#else
-# define PDATA_ROW_SIZE (5*4)
+# define PDATA_ROW_SIZE (5 * 4)
#endif
FILE *file = (FILE *) vfile;
bfd_byte *data = 0;
@@ -1559,7 +1610,7 @@ pe_print_pdata (bfd * abfd, void * vfile)
fprintf (file,
_("\nThe Function Table (interpreted .pdata section contents)\n"));
-#ifdef COFF_WITH_pep
+#if defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
fprintf (file,
_(" vma:\t\t\tBegin Address End Address Unwind Info\n"));
#else
@@ -1613,7 +1664,7 @@ pe_print_pdata (bfd * abfd, void * vfile)
fprintf_vma (file, begin_addr); fputc (' ', file);
fprintf_vma (file, end_addr); fputc (' ', file);
fprintf_vma (file, eh_handler);
-#ifndef COFF_WITH_pep
+#if !defined(COFF_WITH_pep) || defined(COFF_WITH_pex64)
fputc (' ', file);
fprintf_vma (file, eh_data); fputc (' ', file);
fprintf_vma (file, prolog_end_addr);
@@ -1766,6 +1817,7 @@ _bfd_XX_print_private_bfd_data_common (bfd * abfd, void * vfile)
pe_data_type *pe = pe_data (abfd);
struct internal_extra_pe_aouthdr *i = &pe->pe_opthdr;
const char *subsystem_name = NULL;
+ const char *name;
/* The MS dumpbin program reportedly ands with 0xff0f before
printing the characteristics field. Not sure why. No reason to
@@ -1791,6 +1843,52 @@ _bfd_XX_print_private_bfd_data_common (bfd * abfd, void * vfile)
time_t t = pe->coff.timestamp;
fprintf (file, "\nTime/Date\t\t%s", ctime (&t));
}
+
+#ifndef IMAGE_NT_OPTIONAL_HDR_MAGIC
+# define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b
+#endif
+#ifndef IMAGE_NT_OPTIONAL_HDR64_MAGIC
+# define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
+#endif
+#ifndef IMAGE_NT_OPTIONAL_HDRROM_MAGIC
+# define IMAGE_NT_OPTIONAL_HDRROM_MAGIC 0x107
+#endif
+
+ switch (i->Magic)
+ {
+ case IMAGE_NT_OPTIONAL_HDR_MAGIC:
+ name = "PE32";
+ break;
+ case IMAGE_NT_OPTIONAL_HDR64_MAGIC:
+ name = "PE32+";
+ break;
+ case IMAGE_NT_OPTIONAL_HDRROM_MAGIC:
+ name = "ROM";
+ break;
+ default:
+ name = NULL;
+ break;
+ }
+ fprintf (file, "Magic\t\t\t%04x", i->Magic);
+ if (name)
+ fprintf (file, "\t(%s)",name);
+ fprintf (file, "\nMajorLinkerVersion\t%d\n", i->MajorLinkerVersion);
+ fprintf (file, "MinorLinkerVersion\t%d\n", i->MinorLinkerVersion);
+ fprintf (file, "SizeOfCode\t\t%08lx\n", i->SizeOfCode);
+ fprintf (file, "SizeOfInitializedData\t%08lx\n",
+ i->SizeOfInitializedData);
+ fprintf (file, "SizeOfUninitializedData\t%08lx\n",
+ i->SizeOfUninitializedData);
+ fprintf (file, "AddressOfEntryPoint\t");
+ fprintf_vma (file, i->AddressOfEntryPoint);
+ fprintf (file, "\nBaseOfCode\t\t");
+ fprintf_vma (file, i->BaseOfCode);
+#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
+ /* PE32+ does not have BaseOfData member! */
+ fprintf (file, "\nBaseOfData\t\t");
+ fprintf_vma (file, i->BaseOfData);
+#endif
+
fprintf (file, "\nImageBase\t\t");
fprintf_vma (file, i->ImageBase);
fprintf (file, "\nSectionAlignment\t");
@@ -1837,6 +1935,16 @@ _bfd_XX_print_private_bfd_data_common (bfd * abfd, void * vfile)
case IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER:
subsystem_name = "EFI runtime driver";
break;
+ // These are from revision 8.0 of the MS PE/COFF spec
+ case IMAGE_SUBSYSTEM_EFI_ROM:
+ subsystem_name = "EFI ROM";
+ break;
+ case IMAGE_SUBSYSTEM_XBOX:
+ subsystem_name = "XBOX";
+ break;
+ // Added default case for clarity - subsystem_name is NULL anyway.
+ default:
+ subsystem_name = NULL;
}
fprintf (file, "Subsystem\t\t%08x", i->Subsystem);
@@ -1889,8 +1997,8 @@ _bfd_XX_bfd_copy_private_bfd_data_common (bfd * ibfd, bfd * obfd)
if we don't remove this entry as well. */
if (! pe_data (obfd)->has_reloc_section)
{
- pe_data (obfd)->pe_opthdr.DataDirectory[5].VirtualAddress = 0;
- pe_data (obfd)->pe_opthdr.DataDirectory[5].Size = 0;
+ pe_data (obfd)->pe_opthdr.DataDirectory[PE_BASE_RELOCATION_TABLE].VirtualAddress = 0;
+ pe_data (obfd)->pe_opthdr.DataDirectory[PE_BASE_RELOCATION_TABLE].Size = 0;
}
return TRUE;
}
@@ -1949,6 +2057,7 @@ _bfd_XXi_final_link_postscript (bfd * abfd, struct coff_final_link_info *pfinfo)
{
struct coff_link_hash_entry *h1;
struct bfd_link_info *info = pfinfo->info;
+ bfd_boolean result = TRUE;
/* There are a few fields that need to be filled in now while we
have symbol table access.
@@ -1962,49 +2071,103 @@ _bfd_XXi_final_link_postscript (bfd * abfd, struct coff_final_link_info *pfinfo)
".idata$2", FALSE, FALSE, TRUE);
if (h1 != NULL)
{
- pe_data (abfd)->pe_opthdr.DataDirectory[1].VirtualAddress =
- (h1->root.u.def.value
- + h1->root.u.def.section->output_section->vma
- + h1->root.u.def.section->output_offset);
+ /* PR ld/2729: We cannot rely upon all the output sections having been
+ created properly, so check before referencing them. Issue a warning
+ message for any sections tht could not be found. */
+ if (h1->root.u.def.section != NULL
+ && h1->root.u.def.section->output_section != NULL)
+ pe_data (abfd)->pe_opthdr.DataDirectory[PE_IMPORT_TABLE].VirtualAddress =
+ (h1->root.u.def.value
+ + h1->root.u.def.section->output_section->vma
+ + h1->root.u.def.section->output_offset);
+ else
+ {
+ _bfd_error_handler
+ (_("%B: unable to fill in DataDictionary[1] because .idata$2 is missing"),
+ abfd);
+ result = FALSE;
+ }
+
h1 = coff_link_hash_lookup (coff_hash_table (info),
".idata$4", FALSE, FALSE, TRUE);
- pe_data (abfd)->pe_opthdr.DataDirectory[1].Size =
- ((h1->root.u.def.value
- + h1->root.u.def.section->output_section->vma
- + h1->root.u.def.section->output_offset)
- - pe_data (abfd)->pe_opthdr.DataDirectory[1].VirtualAddress);
+ if (h1 != NULL
+ && h1->root.u.def.section != NULL
+ && h1->root.u.def.section->output_section != NULL)
+ pe_data (abfd)->pe_opthdr.DataDirectory[PE_IMPORT_TABLE].Size =
+ ((h1->root.u.def.value
+ + h1->root.u.def.section->output_section->vma
+ + h1->root.u.def.section->output_offset)
+ - pe_data (abfd)->pe_opthdr.DataDirectory[PE_IMPORT_TABLE].VirtualAddress);
+ else
+ {
+ _bfd_error_handler
+ (_("%B: unable to fill in DataDictionary[1] because .idata$4 is missing"),
+ abfd);
+ result = FALSE;
+ }
/* The import address table. This is the size/address of
.idata$5. */
h1 = coff_link_hash_lookup (coff_hash_table (info),
".idata$5", FALSE, FALSE, TRUE);
- pe_data (abfd)->pe_opthdr.DataDirectory[12].VirtualAddress =
- (h1->root.u.def.value
- + h1->root.u.def.section->output_section->vma
- + h1->root.u.def.section->output_offset);
+ if (h1 != NULL
+ && h1->root.u.def.section != NULL
+ && h1->root.u.def.section->output_section != NULL)
+ pe_data (abfd)->pe_opthdr.DataDirectory[PE_IMPORT_ADDRESS_TABLE].VirtualAddress =
+ (h1->root.u.def.value
+ + h1->root.u.def.section->output_section->vma
+ + h1->root.u.def.section->output_offset);
+ else
+ {
+ _bfd_error_handler
+ (_("%B: unable to fill in DataDictionary[12] because .idata$5 is missing"),
+ abfd);
+ result = FALSE;
+ }
+
h1 = coff_link_hash_lookup (coff_hash_table (info),
".idata$6", FALSE, FALSE, TRUE);
- pe_data (abfd)->pe_opthdr.DataDirectory[12].Size =
- ((h1->root.u.def.value
- + h1->root.u.def.section->output_section->vma
- + h1->root.u.def.section->output_offset)
- - pe_data (abfd)->pe_opthdr.DataDirectory[12].VirtualAddress);
+ if (h1 != NULL
+ && h1->root.u.def.section != NULL
+ && h1->root.u.def.section->output_section != NULL)
+ pe_data (abfd)->pe_opthdr.DataDirectory[PE_IMPORT_ADDRESS_TABLE].Size =
+ ((h1->root.u.def.value
+ + h1->root.u.def.section->output_section->vma
+ + h1->root.u.def.section->output_offset)
+ - pe_data (abfd)->pe_opthdr.DataDirectory[PE_IMPORT_ADDRESS_TABLE].VirtualAddress);
+ else
+ {
+ _bfd_error_handler
+ (_("%B: unable to fill in DataDictionary[PE_IMPORT_ADDRESS_TABLE (12)] because .idata$6 is missing"),
+ abfd);
+ result = FALSE;
+ }
}
h1 = coff_link_hash_lookup (coff_hash_table (info),
"__tls_used", FALSE, FALSE, TRUE);
if (h1 != NULL)
{
- pe_data (abfd)->pe_opthdr.DataDirectory[9].VirtualAddress =
- (h1->root.u.def.value
- + h1->root.u.def.section->output_section->vma
- + h1->root.u.def.section->output_offset
- - pe_data (abfd)->pe_opthdr.ImageBase);
- pe_data (abfd)->pe_opthdr.DataDirectory[9].Size = 0x18;
+ if (h1->root.u.def.section != NULL
+ && h1->root.u.def.section->output_section != NULL)
+ pe_data (abfd)->pe_opthdr.DataDirectory[PE_TLS_TABLE].VirtualAddress =
+ (h1->root.u.def.value
+ + h1->root.u.def.section->output_section->vma
+ + h1->root.u.def.section->output_offset
+ - pe_data (abfd)->pe_opthdr.ImageBase);
+ else
+ {
+ _bfd_error_handler
+ (_("%B: unable to fill in DataDictionary[9] because __tls_used is missing"),
+ abfd);
+ result = FALSE;
+ }
+
+ pe_data (abfd)->pe_opthdr.DataDirectory[PE_TLS_TABLE].Size = 0x18;
}
/* If we couldn't find idata$2, we either have an excessively
trivial program or are in DEEP trouble; we have to assume trivial
program.... */
- return TRUE;
+ return result;
}
diff --git a/bfd/pef.c b/bfd/pef.c
index 2aca6a445b76..fc345e955bcd 100644
--- a/bfd/pef.c
+++ b/bfd/pef.c
@@ -1,5 +1,5 @@
/* PEF support for BFD.
- Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,11 +18,11 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+#include "sysdep.h"
#include "safe-ctype.h"
#include "pef.h"
#include "pef-traceback.h"
#include "bfd.h"
-#include "sysdep.h"
#include "libbfd.h"
#include "libiberty.h"
@@ -41,9 +41,6 @@
#define bfd_pef_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
#define bfd_pef_read_minisymbols _bfd_generic_read_minisymbols
#define bfd_pef_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
-#define bfd_pef_get_reloc_upper_bound _bfd_norelocs_get_reloc_upper_bound
-#define bfd_pef_canonicalize_reloc _bfd_norelocs_canonicalize_reloc
-#define bfd_pef_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
#define bfd_pef_set_arch_mach _bfd_generic_set_arch_mach
#define bfd_pef_get_section_contents _bfd_generic_get_section_contents
#define bfd_pef_set_section_contents _bfd_generic_set_section_contents
@@ -209,7 +206,7 @@ bfd_pef_print_symbol (bfd *abfd,
default:
bfd_print_symbol_vandf (abfd, (void *) file, symbol);
fprintf (file, " %-5s %s", symbol->section->name, symbol->name);
- if (strncmp (symbol->name, "__traceback_", strlen ("__traceback_")) == 0)
+ if (CONST_STRNEQ (symbol->name, "__traceback_"))
{
unsigned char *buf = alloca (symbol->udata.i);
size_t offset = symbol->value + 4;
@@ -987,11 +984,7 @@ bfd_pef_canonicalize_symtab (bfd *abfd, asymbol **alocation)
return ret;
}
-static asymbol *
-bfd_pef_make_empty_symbol (bfd *abfd)
-{
- return bfd_alloc (abfd, sizeof (asymbol));
-}
+#define bfd_pef_make_empty_symbol _bfd_generic_make_empty_symbol
static void
bfd_pef_get_symbol_info (bfd *abfd ATTRIBUTE_UNUSED,
@@ -1002,7 +995,8 @@ bfd_pef_get_symbol_info (bfd *abfd ATTRIBUTE_UNUSED,
}
static int
-bfd_pef_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean exec ATTRIBUTE_UNUSED)
+bfd_pef_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
return 0;
}
@@ -1051,7 +1045,7 @@ const bfd_target pef_vec =
BFD_JUMP_TABLE_CORE (_bfd_nocore),
BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
BFD_JUMP_TABLE_SYMBOLS (bfd_pef),
- BFD_JUMP_TABLE_RELOCS (bfd_pef),
+ BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
BFD_JUMP_TABLE_WRITE (bfd_pef),
BFD_JUMP_TABLE_LINK (bfd_pef),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
diff --git a/bfd/pei-arm-wince.c b/bfd/pei-arm-wince.c
new file mode 100644
index 000000000000..7d5a3be3515b
--- /dev/null
+++ b/bfd/pei-arm-wince.c
@@ -0,0 +1,30 @@
+/* BFD back-end for ARM WINCE PE IMAGE COFF files.
+ Copyright 2006 Free Software Foundation, Inc.
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define TARGET_UNDERSCORE 0
+#define USER_LABEL_PREFIX ""
+
+#define TARGET_LITTLE_SYM arm_wince_pei_little_vec
+#define TARGET_LITTLE_NAME "pei-arm-wince-little"
+#define TARGET_BIG_SYM arm_wince_pei_big_vec
+#define TARGET_BIG_NAME "pei-arm-wince-big"
+
+#define LOCAL_LABEL_PREFIX "."
+
+#include "pei-arm.c"
diff --git a/bfd/pei-arm.c b/bfd/pei-arm.c
index 38d3367cef6b..299eda20ad8d 100644
--- a/bfd/pei-arm.c
+++ b/bfd/pei-arm.c
@@ -1,5 +1,5 @@
/* BFD back-end for arm PE IMAGE COFF files.
- Copyright 1995, 1996, 1999, 2002 Free Software Foundation, Inc.
+ Copyright 1995, 1996, 1999, 2002, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#ifndef TARGET_LITTLE_SYM
#define TARGET_LITTLE_SYM armpei_little_vec
@@ -32,4 +32,22 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
#define PCRELOFFSET TRUE
#define COFF_LONG_SECTION_NAMES
+#define COFF_SECTION_ALIGNMENT_ENTRIES \
+{ COFF_SECTION_NAME_EXACT_MATCH (".bss"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".data"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".rdata"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".text"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".idata"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".pdata"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".debug"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }, \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi."), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }
+
#include "coff-arm.c"
diff --git a/bfd/pei-i386.c b/bfd/pei-i386.c
index 38e36f3689d3..9892f1c09763 100644
--- a/bfd/pei-i386.c
+++ b/bfd/pei-i386.c
@@ -1,5 +1,6 @@
/* BFD back-end for Intel 386 PE IMAGE COFF files.
- Copyright 1995, 1996, 1999, 2002, 2004 Free Software Foundation, Inc.
+ Copyright 1995, 1996, 1999, 2002, 2004, 2007
+ Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,8 +18,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#define TARGET_SYM i386pei_vec
#define TARGET_NAME "pei-i386"
@@ -35,10 +36,16 @@
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
{ COFF_SECTION_NAME_EXACT_MATCH (".data"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".data$"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
{ COFF_SECTION_NAME_EXACT_MATCH (".rdata"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".rdata$"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
{ COFF_SECTION_NAME_EXACT_MATCH (".text"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".text$"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
{ COFF_SECTION_NAME_PARTIAL_MATCH (".idata"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
{ COFF_SECTION_NAME_EXACT_MATCH (".pdata"), \
diff --git a/bfd/pei-mcore.c b/bfd/pei-mcore.c
index e71bc11cf6bb..a78f0633910c 100644
--- a/bfd/pei-mcore.c
+++ b/bfd/pei-mcore.c
@@ -1,5 +1,5 @@
/* BFD back-end for MCore PECOFF files.
- Copyright 1999, 2002 Free Software Foundation, Inc.
+ Copyright 1999, 2002, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#ifndef TARGET_BIG_SYM
#define TARGET_BIG_SYM mcore_pei_big_vec
diff --git a/bfd/pei-mips.c b/bfd/pei-mips.c
index 0c9b962f2b6d..4405c0af217a 100644
--- a/bfd/pei-mips.c
+++ b/bfd/pei-mips.c
@@ -1,5 +1,5 @@
/* BFD back-end for MIPS PE IMAGE COFF files.
- Copyright 1995, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1995, 2000, 2001, 2002, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#define TARGET_SYM mipslpei_vec
#define TARGET_NAME "pei-mips"
diff --git a/bfd/pei-ppc.c b/bfd/pei-ppc.c
index 58d65e285d0e..0f572f0c0890 100644
--- a/bfd/pei-ppc.c
+++ b/bfd/pei-ppc.c
@@ -1,5 +1,5 @@
/* BFD back-end for PowerPC PE IMAGE COFF files.
- Copyright 1995, 1996, 1999 Free Software Foundation, Inc.
+ Copyright 1995, 1996, 1999, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,8 +18,8 @@ along with this program; if not, write to the Free Software
Foundation, 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
/* setting up for a PE environment stolen directly from the i386 structure */
#define E_FILNMLEN 18 /* # characters in a file name */
diff --git a/bfd/pei-sh.c b/bfd/pei-sh.c
index 61a3ed06eb67..acbea9ae36d5 100644
--- a/bfd/pei-sh.c
+++ b/bfd/pei-sh.c
@@ -1,5 +1,5 @@
/* BFD back-end for SH PE IMAGE COFF files.
- Copyright 1995, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1995, 2000, 2001, 2002, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#define TARGET_SHL_SYM shlpei_vec
#define TARGET_SHL_NAME "pei-shl"
diff --git a/bfd/pei-x86_64.c b/bfd/pei-x86_64.c
new file mode 100644
index 000000000000..37d9c7f2e54e
--- /dev/null
+++ b/bfd/pei-x86_64.c
@@ -0,0 +1,54 @@
+/* BFD back-end for Intel 386 PE IMAGE COFF files.
+ Copyright 2006, 2007 Free Software Foundation, Inc.
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+
+ Written by Kai Tietz, OneVision Software GmbH&CoKg. */
+
+#include "sysdep.h"
+#include "bfd.h"
+
+#define TARGET_SYM x86_64pei_vec
+#define TARGET_NAME "pei-x86-64"
+#define COFF_IMAGE_WITH_PE
+#define COFF_WITH_PE
+#define COFF_WITH_pex64
+#define PCRELOFFSET TRUE
+#define TARGET_UNDERSCORE '_'
+#define COFF_LONG_SECTION_NAMES
+#define COFF_SUPPORT_GNU_LINKONCE
+#define COFF_LONG_FILENAMES
+
+#define COFF_SECTION_ALIGNMENT_ENTRIES \
+{ COFF_SECTION_NAME_EXACT_MATCH (".bss"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".data"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".rdata"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".text"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".idata"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".pdata"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".debug"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }, \
+{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi."), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }
+
+#include "coff-x86_64.c"
diff --git a/bfd/peicode.h b/bfd/peicode.h
index 2061f415af61..0f4858f4bfbc 100644
--- a/bfd/peicode.h
+++ b/bfd/peicode.h
@@ -1,6 +1,6 @@
/* Support for the generic parts of PE/PEI, for BFD.
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005 Free Software Foundation, Inc.
+ 2005, 2006 Free Software Foundation, Inc.
Written by Cygnus Solutions.
This file is part of BFD, the Binary File Descriptor library.
@@ -182,6 +182,10 @@ coff_swap_filehdr_in (bfd * abfd, void * src, void * dst)
#ifdef COFF_IMAGE_WITH_PE
# define coff_swap_filehdr_out _bfd_XXi_only_swap_filehdr_out
+#elif defined COFF_WITH_pex64
+# define coff_swap_filehdr_out _bfd_pex64_only_swap_filehdr_out
+#elif defined COFF_WITH_pep
+# define coff_swap_filehdr_out _bfd_pep_only_swap_filehdr_out
#else
# define coff_swap_filehdr_out _bfd_pe_only_swap_filehdr_out
#endif
@@ -217,7 +221,10 @@ coff_swap_scnhdr_in (bfd * abfd, void * ext, void * in)
if (scnhdr_int->s_vaddr != 0)
{
scnhdr_int->s_vaddr += pe_data (abfd)->pe_opthdr.ImageBase;
+ /* Do not cut upper 32-bits for 64-bit vma. */
+#ifndef COFF_WITH_pex64
scnhdr_int->s_vaddr &= 0xffffffff;
+#endif
}
#ifndef COFF_NO_HACK_SCNHDR_SIZE
@@ -405,8 +412,16 @@ pe_bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
+ NUM_ILF_SECTIONS * 9 \
+ STRING_SIZE_SIZE)
#define SIZEOF_IDATA2 (5 * 4)
+
+/* For PEx64 idata4 & 5 have thumb size of 8 bytes. */
+#ifdef COFF_WITH_pex64
+#define SIZEOF_IDATA4 (2 * 4)
+#define SIZEOF_IDATA5 (2 * 4)
+#else
#define SIZEOF_IDATA4 (1 * 4)
#define SIZEOF_IDATA5 (1 * 4)
+#endif
+
#define SIZEOF_IDATA6 (2 + strlen (symbol_name) + 1 + 1)
#define SIZEOF_IDATA7 (strlen (source_dll) + 1 + 1)
#define SIZEOF_ILF_SECTIONS (NUM_ILF_SECTIONS * sizeof (struct coff_section_tdata))
@@ -656,9 +671,20 @@ static jump_table jtab[] =
},
#endif
+#ifdef AMD64MAGIC
+ { AMD64MAGIC,
+ { 0xff, 0x25, 0x00, 0x00, 0x00, 0x00, 0x90, 0x90 },
+ 8, 2
+ },
+#endif
+
#ifdef MC68MAGIC
- { MC68MAGIC, { /* XXX fill me in */ }, 0, 0 },
+ { MC68MAGIC,
+ { /* XXX fill me in */ },
+ 0, 0
+ },
#endif
+
#ifdef MIPS_ARCH_MAGIC_WINCE
{ MIPS_ARCH_MAGIC_WINCE,
{ 0x00, 0x00, 0x08, 0x3c, 0x00, 0x00, 0x08, 0x8d,
@@ -830,8 +856,15 @@ pe_ILF_build_a_bfd (bfd * abfd,
/* XXX - treat as IMPORT_NAME ??? */
abort ();
+#ifdef COFF_WITH_pex64
+ ((unsigned int *) id4->contents)[0] = ordinal;
+ ((unsigned int *) id4->contents)[1] = 0x80000000;
+ ((unsigned int *) id5->contents)[0] = ordinal;
+ ((unsigned int *) id5->contents)[1] = 0x80000000;
+#else
* (unsigned int *) id4->contents = ordinal | 0x80000000;
* (unsigned int *) id5->contents = ordinal | 0x80000000;
+#endif
}
else
{
@@ -1071,6 +1104,12 @@ pe_ILF_object_p (bfd * abfd)
#endif
break;
+ case IMAGE_FILE_MACHINE_AMD64:
+#ifdef AMD64MAGIC
+ magic = AMD64MAGIC;
+#endif
+ break;
+
case IMAGE_FILE_MACHINE_M68K:
#ifdef MC68AGIC
magic = MC68MAGIC;
@@ -1195,6 +1234,25 @@ pe_ILF_object_p (bfd * abfd)
return abfd->xvec;
}
+enum arch_type
+{
+ arch_type_unknown,
+ arch_type_i386,
+ arch_type_x86_64
+};
+
+static enum arch_type
+pe_arch (const char *arch)
+{
+ if (strcmp (arch, "i386") == 0 || strcmp (arch, "ia32") == 0)
+ return arch_type_i386;
+
+ if (strcmp (arch, "x86_64") == 0 || strcmp (arch, "x86-64") == 0)
+ return arch_type_x86_64;
+
+ return arch_type_unknown;
+}
+
static const bfd_target *
pe_bfd_object_p (bfd * abfd)
{
@@ -1202,6 +1260,7 @@ pe_bfd_object_p (bfd * abfd)
struct external_PEI_DOS_hdr dos_hdr;
struct external_PEI_IMAGE_hdr image_hdr;
file_ptr offset;
+ const bfd_target *target;
/* Detect if this a Microsoft Import Library Format element. */
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
@@ -1266,7 +1325,60 @@ pe_bfd_object_p (bfd * abfd)
return NULL;
}
- return coff_object_p (abfd);
+ target = coff_object_p (abfd);
+ if (target)
+ {
+ pe_data_type *pe = pe_data (abfd);
+ struct internal_extra_pe_aouthdr *i = &pe->pe_opthdr;
+ bfd_boolean efi = i->Subsystem == IMAGE_SUBSYSTEM_EFI_APPLICATION;
+ enum arch_type arch;
+ const bfd_target * const *target_ptr;
+
+ /* Get the machine. */
+ if (bfd_target_efi_p (abfd->xvec))
+ arch = pe_arch (bfd_target_efi_arch (abfd->xvec));
+ else
+ arch = pe_arch (bfd_target_pei_arch (abfd->xvec));
+
+ for (target_ptr = bfd_target_vector; *target_ptr != NULL;
+ target_ptr++)
+ {
+ if (*target_ptr == target
+ || (*target_ptr)->flavour != bfd_target_coff_flavour)
+ continue;
+
+ if (bfd_target_efi_p (*target_ptr))
+ {
+ /* Skip incompatible arch. */
+ if (pe_arch (bfd_target_efi_arch (*target_ptr)) != arch)
+ continue;
+
+ if (efi)
+ {
+ /* TARGET_PTR is an EFI backend. Don't match
+ TARGET with a EFI file. */
+ bfd_set_error (bfd_error_wrong_format);
+ return NULL;
+ }
+ }
+ else if (bfd_target_pei_p (*target_ptr))
+ {
+ /* Skip incompatible arch. */
+ if (pe_arch (bfd_target_pei_arch (*target_ptr)) != arch)
+ continue;
+
+ if (!efi)
+ {
+ /* TARGET_PTR is a PE backend. Don't match
+ TARGET with a PE file. */
+ bfd_set_error (bfd_error_wrong_format);
+ return NULL;
+ }
+ }
+ }
+ }
+
+ return target;
}
#define coff_object_p pe_bfd_object_p
diff --git a/bfd/po/BLD-POTFILES.in b/bfd/po/BLD-POTFILES.in
index 2dbe723a50ef..07ad4b3602f9 100644
--- a/bfd/po/BLD-POTFILES.in
+++ b/bfd/po/BLD-POTFILES.in
@@ -5,4 +5,5 @@ elf64-ia64.c
elf64-target.h
peigen.c
pepigen.c
+pex64igen.c
targmatch.h
diff --git a/bfd/po/Make-in b/bfd/po/Make-in
index f11ccb41cef0..1a619929557a 100644
--- a/bfd/po/Make-in
+++ b/bfd/po/Make-in
@@ -16,6 +16,7 @@ SHELL = /bin/sh
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
+top_builddir = @top_builddir@
prefix = @prefix@
exec_prefix = @exec_prefix@
@@ -78,7 +79,7 @@ INSTOBJEXT = @INSTOBJEXT@
$(MSGFMT) -o $@ $<
.po.gmo:
- file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
+ file=`echo $* | sed 's,.*/,,'`.gmo \
&& rm -f $$file && $(GMSGFMT) -o $$file $<
.po.cat:
diff --git a/bfd/po/SRC-POTFILES.in b/bfd/po/SRC-POTFILES.in
index 8bcf979a5bfb..5a3d361747ce 100644
--- a/bfd/po/SRC-POTFILES.in
+++ b/bfd/po/SRC-POTFILES.in
@@ -57,6 +57,7 @@ coff-tic80.c
coff-u68k.c
coff-w65.c
coff-we32k.c
+coff-x86_64.c
coff-z80.c
coff-z8k.c
corefile.c
@@ -65,6 +66,7 @@ cpu-arc.c
cpu-arm.c
cpu-avr.c
cpu-bfin.c
+cpu-cr16.c
cpu-cr16c.c
cpu-cris.c
cpu-crx.c
@@ -93,6 +95,7 @@ cpu-m68k.c
cpu-m88k.c
cpu-maxq.c
cpu-mcore.c
+cpu-mep.c
cpu-mips.c
cpu-mmix.c
cpu-msp430.c
@@ -105,8 +108,10 @@ cpu-pj.c
cpu-powerpc.c
cpu-rs6000.c
cpu-s390.c
+cpu-score.c
cpu-sh.c
cpu-sparc.c
+cpu-spu.c
cpu-tic30.c
cpu-tic4x.c
cpu-tic54x.c
@@ -128,12 +133,14 @@ ecofflink.c
ecoffswap.h
efi-app-ia32.c
efi-app-ia64.c
+efi-app-x86_64.c
elf32-am33lin.c
elf32-arc.c
elf32-arm.c
elf32-avr.c
elf32-bfin.c
elf32.c
+elf32-cr16.c
elf32-cr16c.c
elf32-cris.c
elf32-crx.c
@@ -160,6 +167,7 @@ elf32-m68hc1x.c
elf32-m68k.c
elf32-m88k.c
elf32-mcore.c
+elf32-mep.c
elf32-mips.c
elf32-msp430.c
elf32-mt.c
@@ -168,11 +176,13 @@ elf32-or32.c
elf32-pj.c
elf32-ppc.c
elf32-s390.c
+elf32-score.c
elf32-sh64.c
elf32-sh64-com.c
elf32-sh.c
elf32-sh-symbian.c
elf32-sparc.c
+elf32-spu.c
elf32-v850.c
elf32-vax.c
elf32-xc16x.c
@@ -190,6 +200,7 @@ elf64-s390.c
elf64-sh64.c
elf64-sparc.c
elf64-x86-64.c
+elf-attrs.c
elf-bfd.h
elf.c
elfcode.h
@@ -271,21 +282,25 @@ osf-core.c
pc532-mach.c
pdp11.c
pe-arm.c
+pe-arm-wince.c
pef.c
pef.h
pef-traceback.h
pe-i386.c
pei-arm.c
+pei-arm-wince.c
peicode.h
pei-i386.c
pei-mcore.c
pei-mips.c
pei-ppc.c
pei-sh.c
+pei-x86_64.c
pe-mcore.c
pe-mips.c
pe-ppc.c
pe-sh.c
+pe-x86_64.c
ppcboot.c
reloc16.c
reloc.c
diff --git a/bfd/po/bfd.pot b/bfd/po/bfd.pot
index 37c57290aeeb..a01ee37160a8 100644
--- a/bfd/po/bfd.pot
+++ b/bfd/po/bfd.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2005-10-25 22:24+0930\n"
+"POT-Creation-Date: 2007-07-02 16:16+0930\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -33,153 +33,162 @@ msgstr ""
msgid "%B: Bad relocation record imported: %d"
msgstr ""
-#: aoutx.h:1244 aoutx.h:1578
+#: aoutx.h:1267 aoutx.h:1601
#, c-format
msgid "%s: can not represent section `%s' in a.out object file format"
msgstr ""
-#: aoutx.h:1544
+#: aoutx.h:1567
#, c-format
msgid ""
"%s: can not represent section for symbol `%s' in a.out object file format"
msgstr ""
-#: aoutx.h:1546
+#: aoutx.h:1569
msgid "*unknown*"
msgstr ""
-#: aoutx.h:5281
+#: aoutx.h:5311
#, c-format
msgid "%s: relocatable link from %s to %s not supported"
msgstr ""
-#: archive.c:1760
+#: archive.c:1764
msgid "Warning: writing archive was slow: rewriting timestamp\n"
msgstr ""
-#: archive.c:2019
+#: archive.c:2027
msgid "Reading archive file mod timestamp"
msgstr ""
-#: archive.c:2043
+#: archive.c:2051
msgid "Writing updated armap timestamp"
msgstr ""
-#: bfd.c:279
+#: bfd.c:288
msgid "No error"
msgstr ""
-#: bfd.c:280
+#: bfd.c:289
msgid "System call error"
msgstr ""
-#: bfd.c:281
+#: bfd.c:290
msgid "Invalid bfd target"
msgstr ""
-#: bfd.c:282
+#: bfd.c:291
msgid "File in wrong format"
msgstr ""
-#: bfd.c:283
+#: bfd.c:292
msgid "Archive object file in wrong format"
msgstr ""
-#: bfd.c:284
+#: bfd.c:293
msgid "Invalid operation"
msgstr ""
-#: bfd.c:285
+#: bfd.c:294
msgid "Memory exhausted"
msgstr ""
-#: bfd.c:286
+#: bfd.c:295
msgid "No symbols"
msgstr ""
-#: bfd.c:287
+#: bfd.c:296
msgid "Archive has no index; run ranlib to add one"
msgstr ""
-#: bfd.c:288
+#: bfd.c:297
msgid "No more archived files"
msgstr ""
-#: bfd.c:289
+#: bfd.c:298
msgid "Malformed archive"
msgstr ""
-#: bfd.c:290
+#: bfd.c:299
msgid "File format not recognized"
msgstr ""
-#: bfd.c:291
+#: bfd.c:300
msgid "File format is ambiguous"
msgstr ""
-#: bfd.c:292
+#: bfd.c:301
msgid "Section has no contents"
msgstr ""
-#: bfd.c:293
+#: bfd.c:302
msgid "Nonrepresentable section on output"
msgstr ""
-#: bfd.c:294
+#: bfd.c:303
msgid "Symbol needs debug section which does not exist"
msgstr ""
-#: bfd.c:295
+#: bfd.c:304
msgid "Bad value"
msgstr ""
-#: bfd.c:296
+#: bfd.c:305
msgid "File truncated"
msgstr ""
-#: bfd.c:297
+#: bfd.c:306
msgid "File too big"
msgstr ""
-#: bfd.c:298
+#: bfd.c:307
+#, c-format
+msgid "Error reading %s: %s"
+msgstr ""
+
+#: bfd.c:308
msgid "#<Invalid error code>"
msgstr ""
-#: bfd.c:771
+#: bfd.c:829
#, c-format
msgid "BFD %s assertion fail %s:%d"
msgstr ""
-#: bfd.c:787
+#: bfd.c:841
#, c-format
msgid "BFD %s internal error, aborting at %s line %d in %s\n"
msgstr ""
-#: bfd.c:791
+#: bfd.c:845
#, c-format
msgid "BFD %s internal error, aborting at %s line %d\n"
msgstr ""
-#: bfd.c:793
+#: bfd.c:847
msgid "Please report this bug.\n"
msgstr ""
-#: bfdwin.c:202
+#: bfdwin.c:207
#, c-format
msgid "not mapping: data=%lx mapped=%d\n"
msgstr ""
-#: bfdwin.c:205
+#: bfdwin.c:210
#, c-format
msgid "not mapping: env var not set\n"
msgstr ""
-#: binary.c:285
+#: binary.c:283
#, c-format
msgid "Warning: Writing section `%s' to huge (ie negative) file offset 0x%lx."
msgstr ""
-#: coff64-rs6000.c:2109 coff-rs6000.c:3610
+#: cache.c:237
+msgid "reopening %B: %s\n"
+msgstr ""
+
+#: coff64-rs6000.c:2125 coff-rs6000.c:3623
msgid "%B: symbol `%s' has unrecognized smclas %d"
msgstr ""
@@ -193,45 +202,45 @@ msgstr ""
msgid "%B: unknown/unsupported relocation type %d"
msgstr ""
-#: coff-alpha.c:898 coff-alpha.c:935 coff-alpha.c:2007 coff-mips.c:985
+#: coff-alpha.c:898 coff-alpha.c:935 coff-alpha.c:2023 coff-mips.c:1001
msgid "GP relative relocation used when GP not defined"
msgstr ""
-#: coff-alpha.c:1484
+#: coff-alpha.c:1500
msgid "using multiple gp values"
msgstr ""
-#: coff-alpha.c:1543
+#: coff-alpha.c:1559
msgid "%B: unsupported relocation: ALPHA_R_GPRELHIGH"
msgstr ""
-#: coff-alpha.c:1550
+#: coff-alpha.c:1566
msgid "%B: unsupported relocation: ALPHA_R_GPRELLOW"
msgstr ""
-#: coff-alpha.c:1557 elf32-m32r.c:2471 elf64-alpha.c:3912 elf64-alpha.c:4038
-#: elf32-ia64.c:4108 elf64-ia64.c:4108
+#: coff-alpha.c:1573 elf32-m32r.c:2486 elf64-alpha.c:3951 elf64-alpha.c:4104
+#: elf32-ia64.c:4674 elf64-ia64.c:4674
msgid "%B: unknown relocation type %d"
msgstr ""
-#: coff-arm.c:990 elf32-arm.c:1926
+#: coff-arm.c:1035
#, c-format
msgid "%B: unable to find THUMB glue '%s' for `%s'"
msgstr ""
-#: coff-arm.c:1019 elf32-arm.c:1960
+#: coff-arm.c:1064
#, c-format
msgid "%B: unable to find ARM glue '%s' for `%s'"
msgstr ""
-#: coff-arm.c:1319 elf32-arm.c:2683
+#: coff-arm.c:1366 elf32-arm.c:4156
#, c-format
msgid ""
"%B(%s): warning: interworking not enabled.\n"
" first occurrence: %B: arm call to thumb"
msgstr ""
-#: coff-arm.c:1409
+#: coff-arm.c:1456
#, c-format
msgid ""
"%B(%s): warning: interworking not enabled.\n"
@@ -239,105 +248,105 @@ msgid ""
" consider relinking with --support-old-code enabled"
msgstr ""
-#: coff-arm.c:1702 cofflink.c:3015 coff-tic80.c:695
+#: coff-arm.c:1749 cofflink.c:3014 coff-tic80.c:695
msgid "%B: bad reloc address 0x%lx in section `%A'"
msgstr ""
-#: coff-arm.c:2028
+#: coff-arm.c:2074
msgid "%B: illegal symbol index in reloc: %d"
msgstr ""
-#: coff-arm.c:2158
+#: coff-arm.c:2205
#, c-format
msgid "ERROR: %B is compiled for APCS-%d, whereas %B is compiled for APCS-%d"
msgstr ""
-#: coff-arm.c:2174 elf32-arm.c:5093
+#: coff-arm.c:2221 elf32-arm.c:7103
#, c-format
msgid ""
"ERROR: %B passes floats in float registers, whereas %B passes them in "
"integer registers"
msgstr ""
-#: coff-arm.c:2177 elf32-arm.c:5097
+#: coff-arm.c:2224 elf32-arm.c:7107
#, c-format
msgid ""
"ERROR: %B passes floats in integer registers, whereas %B passes them in "
"float registers"
msgstr ""
-#: coff-arm.c:2191
+#: coff-arm.c:2238
#, c-format
msgid ""
"ERROR: %B is compiled as position independent code, whereas target %B is "
"absolute position"
msgstr ""
-#: coff-arm.c:2194
+#: coff-arm.c:2241
#, c-format
msgid ""
"ERROR: %B is compiled as absolute position code, whereas target %B is "
"position independent"
msgstr ""
-#: coff-arm.c:2222 elf32-arm.c:5162
+#: coff-arm.c:2269 elf32-arm.c:7172
#, c-format
msgid "Warning: %B supports interworking, whereas %B does not"
msgstr ""
-#: coff-arm.c:2225 elf32-arm.c:5168
+#: coff-arm.c:2272 elf32-arm.c:7178
#, c-format
msgid "Warning: %B does not support interworking, whereas %B does"
msgstr ""
-#: coff-arm.c:2249
+#: coff-arm.c:2296
#, c-format
msgid "private flags = %x:"
msgstr ""
-#: coff-arm.c:2257 elf32-arm.c:5219
+#: coff-arm.c:2304 elf32-arm.c:7229
#, c-format
msgid " [floats passed in float registers]"
msgstr ""
-#: coff-arm.c:2259
+#: coff-arm.c:2306
#, c-format
msgid " [floats passed in integer registers]"
msgstr ""
-#: coff-arm.c:2262 elf32-arm.c:5222
+#: coff-arm.c:2309 elf32-arm.c:7232
#, c-format
msgid " [position independent]"
msgstr ""
-#: coff-arm.c:2264
+#: coff-arm.c:2311
#, c-format
msgid " [absolute position]"
msgstr ""
-#: coff-arm.c:2268
+#: coff-arm.c:2315
#, c-format
msgid " [interworking flag not initialised]"
msgstr ""
-#: coff-arm.c:2270
+#: coff-arm.c:2317
#, c-format
msgid " [interworking supported]"
msgstr ""
-#: coff-arm.c:2272
+#: coff-arm.c:2319
#, c-format
msgid " [interworking not supported]"
msgstr ""
-#: coff-arm.c:2318 elf32-arm.c:4571
+#: coff-arm.c:2365 elf32-arm.c:6626
#, c-format
msgid ""
"Warning: Not setting interworking flag of %B since it has already been "
"specified as non-interworking"
msgstr ""
-#: coff-arm.c:2322 elf32-arm.c:4575
+#: coff-arm.c:2369 elf32-arm.c:6630
#, c-format
msgid "Warning: Clearing the interworking flag of %B due to outside request"
msgstr ""
@@ -358,36 +367,40 @@ msgstr ""
msgid "%B (%s): Section flag %s (0x%x) ignored"
msgstr ""
-#: coffcode.h:2204
+#: coffcode.h:2231
#, c-format
msgid "Unrecognized TI COFF target id '0x%x'"
msgstr ""
-#: coffcode.h:4211
+#: coffcode.h:2546
+msgid "%B: reloc against a non-existant symbol index: %ld"
+msgstr ""
+
+#: coffcode.h:4269
msgid "%B: warning: line number table read failed"
msgstr ""
-#: coffcode.h:4243
+#: coffcode.h:4301
msgid "%B: warning: illegal symbol index %ld in line numbers"
msgstr ""
-#: coffcode.h:4257
+#: coffcode.h:4315
msgid "%B: warning: duplicate line number information for `%s'"
msgstr ""
-#: coffcode.h:4597
+#: coffcode.h:4655
msgid "%B: Unrecognized storage class %d for %s symbol `%s'"
msgstr ""
-#: coffcode.h:4723
+#: coffcode.h:4781
msgid "warning: %B: local symbol `%s' has no section"
msgstr ""
-#: coffcode.h:4827 coff-i860.c:586 coff-tic54x.c:376
+#: coffcode.h:4886 coff-i860.c:600 coff-tic54x.c:393
msgid "%B: warning: illegal symbol index %ld in relocs"
msgstr ""
-#: coffcode.h:4865
+#: coffcode.h:4924
msgid "%B: illegal relocation type %d at address 0x%lx"
msgstr ""
@@ -395,7 +408,7 @@ msgstr ""
msgid "%B: bad string table size %lu"
msgstr ""
-#: coff-h8300.c:1126
+#: coff-h8300.c:1121
#, c-format
msgid "cannot handle R_MEM_INDIRECT reloc when using %s output"
msgstr ""
@@ -405,53 +418,54 @@ msgstr ""
msgid "Relocation `%s' not yet implemented\n"
msgstr ""
-#: coff-i960.c:137 coff-i960.c:486
+#: coff-i960.c:137 coff-i960.c:500
msgid "uncertain calling convention for non-COFF symbol"
msgstr ""
-#: cofflink.c:507 elflink.c:3948
+#: cofflink.c:509 elflink.c:4158
msgid "Warning: type of symbol `%s' changed from %d to %d in %B"
msgstr ""
-#: cofflink.c:2293
+#: cofflink.c:2292
msgid "%B: relocs in section `%A', but it has no contents"
msgstr ""
-#: cofflink.c:2624 coffswap.h:823
+#: cofflink.c:2623 coffswap.h:823
#, c-format
msgid "%s: %s: reloc overflow: 0x%lx > 0xffff"
msgstr ""
-#: cofflink.c:2633 coffswap.h:809
+#: cofflink.c:2632 coffswap.h:809
#, c-format
msgid "%s: warning: %s: line number overflow: 0x%lx > 0xffff"
msgstr ""
-#: coff-m68k.c:482 elf32-bfin.c:2722 elf32-m68k.c:2193
+#: coff-m68k.c:505 elf32-bfin.c:5434 elf32-m68k.c:2392
msgid "unsupported reloc type"
msgstr ""
-#: coff-maxq.c:128
+#: coff-maxq.c:126
msgid "Can't Make it a Short Jump"
msgstr ""
-#: coff-maxq.c:193
+#: coff-maxq.c:191
msgid "Exceeds Long Jump Range"
msgstr ""
-#: coff-maxq.c:204 coff-maxq.c:278
+#: coff-maxq.c:202 coff-maxq.c:276
msgid "Absolute address Exceeds 16 bit Range"
msgstr ""
-#: coff-maxq.c:242
+#: coff-maxq.c:240
msgid "Absolute address Exceeds 8 bit Range"
msgstr ""
-#: coff-maxq.c:335
+#: coff-maxq.c:333
msgid "Unrecognized Reloc Type"
msgstr ""
-#: coff-mips.c:686 elf32-mips.c:940 elf64-mips.c:1864 elfn32-mips.c:1718
+#: coff-mips.c:686 elf32-mips.c:956 elf32-score.c:344 elf64-mips.c:1896
+#: elfn32-mips.c:1750
msgid "GP relative relocation when _gp not defined"
msgstr ""
@@ -459,22 +473,22 @@ msgstr ""
msgid "Unrecognized reloc"
msgstr ""
-#: coff-rs6000.c:2785
+#: coff-rs6000.c:2798
#, c-format
msgid "%s: unsupported relocation type 0x%02x"
msgstr ""
-#: coff-rs6000.c:2878
+#: coff-rs6000.c:2891
#, c-format
msgid "%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry"
msgstr ""
-#: coff-tic4x.c:174 coff-tic54x.c:282 coff-tic80.c:458
+#: coff-tic4x.c:191 coff-tic54x.c:299 coff-tic80.c:458
#, c-format
msgid "Unrecognized reloc type 0x%x"
msgstr ""
-#: coff-tic4x.c:219
+#: coff-tic4x.c:236
#, c-format
msgid "%s: warning: illegal symbol index %ld in relocs"
msgstr ""
@@ -484,543 +498,644 @@ msgstr ""
msgid "ignoring reloc %s\n"
msgstr ""
-#: cpu-arm.c:184 cpu-arm.c:193
+#: cpu-arm.c:188 cpu-arm.c:199
msgid "ERROR: %B is compiled for the EP9312, whereas %B is compiled for XScale"
msgstr ""
-#: cpu-arm.c:324
+#: cpu-arm.c:331
#, c-format
msgid "warning: unable to update contents of %s section in %s"
msgstr ""
-#: dwarf2.c:315
+#: dwarf2.c:329
msgid "Dwarf Error: Can't find .debug_str section."
msgstr ""
-#: dwarf2.c:333
+#: dwarf2.c:347
#, c-format
msgid ""
"Dwarf Error: DW_FORM_strp offset (%lu) greater than or equal to .debug_str "
"size (%lu)."
msgstr ""
-#: dwarf2.c:426
+#: dwarf2.c:440
msgid "Dwarf Error: Can't find .debug_abbrev section."
msgstr ""
-#: dwarf2.c:441
+#: dwarf2.c:455
#, c-format
msgid ""
"Dwarf Error: Abbrev offset (%lu) greater than or equal to .debug_abbrev size "
"(%lu)."
msgstr ""
-#: dwarf2.c:656
+#: dwarf2.c:670
#, c-format
msgid "Dwarf Error: Invalid or unhandled FORM value: %u."
msgstr ""
-#: dwarf2.c:856
+#: dwarf2.c:873
msgid "Dwarf Error: mangled line number section (bad file number)."
msgstr ""
-#: dwarf2.c:947
+#: dwarf2.c:985
msgid "Dwarf Error: Can't find .debug_line section."
msgstr ""
-#: dwarf2.c:964
+#: dwarf2.c:1002
#, c-format
msgid ""
"Dwarf Error: Line offset (%lu) greater than or equal to .debug_line size (%"
"lu)."
msgstr ""
-#: dwarf2.c:1192
+#: dwarf2.c:1228
msgid "Dwarf Error: mangled line number section."
msgstr ""
-#: dwarf2.c:1382
+#: dwarf2.c:1416
msgid "Dwarf Error: Can't find .debug_ranges section."
msgstr ""
-#: dwarf2.c:1544 dwarf2.c:1660 dwarf2.c:1930
+#: dwarf2.c:1579 dwarf2.c:1695 dwarf2.c:1965
#, c-format
msgid "Dwarf Error: Could not find abbrev number %u."
msgstr ""
-#: dwarf2.c:1891
+#: dwarf2.c:1926
#, c-format
msgid ""
"Dwarf Error: found dwarf version '%u', this reader only handles version 2 "
"information."
msgstr ""
-#: dwarf2.c:1898
+#: dwarf2.c:1933
#, c-format
msgid ""
"Dwarf Error: found address size '%u', this reader can not handle sizes "
"greater than '%u'."
msgstr ""
-#: dwarf2.c:1921
+#: dwarf2.c:1956
#, c-format
msgid "Dwarf Error: Bad abbrev number: %u."
msgstr ""
-#: ecoff.c:1227
+#: ecoff.c:1226
#, c-format
msgid "Unknown basic type %d"
msgstr ""
-#: ecoff.c:1484
+#: ecoff.c:1483
#, c-format
msgid ""
"\n"
" End+1 symbol: %ld"
msgstr ""
-#: ecoff.c:1491 ecoff.c:1494
+#: ecoff.c:1490 ecoff.c:1493
#, c-format
msgid ""
"\n"
" First symbol: %ld"
msgstr ""
-#: ecoff.c:1506
+#: ecoff.c:1505
#, c-format
msgid ""
"\n"
" End+1 symbol: %-7ld Type: %s"
msgstr ""
-#: ecoff.c:1513
+#: ecoff.c:1512
#, c-format
msgid ""
"\n"
" Local symbol: %ld"
msgstr ""
-#: ecoff.c:1521
+#: ecoff.c:1520
#, c-format
msgid ""
"\n"
" struct; End+1 symbol: %ld"
msgstr ""
-#: ecoff.c:1526
+#: ecoff.c:1525
#, c-format
msgid ""
"\n"
" union; End+1 symbol: %ld"
msgstr ""
-#: ecoff.c:1531
+#: ecoff.c:1530
#, c-format
msgid ""
"\n"
" enum; End+1 symbol: %ld"
msgstr ""
-#: ecoff.c:1537
+#: ecoff.c:1536
#, c-format
msgid ""
"\n"
" Type: %s"
msgstr ""
-#: elf32-arm.c:2315
+#: elf32-arm.c:2516
+#, c-format
+msgid "unable to find THUMB glue '%s' for '%s'"
+msgstr ""
+
+#: elf32-arm.c:2549
+#, c-format
+msgid "unable to find ARM glue '%s' for '%s'"
+msgstr ""
+
+#: elf32-arm.c:3119
msgid "%B: BE8 images only valid in big-endian mode."
msgstr ""
-#: elf32-arm.c:2471
+#. Give a warning, but do as the user requests anyway.
+#: elf32-arm.c:3320
+msgid ""
+"%B: warning: selected VFP11 erratum workaround is not necessary for target "
+"architecture"
+msgstr ""
+
+#: elf32-arm.c:3854 elf32-arm.c:3874
+msgid "%B: unable to find VFP11 veneer `%s'"
+msgstr ""
+
+#: elf32-arm.c:3919
#, c-format
msgid "Invalid TARGET2 relocation type '%s'."
msgstr ""
-#: elf32-arm.c:2578
+#: elf32-arm.c:4060
msgid ""
"%B(%s): warning: interworking not enabled.\n"
" first occurrence: %B: thumb call to arm"
msgstr ""
-#: elf32-arm.c:3044
+#: elf32-arm.c:4748
msgid "\\%B: Warning: Arm BLX instruction targets Arm function '%s'."
msgstr ""
-#: elf32-arm.c:3227
+#: elf32-arm.c:5047
msgid "%B: Warning: Thumb BLX instruction targets thumb function '%s'."
msgstr ""
-#: elf32-arm.c:3889
+#: elf32-arm.c:5738
msgid "%B(%A+0x%lx): R_ARM_TLS_LE32 relocation not permitted in shared object"
msgstr ""
-#: elf32-arm.c:4290 elf32-sh.c:4618 elf64-sh64.c:1537
+#: elf32-arm.c:5939
+msgid ""
+"%B(%A+0x%lx): Only ADD or SUB instructions are allowed for ALU group "
+"relocations"
+msgstr ""
+
+#: elf32-arm.c:5979 elf32-arm.c:6066 elf32-arm.c:6149 elf32-arm.c:6234
+msgid "%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s"
+msgstr ""
+
+#: elf32-arm.c:6417 elf32-sh.c:3303 elf64-sh64.c:1555
msgid "%B(%A+0x%lx): %s relocation against SEC_MERGE section"
msgstr ""
-#: elf32-arm.c:4351 elf64-ppc.c:9672
+#: elf32-arm.c:6506 elf64-ppc.c:9972
msgid "%B(%A+0x%lx): %s used with TLS symbol %s"
msgstr ""
-#: elf32-arm.c:4352 elf64-ppc.c:9673
+#: elf32-arm.c:6507 elf64-ppc.c:9973
msgid "%B(%A+0x%lx): %s used with non-TLS symbol %s"
msgstr ""
-#: elf32-arm.c:4375 elf32-i386.c:3038 elf32-m32r.c:2653 elf32-m68k.c:1737
-#: elf32-ppc.c:6561 elf32-s390.c:3012 elf32-sh.c:4717 elf32-xtensa.c:2311
-#: elf64-ppc.c:10825 elf64-s390.c:3010 elf64-sh64.c:1626 elf64-x86-64.c:2522
-#: elf-hppa.h:1413 elf-m10300.c:1460 elfxx-sparc.c:3137
+#: elf32-arm.c:6530 elf32-i386.c:3305 elf32-m32r.c:2597 elf32-m68k.c:1981
+#: elf32-ppc.c:6791 elf32-s390.c:3048 elf32-sh.c:3407 elf32-xtensa.c:2290
+#: elf64-ppc.c:11137 elf64-s390.c:3009 elf64-sh64.c:1647 elf64-x86-64.c:3001
+#: elf-hppa.h:2193 elf-m10300.c:1459 elfxx-sparc.c:3254
msgid "%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"
msgstr ""
-#: elf32-arm.c:4411 elf32-avr.c:880 elf32-cr16c.c:773 elf32-cris.c:1502
-#: elf32-crx.c:911 elf32-d10v.c:536 elf32-fr30.c:595 elf32-frv.c:4107
-#: elf32-h8300.c:494 elf32-i860.c:1189 elf32-ip2k.c:1474 elf32-iq2000.c:616
-#: elf32-m32c.c:465 elf32-m32r.c:3111 elf32-m68hc1x.c:1194 elf32-ms1.c:373
-#: elf32-msp430.c:508 elf32-openrisc.c:383 elf32-v850.c:1672
-#: elf32-xstormy16.c:909 elf64-mmix.c:1517 elf-m10200.c:427 elf-m10300.c:1509
-msgid "internal error: out of range error"
+#: elf32-arm.c:6564
+msgid "out of range"
msgstr ""
-#: elf32-arm.c:4415 elf32-avr.c:884 elf32-cr16c.c:777 elf32-cris.c:1506
-#: elf32-crx.c:915 elf32-d10v.c:540 elf32-fr30.c:599 elf32-frv.c:4111
-#: elf32-h8300.c:498 elf32-i860.c:1193 elf32-iq2000.c:620 elf32-m32c.c:469
-#: elf32-m32r.c:3115 elf32-m68hc1x.c:1198 elf32-msp430.c:512
-#: elf32-openrisc.c:387 elf32-v850.c:1676 elf32-xstormy16.c:913
-#: elf64-mmix.c:1521 elf-m10200.c:431 elf-m10300.c:1513 elfxx-mips.c:7212
-msgid "internal error: unsupported relocation error"
+#: elf32-arm.c:6568
+msgid "unsupported relocation"
msgstr ""
-#: elf32-arm.c:4419 elf32-cr16c.c:781 elf32-crx.c:919 elf32-d10v.c:544
-#: elf32-h8300.c:502 elf32-m32r.c:3119 elf32-m68hc1x.c:1202 elf-m10200.c:435
-#: elf-m10300.c:1517
-msgid "internal error: dangerous error"
+#: elf32-arm.c:6576
+msgid "unknown error"
msgstr ""
-#: elf32-arm.c:4423 elf32-avr.c:892 elf32-cr16c.c:785 elf32-cris.c:1514
-#: elf32-crx.c:923 elf32-d10v.c:548 elf32-fr30.c:607 elf32-frv.c:4119
-#: elf32-h8300.c:506 elf32-i860.c:1201 elf32-ip2k.c:1489 elf32-iq2000.c:628
-#: elf32-m32c.c:477 elf32-m32r.c:3123 elf32-m68hc1x.c:1206 elf32-ms1.c:381
-#: elf32-msp430.c:520 elf32-openrisc.c:395 elf32-v850.c:1696
-#: elf32-xstormy16.c:921 elf64-mmix.c:1529 elf-m10200.c:439 elf-m10300.c:1521
-msgid "internal error: unknown error"
-msgstr ""
-
-#: elf32-arm.c:4664
+#: elf32-arm.c:6676
msgid ""
"Warning: Clearing the interworking flag of %B because non-interworking code "
"in %B has been linked with it"
msgstr ""
-#: elf32-arm.c:4751
+#: elf32-arm.c:6778
msgid "ERROR: %B uses VFP register arguments, %B does not"
msgstr ""
-#: elf32-arm.c:4798
+#: elf32-arm.c:6828
msgid "ERROR: %B: Conflicting architecture profiles %c/%c"
msgstr ""
-#: elf32-arm.c:4813
+#: elf32-arm.c:6843
msgid "Warning: %B: Conflicting platform configuration"
msgstr ""
-#: elf32-arm.c:4821
+#: elf32-arm.c:6852
msgid "ERROR: %B: Conflicting use of R9"
msgstr ""
-#: elf32-arm.c:4833
+#: elf32-arm.c:6864
msgid "ERROR: %B: SB relative addressing conflicts with use of R9"
msgstr ""
-#: elf32-arm.c:4855
+#: elf32-arm.c:6886
msgid "ERROR: %B: Conflicting definitions of wchar_t"
msgstr ""
-#: elf32-arm.c:4881
-msgid "ERROR: %B: Conflicting enum sizes"
+#: elf32-arm.c:6915
+msgid ""
+"warning: %B uses %s enums yet the output is to use %s enums; use of enum "
+"values across objects may fail"
msgstr ""
-#: elf32-arm.c:4892
+#: elf32-arm.c:6928
msgid "ERROR: %B uses iWMMXt register arguments, %B does not"
msgstr ""
-#: elf32-arm.c:4912
-msgid "ERROR: %B: Must be processed by '%s' toolchain"
-msgstr ""
-
-#: elf32-arm.c:4932 elf32-arm.c:4951
-msgid "ERROR: %B: Incompatible object tag '%s':%d"
-msgstr ""
-
-#: elf32-arm.c:4961
+#: elf32-arm.c:6951
msgid "Warning: %B: Unknown EABI object attribute %d"
msgstr ""
-#: elf32-arm.c:5069
+#: elf32-arm.c:7076
msgid ""
"ERROR: Source object %B has EABI version %d, but target %B has EABI version %"
"d"
msgstr ""
-#: elf32-arm.c:5082
+#: elf32-arm.c:7092
msgid "ERROR: %B is compiled for APCS-%d, whereas target %B uses APCS-%d"
msgstr ""
-#: elf32-arm.c:5107
+#: elf32-arm.c:7117
msgid "ERROR: %B uses VFP instructions, whereas %B does not"
msgstr ""
-#: elf32-arm.c:5111
+#: elf32-arm.c:7121
msgid "ERROR: %B uses FPA instructions, whereas %B does not"
msgstr ""
-#: elf32-arm.c:5121
+#: elf32-arm.c:7131
msgid "ERROR: %B uses Maverick instructions, whereas %B does not"
msgstr ""
-#: elf32-arm.c:5125
+#: elf32-arm.c:7135
msgid "ERROR: %B does not use Maverick instructions, whereas %B does"
msgstr ""
-#: elf32-arm.c:5144
+#: elf32-arm.c:7154
msgid "ERROR: %B uses software FP, whereas %B uses hardware FP"
msgstr ""
-#: elf32-arm.c:5148
+#: elf32-arm.c:7158
msgid "ERROR: %B uses hardware FP, whereas %B uses software FP"
msgstr ""
#. Ignore init flag - it may not be set, despite the flags field
#. containing valid data.
#. Ignore init flag - it may not be set, despite the flags field containing valid data.
-#: elf32-arm.c:5195 elf32-bfin.c:2164 elf32-cris.c:3243 elf32-m68hc1x.c:1338
-#: elf32-m68k.c:428 elf32-vax.c:528 elfxx-mips.c:9933
+#: elf32-arm.c:7205 elf32-bfin.c:4795 elf32-cris.c:3233 elf32-m68hc1x.c:1276
+#: elf32-m68k.c:619 elf32-score.c:3752 elf32-vax.c:537 elfxx-mips.c:11310
#, c-format
msgid "private flags = %lx:"
msgstr ""
-#: elf32-arm.c:5204
+#: elf32-arm.c:7214
#, c-format
msgid " [interworking enabled]"
msgstr ""
-#: elf32-arm.c:5212
+#: elf32-arm.c:7222
#, c-format
msgid " [VFP float format]"
msgstr ""
-#: elf32-arm.c:5214
+#: elf32-arm.c:7224
#, c-format
msgid " [Maverick float format]"
msgstr ""
-#: elf32-arm.c:5216
+#: elf32-arm.c:7226
#, c-format
msgid " [FPA float format]"
msgstr ""
-#: elf32-arm.c:5225
+#: elf32-arm.c:7235
#, c-format
msgid " [new ABI]"
msgstr ""
-#: elf32-arm.c:5228
+#: elf32-arm.c:7238
#, c-format
msgid " [old ABI]"
msgstr ""
-#: elf32-arm.c:5231
+#: elf32-arm.c:7241
#, c-format
msgid " [software FP]"
msgstr ""
-#: elf32-arm.c:5240
+#: elf32-arm.c:7250
#, c-format
msgid " [Version1 EABI]"
msgstr ""
-#: elf32-arm.c:5243 elf32-arm.c:5254
+#: elf32-arm.c:7253 elf32-arm.c:7264
#, c-format
msgid " [sorted symbol table]"
msgstr ""
-#: elf32-arm.c:5245 elf32-arm.c:5256
+#: elf32-arm.c:7255 elf32-arm.c:7266
#, c-format
msgid " [unsorted symbol table]"
msgstr ""
-#: elf32-arm.c:5251
+#: elf32-arm.c:7261
#, c-format
msgid " [Version2 EABI]"
msgstr ""
-#: elf32-arm.c:5259
+#: elf32-arm.c:7269
#, c-format
msgid " [dynamic symbols use segment index]"
msgstr ""
-#: elf32-arm.c:5262
+#: elf32-arm.c:7272
#, c-format
msgid " [mapping symbols precede others]"
msgstr ""
-#: elf32-arm.c:5269
+#: elf32-arm.c:7279
#, c-format
msgid " [Version3 EABI]"
msgstr ""
-#: elf32-arm.c:5273
+#: elf32-arm.c:7283
#, c-format
msgid " [Version4 EABI]"
msgstr ""
-#: elf32-arm.c:5276
+#: elf32-arm.c:7287
+#, c-format
+msgid " [Version5 EABI]"
+msgstr ""
+
+#: elf32-arm.c:7290
#, c-format
msgid " [BE8]"
msgstr ""
-#: elf32-arm.c:5279
+#: elf32-arm.c:7293
#, c-format
msgid " [LE8]"
msgstr ""
-#: elf32-arm.c:5285
+#: elf32-arm.c:7299
#, c-format
msgid " <EABI version unrecognised>"
msgstr ""
-#: elf32-arm.c:5292
+#: elf32-arm.c:7306
#, c-format
msgid " [relocatable executable]"
msgstr ""
-#: elf32-arm.c:5295
+#: elf32-arm.c:7309
#, c-format
msgid " [has entry point]"
msgstr ""
-#: elf32-arm.c:5300
+#: elf32-arm.c:7314
#, c-format
msgid "<Unrecognised flag bits set>"
msgstr ""
-#: elf32-arm.c:5536 elf32-i386.c:902 elf32-s390.c:989 elf32-xtensa.c:784
-#: elf64-s390.c:942 elf64-x86-64.c:666 elfxx-sparc.c:1016
+#: elf32-arm.c:7545 elf32-i386.c:960 elf32-s390.c:1003 elf32-xtensa.c:814
+#: elf64-s390.c:958 elf64-x86-64.c:772 elfxx-sparc.c:1113
msgid "%B: bad symbol index: %d"
msgstr ""
-#: elf32-arm.c:6023 elf32-cris.c:2385 elf32-hppa.c:1813 elf32-i370.c:491
-#: elf32-i386.c:1465 elf32-m32r.c:1913 elf32-m68k.c:1088 elf32-ppc.c:4145
-#: elf32-s390.c:1686 elf32-sh.c:3920 elf32-vax.c:1059 elf64-ppc.c:5717
-#: elf64-s390.c:1659 elf64-sh64.c:3442 elf64-x86-64.c:1252 elf-m10300.c:4107
-#: elfxx-sparc.c:1720
+#: elf32-arm.c:8091 elf32-cris.c:2399 elf32-hppa.c:1905 elf32-i370.c:506
+#: elf32-i386.c:1517 elf32-m32r.c:1930 elf32-m68k.c:1330 elf32-ppc.c:4309
+#: elf32-s390.c:1679 elf32-sh.c:2583 elf32-vax.c:1049 elf64-ppc.c:5897
+#: elf64-s390.c:1654 elf64-sh64.c:3437 elf64-x86-64.c:1381 elf-m10300.c:4206
+#: elfxx-sparc.c:1795
#, c-format
msgid "dynamic variable `%s' is zero size"
msgstr ""
-#: elf32-avr.c:888 elf32-cris.c:1510 elf32-fr30.c:603 elf32-frv.c:4115
-#: elf32-i860.c:1197 elf32-ip2k.c:1485 elf32-iq2000.c:624 elf32-m32c.c:473
-#: elf32-ms1.c:377 elf32-msp430.c:516 elf32-openrisc.c:391 elf32-v850.c:1680
-#: elf32-xstormy16.c:917 elf64-mmix.c:1525
+#: elf32-arm.c:8609
+#, c-format
+msgid "Errors encountered processing file %s"
+msgstr ""
+
+#: elf32-arm.c:9837 elf32-arm.c:9859
+msgid "%B: error: VFP11 veneer out of range"
+msgstr ""
+
+#: elf32-avr.c:1253 elf32-bfin.c:2795 elf32-cr16.c:887 elf32-cr16c.c:789
+#: elf32-cris.c:1537 elf32-crx.c:932 elf32-d10v.c:517 elf32-fr30.c:615
+#: elf32-frv.c:4128 elf32-h8300.c:515 elf32-i860.c:1217 elf32-ip2k.c:1499
+#: elf32-iq2000.c:647 elf32-m32c.c:560 elf32-m32r.c:3123 elf32-m68hc1x.c:1132
+#: elf32-mep.c:639 elf32-msp430.c:496 elf32-mt.c:401 elf32-openrisc.c:411
+#: elf32-score.c:2455 elf32-spu.c:2813 elf32-v850.c:1700 elf32-xstormy16.c:946
+#: elf64-mmix.c:1531 elf-m10200.c:455 elf-m10300.c:1522
+msgid "internal error: out of range error"
+msgstr ""
+
+#: elf32-avr.c:1257 elf32-bfin.c:2799 elf32-cr16.c:891 elf32-cr16c.c:793
+#: elf32-cris.c:1541 elf32-crx.c:936 elf32-d10v.c:521 elf32-fr30.c:619
+#: elf32-frv.c:4132 elf32-h8300.c:519 elf32-i860.c:1221 elf32-iq2000.c:651
+#: elf32-m32c.c:564 elf32-m32r.c:3127 elf32-m68hc1x.c:1136 elf32-mep.c:643
+#: elf32-msp430.c:500 elf32-openrisc.c:415 elf32-score.c:2459 elf32-spu.c:2817
+#: elf32-v850.c:1704 elf32-xstormy16.c:950 elf64-mmix.c:1535 elf-m10200.c:459
+#: elf-m10300.c:1526 elfxx-mips.c:8019
+msgid "internal error: unsupported relocation error"
+msgstr ""
+
+#: elf32-avr.c:1261 elf32-bfin.c:2803 elf32-cris.c:1545 elf32-fr30.c:623
+#: elf32-frv.c:4136 elf32-i860.c:1225 elf32-ip2k.c:1510 elf32-iq2000.c:655
+#: elf32-m32c.c:568 elf32-mep.c:647 elf32-msp430.c:504 elf32-mt.c:405
+#: elf32-openrisc.c:419 elf32-v850.c:1708 elf32-xstormy16.c:954
+#: elf64-mmix.c:1539
msgid "internal error: dangerous relocation"
msgstr ""
-#: elf32-bfin.c:96
-msgid "Division by zero. "
+#: elf32-avr.c:1265 elf32-bfin.c:2807 elf32-cr16.c:899 elf32-cr16c.c:801
+#: elf32-cris.c:1549 elf32-crx.c:944 elf32-d10v.c:529 elf32-fr30.c:627
+#: elf32-frv.c:4140 elf32-h8300.c:527 elf32-i860.c:1229 elf32-ip2k.c:1514
+#: elf32-iq2000.c:659 elf32-m32c.c:572 elf32-m32r.c:3135 elf32-m68hc1x.c:1144
+#: elf32-mep.c:651 elf32-msp430.c:508 elf32-mt.c:409 elf32-openrisc.c:423
+#: elf32-score.c:2467 elf32-spu.c:2825 elf32-v850.c:1724 elf32-xstormy16.c:958
+#: elf64-mmix.c:1543 elf-m10200.c:467 elf-m10300.c:1539
+msgid "internal error: unknown error"
+msgstr ""
+
+#: elf32-avr.c:2369 elf32-hppa.c:594 elf32-m68hc1x.c:163 elf64-ppc.c:3801
+msgid "%B: cannot create stub entry %s"
+msgstr ""
+
+#: elf32-bfin.c:2274
+msgid "%B: relocation at `%A+0x%x' references symbol `%s' with nonzero addend"
+msgstr ""
+
+#: elf32-bfin.c:2288 elf32-frv.c:2918
+msgid "relocation references symbol not defined in the module"
+msgstr ""
+
+#: elf32-bfin.c:2385
+msgid "R_BFIN_FUNCDESC references dynamic symbol with nonzero addend"
+msgstr ""
+
+#: elf32-bfin.c:2424 elf32-bfin.c:2547 elf32-frv.c:3655 elf32-frv.c:3776
+msgid "cannot emit fixups in read-only section"
+msgstr ""
+
+#: elf32-bfin.c:2452 elf32-bfin.c:2587 elf32-frv.c:3686 elf32-frv.c:3820
+msgid "cannot emit dynamic relocations in read-only section"
+msgstr ""
+
+#: elf32-bfin.c:2505
+msgid "R_BFIN_FUNCDESC_VALUE references dynamic symbol with nonzero addend"
msgstr ""
-#: elf32-bfin.c:1958
+#: elf32-bfin.c:2673
+msgid "relocations between different segments are not supported"
+msgstr ""
+
+#: elf32-bfin.c:2674
+msgid "warning: relocation references a different segment"
+msgstr ""
+
+#: elf32-bfin.c:3083
msgid "%B(%A+0x%lx): unresolvable relocation against symbol `%s'"
msgstr ""
-#: elf32-bfin.c:1991 elf32-i386.c:3079 elf32-m68k.c:1778 elf32-s390.c:3064
-#: elf64-s390.c:3062 elf64-x86-64.c:2567
+#: elf32-bfin.c:3116 elf32-i386.c:3346 elf32-m68k.c:2022 elf32-s390.c:3100
+#: elf64-s390.c:3061 elf64-x86-64.c:3040
msgid "%B(%A+0x%lx): reloc against `%s': error %d"
msgstr ""
-#: elf32-cris.c:1050
+#: elf32-bfin.c:4687 elf32-frv.c:6422
+msgid "%B: unsupported relocation type %i"
+msgstr ""
+
+#: elf32-bfin.c:4868 elf32-frv.c:6830
+#, c-format
+msgid "%s: cannot link non-fdpic object file into fdpic executable"
+msgstr ""
+
+#: elf32-bfin.c:4872 elf32-frv.c:6834
+#, c-format
+msgid "%s: cannot link fdpic object file into non-fdpic executable"
+msgstr ""
+
+#: elf32-cr16.c:895 elf32-cr16c.c:797 elf32-crx.c:940 elf32-d10v.c:525
+#: elf32-h8300.c:523 elf32-m32r.c:3131 elf32-m68hc1x.c:1140 elf32-score.c:2463
+#: elf32-spu.c:2821 elf-m10200.c:463
+msgid "internal error: dangerous error"
+msgstr ""
+
+#: elf32-cris.c:1059
msgid "%B, section %A: unresolvable relocation %s against symbol `%s'"
msgstr ""
-#: elf32-cris.c:1105
+#: elf32-cris.c:1128
msgid "%B, section %A: No PLT nor GOT for relocation %s against symbol `%s'"
msgstr ""
-#: elf32-cris.c:1107
+#: elf32-cris.c:1130
msgid "%B, section %A: No PLT for relocation %s against symbol `%s'"
msgstr ""
-#: elf32-cris.c:1113 elf32-cris.c:1245
+#: elf32-cris.c:1136 elf32-cris.c:1268
msgid "[whose name is lost]"
msgstr ""
-#: elf32-cris.c:1231
+#: elf32-cris.c:1254
msgid ""
"%B, section %A: relocation %s with non-zero addend %d against local symbol"
msgstr ""
-#: elf32-cris.c:1239
+#: elf32-cris.c:1262
msgid ""
"%B, section %A: relocation %s with non-zero addend %d against symbol `%s'"
msgstr ""
-#: elf32-cris.c:1265
+#: elf32-cris.c:1288
msgid "%B, section %A: relocation %s is not allowed for global symbol: `%s'"
msgstr ""
-#: elf32-cris.c:1281
+#: elf32-cris.c:1304
msgid "%B, section %A: relocation %s with no GOT created"
msgstr ""
-#: elf32-cris.c:1399
+#: elf32-cris.c:1422
msgid "%B: Internal inconsistency; no relocation section %s"
msgstr ""
-#: elf32-cris.c:2520
+#: elf32-cris.c:2510
msgid ""
"%B, section %A:\n"
" v10/v32 compatible object %s must not contain a PIC relocation"
msgstr ""
-#: elf32-cris.c:2707 elf32-cris.c:2775
+#: elf32-cris.c:2697 elf32-cris.c:2765
msgid ""
"%B, section %A:\n"
" relocation %s should not be used in a shared object; recompile with -fPIC"
msgstr ""
-#: elf32-cris.c:3192
+#: elf32-cris.c:3182
msgid "Unexpected machine number"
msgstr ""
-#: elf32-cris.c:3246
+#: elf32-cris.c:3236
#, c-format
msgid " [symbols have a _ prefix]"
msgstr ""
-#: elf32-cris.c:3249
+#: elf32-cris.c:3239
#, c-format
msgid " [v10 and v32]"
msgstr ""
-#: elf32-cris.c:3252
+#: elf32-cris.c:3242
#, c-format
msgid " [v32]"
msgstr ""
-#: elf32-cris.c:3297
+#: elf32-cris.c:3287
msgid "%B: uses _-prefixed symbols, but writing file with non-prefixed symbols"
msgstr ""
-#: elf32-cris.c:3298
+#: elf32-cris.c:3288
msgid "%B: uses non-prefixed symbols, but writing file with _-prefixed symbols"
msgstr ""
-#: elf32-cris.c:3317
+#: elf32-cris.c:3307
msgid "%B contains CRIS v32 code, incompatible with previous objects"
msgstr ""
-#: elf32-cris.c:3319
+#: elf32-cris.c:3309
msgid "%B contains non-CRIS-v32 code, incompatible with previous objects"
msgstr ""
@@ -1028,119 +1143,93 @@ msgstr ""
msgid "relocation requires zero addend"
msgstr ""
-#: elf32-frv.c:2901
+#: elf32-frv.c:2905
msgid "%B(%A+0x%x): relocation to `%s+%x' may have caused the error above"
msgstr ""
-#: elf32-frv.c:2914
-msgid "relocation references symbol not defined in the module"
-msgstr ""
-
-#: elf32-frv.c:2990
+#: elf32-frv.c:2994
msgid "R_FRV_GETTLSOFF not applied to a call instruction"
msgstr ""
-#: elf32-frv.c:3032
+#: elf32-frv.c:3036
msgid "R_FRV_GOTTLSDESC12 not applied to an lddi instruction"
msgstr ""
-#: elf32-frv.c:3103
+#: elf32-frv.c:3107
msgid "R_FRV_GOTTLSDESCHI not applied to a sethi instruction"
msgstr ""
-#: elf32-frv.c:3140
+#: elf32-frv.c:3144
msgid "R_FRV_GOTTLSDESCLO not applied to a setlo or setlos instruction"
msgstr ""
-#: elf32-frv.c:3188
+#: elf32-frv.c:3192
msgid "R_FRV_TLSDESC_RELAX not applied to an ldd instruction"
msgstr ""
-#: elf32-frv.c:3272
+#: elf32-frv.c:3276
msgid "R_FRV_GETTLSOFF_RELAX not applied to a calll instruction"
msgstr ""
-#: elf32-frv.c:3327
+#: elf32-frv.c:3331
msgid "R_FRV_GOTTLSOFF12 not applied to an ldi instruction"
msgstr ""
-#: elf32-frv.c:3357
+#: elf32-frv.c:3361
msgid "R_FRV_GOTTLSOFFHI not applied to a sethi instruction"
msgstr ""
-#: elf32-frv.c:3386
+#: elf32-frv.c:3390
msgid "R_FRV_GOTTLSOFFLO not applied to a setlo or setlos instruction"
msgstr ""
-#: elf32-frv.c:3417
+#: elf32-frv.c:3421
msgid "R_FRV_TLSOFF_RELAX not applied to an ld instruction"
msgstr ""
-#: elf32-frv.c:3462
+#: elf32-frv.c:3466
msgid "R_FRV_TLSMOFFHI not applied to a sethi instruction"
msgstr ""
-#: elf32-frv.c:3489
+#: elf32-frv.c:3493
msgid "R_FRV_TLSMOFFLO not applied to a setlo or setlos instruction"
msgstr ""
-#: elf32-frv.c:3610
+#: elf32-frv.c:3614
msgid "R_FRV_FUNCDESC references dynamic symbol with nonzero addend"
msgstr ""
-#: elf32-frv.c:3649 elf32-frv.c:3762
-msgid "cannot emit fixups in read-only section"
-msgstr ""
-
-#: elf32-frv.c:3675 elf32-frv.c:3802
-msgid "cannot emit dynamic relocations in read-only section"
-msgstr ""
-
-#: elf32-frv.c:3720
+#: elf32-frv.c:3734
msgid "R_FRV_FUNCDESC_VALUE references dynamic symbol with nonzero addend"
msgstr ""
-#: elf32-frv.c:3970 elf32-frv.c:4126
+#: elf32-frv.c:3991 elf32-frv.c:4147
msgid "%B(%A+0x%lx): reloc against `%s': %s"
msgstr ""
-#: elf32-frv.c:3972 elf32-frv.c:3976
+#: elf32-frv.c:3993 elf32-frv.c:3997
msgid "relocation references a different segment"
msgstr ""
-#: elf32-frv.c:6324
-msgid "%B: unsupported relocation type %i"
-msgstr ""
-
-#: elf32-frv.c:6642
+#: elf32-frv.c:6744
#, c-format
msgid ""
"%s: compiled with %s and linked with modules that use non-pic relocations"
msgstr ""
-#: elf32-frv.c:6695 elf32-iq2000.c:801 elf32-m32c.c:785
+#: elf32-frv.c:6797 elf32-iq2000.c:808 elf32-m32c.c:819
#, c-format
msgid "%s: compiled with %s and linked with modules compiled with %s"
msgstr ""
-#: elf32-frv.c:6707
+#: elf32-frv.c:6809
#, c-format
msgid ""
"%s: uses different unknown e_flags (0x%lx) fields than previous modules (0x%"
"lx)"
msgstr ""
-#: elf32-frv.c:6728
-#, c-format
-msgid "%s: cannot link non-fdpic object file into fdpic executable"
-msgstr ""
-
-#: elf32-frv.c:6732
-#, c-format
-msgid "%s: cannot link fdpic object file into non-fdpic executable"
-msgstr ""
-
-#: elf32-frv.c:6757 elf32-iq2000.c:838 elf32-m32c.c:821 elf32-ms1.c:596
+#: elf32-frv.c:6859 elf32-iq2000.c:845 elf32-m32c.c:855 elf32-mt.c:586
#, c-format
msgid "private flags = 0x%lx:"
msgstr ""
@@ -1149,423 +1238,461 @@ msgstr ""
msgid "%B: Relocations in generic ELF (EM: %d)"
msgstr ""
-#: elf32-hppa.c:569 elf32-m68hc1x.c:161 elf64-ppc.c:3660
-msgid "%B: cannot create stub entry %s"
-msgstr ""
-
-#: elf32-hppa.c:822 elf32-hppa.c:3411
+#: elf32-hppa.c:843 elf32-hppa.c:3576
msgid "%B(%A+0x%lx): cannot reach %s, recompile with -ffunction-sections"
msgstr ""
-#: elf32-hppa.c:1212
+#: elf32-hppa.c:1252
msgid ""
"%B: relocation %s can not be used when making a shared object; recompile "
"with -fPIC"
msgstr ""
-#: elf32-hppa.c:1405
+#: elf32-hppa.c:1505
#, c-format
msgid "Could not find relocation section for %s"
msgstr ""
-#: elf32-hppa.c:2677
+#: elf32-hppa.c:2794
msgid "%B: duplicate export stub %s"
msgstr ""
-#: elf32-hppa.c:3266
+#: elf32-hppa.c:3412
msgid ""
"%B(%A+0x%lx): %s fixup for insn 0x%x is not supported in a non-shared link"
msgstr ""
-#: elf32-hppa.c:3895
+#: elf32-hppa.c:4266
msgid "%B(%A+0x%lx): cannot handle %s for %s"
msgstr ""
-#: elf32-hppa.c:4189
+#: elf32-hppa.c:4573
msgid ".got section not immediately after .plt section"
msgstr ""
-#: elf32-i386.c:327 elf32-s390.c:368 elf64-ppc.c:2124 elf64-s390.c:390
-#: elf64-x86-64.c:204
+#: elf32-i386.c:363 elf32-ppc.c:1615 elf32-s390.c:379 elf64-ppc.c:2147
+#: elf64-s390.c:403 elf64-x86-64.c:220
msgid "%B: invalid relocation type %d"
msgstr ""
-#: elf32-i386.c:1015 elf32-s390.c:1171 elf32-sh.c:6389 elf64-s390.c:1133
-#: elfxx-sparc.c:1144
+#: elf32-i386.c:1084 elf32-s390.c:1185 elf32-sh.c:5062 elf64-s390.c:1149
+#: elfxx-sparc.c:1241
msgid "%B: `%s' accessed both as normal and thread local symbol"
msgstr ""
-#: elf32-i386.c:1130 elf32-s390.c:1280 elf64-ppc.c:4731 elf64-s390.c:1245
-#: elf64-x86-64.c:910
+#: elf32-i386.c:1199 elf32-s390.c:1294 elf64-ppc.c:4863 elf64-s390.c:1261
+#: elf64-x86-64.c:1050
msgid "%B: bad relocation section name `%s'"
msgstr ""
-#: elf32-i386.c:2149
+#: elf32-i386.c:2252
msgid "%B: unrecognized relocation (0x%x) in section `%A'"
msgstr ""
-#: elf32-i386.c:2409
+#: elf32-i386.c:2474
msgid ""
"%B: relocation R_386_GOTOFF against protected function `%s' can not be used "
"when making a shared object"
msgstr ""
-#: elf32-ip2k.c:853 elf32-ip2k.c:859 elf32-ip2k.c:926 elf32-ip2k.c:932
+#: elf32-ip2k.c:868 elf32-ip2k.c:874 elf32-ip2k.c:941 elf32-ip2k.c:947
msgid ""
"ip2k relaxer: switch table without complete matching relocation information."
msgstr ""
-#: elf32-ip2k.c:876 elf32-ip2k.c:959
+#: elf32-ip2k.c:891 elf32-ip2k.c:974
msgid "ip2k relaxer: switch table header corrupt."
msgstr ""
-#: elf32-ip2k.c:1301
+#: elf32-ip2k.c:1316
#, c-format
msgid "ip2k linker: missing page instruction at 0x%08lx (dest = 0x%08lx)."
msgstr ""
-#: elf32-ip2k.c:1317
+#: elf32-ip2k.c:1332
#, c-format
msgid "ip2k linker: redundant page instruction at 0x%08lx (dest = 0x%08lx)."
msgstr ""
#. Only if it's not an unresolved symbol.
-#: elf32-ip2k.c:1481
+#: elf32-ip2k.c:1506
msgid "unsupported relocation between data/insn address spaces"
msgstr ""
-#: elf32-iq2000.c:814 elf32-m32c.c:797
+#: elf32-iq2000.c:821 elf32-m32c.c:831
#, c-format
msgid "%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"
msgstr ""
-#: elf32-m32r.c:1436
+#: elf32-m32r.c:1452
msgid "SDA relocation when _SDA_BASE_ not defined"
msgstr ""
-#: elf32-m32r.c:3048
+#: elf32-m32r.c:3060
msgid "%B: The target (%s) of an %s relocation is in the wrong section (%A)"
msgstr ""
-#: elf32-m32r.c:3576
+#: elf32-m32r.c:3588
msgid "%B: Instruction set mismatch with previous modules"
msgstr ""
-#: elf32-m32r.c:3597
+#: elf32-m32r.c:3609
#, c-format
msgid "private flags = %lx"
msgstr ""
-#: elf32-m32r.c:3602
+#: elf32-m32r.c:3614
#, c-format
msgid ": m32r instructions"
msgstr ""
-#: elf32-m32r.c:3603
+#: elf32-m32r.c:3615
#, c-format
msgid ": m32rx instructions"
msgstr ""
-#: elf32-m32r.c:3604
+#: elf32-m32r.c:3616
#, c-format
msgid ": m32r2 instructions"
msgstr ""
-#: elf32-m68hc1x.c:1106
+#: elf32-m68hc1x.c:1044
#, c-format
msgid ""
"Reference to the far symbol `%s' using a wrong relocation may result in "
"incorrect execution"
msgstr ""
-#: elf32-m68hc1x.c:1129
+#: elf32-m68hc1x.c:1067
#, c-format
msgid ""
"banked address [%lx:%04lx] (%lx) is not in the same bank as current banked "
"address [%lx:%04lx] (%lx)"
msgstr ""
-#: elf32-m68hc1x.c:1148
+#: elf32-m68hc1x.c:1086
#, c-format
msgid ""
"reference to a banked address [%lx:%04lx] in the normal address space at %"
"04lx"
msgstr ""
-#: elf32-m68hc1x.c:1281
+#: elf32-m68hc1x.c:1219
msgid ""
"%B: linking files compiled for 16-bit integers (-mshort) and others for 32-"
"bit integers"
msgstr ""
-#: elf32-m68hc1x.c:1288
+#: elf32-m68hc1x.c:1226
msgid ""
"%B: linking files compiled for 32-bit double (-fshort-double) and others for "
"64-bit double"
msgstr ""
-#: elf32-m68hc1x.c:1297
+#: elf32-m68hc1x.c:1235
msgid "%B: linking files compiled for HCS12 with others compiled for HC12"
msgstr ""
-#: elf32-m68hc1x.c:1313 elf32-ppc.c:3576 elf64-sparc.c:696 elfxx-mips.c:9894
+#: elf32-m68hc1x.c:1251 elf32-ppc.c:3733 elf64-sparc.c:696 elfxx-mips.c:11271
msgid "%B: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"
msgstr ""
-#: elf32-m68hc1x.c:1341
+#: elf32-m68hc1x.c:1279
#, c-format
msgid "[abi=32-bit int, "
msgstr ""
-#: elf32-m68hc1x.c:1343
+#: elf32-m68hc1x.c:1281
#, c-format
msgid "[abi=16-bit int, "
msgstr ""
-#: elf32-m68hc1x.c:1346
+#: elf32-m68hc1x.c:1284
#, c-format
msgid "64-bit double, "
msgstr ""
-#: elf32-m68hc1x.c:1348
+#: elf32-m68hc1x.c:1286
#, c-format
msgid "32-bit double, "
msgstr ""
-#: elf32-m68hc1x.c:1351
+#: elf32-m68hc1x.c:1289
#, c-format
msgid "cpu=HC11]"
msgstr ""
-#: elf32-m68hc1x.c:1353
+#: elf32-m68hc1x.c:1291
#, c-format
msgid "cpu=HCS12]"
msgstr ""
-#: elf32-m68hc1x.c:1355
+#: elf32-m68hc1x.c:1293
#, c-format
msgid "cpu=HC12]"
msgstr ""
-#: elf32-m68hc1x.c:1358
+#: elf32-m68hc1x.c:1296
#, c-format
msgid " [memory=bank-model]"
msgstr ""
-#: elf32-m68hc1x.c:1360
+#: elf32-m68hc1x.c:1298
#, c-format
msgid " [memory=flat]"
msgstr ""
-#: elf32-m68k.c:431
-#, c-format
-msgid " [cpu32]"
+#: elf32-m68k.c:634 elf32-m68k.c:635
+msgid "unknown"
msgstr ""
-#: elf32-m68k.c:434
-#, c-format
-msgid " [m68000]"
-msgstr ""
-
-#: elf32-mcore.c:98 elf32-mcore.c:428
+#: elf32-mcore.c:98 elf32-mcore.c:441
msgid "%B: Relocation %s (%d) is not currently supported.\n"
msgstr ""
-#: elf32-mcore.c:414
+#: elf32-mcore.c:427
msgid "%B: Unknown relocation type %d\n"
msgstr ""
-#: elf32-mips.c:971 elf64-mips.c:1929 elfn32-mips.c:1774
-msgid "literal relocation occurs for an external symbol"
+#: elf32-mep.c:809
+msgid "%B and %B are for different cores"
msgstr ""
-#: elf32-mips.c:1011 elf64-mips.c:1972 elfn32-mips.c:1815
-msgid "32bits gp relative relocation occurs for an external symbol"
+#: elf32-mep.c:826
+msgid "%B and %B are for different configurations"
msgstr ""
-#: elf32-mips.c:1134 elf64-mips.c:2066 elfn32-mips.c:1915
+#: elf32-mep.c:864
#, c-format
-msgid "Linking mips16 objects into %s format is not supported"
+msgid "private flags = 0x%lx"
+msgstr ""
+
+#: elf32-mips.c:987 elf64-mips.c:1961 elfn32-mips.c:1806
+msgid "literal relocation occurs for an external symbol"
+msgstr ""
+
+#: elf32-mips.c:1027 elf32-score.c:483 elf64-mips.c:2004 elfn32-mips.c:1847
+msgid "32bits gp relative relocation occurs for an external symbol"
msgstr ""
-#: elf32-ppc.c:1652
+#: elf32-ppc.c:1680
#, c-format
msgid "generic linker can't handle %s"
msgstr ""
-#: elf32-ppc.c:2080
+#: elf32-ppc.c:2162
msgid "corrupt or empty %s section in %B"
msgstr ""
-#: elf32-ppc.c:2087
+#: elf32-ppc.c:2169
msgid "unable to read in %s section from %B"
msgstr ""
-#: elf32-ppc.c:2093
+#: elf32-ppc.c:2175
msgid "corrupt %s section in %B"
msgstr ""
-#: elf32-ppc.c:2136
+#: elf32-ppc.c:2218
msgid "warning: unable to set size of %s section in %B"
msgstr ""
-#: elf32-ppc.c:2183
+#: elf32-ppc.c:2266
msgid "failed to allocate space for new APUinfo section."
msgstr ""
-#: elf32-ppc.c:2202
+#: elf32-ppc.c:2285
msgid "failed to compute new APUinfo section."
msgstr ""
-#: elf32-ppc.c:2205
+#: elf32-ppc.c:2288
msgid "failed to install new APUinfo section."
msgstr ""
-#: elf32-ppc.c:2941
+#: elf32-ppc.c:3021
msgid "%B: relocation %s cannot be used when making a shared object"
msgstr ""
#. It does not make sense to have a procedure linkage
#. table entry for a local symbol.
-#: elf32-ppc.c:3211
+#: elf32-ppc.c:3291
msgid "%B(%A+0x%lx): %s reloc against local symbol"
msgstr ""
-#: elf32-ppc.c:3541
+#: elf32-ppc.c:3632 elf32-ppc.c:3636 elfxx-mips.c:11015 elfxx-mips.c:11034
+#: elfxx-mips.c:11049
+msgid "Warning: %B uses hard float, %B uses soft float"
+msgstr ""
+
+#: elf32-ppc.c:3639 elf32-ppc.c:3643 elfxx-mips.c:10996 elfxx-mips.c:11000
+msgid "Warning: %B uses unknown floating point ABI %d"
+msgstr ""
+
+#: elf32-ppc.c:3698
msgid ""
"%B: compiled with -mrelocatable and linked with modules compiled normally"
msgstr ""
-#: elf32-ppc.c:3549
+#: elf32-ppc.c:3706
msgid ""
"%B: compiled normally and linked with modules compiled with -mrelocatable"
msgstr ""
-#: elf32-ppc.c:5768 elf64-ppc.c:10186
+#: elf32-ppc.c:3792
+msgid "Using bss-plt due to %B"
+msgstr ""
+
+#: elf32-ppc.c:5997 elf64-ppc.c:10489
msgid "%B: unknown relocation type %d for symbol %s"
msgstr ""
-#: elf32-ppc.c:6018
+#: elf32-ppc.c:6247
msgid "%B(%A+0x%lx): non-zero addend on %s reloc against `%s'"
msgstr ""
-#: elf32-ppc.c:6365 elf32-ppc.c:6391 elf32-ppc.c:6450
+#: elf32-ppc.c:6592 elf32-ppc.c:6618 elf32-ppc.c:6677
msgid ""
"%B: the target (%s) of a %s relocation is in the wrong output section (%s)"
msgstr ""
-#: elf32-ppc.c:6505
+#: elf32-ppc.c:6732
msgid "%B: relocation %s is not yet supported for symbol %s."
msgstr ""
-#: elf32-ppc.c:6610 elf64-ppc.c:10872
+#: elf32-ppc.c:6840 elf64-ppc.c:11184
msgid "%B(%A+0x%lx): %s reloc against `%s': error %d"
msgstr ""
-#: elf32-s390.c:2253 elf64-s390.c:2225
+#: elf32-s390.c:2238 elf64-s390.c:2212
msgid "%B(%A+0x%lx): invalid instruction for TLS relocation %s"
msgstr ""
-#: elf32-sh64.c:218 elf64-sh64.c:2322
+#: elf32-score.c:1417 elfxx-mips.c:2695
+msgid "not enough GOT space for local GOT entries"
+msgstr ""
+
+#: elf32-score.c:2549
+#, c-format
+msgid "%s: Malformed reloc detected for section %s"
+msgstr ""
+
+#: elf32-score.c:2600
+msgid "%B: CALL15 reloc at 0x%lx not against global symbol"
+msgstr ""
+
+#: elf32-score.c:3755
+#, c-format
+msgid " [pic]"
+msgstr ""
+
+#: elf32-score.c:3759
+#, c-format
+msgid " [fix dep]"
+msgstr ""
+
+#: elf32-score.c:3801 elfxx-mips.c:11180
+msgid "%B: warning: linking PIC files with non-PIC files"
+msgstr ""
+
+#: elf32-sh64.c:221 elf64-sh64.c:2349
#, c-format
msgid "%s: compiled as 32-bit object and %s is 64-bit"
msgstr ""
-#: elf32-sh64.c:221 elf64-sh64.c:2325
+#: elf32-sh64.c:224 elf64-sh64.c:2352
#, c-format
msgid "%s: compiled as 64-bit object and %s is 32-bit"
msgstr ""
-#: elf32-sh64.c:223 elf64-sh64.c:2327
+#: elf32-sh64.c:226 elf64-sh64.c:2354
#, c-format
msgid "%s: object size does not match that of target %s"
msgstr ""
-#: elf32-sh64.c:446 elf64-sh64.c:2899
+#: elf32-sh64.c:449 elf64-sh64.c:2893
#, c-format
msgid "%s: encountered datalabel symbol in input"
msgstr ""
-#: elf32-sh64.c:523
+#: elf32-sh64.c:526
msgid "PTB mismatch: a SHmedia address (bit 0 == 1)"
msgstr ""
-#: elf32-sh64.c:526
+#: elf32-sh64.c:529
msgid "PTA mismatch: a SHcompact address (bit 0 == 0)"
msgstr ""
-#: elf32-sh64.c:544
+#: elf32-sh64.c:547
#, c-format
msgid "%s: GAS error: unexpected PTB insn with R_SH_PT_16"
msgstr ""
-#: elf32-sh64.c:593
+#: elf32-sh64.c:596
msgid "%B: error: unaligned relocation type %d at %08x reloc %p\n"
msgstr ""
-#: elf32-sh64.c:669
+#: elf32-sh64.c:672
#, c-format
msgid "%s: could not write out added .cranges entries"
msgstr ""
-#: elf32-sh64.c:729
+#: elf32-sh64.c:732
#, c-format
msgid "%s: could not write out sorted .cranges entries"
msgstr ""
-#: elf32-sh.c:2176
+#: elf32-sh.c:532
msgid "%B: 0x%lx: warning: bad R_SH_USES offset"
msgstr ""
-#: elf32-sh.c:2188
+#: elf32-sh.c:544
msgid "%B: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x"
msgstr ""
-#: elf32-sh.c:2205
+#: elf32-sh.c:561
msgid "%B: 0x%lx: warning: bad R_SH_USES load offset"
msgstr ""
-#: elf32-sh.c:2220
+#: elf32-sh.c:576
msgid "%B: 0x%lx: warning: could not find expected reloc"
msgstr ""
-#: elf32-sh.c:2248
+#: elf32-sh.c:604
msgid "%B: 0x%lx: warning: symbol in unexpected section"
msgstr ""
-#: elf32-sh.c:2361
+#: elf32-sh.c:730
msgid "%B: 0x%lx: warning: could not find expected COUNT reloc"
msgstr ""
-#: elf32-sh.c:2370
+#: elf32-sh.c:739
msgid "%B: 0x%lx: warning: bad count"
msgstr ""
-#: elf32-sh.c:2765 elf32-sh.c:3135
+#: elf32-sh.c:1143 elf32-sh.c:1513
msgid "%B: 0x%lx: fatal: reloc overflow while relaxing"
msgstr ""
-#: elf32-sh.c:4566 elf64-sh64.c:1509
+#: elf32-sh.c:3248 elf64-sh64.c:1525
msgid "Unexpected STO_SH5_ISA32 on local symbol is not handled"
msgstr ""
-#: elf32-sh.c:4791
+#: elf32-sh.c:3485
msgid "%B: 0x%lx: fatal: unaligned branch target for relax-support relocation"
msgstr ""
-#: elf32-sh.c:4824 elf32-sh.c:4839
+#: elf32-sh.c:3518 elf32-sh.c:3533
msgid "%B: 0x%lx: fatal: unaligned %s relocation 0x%lx"
msgstr ""
-#: elf32-sh.c:4853
+#: elf32-sh.c:3547
msgid "%B: 0x%lx: fatal: R_SH_PSHA relocation %d not in range -32..32"
msgstr ""
-#: elf32-sh.c:4867
+#: elf32-sh.c:3561
msgid "%B: 0x%lx: fatal: R_SH_PSHL relocation %d not in range -32..32"
msgstr ""
-#: elf32-sh.c:6601 elf64-alpha.c:4466
+#: elf32-sh.c:5274 elf64-alpha.c:4531
msgid "%B: TLS local exec code cannot be linked into shared objects"
msgstr ""
@@ -1581,57 +1708,138 @@ msgstr ""
msgid "%B: Failed to add renamed symbol %s"
msgstr ""
-#: elf32-sparc.c:87
+#: elf32-sparc.c:88
msgid "%B: compiled for a 64 bit system and target is 32 bit"
msgstr ""
-#: elf32-sparc.c:100
+#: elf32-sparc.c:101
msgid "%B: linking little endian files with big endian files"
msgstr ""
-#: elf32-v850.c:160
+#: elf32-spu.c:995
+msgid "warning: call to non-function symbol %s defined in %B"
+msgstr ""
+
+#: elf32-spu.c:1315
+msgid "%B is not allowed to define %s"
+msgstr ""
+
+#: elf32-spu.c:1352
+#, c-format
+msgid "%s in overlay section"
+msgstr ""
+
+#: elf32-spu.c:1363
+msgid "overlay stub relocation overflow"
+msgstr ""
+
+#: elf32-spu.c:1820
+#, c-format
+msgid "warning: %s overlaps %s\n"
+msgstr ""
+
+#: elf32-spu.c:1836
+#, c-format
+msgid "warning: %s exceeds section size\n"
+msgstr ""
+
+#: elf32-spu.c:1867
+msgid "%A:0x%v not found in function table\n"
+msgstr ""
+
+#: elf32-spu.c:1958
+msgid ""
+"%B(%A+0x%v): call to non-code section %B(%A), stack analysis incomplete\n"
+msgstr ""
+
+#: elf32-spu.c:2079
+#, c-format
+msgid "%A link_order not found\n"
+msgstr ""
+
+#: elf32-spu.c:2358
+#, c-format
+msgid "Stack analysis will ignore the call from %s to %s\n"
+msgstr ""
+
+#: elf32-spu.c:2513
+msgid "%s: 0x%v 0x%v\n"
+msgstr ""
+
+#: elf32-spu.c:2517
+msgid " calls:\n"
+msgstr ""
+
+#: elf32-spu.c:2524
+#, c-format
+msgid " %s%s %s\n"
+msgstr ""
+
+#: elf32-spu.c:2585
+msgid "Stack size for call graph root nodes.\n"
+msgstr ""
+
+#: elf32-spu.c:2586
+msgid ""
+"\n"
+"Stack size for functions. Annotations: '*' max stack, 't' tail call\n"
+msgstr ""
+
+#: elf32-spu.c:2615
+msgid " %s: 0x%v\n"
+msgstr ""
+
+#: elf32-spu.c:2625
+msgid "Maximum stack required is 0x%v\n"
+msgstr ""
+
+#: elf32-spu.c:2751
+msgid "%B(%s+0x%lx): unresolvable %s relocation against symbol `%s'"
+msgstr ""
+
+#: elf32-v850.c:162
#, c-format
msgid "Variable `%s' cannot occupy in multiple small data regions"
msgstr ""
-#: elf32-v850.c:163
+#: elf32-v850.c:165
#, c-format
msgid ""
"Variable `%s' can only be in one of the small, zero, and tiny data regions"
msgstr ""
-#: elf32-v850.c:166
+#: elf32-v850.c:168
#, c-format
msgid ""
"Variable `%s' cannot be in both small and zero data regions simultaneously"
msgstr ""
-#: elf32-v850.c:169
+#: elf32-v850.c:171
#, c-format
msgid ""
"Variable `%s' cannot be in both small and tiny data regions simultaneously"
msgstr ""
-#: elf32-v850.c:172
+#: elf32-v850.c:174
#, c-format
msgid ""
"Variable `%s' cannot be in both zero and tiny data regions simultaneously"
msgstr ""
-#: elf32-v850.c:475
+#: elf32-v850.c:477
#, c-format
msgid "FAILED to find previous HI16 reloc\n"
msgstr ""
-#: elf32-v850.c:1684
+#: elf32-v850.c:1712
msgid "could not locate special linker symbol __gp"
msgstr ""
-#: elf32-v850.c:1688
+#: elf32-v850.c:1716
msgid "could not locate special linker symbol __ep"
msgstr ""
-#: elf32-v850.c:1692
+#: elf32-v850.c:1720
msgid "could not locate special linker symbol __ctbp"
msgstr ""
@@ -1659,145 +1867,144 @@ msgstr ""
msgid "v850e1 architecture"
msgstr ""
-#: elf32-vax.c:531
+#: elf32-vax.c:540
#, c-format
msgid " [nonpic]"
msgstr ""
-#: elf32-vax.c:534
+#: elf32-vax.c:543
#, c-format
msgid " [d-float]"
msgstr ""
-#: elf32-vax.c:537
+#: elf32-vax.c:546
#, c-format
msgid " [g-float]"
msgstr ""
-#: elf32-vax.c:647
+#: elf32-vax.c:656
#, c-format
msgid ""
"%s: warning: GOT addend of %ld to `%s' does not match previous GOT addend of "
"%ld"
msgstr ""
-#: elf32-vax.c:1604
+#: elf32-vax.c:1583
#, c-format
msgid "%s: warning: PLT addend of %d to `%s' from %s section ignored"
msgstr ""
-#: elf32-vax.c:1728
+#: elf32-vax.c:1720
#, c-format
msgid "%s: warning: %s relocation against symbol `%s' from %s section"
msgstr ""
-#: elf32-vax.c:1734
+#: elf32-vax.c:1726
#, c-format
msgid "%s: warning: %s relocation to 0x%x from %s section"
msgstr ""
-#: elf32-xstormy16.c:425 elf32-ia64.c:2563 elf64-ia64.c:2563
+#: elf32-xstormy16.c:451 elf32-ia64.c:2961 elf64-ia64.c:2961
msgid "non-zero addend in @fptr reloc"
msgstr ""
-#: elf32-xtensa.c:705
+#: elf32-xtensa.c:733
msgid "%B(%A): invalid property table"
msgstr ""
-#: elf32-xtensa.c:2199
+#: elf32-xtensa.c:2177
msgid "%B(%A+0x%lx): relocation offset out of range (size=0x%x)"
msgstr ""
-#: elf32-xtensa.c:2256
+#: elf32-xtensa.c:2234
msgid "dynamic relocation in read-only section"
msgstr ""
-#: elf32-xtensa.c:2421
+#: elf32-xtensa.c:2407
msgid "internal inconsistency in size of .got.loc section"
msgstr ""
-#: elf32-xtensa.c:2735
+#: elf32-xtensa.c:2714
msgid "%B: incompatible machine type. Output is 0x%x. Input is 0x%x"
msgstr ""
-#: elf32-xtensa.c:3881 elf32-xtensa.c:3889
+#: elf32-xtensa.c:3920 elf32-xtensa.c:3928
msgid "Attempt to convert L32R/CALLX to CALL failed"
msgstr ""
-#: elf32-xtensa.c:5467 elf32-xtensa.c:5543 elf32-xtensa.c:6496
-#: elf32-xtensa.c:6550
+#: elf32-xtensa.c:5522 elf32-xtensa.c:5598 elf32-xtensa.c:6714
msgid ""
"%B(%A+0x%lx): could not decode instruction; possible configuration mismatch"
msgstr ""
-#: elf32-xtensa.c:6369 elf32-xtensa.c:6532
+#: elf32-xtensa.c:6454
msgid ""
"%B(%A+0x%lx): could not decode instruction for XTENSA_ASM_SIMPLIFY "
"relocation; possible configuration mismatch"
msgstr ""
-#: elf32-xtensa.c:7855
+#: elf32-xtensa.c:8166
msgid "invalid relocation address"
msgstr ""
-#: elf32-xtensa.c:7904
+#: elf32-xtensa.c:8215
msgid "overflow after relaxation"
msgstr ""
-#: elf32-xtensa.c:9032
+#: elf32-xtensa.c:9341
msgid "%B(%A+0x%lx): unexpected fix for %s relocation"
msgstr ""
-#: elf64-alpha.c:443
+#: elf64-alpha.c:451
msgid "GPDISP relocation did not find ldah and lda instructions"
msgstr ""
-#: elf64-alpha.c:2363
+#: elf64-alpha.c:2402
msgid "%B: .got subsegment exceeds 64K (size %d)"
msgstr ""
-#: elf64-alpha.c:4210 elf64-alpha.c:4222
+#: elf64-alpha.c:4275 elf64-alpha.c:4287
msgid "%B: gp-relative relocation against dynamic symbol %s"
msgstr ""
-#: elf64-alpha.c:4248 elf64-alpha.c:4383
+#: elf64-alpha.c:4313 elf64-alpha.c:4448
msgid "%B: pc-relative relocation against dynamic symbol %s"
msgstr ""
-#: elf64-alpha.c:4276
+#: elf64-alpha.c:4341
msgid "%B: change in gp: BRSGP %s"
msgstr ""
-#: elf64-alpha.c:4301
+#: elf64-alpha.c:4366
msgid "<unknown>"
msgstr ""
-#: elf64-alpha.c:4306
+#: elf64-alpha.c:4371
msgid "%B: !samegp reloc against symbol without .prologue: %s"
msgstr ""
-#: elf64-alpha.c:4358
+#: elf64-alpha.c:4423
msgid "%B: unhandled dynamic relocation against %s"
msgstr ""
-#: elf64-alpha.c:4390
+#: elf64-alpha.c:4455
msgid "%B: pc-relative relocation against undefined weak symbol %s"
msgstr ""
-#: elf64-alpha.c:4450
+#: elf64-alpha.c:4515
msgid "%B: dtp-relative relocation against dynamic symbol %s"
msgstr ""
-#: elf64-alpha.c:4473
+#: elf64-alpha.c:4538
msgid "%B: tp-relative relocation against dynamic symbol %s"
msgstr ""
-#: elf64-hppa.c:2046
+#: elf64-hppa.c:2039
#, c-format
msgid "stub entry for %s cannot load .plt, dp offset = %ld"
msgstr ""
-#: elf64-mmix.c:1163
+#: elf64-mmix.c:1175
#, c-format
msgid ""
"%s: Internal inconsistency error for value for\n"
@@ -1805,126 +2012,122 @@ msgid ""
"08lx\n"
msgstr ""
-#: elf64-mmix.c:1602
+#: elf64-mmix.c:1616
#, c-format
msgid ""
"%s: base-plus-offset relocation against register symbol: (unknown) in %s"
msgstr ""
-#: elf64-mmix.c:1607
+#: elf64-mmix.c:1621
#, c-format
msgid "%s: base-plus-offset relocation against register symbol: %s in %s"
msgstr ""
-#: elf64-mmix.c:1651
+#: elf64-mmix.c:1665
#, c-format
msgid "%s: register relocation against non-register symbol: (unknown) in %s"
msgstr ""
-#: elf64-mmix.c:1656
+#: elf64-mmix.c:1670
#, c-format
msgid "%s: register relocation against non-register symbol: %s in %s"
msgstr ""
-#: elf64-mmix.c:1693
+#: elf64-mmix.c:1707
#, c-format
msgid "%s: directive LOCAL valid only with a register or absolute value"
msgstr ""
-#: elf64-mmix.c:1721
+#: elf64-mmix.c:1735
#, c-format
msgid ""
"%s: LOCAL directive: Register $%ld is not a local register. First global "
"register is $%ld."
msgstr ""
-#: elf64-mmix.c:2207
+#: elf64-mmix.c:2200
#, c-format
msgid ""
"%s: Error: multiple definition of `%s'; start of %s is set in a earlier "
"linked file\n"
msgstr ""
-#: elf64-mmix.c:2265
+#: elf64-mmix.c:2258
msgid "Register section has contents\n"
msgstr ""
-#: elf64-mmix.c:2457
+#: elf64-mmix.c:2450
#, c-format
msgid ""
"Internal inconsistency: remaining %u != max %u.\n"
" Please report this bug."
msgstr ""
-#: elf64-ppc.c:2500 libbfd.c:931
+#: elf64-ppc.c:2568 libbfd.c:948
msgid "%B: compiled for a big endian system and target is little endian"
msgstr ""
-#: elf64-ppc.c:2503 libbfd.c:933
+#: elf64-ppc.c:2571 libbfd.c:950
msgid "%B: compiled for a little endian system and target is big endian"
msgstr ""
-#: elf64-ppc.c:5707
+#: elf64-ppc.c:5887
#, c-format
msgid ""
"copy reloc against `%s' requires lazy plt linking; avoid setting "
"LD_BIND_NOW=1 or upgrade gcc"
msgstr ""
-#: elf64-ppc.c:6155
+#: elf64-ppc.c:6315
msgid "dynreloc miscount for %B, section %A"
msgstr ""
-#: elf64-ppc.c:6257
+#: elf64-ppc.c:6419
msgid "%B: .opd is not a regular array of opd entries"
msgstr ""
-#: elf64-ppc.c:6266
+#: elf64-ppc.c:6428
msgid "%B: unexpected reloc type %u in .opd section"
msgstr ""
-#: elf64-ppc.c:6287
+#: elf64-ppc.c:6449
msgid "%B: undefined sym `%s' in .opd section"
msgstr ""
-#: elf64-ppc.c:6939 elf64-ppc.c:7318
+#: elf64-ppc.c:7156 elf64-ppc.c:7536
#, c-format
msgid "%s defined in removed toc entry"
msgstr ""
-#: elf64-ppc.c:8041
+#: elf64-ppc.c:8271
#, c-format
msgid "long branch stub `%s' offset overflow"
msgstr ""
-#: elf64-ppc.c:8116
+#: elf64-ppc.c:8346
#, c-format
msgid "can't find branch stub `%s'"
msgstr ""
-#: elf64-ppc.c:8155 elf64-ppc.c:8231
+#: elf64-ppc.c:8412 elf64-ppc.c:8488
#, c-format
msgid "linkage table error against `%s'"
msgstr ""
-#: elf64-ppc.c:8360
+#: elf64-ppc.c:8617
#, c-format
msgid "can't build branch stub `%s'"
msgstr ""
-#: elf64-ppc.c:8784
+#: elf64-ppc.c:9069
msgid "%B section %A exceeds stub group size"
msgstr ""
-#: elf64-ppc.c:9295
-msgid ".glink and .plt too far apart"
-msgstr ""
-
-#: elf64-ppc.c:9408
+#: elf64-ppc.c:9681
msgid "stubs don't match calculated size"
msgstr ""
-#: elf64-ppc.c:9420
+#: elf64-ppc.c:9693
#, c-format
msgid ""
"linker stubs in %u group%s\n"
@@ -1935,28 +2138,28 @@ msgid ""
" plt call %lu"
msgstr ""
-#: elf64-ppc.c:10075
+#: elf64-ppc.c:10377
msgid ""
"%B(%A+0x%lx): automatic multiple TOCs not supported using your crt files; "
"recompile with -mminimal-toc or upgrade gcc"
msgstr ""
-#: elf64-ppc.c:10083
+#: elf64-ppc.c:10385
msgid ""
"%B(%A+0x%lx): sibling call optimization to `%s' does not allow automatic "
"multiple TOCs; recompile with -mminimal-toc or -fno-optimize-sibling-calls, "
"or make `%s' extern"
msgstr ""
-#: elf64-ppc.c:10727
+#: elf64-ppc.c:11036
msgid "%B: relocation %s is not supported for symbol %s."
msgstr ""
-#: elf64-ppc.c:10806
+#: elf64-ppc.c:11118
msgid "%B: error: relocation %s not a multiple of %d"
msgstr ""
-#: elf64-sh64.c:1676
+#: elf64-sh64.c:1700
#, c-format
msgid "%s: error: unaligned relocation type %d at %08x reloc %08x\n"
msgstr ""
@@ -1981,471 +2184,519 @@ msgstr ""
msgid "%B: linking UltraSPARC specific with HAL specific code"
msgstr ""
-#: elf64-x86-64.c:692 elf64-x86-64.c:818 elf64-x86-64.c:2069
+#: elf64-x86-64.c:798 elf64-x86-64.c:958 elf64-x86-64.c:2359
msgid ""
"%B: relocation %s against `%s' can not be used when making a shared object; "
"recompile with -fPIC"
msgstr ""
-#: elf64-x86-64.c:760
+#: elf64-x86-64.c:889
msgid "%B: %s' accessed both as normal and thread local symbol"
msgstr ""
-#: elf64-x86-64.c:2000
+#: elf64-x86-64.c:2271
msgid ""
"%B: relocation R_X86_64_GOTOFF64 against protected function `%s' can not be "
"used when making a shared object"
msgstr ""
-#: elf64-x86-64.c:2065
+#: elf64-x86-64.c:2355
msgid ""
"%B: relocation R_X86_64_PC32 against protected function `%s' can not be used "
"when making a shared object"
msgstr ""
-#: elf.c:288
+#: elf-attrs.c:581
+msgid "ERROR: %B: Must be processed by '%s' toolchain"
+msgstr ""
+
+#: elf-attrs.c:601 elf-attrs.c:620
+msgid "ERROR: %B: Incompatible object tag '%s':%d"
+msgstr ""
+
+#: elf.c:309
msgid "%B: invalid string offset %u >= %lu for section `%s'"
msgstr ""
-#: elf.c:552
+#: elf.c:411
+msgid "%B symbol number %lu references nonexistent SHT_SYMTAB_SHNDX section"
+msgstr ""
+
+#: elf.c:564
+msgid "%B: Corrupt size field in group section header: 0x%lx"
+msgstr ""
+
+#: elf.c:600
msgid "%B: invalid SHT_GROUP entry"
msgstr ""
-#: elf.c:622
+#: elf.c:670
msgid "%B: no group info for section %A"
msgstr ""
-#: elf.c:652 elf.c:3091 elflink.c:7588
+#: elf.c:700 elf.c:3251 elflink.c:9120
msgid "%B: warning: sh_link not set for section `%A'"
msgstr ""
-#: elf.c:688
+#: elf.c:716
+msgid "%B: sh_link [%d] in section `%A' is incorrect"
+msgstr ""
+
+#: elf.c:751
msgid "%B: unknown [%d] section `%s' in group [%s]"
msgstr ""
-#: elf.c:1071
+#: elf.c:1160
#, c-format
msgid ""
"\n"
"Program Header:\n"
msgstr ""
-#: elf.c:1123
+#: elf.c:1202
#, c-format
msgid ""
"\n"
"Dynamic Section:\n"
msgstr ""
-#: elf.c:1248
+#: elf.c:1328
#, c-format
msgid ""
"\n"
"Version definitions:\n"
msgstr ""
-#: elf.c:1273
+#: elf.c:1353
#, c-format
msgid ""
"\n"
"Version References:\n"
msgstr ""
-#: elf.c:1278
+#: elf.c:1358
#, c-format
msgid " required from %s:\n"
msgstr ""
-#: elf.c:1985
+#: elf.c:2054
msgid "%B: invalid link %lu for reloc section %s (index %u)"
msgstr ""
-#: elf.c:3062
+#: elf.c:2222
+msgid ""
+"%B: don't know how to handle allocated, application specific section `%s' [0x"
+"%8x]"
+msgstr ""
+
+#: elf.c:2234
+msgid "%B: don't know how to handle processor specific section `%s' [0x%8x]"
+msgstr ""
+
+#: elf.c:2245
+msgid "%B: don't know how to handle OS specific section `%s' [0x%8x]"
+msgstr ""
+
+#: elf.c:2255
+msgid "%B: don't know how to handle section `%s' [0x%8x]"
+msgstr ""
+
+#: elf.c:3208
msgid "%B: sh_link of section `%A' points to discarded section `%A' of `%B'"
msgstr ""
-#: elf.c:4070
-msgid "%B: Not enough room for program headers (allocated %u, need %u)"
+#: elf.c:3231
+msgid "%B: sh_link of section `%A' points to removed section `%A' of `%B'"
msgstr ""
-#: elf.c:4173
+#: elf.c:4472
msgid ""
"%B: The first section in the PT_DYNAMIC segment is not the .dynamic section"
msgstr ""
-#: elf.c:4217
+#: elf.c:4495
msgid "%B: Not enough room for program headers, try linking with -N"
msgstr ""
-#: elf.c:4308
+#: elf.c:4573
msgid "%B: section %A lma 0x%lx overlaps previous sections"
msgstr ""
-#: elf.c:4709
+#: elf.c:4671
+msgid "%B: section `%A' can't be allocated in segment %d"
+msgstr ""
+
+#: elf.c:4720
msgid "%B: warning: allocated section `%s' not in segment"
msgstr ""
-#: elf.c:5002
+#: elf.c:5209
msgid "%B: symbol `%s' required but not present"
msgstr ""
-#: elf.c:5299
+#: elf.c:5522
msgid "%B: warning: Empty loadable segment detected, is this intentional ?\n"
msgstr ""
-#: elf.c:5961
+#: elf.c:6425
#, c-format
msgid ""
"Unable to find equivalent output section for symbol '%s' from section '%s'"
msgstr ""
-#: elf.c:6917
+#: elf.c:7399
msgid "%B: unsupported relocation type %s"
msgstr ""
-#: elfcode.h:1110
+#: elfcode.h:810
+#, c-format
+msgid "warning: %s has a corrupt string table index - ignoring"
+msgstr ""
+
+#: elfcode.h:1176
#, c-format
msgid "%s: version count (%ld) does not match symbol count (%ld)"
msgstr ""
-#: elfcode.h:1337
+#: elfcode.h:1409
#, c-format
msgid "%s(%s): relocation %d has invalid symbol index %ld"
msgstr ""
-#: elf-hppa.h:1443 elf-hppa.h:1458
+#: elf-eh-frame.c:822
+msgid ""
+"%P: fde encoding in %B(%A) prevents .eh_frame_hdr table being created.\n"
+msgstr ""
+
+#: elf-eh-frame.c:973
+msgid "%P: error in %B(%A); no .eh_frame_hdr table will be created.\n"
+msgstr ""
+
+#: elf-hppa.h:2218 elf-hppa.h:2232
msgid "%B(%A): warning: unresolvable relocation against symbol `%s'"
msgstr ""
-#: elflink.c:907
+#: elflink.c:1004
msgid ""
"%s: TLS definition in %B section %A mismatches non-TLS definition in %B "
"section %A"
msgstr ""
-#: elflink.c:911
+#: elflink.c:1008
msgid "%s: TLS reference in %B mismatches non-TLS reference in %B"
msgstr ""
-#: elflink.c:915
+#: elflink.c:1012
msgid "%s: TLS definition in %B section %A mismatches non-TLS reference in %B"
msgstr ""
-#: elflink.c:919
+#: elflink.c:1016
msgid "%s: TLS reference in %B mismatches non-TLS definition in %B section %A"
msgstr ""
-#: elflink.c:1491
+#: elflink.c:1630
msgid "%B: unexpected redefinition of indirect versioned symbol `%s'"
msgstr ""
-#: elflink.c:1807
-msgid "%B: undefined versioned symbol name %s"
+#: elflink.c:1950
+msgid "%B: version node not found for symbol %s"
msgstr ""
-#: elflink.c:1955
+#: elflink.c:2098
msgid ""
"%B: bad reloc symbol index (0x%lx >= 0x%lx) for offset 0x%lx in section `%A'"
msgstr ""
-#: elflink.c:2147
+#: elflink.c:2290
msgid "%B: relocation size mismatch in %B section %A"
msgstr ""
-#: elflink.c:2437
+#: elflink.c:2598
#, c-format
msgid "warning: type and size of dynamic symbol `%s' are not defined"
msgstr ""
-#: elflink.c:2761
-msgid "warning: creating a DT_TEXTREL in a shared object."
-msgstr ""
-
-#: elflink.c:3696
+#: elflink.c:3893
msgid "%B: %s: invalid version %u (max %d)"
msgstr ""
-#: elflink.c:3732
+#: elflink.c:3929
msgid "%B: %s: invalid needed version %d"
msgstr ""
-#: elflink.c:3912
+#: elflink.c:4112
+msgid ""
+"Warning: alignment %u of common symbol `%s' in %B is greater than the "
+"alignment (%u) of its section %A"
+msgstr ""
+
+#: elflink.c:4118
msgid "Warning: alignment %u of symbol `%s' in %B is smaller than %u in %B"
msgstr ""
-#: elflink.c:3924
+#: elflink.c:4133
msgid "Warning: size of symbol `%s' changed from %lu in %B to %lu in %B"
msgstr ""
-#: elflink.c:4091
+#: elflink.c:4309
#, c-format
msgid "%s: invalid DSO for symbol `%s' definition"
msgstr ""
-#: elflink.c:5152
+#: elflink.c:5535
#, c-format
msgid "%s: undefined version: %s"
msgstr ""
-#: elflink.c:5219
+#: elflink.c:5603
msgid "%B: .preinit_array section is not allowed in DSO"
msgstr ""
-#: elflink.c:5978
+#: elflink.c:6621
+#, c-format
+msgid "undefined %s reference in complex symbol: %s"
+msgstr ""
+
+#: elflink.c:6776
+#, c-format
+msgid "unknown operator '%c' in complex symbol"
+msgstr ""
+
+#: elflink.c:7315 elflink.c:7332 elflink.c:7369 elflink.c:7386
+msgid "%B: Unable to sort relocs - they are in more than one size"
+msgstr ""
+
+#: elflink.c:7346 elflink.c:7400
+msgid "%B: Unable to sort relocs - they are of an unknown size"
+msgstr ""
+
+#: elflink.c:7449
msgid "Not enough memory to sort relocations"
msgstr ""
-#: elflink.c:6369
+#: elflink.c:7636
+msgid "%B: Too many sections: %d (>= %d)"
+msgstr ""
+
+#: elflink.c:7870
msgid "%B: %s symbol `%s' in %B is referenced by DSO"
msgstr ""
-#: elflink.c:6452
+#: elflink.c:7953
msgid "%B: could not find output section %A for input section %A"
msgstr ""
-#: elflink.c:6549
+#: elflink.c:8050
msgid "%B: %s symbol `%s' isn't defined"
msgstr ""
-#: elflink.c:7024
+#: elflink.c:8546
msgid ""
"error: %B contains a reloc (0x%s) for section %A that references a non-"
"existent global symbol"
msgstr ""
-#: elflink.c:7058
+#: elflink.c:8580
msgid ""
"%X`%s' referenced in section `%A' of %B: defined in discarded section `%A' "
"of %B\n"
msgstr ""
-#: elflink.c:7665
+#: elflink.c:9198
msgid "%A has both ordered [`%A' in %B] and unordered [`%A' in %B] sections"
msgstr ""
-#: elflink.c:7670
+#: elflink.c:9203
#, c-format
msgid "%A has both ordered and unordered sections"
msgstr ""
-#: elflink.c:8487 elflink.c:8528
+#: elflink.c:10090 elflink.c:10134
msgid "%B: could not find output section %s"
msgstr ""
-#: elflink.c:8492
+#: elflink.c:10095
#, c-format
msgid "warning: %s section has zero size"
msgstr ""
-#: elflink.c:9087
+#: elflink.c:10199
+msgid "%P: warning: creating a DT_TEXTREL in a shared object.\n"
+msgstr ""
+
+#: elflink.c:10567
+msgid "Removing unused section '%s' in file '%B'"
+msgstr ""
+
+#: elflink.c:10758
msgid "Warning: gc-sections option ignored"
msgstr ""
-#: elflink.c:9704
+#: elflink.c:11249
+msgid "%P%X: can not read symbols: %E\n"
+msgstr ""
+
+#: elflink.c:11391
msgid "%B: ignoring duplicate section `%A'"
msgstr ""
-#: elflink.c:9711 elflink.c:9718
+#: elflink.c:11398 elflink.c:11405
msgid "%B: duplicate section `%A' has different size"
msgstr ""
-#: elflink.c:9726 elflink.c:9731
+#: elflink.c:11413 elflink.c:11418
msgid "%B: warning: could not read contents of section `%A'"
msgstr ""
-#: elflink.c:9735
+#: elflink.c:11422
msgid "%B: warning: duplicate section `%A' has different contents"
msgstr ""
-#: elfxx-mips.c:866
-msgid "static procedure (no name)"
+#: elf-m10300.c:1531
+msgid ""
+"error: inappropriate relocation type for shared library (did you forget -"
+"fpic?)"
msgstr ""
-#: elfxx-mips.c:2513
-msgid "not enough GOT space for local GOT entries"
+#: elf-m10300.c:1534
+msgid "internal error: suspicious relocation type used in shared library"
+msgstr ""
+
+#: elfxx-mips.c:986
+msgid "static procedure (no name)"
msgstr ""
-#: elfxx-mips.c:4356
+#: elfxx-mips.c:4657
msgid "%B: %A+0x%lx: jump to stub routine which is not jal"
msgstr ""
-#: elfxx-mips.c:4993 elfxx-mips.c:5214
+#: elfxx-mips.c:5320 elfxx-mips.c:5540
msgid "%B: Warning: bad `%s' option size %u smaller than its header"
msgstr ""
-#: elfxx-mips.c:5965
+#: elfxx-mips.c:6399
msgid "%B: Malformed reloc detected for section %s"
msgstr ""
-#: elfxx-mips.c:6041
+#: elfxx-mips.c:6441
+msgid "%B: GOT reloc at 0x%lx not expected in executables"
+msgstr ""
+
+#: elfxx-mips.c:6511
msgid "%B: CALL16 reloc at 0x%lx not against global symbol"
msgstr ""
-#: elfxx-mips.c:9380
+#: elfxx-mips.c:7874
+msgid ""
+"%B: Can't find matching LO16 reloc against `%s' for %s at 0x%lx in section `%"
+"A'"
+msgstr ""
+
+#: elfxx-mips.c:10640
#, c-format
msgid "%s: illegal section name `%s'"
msgstr ""
-#: elfxx-mips.c:9719
-msgid "%B: endianness incompatible with that of the selected emulation"
+#: elfxx-mips.c:11010 elfxx-mips.c:11029
+msgid "Warning: %B uses -msingle-float, %B uses -mdouble-float"
msgstr ""
-#: elfxx-mips.c:9731
-msgid "%B: ABI is incompatible with that of the selected emulation"
+#: elfxx-mips.c:11085
+msgid "%B: endianness incompatible with that of the selected emulation"
msgstr ""
-#: elfxx-mips.c:9803
-msgid "%B: warning: linking PIC files with non-PIC files"
+#: elfxx-mips.c:11097
+msgid "%B: ABI is incompatible with that of the selected emulation"
msgstr ""
-#: elfxx-mips.c:9820
+#: elfxx-mips.c:11197
msgid "%B: linking 32-bit code with 64-bit code"
msgstr ""
-#: elfxx-mips.c:9848
+#: elfxx-mips.c:11225
msgid "%B: linking %s module with previous %s modules"
msgstr ""
-#: elfxx-mips.c:9871
+#: elfxx-mips.c:11248
msgid "%B: ABI mismatch: linking %s module with previous %s modules"
msgstr ""
-#: elfxx-mips.c:9936
+#: elfxx-mips.c:11313
#, c-format
msgid " [abi=O32]"
msgstr ""
-#: elfxx-mips.c:9938
+#: elfxx-mips.c:11315
#, c-format
msgid " [abi=O64]"
msgstr ""
-#: elfxx-mips.c:9940
+#: elfxx-mips.c:11317
#, c-format
msgid " [abi=EABI32]"
msgstr ""
-#: elfxx-mips.c:9942
+#: elfxx-mips.c:11319
#, c-format
msgid " [abi=EABI64]"
msgstr ""
-#: elfxx-mips.c:9944
+#: elfxx-mips.c:11321
#, c-format
msgid " [abi unknown]"
msgstr ""
-#: elfxx-mips.c:9946
+#: elfxx-mips.c:11323
#, c-format
msgid " [abi=N32]"
msgstr ""
-#: elfxx-mips.c:9948
+#: elfxx-mips.c:11325
#, c-format
msgid " [abi=64]"
msgstr ""
-#: elfxx-mips.c:9950
+#: elfxx-mips.c:11327
#, c-format
msgid " [no abi set]"
msgstr ""
-#: elfxx-mips.c:9953
-#, c-format
-msgid " [mips1]"
-msgstr ""
-
-#: elfxx-mips.c:9955
-#, c-format
-msgid " [mips2]"
-msgstr ""
-
-#: elfxx-mips.c:9957
-#, c-format
-msgid " [mips3]"
-msgstr ""
-
-#: elfxx-mips.c:9959
-#, c-format
-msgid " [mips4]"
-msgstr ""
-
-#: elfxx-mips.c:9961
-#, c-format
-msgid " [mips5]"
-msgstr ""
-
-#: elfxx-mips.c:9963
-#, c-format
-msgid " [mips32]"
-msgstr ""
-
-#: elfxx-mips.c:9965
-#, c-format
-msgid " [mips64]"
-msgstr ""
-
-#: elfxx-mips.c:9967
-#, c-format
-msgid " [mips32r2]"
-msgstr ""
-
-#: elfxx-mips.c:9969
-#, c-format
-msgid " [mips64r2]"
-msgstr ""
-
-#: elfxx-mips.c:9971
+#: elfxx-mips.c:11348
#, c-format
msgid " [unknown ISA]"
msgstr ""
-#: elfxx-mips.c:9974
-#, c-format
-msgid " [mdmx]"
-msgstr ""
-
-#: elfxx-mips.c:9977
-#, c-format
-msgid " [mips16]"
-msgstr ""
-
-#: elfxx-mips.c:9980
-#, c-format
-msgid " [32bitmode]"
-msgstr ""
-
-#: elfxx-mips.c:9982
+#: elfxx-mips.c:11359
#, c-format
msgid " [not 32bitmode]"
msgstr ""
-#: elfxx-sparc.c:402
+#: elfxx-sparc.c:428
#, c-format
msgid "invalid relocation type %d"
msgstr ""
-#: elfxx-sparc.c:2783
+#: elfxx-sparc.c:2899
msgid "%B: probably compiled without -fPIC?"
msgstr ""
-#: i386linux.c:457 m68klinux.c:461 sparclinux.c:458
+#: i386linux.c:454 m68klinux.c:458 sparclinux.c:453
#, c-format
msgid "Output file requires shared library `%s'\n"
msgstr ""
-#: i386linux.c:465 m68klinux.c:469 sparclinux.c:466
+#: i386linux.c:462 m68klinux.c:466 sparclinux.c:461
#, c-format
msgid "Output file requires shared library `%s.so.%s'\n"
msgstr ""
-#: i386linux.c:654 i386linux.c:704 m68klinux.c:661 m68klinux.c:709
-#: sparclinux.c:656 sparclinux.c:706
+#: i386linux.c:651 i386linux.c:701 m68klinux.c:658 m68klinux.c:706
+#: sparclinux.c:651 sparclinux.c:701
#, c-format
msgid "Symbol %s not defined for fixups\n"
msgstr ""
-#: i386linux.c:728 m68klinux.c:733 sparclinux.c:730
+#: i386linux.c:725 m68klinux.c:730 sparclinux.c:725
msgid "Warning: fixup count mismatch\n"
msgstr ""
@@ -2479,161 +2730,161 @@ msgstr ""
msgid "%B:%u: bad checksum in Intel Hex file (expected %u, found %u)"
msgstr ""
-#: ihex.c:389
+#: ihex.c:390
msgid "%B:%u: bad extended address record length in Intel Hex file"
msgstr ""
-#: ihex.c:406
+#: ihex.c:407
msgid "%B:%u: bad extended start address length in Intel Hex file"
msgstr ""
-#: ihex.c:423
+#: ihex.c:424
msgid "%B:%u: bad extended linear address record length in Intel Hex file"
msgstr ""
-#: ihex.c:440
+#: ihex.c:441
msgid "%B:%u: bad extended linear start address length in Intel Hex file"
msgstr ""
-#: ihex.c:457
+#: ihex.c:458
msgid "%B:%u: unrecognized ihex type %u in Intel Hex file"
msgstr ""
-#: ihex.c:578
+#: ihex.c:577
msgid "%B: internal error in ihex_read_section"
msgstr ""
-#: ihex.c:612
+#: ihex.c:611
msgid "%B: bad section length in ihex_read_section"
msgstr ""
-#: ihex.c:824
+#: ihex.c:823
#, c-format
msgid "%s: address 0x%s out of range for Intel Hex file"
msgstr ""
-#: libbfd.c:961
+#: libbfd.c:978
#, c-format
msgid "Deprecated %s called at %s line %d in %s\n"
msgstr ""
-#: libbfd.c:964
+#: libbfd.c:981
#, c-format
msgid "Deprecated %s called\n"
msgstr ""
-#: linker.c:1873
+#: linker.c:1877
msgid "%B: indirect symbol `%s' to `%s' is a loop"
msgstr ""
-#: linker.c:2740
+#: linker.c:2743
#, c-format
msgid "Attempt to do relocatable link with %s input and %s output"
msgstr ""
-#: linker.c:3037
+#: linker.c:3044
msgid "%B: warning: ignoring duplicate section `%A'\n"
msgstr ""
-#: linker.c:3051
+#: linker.c:3058
msgid "%B: warning: duplicate section `%A' has different size\n"
msgstr ""
-#: merge.c:817
+#: merge.c:818
#, c-format
msgid "%s: access beyond end of merged section (%ld)"
msgstr ""
-#: mmo.c:456
+#: mmo.c:454
#, c-format
msgid "%s: No core to allocate section name %s\n"
msgstr ""
-#: mmo.c:531
+#: mmo.c:529
#, c-format
msgid "%s: No core to allocate a symbol %d bytes long\n"
msgstr ""
-#: mmo.c:1187
+#: mmo.c:1185
#, c-format
msgid "%s: invalid mmo file: initialization value for $255 is not `Main'\n"
msgstr ""
-#: mmo.c:1332
+#: mmo.c:1330
#, c-format
msgid ""
"%s: unsupported wide character sequence 0x%02X 0x%02X after symbol name "
"starting with `%s'\n"
msgstr ""
-#: mmo.c:1566
+#: mmo.c:1564
#, c-format
msgid "%s: invalid mmo file: unsupported lopcode `%d'\n"
msgstr ""
-#: mmo.c:1576
+#: mmo.c:1574
#, c-format
msgid "%s: invalid mmo file: expected YZ = 1 got YZ = %d for lop_quote\n"
msgstr ""
-#: mmo.c:1612
+#: mmo.c:1610
#, c-format
msgid "%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_loc\n"
msgstr ""
-#: mmo.c:1658
+#: mmo.c:1656
#, c-format
msgid ""
"%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_fixo\n"
msgstr ""
-#: mmo.c:1697
+#: mmo.c:1695
#, c-format
msgid "%s: invalid mmo file: expected y = 0, got y = %d for lop_fixrx\n"
msgstr ""
-#: mmo.c:1706
+#: mmo.c:1704
#, c-format
msgid ""
"%s: invalid mmo file: expected z = 16 or z = 24, got z = %d for lop_fixrx\n"
msgstr ""
-#: mmo.c:1729
+#: mmo.c:1727
#, c-format
msgid ""
"%s: invalid mmo file: leading byte of operand word must be 0 or 1, got %d "
"for lop_fixrx\n"
msgstr ""
-#: mmo.c:1752
+#: mmo.c:1750
#, c-format
msgid "%s: cannot allocate file name for file number %d, %d bytes\n"
msgstr ""
-#: mmo.c:1772
+#: mmo.c:1770
#, c-format
msgid ""
"%s: invalid mmo file: file number %d `%s', was already entered as `%s'\n"
msgstr ""
-#: mmo.c:1785
+#: mmo.c:1783
#, c-format
msgid ""
"%s: invalid mmo file: file name for number %d was not specified before use\n"
msgstr ""
-#: mmo.c:1892
+#: mmo.c:1890
#, c-format
msgid ""
"%s: invalid mmo file: fields y and z of lop_stab non-zero, y: %d, z: %d\n"
msgstr ""
-#: mmo.c:1928
+#: mmo.c:1926
#, c-format
msgid "%s: invalid mmo file: lop_end not last item in file\n"
msgstr ""
-#: mmo.c:1941
+#: mmo.c:1939
#, c-format
msgid ""
"%s: invalid mmo file: YZ of lop_end (%ld) not equal to the number of tetras "
@@ -2686,7 +2937,7 @@ msgid ""
"08lx\n"
msgstr ""
-#: oasys.c:876
+#: oasys.c:880
#, c-format
msgid "%s: can not represent section `%s' in oasys"
msgstr ""
@@ -2697,37 +2948,37 @@ msgid "Unhandled OSF/1 core file section type %d\n"
msgstr ""
#. XXX code yet to be written.
-#: peicode.h:731
+#: peicode.h:757
msgid "%B: Unhandled import type; %x"
msgstr ""
-#: peicode.h:736
+#: peicode.h:762
msgid "%B: Unrecognised import type; %x"
msgstr ""
-#: peicode.h:750
+#: peicode.h:776
msgid "%B: Unrecognised import name type; %x"
msgstr ""
-#: peicode.h:1120
+#: peicode.h:1159
msgid "%B: Unrecognised machine type (0x%x) in Import Library Format archive"
msgstr ""
-#: peicode.h:1132
+#: peicode.h:1171
msgid ""
"%B: Recognised but unhandled machine type (0x%x) in Import Library Format "
"archive"
msgstr ""
-#: peicode.h:1150
+#: peicode.h:1189
msgid "%B: size field is zero in Import Library Format header"
msgstr ""
-#: peicode.h:1181
+#: peicode.h:1220
msgid "%B: string not null terminated in ILF object file."
msgstr ""
-#: pe-mips.c:588
+#: pe-mips.c:605
msgid "%B: `ld -r' not supported with PE MIPS objects\n"
msgstr ""
@@ -2735,75 +2986,75 @@ msgstr ""
#. 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:704
+#: pe-mips.c:721
msgid "%B: unimplemented %s\n"
msgstr ""
-#: pe-mips.c:730
+#: pe-mips.c:747
msgid "%B: jump too far away\n"
msgstr ""
-#: pe-mips.c:756
+#: pe-mips.c:773
msgid "%B: bad pair/reflo after refhi\n"
msgstr ""
-#: ppcboot.c:419
+#: ppcboot.c:412
#, c-format
msgid ""
"\n"
"ppcboot header:\n"
msgstr ""
-#: ppcboot.c:420
+#: ppcboot.c:413
#, c-format
msgid "Entry offset = 0x%.8lx (%ld)\n"
msgstr ""
-#: ppcboot.c:421
+#: ppcboot.c:414
#, c-format
msgid "Length = 0x%.8lx (%ld)\n"
msgstr ""
-#: ppcboot.c:424
+#: ppcboot.c:417
#, c-format
msgid "Flag field = 0x%.2x\n"
msgstr ""
-#: ppcboot.c:430
+#: ppcboot.c:423
#, c-format
msgid "Partition name = \"%s\"\n"
msgstr ""
-#: ppcboot.c:449
+#: ppcboot.c:442
#, c-format
msgid ""
"\n"
"Partition[%d] start = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n"
msgstr ""
-#: ppcboot.c:455
+#: ppcboot.c:448
#, c-format
msgid "Partition[%d] end = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n"
msgstr ""
-#: ppcboot.c:461
+#: ppcboot.c:454
#, c-format
msgid "Partition[%d] sector = 0x%.8lx (%ld)\n"
msgstr ""
-#: ppcboot.c:462
+#: ppcboot.c:455
#, c-format
msgid "Partition[%d] length = 0x%.8lx (%ld)\n"
msgstr ""
-#: som.c:5069
+#: som.c:5088
#, c-format
msgid ""
"\n"
"Exec Auxiliary Header\n"
msgstr ""
-#: som.c:5330
+#: som.c:5349
msgid "som_sizeof_headers unimplemented"
msgstr ""
@@ -2811,11 +3062,11 @@ msgstr ""
msgid "%B:%d: Unexpected character `%s' in S-record file\n"
msgstr ""
-#: stabs.c:276
+#: stabs.c:277
msgid "%B(%A+0x%lx): Stabs entry has invalid string index."
msgstr ""
-#: syms.c:1048
+#: syms.c:1056
msgid "Unsupported .stab relocation"
msgstr ""
@@ -2978,316 +3229,320 @@ msgstr ""
msgid "Unhandled relocation %s"
msgstr ""
-#: xcofflink.c:564
+#: xcofflink.c:565
#, c-format
msgid "%s: XCOFF shared object when not producing XCOFF output"
msgstr ""
-#: xcofflink.c:585
+#: xcofflink.c:586
#, c-format
msgid "%s: dynamic object with no .loader section"
msgstr ""
-#: xcofflink.c:1148
+#: xcofflink.c:1149
msgid "%B: `%s' has line numbers but no enclosing section"
msgstr ""
-#: xcofflink.c:1200
+#: xcofflink.c:1201
msgid "%B: class %d symbol `%s' has no aux entries"
msgstr ""
-#: xcofflink.c:1223
+#: xcofflink.c:1224
msgid "%B: symbol `%s' has unrecognized csect type %d"
msgstr ""
-#: xcofflink.c:1235
+#: xcofflink.c:1236
msgid "%B: bad XTY_ER symbol `%s': class %d scnum %d scnlen %d"
msgstr ""
-#: xcofflink.c:1271
+#: xcofflink.c:1272
msgid "%B: XMC_TC0 symbol `%s' is class %d scnlen %d"
msgstr ""
-#: xcofflink.c:1417
+#: xcofflink.c:1418
msgid "%B: csect `%s' not in enclosing section"
msgstr ""
-#: xcofflink.c:1524
+#: xcofflink.c:1525
msgid "%B: misplaced XTY_LD `%s'"
msgstr ""
-#: xcofflink.c:1839
+#: xcofflink.c:1841
msgid "%B: reloc %s:%d not in csect"
msgstr ""
-#: xcofflink.c:2637
+#: xcofflink.c:2639
#, c-format
msgid "%s: no such symbol"
msgstr ""
-#: xcofflink.c:2866
+#: xcofflink.c:2868
#, c-format
msgid "warning: attempt to export undefined symbol `%s'"
msgstr ""
-#: xcofflink.c:3033
+#: xcofflink.c:3035
msgid "error: undefined symbol __rtinit"
msgstr ""
-#: xcofflink.c:3653
+#: xcofflink.c:3655
#, c-format
msgid "TOC overflow: 0x%lx > 0x10000; try -mminimal-toc when compiling"
msgstr ""
-#: xcofflink.c:4489
+#: xcofflink.c:4491
msgid "%B: loader reloc in unrecognized section `%A'"
msgstr ""
-#: xcofflink.c:4510
+#: xcofflink.c:4512
msgid "%B: `%s' in loader reloc but not loader sym"
msgstr ""
-#: xcofflink.c:4525
+#: xcofflink.c:4527
msgid "%B: loader reloc in read-only section %A"
msgstr ""
-#: xcofflink.c:4934 xcofflink.c:4996 xcofflink.c:5291
+#: xcofflink.c:4936 xcofflink.c:4998 xcofflink.c:5293
#, c-format
msgid "%s: loader reloc in unrecognized section `%s'"
msgstr ""
-#: xcofflink.c:5302
+#: xcofflink.c:5304
#, c-format
msgid "%s: `%s' in loader reloc but not loader sym"
msgstr ""
-#: elf32-ia64.c:1139 elf64-ia64.c:1139
+#: elf32-ia64.c:1168 elf64-ia64.c:1168
msgid ""
"%B: Can't relax br at 0x%lx in section `%A'. Please use brl or indirect "
"branch."
msgstr ""
-#: elf32-ia64.c:2508 elf64-ia64.c:2508
+#: elf32-ia64.c:2909 elf64-ia64.c:2909
msgid "@pltoff reloc against local symbol"
msgstr ""
-#: elf32-ia64.c:3955 elf64-ia64.c:3955
+#: elf32-ia64.c:4522 elf64-ia64.c:4522
#, c-format
msgid "%s: short data segment overflowed (0x%lx >= 0x400000)"
msgstr ""
-#: elf32-ia64.c:3966 elf64-ia64.c:3966
+#: elf32-ia64.c:4533 elf64-ia64.c:4533
#, c-format
msgid "%s: __gp does not cover short data segment"
msgstr ""
-#: elf32-ia64.c:4213 elf64-ia64.c:4213
+#: elf32-ia64.c:4807 elf64-ia64.c:4807
msgid "%B: non-pic code with imm relocation against dynamic symbol `%s'"
msgstr ""
-#: elf32-ia64.c:4280 elf64-ia64.c:4280
+#: elf32-ia64.c:4874 elf64-ia64.c:4874
msgid "%B: @gprel relocation against dynamic symbol %s"
msgstr ""
-#: elf32-ia64.c:4343 elf64-ia64.c:4343
+#: elf32-ia64.c:4937 elf64-ia64.c:4937
msgid "%B: linking non-pic code in a position independent executable"
msgstr ""
-#: elf32-ia64.c:4480 elf64-ia64.c:4480
+#: elf32-ia64.c:5074 elf64-ia64.c:5074
msgid "%B: @internal branch to dynamic symbol %s"
msgstr ""
-#: elf32-ia64.c:4482 elf64-ia64.c:4482
+#: elf32-ia64.c:5076 elf64-ia64.c:5076
msgid "%B: speculation fixup to dynamic symbol %s"
msgstr ""
-#: elf32-ia64.c:4484 elf64-ia64.c:4484
+#: elf32-ia64.c:5078 elf64-ia64.c:5078
msgid "%B: @pcrel relocation against dynamic symbol %s"
msgstr ""
-#: elf32-ia64.c:4691 elf64-ia64.c:4691
+#: elf32-ia64.c:5278 elf64-ia64.c:5278
msgid "unsupported reloc"
msgstr ""
-#: elf32-ia64.c:4724 elf64-ia64.c:4724
+#: elf32-ia64.c:5311 elf64-ia64.c:5311
msgid ""
"%B: Can't relax br (%s) to `%s' at 0x%lx in section `%A' with size 0x%lx (> "
"0x1000000)."
msgstr ""
-#: elf32-ia64.c:4985 elf64-ia64.c:4985
+#: elf32-ia64.c:5572 elf64-ia64.c:5572
msgid "%B: linking trap-on-NULL-dereference with non-trapping files"
msgstr ""
-#: elf32-ia64.c:4994 elf64-ia64.c:4994
+#: elf32-ia64.c:5581 elf64-ia64.c:5581
msgid "%B: linking big-endian files with little-endian files"
msgstr ""
-#: elf32-ia64.c:5003 elf64-ia64.c:5003
+#: elf32-ia64.c:5590 elf64-ia64.c:5590
msgid "%B: linking 64-bit files with 32-bit files"
msgstr ""
-#: elf32-ia64.c:5012 elf64-ia64.c:5012
+#: elf32-ia64.c:5599 elf64-ia64.c:5599
msgid "%B: linking constant-gp files with non-constant-gp files"
msgstr ""
-#: elf32-ia64.c:5022 elf64-ia64.c:5022
+#: elf32-ia64.c:5609 elf64-ia64.c:5609
msgid "%B: linking auto-pic files with non-auto-pic files"
msgstr ""
-#: peigen.c:979 pepigen.c:979
+#: peigen.c:998 pepigen.c:998 pex64igen.c:998
#, c-format
msgid "%s: line number overflow: 0x%lx > 0xffff"
msgstr ""
-#: peigen.c:1006 pepigen.c:1006
+#: peigen.c:1025 pepigen.c:1025 pex64igen.c:1025
msgid "Export Directory [.edata (or where ever we found it)]"
msgstr ""
-#: peigen.c:1007 pepigen.c:1007
+#: peigen.c:1026 pepigen.c:1026 pex64igen.c:1026
msgid "Import Directory [parts of .idata]"
msgstr ""
-#: peigen.c:1008 pepigen.c:1008
+#: peigen.c:1027 pepigen.c:1027 pex64igen.c:1027
msgid "Resource Directory [.rsrc]"
msgstr ""
-#: peigen.c:1009 pepigen.c:1009
+#: peigen.c:1028 pepigen.c:1028 pex64igen.c:1028
msgid "Exception Directory [.pdata]"
msgstr ""
-#: peigen.c:1010 pepigen.c:1010
+#: peigen.c:1029 pepigen.c:1029 pex64igen.c:1029
msgid "Security Directory"
msgstr ""
-#: peigen.c:1011 pepigen.c:1011
+#: peigen.c:1030 pepigen.c:1030 pex64igen.c:1030
msgid "Base Relocation Directory [.reloc]"
msgstr ""
-#: peigen.c:1012 pepigen.c:1012
+#: peigen.c:1031 pepigen.c:1031 pex64igen.c:1031
msgid "Debug Directory"
msgstr ""
-#: peigen.c:1013 pepigen.c:1013
+#: peigen.c:1032 pepigen.c:1032 pex64igen.c:1032
msgid "Description Directory"
msgstr ""
-#: peigen.c:1014 pepigen.c:1014
+#: peigen.c:1033 pepigen.c:1033 pex64igen.c:1033
msgid "Special Directory"
msgstr ""
-#: peigen.c:1015 pepigen.c:1015
+#: peigen.c:1034 pepigen.c:1034 pex64igen.c:1034
msgid "Thread Storage Directory [.tls]"
msgstr ""
-#: peigen.c:1016 pepigen.c:1016
+#: peigen.c:1035 pepigen.c:1035 pex64igen.c:1035
msgid "Load Configuration Directory"
msgstr ""
-#: peigen.c:1017 pepigen.c:1017
+#: peigen.c:1036 pepigen.c:1036 pex64igen.c:1036
msgid "Bound Import Directory"
msgstr ""
-#: peigen.c:1018 pepigen.c:1018
+#: peigen.c:1037 pepigen.c:1037 pex64igen.c:1037
msgid "Import Address Table Directory"
msgstr ""
-#: peigen.c:1019 pepigen.c:1019
+#: peigen.c:1038 pepigen.c:1038 pex64igen.c:1038
msgid "Delay Import Directory"
msgstr ""
-#: peigen.c:1020 peigen.c:1021 pepigen.c:1020 pepigen.c:1021
+#: peigen.c:1039 pepigen.c:1039 pex64igen.c:1039
+msgid "CLR Runtime Header"
+msgstr ""
+
+#: peigen.c:1040 pepigen.c:1040 pex64igen.c:1040
msgid "Reserved"
msgstr ""
-#: peigen.c:1081 pepigen.c:1081
+#: peigen.c:1100 pepigen.c:1100 pex64igen.c:1100
#, c-format
msgid ""
"\n"
"There is an import table, but the section containing it could not be found\n"
msgstr ""
-#: peigen.c:1086 pepigen.c:1086
+#: peigen.c:1105 pepigen.c:1105 pex64igen.c:1105
#, c-format
msgid ""
"\n"
"There is an import table in %s at 0x%lx\n"
msgstr ""
-#: peigen.c:1129 pepigen.c:1129
+#: peigen.c:1148 pepigen.c:1148 pex64igen.c:1148
#, c-format
msgid ""
"\n"
"Function descriptor located at the start address: %04lx\n"
msgstr ""
-#: peigen.c:1132 pepigen.c:1132
+#: peigen.c:1151 pepigen.c:1151 pex64igen.c:1151
#, c-format
msgid "\tcode-base %08lx toc (loadable/actual) %08lx/%08lx\n"
msgstr ""
-#: peigen.c:1140 pepigen.c:1140
+#: peigen.c:1159 pepigen.c:1159 pex64igen.c:1159
#, c-format
msgid ""
"\n"
"No reldata section! Function descriptor not decoded.\n"
msgstr ""
-#: peigen.c:1145 pepigen.c:1145
+#: peigen.c:1164 pepigen.c:1164 pex64igen.c:1164
#, c-format
msgid ""
"\n"
"The Import Tables (interpreted %s section contents)\n"
msgstr ""
-#: peigen.c:1148 pepigen.c:1148
+#: peigen.c:1167 pepigen.c:1167 pex64igen.c:1167
#, c-format
msgid ""
" vma: Hint Time Forward DLL First\n"
" Table Stamp Chain Name Thunk\n"
msgstr ""
-#: peigen.c:1196 pepigen.c:1196
+#: peigen.c:1215 pepigen.c:1215 pex64igen.c:1215
#, c-format
msgid ""
"\n"
"\tDLL Name: %s\n"
msgstr ""
-#: peigen.c:1207 pepigen.c:1207
+#: peigen.c:1226 pepigen.c:1226 pex64igen.c:1226
#, c-format
msgid "\tvma: Hint/Ord Member-Name Bound-To\n"
msgstr ""
-#: peigen.c:1232 pepigen.c:1232
+#: peigen.c:1251 pepigen.c:1251 pex64igen.c:1251
#, c-format
msgid ""
"\n"
"There is a first thunk, but the section containing it could not be found\n"
msgstr ""
-#: peigen.c:1365 pepigen.c:1365
+#: peigen.c:1416 pepigen.c:1416 pex64igen.c:1416
#, c-format
msgid ""
"\n"
"There is an export table, but the section containing it could not be found\n"
msgstr ""
-#: peigen.c:1374 pepigen.c:1374
+#: peigen.c:1425 pepigen.c:1425 pex64igen.c:1425
#, c-format
msgid ""
"\n"
"There is an export table in %s, but it does not fit into that section\n"
msgstr ""
-#: peigen.c:1380 pepigen.c:1380
+#: peigen.c:1431 pepigen.c:1431 pex64igen.c:1431
#, c-format
msgid ""
"\n"
"There is an export table in %s at 0x%lx\n"
msgstr ""
-#: peigen.c:1408 pepigen.c:1408
+#: peigen.c:1459 pepigen.c:1459 pex64igen.c:1459
#, c-format
msgid ""
"\n"
@@ -3295,128 +3550,128 @@ msgid ""
"\n"
msgstr ""
-#: peigen.c:1412 pepigen.c:1412
+#: peigen.c:1463 pepigen.c:1463 pex64igen.c:1463
#, c-format
msgid "Export Flags \t\t\t%lx\n"
msgstr ""
-#: peigen.c:1415 pepigen.c:1415
+#: peigen.c:1466 pepigen.c:1466 pex64igen.c:1466
#, c-format
msgid "Time/Date stamp \t\t%lx\n"
msgstr ""
-#: peigen.c:1418 pepigen.c:1418
+#: peigen.c:1469 pepigen.c:1469 pex64igen.c:1469
#, c-format
msgid "Major/Minor \t\t\t%d/%d\n"
msgstr ""
-#: peigen.c:1421 pepigen.c:1421
+#: peigen.c:1472 pepigen.c:1472 pex64igen.c:1472
#, c-format
msgid "Name \t\t\t\t"
msgstr ""
-#: peigen.c:1427 pepigen.c:1427
+#: peigen.c:1478 pepigen.c:1478 pex64igen.c:1478
#, c-format
msgid "Ordinal Base \t\t\t%ld\n"
msgstr ""
-#: peigen.c:1430 pepigen.c:1430
+#: peigen.c:1481 pepigen.c:1481 pex64igen.c:1481
#, c-format
msgid "Number in:\n"
msgstr ""
-#: peigen.c:1433 pepigen.c:1433
+#: peigen.c:1484 pepigen.c:1484 pex64igen.c:1484
#, c-format
msgid "\tExport Address Table \t\t%08lx\n"
msgstr ""
-#: peigen.c:1437 pepigen.c:1437
+#: peigen.c:1488 pepigen.c:1488 pex64igen.c:1488
#, c-format
msgid "\t[Name Pointer/Ordinal] Table\t%08lx\n"
msgstr ""
-#: peigen.c:1440 pepigen.c:1440
+#: peigen.c:1491 pepigen.c:1491 pex64igen.c:1491
#, c-format
msgid "Table Addresses\n"
msgstr ""
-#: peigen.c:1443 pepigen.c:1443
+#: peigen.c:1494 pepigen.c:1494 pex64igen.c:1494
#, c-format
msgid "\tExport Address Table \t\t"
msgstr ""
-#: peigen.c:1448 pepigen.c:1448
+#: peigen.c:1499 pepigen.c:1499 pex64igen.c:1499
#, c-format
msgid "\tName Pointer Table \t\t"
msgstr ""
-#: peigen.c:1453 pepigen.c:1453
+#: peigen.c:1504 pepigen.c:1504 pex64igen.c:1504
#, c-format
msgid "\tOrdinal Table \t\t\t"
msgstr ""
-#: peigen.c:1467 pepigen.c:1467
+#: peigen.c:1518 pepigen.c:1518 pex64igen.c:1518
#, c-format
msgid ""
"\n"
"Export Address Table -- Ordinal Base %ld\n"
msgstr ""
-#: peigen.c:1486 pepigen.c:1486
+#: peigen.c:1537 pepigen.c:1537 pex64igen.c:1537
msgid "Forwarder RVA"
msgstr ""
-#: peigen.c:1497 pepigen.c:1497
+#: peigen.c:1548 pepigen.c:1548 pex64igen.c:1548
msgid "Export RVA"
msgstr ""
-#: peigen.c:1504 pepigen.c:1504
+#: peigen.c:1555 pepigen.c:1555 pex64igen.c:1555
#, c-format
msgid ""
"\n"
"[Ordinal/Name Pointer] Table\n"
msgstr ""
-#: peigen.c:1557 pepigen.c:1557
+#: peigen.c:1608 pepigen.c:1608 pex64igen.c:1608
#, c-format
msgid "Warning, .pdata section size (%ld) is not a multiple of %d\n"
msgstr ""
-#: peigen.c:1561 pepigen.c:1561
+#: peigen.c:1612 pepigen.c:1612 pex64igen.c:1612
#, c-format
msgid ""
"\n"
"The Function Table (interpreted .pdata section contents)\n"
msgstr ""
-#: peigen.c:1564 pepigen.c:1564
+#: peigen.c:1615 pepigen.c:1615 pex64igen.c:1615
#, c-format
msgid " vma:\t\t\tBegin Address End Address Unwind Info\n"
msgstr ""
-#: peigen.c:1566 pepigen.c:1566
+#: peigen.c:1617 pepigen.c:1617 pex64igen.c:1617
#, c-format
msgid ""
" vma:\t\tBegin End EH EH PrologEnd Exception\n"
" \t\tAddress Address Handler Data Address Mask\n"
msgstr ""
-#: peigen.c:1636 pepigen.c:1636
+#: peigen.c:1687 pepigen.c:1687 pex64igen.c:1687
#, c-format
msgid " Register save millicode"
msgstr ""
-#: peigen.c:1639 pepigen.c:1639
+#: peigen.c:1690 pepigen.c:1690 pex64igen.c:1690
#, c-format
msgid " Register restore millicode"
msgstr ""
-#: peigen.c:1642 pepigen.c:1642
+#: peigen.c:1693 pepigen.c:1693 pex64igen.c:1693
#, c-format
msgid " Glue code sequence"
msgstr ""
-#: peigen.c:1692 pepigen.c:1692
+#: peigen.c:1743 pepigen.c:1743 pex64igen.c:1743
#, c-format
msgid ""
"\n"
@@ -3424,14 +3679,14 @@ msgid ""
"PE File Base Relocations (interpreted .reloc section contents)\n"
msgstr ""
-#: peigen.c:1722 pepigen.c:1722
+#: peigen.c:1773 pepigen.c:1773 pex64igen.c:1773
#, c-format
msgid ""
"\n"
"Virtual Address: %08lx Chunk size %ld (0x%lx) Number of fixups %ld\n"
msgstr ""
-#: peigen.c:1735 pepigen.c:1735
+#: peigen.c:1786 pepigen.c:1786 pex64igen.c:1786
#, c-format
msgid "\treloc %4d offset %4x [%4lx] %s"
msgstr ""
@@ -3439,9 +3694,31 @@ msgstr ""
#. The MS dumpbin program reportedly ands with 0xff0f before
#. printing the characteristics field. Not sure why. No reason to
#. emulate it here.
-#: peigen.c:1773 pepigen.c:1773
+#: peigen.c:1825 pepigen.c:1825 pex64igen.c:1825
#, c-format
msgid ""
"\n"
"Characteristics 0x%x\n"
msgstr ""
+
+#: peigen.c:2086 pepigen.c:2086 pex64igen.c:2086
+msgid "%B: unable to fill in DataDictionary[1] because .idata$2 is missing"
+msgstr ""
+
+#: peigen.c:2104 pepigen.c:2104 pex64igen.c:2104
+msgid "%B: unable to fill in DataDictionary[1] because .idata$4 is missing"
+msgstr ""
+
+#: peigen.c:2123 pepigen.c:2123 pex64igen.c:2123
+msgid "%B: unable to fill in DataDictionary[12] because .idata$5 is missing"
+msgstr ""
+
+#: peigen.c:2141 pepigen.c:2141 pex64igen.c:2141
+msgid ""
+"%B: unable to fill in DataDictionary[PE_IMPORT_ADDRESS_TABLE (12)] because ."
+"idata$6 is missing"
+msgstr ""
+
+#: peigen.c:2161 pepigen.c:2161 pex64igen.c:2161
+msgid "%B: unable to fill in DataDictionary[9] because __tls_used is missing"
+msgstr ""
diff --git a/bfd/po/da.gmo b/bfd/po/da.gmo
deleted file mode 100644
index 944a11c1610b..000000000000
--- a/bfd/po/da.gmo
+++ /dev/null
Binary files differ
diff --git a/bfd/po/es.gmo b/bfd/po/es.gmo
deleted file mode 100644
index 4097899662a1..000000000000
--- a/bfd/po/es.gmo
+++ /dev/null
Binary files differ
diff --git a/bfd/po/fr.gmo b/bfd/po/fr.gmo
deleted file mode 100644
index 1a6948d5b93c..000000000000
--- a/bfd/po/fr.gmo
+++ /dev/null
Binary files differ
diff --git a/bfd/po/ja.gmo b/bfd/po/ja.gmo
deleted file mode 100644
index f8142480577e..000000000000
--- a/bfd/po/ja.gmo
+++ /dev/null
Binary files differ
diff --git a/bfd/po/ro.gmo b/bfd/po/ro.gmo
deleted file mode 100644
index 8621928313f6..000000000000
--- a/bfd/po/ro.gmo
+++ /dev/null
Binary files differ
diff --git a/bfd/po/rw.gmo b/bfd/po/rw.gmo
deleted file mode 100644
index 49d9e2fd45e3..000000000000
--- a/bfd/po/rw.gmo
+++ /dev/null
Binary files differ
diff --git a/bfd/po/sv.gmo b/bfd/po/sv.gmo
deleted file mode 100644
index e746ec02e756..000000000000
--- a/bfd/po/sv.gmo
+++ /dev/null
Binary files differ
diff --git a/bfd/po/tr.gmo b/bfd/po/tr.gmo
deleted file mode 100644
index 74c0ea8fc2dd..000000000000
--- a/bfd/po/tr.gmo
+++ /dev/null
Binary files differ
diff --git a/bfd/po/vi.gmo b/bfd/po/vi.gmo
deleted file mode 100644
index f5683c6169d6..000000000000
--- a/bfd/po/vi.gmo
+++ /dev/null
Binary files differ
diff --git a/bfd/po/zh_CN.gmo b/bfd/po/zh_CN.gmo
deleted file mode 100644
index 501f89d427f5..000000000000
--- a/bfd/po/zh_CN.gmo
+++ /dev/null
Binary files differ
diff --git a/bfd/ppcboot.c b/bfd/ppcboot.c
index 7c8a4190bac2..da8c6b8019bd 100644
--- a/bfd/ppcboot.c
+++ b/bfd/ppcboot.c
@@ -1,6 +1,6 @@
/* BFD back-end for PPCbug boot records.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006,
+ 2007 Free Software Foundation, Inc.
Written by Michael Meissner, Cygnus Support, <meissner@cygnus.com>
This file is part of BFD, the Binary File Descriptor library.
@@ -32,9 +32,9 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
the file. objcopy cooperates by specially setting the start
address to zero by default. */
+#include "sysdep.h"
#include "safe-ctype.h"
#include "bfd.h"
-#include "sysdep.h"
#include "libbfd.h"
/* PPCbug location structure */
@@ -99,7 +99,6 @@ static long ppcboot_canonicalize_symtab PARAMS ((bfd *, asymbol **));
static void ppcboot_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
static bfd_boolean ppcboot_set_section_contents
PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type));
-static int ppcboot_sizeof_headers PARAMS ((bfd *, bfd_boolean));
static bfd_boolean ppcboot_bfd_print_private_bfd_data PARAMS ((bfd *, PTR));
#define ppcboot_set_tdata(abfd, ptr) ((abfd)->tdata.any = (PTR) (ptr))
@@ -151,6 +150,7 @@ ppcboot_object_p (abfd)
ppcboot_hdr_t hdr;
size_t i;
ppcboot_data_t *tdata;
+ flagword flags;
BFD_ASSERT (sizeof (ppcboot_hdr_t) == 1024);
@@ -205,10 +205,10 @@ ppcboot_object_p (abfd)
abfd->symcount = PPCBOOT_SYMS;
/* One data section. */
- sec = bfd_make_section (abfd, ".data");
+ flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_CODE | SEC_HAS_CONTENTS;
+ sec = bfd_make_section_with_flags (abfd, ".data", flags);
if (sec == NULL)
return NULL;
- sec->flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_CODE | SEC_HAS_CONTENTS;
sec->vma = 0;
sec->size = statbuf.st_size - sizeof (ppcboot_hdr_t);
sec->filepos = sizeof (ppcboot_hdr_t);
@@ -354,12 +354,6 @@ ppcboot_get_symbol_info (ignore_abfd, symbol, ret)
#define ppcboot_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
#define ppcboot_read_minisymbols _bfd_generic_read_minisymbols
#define ppcboot_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
-
-#define ppcboot_get_reloc_upper_bound \
- ((long (*) PARAMS ((bfd *, asection *))) bfd_0l)
-#define ppcboot_canonicalize_reloc \
- ((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) bfd_0l)
-#define ppcboot_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
/* Write section contents of a ppcboot file. */
@@ -395,9 +389,8 @@ ppcboot_set_section_contents (abfd, sec, data, offset, size)
static int
-ppcboot_sizeof_headers (abfd, exec)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_boolean exec ATTRIBUTE_UNUSED;
+ppcboot_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
return sizeof (ppcboot_hdr_t);
}
@@ -535,7 +528,7 @@ const bfd_target ppcboot_vec =
BFD_JUMP_TABLE_CORE (_bfd_nocore),
BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
BFD_JUMP_TABLE_SYMBOLS (ppcboot),
- BFD_JUMP_TABLE_RELOCS (ppcboot),
+ BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
BFD_JUMP_TABLE_WRITE (ppcboot),
BFD_JUMP_TABLE_LINK (ppcboot),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
diff --git a/bfd/ptrace-core.c b/bfd/ptrace-core.c
index 4ac28aa1dece..8607225da16f 100644
--- a/bfd/ptrace-core.c
+++ b/bfd/ptrace-core.c
@@ -1,6 +1,6 @@
/* BFD backend for core files which use the ptrace_user structure
- Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002, 2003, 2004,
+ 2006, 2007 Free Software Foundation, Inc.
The structure of this file is based on trad-core.c written by John Gilmore
of Cygnus Support.
Modified to work with the ptrace_user structure by Kevin A. Buettner.
@@ -24,8 +24,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
#ifdef PTRACE_CORE
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include <sys/param.h>
@@ -63,6 +63,7 @@ ptrace_unix_core_file_p (abfd)
struct ptrace_user u;
struct trad_core_struct *rawptr;
bfd_size_type amt;
+ flagword flags;
val = bfd_bread ((void *)&u, (bfd_size_type) sizeof u, abfd);
if (val != sizeof u || u.pt_magic != _BCS_PTRACE_MAGIC
@@ -89,13 +90,17 @@ ptrace_unix_core_file_p (abfd)
/* Create the sections. */
- core_stacksec (abfd) = bfd_make_section_anyway (abfd, ".stack");
+ flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
+ core_stacksec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".stack",
+ flags);
if (core_stacksec (abfd) == NULL)
goto fail;
- core_datasec (abfd) = bfd_make_section_anyway (abfd, ".data");
+ core_datasec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".data",
+ flags);
if (core_datasec (abfd) == NULL)
goto fail;
- core_regsec (abfd) = bfd_make_section_anyway (abfd, ".reg");
+ core_regsec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".reg",
+ SEC_HAS_CONTENTS);
if (core_regsec (abfd) == NULL)
goto fail;
@@ -103,10 +108,6 @@ ptrace_unix_core_file_p (abfd)
text. I don't think that any of these things are supported on the
system on which I am developing this for though. */
- core_stacksec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
- core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
- core_regsec (abfd)->flags = SEC_HAS_CONTENTS;
-
core_datasec (abfd)->size = u.pt_dsize;
core_stacksec (abfd)->size = u.pt_ssize;
core_regsec (abfd)->size = sizeof (u);
diff --git a/bfd/reloc.c b/bfd/reloc.c
index f1d09a5ab073..1e5d4bd03fa7 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -1,6 +1,6 @@
/* BFD support for handling relocation entries.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -47,8 +47,8 @@ SECTION
/* DO compile in the reloc_code name table from libbfd.h. */
#define _BFD_MAKE_TABLE_bfd_reloc_code_real
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
/*
@@ -1522,7 +1522,6 @@ _bfd_relocate_contents (reloc_howto_type *howto,
switch (size)
{
default:
- case 0:
abort ();
case 1:
bfd_put_8 (input_bfd, x, location);
@@ -1545,6 +1544,72 @@ _bfd_relocate_contents (reloc_howto_type *howto,
return flag;
}
+/* Clear a given location using a given howto, by applying a relocation value
+ of zero and discarding any in-place addend. This is used for fixed-up
+ relocations against discarded symbols, to make ignorable debug or unwind
+ information more obvious. */
+
+void
+_bfd_clear_contents (reloc_howto_type *howto,
+ bfd *input_bfd,
+ bfd_byte *location)
+{
+ int size;
+ bfd_vma x = 0;
+
+ /* Get the value we are going to relocate. */
+ size = bfd_get_reloc_size (howto);
+ switch (size)
+ {
+ default:
+ case 0:
+ abort ();
+ case 1:
+ x = bfd_get_8 (input_bfd, location);
+ break;
+ case 2:
+ x = bfd_get_16 (input_bfd, location);
+ break;
+ case 4:
+ x = bfd_get_32 (input_bfd, location);
+ break;
+ case 8:
+#ifdef BFD64
+ x = bfd_get_64 (input_bfd, location);
+#else
+ abort ();
+#endif
+ break;
+ }
+
+ /* Zero out the unwanted bits of X. */
+ x &= ~howto->dst_mask;
+
+ /* Put the relocated value back in the object file. */
+ switch (size)
+ {
+ default:
+ case 0:
+ abort ();
+ case 1:
+ bfd_put_8 (input_bfd, x, location);
+ break;
+ case 2:
+ bfd_put_16 (input_bfd, x, location);
+ break;
+ case 4:
+ bfd_put_32 (input_bfd, x, location);
+ break;
+ case 8:
+#ifdef BFD64
+ bfd_put_64 (input_bfd, x, location);
+#else
+ abort ();
+#endif
+ break;
+ }
+}
+
/*
DOCDD
INODE
@@ -1884,6 +1949,37 @@ ENUMDOC
SPARC TLS relocations
ENUM
+ BFD_RELOC_SPU_IMM7
+ENUMX
+ BFD_RELOC_SPU_IMM8
+ENUMX
+ BFD_RELOC_SPU_IMM10
+ENUMX
+ BFD_RELOC_SPU_IMM10W
+ENUMX
+ BFD_RELOC_SPU_IMM16
+ENUMX
+ BFD_RELOC_SPU_IMM16W
+ENUMX
+ BFD_RELOC_SPU_IMM18
+ENUMX
+ BFD_RELOC_SPU_PCREL9a
+ENUMX
+ BFD_RELOC_SPU_PCREL9b
+ENUMX
+ BFD_RELOC_SPU_PCREL16
+ENUMX
+ BFD_RELOC_SPU_LO16
+ENUMX
+ BFD_RELOC_SPU_HI16
+ENUMX
+ BFD_RELOC_SPU_PPU32
+ENUMX
+ BFD_RELOC_SPU_PPU64
+ENUMDOC
+ SPU Relocations.
+
+ENUM
BFD_RELOC_ALPHA_GPDISP_HI16
ENUMDOC
Alpha ECOFF and ELF relocations. Some of these treat the symbol or
@@ -2701,6 +2797,24 @@ ENUM
BFD_RELOC_ARM_PREL31
ENUMDOC
31-bit PC relative address.
+ENUM
+ BFD_RELOC_ARM_MOVW
+ENUMX
+ BFD_RELOC_ARM_MOVT
+ENUMX
+ BFD_RELOC_ARM_MOVW_PCREL
+ENUMX
+ BFD_RELOC_ARM_MOVT_PCREL
+ENUMX
+ BFD_RELOC_ARM_THUMB_MOVW
+ENUMX
+ BFD_RELOC_ARM_THUMB_MOVT
+ENUMX
+ BFD_RELOC_ARM_THUMB_MOVW_PCREL
+ENUMX
+ BFD_RELOC_ARM_THUMB_MOVT_PCREL
+ENUMDOC
+ Low and High halfword relocations for MOVW and MOVT instructions.
ENUM
BFD_RELOC_ARM_JUMP_SLOT
@@ -2739,12 +2853,73 @@ ENUMDOC
ARM thread-local storage relocations.
ENUM
+ BFD_RELOC_ARM_ALU_PC_G0_NC
+ENUMX
+ BFD_RELOC_ARM_ALU_PC_G0
+ENUMX
+ BFD_RELOC_ARM_ALU_PC_G1_NC
+ENUMX
+ BFD_RELOC_ARM_ALU_PC_G1
+ENUMX
+ BFD_RELOC_ARM_ALU_PC_G2
+ENUMX
+ BFD_RELOC_ARM_LDR_PC_G0
+ENUMX
+ BFD_RELOC_ARM_LDR_PC_G1
+ENUMX
+ BFD_RELOC_ARM_LDR_PC_G2
+ENUMX
+ BFD_RELOC_ARM_LDRS_PC_G0
+ENUMX
+ BFD_RELOC_ARM_LDRS_PC_G1
+ENUMX
+ BFD_RELOC_ARM_LDRS_PC_G2
+ENUMX
+ BFD_RELOC_ARM_LDC_PC_G0
+ENUMX
+ BFD_RELOC_ARM_LDC_PC_G1
+ENUMX
+ BFD_RELOC_ARM_LDC_PC_G2
+ENUMX
+ BFD_RELOC_ARM_ALU_SB_G0_NC
+ENUMX
+ BFD_RELOC_ARM_ALU_SB_G0
+ENUMX
+ BFD_RELOC_ARM_ALU_SB_G1_NC
+ENUMX
+ BFD_RELOC_ARM_ALU_SB_G1
+ENUMX
+ BFD_RELOC_ARM_ALU_SB_G2
+ENUMX
+ BFD_RELOC_ARM_LDR_SB_G0
+ENUMX
+ BFD_RELOC_ARM_LDR_SB_G1
+ENUMX
+ BFD_RELOC_ARM_LDR_SB_G2
+ENUMX
+ BFD_RELOC_ARM_LDRS_SB_G0
+ENUMX
+ BFD_RELOC_ARM_LDRS_SB_G1
+ENUMX
+ BFD_RELOC_ARM_LDRS_SB_G2
+ENUMX
+ BFD_RELOC_ARM_LDC_SB_G0
+ENUMX
+ BFD_RELOC_ARM_LDC_SB_G1
+ENUMX
+ BFD_RELOC_ARM_LDC_SB_G2
+ENUMDOC
+ ARM group relocations.
+
+ENUM
BFD_RELOC_ARM_IMMEDIATE
ENUMX
BFD_RELOC_ARM_ADRL_IMMEDIATE
ENUMX
BFD_RELOC_ARM_T32_IMMEDIATE
ENUMX
+ BFD_RELOC_ARM_T32_ADD_IMM
+ENUMX
BFD_RELOC_ARM_T32_IMM12
ENUMX
BFD_RELOC_ARM_T32_ADD_PC12
@@ -3530,6 +3705,50 @@ ENUMDOC
Motorola Mcore relocations.
ENUM
+ BFD_RELOC_MEP_8
+ENUMX
+ BFD_RELOC_MEP_16
+ENUMX
+ BFD_RELOC_MEP_32
+ENUMX
+ BFD_RELOC_MEP_PCREL8A2
+ENUMX
+ BFD_RELOC_MEP_PCREL12A2
+ENUMX
+ BFD_RELOC_MEP_PCREL17A2
+ENUMX
+ BFD_RELOC_MEP_PCREL24A2
+ENUMX
+ BFD_RELOC_MEP_PCABS24A2
+ENUMX
+ BFD_RELOC_MEP_LOW16
+ENUMX
+ BFD_RELOC_MEP_HI16U
+ENUMX
+ BFD_RELOC_MEP_HI16S
+ENUMX
+ BFD_RELOC_MEP_GPREL
+ENUMX
+ BFD_RELOC_MEP_TPREL
+ENUMX
+ BFD_RELOC_MEP_TPREL7
+ENUMX
+ BFD_RELOC_MEP_TPREL7A2
+ENUMX
+ BFD_RELOC_MEP_TPREL7A4
+ENUMX
+ BFD_RELOC_MEP_UIMM24
+ENUMX
+ BFD_RELOC_MEP_ADDR24A4
+ENUMX
+ BFD_RELOC_MEP_GNU_VTINHERIT
+ENUMX
+ BFD_RELOC_MEP_GNU_VTENTRY
+ENUMDOC
+ Toshiba Media Processor Relocations.
+COMMENT
+
+ENUM
BFD_RELOC_MMIX_GETA
ENUMX
BFD_RELOC_MMIX_GETA_1
@@ -3666,11 +3885,25 @@ ENUMDOC
This is a 16 bit reloc for the AVR that stores 8 bit value (usually
command address) into 8 bit immediate value of LDI insn.
ENUM
+ BFD_RELOC_AVR_LO8_LDI_GS
+ENUMDOC
+ This is a 16 bit reloc for the AVR that stores 8 bit value
+ (command address) into 8 bit immediate value of LDI insn. If the address
+ is beyond the 128k boundary, the linker inserts a jump stub for this reloc
+ in the lower 128k.
+ENUM
BFD_RELOC_AVR_HI8_LDI_PM
ENUMDOC
This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
of command address) into 8 bit immediate value of LDI insn.
ENUM
+ BFD_RELOC_AVR_HI8_LDI_GS
+ENUMDOC
+ This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
+ of command address) into 8 bit immediate value of LDI insn. If the address
+ is beyond the 128k boundary, the linker inserts a jump stub for this reloc
+ below 128k.
+ENUM
BFD_RELOC_AVR_HH8_LDI_PM
ENUMDOC
This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
@@ -3873,6 +4106,43 @@ ENUMDOC
Long displacement extension.
ENUM
+ BFD_RELOC_SCORE_DUMMY1
+ENUMDOC
+ Score relocations
+ENUM
+ BFD_RELOC_SCORE_GPREL15
+ENUMDOC
+ Low 16 bit for load/store
+ENUM
+ BFD_RELOC_SCORE_DUMMY2
+ENUMX
+ BFD_RELOC_SCORE_JMP
+ENUMDOC
+ This is a 24-bit reloc with the right 1 bit assumed to be 0
+ENUM
+ BFD_RELOC_SCORE_BRANCH
+ENUMDOC
+ This is a 19-bit reloc with the right 1 bit assumed to be 0
+ENUM
+ BFD_RELOC_SCORE16_JMP
+ENUMDOC
+ This is a 11-bit reloc with the right 1 bit assumed to be 0
+ENUM
+ BFD_RELOC_SCORE16_BRANCH
+ENUMDOC
+ This is a 8-bit reloc with the right 1 bit assumed to be 0
+ENUM
+ BFD_RELOC_SCORE_GOT15
+ENUMX
+ BFD_RELOC_SCORE_GOT_LO16
+ENUMX
+ BFD_RELOC_SCORE_CALL15
+ENUMX
+ BFD_RELOC_SCORE_DUMMY_HI16
+ENUMDOC
+ Undocumented Score relocs
+
+ENUM
BFD_RELOC_IP2K_FR9
ENUMDOC
Scenix IP2K - 9-bit register number / data address
@@ -4246,6 +4516,63 @@ ENUMDOC
NS CR16C Relocations.
ENUM
+ BFD_RELOC_CR16_NUM8
+ENUMX
+ BFD_RELOC_CR16_NUM16
+ENUMX
+ BFD_RELOC_CR16_NUM32
+ENUMX
+ BFD_RELOC_CR16_NUM32a
+ENUMX
+ BFD_RELOC_CR16_REGREL0
+ENUMX
+ BFD_RELOC_CR16_REGREL4
+ENUMX
+ BFD_RELOC_CR16_REGREL4a
+ENUMX
+ BFD_RELOC_CR16_REGREL14
+ENUMX
+ BFD_RELOC_CR16_REGREL14a
+ENUMX
+ BFD_RELOC_CR16_REGREL16
+ENUMX
+ BFD_RELOC_CR16_REGREL20
+ENUMX
+ BFD_RELOC_CR16_REGREL20a
+ENUMX
+ BFD_RELOC_CR16_ABS20
+ENUMX
+ BFD_RELOC_CR16_ABS24
+ENUMX
+ BFD_RELOC_CR16_IMM4
+ENUMX
+ BFD_RELOC_CR16_IMM8
+ENUMX
+ BFD_RELOC_CR16_IMM16
+ENUMX
+ BFD_RELOC_CR16_IMM20
+ENUMX
+ BFD_RELOC_CR16_IMM24
+ENUMX
+ BFD_RELOC_CR16_IMM32
+ENUMX
+ BFD_RELOC_CR16_IMM32a
+ENUMX
+ BFD_RELOC_CR16_DISP4
+ENUMX
+ BFD_RELOC_CR16_DISP8
+ENUMX
+ BFD_RELOC_CR16_DISP16
+ENUMX
+ BFD_RELOC_CR16_DISP20
+ENUMX
+ BFD_RELOC_CR16_DISP24
+ENUMX
+ BFD_RELOC_CR16_DISP24a
+ENUMDOC
+ NS CR16 Relocations.
+
+ENUM
BFD_RELOC_CRX_REL4
ENUMX
BFD_RELOC_CRX_REL8
@@ -4449,6 +4776,12 @@ ENUMDOC
Sony Xstormy16 Relocations.
ENUM
+ BFD_RELOC_RELC
+ENUMDOC
+ Self-describing complex relocations.
+COMMENT
+
+ENUM
BFD_RELOC_XC16X_PAG
ENUMX
BFD_RELOC_XC16X_POF
@@ -4670,10 +5003,13 @@ CODE_FRAGMENT
/*
FUNCTION
bfd_reloc_type_lookup
+ bfd_reloc_name_lookup
SYNOPSIS
reloc_howto_type *bfd_reloc_type_lookup
(bfd *abfd, bfd_reloc_code_real_type code);
+ reloc_howto_type *bfd_reloc_name_lookup
+ (bfd *abfd, const char *reloc_name);
DESCRIPTION
Return a pointer to a howto structure which, when
@@ -4688,6 +5024,12 @@ bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code)
return BFD_SEND (abfd, reloc_type_lookup, (abfd, code));
}
+reloc_howto_type *
+bfd_reloc_name_lookup (bfd *abfd, const char *reloc_name)
+{
+ return BFD_SEND (abfd, reloc_name_lookup, (abfd, reloc_name));
+}
+
static reloc_howto_type bfd_howto_32 =
HOWTO (0, 00, 2, 32, FALSE, 0, complain_overflow_dont, 0, "VRT32", FALSE, 0xffffffff, 0xffffffff, TRUE);
@@ -4876,13 +5218,31 @@ bfd_generic_get_relocated_section_contents (bfd *abfd,
for (parent = reloc_vector; *parent != NULL; parent++)
{
char *error_message = NULL;
- bfd_reloc_status_type r =
- bfd_perform_relocation (input_bfd,
- *parent,
- data,
- input_section,
- relocatable ? abfd : NULL,
- &error_message);
+ asymbol *symbol;
+ bfd_reloc_status_type r;
+
+ symbol = *(*parent)->sym_ptr_ptr;
+ if (symbol->section && elf_discarded_section (symbol->section))
+ {
+ bfd_byte *p;
+ static reloc_howto_type none_howto
+ = HOWTO (0, 0, 0, 0, FALSE, 0, complain_overflow_dont, NULL,
+ "unused", FALSE, 0, 0, FALSE);
+
+ p = data + (*parent)->address * bfd_octets_per_byte (input_bfd);
+ _bfd_clear_contents ((*parent)->howto, input_bfd, p);
+ (*parent)->sym_ptr_ptr = bfd_abs_section.symbol_ptr_ptr;
+ (*parent)->addend = 0;
+ (*parent)->howto = &none_howto;
+ r = bfd_reloc_ok;
+ }
+ else
+ r = bfd_perform_relocation (input_bfd,
+ *parent,
+ data,
+ input_section,
+ relocatable ? abfd : NULL,
+ &error_message);
if (relocatable)
{
diff --git a/bfd/reloc16.c b/bfd/reloc16.c
index 3adbbc75cd1a..f5c78b2c73b6 100644
--- a/bfd/reloc16.c
+++ b/bfd/reloc16.c
@@ -1,6 +1,6 @@
/* 8 and 16 bit COFF relocation functions, for BFD.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001,
- 2002, 2003, 2004 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -32,8 +32,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
file) (unless info->keep_memory is FALSE, in which case they should
free up the relocs after dealing with them). */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "bfdlink.h"
#include "genlink.h"
diff --git a/bfd/riscix.c b/bfd/riscix.c
index 182707981e4d..2e9416e1269f 100644
--- a/bfd/riscix.c
+++ b/bfd/riscix.c
@@ -1,6 +1,6 @@
/* BFD back-end for RISC iX (Acorn, arm) binaries.
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004,
- 2005 Free Software Foundation, Inc.
+ 2005, 2007 Free Software Foundation, Inc.
Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
This file is part of BFD, the Binary File Descriptor library.
@@ -103,8 +103,8 @@
&& ((x).a_info != NMAGIC))
#define N_MAGIC(x) ((x).a_info & ~07200)
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#define WRITE_HEADERS(abfd, execp) \
@@ -274,12 +274,29 @@ riscix_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code)
}
}
+static reloc_howto_type *
+riscix_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (riscix_std_reloc_howto) / sizeof (riscix_std_reloc_howto[0]);
+ i++)
+ if (riscix_std_reloc_howto[i].name != NULL
+ && strcasecmp (riscix_std_reloc_howto[i].name, r_name) == 0)
+ return &riscix_std_reloc_howto[i];
+
+ return NULL;
+}
+
#define MY_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define MY_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define MY_final_link_callback should_not_be_used
#define MY_bfd_final_link _bfd_generic_final_link
#define MY_bfd_reloc_type_lookup riscix_reloc_type_lookup
+#define MY_bfd_reloc_name_lookup riscix_reloc_name_lookup
#define MY_canonicalize_reloc riscix_canonicalize_reloc
#define MY_object_p riscix_object_p
diff --git a/bfd/rs6000-core.c b/bfd/rs6000-core.c
index 280a020a754e..4a2e107d3d7c 100644
--- a/bfd/rs6000-core.c
+++ b/bfd/rs6000-core.c
@@ -1,13 +1,8 @@
/* IBM RS/6000 "XCOFF" back-end for BFD.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
- 2001, 2002, 2004
+ 2001, 2002, 2004, 2006, 2007
Free Software Foundation, Inc.
- FIXME: Can someone provide a transliteration of this name into ASCII?
- Using the following chars caused a compiler warning on HIUX (so I replaced
- them with octal escapes), and isn't useful without an understanding of what
- character set it is.
- Written by Metin G. Ozisik, Mimi Ph\373\364ng-Th\345o V\365,
- and John Gilmore.
+ Written by Metin G. Ozisik, Mimi Phuong-Thao Vo, and John Gilmore.
Archive support from Damon A. Permezel.
Contributed by IBM Corporation and Cygnus Support.
@@ -44,8 +39,8 @@
#define _LONG_LONG
#endif
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#ifdef AIX_CORE
@@ -294,11 +289,10 @@ make_bfd_asection (bfd *abfd, const char *name, flagword flags,
{
asection *asect;
- asect = bfd_make_section_anyway (abfd, name);
+ asect = bfd_make_section_anyway_with_flags (abfd, name, flags);
if (!asect)
return NULL;
- asect->flags = flags;
asect->size = size;
asect->vma = vma;
asect->filepos = filepos;
diff --git a/bfd/sco5-core.c b/bfd/sco5-core.c
index 9a06b8839f54..21631cf5b84e 100644
--- a/bfd/sco5-core.c
+++ b/bfd/sco5-core.c
@@ -1,5 +1,5 @@
/* BFD back end for SCO5 core files (U-area and raw sections)
- Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Jouke Numan <jnuman@hiscom.nl>
@@ -19,8 +19,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "libaout.h" /* BFD a.out internal data structures */
@@ -63,10 +63,9 @@ make_bfd_asection (abfd, name, flags, size, vma, filepos)
{
asection *asect;
- asect = bfd_make_section_anyway (abfd, name);
+ asect = bfd_make_section_anyway_with_flags (abfd, name, flags);
if (!asect)
return NULL;
- asect->flags = flags;
asect->size = size;
asect->vma = vma;
asect->filepos = filepos;
diff --git a/bfd/section.c b/bfd/section.c
index f870e6bfc08a..135f44c0780d 100644
--- a/bfd/section.c
+++ b/bfd/section.c
@@ -1,6 +1,6 @@
/* Object file "section" support for the BFD library.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -133,8 +133,8 @@ SUBSECTION
*/
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "bfdlink.h"
@@ -294,7 +294,9 @@ CODE_FRAGMENT
. else up the line will take care of it later. *}
.#define SEC_LINKER_CREATED 0x200000
.
-. {* This section should not be subject to garbage collection. *}
+. {* This section should not be subject to garbage collection.
+. Also set to inform the linker that this section should not be
+. listed in the link map as discarded. *}
.#define SEC_KEEP 0x400000
.
. {* This section contains "short" data, and should be placed
@@ -540,11 +542,6 @@ CODE_FRAGMENT
. || ((SEC) == bfd_com_section_ptr) \
. || ((SEC) == bfd_ind_section_ptr))
.
-.extern const struct bfd_symbol * const bfd_abs_symbol;
-.extern const struct bfd_symbol * const bfd_com_symbol;
-.extern const struct bfd_symbol * const bfd_und_symbol;
-.extern const struct bfd_symbol * const bfd_ind_symbol;
-.
.{* Macros to handle insertion and deletion of a bfd's sections. These
. only handle the list pointers, ie. do not adjust section_count,
. target_index etc. *}
@@ -635,7 +632,7 @@ CODE_FRAGMENT
.#define bfd_section_removed_from_list(ABFD, S) \
. ((S)->next == NULL ? (ABFD)->section_last != (S) : (S)->next->prev != (S))
.
-.#define BFD_FAKE_SECTION(SEC, FLAGS, SYM, SYM_PTR, NAME, IDX) \
+.#define BFD_FAKE_SECTION(SEC, FLAGS, SYM, NAME, IDX) \
. {* name, id, index, next, prev, flags, user_set_vma, *} \
. { NAME, IDX, 0, NULL, NULL, FLAGS, 0, \
. \
@@ -666,11 +663,8 @@ CODE_FRAGMENT
. {* target_index, used_by_bfd, constructor_chain, owner, *} \
. 0, NULL, NULL, NULL, \
. \
-. {* symbol, *} \
-. (struct bfd_symbol *) SYM, \
-. \
-. {* symbol_ptr_ptr, *} \
-. (struct bfd_symbol **) SYM_PTR, \
+. {* symbol, symbol_ptr_ptr, *} \
+. (struct bfd_symbol *) SYM, &SEC.symbol, \
. \
. {* map_head, map_tail *} \
. { NULL }, { NULL } \
@@ -701,16 +695,14 @@ static const asymbol global_syms[] =
GLOBAL_SYM_INIT (BFD_IND_SECTION_NAME, &bfd_ind_section)
};
-#define STD_SECTION(SEC, FLAGS, SYM, NAME, IDX) \
- const asymbol * const SYM = (asymbol *) &global_syms[IDX]; \
- asection SEC = BFD_FAKE_SECTION(SEC, FLAGS, &global_syms[IDX], &SYM, \
+#define STD_SECTION(SEC, FLAGS, NAME, IDX) \
+ asection SEC = BFD_FAKE_SECTION(SEC, FLAGS, &global_syms[IDX], \
NAME, IDX)
-STD_SECTION (bfd_com_section, SEC_IS_COMMON, bfd_com_symbol,
- BFD_COM_SECTION_NAME, 0);
-STD_SECTION (bfd_und_section, 0, bfd_und_symbol, BFD_UND_SECTION_NAME, 1);
-STD_SECTION (bfd_abs_section, 0, bfd_abs_symbol, BFD_ABS_SECTION_NAME, 2);
-STD_SECTION (bfd_ind_section, 0, bfd_ind_symbol, BFD_IND_SECTION_NAME, 3);
+STD_SECTION (bfd_com_section, SEC_IS_COMMON, BFD_COM_SECTION_NAME, 0);
+STD_SECTION (bfd_und_section, 0, BFD_UND_SECTION_NAME, 1);
+STD_SECTION (bfd_abs_section, 0, BFD_ABS_SECTION_NAME, 2);
+STD_SECTION (bfd_ind_section, 0, BFD_IND_SECTION_NAME, 3);
#undef STD_SECTION
/* Initialize an entry in the section hash table. */
@@ -743,23 +735,16 @@ bfd_section_hash_newfunc (struct bfd_hash_entry *entry,
((struct section_hash_entry *) \
bfd_hash_lookup ((table), (string), (create), (copy)))
-/* Initializes a new section. NEWSECT->NAME is already set. */
+/* Create a symbol whose only job is to point to this section. This
+ is useful for things like relocs which are relative to the base
+ of a section. */
-static asection *
-bfd_section_init (bfd *abfd, asection *newsect)
+bfd_boolean
+_bfd_generic_new_section_hook (bfd *abfd, asection *newsect)
{
- static int section_id = 0x10; /* id 0 to 3 used by STD_SECTION. */
-
- newsect->id = section_id;
- newsect->index = abfd->section_count;
- newsect->owner = abfd;
-
- /* Create a symbol whose only job is to point to this section. This
- is useful for things like relocs which are relative to the base
- of a section. */
newsect->symbol = bfd_make_empty_symbol (abfd);
if (newsect->symbol == NULL)
- return NULL;
+ return FALSE;
newsect->symbol->name = newsect->name;
newsect->symbol->value = 0;
@@ -767,6 +752,19 @@ bfd_section_init (bfd *abfd, asection *newsect)
newsect->symbol->flags = BSF_SECTION_SYM;
newsect->symbol_ptr_ptr = &newsect->symbol;
+ return TRUE;
+}
+
+/* Initializes a new section. NEWSECT->NAME is already set. */
+
+static asection *
+bfd_section_init (bfd *abfd, asection *newsect)
+{
+ static int section_id = 0x10; /* id 0 to 3 used by STD_SECTION. */
+
+ newsect->id = section_id;
+ newsect->index = abfd->section_count;
+ newsect->owner = abfd;
if (! BFD_SEND (abfd, _new_section_hook, (abfd, newsect)))
return NULL;
@@ -964,7 +962,6 @@ DESCRIPTION
asection *
bfd_make_section_old_way (bfd *abfd, const char *name)
{
- struct section_hash_entry *sh;
asection *newsect;
if (abfd->output_has_begun)
@@ -974,30 +971,38 @@ bfd_make_section_old_way (bfd *abfd, const char *name)
}
if (strcmp (name, BFD_ABS_SECTION_NAME) == 0)
- return bfd_abs_section_ptr;
-
- if (strcmp (name, BFD_COM_SECTION_NAME) == 0)
- return bfd_com_section_ptr;
+ newsect = bfd_abs_section_ptr;
+ else if (strcmp (name, BFD_COM_SECTION_NAME) == 0)
+ newsect = bfd_com_section_ptr;
+ else if (strcmp (name, BFD_UND_SECTION_NAME) == 0)
+ newsect = bfd_und_section_ptr;
+ else if (strcmp (name, BFD_IND_SECTION_NAME) == 0)
+ newsect = bfd_ind_section_ptr;
+ else
+ {
+ struct section_hash_entry *sh;
- if (strcmp (name, BFD_UND_SECTION_NAME) == 0)
- return bfd_und_section_ptr;
+ sh = section_hash_lookup (&abfd->section_htab, name, TRUE, FALSE);
+ if (sh == NULL)
+ return NULL;
- if (strcmp (name, BFD_IND_SECTION_NAME) == 0)
- return bfd_ind_section_ptr;
+ newsect = &sh->section;
+ if (newsect->name != NULL)
+ {
+ /* Section already exists. */
+ return newsect;
+ }
- sh = section_hash_lookup (&abfd->section_htab, name, TRUE, FALSE);
- if (sh == NULL)
- return NULL;
-
- newsect = &sh->section;
- if (newsect->name != NULL)
- {
- /* Section already exists. */
- return newsect;
+ newsect->name = name;
+ return bfd_section_init (abfd, newsect);
}
- newsect->name = name;
- return bfd_section_init (abfd, newsect);
+ /* Call new_section_hook when "creating" the standard abs, com, und
+ and ind sections to tack on format specific section data.
+ Also, create a proper section symbol. */
+ if (! BFD_SEND (abfd, _new_section_hook, (abfd, newsect)))
+ return NULL;
+ return newsect;
}
/*
diff --git a/bfd/simple.c b/bfd/simple.c
index d06ce2a96e11..8ebc47e0597e 100644
--- a/bfd/simple.c
+++ b/bfd/simple.c
@@ -1,5 +1,5 @@
/* simple.c -- BFD simple client routines
- Copyright 2002, 2003, 2004, 2005
+ Copyright 2002, 2003, 2004, 2005, 2007
Free Software Foundation, Inc.
Contributed by MontaVista Software, Inc.
@@ -19,8 +19,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "bfdlink.h"
@@ -183,6 +183,7 @@ bfd_simple_get_relocated_section_contents (bfd *abfd,
/* Fill in the bare minimum number of fields for our purposes. */
memset (&link_info, 0, sizeof (link_info));
link_info.input_bfds = abfd;
+ link_info.input_bfds_tail = &abfd->link_next;
link_info.hash = _bfd_generic_link_hash_table_create (abfd);
link_info.callbacks = &callbacks;
diff --git a/bfd/som.c b/bfd/som.c
index 0c9e1b79f9c7..28eb885bfe2c 100644
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -1,6 +1,6 @@
/* bfd back-end for HP PA-RISC SOM objects.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Contributed by the Center for Software Science at the
@@ -24,8 +24,8 @@
02110-1301, USA. */
#include "alloca-conf.h"
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF) || defined(HOST_HPPAMPEIX)
@@ -1626,6 +1626,22 @@ som_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return NULL;
}
+static reloc_howto_type *
+som_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (som_hppa_howto_table) / sizeof (som_hppa_howto_table[0]);
+ i++)
+ if (som_hppa_howto_table[i].name != NULL
+ && strcasecmp (som_hppa_howto_table[i].name, r_name) == 0)
+ return &som_hppa_howto_table[i];
+
+ return NULL;
+}
+
/* Perform some initialization for an object. Save results of this
initialization in the BFD. */
@@ -4374,12 +4390,12 @@ som_slurp_symbol_table (bfd *abfd)
&& sym->symbol.name[strlen (sym->symbol.name) - 1] == '$'
&& !strcmp (sym->symbol.name, sym->symbol.section->name))
sym->symbol.flags |= BSF_SECTION_SYM;
- else if (!strncmp (sym->symbol.name, "L$0\002", 4))
+ else if (CONST_STRNEQ (sym->symbol.name, "L$0\002"))
{
sym->symbol.flags |= BSF_SECTION_SYM;
sym->symbol.name = sym->symbol.section->name;
}
- else if (!strncmp (sym->symbol.name, "L$0\001", 4))
+ else if (CONST_STRNEQ (sym->symbol.name, "L$0\001"))
sym->symbol.flags |= BSF_DEBUGGING;
/* Note increment at bottom of loop, since we skip some symbols
@@ -4959,15 +4975,18 @@ extern const bfd_target som_vec;
static bfd_boolean
som_new_section_hook (bfd *abfd, asection *newsect)
{
- bfd_size_type amt = sizeof (struct som_section_data_struct);
-
- newsect->used_by_bfd = bfd_zalloc (abfd, amt);
if (!newsect->used_by_bfd)
- return FALSE;
+ {
+ bfd_size_type amt = sizeof (struct som_section_data_struct);
+
+ newsect->used_by_bfd = bfd_zalloc (abfd, amt);
+ if (!newsect->used_by_bfd)
+ return FALSE;
+ }
newsect->alignment_power = 3;
/* We allow more than three sections internally. */
- return TRUE;
+ return _bfd_generic_new_section_hook (abfd, newsect);
}
/* Copy any private info we understand from the input symbol
@@ -5325,7 +5344,7 @@ som_find_nearest_line (bfd *abfd ATTRIBUTE_UNUSED,
static int
som_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
- bfd_boolean reloc ATTRIBUTE_UNUSED)
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
(*_bfd_error_handler) (_("som_sizeof_headers unimplemented"));
fflush (stderr);
@@ -5650,7 +5669,7 @@ som_slurp_armap (bfd *abfd)
return FALSE;
/* For archives without .o files there is no symbol table. */
- if (strncmp (nextname, "/ ", 16))
+ if (! CONST_STRNEQ (nextname, "/ "))
{
bfd_has_map (abfd) = FALSE;
return TRUE;
@@ -5749,7 +5768,7 @@ som_bfd_prep_for_ar_write (bfd *abfd,
if (curr_bfd->format != bfd_object
|| curr_bfd->xvec->flavour != bfd_target_som_flavour)
{
- curr_bfd = curr_bfd->next;
+ curr_bfd = curr_bfd->archive_next;
continue;
}
@@ -5794,7 +5813,7 @@ som_bfd_prep_for_ar_write (bfd *abfd,
(*stringsize)++;
}
- curr_bfd = curr_bfd->next;
+ curr_bfd = curr_bfd->archive_next;
}
return TRUE;
}
@@ -5903,7 +5922,7 @@ som_bfd_ar_write_symbol_stuff (bfd *abfd,
if (curr_bfd->format != bfd_object
|| curr_bfd->xvec->flavour != bfd_target_som_flavour)
{
- curr_bfd = curr_bfd->next;
+ curr_bfd = curr_bfd->archive_next;
continue;
}
@@ -6019,7 +6038,7 @@ som_bfd_ar_write_symbol_stuff (bfd *abfd,
linker requires objects begin on an even boundary. So round
up the current offset as necessary. */
curr_som_offset = (curr_som_offset + 0x1) &~ (unsigned) 1;
- curr_bfd = curr_bfd->next;
+ curr_bfd = curr_bfd->archive_next;
som_index++;
}
@@ -6125,7 +6144,7 @@ som_write_armap (bfd *abfd,
if (curr_bfd->format == bfd_object
&& curr_bfd->xvec->flavour == bfd_target_som_flavour)
lst.module_count++;
- curr_bfd = curr_bfd->next;
+ curr_bfd = curr_bfd->archive_next;
}
lst.module_limit = lst.module_count;
lst.dir_loc = lst_size;
diff --git a/bfd/sparclinux.c b/bfd/sparclinux.c
index d8659eec16ba..445a66c0e103 100644
--- a/bfd/sparclinux.c
+++ b/bfd/sparclinux.c
@@ -1,23 +1,23 @@
/* BFD back-end for linux flavored sparc a.out binaries.
Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002,
- 2003, 2004, 2006 Free Software Foundation, Inc.
+ 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
-USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
+ USA. */
#define TARGET_PAGE_SIZE 4096
#define ZMAGIC_DISK_BLOCK_SIZE 1024
@@ -27,8 +27,8 @@ USA. */
#define MACHTYPE_OK(mtype) ((mtype) == M_SPARC || (mtype) == M_UNKNOWN)
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "aout/aout64.h"
#include "aout/stab_gnu.h"
@@ -94,8 +94,7 @@ sparclinux_write_object_contents (abfd)
#define GOT_REF_PREFIX "__GOT_"
#endif
-#define IS_GOT_SYM(name) \
- (strncmp (name, GOT_REF_PREFIX, sizeof GOT_REF_PREFIX - 1) == 0)
+#define IS_GOT_SYM(name) (CONST_STRNEQ (name, GOT_REF_PREFIX))
/* See if a symbol name is a reference to the procedure linkage table. */
@@ -103,8 +102,7 @@ sparclinux_write_object_contents (abfd)
#define PLT_REF_PREFIX "__PLT_"
#endif
-#define IS_PLT_SYM(name) \
- (strncmp (name, PLT_REF_PREFIX, sizeof PLT_REF_PREFIX - 1) == 0)
+#define IS_PLT_SYM(name) (CONST_STRNEQ (name, PLT_REF_PREFIX))
/* This string is used to generate specialized error messages. */
@@ -313,9 +311,8 @@ linux_link_create_dynamic_sections (abfd, info)
/* We choose to use the name ".linux-dynamic" for the fixup table.
Why not? */
- s = bfd_make_section (abfd, ".linux-dynamic");
+ s = bfd_make_section_with_flags (abfd, ".linux-dynamic", flags);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags)
|| ! bfd_set_section_alignment (abfd, s, 2))
return FALSE;
s->size = 0;
@@ -429,9 +426,7 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string,
This function is called via linux_link_hash_traverse. */
static bfd_boolean
-linux_tally_symbols (h, data)
- struct linux_link_hash_entry *h;
- PTR data;
+linux_tally_symbols (struct linux_link_hash_entry *h, void * data)
{
struct bfd_link_info *info = (struct bfd_link_info *) data;
struct fixup *f, *f1;
@@ -443,8 +438,7 @@ linux_tally_symbols (h, data)
h = (struct linux_link_hash_entry *) h->root.root.u.i.link;
if (h->root.root.type == bfd_link_hash_undefined
- && strncmp (h->root.root.root.string, NEEDS_SHRLIB,
- sizeof NEEDS_SHRLIB - 1) == 0)
+ && CONST_STRNEQ (h->root.root.root.string, NEEDS_SHRLIB))
{
const char *name;
char *p;
diff --git a/bfd/sparclynx.c b/bfd/sparclynx.c
index 81aa5548153d..df61d425d25f 100644
--- a/bfd/sparclynx.c
+++ b/bfd/sparclynx.c
@@ -1,6 +1,6 @@
/* BFD support for Sparc binaries under LynxOS.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1998, 2000,
- 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+ 2001, 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -24,8 +24,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
#define MY(OP) CONCAT2 (sparclynx_aout_,OP)
#define TARGETNAME "a.out-sparc-lynx"
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "aout/sun4.h"
diff --git a/bfd/srec.c b/bfd/srec.c
index 2b24f46ffb64..354a6ee670f0 100644
--- a/bfd/srec.c
+++ b/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, 2003, 2004, 2005
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
@@ -101,8 +101,8 @@
We allow symbols to be anywhere in the data stream - the module names
are always ignored. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "libiberty.h"
#include "safe-ctype.h"
@@ -526,15 +526,16 @@ srec_scan (bfd *abfd)
char secbuf[20];
char *secname;
bfd_size_type amt;
+ flagword flags;
sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1);
amt = strlen (secbuf) + 1;
secname = bfd_alloc (abfd, amt);
strcpy (secname, secbuf);
- sec = bfd_make_section (abfd, secname);
+ flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC;
+ sec = bfd_make_section_with_flags (abfd, secname, flags);
if (sec == NULL)
goto error_return;
- sec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC;
sec->vma = address;
sec->lma = address;
sec->size = bytes;
@@ -1099,7 +1100,7 @@ symbolsrec_write_object_contents (bfd *abfd)
static int
srec_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
- bfd_boolean exec ATTRIBUTE_UNUSED)
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
return 0;
}
@@ -1193,9 +1194,6 @@ srec_print_symbol (bfd *abfd,
#define srec_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
#define srec_read_minisymbols _bfd_generic_read_minisymbols
#define srec_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
-#define srec_get_reloc_upper_bound ((long (*) (bfd *, asection *)) bfd_0l)
-#define srec_canonicalize_reloc ((long (*) (bfd *, asection *, arelent **, asymbol **)) bfd_0l)
-#define srec_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
#define srec_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
#define srec_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
#define srec_bfd_relax_section bfd_generic_relax_section
@@ -1256,7 +1254,7 @@ const bfd_target srec_vec =
BFD_JUMP_TABLE_CORE (_bfd_nocore),
BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
BFD_JUMP_TABLE_SYMBOLS (srec),
- BFD_JUMP_TABLE_RELOCS (srec),
+ BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
BFD_JUMP_TABLE_WRITE (srec),
BFD_JUMP_TABLE_LINK (srec),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
@@ -1311,7 +1309,7 @@ const bfd_target symbolsrec_vec =
BFD_JUMP_TABLE_CORE (_bfd_nocore),
BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
BFD_JUMP_TABLE_SYMBOLS (srec),
- BFD_JUMP_TABLE_RELOCS (srec),
+ BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
BFD_JUMP_TABLE_WRITE (srec),
BFD_JUMP_TABLE_LINK (srec),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
diff --git a/bfd/stabs.c b/bfd/stabs.c
index ba3f93446193..1192cd165b91 100644
--- a/bfd/stabs.c
+++ b/bfd/stabs.c
@@ -1,6 +1,6 @@
/* Stabs in sections linking support.
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- 2006 Free Software Foundation, Inc.
+ 2006, 2007 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -22,8 +22,8 @@
/* This file contains support for linking stabs in sections, as used
on COFF and ELF. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "aout/stab_gnu.h"
#include "safe-ctype.h"
@@ -175,10 +175,8 @@ _bfd_link_section_stabs (bfd *abfd,
prepared to handle them. */
return TRUE;
- if ((stabsec->output_section != NULL
- && bfd_is_abs_section (stabsec->output_section))
- || (stabstrsec->output_section != NULL
- && bfd_is_abs_section (stabstrsec->output_section)))
+ if (bfd_is_abs_section (stabsec->output_section)
+ || bfd_is_abs_section (stabstrsec->output_section))
/* At least one of the sections is being discarded from the
link, so we should just ignore them. */
return TRUE;
@@ -187,6 +185,8 @@ _bfd_link_section_stabs (bfd *abfd,
if (sinfo->stabstr == NULL)
{
+ flagword flags;
+
/* Initialize the stabs information we need to keep track of. */
first = TRUE;
sinfo->strings = _bfd_stringtab_init ();
@@ -198,11 +198,12 @@ _bfd_link_section_stabs (bfd *abfd,
stab_link_includes_newfunc,
sizeof (struct stab_link_includes_entry)))
goto error_return;
- sinfo->stabstr = bfd_make_section_anyway (abfd, ".stabstr");
+ flags = (SEC_HAS_CONTENTS | SEC_READONLY | SEC_DEBUGGING
+ | SEC_LINKER_CREATED);
+ sinfo->stabstr = bfd_make_section_anyway_with_flags (abfd, ".stabstr",
+ flags);
if (sinfo->stabstr == NULL)
goto error_return;
- sinfo->stabstr->flags |= (SEC_HAS_CONTENTS | SEC_READONLY
- | SEC_DEBUGGING | SEC_LINKER_CREATED);
}
/* Initialize the information we are going to store for this .stab
@@ -430,7 +431,7 @@ _bfd_link_section_stabs (bfd *abfd,
++nest;
else if (incl_type == (int) N_EXCL)
/* Keep existing exclusion marks. */
- continue;
+ continue;
else if (nest == 0)
{
*incl_pstridx = (bfd_size_type) -1;
@@ -455,8 +456,8 @@ _bfd_link_section_stabs (bfd *abfd,
for that section. */
stabsec->size = (count - skip) * STABSIZE;
if (stabsec->size == 0)
- stabsec->flags |= SEC_EXCLUDE;
- stabstrsec->flags |= SEC_EXCLUDE;
+ stabsec->flags |= SEC_EXCLUDE | SEC_KEEP;
+ stabstrsec->flags |= SEC_EXCLUDE | SEC_KEEP;
sinfo->stabstr->size = _bfd_stringtab_size (sinfo->strings);
/* Calculate the `cumulative_skips' array now that stabs have been
@@ -608,7 +609,7 @@ _bfd_discard_section_stabs (bfd *abfd,
/* Shrink the stabsec as needed. */
stabsec->size -= skip * STABSIZE;
if (stabsec->size == 0)
- stabsec->flags |= SEC_EXCLUDE;
+ stabsec->flags |= SEC_EXCLUDE | SEC_KEEP;
/* Recalculate the `cumulative_skips' array now that stabs have been
deleted for this section. */
diff --git a/bfd/sunos.c b/bfd/sunos.c
index 024320fbfa18..a9117f477181 100644
--- a/bfd/sunos.c
+++ b/bfd/sunos.c
@@ -745,57 +745,50 @@ sunos_create_dynamic_sections (bfd *abfd,
/* The .dynamic section holds the basic dynamic information: the
sun4_dynamic structure, the dynamic debugger information, and
the sun4_dynamic_link structure. */
- s = bfd_make_section (abfd, ".dynamic");
+ s = bfd_make_section_with_flags (abfd, ".dynamic", flags);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags)
|| ! bfd_set_section_alignment (abfd, s, 2))
return FALSE;
/* The .got section holds the global offset table. The address
is put in the ld_got field. */
- s = bfd_make_section (abfd, ".got");
+ s = bfd_make_section_with_flags (abfd, ".got", flags);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags)
|| ! bfd_set_section_alignment (abfd, s, 2))
return FALSE;
/* The .plt section holds the procedure linkage table. The
address is put in the ld_plt field. */
- s = bfd_make_section (abfd, ".plt");
+ s = bfd_make_section_with_flags (abfd, ".plt", flags | SEC_CODE);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_CODE)
|| ! bfd_set_section_alignment (abfd, s, 2))
return FALSE;
/* The .dynrel section holds the dynamic relocs. The address is
put in the ld_rel field. */
- s = bfd_make_section (abfd, ".dynrel");
+ s = bfd_make_section_with_flags (abfd, ".dynrel", flags | SEC_READONLY);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
|| ! bfd_set_section_alignment (abfd, s, 2))
return FALSE;
/* The .hash section holds the dynamic hash table. The address
is put in the ld_hash field. */
- s = bfd_make_section (abfd, ".hash");
+ s = bfd_make_section_with_flags (abfd, ".hash", flags | SEC_READONLY);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
|| ! bfd_set_section_alignment (abfd, s, 2))
return FALSE;
/* The .dynsym section holds the dynamic symbols. The address
is put in the ld_stab field. */
- s = bfd_make_section (abfd, ".dynsym");
+ s = bfd_make_section_with_flags (abfd, ".dynsym", flags | SEC_READONLY);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
|| ! bfd_set_section_alignment (abfd, s, 2))
return FALSE;
/* The .dynstr section holds the dynamic symbol string table.
The address is put in the ld_symbols field. */
- s = bfd_make_section (abfd, ".dynstr");
+ s = bfd_make_section_with_flags (abfd, ".dynstr", flags | SEC_READONLY);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
|| ! bfd_set_section_alignment (abfd, s, 2))
return FALSE;
@@ -890,14 +883,10 @@ sunos_add_dynamic_symbols (bfd *abfd,
/* The .need section holds the list of names of shared objets
which must be included at runtime. The address of this
section is put in the ld_need field. */
- asection *s = bfd_make_section (dynobj, ".need");
+ flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY | SEC_READONLY);
+ asection *s = bfd_make_section_with_flags (dynobj, ".need", flags);
if (s == NULL
- || ! bfd_set_section_flags (dynobj, s,
- (SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_READONLY))
|| ! bfd_set_section_alignment (dynobj, s, 2))
return FALSE;
}
@@ -907,14 +896,10 @@ sunos_add_dynamic_symbols (bfd *abfd,
/* The .rules section holds the path to search for shared
objects. The address of this section is put in the ld_rules
field. */
- asection *s = bfd_make_section (dynobj, ".rules");
+ flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY | SEC_READONLY);
+ asection *s = bfd_make_section_with_flags (dynobj, ".rules", flags);
if (s == NULL
- || ! bfd_set_section_flags (dynobj, s,
- (SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_READONLY))
|| ! bfd_set_section_alignment (dynobj, s, 2))
return FALSE;
}
diff --git a/bfd/syms.c b/bfd/syms.c
index 0ff94164ed5e..89c38692ed30 100644
--- a/bfd/syms.c
+++ b/bfd/syms.c
@@ -1,6 +1,6 @@
/* Generic symbol-table support for the BFD library.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004
+ 2000, 2001, 2002, 2003, 2004, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -288,6 +288,14 @@ CODE_FRAGMENT
. {* This symbol is thread local. Used in ELF. *}
.#define BSF_THREAD_LOCAL 0x40000
.
+. {* This symbol represents a complex relocation expression,
+. with the expression tree serialized in the symbol name. *}
+.#define BSF_RELC 0x80000
+.
+. {* This symbol represents a signed complex relocation expression,
+. with the expression tree serialized in the symbol name. *}
+.#define BSF_SRELC 0x100000
+.
. flagword flags;
.
. {* A pointer to the section to which this symbol is
@@ -307,8 +315,8 @@ CODE_FRAGMENT
.
*/
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "safe-ctype.h"
#include "bfdlink.h"
diff --git a/bfd/sysdep.h b/bfd/sysdep.h
index f6313d3905ce..e1b070b4a899 100644
--- a/bfd/sysdep.h
+++ b/bfd/sysdep.h
@@ -1,5 +1,5 @@
/* sysdep.h -- handle host dependencies for the BFD library
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -22,10 +22,10 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef BFD_SYSDEP_H
#define BFD_SYSDEP_H
-#include "ansidecl.h"
-
#include "config.h"
+#include "ansidecl.h"
+
#ifdef HAVE_STDDEF_H
#include <stddef.h>
#endif
diff --git a/bfd/targets.c b/bfd/targets.c
index 849eb944fbeb..23e52cd6ec82 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -1,6 +1,6 @@
/* Generic target-file-type support for the BFD library.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -20,8 +20,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "fnmatch.h"
@@ -402,7 +402,8 @@ BFD_JUMP_TABLE macros.
.#define BFD_JUMP_TABLE_RELOCS(NAME) \
. NAME##_get_reloc_upper_bound, \
. NAME##_canonicalize_reloc, \
-. NAME##_bfd_reloc_type_lookup
+. NAME##_bfd_reloc_type_lookup, \
+. NAME##_bfd_reloc_name_lookup
.
. long (*_get_reloc_upper_bound) (bfd *, sec_ptr);
. long (*_bfd_canonicalize_reloc)
@@ -410,6 +411,9 @@ BFD_JUMP_TABLE macros.
. {* See documentation on reloc types. *}
. reloc_howto_type *
. (*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
+. reloc_howto_type *
+. (*reloc_name_lookup) (bfd *, const char *);
+.
.
. {* Routines used when writing an object file. *}
.#define BFD_JUMP_TABLE_WRITE(NAME) \
@@ -438,7 +442,7 @@ BFD_JUMP_TABLE macros.
. NAME##_bfd_discard_group, \
. NAME##_section_already_linked \
.
-. int (*_bfd_sizeof_headers) (bfd *, bfd_boolean);
+. int (*_bfd_sizeof_headers) (bfd *, struct bfd_link_info *);
. bfd_byte * (*_bfd_get_relocated_section_contents)
. (bfd *, struct bfd_link_info *, struct bfd_link_order *,
. bfd_byte *, bfd_boolean, struct bfd_symbol **);
@@ -481,7 +485,8 @@ BFD_JUMP_TABLE macros.
.
. {* Check if SEC has been already linked during a reloceatable or
. final link. *}
-. void (*_section_already_linked) (bfd *, struct bfd_section *);
+. void (*_section_already_linked) (bfd *, struct bfd_section *,
+. struct bfd_link_info *);
.
. {* Routines to handle dynamic symbols and relocs. *}
.#define BFD_JUMP_TABLE_DYNAMIC(NAME) \
@@ -541,6 +546,10 @@ extern const bfd_target arm_epoc_pe_big_vec;
extern const bfd_target arm_epoc_pe_little_vec;
extern const bfd_target arm_epoc_pei_big_vec;
extern const bfd_target arm_epoc_pei_little_vec;
+extern const bfd_target arm_wince_pe_big_vec;
+extern const bfd_target arm_wince_pe_little_vec;
+extern const bfd_target arm_wince_pei_big_vec;
+extern const bfd_target arm_wince_pei_little_vec;
extern const bfd_target armcoff_big_vec;
extern const bfd_target armcoff_little_vec;
extern const bfd_target armnetbsd_vec;
@@ -551,6 +560,7 @@ extern const bfd_target armpei_little_vec;
extern const bfd_target b_out_vec_big_host;
extern const bfd_target b_out_vec_little_host;
extern const bfd_target bfd_efi_app_ia32_vec;
+extern const bfd_target bfd_efi_app_x86_64_vec;
extern const bfd_target bfd_efi_app_ia64_vec;
extern const bfd_target bfd_elf32_avr_vec;
extern const bfd_target bfd_elf32_bfin_vec;
@@ -562,6 +572,7 @@ extern const bfd_target bfd_elf32_bigarm_symbian_vec;
extern const bfd_target bfd_elf32_bigarm_vxworks_vec;
extern const bfd_target bfd_elf32_bigmips_vec;
extern const bfd_target bfd_elf32_bigmips_vxworks_vec;
+extern const bfd_target bfd_elf32_cr16_vec;
extern const bfd_target bfd_elf32_cr16c_vec;
extern const bfd_target bfd_elf32_cris_vec;
extern const bfd_target bfd_elf32_crx_vec;
@@ -604,6 +615,8 @@ extern const bfd_target bfd_elf32_m68k_vec;
extern const bfd_target bfd_elf32_m88k_vec;
extern const bfd_target bfd_elf32_mcore_big_vec;
extern const bfd_target bfd_elf32_mcore_little_vec;
+extern const bfd_target bfd_elf32_mep_vec;
+extern const bfd_target bfd_elf32_mep_little_vec;
extern const bfd_target bfd_elf32_mn10200_vec;
extern const bfd_target bfd_elf32_mn10300_vec;
extern const bfd_target bfd_elf32_mt_vec;
@@ -620,6 +633,8 @@ extern const bfd_target bfd_elf32_powerpc_vec;
extern const bfd_target bfd_elf32_powerpcle_vec;
extern const bfd_target bfd_elf32_powerpc_vxworks_vec;
extern const bfd_target bfd_elf32_s390_vec;
+extern const bfd_target bfd_elf32_bigscore_vec;
+extern const bfd_target bfd_elf32_littlescore_vec;
extern const bfd_target bfd_elf32_sh64_vec;
extern const bfd_target bfd_elf32_sh64l_vec;
extern const bfd_target bfd_elf32_sh64lin_vec;
@@ -632,9 +647,12 @@ extern const bfd_target bfd_elf32_shl_vec;
extern const bfd_target bfd_elf32_shl_symbian_vec;
extern const bfd_target bfd_elf32_shlin_vec;
extern const bfd_target bfd_elf32_shlnbsd_vec;
+extern const bfd_target bfd_elf32_shlvxworks_vec;
extern const bfd_target bfd_elf32_shnbsd_vec;
+extern const bfd_target bfd_elf32_shvxworks_vec;
extern const bfd_target bfd_elf32_sparc_vec;
extern const bfd_target bfd_elf32_sparc_vxworks_vec;
+extern const bfd_target bfd_elf32_spu_vec;
extern const bfd_target bfd_elf32_tradbigmips_vec;
extern const bfd_target bfd_elf32_tradlittlemips_vec;
extern const bfd_target bfd_elf32_us_cris_vec;
@@ -666,8 +684,10 @@ extern const bfd_target bfd_elf64_sh64blin_vec;
extern const bfd_target bfd_elf64_sh64lnbsd_vec;
extern const bfd_target bfd_elf64_sh64nbsd_vec;
extern const bfd_target bfd_elf64_sparc_vec;
+extern const bfd_target bfd_elf64_sparc_freebsd_vec;
extern const bfd_target bfd_elf64_tradbigmips_vec;
extern const bfd_target bfd_elf64_tradlittlemips_vec;
+extern const bfd_target bfd_elf64_x86_64_freebsd_vec;
extern const bfd_target bfd_elf64_x86_64_vec;
extern const bfd_target bfd_mmo_vec;
extern const bfd_target bfd_powerpc_pe_vec;
@@ -780,6 +800,9 @@ extern const bfd_target vms_alpha_vec;
extern const bfd_target vms_vax_vec;
extern const bfd_target w65_vec;
extern const bfd_target we32kcoff_vec;
+extern const bfd_target x86_64pe_vec;
+extern const bfd_target x86_64pei_vec;
+extern const bfd_target x86_64coff_vec;
extern const bfd_target z80coff_vec;
extern const bfd_target z8kcoff_vec;
@@ -804,8 +827,8 @@ extern const bfd_target sco5_core_vec;
extern const bfd_target trad_core_vec;
extern const bfd_target bfd_elf32_am33lin_vec;
-static const bfd_target * const _bfd_target_vector[] = {
-
+static const bfd_target * const _bfd_target_vector[] =
+{
#ifdef SELECT_VECS
SELECT_VECS,
@@ -841,6 +864,10 @@ static const bfd_target * const _bfd_target_vector[] = {
&arm_epoc_pe_little_vec,
&arm_epoc_pei_big_vec,
&arm_epoc_pei_little_vec,
+ &arm_wince_pe_big_vec,
+ &arm_wince_pe_little_vec,
+ &arm_wince_pei_big_vec,
+ &arm_wince_pei_little_vec,
&armcoff_big_vec,
&armcoff_little_vec,
&armnetbsd_vec,
@@ -852,6 +879,7 @@ static const bfd_target * const _bfd_target_vector[] = {
&b_out_vec_little_host,
&bfd_efi_app_ia32_vec,
#ifdef BFD64
+ &bfd_efi_app_x86_64_vec,
&bfd_efi_app_ia64_vec,
#endif
&bfd_elf32_avr_vec,
@@ -869,6 +897,7 @@ static const bfd_target * const _bfd_target_vector[] = {
&bfd_elf32_bigarm_vxworks_vec,
&bfd_elf32_bigmips_vec,
&bfd_elf32_bigmips_vxworks_vec,
+ &bfd_elf32_cr16_vec,
&bfd_elf32_cr16c_vec,
&bfd_elf32_cris_vec,
&bfd_elf32_crx_vec,
@@ -915,6 +944,7 @@ static const bfd_target * const _bfd_target_vector[] = {
&bfd_elf32_m88k_vec,
&bfd_elf32_mcore_big_vec,
&bfd_elf32_mcore_little_vec,
+ &bfd_elf32_mep_vec,
&bfd_elf32_mn10200_vec,
&bfd_elf32_mn10300_vec,
&bfd_elf32_mt_vec,
@@ -933,13 +963,17 @@ static const bfd_target * const _bfd_target_vector[] = {
&bfd_elf32_powerpc_vxworks_vec,
&bfd_elf32_powerpcle_vec,
&bfd_elf32_s390_vec,
+ &bfd_elf32_bigscore_vec,
+ &bfd_elf32_littlescore_vec,
&bfd_elf32_sh_vec,
&bfd_elf32_shblin_vec,
&bfd_elf32_shl_vec,
&bfd_elf32_shl_symbian_vec,
&bfd_elf32_shlin_vec,
&bfd_elf32_shlnbsd_vec,
+ &bfd_elf32_shlvxworks_vec,
&bfd_elf32_shnbsd_vec,
+ &bfd_elf32_shvxworks_vec,
#ifdef BFD64
&bfd_elf32_sh64_vec,
&bfd_elf32_sh64l_vec,
@@ -950,6 +984,7 @@ static const bfd_target * const _bfd_target_vector[] = {
#endif
&bfd_elf32_sparc_vec,
&bfd_elf32_sparc_vxworks_vec,
+ &bfd_elf32_spu_vec,
&bfd_elf32_tradbigmips_vec,
&bfd_elf32_tradlittlemips_vec,
&bfd_elf32_us_cris_vec,
@@ -982,8 +1017,10 @@ static const bfd_target * const _bfd_target_vector[] = {
&bfd_elf64_sh64lin_vec,
&bfd_elf64_sh64blin_vec,
&bfd_elf64_sparc_vec,
+ &bfd_elf64_sparc_freebsd_vec,
&bfd_elf64_tradbigmips_vec,
&bfd_elf64_tradlittlemips_vec,
+ &bfd_elf64_x86_64_freebsd_vec,
&bfd_elf64_x86_64_vec,
&bfd_mmo_vec,
#endif
@@ -1036,6 +1073,11 @@ static const bfd_target * const _bfd_target_vector[] = {
&i386os9k_vec,
&i386pe_vec,
&i386pei_vec,
+#ifdef BFD64
+ &x86_64coff_vec,
+ &x86_64pe_vec,
+ &x86_64pei_vec,
+#endif
&i860coff_vec,
&icoff_big_vec,
&icoff_little_vec,
@@ -1260,7 +1302,6 @@ find_target (const char *name)
while (match->vector == NULL)
++match;
return match->vector;
- break;
}
}
@@ -1307,14 +1348,15 @@ SYNOPSIS
DESCRIPTION
Return a pointer to the transfer vector for the object target
- named @var{target_name}. If @var{target_name} is <<NULL>>, choose the
- one in the environment variable <<GNUTARGET>>; if that is null or not
- defined, then choose the first entry in the target list.
- Passing in the string "default" or setting the environment
- variable to "default" will cause the first entry in the target
- list to be returned, and "target_defaulted" will be set in the
- BFD. This causes <<bfd_check_format>> to loop over all the
- targets to find the one that matches the file being read.
+ named @var{target_name}. If @var{target_name} is <<NULL>>,
+ choose the one in the environment variable <<GNUTARGET>>; if
+ that is null or not defined, then choose the first entry in the
+ target list. Passing in the string "default" or setting the
+ environment variable to "default" will cause the first entry in
+ the target list to be returned, and "target_defaulted" will be
+ set in the BFD if @var{abfd} isn't <<NULL>>. This causes
+ <<bfd_check_format>> to loop over all the targets to find the
+ one that matches the file being read.
*/
const bfd_target *
@@ -1331,21 +1373,27 @@ bfd_find_target (const char *target_name, bfd *abfd)
/* This is safe; the vector cannot be null. */
if (targname == NULL || strcmp (targname, "default") == 0)
{
- abfd->target_defaulted = TRUE;
if (bfd_default_vector[0] != NULL)
- abfd->xvec = bfd_default_vector[0];
+ target = bfd_default_vector[0];
else
- abfd->xvec = bfd_target_vector[0];
- return abfd->xvec;
+ target = bfd_target_vector[0];
+ if (abfd)
+ {
+ abfd->xvec = target;
+ abfd->target_defaulted = TRUE;
+ }
+ return target;
}
- abfd->target_defaulted = FALSE;
+ if (abfd)
+ abfd->target_defaulted = FALSE;
target = find_target (targname);
if (target == NULL)
return NULL;
- abfd->xvec = target;
+ if (abfd)
+ abfd->xvec = target;
return target;
}
diff --git a/bfd/tekhex.c b/bfd/tekhex.c
index afe42cc948a9..78deaf99ae14 100644
--- a/bfd/tekhex.c
+++ b/bfd/tekhex.c
@@ -1,6 +1,6 @@
/* BFD backend for Extended Tektronix Hex Format objects.
Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004 Free Software Foundation, Inc.
+ 2003, 2004, 2007 Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
This file is part of BFD, the Binary File Descriptor library.
@@ -65,8 +65,8 @@
The data can come out of order, and may be discontigous. This is a
serial protocol, so big files are unlikely, so we keep a list of 8k chunks. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "libiberty.h"
@@ -436,6 +436,7 @@ first_phase (bfd *abfd, int type, char *src)
if (!getvalue (&src, &val))
return FALSE;
new->symbol.value = val - section->vma;
+ break;
}
default:
return FALSE;
@@ -457,11 +458,10 @@ pass_over (bfd *abfd, bfd_boolean (*func) (bfd *, int, char *))
/* To the front of the file. */
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
- abort ();
+ return FALSE;
while (! eof)
{
- char buffer[MAXCHUNK];
- char *src = buffer;
+ char src[MAXCHUNK];
char type;
/* Find first '%'. */
@@ -471,22 +471,24 @@ pass_over (bfd *abfd, bfd_boolean (*func) (bfd *, int, char *))
if (eof)
break;
- src++;
/* Fetch the type and the length and the checksum. */
if (bfd_bread (src, (bfd_size_type) 5, abfd) != 5)
- abort (); /* FIXME. */
+ return FALSE;
type = src[2];
if (!ISHEX (src[0]) || !ISHEX (src[1]))
break;
- /* Already read five char. */
+ /* Already read five chars. */
chars_on_line = HEX (src) - 5;
+ if (chars_on_line >= MAXCHUNK)
+ return FALSE;
+
if (bfd_bread (src, (bfd_size_type) chars_on_line, abfd) != chars_on_line)
- abort (); /* FIXME. */
+ return FALSE;
/* Put a null at the end. */
src[chars_on_line] = 0;
@@ -751,7 +753,6 @@ out (bfd *abfd, int type, char *start, char *end)
static bfd_boolean
tekhex_write_object_contents (bfd *abfd)
{
- int bytes_written;
char buffer[100];
asymbol **p;
asection *s;
@@ -759,8 +760,6 @@ tekhex_write_object_contents (bfd *abfd)
tekhex_init ();
- bytes_written = 0;
-
/* And the raw data. */
for (d = abfd->tdata.tekhex_data->data;
d != NULL;
@@ -868,7 +867,7 @@ tekhex_write_object_contents (bfd *abfd)
static int
tekhex_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
- bfd_boolean exec ATTRIBUTE_UNUSED)
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
return 0;
}
diff --git a/bfd/trad-core.c b/bfd/trad-core.c
index cb4111fb9418..79b869cb37af 100644
--- a/bfd/trad-core.c
+++ b/bfd/trad-core.c
@@ -1,6 +1,6 @@
/* BFD back end for traditional Unix core files (U-area and raw sections)
Copyright 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Written by John Gilmore of Cygnus Support.
@@ -20,8 +20,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "libaout.h" /* BFD a.out internal data structures */
@@ -79,6 +79,7 @@ trad_unix_core_file_p (abfd)
struct user u;
struct trad_core_struct *rawptr;
bfd_size_type amt;
+ flagword flags;
#ifdef TRAD_CORE_USER_OFFSET
/* If defined, this macro is the file position of the user struct. */
@@ -113,24 +114,24 @@ trad_unix_core_file_p (abfd)
if (bfd_stat (abfd, &statbuf) < 0)
return 0;
- if ((unsigned long) (NBPG * (UPAGES + u.u_dsize
+ if ((ufile_ptr) NBPG * (UPAGES + u.u_dsize
#ifdef TRAD_CORE_DSIZE_INCLUDES_TSIZE
- - u.u_tsize
+ - u.u_tsize
#endif
- + u.u_ssize))
- > (unsigned long) statbuf.st_size)
+ + u.u_ssize)
+ > (ufile_ptr) statbuf.st_size)
{
bfd_set_error (bfd_error_wrong_format);
return 0;
}
#ifndef TRAD_CORE_ALLOW_ANY_EXTRA_SIZE
- if ((unsigned long) (NBPG * (UPAGES + u.u_dsize + u.u_ssize)
+ if (((ufile_ptr) NBPG * (UPAGES + u.u_dsize + u.u_ssize)
#ifdef TRAD_CORE_EXTRA_SIZE_ALLOWED
/* Some systems write the file too big. */
- + TRAD_CORE_EXTRA_SIZE_ALLOWED
+ + TRAD_CORE_EXTRA_SIZE_ALLOWED
#endif
- )
- < (unsigned long) statbuf.st_size)
+ )
+ < (ufile_ptr) statbuf.st_size)
{
/* The file is too big. Maybe it's not a core file
or we otherwise have bad values for u_dsize and u_ssize). */
@@ -155,20 +156,20 @@ trad_unix_core_file_p (abfd)
/* Create the sections. */
- core_stacksec(abfd) = bfd_make_section_anyway (abfd, ".stack");
+ flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
+ core_stacksec(abfd) = bfd_make_section_anyway_with_flags (abfd, ".stack",
+ flags);
if (core_stacksec (abfd) == NULL)
goto fail;
- core_datasec (abfd) = bfd_make_section_anyway (abfd, ".data");
+ core_datasec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".data",
+ flags);
if (core_datasec (abfd) == NULL)
goto fail;
- core_regsec (abfd) = bfd_make_section_anyway (abfd, ".reg");
+ core_regsec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".reg",
+ SEC_HAS_CONTENTS);
if (core_regsec (abfd) == NULL)
goto fail;
- core_stacksec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
- core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
- core_regsec (abfd)->flags = SEC_HAS_CONTENTS;
-
core_datasec (abfd)->size = NBPG * u.u_dsize
#ifdef TRAD_CORE_DSIZE_INCLUDES_TSIZE
- NBPG * u.u_tsize
diff --git a/bfd/vaxbsd.c b/bfd/vaxbsd.c
index 5f5f8a1e59d6..fc53f7800bb4 100644
--- a/bfd/vaxbsd.c
+++ b/bfd/vaxbsd.c
@@ -1,5 +1,5 @@
/* BFD back-end for BSD and Ultrix/VAX (1K page size) a.out-ish binaries.
- Copyright 2002, 2003 Free Software Foundation, Inc.
+ Copyright 2002, 2003, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -32,8 +32,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
#define TARGETNAME "a.out-vax-bsd"
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "libaout.h"
diff --git a/bfd/versados.c b/bfd/versados.c
index fb6cfbd22ac0..a2ce0db79ae4 100644
--- a/bfd/versados.c
+++ b/bfd/versados.c
@@ -1,6 +1,6 @@
/* BFD back-end for VERSAdos-E objects.
- Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
+ Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+ 2006, 2007 Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
Versados is a Motorola trademark.
@@ -37,8 +37,8 @@
o Object Text Record
o End Record. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "libiberty.h"
@@ -675,7 +675,7 @@ versados_set_section_contents (bfd *abfd ATTRIBUTE_UNUSED,
static int
versados_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
- bfd_boolean exec ATTRIBUTE_UNUSED)
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
return 0;
}
@@ -798,6 +798,7 @@ versados_canonicalize_reloc (bfd *abfd,
#define versados_read_minisymbols _bfd_generic_read_minisymbols
#define versados_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
#define versados_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
+#define versados_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup
#define versados_set_arch_mach bfd_default_set_arch_mach
#define versados_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
#define versados_bfd_relax_section bfd_generic_relax_section
diff --git a/bfd/version.h b/bfd/version.h
index f0ad1a889092..88dbbce9fc80 100644
--- a/bfd/version.h
+++ b/bfd/version.h
@@ -1,3 +1,4 @@
-#define BFD_VERSION_DATE 20070807
+#define BFD_VERSION_DATE 20070703
#define BFD_VERSION @bfd_version@
-#define BFD_VERSION_STRING @bfd_version_string@
+#define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@
+#define REPORT_BUGS_TO @report_bugs_to@
diff --git a/bfd/vms-gsd.c b/bfd/vms-gsd.c
index 9d06cf78d0ea..661f0c437707 100644
--- a/bfd/vms-gsd.c
+++ b/bfd/vms-gsd.c
@@ -1,7 +1,7 @@
/* vms-gsd.c -- BFD back-end for VAX (openVMS/VAX) and
EVAX (openVMS/Alpha) files.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+ 2007 Free Software Foundation, Inc.
go and read the openVMS linker manual (esp. appendix B)
if you don't know what's going on here :-)
@@ -22,8 +22,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
diff --git a/bfd/vms-hdr.c b/bfd/vms-hdr.c
index 24a0aec1a0c5..f116904f2373 100644
--- a/bfd/vms-hdr.c
+++ b/bfd/vms-hdr.c
@@ -1,7 +1,7 @@
/* vms-hdr.c -- BFD back-end for VMS/VAX (openVMS/VAX) and
EVAX (openVMS/Alpha) files.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005
- Free Software Foundation, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006,
+ 2007 Free Software Foundation, Inc.
HDR record handling functions
EMH record handling functions
@@ -25,9 +25,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+#include "sysdep.h"
#include "bfd.h"
#include "bfdver.h"
-#include "sysdep.h"
#include "bfdlink.h"
#include "safe-ctype.h"
#include "libbfd.h"
@@ -248,7 +248,7 @@ _bfd_vms_write_hdr (bfd *abfd, int objtype)
/* LMN. */
_bfd_vms_output_begin (abfd, EOBJ_S_C_EMH, EMH_S_C_LNM);
- _bfd_vms_output_dump (abfd, (unsigned char *)"GAS proGIS", 10);
+ _bfd_vms_output_dump (abfd, (unsigned char *) STRING_COMMA_LEN ("GAS proGIS"));
_bfd_vms_output_flush (abfd);
/* SRC. */
@@ -260,7 +260,7 @@ _bfd_vms_write_hdr (bfd *abfd, int objtype)
if (symbol->flags & BSF_FILE)
{
- if (strncmp ((char *)symbol->name, "<CASE:", 6) == 0)
+ if (CONST_STRNEQ ((char *)symbol->name, "<CASE:"))
{
PRIV (flag_hash_long_names) = symbol->name[6] - '0';
PRIV (flag_show_after_trunc) = symbol->name[7] - '0';
@@ -280,13 +280,13 @@ _bfd_vms_write_hdr (bfd *abfd, int objtype)
}
if (symnum == abfd->symcount)
- _bfd_vms_output_dump (abfd, (unsigned char *)"noname", 6);
+ _bfd_vms_output_dump (abfd, (unsigned char *) STRING_COMMA_LEN ("noname"));
_bfd_vms_output_flush (abfd);
/* TTL. */
_bfd_vms_output_begin (abfd, EOBJ_S_C_EMH, EMH_S_C_TTL);
- _bfd_vms_output_dump (abfd, (unsigned char *)"TTL", 3);
+ _bfd_vms_output_dump (abfd, (unsigned char *) STRING_COMMA_LEN ("TTL"));
_bfd_vms_output_flush (abfd);
/* CPR. */
diff --git a/bfd/vms-misc.c b/bfd/vms-misc.c
index 7a3368bc7b04..31bd3b45a37c 100644
--- a/bfd/vms-misc.c
+++ b/bfd/vms-misc.c
@@ -1,7 +1,7 @@
/* vms-misc.c -- Miscellaneous functions for VAX (openVMS/VAX) and
EVAX (openVMS/Alpha) files.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+ 2007 Free Software Foundation, Inc.
Written by Klaus K"ampf (kkaempf@rmi.de)
@@ -23,8 +23,8 @@
#include <stdarg.h>
#endif
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
diff --git a/bfd/vms-tir.c b/bfd/vms-tir.c
index d6bff96f483f..af79f20b75dd 100644
--- a/bfd/vms-tir.c
+++ b/bfd/vms-tir.c
@@ -1,6 +1,6 @@
/* vms-tir.c -- BFD back-end for VAX (openVMS/VAX) and
EVAX (openVMS/Alpha) files.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2007
Free Software Foundation, Inc.
TIR record handling functions
@@ -34,8 +34,8 @@
qw quadword (8 byte, 64 bit)
da data stream */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "vms.h"
diff --git a/bfd/vms.c b/bfd/vms.c
index e6ee98a53eec..c73692e32b5d 100644
--- a/bfd/vms.c
+++ b/bfd/vms.c
@@ -1,7 +1,7 @@
/* vms.c -- BFD back-end for VAX (openVMS/VAX) and
EVAX (openVMS/Alpha) files.
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- 2006 Free Software Foundation, Inc.
+ 2006, 2007 Free Software Foundation, Inc.
Written by Klaus K"ampf (kkaempf@rmi.de)
@@ -19,8 +19,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
@@ -487,7 +487,7 @@ vms_new_section_hook (bfd * abfd, asection *section)
vms_debug (7, "%d: %s\n", section->index, section->name);
#endif
- return TRUE;
+ return _bfd_generic_new_section_hook (abfd, section);
}
/* Read the contents of a section.
@@ -1353,6 +1353,22 @@ vms_bfd_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
return & alpha_howto_table[alpha_type];
}
+static reloc_howto_type *
+vms_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 0;
+ i < sizeof (alpha_howto_table) / sizeof (alpha_howto_table[0]);
+ i++)
+ if (alpha_howto_table[i].name != NULL
+ && strcasecmp (alpha_howto_table[i].name, r_name) == 0)
+ return &alpha_howto_table[i];
+
+ return NULL;
+}
+
/* Part 4.7, writing an object file. */
/* Set the architecture and machine type in BFD abfd to arch and mach.
@@ -1402,7 +1418,7 @@ vms_set_section_contents (bfd * abfd,
static int
vms_sizeof_headers (bfd * abfd ATTRIBUTE_UNUSED,
- bfd_boolean reloc ATTRIBUTE_UNUSED)
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
vms_debug (1, "vms_sizeof_headers (%p, %s)\n", abfd, (reloc)?"True":"False");
diff --git a/bfd/warning.m4 b/bfd/warning.m4
index 2e2dd424c0f7..b366cadeb293 100644
--- a/bfd/warning.m4
+++ b/bfd/warning.m4
@@ -4,7 +4,7 @@ AC_DEFUN([AM_BINUTILS_WARNINGS],[
GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
AC_ARG_ENABLE(werror,
- [ --enable-werror treat compile warnings as errors],
+ [ --enable-werror treat compile warnings as errors],
[case "${enableval}" in
yes | y) ERROR_ON_WARNING="yes" ;;
no | n) ERROR_ON_WARNING="no" ;;
@@ -27,7 +27,7 @@ if test "${GCC}" = yes ; then
fi
AC_ARG_ENABLE(build-warnings,
-[ --enable-build-warnings Enable build-time compiler warnings],
+[ --enable-build-warnings enable build-time compiler warnings],
[case "${enableval}" in
yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
no) if test "${GCC}" = yes ; then
diff --git a/bfd/xcoff-target.h b/bfd/xcoff-target.h
index 7e73cf26a59d..b912fdf35e6d 100644
--- a/bfd/xcoff-target.h
+++ b/bfd/xcoff-target.h
@@ -1,5 +1,5 @@
/* Common definitions for backends based on IBM RS/6000 "XCOFF64" files.
- Copyright 2000, 2001, 2002, 2004, 2005
+ Copyright 2000, 2001, 2002, 2004, 2005, 2006
Free Software Foundation, Inc.
Contributed by Cygnus Support.
@@ -125,7 +125,7 @@ extern bfd * _bfd_xcoff_openr_next_archived_file (bfd *, bfd *);
extern int _bfd_xcoff_generic_stat_arch_elt (bfd *, struct stat *);
extern bfd_boolean _bfd_xcoff_write_armap (bfd *, unsigned int, struct orl *, unsigned int, int);
extern bfd_boolean _bfd_xcoff_write_archive_contents (bfd *);
-extern int _bfd_xcoff_sizeof_headers (bfd *, bfd_boolean);
+extern int _bfd_xcoff_sizeof_headers (bfd *, struct bfd_link_info *);
extern void _bfd_xcoff_swap_sym_in (bfd *, void *, void *);
extern unsigned int _bfd_xcoff_swap_sym_out (bfd *, void *, void *);
extern void _bfd_xcoff_swap_aux_in (bfd *, void *, int, int, int, int, void *);
diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c
index 47c330b6c15f..b02886a416b9 100644
--- a/bfd/xcofflink.c
+++ b/bfd/xcofflink.c
@@ -1,6 +1,6 @@
/* POWER/PowerPC XCOFF linker support.
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006 Free Software Foundation, Inc.
+ 2005, 2006, 2007 Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>, Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -19,8 +19,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "coff/internal.h"
@@ -794,27 +794,27 @@ xcoff_link_create_extra_sections (bfd * abfd, struct bfd_link_info *info)
if (xcoff_hash_table (info)->loader_section == NULL)
{
asection *lsec;
+ flagword flags = SEC_HAS_CONTENTS | SEC_IN_MEMORY;
- lsec = bfd_make_section_anyway (abfd, ".loader");
+ lsec = bfd_make_section_anyway_with_flags (abfd, ".loader", flags);
if (lsec == NULL)
goto end_return;
xcoff_hash_table (info)->loader_section = lsec;
- lsec->flags |= SEC_HAS_CONTENTS | SEC_IN_MEMORY;
}
/* Likewise for the linkage section. */
if (xcoff_hash_table (info)->linkage_section == NULL)
{
asection *lsec;
+ flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY);
- lsec = bfd_make_section_anyway (abfd, ".gl");
+ lsec = bfd_make_section_anyway_with_flags (abfd, ".gl", flags);
if (lsec == NULL)
goto end_return;
xcoff_hash_table (info)->linkage_section = lsec;
- lsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY);
lsec->alignment_power = 2;
}
@@ -822,14 +822,14 @@ xcoff_link_create_extra_sections (bfd * abfd, struct bfd_link_info *info)
if (xcoff_hash_table (info)->toc_section == NULL)
{
asection *tsec;
+ flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY);
- tsec = bfd_make_section_anyway (abfd, ".tc");
+ tsec = bfd_make_section_anyway_with_flags (abfd, ".tc", flags);
if (tsec == NULL)
goto end_return;
xcoff_hash_table (info)->toc_section = tsec;
- tsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY);
tsec->alignment_power = 2;
}
@@ -837,14 +837,14 @@ xcoff_link_create_extra_sections (bfd * abfd, struct bfd_link_info *info)
if (xcoff_hash_table (info)->descriptor_section == NULL)
{
asection *dsec;
+ flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY);
- dsec = bfd_make_section_anyway (abfd, ".ds");
+ dsec = bfd_make_section_anyway_with_flags (abfd, ".ds", flags);
if (dsec == NULL)
goto end_return;
xcoff_hash_table (info)->descriptor_section = dsec;
- dsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY);
dsec->alignment_power = 2;
}
@@ -853,13 +853,13 @@ xcoff_link_create_extra_sections (bfd * abfd, struct bfd_link_info *info)
&& info->strip != strip_all)
{
asection *dsec;
+ flagword flags = SEC_HAS_CONTENTS | SEC_IN_MEMORY;
- dsec = bfd_make_section_anyway (abfd, ".debug");
+ dsec = bfd_make_section_anyway_with_flags (abfd, ".debug", flags);
if (dsec == NULL)
goto end_return;
xcoff_hash_table (info)->debug_section = dsec;
- dsec->flags |= SEC_HAS_CONTENTS | SEC_IN_MEMORY;
}
}
@@ -1552,16 +1552,17 @@ xcoff_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
{
/* The linker script puts the .td section in the data
section after the .tc section. */
- csect = bfd_make_section_anyway (abfd, ".td");
+ csect = bfd_make_section_anyway_with_flags (abfd, ".td",
+ SEC_ALLOC);
}
else
- csect = bfd_make_section_anyway (abfd, ".bss");
+ csect = bfd_make_section_anyway_with_flags (abfd, ".bss",
+ SEC_ALLOC);
if (csect == NULL)
goto error_return;
csect->vma = sym.n_value;
csect->size = aux.x_csect.x_scnlen.l;
- csect->flags |= SEC_ALLOC;
csect->alignment_power = SMTYP_ALIGN (aux.x_csect.x_smtyp);
/* There are a number of other fields and section flags
which we do not bother to set. */
@@ -5460,8 +5461,8 @@ _bfd_xcoff_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
that needs padding. This requires unlinking and
relinking the bfd's section list. */
- n = bfd_make_section_anyway (abfd, ".pad");
- n->flags = SEC_HAS_CONTENTS;
+ n = bfd_make_section_anyway_with_flags (abfd, ".pad",
+ SEC_HAS_CONTENTS);
n->alignment_power = 0;
bfd_section_list_remove (abfd, n);
diff --git a/bfd/xsym.c b/bfd/xsym.c
index 9659a65e021b..c9757b65414a 100644
--- a/bfd/xsym.c
+++ b/bfd/xsym.c
@@ -1,5 +1,5 @@
/* xSYM symbol-file support for BFD.
- Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,9 +18,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+#include "sysdep.h"
#include "xsym.h"
#include "bfd.h"
-#include "sysdep.h"
#include "libbfd.h"
#define bfd_sym_close_and_cleanup _bfd_generic_close_and_cleanup
@@ -34,9 +34,6 @@
#define bfd_sym_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
#define bfd_sym_read_minisymbols _bfd_generic_read_minisymbols
#define bfd_sym_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
-#define bfd_sym_get_reloc_upper_bound _bfd_norelocs_get_reloc_upper_bound
-#define bfd_sym_canonicalize_reloc _bfd_norelocs_canonicalize_reloc
-#define bfd_sym_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
#define bfd_sym_set_arch_mach _bfd_generic_set_arch_mach
#define bfd_sym_get_section_contents _bfd_generic_get_section_contents
#define bfd_sym_set_section_contents _bfd_generic_set_section_contents
@@ -2228,7 +2225,7 @@ bfd_sym_scan (bfd *abfd, bfd_sym_version version, bfd_sym_data_struct *mdata)
if (mdata->name_table == NULL)
return -1;
- bfdsec = bfd_make_section_anyway (abfd, name);
+ bfdsec = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS);
if (bfdsec == NULL)
return -1;
@@ -2238,8 +2235,6 @@ bfd_sym_scan (bfd *abfd, bfd_sym_version version, bfd_sym_data_struct *mdata)
bfdsec->filepos = 0;
bfdsec->alignment_power = 0;
- bfdsec->flags = SEC_HAS_CONTENTS;
-
abfd->tdata.sym_data = mdata;
return 0;
@@ -2277,11 +2272,7 @@ bfd_sym_object_p (bfd *abfd)
return NULL;
}
-asymbol *
-bfd_sym_make_empty_symbol (bfd *abfd)
-{
- return bfd_alloc (abfd, sizeof (asymbol));
-}
+#define bfd_sym_make_empty_symbol _bfd_generic_make_empty_symbol
void
bfd_sym_get_symbol_info (bfd *abfd ATTRIBUTE_UNUSED, asymbol *symbol, symbol_info *ret)
@@ -2302,7 +2293,8 @@ bfd_sym_canonicalize_symtab (bfd *abfd ATTRIBUTE_UNUSED, asymbol **sym ATTRIBUTE
}
int
-bfd_sym_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean exec ATTRIBUTE_UNUSED)
+bfd_sym_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
return 0;
}
@@ -2351,7 +2343,7 @@ const bfd_target sym_vec =
BFD_JUMP_TABLE_CORE (_bfd_nocore),
BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
BFD_JUMP_TABLE_SYMBOLS (bfd_sym),
- BFD_JUMP_TABLE_RELOCS (bfd_sym),
+ BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
BFD_JUMP_TABLE_WRITE (bfd_sym),
BFD_JUMP_TABLE_LINK (bfd_sym),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
diff --git a/bfd/xsym.h b/bfd/xsym.h
index 386a16357468..7b69aadf34b2 100644
--- a/bfd/xsym.h
+++ b/bfd/xsym.h
@@ -1,5 +1,5 @@
/* xSYM symbol-file support for BFD.
- Copyright 1999, 2000, 2001, 2002, 2003, 2005
+ Copyright 1999, 2000, 2001, 2002, 2003, 2005, 2006
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -687,8 +687,6 @@ extern int bfd_sym_scan
(bfd *, bfd_sym_version, bfd_sym_data_struct *);
extern const bfd_target * bfd_sym_object_p
(bfd *);
-extern asymbol * bfd_sym_make_empty_symbol
- (bfd *);
extern void bfd_sym_get_symbol_info
(bfd *, asymbol *, symbol_info *);
extern long bfd_sym_get_symtab_upper_bound
@@ -696,6 +694,6 @@ extern long bfd_sym_get_symtab_upper_bound
extern long bfd_sym_canonicalize_symtab
(bfd *, asymbol **);
extern int bfd_sym_sizeof_headers
- (bfd *, bfd_boolean);
+ (bfd *, struct bfd_link_info *);
#endif /* __xSYM_H__ */
diff --git a/bfd/xtensa-isa.c b/bfd/xtensa-isa.c
index 5fcf51eea935..362e47c31797 100644
--- a/bfd/xtensa-isa.c
+++ b/bfd/xtensa-isa.c
@@ -1,5 +1,5 @@
/* Configurable Xtensa ISA support.
- Copyright 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -17,8 +17,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include "bfd.h"
#include "sysdep.h"
+#include "bfd.h"
#include "libbfd.h"
#include "xtensa-isa.h"
#include "xtensa-isa-internal.h"