Import of Binutils from the FSF 2.13 branch (just pre-.1 release).

These bits are taken from the FSF anoncvs repo on 11-Oct-2002 22:39:35 PDT.
This commit is contained in:
David E. O'Brien 2002-10-11 06:01:20 +00:00
parent bde4025733
commit 88e5f95a93
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/binutils/dist/; revision=104834
395 changed files with 35475 additions and 16887 deletions

File diff suppressed because it is too large Load Diff

View File

@ -33,9 +33,12 @@ readline/support/config.sub; readline/support/config.guess
gdb-patches@sources.redhat.com
dejagnu/
Notify http://dejagnu.sourceforge.net/ of generic changes.
Generic patches to gdb-patches@sources.redhat.com;
Other dependents of dejagnu include sid@, binutils@, gcc@, etc.
Send all patches to:
http://www.gnu.org/software/dejagnu/
mail:bug-dejagnu@gnu.org
For changes to the local repostory, send them to
gdb-patches@sources.redhat.com when generic; and sid@,
binutils@, gcc@, etc. for sub-components.
gdb/; mmalloc/; readline/; sim/; GDB's part of include/ & dejagnu/
gdb: http://sources.redhat.com/gdb/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -9,8 +9,10 @@ MKDEP = gcc -MM
SUBDIRS = doc po
docdir = doc
bfdlibdir = @bfdlibdir@
bfdincludedir = @bfdincludedir@
lib_LTLIBRARIES = libbfd.la
bfdlib_LTLIBRARIES = libbfd.la
WARN_CFLAGS = @WARN_CFLAGS@
AM_CFLAGS = $(WARN_CFLAGS)
@ -54,7 +56,9 @@ ALL_MACHINES = \
cpu-cris.lo \
cpu-d10v.lo \
cpu-d30v.lo \
cpu-dlx.lo \
cpu-fr30.lo \
cpu-frv.lo \
cpu-h8300.lo \
cpu-h8500.lo \
cpu-hppa.lo \
@ -102,7 +106,9 @@ ALL_MACHINES_CFILES = \
cpu-cris.c \
cpu-d10v.c \
cpu-d30v.c \
cpu-dlx.c \
cpu-fr30.c \
cpu-frv.c \
cpu-h8300.c \
cpu-h8500.c \
cpu-hppa.c \
@ -196,12 +202,16 @@ BFD32_BACKENDS = \
elf32-cris.lo \
elf32-d10v.lo \
elf32-d30v.lo \
elf32-dlx.lo \
elf32-fr30.lo \
elf32-frv.lo \
elf32-gen.lo \
elf32-h8300.lo \
elf32-hppa.lo \
elf32-i370.lo \
elf32-i386.lo \
elf32-i386-fbsd.lo \
elf32-i386qnx.lo \
elf32-i860.lo \
elf32-i960.lo \
elf32-ia64.lo \
@ -213,6 +223,7 @@ BFD32_BACKENDS = \
elf-m10200.lo \
elf-m10300.lo \
elf32-mcore.lo \
elfxx-mips.lo \
elf32-mips.lo \
elf32-openrisc.lo \
elf32-or32.lo \
@ -222,9 +233,12 @@ BFD32_BACKENDS = \
elf32-sh.lo \
elf32-sh-lin.lo \
elf32-sh64.lo \
elf32-sh64-com.lo \
elf32-sh-nbsd.lo \
elf32-sh64-nbsd.lo \
elf32-sparc.lo \
elf32-v850.lo \
elf32-vax.lo \
elf32-xstormy16.lo \
elf32.lo \
elflink.lo \
@ -283,6 +297,8 @@ BFD32_BACKENDS = \
sparcnetbsd.lo \
sunos.lo \
vaxnetbsd.lo \
vax1knetbsd.lo \
vaxbsd.lo \
versados.lo \
vms.lo \
vms-gsd.lo \
@ -344,12 +360,16 @@ BFD32_BACKENDS_CFILES = \
elf32-cris.c \
elf32-d10v.c \
elf32-d30v.c \
elf32-dlx.c \
elf32-fr30.c \
elf32-frv.c \
elf32-gen.c \
elf32-h8300.c \
elf32-hppa.c \
elf32-i370.c \
elf32-i386.c \
elf32-i386-fbsd.c \
elf32-i386qnx.c \
elf32-i860.c \
elf32-i960.c \
elf32-m32r.c \
@ -360,18 +380,22 @@ BFD32_BACKENDS_CFILES = \
elf-m10200.c \
elf-m10300.c \
elf32-mcore.c \
elfxx-mips.c \
elf32-mips.c \
elf32-openrisc.c \
elf32-or32.c \
elf32-pj.c \
elf32-ppc.c \
elf32-sh64.c \
elf32-sh64-com.c \
elf32-s390.c \
elf32-sh.c \
elf32-sh-lin.c \
elf32-sh-nbsd.c \
elf32-sh64-nbsd.c \
elf32-sparc.c \
elf32-v850.c \
elf32-vax.c \
elf32-xstormy16.c \
elf32.c \
elflink.c \
@ -429,6 +453,8 @@ BFD32_BACKENDS_CFILES = \
sparcnetbsd.c \
sunos.c \
vaxnetbsd.c \
vax1knetbsd.c \
vaxbsd.c \
versados.c \
vms.c \
vms-gsd.c \
@ -441,6 +467,7 @@ BFD32_BACKENDS_CFILES = \
# target_vector in targets.c if configured with --enable-targets=all
# and --enable-64-bit-bfd.
BFD64_BACKENDS = \
aix5ppc-core.lo \
aout64.lo \
coff-alpha.lo \
coff64-rs6000.lo \
@ -448,12 +475,14 @@ BFD64_BACKENDS = \
efi-app-ia64.lo \
elf64-x86-64.lo \
elf64-alpha.lo \
elf64-alpha-fbsd.lo \
elf64-hppa.lo \
elf64-ia64.lo \
elf64-gen.lo \
elf64-mips.lo \
elf64-mmix.lo \
elf64-sh64.lo \
elf64-sh64-nbsd.lo \
elf64-ppc.lo \
elf64-s390.lo \
elf64-sparc.lo \
@ -464,6 +493,7 @@ BFD64_BACKENDS = \
pepigen.lo
BFD64_BACKENDS_CFILES = \
aix5ppc-core.c \
aout64.c \
coff-alpha.c \
coff64-rs6000.c \
@ -471,6 +501,7 @@ BFD64_BACKENDS_CFILES = \
efi-app-ia64.c \
elf64-x86-64.c \
elf64-alpha.c \
elf64-alpha-fbsd.c \
elf64-hppa.c \
elf64-gen.c \
elf64-mips.c \
@ -478,6 +509,7 @@ BFD64_BACKENDS_CFILES = \
elf64-ppc.c \
elf64-s390.c \
elf64-sh64.c \
elf64-sh64-nbsd.c \
elf64-sparc.c \
elf64.c \
mmo.c \
@ -668,14 +700,35 @@ $(BFD32_LIBS) \
$(BFD64_BACKENDS) \
$(OPTIONAL_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
# Install BFD include file, and others that it needs.
install-data-local: $(BFD_H)
install-bfdlibLTLIBRARIES: @INSTALL_LIBBFD_TRUE@install_libbfd
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(includedir)
$(INSTALL_DATA) $(BFD_H) $(DESTDIR)$(includedir)/bfd.h
$(INSTALL_DATA) $(INCDIR)/ansidecl.h $(DESTDIR)$(includedir)/ansidecl.h
$(INSTALL_DATA) $(INCDIR)/symcat.h $(DESTDIR)$(includedir)/symcat.h
$(INSTALL_DATA) $(INCDIR)/bfdlink.h $(DESTDIR)$(includedir)/bfdlink.h
uninstall-bfdlibLTLIBRARIES: @INSTALL_LIBBFD_TRUE@uninstall_libbfd
@$(NORMAL_UNINSTALL)
.PHONY: install_libbfd uninstall_libbfd
install_libbfd: $(bfdlib_LTLIBRARIES) $(BFD_H)
$(mkinstalldirs) $(DESTDIR)$(bfdlibdir)
$(mkinstalldirs) $(DESTDIR)$(bfdincludedir)
@list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(bfdlibdir)/$$p"; \
$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(bfdlibdir)/$$p; \
else :; fi; \
done
$(INSTALL_DATA) $(BFD_H) $(DESTDIR)$(bfdincludedir)/bfd.h
$(INSTALL_DATA) $(INCDIR)/ansidecl.h $(DESTDIR)$(bfdincludedir)/ansidecl.h
$(INSTALL_DATA) $(INCDIR)/symcat.h $(DESTDIR)$(bfdincludedir)/symcat.h
$(INSTALL_DATA) $(INCDIR)/bfdlink.h $(DESTDIR)$(bfdincludedir)/bfdlink.h
uninstall_libbfd:
list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(bfdlibdir)/$$p; \
done
rm -f $(DESTDIR)$(bfdincludedir)/bfd.h
rm -f $(DESTDIR)$(bfdincludedir)/ansidecl.h
rm -f $(DESTDIR)$(bfdincludedir)/symcat.h
rm -f $(DESTDIR)$(bfdincludedir)/bfdlink.h
Makefile: $(srcdir)/configure.in
@ -787,7 +840,6 @@ DISTCLEANFILES = $(BUILD_CFILES) $(BUILD_HFILES)
config.status: $(srcdir)/configure $(srcdir)/config.bfd $(srcdir)/configure.host
$(SHELL) ./config.status --recheck
# What appears below is generated by a hacked mkdep using gcc -MM.
# DO NOT DELETE THIS LINE -- mkdep uses it.
@ -827,7 +879,8 @@ stabs.lo: stabs.c $(INCDIR)/filenames.h $(INCDIR)/aout/stab_gnu.h \
$(INCDIR)/aout/stab.def $(INCDIR)/safe-ctype.h
stab-syms.lo: stab-syms.c libaout.h $(INCDIR)/bfdlink.h \
$(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab.def
merge.lo: merge.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
merge.lo: merge.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
$(INCDIR)/libiberty.h
dwarf2.lo: dwarf2.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf2.h
@ -840,7 +893,9 @@ cpu-avr.lo: cpu-avr.c $(INCDIR)/filenames.h
cpu-cris.lo: cpu-cris.c $(INCDIR)/filenames.h
cpu-d10v.lo: cpu-d10v.c $(INCDIR)/filenames.h
cpu-d30v.lo: cpu-d30v.c $(INCDIR)/filenames.h
cpu-dlx.lo: cpu-dlx.c $(INCDIR)/filenames.h
cpu-fr30.lo: cpu-fr30.c $(INCDIR)/filenames.h
cpu-frv.lo: cpu-frv.c $(INCDIR)/filenames.h
cpu-h8300.lo: cpu-h8300.c $(INCDIR)/filenames.h
cpu-h8500.lo: cpu-h8500.c $(INCDIR)/filenames.h
cpu-hppa.lo: cpu-hppa.c $(INCDIR)/filenames.h
@ -1056,10 +1111,18 @@ elf32-d30v.lo: elf32-d30v.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/d30v.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
elf32-dlx.lo: elf32-dlx.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/dlx.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
elf32-fr30.lo: elf32-fr30.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/fr30.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
elf32-frv.lo: elf32-frv.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/frv.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
elf32-gen.lo: elf32-gen.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h elf32-target.h
@ -1078,6 +1141,14 @@ elf32-i386.lo: elf32-i386.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
elf32-i386-fbsd.lo: elf32-i386-fbsd.c elf32-i386.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h \
$(INCDIR)/elf/reloc-macros.h elf32-target.h
elf32-i386qnx.lo: elf32-i386qnx.c elf32-i386.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h \
$(INCDIR)/elf/reloc-macros.h elf32-target.h
elf32-i860.lo: elf32-i860.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/i860.h $(INCDIR)/elf/reloc-macros.h \
@ -1116,12 +1187,17 @@ elf32-mcore.lo: elf32-mcore.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/mcore.h \
$(INCDIR)/elf/reloc-macros.h elf32-target.h
elfxx-mips.lo: elfxx-mips.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h elfxx-mips.h $(INCDIR)/elf/mips.h \
$(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
$(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h
elf32-mips.lo: elf32-mips.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
genlink.h elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h \
$(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \
$(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h \
ecoffswap.h elf32-target.h
$(INCDIR)/elf/external.h elfxx-mips.h $(INCDIR)/elf/mips.h \
$(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h \
$(INCDIR)/coff/external.h ecoffswap.h elf32-target.h
elf32-openrisc.lo: elf32-openrisc.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/openrisc.h \
@ -1144,6 +1220,10 @@ elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \
elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
elf32-sh64-com.lo: elf32-sh64-com.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/sh.h \
$(INCDIR)/elf/reloc-macros.h $(srcdir)/../opcodes/sh64-opc.h
elf32-s390.lo: elf32-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \
@ -1160,6 +1240,11 @@ elf32-sh-nbsd.lo: elf32-sh-nbsd.c elf32-sh.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \
$(INCDIR)/elf/reloc-macros.h elf32-target.h
elf32-sh64-nbsd.lo: elf32-sh64-nbsd.c elf32-sh64.c \
$(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
$(srcdir)/../opcodes/sh64-opc.h elf32-sh.c $(INCDIR)/elf/sh.h \
$(INCDIR)/elf/reloc-macros.h elf32-target.h
elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \
@ -1169,6 +1254,10 @@ elf32-v850.lo: elf32-v850.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h \
$(INCDIR)/libiberty.h elf32-target.h
elf32-vax.lo: elf32-vax.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/vax.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
elf32-xstormy16.lo: elf32-xstormy16.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/xstormy16.h \
@ -1183,7 +1272,7 @@ elflink.lo: elflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/elf/external.h
elf-strtab.lo: elf-strtab.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h
$(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h
elf-eh-frame.lo: elf-eh-frame.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf2.h
@ -1353,6 +1442,12 @@ sunos.lo: sunos.c $(INCDIR)/bfdlink.h libaout.h aoutf1.h \
vaxnetbsd.lo: vaxnetbsd.c netbsd.h $(INCDIR)/filenames.h \
libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
vax1knetbsd.lo: vax1knetbsd.c netbsd.h $(INCDIR)/filenames.h \
libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
vaxbsd.lo: vaxbsd.c $(INCDIR)/filenames.h libaout.h \
$(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
versados.lo: versados.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h
vms.lo: vms.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
vms.h
@ -1367,6 +1462,7 @@ vms-tir.lo: vms-tir.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
xcofflink.lo: xcofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h libcoff.h \
libxcoff.h
aix5ppc-core.lo: aix5ppc-core.c
aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
$(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
@ -1387,8 +1483,8 @@ efi-app-ia64.lo: efi-app-ia64.c $(INCDIR)/filenames.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
$(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
elf64-x86-64.lo: elf64-x86-64.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/x86-64.h \
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/x86-64.h \
$(INCDIR)/elf/reloc-macros.h elf64-target.h
elf64-alpha.lo: elf64-alpha.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
@ -1397,6 +1493,13 @@ elf64-alpha.lo: elf64-alpha.c $(INCDIR)/filenames.h \
$(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h \
$(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h libcoff.h \
libecoff.h ecoffswap.h elf64-target.h
elf64-alpha-fbsd.lo: elf64-alpha-fbsd.c elf64-alpha.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/alpha.h \
$(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/internal.h \
$(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h \
$(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h libcoff.h \
libecoff.h ecoffswap.h elf64-target.h
elf64-hppa.lo: elf64-hppa.c $(INCDIR)/alloca-conf.h \
$(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
@ -1407,10 +1510,11 @@ elf64-gen.lo: elf64-gen.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/bfdlink.h elf64-target.h
elf64-mips.lo: elf64-mips.c $(INCDIR)/filenames.h $(INCDIR)/aout/ar.h \
$(INCDIR)/bfdlink.h genlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/mips.h \
$(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h \
ecoffswap.h elf64-target.h
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfxx-mips.h \
$(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \
$(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \
$(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h ecoffswap.h \
elf64-target.h
elf64-mmix.lo: elf64-mmix.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/mmix.h $(INCDIR)/elf/reloc-macros.h \
@ -1427,6 +1531,10 @@ elf64-sh64.lo: elf64-sh64.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
elf64-target.h
elf64-sh64-nbsd.lo: elf64-sh64-nbsd.c elf64-sh64.c \
$(INCDIR)/filenames.h $(INCDIR)/bfdlink.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h elf64-target.h
elf64-sparc.lo: elf64-sparc.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/sparc.h \

View File

@ -133,8 +133,10 @@ MKDEP = gcc -MM
SUBDIRS = doc po
docdir = doc
bfdlibdir = @bfdlibdir@
bfdincludedir = @bfdincludedir@
lib_LTLIBRARIES = libbfd.la
bfdlib_LTLIBRARIES = libbfd.la
WARN_CFLAGS = @WARN_CFLAGS@
AM_CFLAGS = $(WARN_CFLAGS)
@ -180,7 +182,9 @@ ALL_MACHINES = \
cpu-cris.lo \
cpu-d10v.lo \
cpu-d30v.lo \
cpu-dlx.lo \
cpu-fr30.lo \
cpu-frv.lo \
cpu-h8300.lo \
cpu-h8500.lo \
cpu-hppa.lo \
@ -229,7 +233,9 @@ ALL_MACHINES_CFILES = \
cpu-cris.c \
cpu-d10v.c \
cpu-d30v.c \
cpu-dlx.c \
cpu-fr30.c \
cpu-frv.c \
cpu-h8300.c \
cpu-h8500.c \
cpu-hppa.c \
@ -324,12 +330,16 @@ BFD32_BACKENDS = \
elf32-cris.lo \
elf32-d10v.lo \
elf32-d30v.lo \
elf32-dlx.lo \
elf32-fr30.lo \
elf32-frv.lo \
elf32-gen.lo \
elf32-h8300.lo \
elf32-hppa.lo \
elf32-i370.lo \
elf32-i386.lo \
elf32-i386-fbsd.lo \
elf32-i386qnx.lo \
elf32-i860.lo \
elf32-i960.lo \
elf32-ia64.lo \
@ -341,6 +351,7 @@ BFD32_BACKENDS = \
elf-m10200.lo \
elf-m10300.lo \
elf32-mcore.lo \
elfxx-mips.lo \
elf32-mips.lo \
elf32-openrisc.lo \
elf32-or32.lo \
@ -350,9 +361,12 @@ BFD32_BACKENDS = \
elf32-sh.lo \
elf32-sh-lin.lo \
elf32-sh64.lo \
elf32-sh64-com.lo \
elf32-sh-nbsd.lo \
elf32-sh64-nbsd.lo \
elf32-sparc.lo \
elf32-v850.lo \
elf32-vax.lo \
elf32-xstormy16.lo \
elf32.lo \
elflink.lo \
@ -411,6 +425,8 @@ BFD32_BACKENDS = \
sparcnetbsd.lo \
sunos.lo \
vaxnetbsd.lo \
vax1knetbsd.lo \
vaxbsd.lo \
versados.lo \
vms.lo \
vms-gsd.lo \
@ -473,12 +489,16 @@ BFD32_BACKENDS_CFILES = \
elf32-cris.c \
elf32-d10v.c \
elf32-d30v.c \
elf32-dlx.c \
elf32-fr30.c \
elf32-frv.c \
elf32-gen.c \
elf32-h8300.c \
elf32-hppa.c \
elf32-i370.c \
elf32-i386.c \
elf32-i386-fbsd.c \
elf32-i386qnx.c \
elf32-i860.c \
elf32-i960.c \
elf32-m32r.c \
@ -489,18 +509,22 @@ BFD32_BACKENDS_CFILES = \
elf-m10200.c \
elf-m10300.c \
elf32-mcore.c \
elfxx-mips.c \
elf32-mips.c \
elf32-openrisc.c \
elf32-or32.c \
elf32-pj.c \
elf32-ppc.c \
elf32-sh64.c \
elf32-sh64-com.c \
elf32-s390.c \
elf32-sh.c \
elf32-sh-lin.c \
elf32-sh-nbsd.c \
elf32-sh64-nbsd.c \
elf32-sparc.c \
elf32-v850.c \
elf32-vax.c \
elf32-xstormy16.c \
elf32.c \
elflink.c \
@ -558,6 +582,8 @@ BFD32_BACKENDS_CFILES = \
sparcnetbsd.c \
sunos.c \
vaxnetbsd.c \
vax1knetbsd.c \
vaxbsd.c \
versados.c \
vms.c \
vms-gsd.c \
@ -571,6 +597,7 @@ BFD32_BACKENDS_CFILES = \
# target_vector in targets.c if configured with --enable-targets=all
# and --enable-64-bit-bfd.
BFD64_BACKENDS = \
aix5ppc-core.lo \
aout64.lo \
coff-alpha.lo \
coff64-rs6000.lo \
@ -578,12 +605,14 @@ BFD64_BACKENDS = \
efi-app-ia64.lo \
elf64-x86-64.lo \
elf64-alpha.lo \
elf64-alpha-fbsd.lo \
elf64-hppa.lo \
elf64-ia64.lo \
elf64-gen.lo \
elf64-mips.lo \
elf64-mmix.lo \
elf64-sh64.lo \
elf64-sh64-nbsd.lo \
elf64-ppc.lo \
elf64-s390.lo \
elf64-sparc.lo \
@ -595,6 +624,7 @@ BFD64_BACKENDS = \
BFD64_BACKENDS_CFILES = \
aix5ppc-core.c \
aout64.c \
coff-alpha.c \
coff64-rs6000.c \
@ -602,6 +632,7 @@ BFD64_BACKENDS_CFILES = \
efi-app-ia64.c \
elf64-x86-64.c \
elf64-alpha.c \
elf64-alpha-fbsd.c \
elf64-hppa.c \
elf64-gen.c \
elf64-mips.c \
@ -609,6 +640,7 @@ BFD64_BACKENDS_CFILES = \
elf64-ppc.c \
elf64-s390.c \
elf64-sh64.c \
elf64-sh64-nbsd.c \
elf64-sparc.c \
elf64.c \
mmo.c \
@ -732,7 +764,7 @@ LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
libbfd_a_LIBADD =
libbfd_a_OBJECTS =
LTLIBRARIES = $(lib_LTLIBRARIES)
LTLIBRARIES = $(bfdlib_LTLIBRARIES)
libbfd_la_OBJECTS = archive.lo archures.lo bfd.lo cache.lo coffgen.lo \
corefile.lo format.lo init.lo libbfd.lo opncls.lo reloc.lo section.lo \
@ -853,33 +885,17 @@ distclean-libtool:
maintainer-clean-libtool:
mostlyclean-libLTLIBRARIES:
mostlyclean-bfdlibLTLIBRARIES:
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
clean-bfdlibLTLIBRARIES:
-test -z "$(bfdlib_LTLIBRARIES)" || rm -f $(bfdlib_LTLIBRARIES)
distclean-libLTLIBRARIES:
distclean-bfdlibLTLIBRARIES:
maintainer-clean-libLTLIBRARIES:
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(libdir)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \
$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \
else :; fi; \
done
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
list='$(lib_LTLIBRARIES)'; for p in $$list; do \
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
done
maintainer-clean-bfdlibLTLIBRARIES:
libbfd.la: $(libbfd_la_OBJECTS) $(libbfd_la_DEPENDENCIES)
$(LINK) -rpath $(libdir) $(libbfd_la_LDFLAGS) $(libbfd_la_OBJECTS) $(libbfd_la_LIBADD) $(LIBS)
$(LINK) -rpath $(bfdlibdir) $(libbfd_la_LDFLAGS) $(libbfd_la_OBJECTS) $(libbfd_la_LIBADD) $(LIBS)
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
@ -1041,16 +1057,16 @@ install-info: install-info-recursive
all-recursive-am: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
install-exec-am: install-libLTLIBRARIES
install-exec-am:
install-exec: install-exec-recursive
install-data-am: install-data-local
install-data-am: install-bfdlibLTLIBRARIES
install-data: install-data-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-recursive
uninstall-am: uninstall-libLTLIBRARIES
uninstall-am: uninstall-bfdlibLTLIBRARIES
uninstall: uninstall-recursive
all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) config.h
all-redirect: all-recursive-am
@ -1058,7 +1074,7 @@ install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs: installdirs-recursive
installdirs-am:
$(mkinstalldirs) $(DESTDIR)$(libdir)
$(mkinstalldirs) $(DESTDIR)$(bfdlibdir)
mostlyclean-generic:
@ -1075,19 +1091,19 @@ distclean-generic:
maintainer-clean-generic:
mostlyclean-am: mostlyclean-hdr mostlyclean-noinstLIBRARIES \
mostlyclean-compile mostlyclean-libtool \
mostlyclean-libLTLIBRARIES mostlyclean-tags \
mostlyclean-bfdlibLTLIBRARIES mostlyclean-tags \
mostlyclean-generic
mostlyclean: mostlyclean-recursive
clean-am: clean-hdr clean-noinstLIBRARIES clean-compile clean-libtool \
clean-libLTLIBRARIES clean-tags clean-generic \
clean-bfdlibLTLIBRARIES clean-tags clean-generic \
mostlyclean-am
clean: clean-recursive
distclean-am: distclean-hdr distclean-noinstLIBRARIES distclean-compile \
distclean-libtool distclean-libLTLIBRARIES \
distclean-libtool distclean-bfdlibLTLIBRARIES \
distclean-tags distclean-generic clean-am
-rm -f libtool
@ -1097,8 +1113,9 @@ distclean: distclean-recursive
maintainer-clean-am: maintainer-clean-hdr \
maintainer-clean-noinstLIBRARIES \
maintainer-clean-compile maintainer-clean-libtool \
maintainer-clean-libLTLIBRARIES maintainer-clean-tags \
maintainer-clean-generic distclean-am
maintainer-clean-bfdlibLTLIBRARIES \
maintainer-clean-tags maintainer-clean-generic \
distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
@ -1110,22 +1127,22 @@ mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile mostlyclean-libtool distclean-libtool \
clean-libtool maintainer-clean-libtool mostlyclean-libLTLIBRARIES \
distclean-libLTLIBRARIES clean-libLTLIBRARIES \
maintainer-clean-libLTLIBRARIES uninstall-libLTLIBRARIES \
install-libLTLIBRARIES install-data-recursive uninstall-data-recursive \
install-exec-recursive uninstall-exec-recursive installdirs-recursive \
uninstalldirs-recursive all-recursive check-recursive \
installcheck-recursive info-recursive dvi-recursive \
mostlyclean-recursive distclean-recursive clean-recursive \
clean-libtool maintainer-clean-libtool mostlyclean-bfdlibLTLIBRARIES \
distclean-bfdlibLTLIBRARIES clean-bfdlibLTLIBRARIES \
maintainer-clean-bfdlibLTLIBRARIES uninstall-bfdlibLTLIBRARIES \
install-bfdlibLTLIBRARIES install-data-recursive \
uninstall-data-recursive install-exec-recursive \
uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \
all-recursive check-recursive installcheck-recursive info-recursive \
dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
dvi-am dvi check check-am installcheck-am installcheck install-info-am \
install-info all-recursive-am install-exec-am install-exec \
install-data-local install-data-am install-data install-am install \
uninstall-am uninstall all-redirect all-am all installdirs-am \
installdirs mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
install-data-am install-data install-am install uninstall-am uninstall \
all-redirect all-am all installdirs-am installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
po/SRC-POTFILES.in: @MAINT@ Makefile $(SRC_POTFILES)
@ -1226,14 +1243,35 @@ $(BFD32_LIBS) \
$(BFD64_BACKENDS) \
$(OPTIONAL_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
# Install BFD include file, and others that it needs.
install-data-local: $(BFD_H)
install-bfdlibLTLIBRARIES: @INSTALL_LIBBFD_TRUE@install_libbfd
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(includedir)
$(INSTALL_DATA) $(BFD_H) $(DESTDIR)$(includedir)/bfd.h
$(INSTALL_DATA) $(INCDIR)/ansidecl.h $(DESTDIR)$(includedir)/ansidecl.h
$(INSTALL_DATA) $(INCDIR)/symcat.h $(DESTDIR)$(includedir)/symcat.h
$(INSTALL_DATA) $(INCDIR)/bfdlink.h $(DESTDIR)$(includedir)/bfdlink.h
uninstall-bfdlibLTLIBRARIES: @INSTALL_LIBBFD_TRUE@uninstall_libbfd
@$(NORMAL_UNINSTALL)
.PHONY: install_libbfd uninstall_libbfd
install_libbfd: $(bfdlib_LTLIBRARIES) $(BFD_H)
$(mkinstalldirs) $(DESTDIR)$(bfdlibdir)
$(mkinstalldirs) $(DESTDIR)$(bfdincludedir)
@list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(bfdlibdir)/$$p"; \
$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(bfdlibdir)/$$p; \
else :; fi; \
done
$(INSTALL_DATA) $(BFD_H) $(DESTDIR)$(bfdincludedir)/bfd.h
$(INSTALL_DATA) $(INCDIR)/ansidecl.h $(DESTDIR)$(bfdincludedir)/ansidecl.h
$(INSTALL_DATA) $(INCDIR)/symcat.h $(DESTDIR)$(bfdincludedir)/symcat.h
$(INSTALL_DATA) $(INCDIR)/bfdlink.h $(DESTDIR)$(bfdincludedir)/bfdlink.h
uninstall_libbfd:
list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(bfdlibdir)/$$p; \
done
rm -f $(DESTDIR)$(bfdincludedir)/bfd.h
rm -f $(DESTDIR)$(bfdincludedir)/ansidecl.h
rm -f $(DESTDIR)$(bfdincludedir)/symcat.h
rm -f $(DESTDIR)$(bfdincludedir)/bfdlink.h
Makefile: $(srcdir)/configure.in
@ -1371,7 +1409,8 @@ stabs.lo: stabs.c $(INCDIR)/filenames.h $(INCDIR)/aout/stab_gnu.h \
$(INCDIR)/aout/stab.def $(INCDIR)/safe-ctype.h
stab-syms.lo: stab-syms.c libaout.h $(INCDIR)/bfdlink.h \
$(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab.def
merge.lo: merge.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
merge.lo: merge.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
$(INCDIR)/libiberty.h
dwarf2.lo: dwarf2.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf2.h
@ -1384,7 +1423,9 @@ cpu-avr.lo: cpu-avr.c $(INCDIR)/filenames.h
cpu-cris.lo: cpu-cris.c $(INCDIR)/filenames.h
cpu-d10v.lo: cpu-d10v.c $(INCDIR)/filenames.h
cpu-d30v.lo: cpu-d30v.c $(INCDIR)/filenames.h
cpu-dlx.lo: cpu-dlx.c $(INCDIR)/filenames.h
cpu-fr30.lo: cpu-fr30.c $(INCDIR)/filenames.h
cpu-frv.lo: cpu-frv.c $(INCDIR)/filenames.h
cpu-h8300.lo: cpu-h8300.c $(INCDIR)/filenames.h
cpu-h8500.lo: cpu-h8500.c $(INCDIR)/filenames.h
cpu-hppa.lo: cpu-hppa.c $(INCDIR)/filenames.h
@ -1600,10 +1641,18 @@ elf32-d30v.lo: elf32-d30v.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/d30v.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
elf32-dlx.lo: elf32-dlx.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/dlx.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
elf32-fr30.lo: elf32-fr30.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/fr30.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
elf32-frv.lo: elf32-frv.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/frv.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
elf32-gen.lo: elf32-gen.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h elf32-target.h
@ -1622,6 +1671,14 @@ elf32-i386.lo: elf32-i386.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
elf32-i386-fbsd.lo: elf32-i386-fbsd.c elf32-i386.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h \
$(INCDIR)/elf/reloc-macros.h elf32-target.h
elf32-i386qnx.lo: elf32-i386qnx.c elf32-i386.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h \
$(INCDIR)/elf/reloc-macros.h elf32-target.h
elf32-i860.lo: elf32-i860.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/i860.h $(INCDIR)/elf/reloc-macros.h \
@ -1660,12 +1717,17 @@ elf32-mcore.lo: elf32-mcore.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/mcore.h \
$(INCDIR)/elf/reloc-macros.h elf32-target.h
elfxx-mips.lo: elfxx-mips.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h elfxx-mips.h $(INCDIR)/elf/mips.h \
$(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
$(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h
elf32-mips.lo: elf32-mips.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
genlink.h elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h \
$(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \
$(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h \
ecoffswap.h elf32-target.h
$(INCDIR)/elf/external.h elfxx-mips.h $(INCDIR)/elf/mips.h \
$(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h \
$(INCDIR)/coff/external.h ecoffswap.h elf32-target.h
elf32-openrisc.lo: elf32-openrisc.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/openrisc.h \
@ -1688,6 +1750,10 @@ elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \
elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
elf32-sh64-com.lo: elf32-sh64-com.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/sh.h \
$(INCDIR)/elf/reloc-macros.h $(srcdir)/../opcodes/sh64-opc.h
elf32-s390.lo: elf32-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \
@ -1704,6 +1770,11 @@ elf32-sh-nbsd.lo: elf32-sh-nbsd.c elf32-sh.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \
$(INCDIR)/elf/reloc-macros.h elf32-target.h
elf32-sh64-nbsd.lo: elf32-sh64-nbsd.c elf32-sh64.c \
$(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
$(srcdir)/../opcodes/sh64-opc.h elf32-sh.c $(INCDIR)/elf/sh.h \
$(INCDIR)/elf/reloc-macros.h elf32-target.h
elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \
@ -1713,6 +1784,10 @@ elf32-v850.lo: elf32-v850.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h \
$(INCDIR)/libiberty.h elf32-target.h
elf32-vax.lo: elf32-vax.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/vax.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
elf32-xstormy16.lo: elf32-xstormy16.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/xstormy16.h \
@ -1727,7 +1802,7 @@ elflink.lo: elflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/elf/external.h
elf-strtab.lo: elf-strtab.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h
$(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h
elf-eh-frame.lo: elf-eh-frame.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf2.h
@ -1897,6 +1972,12 @@ sunos.lo: sunos.c $(INCDIR)/bfdlink.h libaout.h aoutf1.h \
vaxnetbsd.lo: vaxnetbsd.c netbsd.h $(INCDIR)/filenames.h \
libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
vax1knetbsd.lo: vax1knetbsd.c netbsd.h $(INCDIR)/filenames.h \
libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
vaxbsd.lo: vaxbsd.c $(INCDIR)/filenames.h libaout.h \
$(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
versados.lo: versados.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h
vms.lo: vms.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
vms.h
@ -1911,6 +1992,7 @@ vms-tir.lo: vms-tir.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
xcofflink.lo: xcofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h libcoff.h \
libxcoff.h
aix5ppc-core.lo: aix5ppc-core.c
aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
$(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
@ -1931,8 +2013,8 @@ efi-app-ia64.lo: efi-app-ia64.c $(INCDIR)/filenames.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
$(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
elf64-x86-64.lo: elf64-x86-64.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/x86-64.h \
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/x86-64.h \
$(INCDIR)/elf/reloc-macros.h elf64-target.h
elf64-alpha.lo: elf64-alpha.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
@ -1941,6 +2023,13 @@ elf64-alpha.lo: elf64-alpha.c $(INCDIR)/filenames.h \
$(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h \
$(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h libcoff.h \
libecoff.h ecoffswap.h elf64-target.h
elf64-alpha-fbsd.lo: elf64-alpha-fbsd.c elf64-alpha.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/alpha.h \
$(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/internal.h \
$(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h \
$(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h libcoff.h \
libecoff.h ecoffswap.h elf64-target.h
elf64-hppa.lo: elf64-hppa.c $(INCDIR)/alloca-conf.h \
$(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
@ -1951,10 +2040,11 @@ elf64-gen.lo: elf64-gen.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/bfdlink.h elf64-target.h
elf64-mips.lo: elf64-mips.c $(INCDIR)/filenames.h $(INCDIR)/aout/ar.h \
$(INCDIR)/bfdlink.h genlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/mips.h \
$(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h \
ecoffswap.h elf64-target.h
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfxx-mips.h \
$(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \
$(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \
$(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h ecoffswap.h \
elf64-target.h
elf64-mmix.lo: elf64-mmix.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/mmix.h $(INCDIR)/elf/reloc-macros.h \
@ -1971,6 +2061,10 @@ elf64-sh64.lo: elf64-sh64.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
elf64-target.h
elf64-sh64-nbsd.lo: elf64-sh64-nbsd.c elf64-sh64.c \
$(INCDIR)/filenames.h $(INCDIR)/bfdlink.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h elf64-target.h
elf64-sparc.lo: elf64-sparc.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/sparc.h \

View File

@ -123,3 +123,27 @@ 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,
[ --install-libbfd controls installation of libbfd and related headers],
install_libbfd_p=$enableval,
if test "${host}" = "${target}" -o "$enable_shared" = "yes"; then
install_libbfd_p=yes
else
install_libbfd_p=no
fi)
AC_MSG_RESULT($install_libbfd_p)
AM_CONDITIONAL(INSTALL_LIBBFD, test $install_libbfd_p = yes)
# libbfd.a is a host library containing target dependent code
bfdlibdir='$(libdir)'
bfdincludedir='$(includedir)'
if test "${host}" != "${target}"; then
bfdlibdir='$(exec_prefix)/$(host_alias)/$(target_alias)/lib'
bfdincludedir='$(exec_prefix)/$(host_alias)/$(target_alias)/include'
fi
AC_SUBST(bfdlibdir)
AC_SUBST(bfdincludedir)
]
)

View File

@ -136,6 +136,43 @@ 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,
[ --install-libbfd controls installation of libbfd and related headers],
install_libbfd_p=$enableval,
if test "${host}" = "${target}" -o "$enable_shared" = "yes"; then
install_libbfd_p=yes
else
install_libbfd_p=no
fi)
AC_MSG_RESULT($install_libbfd_p)
AM_CONDITIONAL(INSTALL_LIBBFD, test $install_libbfd_p = yes)
# libbfd.a is a host library containing target dependent code
bfdlibdir='$(libdir)'
bfdincludedir='$(includedir)'
if test "${host}" != "${target}"; then
bfdlibdir='$(exec_prefix)/$(host_alias)/$(target_alias)/lib'
bfdincludedir='$(exec_prefix)/$(host_alias)/$(target_alias)/include'
fi
AC_SUBST(bfdlibdir)
AC_SUBST(bfdincludedir)
]
)
# Define a conditional.
AC_DEFUN([AM_CONDITIONAL],
[AC_SUBST($1_TRUE)
AC_SUBST($1_FALSE)
if $2; then
$1_TRUE=
$1_FALSE='#'
else
$1_TRUE='#'
$1_FALSE=
fi])
# Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things.
# But this isn't really a big deal.
@ -271,16 +308,3 @@ AC_DEFUN([AM_MAINTAINER_MODE],
]
)
# Define a conditional.
AC_DEFUN([AM_CONDITIONAL],
[AC_SUBST($1_TRUE)
AC_SUBST($1_FALSE)
if $2; then
$1_TRUE=
$1_FALSE='#'
else
$1_TRUE='#'
$1_FALSE=
fi])

View File

@ -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
2000, 2001, 2002
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@ -207,7 +207,7 @@ static boolean
MY(mkobject) (abfd)
bfd *abfd;
{
if (NAME(aout,mkobject) (abfd) == false)
if (! NAME(aout,mkobject) (abfd))
return false;
#if 0 /* Sizes get set in set_sizes callback, later, after we know
the architecture and machine. */
@ -513,6 +513,9 @@ MY_bfd_final_link (abfd, info)
#ifndef MY_bfd_merge_sections
#define MY_bfd_merge_sections bfd_generic_merge_sections
#endif
#ifndef MY_bfd_discard_group
#define MY_bfd_discard_group bfd_generic_discard_group
#endif
#ifndef MY_bfd_reloc_type_lookup
#define MY_bfd_reloc_type_lookup NAME(aout,reloc_type_lookup)
#endif
@ -528,9 +531,15 @@ MY_bfd_final_link (abfd, info)
#ifndef MY_bfd_link_hash_table_create
#define MY_bfd_link_hash_table_create NAME(aout,link_hash_table_create)
#endif
#ifndef MY_bfd_link_hash_table_free
#define MY_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#endif
#ifndef MY_bfd_link_add_symbols
#define MY_bfd_link_add_symbols NAME(aout,link_add_symbols)
#endif
#ifndef MY_bfd_link_just_syms
#define MY_bfd_link_just_syms _bfd_generic_link_just_syms
#endif
#ifndef MY_bfd_link_split_section
#define MY_bfd_link_split_section _bfd_generic_link_split_section
#endif

View File

@ -748,7 +748,7 @@ sunos4_core_file_matches_executable_p (core_bfd, exec_bfd)
return (memcmp ((char *) &((core_hdr (core_bfd)->hdr)->c_aouthdr),
(char *) exec_hdr (exec_bfd),
sizeof (struct internal_exec)) == 0) ? true : false;
sizeof (struct internal_exec)) == 0);
}
#define MY_set_sizes sunos4_set_sizes

View File

@ -533,7 +533,7 @@ NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p)
obj_aout_sym_hashes (abfd) = NULL;
if (! NAME(aout,make_sections) (abfd))
return NULL;
goto error_ret;
obj_datasec (abfd)->_raw_size = execp->a_data;
obj_bsssec (abfd)->_raw_size = execp->a_bss;
@ -655,13 +655,13 @@ NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p)
obj_textsec (abfd)->next = obj_datasec (abfd);
obj_datasec (abfd)->next = obj_bsssec (abfd);
#endif
return result;
}
else
{
free (rawptr);
abfd->tdata.aout_data = oldrawptr;
}
return result;
error_ret:
bfd_release (abfd, rawptr);
abfd->tdata.aout_data = oldrawptr;
return NULL;
}
/*
@ -1310,9 +1310,9 @@ aout_get_external_symbols (abfd)
count = exec_hdr (abfd)->a_syms / EXTERNAL_NLIST_SIZE;
#ifdef USE_MMAP
if (bfd_get_file_window (abfd,
obj_sym_filepos (abfd), exec_hdr (abfd)->a_syms,
&obj_aout_sym_window (abfd), true) == false)
if (! bfd_get_file_window (abfd, obj_sym_filepos (abfd),
exec_hdr (abfd)->a_syms,
&obj_aout_sym_window (abfd), true))
return false;
syms = (struct external_nlist *) obj_aout_sym_window (abfd).data;
#else
@ -1352,8 +1352,8 @@ aout_get_external_symbols (abfd)
stringsize = GET_WORD (abfd, string_chars);
#ifdef USE_MMAP
if (bfd_get_file_window (abfd, obj_str_filepos (abfd), stringsize,
&obj_aout_string_window (abfd), true) == false)
if (! bfd_get_file_window (abfd, obj_str_filepos (abfd), stringsize,
&obj_aout_string_window (abfd), true))
return false;
strings = (char *) obj_aout_string_window (abfd).data;
#else
@ -1837,11 +1837,9 @@ NAME(aout,slurp_symbol_table) (abfd)
cached_size = obj_aout_external_sym_count (abfd);
cached_size *= sizeof (aout_symbol_type);
cached = (aout_symbol_type *) bfd_malloc (cached_size);
cached = (aout_symbol_type *) bfd_zmalloc (cached_size);
if (cached == NULL && cached_size != 0)
return false;
if (cached_size != 0)
memset (cached, 0, (size_t) cached_size);
/* Convert from external symbol information to internal. */
if (! (NAME(aout,translate_symbol_table)
@ -2411,10 +2409,9 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols)
count = reloc_size / each_size;
amt = count * sizeof (arelent);
reloc_cache = (arelent *) bfd_malloc (amt);
reloc_cache = (arelent *) bfd_zmalloc (amt);
if (reloc_cache == NULL && count != 0)
return false;
memset (reloc_cache, 0, (size_t) amt);
relocs = bfd_malloc (reloc_size);
if (relocs == NULL && reloc_size != 0)
@ -4189,7 +4186,8 @@ aout_link_write_symbols (finfo, input_bfd)
/* Use the name from the hash table, in case the symbol was
wrapped. */
if (h != NULL)
if (h != NULL
&& h->root.type != bfd_link_hash_warning)
name = h->root.root.string;
/* If this is an indirect or warning symbol, then change
@ -4211,7 +4209,6 @@ aout_link_write_symbols (finfo, input_bfd)
/* If the symbol has already been written out, skip it. */
if (h != (struct aout_link_hash_entry *) NULL
&& h->root.type != bfd_link_hash_warning
&& h->written)
{
if ((type & N_TYPE) == N_INDR

View File

@ -603,8 +603,6 @@ bfd_generic_archive_p (abfd)
char armag[SARMAG + 1];
bfd_size_type amt;
tdata_hold = abfd->tdata.aout_ar_data;
if (bfd_bread ((PTR) armag, (bfd_size_type) SARMAG, abfd) != SARMAG)
{
if (bfd_get_error () != bfd_error_system_call)
@ -621,13 +619,15 @@ bfd_generic_archive_p (abfd)
return 0;
#endif
/* We are setting bfd_ardata(abfd) here, but since bfd_ardata
involves a cast, we can't do it as the left operand of assignment. */
amt = sizeof (struct artdata);
abfd->tdata.aout_ar_data = (struct artdata *) bfd_zalloc (abfd, amt);
tdata_hold = bfd_ardata (abfd);
amt = sizeof (struct artdata);
bfd_ardata (abfd) = (struct artdata *) bfd_zalloc (abfd, amt);
if (bfd_ardata (abfd) == NULL)
return NULL;
{
bfd_ardata (abfd) = tdata_hold;
return NULL;
}
bfd_ardata (abfd)->first_file_filepos = SARMAG;
bfd_ardata (abfd)->cache = NULL;
@ -636,21 +636,13 @@ bfd_generic_archive_p (abfd)
bfd_ardata (abfd)->extended_names = NULL;
bfd_ardata (abfd)->tdata = NULL;
if (!BFD_SEND (abfd, _bfd_slurp_armap, (abfd)))
if (!BFD_SEND (abfd, _bfd_slurp_armap, (abfd))
|| !BFD_SEND (abfd, _bfd_slurp_extended_name_table, (abfd)))
{
bfd_release (abfd, bfd_ardata (abfd));
abfd->tdata.aout_ar_data = tdata_hold;
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
return NULL;
}
if (!BFD_SEND (abfd, _bfd_slurp_extended_name_table, (abfd)))
{
bfd_release (abfd, bfd_ardata (abfd));
abfd->tdata.aout_ar_data = tdata_hold;
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
bfd_ardata (abfd) = tdata_hold;
return NULL;
}
@ -686,9 +678,9 @@ bfd_generic_archive_p (abfd)
release bfd_ardata. FIXME. */
(void) bfd_close (first);
bfd_release (abfd, bfd_ardata (abfd));
abfd->tdata.aout_ar_data = tdata_hold;
#endif
bfd_set_error (bfd_error_wrong_object_format);
bfd_ardata (abfd) = tdata_hold;
return NULL;
}
/* And we ought to close `first' here too. */
@ -1746,7 +1738,7 @@ _bfd_write_archive_contents (arch)
if (makemap && hasobjects)
{
if (_bfd_compute_and_write_armap (arch, (unsigned int) elength) != true)
if (! _bfd_compute_and_write_armap (arch, (unsigned int) elength))
return false;
}
@ -1876,8 +1868,8 @@ _bfd_compute_and_write_armap (arch, elength)
current != (bfd *) NULL;
current = current->next, elt_no++)
{
if ((bfd_check_format (current, bfd_object) == true)
&& ((bfd_get_file_flags (current) & HAS_SYMS)))
if (bfd_check_format (current, bfd_object)
&& (bfd_get_file_flags (current) & HAS_SYMS) != 0)
{
long storage;
long symcount;

View File

@ -193,6 +193,7 @@ DESCRIPTION
.#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 *}
. bfd_arch_z8k, {* Zilog Z8000 *}
@ -246,6 +247,13 @@ DESCRIPTION
.#define bfd_mach_am33 330
. bfd_arch_fr30,
.#define bfd_mach_fr30 0x46523330
. bfd_arch_frv,
.#define bfd_mach_frv 0
.#define bfd_mach_frvsimple 1
.#define bfd_mach_fr300 300
.#define bfd_mach_fr400 400
.#define bfd_mach_frvtomcat 499 {* fr500 prototype *}
.#define bfd_mach_fr500 500
. bfd_arch_mcore,
. bfd_arch_ia64, {* HP/Intel ia64 *}
.#define bfd_mach_ia64_elf64 0
@ -312,7 +320,9 @@ extern const bfd_arch_info_type bfd_avr_arch;
extern const bfd_arch_info_type bfd_cris_arch;
extern const bfd_arch_info_type bfd_d10v_arch;
extern const bfd_arch_info_type bfd_d30v_arch;
extern const bfd_arch_info_type bfd_dlx_arch;
extern const bfd_arch_info_type bfd_fr30_arch;
extern const bfd_arch_info_type bfd_frv_arch;
extern const bfd_arch_info_type bfd_h8300_arch;
extern const bfd_arch_info_type bfd_h8500_arch;
extern const bfd_arch_info_type bfd_hppa_arch;
@ -365,7 +375,9 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
&bfd_cris_arch,
&bfd_d10v_arch,
&bfd_d30v_arch,
&bfd_dlx_arch,
&bfd_fr30_arch,
&bfd_frv_arch,
&bfd_h8300_arch,
&bfd_h8500_arch,
&bfd_hppa_arch,

View File

@ -1,5 +1,5 @@
/* BFD back-end for NetBSD/ARM a.out-ish binaries.
Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@ -44,7 +44,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h" /* To ensure following declaration is OK */
CONST struct reloc_howto_struct *
const struct reloc_howto_struct *
MY_bfd_reloc_type_lookup
PARAMS ((bfd * abfd AND
bfd_reloc_code_real_type code));

View File

@ -4,21 +4,21 @@
Free Software Foundation, Inc.
Contributed by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef __BFD_H_SEEN__
#define __BFD_H_SEEN__
@ -328,12 +328,13 @@ alent;
/* Object and core file sections. */
#define align_power(addr, align) \
( ((addr) + ((1<<(align))-1)) & (-1 << (align)))
(((addr) + ((bfd_vma) 1 << (align)) - 1) & ((bfd_vma) -1 << (align)))
typedef struct sec *sec_ptr;
#define bfd_get_section_name(bfd, ptr) ((ptr)->name + 0)
#define bfd_get_section_vma(bfd, ptr) ((ptr)->vma + 0)
#define bfd_get_section_lma(bfd, ptr) ((ptr)->lma + 0)
#define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0)
#define bfd_section_name(bfd, ptr) ((ptr)->name)
#define bfd_section_size(bfd, ptr) (bfd_get_section_size_before_reloc(ptr))
@ -345,7 +346,7 @@ typedef struct sec *sec_ptr;
#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma= (val)), ((ptr)->user_set_vma = (boolean)true), true)
#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = (boolean)true), true)
#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),true)
#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),true)
@ -525,6 +526,8 @@ extern void warn_deprecated
#define bfd_get_outsymbols(abfd) ((abfd)->outsymbols)
#define bfd_count_sections(abfd) ((abfd)->section_count)
#define bfd_get_dynamic_symcount(abfd) ((abfd)->dynsymcount)
#define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (boolean) (bool)), true)
@ -745,9 +748,12 @@ extern boolean bfd_xcoff_record_link_assignment
extern boolean bfd_xcoff_size_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *, const char *, const char *,
unsigned long, unsigned long, unsigned long, boolean,
int, boolean, boolean, struct sec **));
int, boolean, boolean, struct sec **, boolean));
extern boolean bfd_xcoff_link_generate_rtinit
PARAMS ((bfd *, const char *, const char *));
PARAMS ((bfd *, const char *, const char *, boolean));
/* XCOFF support routines for ar. */
extern boolean bfd_xcoff_ar_archive_set_magic PARAMS ((bfd *, char *));
/* Externally visible COFF routines. */
@ -799,6 +805,9 @@ extern boolean bfd_elf32_arm_process_before_allocation
extern boolean bfd_elf32_arm_get_bfd_for_interworking
PARAMS ((bfd *, struct bfd_link_info *));
extern boolean bfd_elf32_arm_add_glue_sections_to_bfd
PARAMS ((bfd *, struct bfd_link_info *));
/* TI COFF load page support. */
extern void bfd_ticoff_set_section_load_page
PARAMS ((struct sec *, int));
@ -806,4 +815,3 @@ extern void bfd_ticoff_set_section_load_page
extern int bfd_ticoff_get_section_load_page
PARAMS ((struct sec *));
/* And more from the source. */

View File

@ -10,21 +10,21 @@
Free Software Foundation, Inc.
Contributed by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef __BFD_H_SEEN__
#define __BFD_H_SEEN__
@ -334,12 +334,13 @@ alent;
/* Object and core file sections. */
#define align_power(addr, align) \
( ((addr) + ((1<<(align))-1)) & (-1 << (align)))
(((addr) + ((bfd_vma) 1 << (align)) - 1) & ((bfd_vma) -1 << (align)))
typedef struct sec *sec_ptr;
#define bfd_get_section_name(bfd, ptr) ((ptr)->name + 0)
#define bfd_get_section_vma(bfd, ptr) ((ptr)->vma + 0)
#define bfd_get_section_lma(bfd, ptr) ((ptr)->lma + 0)
#define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0)
#define bfd_section_name(bfd, ptr) ((ptr)->name)
#define bfd_section_size(bfd, ptr) (bfd_get_section_size_before_reloc(ptr))
@ -351,7 +352,7 @@ typedef struct sec *sec_ptr;
#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma= (val)), ((ptr)->user_set_vma = (boolean)true), true)
#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = (boolean)true), true)
#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),true)
#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),true)
@ -531,6 +532,8 @@ extern void warn_deprecated
#define bfd_get_outsymbols(abfd) ((abfd)->outsymbols)
#define bfd_count_sections(abfd) ((abfd)->section_count)
#define bfd_get_dynamic_symcount(abfd) ((abfd)->dynsymcount)
#define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (boolean) (bool)), true)
@ -751,9 +754,12 @@ extern boolean bfd_xcoff_record_link_assignment
extern boolean bfd_xcoff_size_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *, const char *, const char *,
unsigned long, unsigned long, unsigned long, boolean,
int, boolean, boolean, struct sec **));
int, boolean, boolean, struct sec **, boolean));
extern boolean bfd_xcoff_link_generate_rtinit
PARAMS ((bfd *, const char *, const char *));
PARAMS ((bfd *, const char *, const char *, boolean));
/* XCOFF support routines for ar. */
extern boolean bfd_xcoff_ar_archive_set_magic PARAMS ((bfd *, char *));
/* Externally visible COFF routines. */
@ -805,6 +811,9 @@ extern boolean bfd_elf32_arm_process_before_allocation
extern boolean bfd_elf32_arm_get_bfd_for_interworking
PARAMS ((bfd *, struct bfd_link_info *));
extern boolean bfd_elf32_arm_add_glue_sections_to_bfd
PARAMS ((bfd *, struct bfd_link_info *));
/* TI COFF load page support. */
extern void bfd_ticoff_set_section_load_page
PARAMS ((struct sec *, int));
@ -812,10 +821,11 @@ extern void bfd_ticoff_set_section_load_page
extern int bfd_ticoff_get_section_load_page
PARAMS ((struct sec *));
/* And more from the source. */
/* Extracted from init.c. */
void
bfd_init PARAMS ((void));
/* Extracted from opncls.c. */
bfd *
bfd_openr PARAMS ((const char *filename, const char *target));
@ -843,6 +853,7 @@ bfd_make_writable PARAMS ((bfd *abfd));
boolean
bfd_make_readable PARAMS ((bfd *abfd));
/* Extracted from libbfd.c. */
/* Byte swapping macros for user section data. */
@ -983,6 +994,7 @@ bfd_make_readable PARAMS ((bfd *abfd));
#define H_GET_S8 bfd_h_get_signed_8
/* Extracted from section.c. */
/* This structure is used for a comdat section, as in PE. A comdat
section is associated with a particular symbol. When the linker
sees a comdat section, it keeps only one of the sections with a
@ -1064,12 +1076,6 @@ typedef struct sec
standard data. */
#define SEC_CONSTRUCTOR 0x100
/* The section is a constructor, and should be placed at the
end of the text, data, or bss section(?). */
#define SEC_CONSTRUCTOR_TEXT 0x1100
#define SEC_CONSTRUCTOR_DATA 0x2100
#define SEC_CONSTRUCTOR_BSS 0x3100
/* The section has contents - a data section could be
<<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be
<<SEC_HAS_CONTENTS>> */
@ -1090,6 +1096,9 @@ typedef struct sec
sections. */
#define SEC_COFF_SHARED_LIBRARY 0x800
/* The section contains thread local data. */
#define SEC_THREAD_LOCAL 0x1000
/* The section has GOT references. This flag is only for the
linker, and is currently only used by the elf32-hppa back end.
It will be set if global offset table references were detected
@ -1446,6 +1455,10 @@ bfd_copy_private_section_data PARAMS ((bfd *ibfd, asection *isec,
void
_bfd_strip_section_from_output PARAMS ((struct bfd_link_info *info, asection *section));
boolean
bfd_generic_discard_group PARAMS ((bfd *abfd, asection *group));
/* Extracted from archures.c. */
enum bfd_architecture
{
bfd_arch_unknown, /* File arch not known. */
@ -1572,6 +1585,7 @@ enum bfd_architecture
#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 */
bfd_arch_z8k, /* Zilog Z8000 */
@ -1625,6 +1639,13 @@ enum bfd_architecture
#define bfd_mach_am33 330
bfd_arch_fr30,
#define bfd_mach_fr30 0x46523330
bfd_arch_frv,
#define bfd_mach_frv 0
#define bfd_mach_frvsimple 1
#define bfd_mach_fr300 300
#define bfd_mach_fr400 400
#define bfd_mach_frvtomcat 499 /* fr500 prototype */
#define bfd_mach_fr500 500
bfd_arch_mcore,
bfd_arch_ia64, /* HP/Intel ia64 */
#define bfd_mach_ia64_elf64 0
@ -1718,6 +1739,7 @@ unsigned int
bfd_arch_mach_octets_per_byte PARAMS ((enum bfd_architecture arch,
unsigned long machine));
/* Extracted from reloc.c. */
typedef enum bfd_reloc_status
{
/* No errors detected. */
@ -2143,6 +2165,21 @@ share a common GP, and the target address is adjusted for
STO_ALPHA_STD_GPLOAD. */
BFD_RELOC_ALPHA_BRSGP,
/* Alpha thread-local storage relocations. */
BFD_RELOC_ALPHA_TLSGD,
BFD_RELOC_ALPHA_TLSLDM,
BFD_RELOC_ALPHA_DTPMOD64,
BFD_RELOC_ALPHA_GOTDTPREL16,
BFD_RELOC_ALPHA_DTPREL64,
BFD_RELOC_ALPHA_DTPREL_HI16,
BFD_RELOC_ALPHA_DTPREL_LO16,
BFD_RELOC_ALPHA_DTPREL16,
BFD_RELOC_ALPHA_GOTTPREL16,
BFD_RELOC_ALPHA_TPREL64,
BFD_RELOC_ALPHA_TPREL_HI16,
BFD_RELOC_ALPHA_TPREL_LO16,
BFD_RELOC_ALPHA_TPREL16,
/* Bits 27..2 of the relocation address shifted right 2 bits;
simple reloc otherwise. */
BFD_RELOC_MIPS_JMP,
@ -2197,6 +2234,17 @@ to compensate for the borrow when the low bits are added. */
BFD_RELOC_MIPS_RELGOT,
BFD_RELOC_MIPS_JALR,
/* Fujitsu Frv Relocations. */
BFD_RELOC_FRV_LABEL16,
BFD_RELOC_FRV_LABEL24,
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,
/* i386/elf relocations */
BFD_RELOC_386_GOT32,
@ -2207,6 +2255,18 @@ to compensate for the borrow when the low bits are added. */
BFD_RELOC_386_RELATIVE,
BFD_RELOC_386_GOTOFF,
BFD_RELOC_386_GOTPC,
BFD_RELOC_386_TLS_TPOFF,
BFD_RELOC_386_TLS_IE,
BFD_RELOC_386_TLS_GOTIE,
BFD_RELOC_386_TLS_LE,
BFD_RELOC_386_TLS_GD,
BFD_RELOC_386_TLS_LDM,
BFD_RELOC_386_TLS_LDO_32,
BFD_RELOC_386_TLS_IE_32,
BFD_RELOC_386_TLS_LE_32,
BFD_RELOC_386_TLS_DTPMOD32,
BFD_RELOC_386_TLS_DTPOFF32,
BFD_RELOC_386_TLS_TPOFF32,
/* x86-64/elf relocations */
BFD_RELOC_X86_64_GOT32,
@ -2511,6 +2571,15 @@ of the container. */
/* This is a 32-bit pc-relative reloc. */
BFD_RELOC_D30V_32_PCREL,
/* DLX relocs */
BFD_RELOC_DLX_HI16_S,
/* DLX relocs */
BFD_RELOC_DLX_LO16,
/* DLX relocs */
BFD_RELOC_DLX_JMP26,
/* Mitsubishi M32R relocs.
This is a 24 bit absolute address. */
BFD_RELOC_M32R_24,
@ -2918,12 +2987,25 @@ this offset in the reloc's section offset. */
BFD_RELOC_IA64_IPLTMSB,
BFD_RELOC_IA64_IPLTLSB,
BFD_RELOC_IA64_COPY,
BFD_RELOC_IA64_TPREL22,
BFD_RELOC_IA64_TPREL64MSB,
BFD_RELOC_IA64_TPREL64LSB,
BFD_RELOC_IA64_LTOFF_TP22,
BFD_RELOC_IA64_LTOFF22X,
BFD_RELOC_IA64_LDXMOV,
BFD_RELOC_IA64_TPREL14,
BFD_RELOC_IA64_TPREL22,
BFD_RELOC_IA64_TPREL64I,
BFD_RELOC_IA64_TPREL64MSB,
BFD_RELOC_IA64_TPREL64LSB,
BFD_RELOC_IA64_LTOFF_TPREL22,
BFD_RELOC_IA64_DTPMOD64MSB,
BFD_RELOC_IA64_DTPMOD64LSB,
BFD_RELOC_IA64_LTOFF_DTPMOD22,
BFD_RELOC_IA64_DTPREL14,
BFD_RELOC_IA64_DTPREL22,
BFD_RELOC_IA64_DTPREL64I,
BFD_RELOC_IA64_DTPREL32MSB,
BFD_RELOC_IA64_DTPREL32LSB,
BFD_RELOC_IA64_DTPREL64MSB,
BFD_RELOC_IA64_DTPREL64LSB,
BFD_RELOC_IA64_LTOFF_DTPREL22,
/* Motorola 68HC11 reloc.
This is the 8 bits high part of an absolute address. */
@ -3021,6 +3103,11 @@ This is the 3 bits of a value. */
BFD_RELOC_XSTORMY16_REL_12,
BFD_RELOC_XSTORMY16_24,
BFD_RELOC_XSTORMY16_FPTR16,
/* Relocations used by VAX ELF. */
BFD_RELOC_VAX_GLOB_DAT,
BFD_RELOC_VAX_JMP_SLOT,
BFD_RELOC_VAX_RELATIVE,
BFD_RELOC_UNUSED };
typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
reloc_howto_type *
@ -3029,6 +3116,7 @@ bfd_reloc_type_lookup PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
const char *
bfd_get_reloc_code_name PARAMS ((bfd_reloc_code_real_type code));
/* Extracted from syms.c. */
typedef struct symbol_cache_entry
{
@ -3134,6 +3222,9 @@ typedef struct symbol_cache_entry
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
@ -3198,6 +3289,7 @@ bfd_copy_private_symbol_data PARAMS ((bfd *ibfd, asymbol *isym, bfd *obfd, asymb
BFD_SEND (obfd, _bfd_copy_private_symbol_data, \
(ibfd, isymbol, obfd, osymbol))
/* Extracted from bfd.c. */
struct _bfd
{
/* The filename the application opened the BFD with. */
@ -3292,6 +3384,9 @@ struct _bfd
/* Symbol table for output BFD (with symcount entries). */
struct symbol_cache_entry **outsymbols;
/* Used for slurped dynamic symbol tables. */
unsigned int dynsymcount;
/* Pointer to structure which contains architecture information. */
const struct bfd_arch_info *arch_info;
@ -3497,12 +3592,21 @@ bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags));
#define bfd_merge_sections(abfd, link_info) \
BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
#define bfd_discard_group(abfd, sec) \
BFD_SEND (abfd, _bfd_discard_group, (abfd, sec))
#define bfd_link_hash_table_create(abfd) \
BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
#define bfd_link_hash_table_free(abfd, hash) \
BFD_SEND (abfd, _bfd_link_hash_table_free, (hash))
#define bfd_link_add_symbols(abfd, info) \
BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
#define bfd_link_just_syms(sec, info) \
BFD_SEND (abfd, _bfd_link_just_syms, (sec, info))
#define bfd_final_link(abfd, info) \
BFD_SEND (abfd, _bfd_final_link, (abfd, info))
@ -3532,6 +3636,7 @@ extern bfd_byte *bfd_get_relocated_section_contents
boolean
bfd_alt_mach_code PARAMS ((bfd *abfd, int index));
/* Extracted from archive.c. */
symindex
bfd_get_next_mapent PARAMS ((bfd *abfd, symindex previous, carsym **sym));
@ -3541,6 +3646,7 @@ bfd_set_archive_head PARAMS ((bfd *output, bfd *new_head));
bfd *
bfd_openr_next_archived_file PARAMS ((bfd *archive, bfd *previous));
/* Extracted from corefile.c. */
const char *
bfd_core_file_failing_command PARAMS ((bfd *abfd));
@ -3550,6 +3656,7 @@ bfd_core_file_failing_signal PARAMS ((bfd *abfd));
boolean
core_file_matches_executable_p PARAMS ((bfd *core_bfd, bfd *exec_bfd));
/* Extracted from targets.c. */
#define BFD_SEND(bfd, message, arglist) \
((*((bfd)->xvec->message)) arglist)
@ -3825,11 +3932,14 @@ CONCAT2 (NAME,_sizeof_headers), \
CONCAT2 (NAME,_bfd_get_relocated_section_contents), \
CONCAT2 (NAME,_bfd_relax_section), \
CONCAT2 (NAME,_bfd_link_hash_table_create), \
CONCAT2 (NAME,_bfd_link_hash_table_free), \
CONCAT2 (NAME,_bfd_link_add_symbols), \
CONCAT2 (NAME,_bfd_link_just_syms), \
CONCAT2 (NAME,_bfd_final_link), \
CONCAT2 (NAME,_bfd_link_split_section), \
CONCAT2 (NAME,_bfd_gc_sections), \
CONCAT2 (NAME,_bfd_merge_sections)
CONCAT2 (NAME,_bfd_merge_sections), \
CONCAT2 (NAME,_bfd_discard_group)
int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean));
bfd_byte *(*_bfd_get_relocated_section_contents)
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
@ -3842,9 +3952,15 @@ CONCAT2 (NAME,_bfd_merge_sections)
different information in this table. */
struct bfd_link_hash_table *(*_bfd_link_hash_table_create) PARAMS ((bfd *));
/* Release the memory associated with the linker hash table. */
void (*_bfd_link_hash_table_free) PARAMS ((struct bfd_link_hash_table *));
/* Add symbols from this object file into the hash table. */
boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
/* Indicate that we are only retrieving symbol values from this section. */
void (*_bfd_link_just_syms) PARAMS ((asection *, struct bfd_link_info *));
/* Do a link based on the link_order structures attached to each
section of the BFD. */
boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *));
@ -3858,6 +3974,9 @@ CONCAT2 (NAME,_bfd_merge_sections)
/* Attempt to merge SEC_MERGE sections. */
boolean (*_bfd_merge_sections) PARAMS ((bfd *, struct bfd_link_info *));
/* Discard members of a group. */
boolean (*_bfd_discard_group) PARAMS ((bfd *, struct sec *));
/* Routines to handle dynamic symbols and relocs. */
#define BFD_JUMP_TABLE_DYNAMIC(NAME) \
CONCAT2 (NAME,_get_dynamic_symtab_upper_bound), \
@ -3896,6 +4015,7 @@ bfd_target_list PARAMS ((void));
const bfd_target *
bfd_search_for_target PARAMS ((int (* search_func) (const bfd_target *, void *), void *));
/* Extracted from format.c. */
boolean
bfd_check_format PARAMS ((bfd *abfd, bfd_format format));

View File

@ -128,6 +128,9 @@ CODE_FRAGMENT
. {* Symbol table for output BFD (with symcount entries). *}
. struct symbol_cache_entry **outsymbols;
.
. {* Used for slurped dynamic symbol tables. *}
. unsigned int dynsymcount;
.
. {* Pointer to structure which contains architecture information. *}
. const struct bfd_arch_info *arch_info;
.
@ -749,7 +752,6 @@ bfd_get_arch_size (abfd)
if (abfd->xvec->flavour == bfd_target_elf_flavour)
return (get_elf_backend_data (abfd))->s->arch_size;
bfd_set_error (bfd_error_wrong_format);
return -1;
}
@ -1008,7 +1010,8 @@ DESCRIPTION
in hex if a leading "0x" or "0X" is found, otherwise
in octal if a leading zero is found, otherwise in decimal.
Overflow is not detected.
If the value would overflow, the maximum <<bfd_vma>> value is
returned.
*/
bfd_vma
@ -1018,48 +1021,64 @@ bfd_scan_vma (string, end, base)
int base;
{
bfd_vma value;
int digit;
bfd_vma cutoff;
unsigned int cutlim;
int overflow;
/* Let the host do it if possible. */
if (sizeof (bfd_vma) <= sizeof (unsigned long))
return (bfd_vma) strtoul (string, (char **) end, base);
/* A negative base makes no sense, and we only need to go as high as hex. */
if ((base < 0) || (base > 16))
return (bfd_vma) 0;
if (base == 0)
{
if (string[0] == '0')
{
if ((string[1] == 'x') || (string[1] == 'X'))
base = 16;
/* XXX should we also allow "0b" or "0B" to set base to 2? */
else
base = 8;
}
else
base = 10;
}
if ((base == 16) &&
(string[0] == '0') && ((string[1] == 'x') || (string[1] == 'X')))
string += 2;
/* XXX should we also skip over "0b" or "0B" if base is 2? */
if ((base < 2) || (base > 36))
base = 10;
/* Speed could be improved with a table like hex_value[] in gas. */
#define HEX_VALUE(c) \
(ISXDIGIT (c) \
? (ISDIGIT (c) \
? (c - '0') \
: (10 + c - (ISLOWER (c) ? 'a' : 'A'))) \
: 42)
if (base == 16
&& string[0] == '0'
&& (string[1] == 'x' || string[1] == 'X')
&& ISXDIGIT (string[2]))
{
string += 2;
}
for (value = 0; (digit = HEX_VALUE (* string)) < base; string ++)
value = value * base + digit;
cutoff = (~ (bfd_vma) 0) / (bfd_vma) base;
cutlim = (~ (bfd_vma) 0) % (bfd_vma) base;
value = 0;
overflow = 0;
while (1)
{
unsigned int digit;
if (end)
* end = string;
digit = *string;
if (ISDIGIT (digit))
digit = digit - '0';
else if (ISALPHA (digit))
digit = TOUPPER (digit) - 'A' + 10;
else
break;
if (digit >= (unsigned int) base)
break;
if (value > cutoff || (value == cutoff && digit > cutlim))
overflow = 1;
value = value * base + digit;
++string;
}
if (overflow)
value = ~ (bfd_vma) 0;
if (end != NULL)
*end = string;
return value;
}
@ -1169,12 +1188,21 @@ DESCRIPTION
.#define bfd_merge_sections(abfd, link_info) \
. BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
.
.#define bfd_discard_group(abfd, sec) \
. BFD_SEND (abfd, _bfd_discard_group, (abfd, sec))
.
.#define bfd_link_hash_table_create(abfd) \
. BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
.
.#define bfd_link_hash_table_free(abfd, hash) \
. BFD_SEND (abfd, _bfd_link_hash_table_free, (hash))
.
.#define bfd_link_add_symbols(abfd, info) \
. BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
.
.#define bfd_link_just_syms(sec, info) \
. BFD_SEND (abfd, _bfd_link_just_syms, (sec, info))
.
.#define bfd_final_link(abfd, info) \
. BFD_SEND (abfd, _bfd_final_link, (abfd, info))
.
@ -1309,27 +1337,27 @@ FUNCTION
bfd_alt_mach_code
SYNOPSIS
boolean bfd_alt_mach_code(bfd *abfd, int index);
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 (index == 0) and any others. Currently,
the preferred one (alternative == 0) and any others. Currently,
only ELF supports this feature, with up to two alternate
machine codes.
*/
boolean
bfd_alt_mach_code (abfd, index)
bfd_alt_mach_code (abfd, alternative)
bfd *abfd;
int index;
int alternative;
{
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
{
int code;
switch (index)
switch (alternative)
{
case 0:
code = get_elf_backend_data (abfd)->elf_machine_code;

View File

@ -1,5 +1,5 @@
/* BFD back-end for binary objects.
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>
@ -337,7 +337,10 @@ binary_sizeof_headers (abfd, exec)
#define binary_bfd_relax_section bfd_generic_relax_section
#define binary_bfd_gc_sections bfd_generic_gc_sections
#define binary_bfd_merge_sections bfd_generic_merge_sections
#define binary_bfd_discard_group bfd_generic_discard_group
#define binary_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define binary_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define binary_bfd_link_just_syms _bfd_generic_link_just_syms
#define binary_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define binary_bfd_final_link _bfd_generic_final_link
#define binary_bfd_link_split_section _bfd_generic_link_split_section

View File

@ -1,5 +1,5 @@
/* BFD library -- caching of file descriptors.
Copyright 1990, 1991, 1992, 1993, 1994, 1996, 2000, 2001
Copyright 1990, 1991, 1992, 1993, 1994, 1996, 2000, 2001, 2002
Free Software Foundation, Inc.
Hacked by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
@ -277,7 +277,7 @@ bfd_open_file (abfd)
break;
case both_direction:
case write_direction:
if (abfd->opened_once == true)
if (abfd->opened_once)
{
abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_RUB);
if (abfd->iostream == NULL)

View File

@ -1,5 +1,5 @@
/* BFD back-end for ALPHA Extended-Coff files.
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
Modified from coff-mips.c by Steve Chamberlain <sac@cygnus.com> and
Ian Lance Taylor <ian@cygnus.com>.
@ -795,7 +795,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
gp = _bfd_get_gp_value (abfd);
if (gp == 0)
{
if (relocateable != false)
if (relocateable)
{
asection *sec;
bfd_vma lo;
@ -2356,6 +2356,7 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data =
#define _bfd_ecoff_bfd_relax_section bfd_generic_relax_section
#define _bfd_ecoff_bfd_gc_sections bfd_generic_gc_sections
#define _bfd_ecoff_bfd_merge_sections bfd_generic_merge_sections
#define _bfd_ecoff_bfd_discard_group bfd_generic_discard_group
const bfd_target ecoffalpha_little_vec =
{

View File

@ -947,14 +947,14 @@ coff_arm_link_hash_table_create (abfd)
struct coff_arm_link_hash_table * ret;
bfd_size_type amt = sizeof (struct coff_arm_link_hash_table);
ret = (struct coff_arm_link_hash_table *) bfd_alloc (abfd, amt);
ret = (struct coff_arm_link_hash_table *) bfd_malloc (amt);
if (ret == (struct coff_arm_link_hash_table *) NULL)
return NULL;
if (! _bfd_coff_link_hash_table_init
(& ret->root, abfd, _bfd_coff_link_hash_newfunc))
{
bfd_release (abfd, ret);
free (ret);
return (struct bfd_link_hash_table *) NULL;
}
@ -1701,21 +1701,23 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
|| signed_check < reloc_signed_min)
overflow = true;
/* For the BLX(1) instruction remove bit 0 of the adjusted offset.
Bit 0 can only be set if the upper insn is at a half-word boundary,
since the destination address, an ARM instruction, must always be
on a word boundary. The semantics of the BLX (1) instruction,
however, are that bit 0 in the offset must always be 0, and the
corresponding bit 1 in the target address will be set from bit
1 of the source address. */
if ((x & 0x18000000) == 0x08000000)
relocation &= ~0x2;
/* Put the relocation into the correct bits. */
/* Put the relocation into the correct bits.
For a BLX instruction, make sure that the relocation is rounded up
to a word boundary. This follows the semantics of the instruction
which specifies that bit 1 of the target address will come from bit
1 of the base address. */
if (bfd_big_endian (input_bfd))
relocation = (((relocation & 0xffe) >> 1) | ((relocation << 4) & 0x07ff0000));
{
if ((x & 0x1800) == 0x0800 && (relocation & 0x02))
relocation += 2;
relocation = (((relocation & 0xffe) >> 1) | ((relocation << 4) & 0x07ff0000));
}
else
relocation = (((relocation & 0xffe) << 15) | ((relocation >> 12) & 0x7ff));
{
if ((x & 0x18000000) == 0x08000000 && (relocation & 0x02))
relocation += 2;
relocation = (((relocation & 0xffe) << 15) | ((relocation >> 12) & 0x7ff));
}
/* Add the relocation to the correct bits of X. */
x = ((x & ~howto->dst_mask) | relocation);

View File

@ -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
2000, 2001, 2002
Free Software Foundation, Inc.
Written by Cygnus Support.
@ -117,7 +117,7 @@ coff_i386_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
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 == true && howto->pcrel_offset == true)
if (howto->pc_relative && howto->pcrel_offset)
diff = -(1 << howto->size);
else
diff = -reloc_entry->addend;

View File

@ -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
2000, 2001, 2002
Free Software Foundation, Inc.
Original version pieced together by Kim Knuttila (krk@cygnus.com)
@ -204,13 +204,13 @@ ppc_coff_link_hash_table_create (abfd)
struct ppc_coff_link_hash_table *ret;
bfd_size_type amt = sizeof (struct ppc_coff_link_hash_table);
ret = (struct ppc_coff_link_hash_table *) bfd_alloc (abfd, amt);
ret = (struct ppc_coff_link_hash_table *) bfd_malloc (amt);
if (ret == NULL)
return NULL;
if (! ppc_coff_link_hash_table_init (ret, abfd,
ppc_coff_link_hash_newfunc))
{
bfd_release (abfd, ret);
free (ret);
return (struct bfd_link_hash_table *) NULL;
}
return &ret->root.root;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -341,6 +341,11 @@ static PTR coff_mkobject_hook PARAMS ((bfd *, PTR, PTR));
#ifdef COFF_WITH_PE
static flagword handle_COMDAT PARAMS ((bfd *, flagword, PTR, const char *, asection *));
#endif
#ifdef COFF_IMAGE_WITH_PE
static boolean coff_read_word PARAMS ((bfd *, unsigned int *));
static unsigned int coff_compute_checksum PARAMS ((bfd *));
static boolean coff_apply_checksum PARAMS ((bfd *));
#endif
/* void warning(); */
@ -1493,12 +1498,12 @@ coff_new_section_hook (abfd, section)
section->alignment_power = COFF_DEFAULT_SECTION_ALIGNMENT_POWER;
#ifdef RS6000COFF_C
if (xcoff_data (abfd)->text_align_power != 0
if (bfd_xcoff_text_align_power (abfd) != 0
&& strcmp (bfd_get_section_name (abfd, section), ".text") == 0)
section->alignment_power = xcoff_data (abfd)->text_align_power;
if (xcoff_data (abfd)->data_align_power != 0
section->alignment_power = bfd_xcoff_text_align_power (abfd);
if (bfd_xcoff_data_align_power (abfd) != 0
&& strcmp (bfd_get_section_name (abfd, section), ".data") == 0)
section->alignment_power = xcoff_data (abfd)->data_align_power;
section->alignment_power = bfd_xcoff_data_align_power (abfd);
#endif
/* Allocate aux records for section symbols, to store size and
@ -1734,7 +1739,7 @@ coff_mkobject_hook (abfd, filehdr, aouthdr)
struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
coff_data_type *coff;
if (coff_mkobject (abfd) == false)
if (! coff_mkobject (abfd))
return NULL;
coff = coff_data (abfd);
@ -1777,8 +1782,8 @@ coff_mkobject_hook (abfd, filehdr, aouthdr)
xcoff->toc = internal_a->o_toc;
xcoff->sntoc = internal_a->o_sntoc;
xcoff->snentry = internal_a->o_snentry;
xcoff->text_align_power = internal_a->o_algntext;
xcoff->data_align_power = internal_a->o_algndata;
bfd_xcoff_text_align_power (abfd) = internal_a->o_algntext;
bfd_xcoff_data_align_power (abfd) = internal_a->o_algndata;
xcoff->modtype = internal_a->o_modtype;
xcoff->cputype = internal_a->o_cputype;
xcoff->maxdata = internal_a->o_maxdata;
@ -1964,6 +1969,7 @@ coff_set_arch_mach_hook (abfd, filehdr)
#ifdef RS6000COFF_C
#ifdef XCOFF64
case U64_TOCMAGIC:
case U803XTOCMAGIC:
#else
case U802ROMAGIC:
@ -2152,6 +2158,13 @@ coff_set_arch_mach_hook (abfd, filehdr)
arch = bfd_arch_mcore;
break;
#endif
#ifdef W65MAGIC
case W65MAGIC:
arch = bfd_arch_w65;
break;
#endif
default: /* Unreadable input file type */
arch = bfd_arch_obscure;
break;
@ -2171,7 +2184,7 @@ symname_in_debug_hook (abfd, sym)
bfd * abfd ATTRIBUTE_UNUSED;
struct internal_syment *sym;
{
return SYMNAME_IN_DEBUG (sym) ? true : false;
return SYMNAME_IN_DEBUG (sym) != 0;
}
#else
@ -2388,7 +2401,7 @@ coff_write_relocs (abfd, first_undef)
return false;
#ifdef COFF_WITH_PE
if (s->reloc_count > 0xffff)
if (obj_pe (abfd) && s->reloc_count >= 0xffff)
{
/* encode real count here as first reloc */
struct internal_reloc n;
@ -2768,14 +2781,8 @@ coff_set_flags (abfd, magicp, flagsp)
#ifndef PPCMAGIC
case bfd_arch_powerpc:
#endif
#ifdef XCOFF64
if (bfd_get_mach (abfd) == bfd_mach_ppc_620
&& !strncmp (abfd->xvec->name,"aix", 3))
*magicp = U803XTOCMAGIC;
else
#else
*magicp = U802TOCMAGIC;
#endif
BFD_ASSERT (bfd_get_flavour (abfd) == bfd_target_xcoff_flavour);
*magicp = bfd_xcoff_magic_number (abfd);
return true;
break;
#endif
@ -2822,8 +2829,8 @@ coff_set_arch_mach (abfd, arch, machine)
if (! bfd_default_set_arch_mach (abfd, arch, machine))
return false;
if (arch != bfd_arch_unknown &&
coff_set_flags (abfd, &dummy1, &dummy2) != true)
if (arch != bfd_arch_unknown
&& ! coff_set_flags (abfd, &dummy1, &dummy2))
return false; /* We can't represent this type */
return true; /* We're easy ... */
@ -3084,8 +3091,10 @@ coff_compute_section_file_positions (abfd)
AIX executable is stripped with gnu strip because the default vma
of native is 0x10000150 but default for gnu is 0x10000140. Gnu
stripped gnu excutable passes this check because the filepos is
0x0140. */
if (!strcmp (current->name, _TEXT))
0x0140. This problem also show up with 64 bit shared objects. The
data section must also be aligned. */
if (!strcmp (current->name, _TEXT)
|| !strcmp (current->name, _DATA))
{
bfd_vma pad;
bfd_vma align;
@ -3276,6 +3285,100 @@ coff_add_missing_symbols (abfd)
#endif /* 0 */
#ifdef COFF_IMAGE_WITH_PE
static unsigned int pelength;
static unsigned int peheader;
static boolean
coff_read_word (abfd, value)
bfd *abfd;
unsigned int *value;
{
unsigned char b[2];
int status;
status = bfd_bread (b, (bfd_size_type) 2, abfd);
if (status < 1)
{
*value = 0;
return false;
}
if (status == 1)
*value = (unsigned int) b[0];
else
*value = (unsigned int) (b[0] + (b[1] << 8));
pelength += (unsigned int) status;
return true;
}
static unsigned int
coff_compute_checksum (abfd)
bfd *abfd;
{
boolean more_data;
file_ptr filepos;
unsigned int value;
unsigned int total;
total = 0;
pelength = 0;
filepos = (file_ptr) 0;
do
{
if (bfd_seek (abfd, filepos, SEEK_SET) != 0)
return 0;
more_data = coff_read_word (abfd, &value);
total += value;
total = 0xffff & (total + (total >> 0x10));
filepos += 2;
}
while (more_data);
return (0xffff & (total + (total >> 0x10)));
}
static boolean
coff_apply_checksum (abfd)
bfd *abfd;
{
unsigned int computed;
unsigned int checksum = 0;
if (bfd_seek (abfd, 0x3c, SEEK_SET) != 0)
return false;
if (!coff_read_word (abfd, &peheader))
return false;
if (bfd_seek (abfd, peheader + 0x58, SEEK_SET) != 0)
return false;
checksum = 0;
bfd_bwrite (&checksum, (bfd_size_type) 4, abfd);
if (bfd_seek (abfd, peheader, SEEK_SET) != 0)
return false;
computed = coff_compute_checksum (abfd);
checksum = computed + pelength;
if (bfd_seek (abfd, peheader + 0x58, SEEK_SET) != 0)
return false;
bfd_bwrite (&checksum, (bfd_size_type) 4, abfd);
return true;
}
#endif /* COFF_IMAGE_WITH_PE */
/* SUPPRESS 558 */
/* SUPPRESS 529 */
static boolean
@ -3309,7 +3412,7 @@ coff_write_object_contents (abfd)
lnno_size = coff_count_linenumbers (abfd) * bfd_coff_linesz (abfd);
if (abfd->output_has_begun == false)
if (! abfd->output_has_begun)
{
if (! coff_compute_section_file_positions (abfd))
return false;
@ -3324,7 +3427,7 @@ coff_write_object_contents (abfd)
{
#ifdef COFF_WITH_PE
/* we store the actual reloc count in the first reloc's addr */
if (current->reloc_count > 0xffff)
if (obj_pe (abfd) && current->reloc_count >= 0xffff)
reloc_count ++;
#endif
reloc_count += current->reloc_count;
@ -3355,7 +3458,7 @@ coff_write_object_contents (abfd)
reloc_base += current->reloc_count * bfd_coff_relsz (abfd);
#ifdef COFF_WITH_PE
/* extra reloc to hold real count */
if (current->reloc_count > 0xffff)
if (obj_pe (abfd) && current->reloc_count >= 0xffff)
reloc_base += bfd_coff_relsz (abfd);
#endif
}
@ -4066,6 +4169,11 @@ coff_write_object_contents (abfd)
if (amount != bfd_coff_aoutsz (abfd))
return false;
#ifdef COFF_IMAGE_WITH_PE
if (! coff_apply_checksum (abfd))
return false;
#endif
}
#ifdef RS6000COFF_C
else
@ -4095,7 +4203,7 @@ coff_set_section_contents (abfd, section, location, offset, count)
file_ptr offset;
bfd_size_type count;
{
if (abfd->output_has_begun == false) /* set by bfd.c handler */
if (! abfd->output_has_begun) /* set by bfd.c handler */
{
if (! coff_compute_section_file_positions (abfd))
return false;
@ -5049,6 +5157,10 @@ dummy_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
}
#endif
#ifndef coff_bfd_link_hash_table_free
#define coff_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#endif
/* If coff_relocate_section is defined, we can use the optimized COFF
backend linker. Otherwise we must continue to use the old linker. */
#ifdef coff_relocate_section
@ -5072,6 +5184,7 @@ dummy_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
#define coff_bfd_final_link _bfd_generic_final_link
#endif /* ! defined (coff_relocate_section) */
#define coff_bfd_link_just_syms _bfd_generic_link_just_syms
#define coff_bfd_link_split_section _bfd_generic_link_split_section
#ifndef coff_start_final_link
@ -5268,6 +5381,10 @@ static const bfd_coff_backend_data bfd_coff_std_swap_table =
#define coff_bfd_merge_sections bfd_generic_merge_sections
#endif
#ifndef coff_bfd_discard_group
#define coff_bfd_discard_group bfd_generic_discard_group
#endif
#define CREATE_BIG_COFF_TARGET_VEC(VAR, NAME, EXTRA_O_FLAGS, EXTRA_S_FLAGS, UNDER, ALTERNATIVE) \
const bfd_target VAR = \
{ \

View File

@ -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
2000, 2001, 2002
Free Software Foundation, Inc.
Written by Cygnus Support.
@ -178,6 +178,7 @@ coff_real_object_p (abfd, nscns, internal_f, internal_a)
flagword oflags = abfd->flags;
bfd_vma ostart = bfd_get_start_address (abfd);
PTR tdata;
PTR tdata_save;
bfd_size_type readsize; /* length of file_info */
unsigned int scnhsz;
char *external_sections;
@ -206,9 +207,10 @@ coff_real_object_p (abfd, nscns, internal_f, internal_a)
/* Set up the tdata area. ECOFF uses its own routine, and overrides
abfd->flags. */
tdata_save = abfd->tdata.any;
tdata = bfd_coff_mkobject_hook (abfd, (PTR) internal_f, (PTR) internal_a);
if (tdata == NULL)
return 0;
goto fail2;
scnhsz = bfd_coff_scnhsz (abfd);
readsize = (bfd_size_type) nscns * scnhsz;
@ -221,7 +223,7 @@ coff_real_object_p (abfd, nscns, internal_f, internal_a)
/* Set the arch/mach *before* swapping in sections; section header swapping
may depend on arch/mach info. */
if (bfd_coff_set_arch_mach_hook (abfd, (PTR) internal_f) == false)
if (! bfd_coff_set_arch_mach_hook (abfd, (PTR) internal_f))
goto fail;
/* Now copy data as required; construct all asections etc */
@ -245,6 +247,8 @@ coff_real_object_p (abfd, nscns, internal_f, internal_a)
fail:
bfd_release (abfd, tdata);
fail2:
abfd->tdata.any = tdata_save;
abfd->flags = oflags;
bfd_get_start_address (abfd) = ostart;
return (const bfd_target *) NULL;
@ -270,12 +274,13 @@ coff_object_p (abfd)
filehdr = bfd_alloc (abfd, filhsz);
if (filehdr == NULL)
return 0;
return NULL;
if (bfd_bread (filehdr, filhsz, abfd) != filhsz)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
return 0;
bfd_release (abfd, filehdr);
return NULL;
}
bfd_coff_swap_filehdr_in (abfd, filehdr, &internal_f);
bfd_release (abfd, filehdr);
@ -288,11 +293,11 @@ coff_object_p (abfd)
only read in f_opthdr bytes in the call to bfd_bread. We should
also attempt to catch corrupt or non-COFF binaries with a strange
value for f_opthdr. */
if (bfd_coff_bad_format_hook (abfd, &internal_f) == false
if (! bfd_coff_bad_format_hook (abfd, &internal_f)
|| internal_f.f_opthdr > aoutsz)
{
bfd_set_error (bfd_error_wrong_format);
return 0;
return NULL;
}
nscns = internal_f.f_nscns;
@ -302,13 +307,15 @@ coff_object_p (abfd)
opthdr = bfd_alloc (abfd, aoutsz);
if (opthdr == NULL)
return 0;
return NULL;
if (bfd_bread (opthdr, (bfd_size_type) internal_f.f_opthdr, abfd)
!= internal_f.f_opthdr)
{
return 0;
bfd_release (abfd, opthdr);
return NULL;
}
bfd_coff_swap_aouthdr_in (abfd, opthdr, (PTR) &internal_a);
bfd_release (abfd, opthdr);
}
return coff_real_object_p (abfd, nscns, &internal_f,
@ -1438,13 +1445,13 @@ coff_section_symbol (abfd, name)
combined_entry_type e[10];
};
struct foo *f;
f = (struct foo *) bfd_alloc (abfd, (bfd_size_type) sizeof (*f));
f = (struct foo *) bfd_zalloc (abfd, (bfd_size_type) sizeof (*f));
if (!f)
{
bfd_set_error (bfd_error_no_error);
return NULL;
}
memset ((char *) f, 0, sizeof (*f));
coff_symbol_from (abfd, sym)->native = csym = f->e;
}
csym[0].u.syment.n_sclass = C_STAT;
@ -1835,10 +1842,9 @@ coff_get_normalized_symtab (abfd)
if (internal_ptr->u.syment._n._n_name[i] == '\0')
break;
newstring = (PTR) bfd_alloc (abfd, (bfd_size_type) (i + 1));
newstring = (PTR) bfd_zalloc (abfd, (bfd_size_type) (i + 1));
if (newstring == NULL)
return (NULL);
memset (newstring, 0, i + 1);
strncpy (newstring, internal_ptr->u.syment._n._n_name, i);
internal_ptr->u.syment._n._n_n._n_offset = (long int) newstring;
internal_ptr->u.syment._n._n_n._n_zeroes = 0;
@ -1897,10 +1903,9 @@ coff_make_empty_symbol (abfd)
bfd *abfd;
{
bfd_size_type amt = sizeof (coff_symbol_type);
coff_symbol_type *new = (coff_symbol_type *) bfd_alloc (abfd, amt);
coff_symbol_type *new = (coff_symbol_type *) bfd_zalloc (abfd, amt);
if (new == NULL)
return (NULL);
memset (new, 0, sizeof *new);
new->symbol.section = 0;
new->native = 0;
new->lineno = (alent *) NULL;
@ -2415,7 +2420,7 @@ coff_sizeof_headers (abfd, reloc)
{
size_t size;
if (reloc == false)
if (! reloc)
{
size = bfd_coff_filhsz (abfd) + bfd_coff_aoutsz (abfd);
}
@ -2453,12 +2458,10 @@ bfd_coff_set_symbol_class (abfd, symbol, class)
combined_entry_type * native;
bfd_size_type amt = sizeof (* native);
native = (combined_entry_type *) bfd_alloc (abfd, amt);
native = (combined_entry_type *) bfd_zalloc (abfd, amt);
if (native == NULL)
return false;
memset (native, 0, sizeof (* native));
native->u.syment.n_type = T_NULL;
native->u.syment.n_sclass = class;

View File

@ -119,13 +119,13 @@ _bfd_coff_link_hash_table_create (abfd)
struct coff_link_hash_table *ret;
bfd_size_type amt = sizeof (struct coff_link_hash_table);
ret = (struct coff_link_hash_table *) bfd_alloc (abfd, amt);
ret = (struct coff_link_hash_table *) bfd_malloc (amt);
if (ret == NULL)
return NULL;
if (! _bfd_coff_link_hash_table_init (ret, abfd,
_bfd_coff_link_hash_newfunc))
{
bfd_release (abfd, ret);
free (ret);
return (struct bfd_link_hash_table *) NULL;
}
return &ret->root;
@ -342,12 +342,10 @@ coff_link_add_symbols (abfd, info)
/* We keep a list of the linker hash table entries that correspond
to particular symbols. */
amt = symcount * sizeof (struct coff_link_hash_entry *);
sym_hash = (struct coff_link_hash_entry **) bfd_alloc (abfd, amt);
sym_hash = (struct coff_link_hash_entry **) bfd_zalloc (abfd, amt);
if (sym_hash == NULL && symcount != 0)
goto error_return;
obj_coff_sym_hashes (abfd) = sym_hash;
memset (sym_hash, 0,
(size_t) symcount * sizeof (struct coff_link_hash_entry *));
symesz = bfd_coff_symesz (abfd);
BFD_ASSERT (symesz == bfd_coff_auxesz (abfd));
@ -759,6 +757,10 @@ _bfd_coff_final_link (abfd, info)
o->flags |= SEC_RELOC;
o->rel_filepos = rel_filepos;
rel_filepos += o->reloc_count * relsz;
/* In PE COFF, if there are at least 0xffff relocations an
extra relocation will be written out to encode the count. */
if (obj_pe (abfd) && o->reloc_count >= 0xffff)
rel_filepos += relsz;
}
if (bfd_coff_long_section_names (abfd)

View File

@ -244,13 +244,7 @@ coff_swap_reloc_in (abfd, src, dst)
reloc_dst->r_vaddr = GET_RELOC_VADDR (abfd, reloc_src->r_vaddr);
reloc_dst->r_symndx = H_GET_S32 (abfd, reloc_src->r_symndx);
#ifdef RS6000COFF_C
reloc_dst->r_type = H_GET_8 (abfd, reloc_src->r_type);
reloc_dst->r_size = H_GET_8 (abfd, reloc_src->r_size);
#else
reloc_dst->r_type = H_GET_16 (abfd, reloc_src->r_type);
#endif
#ifdef SWAP_IN_RELOC_OFFSET
reloc_dst->r_offset = SWAP_IN_RELOC_OFFSET (abfd, reloc_src->r_offset);
@ -267,13 +261,7 @@ coff_swap_reloc_out (abfd, src, dst)
struct external_reloc *reloc_dst = (struct external_reloc *) dst;
PUT_RELOC_VADDR (abfd, reloc_src->r_vaddr, reloc_dst->r_vaddr);
H_PUT_32 (abfd, reloc_src->r_symndx, reloc_dst->r_symndx);
#ifdef RS6000COFF_C
H_PUT_8 (abfd, reloc_src->r_type, reloc_dst->r_type);
H_PUT_8 (abfd, reloc_src->r_size, reloc_dst->r_size);
#else
H_PUT_16 (abfd, reloc_src->r_type, reloc_dst->r_type);
#endif
#ifdef SWAP_OUT_RELOC_OFFSET
SWAP_OUT_RELOC_OFFSET (abfd, reloc_src->r_offset, reloc_dst->r_offset);

View File

@ -35,6 +35,7 @@ alpha*) targ_archs=bfd_alpha_arch ;;
arm*) targ_archs=bfd_arm_arch ;;
c30*) targ_archs=bfd_tic30_arch ;;
c54x*) targ_archs=bfd_tic54x_arch ;;
dlx*) targ_archs=bfd_dlx_arch ;;
hppa*) targ_archs=bfd_hppa_arch ;;
i[3456]86) targ_archs=bfd_i386_arch ;;
i370) targ_archs=bfd_i370_arch ;;
@ -57,7 +58,6 @@ v850*) targ_archs=bfd_v850_arch ;;
x86_64) targ_archs=bfd_i386_arch ;;
xscale*) targ_archs=bfd_arm_arch ;;
z8k*) targ_archs=bfd_z8k_arch ;;
sh*) targ_archs=bfd_sh_arch ;;
*) targ_archs=bfd_${targ_cpu}_arch ;;
esac
@ -70,7 +70,16 @@ esac
case "${targ}" in
# START OF targmatch.h
#ifdef BFD64
alpha*-*-netbsd* | alpha*-*-freebsd*)
alpha*-*-freebsd*)
targ_defvec=bfd_elf64_alpha_freebsd_vec
targ_selvecs=ecoffalpha_little_vec
# FreeBSD <= 4.0 supports only the old nonstandard way of ABI labelling.
case "${targ}" in
alpha*-*-freebsd3* | alpha*-*-freebsd4 | alpha*-*-freebsd4.0*)
targ_cflags=-DOLD_FREEBSD_ABI_LABEL ;;
esac
;;
alpha*-*-netbsd* | alpha*-*-openbsd*)
targ_defvec=bfd_elf64_alpha_vec
targ_selvecs=ecoffalpha_little_vec
;;
@ -104,7 +113,7 @@ case "${targ}" in
targ_defvec=bfd_elf32_ia64_hpux_big_vec
targ_selvecs="bfd_elf64_ia64_hpux_big_vec"
;;
sparc64-*-freebsd* | sparc64-*-netbsd*)
sparc64-*-freebsd* | sparc64-*-netbsd* | sparc64-*-openbsd*)
targ_defvec=bfd_elf64_sparc_vec
targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec"
;;
@ -115,12 +124,17 @@ case "${targ}" in
targ_selvecs=bfd_elf32_bigarc_vec
;;
armeb-*-netbsdelf*)
targ_defvec=bfd_elf32_bigarm_vec
targ_selvecs="bfd_elf32_littlearm_vec armnetbsd_vec"
;;
arm-*-netbsdelf*)
targ_defvec=bfd_elf32_littlearm_vec
targ_selvecs="bfd_elf32_bigarm_vec armnetbsd_vec"
;;
arm-*-netbsd* | arm-*-openbsd*)
targ_defvec=armnetbsd_vec
targ_selvecs="bfd_elf32_littlearm_vec bfd_elf32_bigarm_vec"
targ_underscore=yes
;;
arm-*-riscix*)
@ -263,6 +277,11 @@ case "${targ}" in
targ_defvec=bfd_elf32_d10v_vec
;;
dlx-*-elf*)
targ_defvec=bfd_elf32_dlx_big_vec
targ_selvecs="bfd_elf32_dlx_big_vec"
;;
d30v-*-*)
targ_defvec=bfd_elf32_d30v_vec
;;
@ -271,6 +290,10 @@ case "${targ}" in
targ_defvec=bfd_elf32_fr30_vec
;;
frv-*-elf)
targ_defvec=bfd_elf32_frv_vec
;;
h8300*-*-elf)
targ_defvec=bfd_elf32_h8300_vec
@ -303,7 +326,7 @@ case "${targ}" in
targ_defvec=bfd_elf32_hppa_linux_vec
targ_selvecs=bfd_elf32_hppa_vec
;;
hppa*-*-*elf* | hppa*-*-lites* | hppa*-*-netbsd* | hppa*-*-sysv4* | hppa*-*-rtems*)
hppa*-*-*elf* | hppa*-*-lites* | hppa*-*-netbsd* | hppa*-*-sysv4* | hppa*-*-rtems* | hppa*-*-openbsd*)
targ_defvec=bfd_elf32_hppa_vec
targ_selvecs=bfd_elf32_hppa_linux_vec
;;
@ -336,10 +359,14 @@ case "${targ}" in
targ_defvec=bfd_elf32_i386_vec
targ_selvecs=i386coff_vec
;;
i[3456]86-*-nto-qnx*)
targ_defvec=bfd_elf32_i386qnx_vec
targ_selvecs=i386coff_vec
;;
i[3456]86-*-chorus*)
targ_defvec=bfd_elf32_i386_vec
;;
i[3456]86-*-msdosdjgpp* | i[3456]*-*-go32* | i[3456]86-go32-rtems* )
*-*-msdosdjgpp* | *-*-go32* | *-go32-rtems* )
targ_defvec=go32coff_vec
targ_selvecs="go32stubbedcoff_vec i386aout_vec"
;;
@ -370,13 +397,22 @@ case "${targ}" in
targ_underscore=yes
;;
i[3456]86-*-freebsd*)
targ_defvec=bfd_elf32_i386_vec
targ_defvec=bfd_elf32_i386_freebsd_vec
targ_selvecs=i386coff_vec
# FreeBSD <= 4.0 supports only the old nonstandard way of ABI labelling.
case "${targ}" in
i[3456]86-*-freebsd3* | i[3456]86-*-freebsd4 | i[3456]86-*-freebsd4.0*)
targ_cflags=-DOLD_FREEBSD_ABI_LABEL ;;
esac
;;
i[3456]86-*-netbsdelf*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs=i386netbsd_vec
;;
i[3456]86-*-netbsdpe*)
targ_defvec=i386pe_vec
targ_selvecs="i386pe_vec i386pei_vec bfd_elf32_i386_vec"
;;
i[3456]86-*-netbsdaout* | i[3456]86-*-netbsd* | i[3456]86-*-openbsd*)
targ_defvec=i386netbsd_vec
targ_selvecs="bfd_elf32_i386_vec i386bsd_vec"
@ -785,11 +821,24 @@ case "${targ}" in
targ_selvecs="bfd_elf32_pjl_vec bfd_elf32_pj_vec bfd_elf32_i386_vec"
;;
powerpc-*-aix5*)
targ_defvec=rs6000coff_vec
targ_selvecs="aix5coff64_vec"
want64=true
;;
#ifdef BFD64
powerpc64-*-aix5*)
targ_defvec=aix5coff64_vec
targ_selvecs="rs6000coff_vec"
want64=true
;;
#endif
powerpc-*-aix* | powerpc-*-beos* | rs6000-*-*)
targ_defvec=rs6000coff_vec
targ64_selvecs=rs6000coff64_vec
case "${targ}" in
*-*-aix4.[3456789]* | *-*-aix[56789]*)
*-*-aix4.[3456789]* | *-*-aix[56789]*)
want64=true;;
*)
@ -812,7 +861,7 @@ case "${targ}" in
#endif
powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \
powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-rtems* | \
powerpc-*-chorus* | powerpc-*-vxworks*)
powerpc-*-chorus* | powerpc-*-vxworks* | powerpc-*-windiss*)
targ_defvec=bfd_elf32_powerpc_vec
targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec"
targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec"
@ -847,11 +896,24 @@ case "${targ}" in
#endif
#ifdef BFD64
sh64l*-*-elf*)
targ_defvec=bfd_elf32_sh64l_vec
targ_selvecs="bfd_elf32_sh64_vec bfd_elf64_sh64l_vec bfd_elf64_sh64_vec bfd_elf32_shl_vec bfd_elf32_sh_vec"
targ_underscore=yes
;;
sh64-*-elf*)
targ_defvec=bfd_elf32_sh64_vec
targ_selvecs="bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec bfd_elf32_sh_vec bfd_elf32_shl_vec"
targ_underscore=yes
;;
sh64eb-*-linux*)
targ_defvec=bfd_elf32_shblin_vec
targ_selvecs="bfd_elf32_shblin_vec bfd_elf32_sh64_vec bfd_elf64_sh64_vec bfd_elf32_sh_vec"
;;
sh64-*-linux*)
targ_defvec=bfd_elf32_shlin_vec
targ_selvecs="bfd_elf32_shlin_vec bfd_elf32_sh64l_vec bfd_elf64_sh64l_vec bfd_elf32_shl_vec"
;;
#endif /* BFD64 */
sh-*-linux*)
@ -868,6 +930,33 @@ case "${targ}" in
targ_defvec=bfd_elf32_shlin_vec
;;
#ifdef BFD64
sh5le-*-netbsd*)
targ_defvec=bfd_elf32_sh64lnbsd_vec
targ_selvecs="bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec"
;;
sh5-*-netbsd*)
targ_defvec=bfd_elf32_sh64nbsd_vec
targ_selvecs="bfd_elf32_sh64lnbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec"
;;
sh64le-*-netbsd*)
targ_defvec=bfd_elf64_sh64lnbsd_vec
targ_selvecs="bfd_elf64_sh64nbsd_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec"
;;
sh64-*-netbsd*)
targ_defvec=bfd_elf64_sh64nbsd_vec
targ_selvecs="bfd_elf64_sh64lnbsd_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec"
;;
#endif
shle-*-netbsdelf*)
targ_defvec=bfd_elf32_shlnbsd_vec
targ_selvecs="bfd_elf32_shnbsd_vec shcoff_vec shlcoff_vec"
#ifdef BFD64
targ_selvecs="${targ_selvecs} bfd_elf32_sh64_vec bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec"
#endif
;;
sh*le-*-netbsdelf*)
targ_defvec=bfd_elf32_shlnbsd_vec
targ_selvecs="bfd_elf32_shnbsd_vec shcoff_vec shlcoff_vec"
@ -884,7 +973,15 @@ case "${targ}" in
targ_selvecs="bfd_elf32_shlnbsd_vec shcoff_vec shlcoff_vec"
;;
sh-*-elf* | sh-*-rtemself*)
shl*-*-elf* | sh[1234]l*-*-elf* | sh3el*-*-elf*)
targ_defvec=bfd_elf32_shl_vec
targ_selvecs="bfd_elf32_sh_vec shlcoff_vec shcoff_vec shlcoff_small_vec shcoff_small_vec"
#ifdef BFD64
targ_selvecs="${targ_selvecs} bfd_elf32_sh64_vec bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec"
#endif
targ_underscore=yes
;;
sh-*-elf* | sh[1234]*-elf* | sh-*-rtemself*)
targ_defvec=bfd_elf32_sh_vec
targ_selvecs="bfd_elf32_shl_vec shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec"
#ifdef BFD64
@ -1014,12 +1111,22 @@ case "${targ}" in
v850ea-*-*)
targ_defvec=bfd_elf32_v850_vec
;;
#if HAVE_host_aout_vec
vax-*-bsd* | vax-*-ultrix*)
targ_defvec=host_aout_vec
vax-*-netbsdelf*)
targ_defvec=bfd_elf32_vax_vec
targ_selvecs="vaxnetbsd_vec vax1knetbsd_vec"
;;
vax-*-netbsdaout* | vax-*-netbsd*)
targ_defvec=vaxnetbsd_vec
targ_selvecs="bfd_elf32_vax_vec vax1knetbsd_vec"
targ_underscore=yes
;;
vax-*-bsd* | vax-*-ultrix*)
targ_defvec=vaxbsd_vec
targ_underscore=yes
;;
#endif
vax*-*-*vms*)
targ_defvec=vms_vax_vec

File diff suppressed because it is too large Load Diff

View File

@ -7,9 +7,9 @@ AC_INIT(libbfd.c)
AC_CANONICAL_SYSTEM
AC_ISC_POSIX
AM_INIT_AUTOMAKE(bfd, 2.12.1)
AM_INIT_AUTOMAKE(bfd, 2.13)
# Uncomment the next line to remove the date from the reported bfd version
is_release=y
# is_release=y
changequote(,)dnl
bfd_version=`echo "${VERSION}" | sed -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$/\1\2\3\4\5/'`
@ -98,6 +98,7 @@ if test -z "$target" ; then
fi
AM_MAINTAINER_MODE
AM_INSTALL_LIBBFD
AC_EXEEXT
host64=false
@ -108,7 +109,7 @@ bfd_default_target_size=32
AC_PROG_CC
ALL_LINGUAS="fr tr ja es sv"
ALL_LINGUAS="fr tr ja es sv da"
CY_GNU_GETTEXT
# Permit host specific settings.
@ -162,7 +163,9 @@ if test "${target}" = "${host}"; then
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/alphalinux.h"'
;;
alpha*-*-netbsd*) COREFILE=netbsd-core.lo ;;
alpha*-*-netbsd* | alpha*-*-openbsd*)
COREFILE=netbsd-core.lo
;;
alpha*-*-*) COREFILE=osf-core.lo ;;
arm-*-freebsd*) COREFILE='' ;;
arm-*-netbsd*) COREFILE=netbsd-core.lo ;;
@ -308,8 +311,11 @@ changequote([,])dnl
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/m68kaux.h"'
;;
m88*-*-sysv4*) ;;
m88*-motorola-sysv*) COREFILE=ptrace-core.lo ;;
m88*-*-sysv4*)
;;
m88*-motorola-sysv*)
COREFILE=ptrace-core.lo
;;
m88*-*-mach3*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/m88kmach3.h"'
@ -321,7 +327,13 @@ changequote([,])dnl
ns32k-*-netbsd* | ns32k-*-openbsd*)
COREFILE=netbsd-core.lo
;;
rs6000-*-lynx*) COREFILE=lynx-core.lo ;;
rs6000-*-lynx*)
COREFILE=lynx-core.lo
;;
rs6000-*-aix5.* | powerpc-*-aix5.*)
COREFILE=rs6000-core.lo
COREFLAG="$COREFLAG -DAIX_5_CORE -DAIX_CORE_DUMPX_CORE"
;;
changequote(,)dnl
rs6000-*-aix4.[3-9]* | powerpc-*-aix4.[3-9]*)
changequote([,])dnl
@ -346,13 +358,14 @@ changequote([,])dnl
powerpc-*-*bsd*) COREFILE=netbsd-core.lo ;;
s390*-*-*) COREFILE=trad-core.lo ;;
sh*-*-netbsd*) COREFILE=netbsd-core.lo ;;
sparc-*-netbsd* | sparc-*-openbsd*)
sparc-*-netbsd* | sparc*-*-openbsd*)
COREFILE=netbsd-core.lo
;;
tahoe-*-*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/tahoe.h"'
;;
vax-*-netbsd*) COREFILE=netbsd-core.lo ;;
vax-*-ultrix2*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/vaxult2.h"'
@ -522,19 +535,9 @@ do
# This list is alphabetized to make it easy to compare
# with the two vector lists in targets.c. For the same reason,
# use one entry per line, even though this leads to long lines.
# 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.lo $elf cofflink.lo"
target_size=64 ;;
bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32.lo $elf cofflink.lo"
target_size=64 ;;
bfd_elf64_sh64_vec) tb="$tb elf64-sh64.lo elf64.lo $elf"
target_size=64 ;;
bfd_elf64_sh64l_vec) tb="$tb elf64-sh64.lo elf64.lo $elf"
target_size=64 ;;
a29kcoff_big_vec) tb="$tb coff-a29k.lo cofflink.lo" ;;
a_out_adobe_vec) tb="$tb aout-adobe.lo aout32.lo" ;;
aix5coff64_vec) tb="$tb coff64-rs6000.lo xcofflink.lo aix5ppc-core.lo"; target_size=64 ;;
aout0_big_vec) tb="$tb aout0.lo aout32.lo" ;;
aout_arm_big_vec) tb="$tb aout-arm.lo aout32.lo" ;;
aout_arm_little_vec) tb="$tb aout-arm.lo aout32.lo" ;;
@ -561,16 +564,20 @@ do
bfd_elf32_bigarc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;;
bfd_elf32_bigarm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;;
bfd_elf32_bigarm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;;
bfd_elf32_bigmips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_bigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;;
bfd_elf32_d10v_vec) tb="$tb elf32-d10v.lo elf32.lo $elf" ;;
bfd_elf32_d30v_vec) tb="$tb elf32-d30v.lo elf32.lo $elf" ;;
bfd_elf32_dlx_big_vec) tb="$tb elf32-dlx.lo elf32.lo $elf" ;;
bfd_elf32_fr30_vec) tb="$tb elf32-fr30.lo elf32.lo $elf" ;;
bfd_elf32_frv_vec) tb="$tb elf32-frv.lo elf32.lo $elf" ;;
bfd_elf32_h8300_vec) tb="$tb elf32-h8300.lo elf32.lo $elf" ;;
bfd_elf32_hppa_linux_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_i370_vec) tb="$tb elf32-i370.lo elf32.lo $elf" ;;
bfd_elf32_i386_freebsd_vec) tb="$tb elf32-i386-fbsd.lo elf32.lo $elf" ;;
bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;;
bfd_elf32_i386qnx_vec) tb="$tb elf32-i386qnx.lo elf32.lo $elf" ;;
bfd_elf32_i860_little_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
bfd_elf32_i860_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
bfd_elf32_i960_vec) tb="$tb elf32-i960.lo elf32.lo $elf" ;;
@ -580,7 +587,7 @@ do
bfd_elf32_littlearc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;;
bfd_elf32_littlearm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;;
bfd_elf32_littlearm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;;
bfd_elf32_littlemips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_littlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_m32r_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
bfd_elf32_m68hc11_vec) tb="$tb elf32-m68hc11.lo elf32.lo $elf" ;;
bfd_elf32_m68hc12_vec) tb="$tb elf32-m68hc12.lo elf32.lo $elf" ;;
@ -597,6 +604,13 @@ do
bfd_elf32_powerpc_vec) tb="$tb elf32-ppc.lo elf32.lo $elf" ;;
bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.lo elf32.lo $elf" ;;
bfd_elf32_s390_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;;
# FIXME: We include cofflink.lo not because it's needed for
# bfd_elf32_sh64[l]_vec, but because we include bfd_elf32_sh[l]_vec
# which needs it but does not list it. Should be fixed in right place.
bfd_elf32_sh64_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
bfd_elf32_sh64lnbsd_vec) tb="$tb elf32-sh64-nbsd.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;;
bfd_elf32_sh64nbsd_vec) tb="$tb elf32-sh64-nbsd.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;;
bfd_elf32_sh_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
bfd_elf32_shblin_vec) tb="$tb elf32-sh-lin.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
bfd_elf32_shl_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
@ -604,14 +618,16 @@ do
bfd_elf32_shlnbsd_vec) tb="$tb elf32-sh-nbsd.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
bfd_elf32_shnbsd_vec) tb="$tb elf32-sh-nbsd.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elf32.lo $elf" ;;
bfd_elf32_tradbigmips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_tradbigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_us_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;;
bfd_elf32_v850_vec) tb="$tb elf32-v850.lo elf32.lo $elf" ;;
bfd_elf32_vax_vec) tb="$tb elf32-vax.lo elf32.lo $elf" ;;
bfd_elf32_xstormy16_vec) tb="$tb elf32-xstormy16.lo elf32.lo $elf" ;;
bfd_elf64_alpha_freebsd_vec) tb="$tb elf64-alpha-fbsd.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_bigmips_vec) tb="$tb elf64-mips.lo elf64.lo elf32-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_bigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_hppa_linux_vec) tb="$tb elf64-hppa.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_hppa_vec) tb="$tb elf64-hppa.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_ia64_aix_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
@ -620,22 +636,24 @@ do
bfd_elf64_ia64_hpux_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_ia64_little_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_little_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_littlemips_vec) tb="$tb elf64-mips.lo elf64.lo elf32-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_littlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_mmix_vec) tb="$tb elf64-mmix.lo elf64.lo $elf" target_size=64 ;;
bfd_elf64_powerpc_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_powerpcle_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf" target_size=64 ;;
bfd_elf64_s390_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_sh64_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
bfd_elf64_sh64l_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
bfd_elf64_sh64lnbsd_vec) tb="$tb elf64-sh64-nbsd.lo elf64.lo $elf" target_size=64 ;;
bfd_elf64_sh64nbsd_vec) tb="$tb elf64-sh64-nbsd.lo elf64.lo $elf" target_size=64 ;;
bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_tradbigmips_vec) tb="$tb elf64-mips.lo elf64.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_tradbigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_x86_64_vec) tb="$tb elf64-x86-64.lo elf64.lo $elf"; target_size=64 ;;
bfd_mmo_vec) tb="$tb mmo.lo" target_size=64 ;;
bfd_powerpc_pe_vec) tb="$tb pe-ppc.lo peigen.lo cofflink.lo" ;;
bfd_powerpc_pei_vec) tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;;
bfd_powerpcle_pe_vec) tb="$tb pe-ppc.lo peigen.lo cofflink.lo" ;;
bfd_powerpcle_pei_vec) tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;;
cisco_core_big_vec) tb="$tb cisco-core.lo" ;;
cisco_core_little_vec) tb="$tb cisco-core.lo" ;;
cris_aout_vec) tb="$tb aout-cris.lo" ;;
demo_64_vec) tb="$tb demo64.lo aout64.lo"; target_size=64 ;;
ecoff_big_vec) tb="$tb coff-mips.lo ecoff.lo ecofflink.lo" ;;
@ -677,6 +695,7 @@ do
m68knetbsd_vec) tb="$tb m68knetbsd.lo aout32.lo" ;;
m68ksysvcoff_vec) tb="$tb coff-svm68k.lo cofflink.lo" ;;
m88kbcs_vec) tb="$tb coff-m88k.lo" ;;
m88kmach3_vec) tb="$tb m88kmach3.lo aout32.lo" ;;
mcore_pe_big_vec) tb="$tb pe-mcore.lo peigen.lo cofflink.lo" ;;
mcore_pe_little_vec) tb="$tb pe-mcore.lo peigen.lo cofflink.lo" ;;
mcore_pei_big_vec) tb="$tb pei-mcore.lo peigen.lo cofflink.lo" ;;
@ -695,7 +714,7 @@ do
pmac_xcoff_vec) tb="$tb coff-rs6000.lo xcofflink.lo" ;;
ppcboot_vec) tb="$tb ppcboot.lo" ;;
riscix_vec) tb="$tb aout32.lo riscix.lo" ;;
rs6000coff64_vec) tb="$tb coff64-rs6000.lo xcofflink.lo"; target_size=64 ;;
rs6000coff64_vec) tb="$tb coff64-rs6000.lo xcofflink.lo aix5ppc-core.lo"; target_size=64 ;;
rs6000coff_vec) tb="$tb coff-rs6000.lo xcofflink.lo" ;;
shcoff_small_vec) tb="$tb coff-sh.lo cofflink.lo" ;;
shcoff_vec) tb="$tb coff-sh.lo cofflink.lo" ;;
@ -710,10 +729,7 @@ do
sparclynx_aout_vec) tb="$tb sparclynx.lo lynx-core.lo aout32.lo" ;;
sparclynx_coff_vec) tb="$tb cf-sparclynx.lo lynx-core.lo" ;;
sparcnetbsd_vec) tb="$tb sparcnetbsd.lo aout32.lo" ;;
srec_vec) tb="$tb srec.lo" ;;
sunos_big_vec) tb="$tb sunos.lo aout32.lo" ;;
symbolsrec_vec) tb="$tb srec.lo" ;;
tekhex_vec) tb="$tb tekhex.lo" ;;
tic30_aout_vec) tb="$tb aout-tic30.lo" ;;
tic30_coff_vec) tb="$tb coff-tic30.lo" ;;
tic54x_coff0_beh_vec) tb="$tb coff-tic54x.lo" ;;
@ -723,6 +739,9 @@ do
tic54x_coff2_beh_vec) tb="$tb coff-tic54x.lo" ;;
tic54x_coff2_vec) tb="$tb coff-tic54x.lo" ;;
tic80coff_vec) tb="$tb coff-tic80.lo cofflink.lo" ;;
vaxnetbsd_vec) tb="$tb vaxnetbsd.lo aout32.lo" ;;
vax1knetbsd_vec) tb="$tb vax1knetbsd.lo aout32.lo" ;;
vaxbsd_vec) tb="$tb vaxbsd.lo aout32.lo" ;;
versados_vec) tb="$tb versados.lo" ;;
vms_alpha_vec) tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo"; target_size=64 ;;
vms_vax_vec) tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo" ;;
@ -730,6 +749,13 @@ do
we32kcoff_vec) tb="$tb coff-we32k.lo" ;;
z8kcoff_vec) tb="$tb coff-z8k.lo reloc16.lo" ;;
# These appear out of order in targets.c
srec_vec) tb="$tb srec.lo" ;;
symbolsrec_vec) tb="$tb srec.lo" ;;
tekhex_vec) tb="$tb tekhex.lo" ;;
cisco_core_big_vec) tb="$tb cisco-core.lo" ;;
cisco_core_little_vec) tb="$tb cisco-core.lo" ;;
"") ;;
*) AC_MSG_ERROR(*** unknown target vector $vec) ;;
esac

View File

@ -1,5 +1,5 @@
/* Core file generic interface routines for BFD.
Copyright 1990, 1991, 1992, 1993, 1994, 2000, 2001
Copyright 1990, 1991, 1992, 1993, 1994, 2000, 2001, 2002
Free Software Foundation, Inc.
Written by Cygnus Support.
@ -44,7 +44,7 @@ DESCRIPTION
*/
CONST char *
const char *
bfd_core_file_failing_command (abfd)
bfd *abfd;
{

View File

@ -1,70 +1,72 @@
/* BFD support for the ARM processor
Copyright 1994, 1997, 1999, 2000 Free Software Foundation, Inc.
Copyright 1994, 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
This file is part of BFD, the Binary File Descriptor library.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
static const bfd_arch_info_type *compatible
static const bfd_arch_info_type * compatible
PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
static boolean scan PARAMS ((const struct bfd_arch_info *, const char *));
static boolean scan
PARAMS ((const struct bfd_arch_info *, const char *));
/* This routine is provided two arch_infos and works out which ARM
machine which would be compatible with both and returns a pointer
to its info structure */
to its info structure. */
static const bfd_arch_info_type *
compatible (a,b)
const bfd_arch_info_type * a;
const bfd_arch_info_type * b;
{
/* If a & b are for different architecture we can do nothing */
/* If a & b are for different architecture we can do nothing. */
if (a->arch != b->arch)
return NULL;
/* If a & b are for the same machine then all is well */
/* If a & b are for the same machine then all is well. */
if (a->mach == b->mach)
return a;
/* Otherwise if either a or b is the 'default' machine then
it can be polymorphed into the other */
/* Otherwise if either a or b is the 'default' machine
then it can be polymorphed into the other. */
if (a->the_default)
return b;
if (b->the_default)
return a;
/* So far all newer ARM architecture cores are supersets of previous cores */
/* So far all newer ARM architecture cores are
supersets of previous cores. */
if (a->mach < b->mach)
return b;
else if (a->mach > b->mach)
return a;
/* Never reached! */
/* Never reached! */
return NULL;
}
static struct
{
enum bfd_architecture arch;
char * name;
unsigned int mach;
char * name;
}
processors[] =
{
@ -103,21 +105,21 @@ scan (info, string)
{
int i;
/* First test for an exact match */
/* First test for an exact match. */
if (strcasecmp (string, info->printable_name) == 0)
return true;
/* Next check for a processor name instead of an Architecture name */
/* Next check for a processor name instead of an Architecture name. */
for (i = sizeof (processors) / sizeof (processors[0]); i--;)
{
if (strcasecmp (string, processors[ i ].name) == 0)
if (strcasecmp (string, processors [i].name) == 0)
break;
}
if (i != -1 && info->arch == processors[ i ].arch)
if (i != -1 && info->mach == processors [i].mach)
return true;
/* Finally check for the default architecture */
/* Finally check for the default architecture. */
if (strcasecmp (string, "arm") == 0)
return info->the_default;
@ -129,17 +131,17 @@ scan (info, string)
static const bfd_arch_info_type arch_info_struct[] =
{
N( bfd_mach_arm_2, "armv2", false, & arch_info_struct[1] ),
N( bfd_mach_arm_2a, "armv2a", false, & arch_info_struct[2] ),
N( bfd_mach_arm_3, "armv3", false, & arch_info_struct[3] ),
N( bfd_mach_arm_3M, "armv3m", false, & arch_info_struct[4] ),
N( bfd_mach_arm_4, "armv4", false, & arch_info_struct[5] ),
N( bfd_mach_arm_4T, "armv4t", false, & arch_info_struct[6] ),
N( bfd_mach_arm_5, "armv5", false, & arch_info_struct[7] ),
N( bfd_mach_arm_5T, "armv5t", false, & arch_info_struct[8] ),
N( bfd_mach_arm_5TE, "armv5te", false, & arch_info_struct[9] ),
N( bfd_mach_arm_XScale, "xscale", false, NULL )
N (bfd_mach_arm_2, "armv2", false, & arch_info_struct[1]),
N (bfd_mach_arm_2a, "armv2a", false, & arch_info_struct[2]),
N (bfd_mach_arm_3, "armv3", false, & arch_info_struct[3]),
N (bfd_mach_arm_3M, "armv3m", false, & arch_info_struct[4]),
N (bfd_mach_arm_4, "armv4", false, & arch_info_struct[5]),
N (bfd_mach_arm_4T, "armv4t", false, & arch_info_struct[6]),
N (bfd_mach_arm_5, "armv5", false, & arch_info_struct[7]),
N (bfd_mach_arm_5T, "armv5t", false, & arch_info_struct[8]),
N (bfd_mach_arm_5TE, "armv5te", false, & arch_info_struct[9]),
N (bfd_mach_arm_XScale, "xscale", false, NULL)
};
const bfd_arch_info_type bfd_arm_arch =
N( 0, "arm", true, & arch_info_struct[0] );
N (0, "arm", true, & arch_info_struct[0]);

View File

@ -50,7 +50,8 @@ powerpc_compatible (a,b)
const bfd_arch_info_type bfd_powerpc_archs[] =
{
#if BFD_DEFAULT_TARGET_SIZE == 64 /* default arch must come first. */
#if BFD_DEFAULT_TARGET_SIZE == 64
/* Default arch must come first. */
{
64, /* 64 bits in a word */
64, /* 64 bits in an address */
@ -65,6 +66,8 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
bfd_default_scan,
&bfd_powerpc_archs[1]
},
/* elf32-ppc:ppc_elf_object_p relies on the default 32 bit arch
being immediately after the 64 bit default. */
{
32, /* 32 bits in a word */
32, /* 32 bits in an address */
@ -80,6 +83,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
&bfd_powerpc_archs[2],
},
#else
/* Default arch must come first. */
{
32, /* 32 bits in a word */
32, /* 32 bits in an address */
@ -94,6 +98,8 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
bfd_default_scan,
&bfd_powerpc_archs[1],
},
/* elf64-ppc:ppc64_elf_object_p relies on the default 64 bit arch
being immediately after the 32 bit default. */
{
64, /* 64 bits in a word */
64, /* 64 bits in an address */

View File

@ -1,4 +1,44 @@
2002-03-28 Alan Modra <amodra@bigpond.net.au>
2002-09-23 Daniel Jacobowitz <drow@mvista.com>
Merge from mainline:
2002-08-28 John David Anglin <dave@hiauly1.hia.nrc.ca>
* chew.c (paramstuff, outputdots, perform, bang and usage): Remove
void from function definitions.
2002-08-13 Alan Modra <amodra@bigpond.net.au>
* header.sed: Strip tabs.
2002-06-08 Alan Modra <amodra@bigpond.net.au>
* Makefile.am: Fix quote style in last change.
* Makefile.in: Regenerate.
2002-06-07 Alan Modra <amodra@bigpond.net.au>
* Makefile.am (libbfd.h): Don't use "echo -n".
(libcoff.h, bfd.h): Likewise.
* Makefile.in: Regenerate.
2002-06-06 Lars Brinkhoff <lars@nocrew.org>
* bfdint.texi: Change registry@sco.com to registry@caldera.com.
2002-06-05 Alan Modra <amodra@bigpond.net.au>
* Makefile.am (libbfd.h): Add "Extracted from.." comment.
(libcoff.h, bfd.h): Likewise.
* Makefile.in: Regenerate.
2002-05-25 Alan Modra <amodra@bigpond.net.au>
* chew.c: Use #include "" instead of <> for local header files.
2002-04-20 Alan Modra <amodra@bigpond.net.au>
* Makefile.in: Regenerate.
2002-02-11 Alan Modra <amodra@bigpond.net.au>
* Makefile.in: Regenerate.

View File

@ -209,7 +209,9 @@ libbfd.h: $(LIBBFD_H_DEP)
case $$file in \
*-in.h) cat $$file >> $@ ;; \
*/header.sed) break ;; \
*) ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
*) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \
-e 's,$$,. */,' >> $@ ; \
./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
esac; \
done
@ -226,7 +228,9 @@ libcoff.h: $(LIBCOFF_H_DEP)
case $$file in \
*-in.h) cat $$file >> $@ ;; \
*/header.sed) break ;; \
*) ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
*) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \
-e 's,$$,. */,' >> $@ ; \
./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
esac; \
done
@ -255,7 +259,9 @@ bfd.h: $(BFD_H_DEP)
case $$file in \
*-in.h) cat $$file >> $@ ;; \
*/header.sed) break ;; \
*) ./$(MKDOC) -f $(srcdir)/proto.str < $$file >> $@ ;; \
*) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \
-e 's,$$,. */,' >> $@ ; \
./$(MKDOC) -f $(srcdir)/proto.str < $$file >> $@ ;; \
esac; \
done
echo "#ifdef __cplusplus" >> $@

View File

@ -121,6 +121,8 @@ bfd_machines = @bfd_machines@
bfd_version = @bfd_version@
bfd_version_date = @bfd_version_date@
bfd_version_string = @bfd_version_string@
bfdincludedir = @bfdincludedir@
bfdlibdir = @bfdlibdir@
l = @l@
tdefaults = @tdefaults@
wordsize = @wordsize@
@ -604,7 +606,9 @@ libbfd.h: $(LIBBFD_H_DEP)
case $$file in \
*-in.h) cat $$file >> $@ ;; \
*/header.sed) break ;; \
*) ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
*) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \
-e 's,$$,. */,' >> $@ ; \
./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
esac; \
done
@ -614,7 +618,9 @@ libcoff.h: $(LIBCOFF_H_DEP)
case $$file in \
*-in.h) cat $$file >> $@ ;; \
*/header.sed) break ;; \
*) ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
*) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \
-e 's,$$,. */,' >> $@ ; \
./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
esac; \
done
@ -624,7 +630,9 @@ bfd.h: $(BFD_H_DEP)
case $$file in \
*-in.h) cat $$file >> $@ ;; \
*/header.sed) break ;; \
*) ./$(MKDOC) -f $(srcdir)/proto.str < $$file >> $@ ;; \
*) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \
-e 's,$$,. */,' >> $@ ; \
./$(MKDOC) -f $(srcdir)/proto.str < $$file >> $@ ;; \
esac; \
done
echo "#ifdef __cplusplus" >> $@

View File

@ -159,6 +159,7 @@ enum bfd_architecture
#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 */
bfd_arch_z8k, /* Zilog Z8000 */
@ -212,6 +213,13 @@ enum bfd_architecture
#define bfd_mach_am33 330
bfd_arch_fr30,
#define bfd_mach_fr30 0x46523330
bfd_arch_frv,
#define bfd_mach_frv 0
#define bfd_mach_frvsimple 1
#define bfd_mach_fr300 300
#define bfd_mach_fr400 400
#define bfd_mach_frvtomcat 499 /* fr500 prototype */
#define bfd_mach_fr500 500
bfd_arch_mcore,
bfd_arch_ia64, /* HP/Intel ia64 */
#define bfd_mach_ia64_elf64 0

View File

@ -1545,9 +1545,9 @@ Define @samp{ELF_ARCH} to the BFD architecture (an element of the
@item
Define @samp{ELF_MACHINE_CODE} to the magic number which should appear
in the @samp{e_machine} field of the ELF header. As of this writing,
these magic numbers are assigned by SCO; if you want to get a magic
these magic numbers are assigned by Caldera; if you want to get a magic
number for a particular processor, try sending a note to
@email{registry@@sco.com}. In the BFD sources, the magic numbers are
@email{registry@@caldera.com}. In the BFD sources, the magic numbers are
found in @file{include/elf/common.h}; they have names beginning with
@samp{EM_}.
@item

View File

@ -502,7 +502,8 @@ A base of 0 causes the function to interpret the string
in hex if a leading "0x" or "0X" is found, otherwise
in octal if a leading zero is found, otherwise in decimal.
Overflow is not detected.
If the value would overflow, the maximum @code{bfd_vma} value is
returned.
@findex bfd_copy_private_bfd_data
@subsubsection @code{bfd_copy_private_bfd_data}
@ -613,12 +614,21 @@ Stuff which should be documented:
#define bfd_merge_sections(abfd, link_info) \
BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
#define bfd_discard_group(abfd, sec) \
BFD_SEND (abfd, _bfd_discard_group, (abfd, sec))
#define bfd_link_hash_table_create(abfd) \
BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
#define bfd_link_hash_table_free(abfd, hash) \
BFD_SEND (abfd, _bfd_link_hash_table_free, (hash))
#define bfd_link_add_symbols(abfd, info) \
BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
#define bfd_link_just_syms(sec, info) \
BFD_SEND (abfd, _bfd_link_just_syms, (sec, info))
#define bfd_final_link(abfd, info) \
BFD_SEND (abfd, _bfd_final_link, (abfd, info))

View File

@ -82,7 +82,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foo. */
#include <ansidecl.h>
#include "ansidecl.h"
#include "sysdep.h"
#include <assert.h>
#include <stdio.h>
@ -485,7 +485,7 @@ print_stack_level ()
*/
static void
paramstuff (void)
paramstuff ()
{
unsigned int openp;
unsigned int fname;
@ -626,7 +626,7 @@ manglecomments ()
/* Mod tos so that only lines with leading dots remain */
static void
outputdots (void)
outputdots ()
{
unsigned int idx = 0;
string_type out;
@ -1261,7 +1261,7 @@ lookup_word (word)
}
static void
perform (void)
perform ()
{
tos = stack;
@ -1412,7 +1412,7 @@ compile (string)
}
static void
bang (void)
bang ()
{
*(long *) ((isp[0])) = isp[-1];
isp -= 2;
@ -1487,7 +1487,7 @@ read_in (str, file)
}
static void
usage (void)
usage ()
{
fprintf (stderr, "usage: -[d|i|g] <file >file\n");
exit (33);

View File

@ -1,4 +1,6 @@
@section ELF backends
@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).

View File

@ -1,3 +1,4 @@
s|[ ][ ]*| |g
s|\(.*\) [^ ]*header.sed.*|\1|
s|[^ ]*/||g
s|^ *|"|

View File

@ -716,6 +716,21 @@ 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.
@ -768,6 +783,17 @@ Relocation against a MIPS literal section.
@deffnx {} BFD_RELOC_MIPS_REL16
@deffnx {} BFD_RELOC_MIPS_RELGOT
@deffnx {} BFD_RELOC_MIPS_JALR
@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
Fujitsu Frv Relocations.
@end deffn
MIPS ELF relocations.
@end deffn
@deffn {} BFD_RELOC_386_GOT32
@ -778,6 +804,15 @@ MIPS ELF relocations.
@deffnx {} BFD_RELOC_386_RELATIVE
@deffnx {} BFD_RELOC_386_GOTOFF
@deffnx {} BFD_RELOC_386_GOTPC
@deffnx {} BFD_RELOC_386_TLS_LE
@deffnx {} BFD_RELOC_386_TLS_GD
@deffnx {} BFD_RELOC_386_TLS_LDM
@deffnx {} BFD_RELOC_386_TLS_LDO_32
@deffnx {} BFD_RELOC_386_TLS_IE_32
@deffnx {} BFD_RELOC_386_TLS_LE_32
@deffnx {} BFD_RELOC_386_TLS_DTPMOD32
@deffnx {} BFD_RELOC_386_TLS_DTPOFF32
@deffnx {} BFD_RELOC_386_TLS_TPOFF32
i386/elf relocations
@end deffn
@deffn {} BFD_RELOC_X86_64_GOT32
@ -1083,6 +1118,15 @@ This is a 32-bit absolute reloc.
@deffn {} BFD_RELOC_D30V_32_PCREL
This is a 32-bit pc-relative reloc.
@end deffn
@deffn {} BFD_RELOC_DLX_HI16_S
DLX relocs
@end deffn
@deffn {} BFD_RELOC_DLX_LO16
DLX relocs
@end deffn
@deffn {} BFD_RELOC_DLX_JMP26
DLX relocs
@end deffn
@deffn {} BFD_RELOC_M32R_24
Mitsubishi M32R relocs.
This is a 24 bit absolute address.
@ -1488,12 +1532,25 @@ this offset in the reloc's section offset.
@deffnx {} BFD_RELOC_IA64_IPLTMSB
@deffnx {} BFD_RELOC_IA64_IPLTLSB
@deffnx {} BFD_RELOC_IA64_COPY
@deffnx {} BFD_RELOC_IA64_TPREL22
@deffnx {} BFD_RELOC_IA64_TPREL64MSB
@deffnx {} BFD_RELOC_IA64_TPREL64LSB
@deffnx {} BFD_RELOC_IA64_LTOFF_TP22
@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
@ -1593,6 +1650,11 @@ H8 elf Relocations.
@deffnx {} BFD_RELOC_XSTORMY16_FPTR16
Sony Xstormy16 Relocations.
@end deffn
@deffn {} BFD_RELOC_VAX_GLOB_DAT
@deffnx {} BFD_RELOC_VAX_JMP_SLOT
@deffnx {} BFD_RELOC_VAX_RELATIVE
Relocations used by VAX ELF.
@end deffn
@example

View File

@ -188,12 +188,6 @@ typedef struct sec
standard data. */
#define SEC_CONSTRUCTOR 0x100
/* The section is a constructor, and should be placed at the
end of the text, data, or bss section(?). */
#define SEC_CONSTRUCTOR_TEXT 0x1100
#define SEC_CONSTRUCTOR_DATA 0x2100
#define SEC_CONSTRUCTOR_BSS 0x3100
/* 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} */
@ -214,6 +208,9 @@ typedef struct sec
sections. */
#define SEC_COFF_SHARED_LIBRARY 0x800
/* The section contains thread local data. */
#define SEC_THREAD_LOCAL 0x1000
/* The section has GOT references. This flag is only for the
linker, and is currently only used by the elf32-hppa back end.
It will be set if global offset table references were detected
@ -771,7 +768,18 @@ void _bfd_strip_section_from_output
@end example
@strong{Description}@*
Remove @var{section} from the output. If the output section
becomes empty, remove it from the output bfd. @var{info} may
be NULL; if it is not, it is used to decide whether the output
section is empty.
becomes empty, remove it from the output bfd.
This function won't actually do anything except twiddle flags
if called too late in the linking process, when it's not safe
to remove sections.
@findex bfd_generic_discard_group
@subsubsection @code{bfd_generic_discard_group}
@strong{Synopsis}
@example
boolean bfd_generic_discard_group (bfd *abfd, asection *group);
@end example
@strong{Description}@*
Remove all members of @var{group} from the output.

View File

@ -243,6 +243,9 @@ typedef struct symbol_cache_entry
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

View File

@ -375,11 +375,14 @@ CONCAT2 (NAME,_sizeof_headers), \
CONCAT2 (NAME,_bfd_get_relocated_section_contents), \
CONCAT2 (NAME,_bfd_relax_section), \
CONCAT2 (NAME,_bfd_link_hash_table_create), \
CONCAT2 (NAME,_bfd_link_hash_table_free), \
CONCAT2 (NAME,_bfd_link_add_symbols), \
CONCAT2 (NAME,_bfd_link_just_syms), \
CONCAT2 (NAME,_bfd_final_link), \
CONCAT2 (NAME,_bfd_link_split_section), \
CONCAT2 (NAME,_bfd_gc_sections), \
CONCAT2 (NAME,_bfd_merge_sections)
CONCAT2 (NAME,_bfd_merge_sections), \
CONCAT2 (NAME,_bfd_discard_group)
int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean));
bfd_byte *(*_bfd_get_relocated_section_contents)
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
@ -392,9 +395,15 @@ CONCAT2 (NAME,_bfd_merge_sections)
different information in this table. */
struct bfd_link_hash_table *(*_bfd_link_hash_table_create) PARAMS ((bfd *));
/* Release the memory associated with the linker hash table. */
void (*_bfd_link_hash_table_free) PARAMS ((struct bfd_link_hash_table *));
/* Add symbols from this object file into the hash table. */
boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
/* Indicate that we are only retrieving symbol values from this section. */
void (*_bfd_link_just_syms) PARAMS ((asection *, struct bfd_link_info *));
/* Do a link based on the link_order structures attached to each
section of the BFD. */
boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *));
@ -408,6 +417,9 @@ CONCAT2 (NAME,_bfd_merge_sections)
/* Attempt to merge SEC_MERGE sections. */
boolean (*_bfd_merge_sections) PARAMS ((bfd *, struct bfd_link_info *));
/* Discard members of a group. */
boolean (*_bfd_discard_group) PARAMS ((bfd *, struct sec *));
/* Routines to handle dynamic symbols and relocs. */
#define BFD_JUMP_TABLE_DYNAMIC(NAME) \
CONCAT2 (NAME,_get_dynamic_symtab_upper_bound), \

View File

@ -13,21 +13,21 @@
based on Fred Fish's (Cygnus Support) implementation of DWARF 1
support in dwarfread.c
This file is part of BFD.
This file is part of BFD.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
@ -856,13 +856,18 @@ concat_filename (table, file)
filename = table->files[file - 1].name;
if (IS_ABSOLUTE_PATH(filename))
return filename;
else
{
char* dirname = (table->files[file - 1].dir
? table->dirs[table->files[file - 1].dir - 1]
: table->comp_dir);
return (char*) concat (dirname, "/", filename, NULL);
/* Not all tools set DW_AT_comp_dir, so dirname may be unknown. The
best we can do is return the filename part. */
if (dirname == NULL)
return filename;
else
return (char*) concat (dirname, "/", filename, NULL);
}
}
@ -990,6 +995,13 @@ decode_line_info (unit, stash)
line_ptr += 8;
offset_size = 8;
}
else if (lh.total_length == 0 && unit->addr_size == 8)
{
/* Handle (non-standard) 64-bit DWARF2 formats. */
lh.total_length = read_4_bytes (abfd, line_ptr);
line_ptr += 4;
offset_size = 8;
}
line_end = line_ptr + lh.total_length;
lh.version = read_2_bytes (abfd, line_ptr);
line_ptr += 2;
@ -1072,13 +1084,19 @@ decode_line_info (unit, stash)
{
/* State machine registers. */
bfd_vma address = 0;
char* filename = concat_filename (table, 1);
char * filename = concat_filename (table, 1);
unsigned int line = 1;
unsigned int column = 0;
int is_stmt = lh.default_is_stmt;
int basic_block = 0;
int end_sequence = 0, need_low_pc = 1;
bfd_vma low_pc = 0;
int end_sequence = 0;
/* eraxxon@alumni.rice.edu: Against the DWARF2 specs, some
compilers generate address sequences that are wildly out of
order using DW_LNE_set_address (e.g. Intel C++ 6.0 compiler
for ia64-Linux). Thus, to determine the low and high
address, we must compare on every DW_LNS_copy, etc. */
bfd_vma low_pc = 0;
bfd_vma high_pc = 0;
/* Decode the table. */
while (! end_sequence)
@ -1087,7 +1105,8 @@ decode_line_info (unit, stash)
line_ptr += 1;
if (op_code >= lh.opcode_base)
{ /* Special operand. */
{
/* Special operand. */
adj_opcode = op_code - lh.opcode_base;
address += (adj_opcode / lh.line_range)
* lh.minimum_instruction_length;
@ -1095,29 +1114,30 @@ decode_line_info (unit, stash)
/* Append row to matrix using current values. */
add_line_info (table, address, filename, line, column, 0);
basic_block = 1;
if (need_low_pc)
{
need_low_pc = 0;
low_pc = address;
}
if (low_pc == 0 || address < low_pc)
low_pc = address;
if (address > high_pc)
high_pc = address;
}
else switch (op_code)
{
case DW_LNS_extended_op:
line_ptr += 1; /* Ignore length. */
/* Ignore length. */
line_ptr += 1;
extended_op = read_1_byte (abfd, line_ptr);
line_ptr += 1;
switch (extended_op)
{
case DW_LNE_end_sequence:
end_sequence = 1;
add_line_info (table, address, filename, line, column,
end_sequence);
if (need_low_pc)
{
need_low_pc = 0;
low_pc = address;
}
arange_add (unit, low_pc, high_pc);
if (low_pc == 0 || address < low_pc)
low_pc = address;
if (address > high_pc)
high_pc = address;
arange_add (unit, low_pc, address);
break;
case DW_LNE_set_address:
@ -1157,11 +1177,10 @@ decode_line_info (unit, stash)
case DW_LNS_copy:
add_line_info (table, address, filename, line, column, 0);
basic_block = 0;
if (need_low_pc)
{
need_low_pc = 0;
low_pc = address;
}
if (low_pc == 0 || address < low_pc)
low_pc = address;
if (address > high_pc)
high_pc = address;
break;
case DW_LNS_advance_pc:
address += lh.minimum_instruction_length
@ -1176,8 +1195,8 @@ decode_line_info (unit, stash)
{
unsigned int file;
/* The file and directory tables are 0 based, the references
are 1 based. */
/* The file and directory tables are 0
based, the references are 1 based. */
file = read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
line_ptr += bytes_read;
filename = concat_filename (table, file);
@ -1202,8 +1221,9 @@ decode_line_info (unit, stash)
line_ptr += 2;
break;
default:
{ /* Unknown standard opcode, ignore it. */
{
int i;
/* Unknown standard opcode, ignore it. */
for (i = 0; i < lh.standard_opcode_lengths[op_code]; i++)
{
(void) read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
@ -1222,10 +1242,7 @@ decode_line_info (unit, stash)
LINENUMBER_PTR, are pointers to the objects to be filled in. */
static boolean
lookup_address_in_line_info_table (table,
addr,
function,
filename_ptr,
lookup_address_in_line_info_table (table, addr, function, filename_ptr,
linenumber_ptr)
struct line_info_table* table;
bfd_vma addr;
@ -1286,9 +1303,7 @@ lookup_address_in_line_info_table (table,
/* If ADDR is within TABLE, set FUNCTIONNAME_PTR, and return true. */
static boolean
lookup_address_in_function_table (table,
addr,
function_ptr,
lookup_address_in_function_table (table, addr, function_ptr,
functionname_ptr)
struct funcinfo* table;
bfd_vma addr;
@ -1654,9 +1669,8 @@ comp_unit_contains_address (unit, addr)
false otherwise. */
static boolean
comp_unit_find_nearest_line (unit, addr,
filename_ptr, functionname_ptr, linenumber_ptr,
stash)
comp_unit_find_nearest_line (unit, addr, filename_ptr, functionname_ptr,
linenumber_ptr, stash)
struct comp_unit* unit;
bfd_vma addr;
const char **filename_ptr;
@ -1696,26 +1710,23 @@ comp_unit_find_nearest_line (unit, addr,
}
function = NULL;
func_p = lookup_address_in_function_table (unit->function_table,
addr,
&function,
functionname_ptr);
line_p = lookup_address_in_line_info_table (unit->line_table,
addr,
function,
filename_ptr,
func_p = lookup_address_in_function_table (unit->function_table, addr,
&function, functionname_ptr);
line_p = lookup_address_in_line_info_table (unit->line_table, addr,
function, filename_ptr,
linenumber_ptr);
return line_p || func_p;
}
/* Locate a section in a BFD containing debugging info. The search starts from the
section after AFTER_SEC, or from the first section in the BFD if AFTER_SEC is
NULL. The search works by examining the names of the sections. There are two
permissiable names. The first is .debug_info. This is the standard DWARF2 name.
The second is a prefix .gnu.linkonce.wi. This is a variation on the .debug_info
section which has a checksum describing the contents appended onto the name. This
allows the linker to identify and discard duplicate debugging sections for
different compilation units. */
/* Locate a section in a BFD containing debugging info. The search starts
from the section after AFTER_SEC, or from the first section in the BFD if
AFTER_SEC is NULL. The search works by examining the names of the
sections. There are two permissiable names. The first is .debug_info.
This is the standard DWARF2 name. The second is a prefix .gnu.linkonce.wi.
This is a variation on the .debug_info section which has a checksum
describing the contents appended onto the name. This allows the linker to
identify and discard duplicate debugging sections for different
compilation units. */
#define DWARF2_DEBUG_INFO ".debug_info"
#define GNU_LINKONCE_INFO ".gnu.linkonce.wi."
@ -1754,8 +1765,7 @@ find_debug_info (abfd, after_sec)
boolean
_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
filename_ptr, functionname_ptr,
linenumber_ptr,
addr_size, pinfo)
linenumber_ptr, addr_size, pinfo)
bfd *abfd;
asection *section;
asymbol **symbols;
@ -1895,6 +1905,13 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
length = read_8_bytes (abfd, stash->info_ptr + 4);
stash->info_ptr += 8;
}
else if (length == 0)
{
/* Handle (non-standard) 64-bit DWARF2 formats. */
offset_size = 8;
length = read_4_bytes (abfd, stash->info_ptr + 4);
stash->info_ptr += 4;
}
}
else
length = read_8_bytes (abfd, stash->info_ptr);

View File

@ -4,21 +4,21 @@
Original version by Per Bothner.
Full support added by Ian Lance Taylor, ian@cygnus.com.
This file is part of BFD, the Binary File Descriptor library.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
@ -46,29 +46,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Prototypes for static functions. */
static int ecoff_get_magic PARAMS ((bfd *abfd));
static long ecoff_sec_to_styp_flags PARAMS ((const char *name,
flagword flags));
static boolean ecoff_slurp_symbolic_header PARAMS ((bfd *abfd));
static boolean ecoff_set_symbol_info PARAMS ((bfd *abfd, SYMR *ecoff_sym,
asymbol *asym, int ext, int weak));
static void ecoff_emit_aggregate PARAMS ((bfd *abfd, FDR *fdr,
char *string,
RNDXR *rndx, long isym,
const char *which));
static char *ecoff_type_to_string PARAMS ((bfd *abfd, FDR *fdr,
unsigned int indx));
static boolean ecoff_slurp_reloc_table PARAMS ((bfd *abfd, asection *section,
asymbol **symbols));
static int ecoff_get_magic PARAMS ((bfd *));
static long ecoff_sec_to_styp_flags PARAMS ((const char *, flagword));
static boolean ecoff_slurp_symbolic_header PARAMS ((bfd *));
static boolean ecoff_set_symbol_info PARAMS ((bfd *, SYMR *, asymbol *, int, int));
static void ecoff_emit_aggregate PARAMS ((bfd *, FDR *, char *, RNDXR *, long, const char *));
static char *ecoff_type_to_string PARAMS ((bfd *, FDR *, unsigned int));
static boolean ecoff_slurp_reloc_table PARAMS ((bfd *, asection *, asymbol **));
static int ecoff_sort_hdrs PARAMS ((const PTR, const PTR));
static boolean ecoff_compute_section_file_positions PARAMS ((bfd *abfd));
static bfd_size_type ecoff_compute_reloc_file_positions PARAMS ((bfd *abfd));
static boolean ecoff_compute_section_file_positions PARAMS ((bfd *));
static bfd_size_type ecoff_compute_reloc_file_positions PARAMS ((bfd *));
static boolean ecoff_get_extr PARAMS ((asymbol *, EXTR *));
static void ecoff_set_index PARAMS ((asymbol *, bfd_size_type));
static unsigned int ecoff_armap_hash PARAMS ((const char *s,
unsigned int *rehash,
unsigned int size,
unsigned int hlog));
static unsigned int ecoff_armap_hash PARAMS ((const char *, unsigned int *, unsigned int, unsigned int));
/* This stuff is somewhat copied from coffcode.h. */
@ -105,6 +95,7 @@ _bfd_ecoff_mkobject (abfd)
bfd *abfd;
{
bfd_size_type amt = sizeof (ecoff_data_type);
abfd->tdata.ecoff_obj_data = (struct ecoff_tdata *) bfd_zalloc (abfd, amt);
if (abfd->tdata.ecoff_obj_data == NULL)
return false;
@ -125,7 +116,7 @@ _bfd_ecoff_mkobject_hook (abfd, filehdr, aouthdr)
struct internal_aouthdr *internal_a = (struct internal_aouthdr *) aouthdr;
ecoff_data_type *ecoff;
if (_bfd_ecoff_mkobject (abfd) == false)
if (! _bfd_ecoff_mkobject (abfd))
return NULL;
ecoff = ecoff_data (abfd);
@ -184,10 +175,8 @@ _bfd_ecoff_new_section_hook (abfd, section)
|| strcmp (section->name, _SBSS) == 0)
section->flags |= SEC_ALLOC;
else if (strcmp (section->name, _LIB) == 0)
{
/* An Irix 4 shared libary. */
section->flags |= SEC_COFF_SHARED_LIBRARY;
}
/* An Irix 4 shared libary. */
section->flags |= SEC_COFF_SHARED_LIBRARY;
/* Probably any other section name is SEC_NEVER_LOAD, but I'm
uncertain about .init on some systems and I don't know how shared
@ -221,14 +210,14 @@ _bfd_ecoff_set_arch_mach_hook (abfd, filehdr)
case MIPS_MAGIC_LITTLE2:
case MIPS_MAGIC_BIG2:
/* MIPS ISA level 2: the r6000 */
/* MIPS ISA level 2: the r6000. */
arch = bfd_arch_mips;
mach = 6000;
break;
case MIPS_MAGIC_LITTLE3:
case MIPS_MAGIC_BIG3:
/* MIPS ISA level 3: the r4000 */
/* MIPS ISA level 3: the r4000. */
arch = bfd_arch_mips;
mach = 4000;
break;
@ -553,7 +542,6 @@ _bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug)
documented section. And the ordering of the sections varies between
statically and dynamically linked executables.
If bfd supports SEEK_END someday, this code could be simplified. */
raw_end = 0;
#define UPDATE_RAW_END(start, count, size) \
@ -565,7 +553,9 @@ _bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug)
UPDATE_RAW_END (cbDnOffset, idnMax, backend->debug_swap.external_dnr_size);
UPDATE_RAW_END (cbPdOffset, ipdMax, backend->debug_swap.external_pdr_size);
UPDATE_RAW_END (cbSymOffset, isymMax, backend->debug_swap.external_sym_size);
UPDATE_RAW_END (cbOptOffset, ioptMax, backend->debug_swap.external_opt_size);
/* eraxxon@alumni.rice.edu: ioptMax refers to the size of the
optimization symtab, not the number of entries */
UPDATE_RAW_END (cbOptOffset, ioptMax, sizeof (char));
UPDATE_RAW_END (cbAuxOffset, iauxMax, sizeof (union aux_ext));
UPDATE_RAW_END (cbSsOffset, issMax, sizeof (char));
UPDATE_RAW_END (cbSsExtOffset, issExtMax, sizeof (char));
@ -604,6 +594,7 @@ _bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug)
debug->off2 = (type) ((char *) raw \
+ (internal_symhdr->off1 \
- raw_base))
FIX (cbLineOffset, line, unsigned char *);
FIX (cbDnOffset, external_dnr, PTR);
FIX (cbPdOffset, external_pdr, PTR);
@ -661,10 +652,9 @@ _bfd_ecoff_make_empty_symbol (abfd)
ecoff_symbol_type *new;
bfd_size_type amt = sizeof (ecoff_symbol_type);
new = (ecoff_symbol_type *) bfd_alloc (abfd, amt);
new = (ecoff_symbol_type *) bfd_zalloc (abfd, amt);
if (new == (ecoff_symbol_type *) NULL)
return (asymbol *) NULL;
memset ((PTR) new, 0, sizeof *new);
new->symbol.section = (asection *) NULL;
new->fdr = (FDR *) NULL;
new->local = false;
@ -727,6 +717,10 @@ ecoff_set_symbol_info (abfd, ecoff_sym, asym, ext, weak)
|| ECOFF_IS_STAB (ecoff_sym))
asym->flags |= BSF_DEBUGGING;
}
if (ecoff_sym->st == stProc || ecoff_sym->st == stStaticProc)
asym->flags |= BSF_FUNCTION;
switch (ecoff_sym->sc)
{
case scNil:
@ -1057,7 +1051,7 @@ _bfd_ecoff_get_symtab (abfd, alocation)
ecoff_symbol_type *symbase;
ecoff_symbol_type **location = (ecoff_symbol_type **) alocation;
if (_bfd_ecoff_slurp_symbol_table (abfd) == false)
if (! _bfd_ecoff_slurp_symbol_table (abfd))
return -1;
if (bfd_get_symcount (abfd) == 0)
return 0;
@ -1187,56 +1181,54 @@ ecoff_type_to_string (abfd, fdr, indx)
qualifiers[5].type = u.ti.tq5;
qualifiers[6].type = tqNil;
/*
* Go get the basic type.
*/
/* Go get the basic type. */
switch (basic_type)
{
case btNil: /* undefined */
case btNil: /* Undefined. */
strcpy (p1, "nil");
break;
case btAdr: /* address - integer same size as pointer */
case btAdr: /* Address - integer same size as pointer. */
strcpy (p1, "address");
break;
case btChar: /* character */
case btChar: /* Character. */
strcpy (p1, "char");
break;
case btUChar: /* unsigned character */
case btUChar: /* Unsigned character. */
strcpy (p1, "unsigned char");
break;
case btShort: /* short */
case btShort: /* Short. */
strcpy (p1, "short");
break;
case btUShort: /* unsigned short */
case btUShort: /* Unsigned short. */
strcpy (p1, "unsigned short");
break;
case btInt: /* int */
case btInt: /* Int. */
strcpy (p1, "int");
break;
case btUInt: /* unsigned int */
case btUInt: /* Unsigned int. */
strcpy (p1, "unsigned int");
break;
case btLong: /* long */
case btLong: /* Long. */
strcpy (p1, "long");
break;
case btULong: /* unsigned long */
case btULong: /* Unsigned long. */
strcpy (p1, "unsigned long");
break;
case btFloat: /* float (real) */
case btFloat: /* Float (real). */
strcpy (p1, "float");
break;
case btDouble: /* Double (real) */
case btDouble: /* Double (real). */
strcpy (p1, "double");
break;
@ -1244,83 +1236,83 @@ ecoff_type_to_string (abfd, fdr, indx)
1st word is [ST_RFDESCAPE, offset] pointer to struct def;
2nd word is file index if 1st word rfd is ST_RFDESCAPE. */
case btStruct: /* Structure (Record) */
case btStruct: /* Structure (Record). */
_bfd_ecoff_swap_rndx_in (bigendian, &aux_ptr[indx].a_rndx, &rndx);
ecoff_emit_aggregate (abfd, fdr, p1, &rndx,
(long) AUX_GET_ISYM (bigendian, &aux_ptr[indx+1]),
"struct");
indx++; /* skip aux words */
indx++; /* Skip aux words. */
break;
/* Unions add 1-2 aux words:
1st word is [ST_RFDESCAPE, offset] pointer to union def;
2nd word is file index if 1st word rfd is ST_RFDESCAPE. */
case btUnion: /* Union */
case btUnion: /* Union. */
_bfd_ecoff_swap_rndx_in (bigendian, &aux_ptr[indx].a_rndx, &rndx);
ecoff_emit_aggregate (abfd, fdr, p1, &rndx,
(long) AUX_GET_ISYM (bigendian, &aux_ptr[indx+1]),
"union");
indx++; /* skip aux words */
indx++; /* Skip aux words. */
break;
/* Enumerations add 1-2 aux words:
1st word is [ST_RFDESCAPE, offset] pointer to enum def;
2nd word is file index if 1st word rfd is ST_RFDESCAPE. */
case btEnum: /* Enumeration */
case btEnum: /* Enumeration. */
_bfd_ecoff_swap_rndx_in (bigendian, &aux_ptr[indx].a_rndx, &rndx);
ecoff_emit_aggregate (abfd, fdr, p1, &rndx,
(long) AUX_GET_ISYM (bigendian, &aux_ptr[indx+1]),
"enum");
indx++; /* skip aux words */
indx++; /* Skip aux words. */
break;
case btTypedef: /* defined via a typedef, isymRef points */
case btTypedef: /* Defined via a typedef, isymRef points. */
strcpy (p1, "typedef");
break;
case btRange: /* subrange of int */
case btRange: /* Subrange of int. */
strcpy (p1, "subrange");
break;
case btSet: /* pascal sets */
case btSet: /* Pascal sets. */
strcpy (p1, "set");
break;
case btComplex: /* fortran complex */
case btComplex: /* Fortran complex. */
strcpy (p1, "complex");
break;
case btDComplex: /* fortran double complex */
case btDComplex: /* Fortran double complex. */
strcpy (p1, "double complex");
break;
case btIndirect: /* forward or unnamed typedef */
case btIndirect: /* Forward or unnamed typedef. */
strcpy (p1, "forward/unamed typedef");
break;
case btFixedDec: /* Fixed Decimal */
case btFixedDec: /* Fixed Decimal. */
strcpy (p1, "fixed decimal");
break;
case btFloatDec: /* Float Decimal */
case btFloatDec: /* Float Decimal. */
strcpy (p1, "float decimal");
break;
case btString: /* Varying Length Character String */
case btString: /* Varying Length Character String. */
strcpy (p1, "string");
break;
case btBit: /* Aligned Bit String */
case btBit: /* Aligned Bit String. */
strcpy (p1, "bit");
break;
case btPicture: /* Picture */
case btPicture: /* Picture. */
strcpy (p1, "picture");
break;
case btVoid: /* Void */
case btVoid: /* Void. */
strcpy (p1, "void");
break;
@ -1331,9 +1323,7 @@ ecoff_type_to_string (abfd, fdr, indx)
p1 += strlen (buffer1);
/*
* If this is a bitfield, get the bitsize.
*/
/* If this is a bitfield, get the bitsize. */
if (u.ti.fBitfield)
{
int bitsize;
@ -1343,20 +1333,16 @@ ecoff_type_to_string (abfd, fdr, indx)
p1 += strlen (buffer1);
}
/*
* Deal with any qualifiers.
*/
/* Deal with any qualifiers. */
if (qualifiers[0].type != tqNil)
{
/*
* Snarf up any array bounds in the correct order. Arrays
* store 5 successive words in the aux. table:
* word 0 RNDXR to type of the bounds (ie, int)
* word 1 Current file descriptor index
* word 2 low bound
* word 3 high bound (or -1 if [])
* word 4 stride size in bits
*/
/* Snarf up any array bounds in the correct order. Arrays
store 5 successive words in the aux. table:
word 0 RNDXR to type of the bounds (ie, int)
word 1 Current file descriptor index
word 2 low bound
word 3 high bound (or -1 if [])
word 4 stride size in bits. */
for (i = 0; i < 7; i++)
{
if (qualifiers[i].type == tqArray)
@ -1371,9 +1357,7 @@ ecoff_type_to_string (abfd, fdr, indx)
}
}
/*
* Now print out the qualifiers.
*/
/* Now print out the qualifiers. */
for (i = 0; i < 6; i++)
{
switch (qualifiers[i].type)
@ -1409,7 +1393,6 @@ ecoff_type_to_string (abfd, fdr, indx)
/* Print array bounds reversed (ie, in the order the C
programmer writes them). C is such a fun language.... */
while (i < 5 && qualifiers[i+1].type == tqArray)
i++;
@ -1511,7 +1494,7 @@ _bfd_ecoff_print_symbol (abfd, filep, symbol, how)
}
break;
case bfd_print_symbol_all:
/* Print out the symbols in a reasonable way */
/* Print out the symbols in a reasonable way. */
{
char type;
int pos;
@ -1585,7 +1568,7 @@ _bfd_ecoff_print_symbol (abfd, filep, symbol, how)
order is indicated by a bit in the fdr. */
bigendian = fdr->fBigendian;
/* This switch is basically from gcc/mips-tdump.c */
/* This switch is basically from gcc/mips-tdump.c. */
switch (ecoff_ext.asym.st)
{
case stNil:
@ -1678,7 +1661,7 @@ ecoff_slurp_reloc_table (abfd, section, symbols)
|| (section->flags & SEC_CONSTRUCTOR) != 0)
return true;
if (_bfd_ecoff_slurp_symbol_table (abfd) == false)
if (! _bfd_ecoff_slurp_symbol_table (abfd))
return false;
amt = section->reloc_count;
@ -1794,7 +1777,7 @@ _bfd_ecoff_canonicalize_reloc (abfd, section, relptr, symbols)
{
arelent *tblptr;
if (ecoff_slurp_reloc_table (abfd, section, symbols) == false)
if (! ecoff_slurp_reloc_table (abfd, section, symbols))
return -1;
tblptr = section->relocation;
@ -2181,7 +2164,7 @@ ecoff_compute_section_file_positions (abfd)
if ((current->flags & SEC_HAS_CONTENTS) != 0)
file_sofar += current->_raw_size;
/* make sure that this section is of the right size too */
/* Make sure that this section is of the right size too. */
old_sofar = sofar;
sofar = BFD_ALIGN (sofar, 1 << alignment_power);
if ((current->flags & SEC_HAS_CONTENTS) != 0)
@ -2268,7 +2251,7 @@ _bfd_ecoff_set_section_contents (abfd, section, location, offset, count)
/* This must be done first, because bfd_set_section_contents is
going to set output_has_begun to true. */
if (abfd->output_has_begun == false)
if (! abfd->output_has_begun)
{
if (! ecoff_compute_section_file_positions (abfd))
return false;
@ -2363,7 +2346,7 @@ bfd_ecoff_set_regmasks (abfd, gprmask, fprmask, cprmask)
tdata->fprmask = fprmask;
if (cprmask != (unsigned long *) NULL)
{
register int i;
int i;
for (i = 0; i < 3; i++)
tdata->cprmask[i] = cprmask[i];
@ -2630,13 +2613,12 @@ _bfd_ecoff_write_object_contents (abfd)
else if (section.s_flags == 0
|| (section.s_flags & STYP_ECOFF_LIB) != 0
|| section.s_flags == STYP_COMMENT)
/* Do nothing */ ;
/* Do nothing. */ ;
else
abort ();
}
/* Set up the file header. */
internal_f.f_magic = ecoff_get_magic (abfd);
/* We will NOT put a fucking timestamp in the header here. Every
@ -2729,7 +2711,6 @@ _bfd_ecoff_write_object_contents (abfd)
}
/* Write out the file header and the optional header. */
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
goto error_return;
@ -2751,11 +2732,9 @@ _bfd_ecoff_write_object_contents (abfd)
symhdr->issExtMax = 0;
debug->external_ext = debug->external_ext_end = NULL;
debug->ssext = debug->ssext_end = NULL;
if (bfd_ecoff_debug_externals (abfd, debug, &backend->debug_swap,
(((abfd->flags & EXEC_P) == 0)
? true : false),
ecoff_get_extr, ecoff_set_index)
== false)
if (! bfd_ecoff_debug_externals (abfd, debug, &backend->debug_swap,
(abfd->flags & EXEC_P) == 0,
ecoff_get_extr, ecoff_set_index))
goto error_return;
/* Write out the relocs. */
@ -2859,9 +2838,8 @@ _bfd_ecoff_write_object_contents (abfd)
if (bfd_get_symcount (abfd) > 0)
{
/* Write out the debugging information. */
if (bfd_ecoff_write_debug (abfd, debug, &backend->debug_swap,
ecoff_data (abfd)->sym_filepos)
== false)
if (! bfd_ecoff_write_debug (abfd, debug, &backend->debug_swap,
ecoff_data (abfd)->sym_filepos))
goto error_return;
}
}
@ -3060,7 +3038,6 @@ _bfd_ecoff_slurp_armap (abfd)
/* This code used to overlay the symdefs over the raw archive data,
but that doesn't work on a 64 bit host. */
stringbase = raw_armap + count * 8 + 8;
#ifdef CHECK_ARMAP_HASH
@ -3314,8 +3291,6 @@ _bfd_ecoff_archive_p (abfd)
char armag[SARMAG + 1];
bfd_size_type amt;
tdata_hold = abfd->tdata.aout_ar_data;
if (bfd_bread ((PTR) armag, (bfd_size_type) SARMAG, abfd) != SARMAG)
{
if (bfd_get_error () != bfd_error_system_call)
@ -3329,15 +3304,13 @@ _bfd_ecoff_archive_p (abfd)
return NULL;
}
/* We are setting bfd_ardata(abfd) here, but since bfd_ardata
involves a cast, we can't do it as the left operand of
assignment. */
amt = sizeof (struct artdata);
abfd->tdata.aout_ar_data = (struct artdata *) bfd_zalloc (abfd, amt);
tdata_hold = bfd_ardata (abfd);
amt = sizeof (struct artdata);
bfd_ardata (abfd) = (struct artdata *) bfd_zalloc (abfd, amt);
if (bfd_ardata (abfd) == (struct artdata *) NULL)
{
abfd->tdata.aout_ar_data = tdata_hold;
bfd_ardata (abfd) = tdata_hold;
return (const bfd_target *) NULL;
}
@ -3348,11 +3321,11 @@ _bfd_ecoff_archive_p (abfd)
bfd_ardata (abfd)->extended_names = NULL;
bfd_ardata (abfd)->tdata = NULL;
if (_bfd_ecoff_slurp_armap (abfd) == false
|| _bfd_ecoff_slurp_extended_name_table (abfd) == false)
if (! _bfd_ecoff_slurp_armap (abfd)
|| ! _bfd_ecoff_slurp_extended_name_table (abfd))
{
bfd_release (abfd, bfd_ardata (abfd));
abfd->tdata.aout_ar_data = tdata_hold;
bfd_ardata (abfd) = tdata_hold;
return (const bfd_target *) NULL;
}
@ -3370,22 +3343,23 @@ _bfd_ecoff_archive_p (abfd)
first = bfd_openr_next_archived_file (abfd, (bfd *) NULL);
if (first != NULL)
{
boolean fail;
first->target_defaulted = false;
fail = false;
if (bfd_check_format (first, bfd_object)
&& first->xvec != abfd->xvec)
{
#if 0
/* We ought to close `first' here, but we can't, because
we have no way to remove it from the archive cache.
It's close to impossible to figure out when we can
release bfd_ardata. FIXME. */
(void) bfd_close (first);
bfd_release (abfd, bfd_ardata (abfd));
abfd->tdata.aout_ar_data = tdata_hold;
bfd_set_error (bfd_error_wrong_format);
#endif
bfd_set_error (bfd_error_wrong_object_format);
bfd_ardata (abfd) = tdata_hold;
return NULL;
}
/* We ought to close first here, but we can't, because we
have no way to remove it from the archive cache. FIXME. */
/* And we ought to close `first' here too. */
}
}
@ -3452,7 +3426,7 @@ _bfd_ecoff_bfd_link_hash_table_create (abfd)
struct ecoff_link_hash_table *ret;
bfd_size_type amt = sizeof (struct ecoff_link_hash_table);
ret = (struct ecoff_link_hash_table *) bfd_alloc (abfd, amt);
ret = (struct ecoff_link_hash_table *) bfd_malloc (amt);
if (ret == NULL)
return NULL;
if (! _bfd_link_hash_table_init (&ret->root, abfd,

View File

@ -1,5 +1,5 @@
/* Routines to link ECOFF debugging information.
Copyright 1993, 1994, 1995, 1996, 1997, 2000, 2001
Copyright 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002
Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>.
@ -1314,12 +1314,12 @@ bfd_ecoff_debug_externals (abfd, debug, swap, relocateable, get_extr,
sym_ptr = *sym_ptr_ptr;
/* Get the external symbol information. */
if ((*get_extr) (sym_ptr, &esym) == false)
if (! (*get_extr) (sym_ptr, &esym))
continue;
/* If we're producing an executable, move common symbols into
bss. */
if (relocateable == false)
if (! relocateable)
{
if (esym.asym.sc == scCommon)
esym.asym.sc = scBss;
@ -1376,20 +1376,18 @@ bfd_ecoff_debug_one_external (abfd, debug, swap, name, esym)
if ((size_t) (debug->ssext_end - debug->ssext)
< symhdr->issExtMax + namelen + 1)
{
if (ecoff_add_bytes ((char **) &debug->ssext,
(char **) &debug->ssext_end,
symhdr->issExtMax + namelen + 1)
== false)
if (! ecoff_add_bytes ((char **) &debug->ssext,
(char **) &debug->ssext_end,
symhdr->issExtMax + namelen + 1))
return false;
}
if ((size_t) ((char *) debug->external_ext_end
- (char *) debug->external_ext)
< (symhdr->iextMax + 1) * external_ext_size)
{
if (ecoff_add_bytes ((char **) &debug->external_ext,
(char **) &debug->external_ext_end,
(symhdr->iextMax + 1) * (size_t) external_ext_size)
== false)
if (! ecoff_add_bytes ((char **) &debug->external_ext,
(char **) &debug->external_ext_end,
(symhdr->iextMax + 1) * (size_t) external_ext_size))
return false;
}
@ -1650,11 +1648,10 @@ ecoff_write_shuffle (abfd, swap, shuffle, space)
bfd_byte *s;
i = swap->debug_align - (total & (swap->debug_align - 1));
s = (bfd_byte *) bfd_malloc ((bfd_size_type) i);
s = (bfd_byte *) bfd_zmalloc ((bfd_size_type) i);
if (s == NULL && i != 0)
return false;
memset ((PTR) s, 0, i);
if (bfd_bwrite ((PTR) s, (bfd_size_type) i, abfd) != i)
{
free (s);
@ -1736,10 +1733,10 @@ bfd_ecoff_write_accumulated_debug (handle, abfd, debug, swap, info, where)
bfd_byte *s;
i = swap->debug_align - (total & (swap->debug_align - 1));
s = (bfd_byte *) bfd_malloc ((bfd_size_type) i);
s = (bfd_byte *) bfd_zmalloc ((bfd_size_type) i);
if (s == NULL && i != 0)
goto error_return;
memset ((PTR) s, 0, i);
if (bfd_bwrite ((PTR) s, (bfd_size_type) i, abfd) != i)
{
free (s);
@ -1761,10 +1758,10 @@ bfd_ecoff_write_accumulated_debug (handle, abfd, debug, swap, info, where)
i = (swap->debug_align
- (debug->symbolic_header.issExtMax & (swap->debug_align - 1)));
s = (bfd_byte *) bfd_malloc ((bfd_size_type) i);
s = (bfd_byte *) bfd_zmalloc ((bfd_size_type) i);
if (s == NULL && i != 0)
goto error_return;
memset ((PTR) s, 0, i);
if (bfd_bwrite ((PTR) s, (bfd_size_type) i, abfd) != i)
{
free (s);

View File

@ -223,6 +223,12 @@ struct elf_link_local_dynamic_entry
Elf_Internal_Sym isym;
};
struct elf_link_loaded_list
{
struct elf_link_loaded_list *next;
bfd *abfd;
};
enum elf_link_info_type
{
ELF_INFO_TYPE_NONE,
@ -230,9 +236,18 @@ enum elf_link_info_type
ELF_INFO_TYPE_MERGE,
ELF_INFO_TYPE_EH_FRAME,
ELF_INFO_TYPE_EH_FRAME_HDR,
ELF_INFO_TYPE_JUST_SYMS,
ELF_INFO_TYPE_LAST
};
/* Cached start, size and alignment of PT_TLS segment. */
struct elf_link_tls_segment
{
bfd_vma start;
bfd_size_type size;
unsigned int align;
};
/* ELF linker hash table. */
struct elf_link_hash_table
@ -285,6 +300,12 @@ struct elf_link_hash_table
/* A linked list of DT_RPATH/DT_RUNPATH names found in dynamic
objects included in the link. */
struct bfd_link_needed_list *runpath;
/* Cached start, size and alignment of PT_TLS segment. */
struct elf_link_tls_segment *tls_segment;
/* A linked list of BFD's loaded in the link. */
struct elf_link_loaded_list *loaded;
};
/* Look up an entry in an ELF linker hash table. */
@ -341,6 +362,8 @@ struct elf_size_info {
PARAMS ((bfd *));
void (*write_relocs)
PARAMS ((bfd *, asection *, PTR));
void (*swap_symbol_in)
PARAMS ((bfd *, const PTR, const PTR, Elf_Internal_Sym *));
void (*swap_symbol_out)
PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR));
boolean (*slurp_reloc_table)
@ -394,8 +417,7 @@ enum elf_reloc_type_class {
struct elf_reloc_cookie
{
Elf_Internal_Rela *rels, *rel, *relend;
PTR locsyms;
PTR locsym_shndx;
Elf_Internal_Sym *locsyms;
bfd *abfd;
size_t locsymcount;
size_t extsymoff;
@ -403,6 +425,14 @@ struct elf_reloc_cookie
boolean bad_symtab;
};
/* The level of IRIX compatibility we're striving for. */
typedef enum {
ict_none,
ict_irix5,
ict_irix6
} irix_compat_t;
struct elf_backend_data
{
/* The architecture for this backend. */
@ -470,7 +500,7 @@ struct elf_backend_data
/* A function to handle unusual section types when creating BFD
sections from ELF sections. */
boolean (*elf_backend_section_from_shdr)
PARAMS ((bfd *, Elf32_Internal_Shdr *, char *));
PARAMS ((bfd *, Elf32_Internal_Shdr *, const char *));
/* A function to convert machine dependent section header flags to
BFD internal section header flags. */
@ -649,10 +679,9 @@ struct elf_backend_data
PARAMS ((bfd *));
/* This function is called during section gc to discover the section a
particular relocation refers to. It need not be defined for hosts
that have no queer relocation types. */
particular relocation refers to. */
asection * (*gc_mark_hook)
PARAMS ((bfd *abfd, struct bfd_link_info *, Elf_Internal_Rela *,
PARAMS ((asection *sec, struct bfd_link_info *, Elf_Internal_Rela *,
struct elf_link_hash_entry *h, Elf_Internal_Sym *));
/* This function, if defined, is called during the sweep phase of gc
@ -682,13 +711,14 @@ struct elf_backend_data
PARAMS ((bfd *, struct bfd_link_info *, PTR,
boolean (*) (PTR, const char *, Elf_Internal_Sym *, asection *)));
/* Copy any information related to dynamic linking from a pre-existing
/* Copy any information related to dynamic linking from a pre-existing
symbol to a newly created symbol. Also called to copy flags and
other back-end info to a weakdef, in which case the symbol is not
newly created and plt/got refcounts and dynamic indices should not
be copied. */
void (*elf_backend_copy_indirect_symbol)
PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
struct elf_link_hash_entry *));
/* Modify any information related to dynamic linking such that the
symbol is not exported. */
@ -697,7 +727,7 @@ struct elf_backend_data
/* Emit relocations. Overrides default routine for emitting relocs,
except during a relocatable link, or if all relocs are being emitted. */
void (*elf_backend_emit_relocs)
boolean (*elf_backend_emit_relocs)
PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *));
/* Count relocations. Not called for relocatable links
@ -740,6 +770,30 @@ struct elf_backend_data
boolean (*elf_backend_write_section)
PARAMS ((bfd *, asection *, bfd_byte *));
/* This function, if defined, sets up the file positions for non PT_LOAD
segments, especially for segments containing non-allocated sections. */
void (*set_nonloadable_filepos)
PARAMS ((bfd *, Elf_Internal_Phdr *));
/* This function, if defined, returns true if the section is contained
within the segment. File positions are compared. */
boolean (*is_contained_by_filepos)
PARAMS ((asection *, Elf_Internal_Phdr *));
/* This function, if defined, returns true if copy_private_bfd_data
should be called. It provides a way of overriding default
test conditions in _bfd_elf_copy_private_section_data. */
boolean (*copy_private_bfd_data_p)
PARAMS ((bfd *, asection *, bfd *, asection *));
/* The level of IRIX compatibility we're striving for.
MIPS ELF specific function. */
irix_compat_t (*elf_backend_mips_irix_compat)
PARAMS ((bfd *));
reloc_howto_type *(*elf_backend_mips_rtype_to_howto)
PARAMS ((unsigned int, boolean));
/* The swapping table to use when dealing with ECOFF information.
Used for the MIPS ELF .mdebug section. */
const struct ecoff_debug_swap *elf_backend_ecoff_debug_swap;
@ -806,6 +860,10 @@ 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. */
unsigned want_p_paddr_set_to_zero : 1;
};
/* Information stored for each BFD section in an ELF file. This
@ -870,8 +928,13 @@ struct bfd_elf_section_data
/* Type of that information. */
enum elf_link_info_type sec_info_type;
/* Group name, if this section is part of a group. */
const char *group_name;
union {
/* Group name, if this section is a member of a group. */
const char *name;
/* Group signature sym, if this is the SHT_GROUP section. */
struct symbol_cache_entry *id;
} group;
/* A linked list of sections in the group. Circular when used by
the linker. */
@ -882,17 +945,23 @@ struct bfd_elf_section_data
/* Nonzero if this section uses RELA relocations, rather than REL. */
unsigned int use_rela_p:1;
/* Nonzero when a group is COMDAT. */
unsigned int linkonce_p:1;
};
#define elf_section_data(sec) ((struct bfd_elf_section_data*)sec->used_by_bfd)
#define elf_group_name(sec) (elf_section_data(sec)->group_name)
#define elf_group_name(sec) (elf_section_data(sec)->group.name)
#define elf_group_id(sec) (elf_section_data(sec)->group.id)
#define elf_next_in_group(sec) (elf_section_data(sec)->next_in_group)
#define elf_linkonce_p(sec) (elf_section_data(sec)->linkonce_p)
/* Return true if section has been discarded. */
#define elf_discarded_section(sec) \
(!bfd_is_abs_section(sec) \
&& bfd_is_abs_section((sec)->output_section) \
&& elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_MERGE)
&& elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_MERGE \
&& elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_JUST_SYMS)
#define get_elf_backend_data(abfd) \
((struct elf_backend_data *) (abfd)->xvec->backend_data)
@ -1151,6 +1220,9 @@ extern char *bfd_elf_string_from_elf_section
PARAMS ((bfd *, unsigned, unsigned));
extern char *bfd_elf_get_str_section
PARAMS ((bfd *, unsigned));
extern Elf_Internal_Sym *bfd_elf_get_elf_syms
PARAMS ((bfd *, Elf_Internal_Shdr *, size_t, size_t,
Elf_Internal_Sym *, PTR, Elf_External_Sym_Shndx *));
extern boolean _bfd_elf_copy_private_bfd_data
PARAMS ((bfd *, bfd *));
@ -1200,7 +1272,8 @@ extern struct bfd_hash_entry *_bfd_elf_link_hash_newfunc
extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create
PARAMS ((bfd *));
extern void _bfd_elf_link_hash_copy_indirect
PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
struct elf_link_hash_entry *));
extern void _bfd_elf_link_hash_hide_symbol
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, boolean));
extern boolean _bfd_elf_link_hash_table_init
@ -1210,10 +1283,14 @@ extern boolean _bfd_elf_link_hash_table_init
const char *)));
extern boolean _bfd_elf_slurp_version_tables
PARAMS ((bfd *));
extern boolean _bfd_elf_merge_sections
PARAMS ((bfd *, struct bfd_link_info *));
extern boolean bfd_elf_discard_group
PARAMS ((bfd *, struct sec *));
extern void bfd_elf_set_group_contents
PARAMS ((bfd *, asection *, PTR));
extern void _bfd_elf_link_just_syms
PARAMS ((asection *, struct bfd_link_info *));
extern boolean _bfd_elf_copy_private_symbol_data
PARAMS ((bfd *, asymbol *, bfd *, asymbol *));
extern boolean _bfd_elf_copy_private_section_data
@ -1390,8 +1467,7 @@ extern boolean bfd_elf32_bfd_final_link
PARAMS ((bfd *, struct bfd_link_info *));
extern void bfd_elf32_swap_symbol_in
PARAMS ((bfd *, const Elf32_External_Sym *, const Elf_External_Sym_Shndx *,
Elf_Internal_Sym *));
PARAMS ((bfd *, const PTR, const PTR, Elf_Internal_Sym *));
extern void bfd_elf32_swap_symbol_out
PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR));
extern void bfd_elf32_swap_reloc_in
@ -1443,8 +1519,7 @@ extern boolean bfd_elf64_bfd_final_link
PARAMS ((bfd *, struct bfd_link_info *));
extern void bfd_elf64_swap_symbol_in
PARAMS ((bfd *, const Elf64_External_Sym *, const Elf_External_Sym_Shndx *,
Elf_Internal_Sym *));
PARAMS ((bfd *, const PTR, const PTR, Elf_Internal_Sym *));
extern void bfd_elf64_swap_symbol_out
PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR));
extern void bfd_elf64_swap_reloc_in
@ -1485,10 +1560,12 @@ extern Elf_Internal_Rela *_bfd_elf64_link_read_relocs
#define bfd_elf64_link_record_dynamic_symbol \
_bfd_elf_link_record_dynamic_symbol
extern boolean _bfd_elf32_link_record_local_dynamic_symbol
PARAMS ((struct bfd_link_info *, bfd *, long));
extern boolean _bfd_elf64_link_record_local_dynamic_symbol
extern int elf_link_record_local_dynamic_symbol
PARAMS ((struct bfd_link_info *, bfd *, long));
#define _bfd_elf32_link_record_local_dynamic_symbol \
elf_link_record_local_dynamic_symbol
#define _bfd_elf64_link_record_local_dynamic_symbol \
elf_link_record_local_dynamic_symbol
extern boolean _bfd_elf_close_and_cleanup
PARAMS ((bfd *));
@ -1524,99 +1601,20 @@ extern boolean _bfd_elf64_reloc_symbol_deleted_p
PARAMS ((bfd_vma, PTR));
/* Exported interface for writing elf corefile notes. */
extern char *elfcore_write_note
PARAMS ((bfd *, char *, int *, char *, int, void *, int));
extern char *elfcore_write_prpsinfo
PARAMS ((bfd *, char *, int *, char *, char *));
extern char *elfcore_write_prstatus
PARAMS ((bfd *, char *, int *, long, int, void *));
extern char * elfcore_write_pstatus
PARAMS ((bfd *, char *, int *, long, int, void *));
extern char *elfcore_write_prfpreg
PARAMS ((bfd *, char *, int *, void *, int));
extern char *elfcore_write_prxfpreg
PARAMS ((bfd *, char *, int *, void *, int));
extern char *elfcore_write_lwpstatus
PARAMS ((bfd*, char*, int*, long, int, void*));
/* MIPS ELF specific routines. */
extern boolean _bfd_mips_elf_object_p
PARAMS ((bfd *));
extern boolean _bfd_mips_elf_section_from_shdr
PARAMS ((bfd *, Elf_Internal_Shdr *, char *));
extern boolean _bfd_mips_elf_fake_sections
PARAMS ((bfd *, Elf_Internal_Shdr *, asection *));
extern boolean _bfd_mips_elf_section_from_bfd_section
PARAMS ((bfd *, asection *, int *));
extern boolean _bfd_mips_elf_section_processing
PARAMS ((bfd *, Elf_Internal_Shdr *));
extern void _bfd_mips_elf_symbol_processing
PARAMS ((bfd *, asymbol *));
extern boolean _bfd_mips_elf_read_ecoff_info
PARAMS ((bfd *, asection *, struct ecoff_debug_info *));
extern void _bfd_mips_elf_final_write_processing
PARAMS ((bfd *, boolean));
extern bfd_reloc_status_type _bfd_mips_elf_hi16_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
extern bfd_reloc_status_type _bfd_mips_elf_lo16_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
extern bfd_reloc_status_type _bfd_mips_elf_gprel16_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
extern bfd_reloc_status_type _bfd_mips_elf_got16_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
extern bfd_reloc_status_type _bfd_mips_elf_gprel32_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
extern boolean _bfd_mips_elf_set_private_flags
PARAMS ((bfd *, flagword));
extern boolean _bfd_mips_elf_merge_private_bfd_data
PARAMS ((bfd *, bfd *));
extern boolean _bfd_mips_elf_find_nearest_line
PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
const char **, unsigned int *));
extern boolean _bfd_mips_elf_set_section_contents
PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
extern boolean _bfd_mips_elf_create_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
extern boolean _bfd_mips_elf_add_symbol_hook
PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
const char **, flagword *, asection **, bfd_vma *));
extern boolean _bfd_mips_elf_adjust_dynamic_symbol
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
extern boolean _bfd_mips_elf_finish_dynamic_symbol
PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
Elf_Internal_Sym *));
extern boolean _bfd_mips_elf_finish_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
extern asection * _bfd_mips_elf_gc_mark_hook
PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *,
struct elf_link_hash_entry *, Elf_Internal_Sym *));
extern boolean _bfd_mips_elf_gc_sweep_hook
PARAMS ((bfd *, struct bfd_link_info *, asection *,
const Elf_Internal_Rela *));
extern boolean _bfd_mips_elf_always_size_sections
PARAMS ((bfd *, struct bfd_link_info *));
extern boolean _bfd_mips_elf_size_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
extern boolean _bfd_mips_elf_check_relocs
PARAMS ((bfd *, struct bfd_link_info *, asection *,
const Elf_Internal_Rela *));
extern struct bfd_link_hash_table *_bfd_mips_elf_link_hash_table_create
PARAMS ((bfd *));
extern boolean _bfd_mips_elf_print_private_bfd_data
PARAMS ((bfd *, PTR));
extern boolean _bfd_mips_elf_link_output_symbol_hook
PARAMS ((bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *,
asection *));
extern boolean _bfd_mips_elf_final_link
PARAMS ((bfd *, struct bfd_link_info *));
extern int _bfd_mips_elf_additional_program_headers
PARAMS ((bfd *));
extern boolean _bfd_mips_elf_modify_segment_map
PARAMS ((bfd *));
extern boolean _bfd_mips_elf_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
extern char *elfcore_write_note
PARAMS ((bfd *, char *, int *, const char *, int, const PTR, int));
extern char *elfcore_write_prpsinfo
PARAMS ((bfd *, char *, int *, const char *, const char *));
extern char *elfcore_write_prstatus
PARAMS ((bfd *, char *, int *, long, int, const PTR));
extern char * elfcore_write_pstatus
PARAMS ((bfd *, char *, int *, long, int, const PTR));
extern char *elfcore_write_prfpreg
PARAMS ((bfd *, char *, int *, const PTR, int));
extern char *elfcore_write_prxfpreg
PARAMS ((bfd *, char *, int *, const PTR, int));
extern char *elfcore_write_lwpstatus
PARAMS ((bfd *, char *, int *, long, int, const PTR));
/* SH ELF specific routine. */

View File

@ -627,11 +627,11 @@ _bfd_elf_discard_section_eh_frame (abfd, info, sec, ehdrsec,
goto free_no_table;
if ((*reloc_symbol_deleted_p) (buf - ehbuf, cookie))
{
cookie->rel = rel;
/* This is a FDE against discarded section, it should
be deleted. */
new_size -= hdr.length + 4;
sec_info->entry[sec_info->count].removed = 1;
memset (rel, 0, sizeof (*rel));
}
else
{
@ -787,7 +787,7 @@ _bfd_elf_maybe_strip_eh_frame_hdr (info)
struct eh_frame_hdr_info *hdr_info;
sec = bfd_get_section_by_name (elf_hash_table (info)->dynobj, ".eh_frame_hdr");
if (sec == NULL)
if (sec == NULL || bfd_is_abs_section (sec->output_section))
return true;
hdr_info
@ -805,7 +805,7 @@ _bfd_elf_maybe_strip_eh_frame_hdr (info)
/* Count only sections which have at least a single CIE or FDE.
There cannot be any CIE or FDE <= 8 bytes. */
o = bfd_get_section_by_name (abfd, ".eh_frame");
if (o && o->_raw_size > 8)
if (o && o->_raw_size > 8 && !bfd_is_abs_section (o->output_section))
break;
}

View File

@ -1,28 +1,29 @@
/* ELF strtab with GC and suffix merging support.
Copyright 2001 Free Software Foundation, Inc.
Copyright 2001, 2002 Free Software Foundation, Inc.
Written by Jakub Jelinek <jakub@redhat.com>.
This file is part of BFD, the Binary File Descriptor library.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "hashtab.h"
#include "libiberty.h"
/* An entry in the strtab hash table. */
@ -351,7 +352,7 @@ _bfd_elf_strtab_finalize (tab)
qsort (array, size, sizeof (struct elf_strtab_hash_entry *), cmplengthentry);
last4tab = htab_create (size * 4, NULL, last4_eq, NULL);
last4tab = htab_create_alloc (size * 4, NULL, last4_eq, NULL, calloc, free);
if (last4tab == NULL)
goto alloc_failure;

File diff suppressed because it is too large Load Diff

View File

@ -235,7 +235,7 @@ arc_elf_b22_pcrel (abfd, reloc_entry, symbol, data, input_section,
return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
input_section, output_bfd, error_message);
}
#define TARGET_LITTLE_SYM bfd_elf32_littlearc_vec
#define TARGET_LITTLE_NAME "elf32-littlearc"
#define TARGET_BIG_SYM bfd_elf32_bigarc_vec

View File

@ -58,7 +58,7 @@ static boolean elf32_arm_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
static asection * elf32_arm_gc_mark_hook
PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *,
PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
struct elf_link_hash_entry *, Elf_Internal_Sym *));
static boolean elf32_arm_gc_sweep_hook
PARAMS ((bfd *, struct bfd_link_info *, asection *,
@ -236,14 +236,14 @@ elf32_arm_link_hash_table_create (abfd)
struct elf32_arm_link_hash_table *ret;
bfd_size_type amt = sizeof (struct elf32_arm_link_hash_table);
ret = (struct elf32_arm_link_hash_table *) bfd_alloc (abfd, amt);
ret = (struct elf32_arm_link_hash_table *) bfd_malloc (amt);
if (ret == (struct elf32_arm_link_hash_table *) NULL)
return NULL;
if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
elf32_arm_link_hash_newfunc))
{
bfd_release (abfd, ret);
free (ret);
return NULL;
}
@ -547,31 +547,22 @@ record_thumb_to_arm_glue (link_info, h)
return;
}
/* Select a BFD to be used to hold the sections used by the glue code.
This function is called from the linker scripts in ld/emultempl/
{armelf/pe}.em */
/* Add the glue sections to ABFD. This function is called from the
linker scripts in ld/emultempl/{armelf}.em. */
boolean
bfd_elf32_arm_get_bfd_for_interworking (abfd, info)
bfd_elf32_arm_add_glue_sections_to_bfd (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
{
struct elf32_arm_link_hash_table *globals;
flagword flags;
asection *sec;
/* If we are only performing a partial link do not bother
getting a bfd to hold the glue. */
/* If we are only performing a partial
link do not bother adding the glue. */
if (info->relocateable)
return true;
globals = elf32_arm_hash_table (info);
BFD_ASSERT (globals != NULL);
if (globals->bfd_of_glue_owner != NULL)
return true;
sec = bfd_get_section_by_name (abfd, ARM2THUMB_GLUE_SECTION_NAME);
if (sec == NULL)
@ -609,6 +600,32 @@ bfd_elf32_arm_get_bfd_for_interworking (abfd, info)
sec->gc_mark = 1;
}
return true;
}
/* Select a BFD to be used to hold the sections used by the glue code.
This function is called from the linker scripts in ld/emultempl/
{armelf/pe}.em */
boolean
bfd_elf32_arm_get_bfd_for_interworking (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
{
struct elf32_arm_link_hash_table *globals;
/* If we are only performing a partial link
do not bother getting a bfd to hold the glue. */
if (info->relocateable)
return true;
globals = elf32_arm_hash_table (info);
BFD_ASSERT (globals != NULL);
if (globals->bfd_of_glue_owner != NULL)
return true;
/* Save the bfd for later use. */
globals->bfd_of_glue_owner = abfd;
@ -622,12 +639,9 @@ bfd_elf32_arm_process_before_allocation (abfd, link_info, no_pipeline_knowledge)
int no_pipeline_knowledge;
{
Elf_Internal_Shdr *symtab_hdr;
Elf_Internal_Rela *free_relocs = NULL;
Elf_Internal_Rela *internal_relocs = NULL;
Elf_Internal_Rela *irel, *irelend;
bfd_byte *contents = NULL;
bfd_byte *free_contents = NULL;
Elf32_External_Sym *extsyms = NULL;
Elf32_External_Sym *free_extsyms = NULL;
asection *sec;
struct elf32_arm_link_hash_table *globals;
@ -660,13 +674,15 @@ bfd_elf32_arm_process_before_allocation (abfd, link_info, no_pipeline_knowledge)
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
/* Load the relocs. */
irel = (_bfd_elf32_link_read_relocs (abfd, sec, (PTR) NULL,
(Elf_Internal_Rela *) NULL, false));
internal_relocs
= _bfd_elf32_link_read_relocs (abfd, sec, (PTR) NULL,
(Elf_Internal_Rela *) NULL, false);
BFD_ASSERT (irel != 0);
if (internal_relocs == NULL)
goto error_return;
irelend = irel + sec->reloc_count;
for (; irel < irelend; irel++)
irelend = internal_relocs + sec->reloc_count;
for (irel = internal_relocs; irel < irelend; irel++)
{
long r_type;
unsigned long r_index;
@ -694,37 +710,12 @@ bfd_elf32_arm_process_before_allocation (abfd, link_info, no_pipeline_knowledge)
if (contents == NULL)
goto error_return;
free_contents = contents;
if (!bfd_get_section_contents (abfd, sec, contents,
(file_ptr) 0, sec->_raw_size))
goto error_return;
}
}
/* Read this BFD's symbols if we haven't done so already. */
if (extsyms == NULL)
{
/* Get cached copy if it exists. */
if (symtab_hdr->contents != NULL)
extsyms = (Elf32_External_Sym *) symtab_hdr->contents;
else
{
/* Go get them off disk. */
extsyms = ((Elf32_External_Sym *)
bfd_malloc (symtab_hdr->sh_size));
if (extsyms == NULL)
goto error_return;
free_extsyms = extsyms;
if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0
|| (bfd_bread (extsyms, symtab_hdr->sh_size, abfd)
!= symtab_hdr->sh_size))
goto error_return;
}
}
/* If the relocation is not against a symbol it cannot concern us. */
h = NULL;
@ -764,17 +755,27 @@ bfd_elf32_arm_process_before_allocation (abfd, link_info, no_pipeline_knowledge)
break;
}
}
if (contents != NULL
&& elf_section_data (sec)->this_hdr.contents != contents)
free (contents);
contents = NULL;
if (internal_relocs != NULL
&& elf_section_data (sec)->relocs != internal_relocs)
free (internal_relocs);
internal_relocs = NULL;
}
return true;
error_return:
if (free_relocs != NULL)
free (free_relocs);
if (free_contents != NULL)
free (free_contents);
if (free_extsyms != NULL)
free (free_extsyms);
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;
}
@ -1471,22 +1472,19 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
if (signed_check > reloc_signed_max || signed_check < reloc_signed_min)
overflow = true;
#ifndef OLD_ARM_ABI
if (r_type == R_ARM_THM_XPC22
&& ((lower_insn & 0x1800) == 0x0800))
/* For a BLX instruction, make sure that the relocation is rounded up
to a word boundary. This follows the semantics of the instruction
which specifies that bit 1 of the target address will come from bit
1 of the base address. */
relocation = (relocation + 2) & ~ 3;
#endif
/* Put RELOCATION back into the insn. */
upper_insn = (upper_insn & ~(bfd_vma) 0x7ff) | ((relocation >> 12) & 0x7ff);
lower_insn = (lower_insn & ~(bfd_vma) 0x7ff) | ((relocation >> 1) & 0x7ff);
#ifndef OLD_ARM_ABI
if (r_type == R_ARM_THM_XPC22
&& ((lower_insn & 0x1800) == 0x0800))
/* Remove bit zero of the adjusted offset. Bit zero can only be
set if the upper insn is at a half-word boundary, since the
destination address, an ARM instruction, must always be on a
word boundary. The semantics of the BLX (1) instruction, however,
are that bit zero in the offset must always be zero, and the
corresponding bit one in the target address will be set from bit
one of the source address. */
lower_insn &= ~1;
#endif
/* Put the relocated value back in the object file: */
bfd_put_16 (input_bfd, upper_insn, hit_data);
bfd_put_16 (input_bfd, lower_insn, hit_data + 2);
@ -1526,7 +1524,7 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
signed_check = check | ~((bfd_vma) -1 >> howto->rightshift);
relocation |= (bfd_get_16 (input_bfd, hit_data) & (~ howto->dst_mask));
bfd_put_16 (input_bfd, relocation, hit_data);
/* Assumes two's complement. */
@ -1535,7 +1533,7 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
return bfd_reloc_ok;
}
case R_ARM_GNU_VTINHERIT:
case R_ARM_GNU_VTENTRY:
return bfd_reloc_ok;
@ -1560,7 +1558,7 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
if (sgot == NULL)
return bfd_reloc_notsupported;
/* If we are addressing a Thumb function, we need to adjust the
/* If we are addressing a Thumb function, we need to adjust the
address by one, so that attempts to call the function pointer will
correctly interpret it as Thumb code. */
if (sym_flags == STT_ARM_TFUNC)
@ -2209,7 +2207,7 @@ elf32_arm_merge_private_bfd_data (ibfd, obfd)
asection *sec;
/* Check if we have the same endianess. */
if (_bfd_generic_verify_endian_match (ibfd, obfd) == false)
if (! _bfd_generic_verify_endian_match (ibfd, obfd))
return false;
if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour
@ -2360,7 +2358,7 @@ ERROR: %s uses hardware FP, whereas %s uses software FP"),
_bfd_error_handler (_("\
Warning: %s supports interworking, whereas %s does not"),
bfd_archive_filename (ibfd),
bfd_get_filename (obfd));
bfd_get_filename (obfd));
}
else
{
@ -2515,8 +2513,8 @@ elf32_arm_get_symbol_type (elf_sym, type)
}
static asection *
elf32_arm_gc_mark_hook (abfd, info, rel, h, sym)
bfd *abfd;
elf32_arm_gc_mark_hook (sec, info, rel, h, sym)
asection *sec;
struct bfd_link_info *info ATTRIBUTE_UNUSED;
Elf_Internal_Rela *rel;
struct elf_link_hash_entry *h;
@ -2546,9 +2544,7 @@ elf32_arm_gc_mark_hook (abfd, info, rel, h, sym)
}
}
else
{
return bfd_section_from_elf_index (abfd, sym->st_shndx);
}
return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
return NULL;
}
@ -2962,16 +2958,22 @@ elf32_arm_adjust_dynamic_symbol (info, h)
if (h->type == STT_FUNC
|| (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
{
/* If we link a program (not a DSO), we'll get rid of unnecessary
PLT entries; we point to the actual symbols -- even for pic
relocs, because a program built with -fpic should have the same
result as one built without -fpic, specifically considering weak
symbols.
FIXME: m68k and i386 differ here, for unclear reasons. */
if (! info->shared
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
&& (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0)
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0)
{
/* This case can occur if we saw a PLT32 reloc in an input
file, but the symbol was never referred to by a dynamic
object. In such a case, we don't actually need to build
a procedure linkage table, and we can just do a PC32
reloc instead. */
file, but the symbol was not defined by a dynamic object.
In such a case, we don't actually need to build a
procedure linkage table, and we can just do a PC32 reloc
instead. */
BFD_ASSERT ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0);
h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
return true;
}

File diff suppressed because it is too large Load Diff

View File

@ -43,6 +43,7 @@ static boolean ppc_elf_relax_section
PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *));
static bfd_reloc_status_type ppc_elf_addr16_ha_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
static boolean ppc_elf_object_p PARAMS ((bfd *));
static boolean ppc_elf_set_private_flags PARAMS ((bfd *, flagword));
static boolean ppc_elf_merge_private_bfd_data PARAMS ((bfd *, bfd *));
@ -56,7 +57,7 @@ static boolean ppc_elf_create_dynamic_sections
static boolean ppc_elf_section_from_shdr PARAMS ((bfd *,
Elf32_Internal_Shdr *,
char *));
const char *));
static boolean ppc_elf_fake_sections
PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *));
@ -70,7 +71,7 @@ static boolean ppc_elf_check_relocs PARAMS ((bfd *,
asection *,
const Elf_Internal_Rela *));
static asection * ppc_elf_gc_mark_hook PARAMS ((bfd *abfd,
static asection * ppc_elf_gc_mark_hook PARAMS ((asection *sec,
struct bfd_link_info *info,
Elf_Internal_Rela *rel,
struct elf_link_hash_entry *h,
@ -1380,6 +1381,27 @@ ppc_elf_addr16_ha_reloc (abfd, reloc_entry, symbol, data, input_section,
return bfd_reloc_continue;
}
/* Fix bad default arch selected for a 32 bit input bfd when the
default is 64 bit. */
static boolean
ppc_elf_object_p (abfd)
bfd *abfd;
{
if (abfd->arch_info->the_default && abfd->arch_info->bits_per_word == 64)
{
Elf_Internal_Ehdr *i_ehdr = elf_elfheader (abfd);
if (i_ehdr->e_ident[EI_CLASS] == ELFCLASS32)
{
/* Relies on arch after 64 bit default being 32 bit default. */
abfd->arch_info = abfd->arch_info->next;
BFD_ASSERT (abfd->arch_info->bits_per_word == 32);
}
}
return true;
}
/* Function to set whether a module needs the -mrelocatable bit set. */
static boolean
@ -1407,7 +1429,7 @@ ppc_elf_merge_private_bfd_data (ibfd, obfd)
boolean error;
/* Check if we have the same endianess */
if (_bfd_generic_verify_endian_match (ibfd, obfd) == false)
if (! _bfd_generic_verify_endian_match (ibfd, obfd))
return false;
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
@ -1490,7 +1512,7 @@ static boolean
ppc_elf_section_from_shdr (abfd, hdr, name)
bfd *abfd;
Elf32_Internal_Shdr *hdr;
char *name;
const char *name;
{
asection *newsect;
flagword flags;
@ -2459,8 +2481,8 @@ ppc_elf_check_relocs (abfd, info, sec, relocs)
relocation. */
static asection *
ppc_elf_gc_mark_hook (abfd, info, rel, h, sym)
bfd *abfd;
ppc_elf_gc_mark_hook (sec, info, rel, h, sym)
asection *sec;
struct bfd_link_info *info ATTRIBUTE_UNUSED;
Elf_Internal_Rela *rel;
struct elf_link_hash_entry *h;
@ -2490,9 +2512,7 @@ ppc_elf_gc_mark_hook (abfd, info, rel, h, sym)
}
}
else
{
return bfd_section_from_elf_index (abfd, sym->st_shndx);
}
return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
return NULL;
}
@ -2723,11 +2743,11 @@ ppc_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
else
{
BFD_ASSERT ((h->got.offset & 1) == 0);
bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset);
rela.r_info = ELF32_R_INFO (h->dynindx, R_PPC_GLOB_DAT);
rela.r_addend = 0;
}
bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset);
bfd_elf32_swap_reloca_out (output_bfd, &rela,
((Elf32_External_Rela *) srela->contents
+ srela->reloc_count));
@ -3267,13 +3287,19 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
+ sreloc->reloc_count));
++sreloc->reloc_count;
/* This reloc will be computed at runtime, so there's no
need to do anything now, unless this is a RELATIVE
reloc in an unallocated section. */
if (skip != -1
|| (input_section->flags & SEC_ALLOC) != 0
|| ELF32_R_TYPE (outrel.r_info) != R_PPC_RELATIVE)
if (skip == -1)
continue;
/* This reloc will be computed at runtime. We clear the memory
so that it contains predictable value. */
if (! skip
&& ((input_section->flags & SEC_ALLOC) != 0
|| ELF32_R_TYPE (outrel.r_info) != R_PPC_RELATIVE))
{
relocation = howto->pc_relative ? outrel.r_offset : 0;
addend = 0;
break;
}
}
/* Arithmetic adjust relocations that aren't going into a
@ -3370,7 +3396,6 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
off &= ~1;
else
{
bfd_put_32 (output_bfd, relocation, sgot->contents + off);
if (info->shared)
{
@ -3392,8 +3417,10 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
srelgot->contents)
+ srelgot->reloc_count));
++srelgot->reloc_count;
relocation = 0;
}
bfd_put_32 (output_bfd, relocation, sgot->contents + off);
local_got_offsets[r_symndx] |= 1;
}
@ -3797,6 +3824,7 @@ ppc_elf_grok_psinfo (abfd, note)
#define bfd_elf32_bfd_set_private_flags ppc_elf_set_private_flags
#define bfd_elf32_bfd_final_link _bfd_elf32_gc_common_final_link
#define elf_backend_object_p ppc_elf_object_p
#define elf_backend_gc_mark_hook ppc_elf_gc_mark_hook
#define elf_backend_gc_sweep_hook ppc_elf_gc_sweep_hook
#define elf_backend_section_from_shdr ppc_elf_section_from_shdr

View File

@ -1,5 +1,5 @@
/* SPARC-specific support for 32-bit ELF
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@ -55,7 +55,7 @@ static void elf32_sparc_final_write_processing
static enum elf_reloc_type_class elf32_sparc_reloc_type_class
PARAMS ((const Elf_Internal_Rela *));
static asection * elf32_sparc_gc_mark_hook
PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *,
PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
struct elf_link_hash_entry *, Elf_Internal_Sym *));
static boolean elf32_sparc_gc_sweep_hook
PARAMS ((bfd *, struct bfd_link_info *, asection *,
@ -637,14 +637,13 @@ elf32_sparc_check_relocs (abfd, info, sec, relocs)
}
static asection *
elf32_sparc_gc_mark_hook (abfd, info, rel, h, sym)
bfd *abfd;
elf32_sparc_gc_mark_hook (sec, info, rel, h, sym)
asection *sec;
struct bfd_link_info *info ATTRIBUTE_UNUSED;
Elf_Internal_Rela *rel;
struct elf_link_hash_entry *h;
Elf_Internal_Sym *sym;
{
if (h != NULL)
{
switch (ELF32_R_TYPE (rel->r_info))
@ -669,9 +668,7 @@ elf32_sparc_gc_mark_hook (abfd, info, rel, h, sym)
}
}
else
{
return bfd_section_from_elf_index (abfd, sym->st_shndx);
}
return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
return NULL;
}
@ -1564,10 +1561,11 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
break;
}
/* ??? Copied from elf32-i386.c, debugging section check and all. */
/* Dynamic relocs are not propagated for SEC_DEBUGGING sections
because such sections are not SEC_ALLOC and thus ld.so will
not process them. */
if (unresolved_reloc
&& !(info->shared
&& (input_section->flags & SEC_DEBUGGING) != 0
&& !((input_section->flags & SEC_DEBUGGING) != 0
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
(*_bfd_error_handler)
(_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"),

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -17,6 +17,16 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
bfd_vma ppc64_elf_toc PARAMS ((bfd *));
boolean ppc64_elf_size_stubs PARAMS ((bfd *, struct bfd_link_info *, int *));
boolean ppc64_elf_build_stubs PARAMS ((bfd *, struct bfd_link_info *));
boolean ppc64_elf_mark_entry_syms
PARAMS ((struct bfd_link_info *));
bfd_vma ppc64_elf_toc
PARAMS ((bfd *));
int ppc64_elf_setup_section_lists
PARAMS ((bfd *, struct bfd_link_info *));
void ppc64_elf_next_input_section
PARAMS ((struct bfd_link_info *, asection *));
boolean ppc64_elf_size_stubs
PARAMS ((bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma,
asection *(*) (const char *, asection *), void (*) (void)));
boolean ppc64_elf_build_stubs
PARAMS ((struct bfd_link_info *));

View File

@ -72,6 +72,9 @@ static void sparc64_elf_symbol_processing
static boolean sparc64_elf_merge_private_bfd_data
PARAMS ((bfd *, bfd *));
static boolean sparc64_elf_fake_sections
PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *));
static const char *sparc64_elf_print_symbol_all
PARAMS ((bfd *, PTR, asymbol *));
static boolean sparc64_elf_relax_section
@ -659,14 +662,14 @@ sparc64_elf_bfd_link_hash_table_create (abfd)
struct sparc64_elf_link_hash_table *ret;
bfd_size_type amt = sizeof (struct sparc64_elf_link_hash_table);
ret = (struct sparc64_elf_link_hash_table *) bfd_zalloc (abfd, amt);
ret = (struct sparc64_elf_link_hash_table *) bfd_zmalloc (amt);
if (ret == (struct sparc64_elf_link_hash_table *) NULL)
return NULL;
if (! _bfd_elf_link_hash_table_init (&ret->root, abfd,
_bfd_elf_link_hash_newfunc))
{
bfd_release (abfd, ret);
free (ret);
return NULL;
}
@ -711,7 +714,7 @@ init_insn_reloc (abfd,
return bfd_reloc_ok;
}
/* This works because partial_inplace == false. */
/* This works because partial_inplace is false. */
if (output_bfd != NULL)
return bfd_reloc_continue;
@ -1386,7 +1389,7 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
return true;
}
else if (*namep && **namep
&& info->hash->creator->flavour == bfd_target_elf_flavour)
&& info->hash->creator == abfd->xvec)
{
int i;
struct sparc64_elf_app_reg *p;
@ -2565,9 +2568,11 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
break;
}
/* Dynamic relocs are not propagated for SEC_DEBUGGING sections
because such sections are not SEC_ALLOC and thus ld.so will
not process them. */
if (unresolved_reloc
&& !(info->shared
&& (input_section->flags & SEC_DEBUGGING) != 0
&& !((input_section->flags & SEC_DEBUGGING) != 0
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
(*_bfd_error_handler)
(_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"),
@ -2995,6 +3000,27 @@ sparc64_elf_merge_private_bfd_data (ibfd, obfd)
}
return true;
}
/* MARCO: Set the correct entry size for the .stab section. */
static boolean
sparc64_elf_fake_sections (abfd, hdr, sec)
bfd *abfd ATTRIBUTE_UNUSED;
Elf32_Internal_Shdr *hdr ATTRIBUTE_UNUSED;
asection *sec;
{
const char *name;
name = bfd_get_section_name (abfd, sec);
if (strcmp (name, ".stab") == 0)
{
/* Even in the 64bit case the stab entries are only 12 bytes long. */
elf_section_data (sec)->this_hdr.sh_entsize = 12;
}
return true;
}
/* Print a STT_REGISTER symbol to file FILE. */
@ -3067,6 +3093,7 @@ const struct elf_size_info sparc64_elf_size_info =
bfd_elf64_write_out_phdrs,
bfd_elf64_write_shdrs_and_ehdr,
sparc64_elf_write_relocs,
bfd_elf64_swap_symbol_in,
bfd_elf64_swap_symbol_out,
sparc64_elf_slurp_reloc_table,
bfd_elf64_slurp_symbol_table,
@ -3131,6 +3158,8 @@ const struct elf_size_info sparc64_elf_size_info =
sparc64_elf_output_arch_syms
#define bfd_elf64_bfd_merge_private_bfd_data \
sparc64_elf_merge_private_bfd_data
#define elf_backend_fake_sections \
sparc64_elf_fake_sections
#define elf_backend_size_info \
sparc64_elf_size_info

View File

@ -125,6 +125,10 @@ static reloc_howto_type *elf64_x86_64_reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type));
static void elf64_x86_64_info_to_howto
PARAMS ((bfd *, arelent *, Elf64_Internal_Rela *));
static boolean elf64_x86_64_grok_prstatus
PARAMS ((bfd *, Elf_Internal_Note *));
static boolean elf64_x86_64_grok_psinfo
PARAMS ((bfd *, Elf_Internal_Note *));
static struct bfd_link_hash_table *elf64_x86_64_link_hash_table_create
PARAMS ((bfd *));
static boolean elf64_x86_64_elf_object_p PARAMS ((bfd *abfd));
@ -133,12 +137,13 @@ static boolean create_got_section
static boolean elf64_x86_64_create_dynamic_sections
PARAMS((bfd *, struct bfd_link_info *));
static void elf64_x86_64_copy_indirect_symbol
PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
struct elf_link_hash_entry *));
static boolean elf64_x86_64_check_relocs
PARAMS ((bfd *, struct bfd_link_info *, asection *sec,
const Elf_Internal_Rela *));
static asection *elf64_x86_64_gc_mark_hook
PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *,
PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
struct elf_link_hash_entry *, Elf_Internal_Sym *));
static boolean elf64_x86_64_gc_sweep_hook
@ -208,6 +213,73 @@ elf64_x86_64_info_to_howto (abfd, cache_ptr, dst)
BFD_ASSERT (r_type == cache_ptr->howto->type);
}
/* Support for core dump NOTE sections. */
static boolean
elf64_x86_64_grok_prstatus (abfd, note)
bfd *abfd;
Elf_Internal_Note *note;
{
int offset;
size_t raw_size;
switch (note->descsz)
{
default:
return false;
case 336: /* sizeof(istruct elf_prstatus) on Linux/x86_64 */
/* pr_cursig */
elf_tdata (abfd)->core_signal
= bfd_get_16 (abfd, note->descdata + 12);
/* pr_pid */
elf_tdata (abfd)->core_pid
= bfd_get_32 (abfd, note->descdata + 32);
/* pr_reg */
offset = 112;
raw_size = 216;
break;
}
/* Make a ".reg/999" section. */
return _bfd_elfcore_make_pseudosection (abfd, ".reg",
raw_size, note->descpos + offset);
}
static boolean
elf64_x86_64_grok_psinfo (abfd, note)
bfd *abfd;
Elf_Internal_Note *note;
{
switch (note->descsz)
{
default:
return false;
case 136: /* sizeof(struct elf_prpsinfo) on Linux/x86_64 */
elf_tdata (abfd)->core_program
= _bfd_elfcore_strndup (abfd, note->descdata + 40, 16);
elf_tdata (abfd)->core_command
= _bfd_elfcore_strndup (abfd, note->descdata + 56, 80);
}
/* Note that for some reason, a spurious space is tacked
onto the end of the args in some (at least one anyway)
implementations, so strip it off if it exists. */
{
char *command = elf_tdata (abfd)->core_command;
int n = strlen (command);
if (0 < n && command[n - 1] == ' ')
command[n - 1] = '\0';
}
return true;
}
/* Functions for the x86-64 ELF linker. */
/* The name of the dynamic interpreter. This is put in the .interp
@ -340,13 +412,13 @@ elf64_x86_64_link_hash_table_create (abfd)
struct elf64_x86_64_link_hash_table *ret;
bfd_size_type amt = sizeof (struct elf64_x86_64_link_hash_table);
ret = (struct elf64_x86_64_link_hash_table *) bfd_alloc (abfd, amt);
ret = (struct elf64_x86_64_link_hash_table *) bfd_malloc (amt);
if (ret == NULL)
return NULL;
if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc))
{
bfd_release (abfd, ret);
free (ret);
return NULL;
}
@ -426,7 +498,8 @@ elf64_x86_64_create_dynamic_sections (dynobj, info)
/* Copy the extra info we tack onto an elf_link_hash_entry. */
static void
elf64_x86_64_copy_indirect_symbol (dir, ind)
elf64_x86_64_copy_indirect_symbol (bed, dir, ind)
struct elf_backend_data *bed;
struct elf_link_hash_entry *dir, *ind;
{
struct elf64_x86_64_link_hash_entry *edir, *eind;
@ -468,7 +541,7 @@ elf64_x86_64_copy_indirect_symbol (dir, ind)
eind->dyn_relocs = NULL;
}
_bfd_elf_link_hash_copy_indirect (dir, ind);
_bfd_elf_link_hash_copy_indirect (bed, dir, ind);
}
static boolean
@ -589,11 +662,28 @@ elf64_x86_64_check_relocs (abfd, info, sec, relocs)
case R_X86_64_8:
case R_X86_64_16:
case R_X86_64_32:
case R_X86_64_64:
case R_X86_64_32S:
/* Let's help debug shared library creation. These relocs
cannot be used in shared libs. Don't error out for
sections we don't care about, such as debug sections or
non-constant sections. */
if (info->shared
&& (sec->flags & SEC_ALLOC) != 0
&& (sec->flags & SEC_READONLY) != 0)
{
(*_bfd_error_handler)
(_("%s: relocation %s can not be used when making a shared object; recompile with -fPIC"),
bfd_archive_filename (abfd),
x86_64_elf_howto_table[ELF64_R_TYPE (rel->r_info)].name);
bfd_set_error (bfd_error_bad_value);
return false;
}
/* Fall through. */
case R_X86_64_PC8:
case R_X86_64_PC16:
case R_X86_64_PC32:
case R_X86_64_64:
if (h != NULL && !info->shared)
{
/* If this reloc is in a read-only section, we might
@ -768,8 +858,8 @@ elf64_x86_64_check_relocs (abfd, info, sec, relocs)
relocation. */
static asection *
elf64_x86_64_gc_mark_hook (abfd, info, rel, h, sym)
bfd *abfd;
elf64_x86_64_gc_mark_hook (sec, info, rel, h, sym)
asection *sec;
struct bfd_link_info *info ATTRIBUTE_UNUSED;
Elf_Internal_Rela *rel;
struct elf_link_hash_entry *h;
@ -799,9 +889,7 @@ elf64_x86_64_gc_mark_hook (abfd, info, rel, h, sym)
}
}
else
{
return bfd_section_from_elf_index (abfd, sym->st_shndx);
}
return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
return NULL;
}
@ -1016,7 +1104,7 @@ elf64_x86_64_adjust_dynamic_symbol (info, h)
/* We must generate a R_X86_64_COPY reloc to tell the dynamic linker
to copy the initial value out of the dynamic object and into the
runtime process image. */
runtime process image. */
if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
{
htab->srelbss->_raw_size += sizeof (Elf64_External_Rela);
@ -1790,9 +1878,44 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
else
{
/* This symbol is local, or marked to become local. */
relocate = true;
outrel.r_info = ELF64_R_INFO (0, R_X86_64_RELATIVE);
outrel.r_addend = relocation + rel->r_addend;
if (r_type == R_X86_64_64)
{
relocate = true;
outrel.r_info = ELF64_R_INFO (0, R_X86_64_RELATIVE);
outrel.r_addend = relocation + rel->r_addend;
}
else
{
long sindx;
if (h == NULL)
sec = local_sections[r_symndx];
else
{
BFD_ASSERT (h->root.type == bfd_link_hash_defined
|| (h->root.type
== bfd_link_hash_defweak));
sec = h->root.u.def.section;
}
if (sec != NULL && bfd_is_abs_section (sec))
sindx = 0;
else if (sec == NULL || sec->owner == NULL)
{
bfd_set_error (bfd_error_bad_value);
return false;
}
else
{
asection *osec;
osec = sec->output_section;
sindx = elf_section_data (osec)->dynindx;
BFD_ASSERT (sindx > 0);
}
outrel.r_info = ELF64_R_INFO (sindx, r_type);
outrel.r_addend = relocation + rel->r_addend;
}
}
sreloc = elf_section_data (input_section)->sreloc;
@ -1817,14 +1940,11 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
break;
}
/* FIXME: Why do we allow debugging sections to escape this error?
More importantly, why do we not emit dynamic relocs for
R_386_32 above in debugging sections (which are ! SEC_ALLOC)?
If we had emitted the dynamic reloc, we could remove the
fudge here. */
/* Dynamic relocs are not propagated for SEC_DEBUGGING sections
because such sections are not SEC_ALLOC and thus ld.so will
not process them. */
if (unresolved_reloc
&& !(info->shared
&& (input_section->flags & SEC_DEBUGGING) != 0
&& !((input_section->flags & SEC_DEBUGGING) != 0
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
(*_bfd_error_handler)
(_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"),
@ -2228,6 +2348,8 @@ elf64_x86_64_finish_dynamic_sections (output_bfd, info)
#define elf_backend_finish_dynamic_symbol elf64_x86_64_finish_dynamic_symbol
#define elf_backend_gc_mark_hook elf64_x86_64_gc_mark_hook
#define elf_backend_gc_sweep_hook elf64_x86_64_gc_sweep_hook
#define elf_backend_grok_prstatus elf64_x86_64_grok_prstatus
#define elf_backend_grok_psinfo elf64_x86_64_grok_psinfo
#define elf_backend_reloc_type_class elf64_x86_64_reloc_type_class
#define elf_backend_relocate_section elf64_x86_64_relocate_section
#define elf_backend_size_dynamic_sections elf64_x86_64_size_dynamic_sections

View File

@ -1,5 +1,5 @@
/* 32-bit ELF support for ARM old abi option.
Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@ -18,6 +18,14 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define OLD_ARM_ABI
#define bfd_elf32_arm_allocate_interworking_sections \
bfd_elf32_arm_oabi_allocate_interworking_sections
#define bfd_elf32_arm_get_bfd_for_interworking \
bfd_elf32_arm_oabi_get_bfd_for_interworking
#define bfd_elf32_arm_process_before_allocation \
bfd_elf32_arm_oabi_process_before_allocation
#define bfd_elf32_arm_add_glue_sections_to_bfd \
bfd_elf32_arm_oabi_add_glue_sections_to_bfd
#include "elf/arm.h"
#include "bfd.h"
@ -417,11 +425,4 @@ elf32_arm_reloc_type_lookup (abfd, code)
return NULL;
}
#define bfd_elf32_arm_allocate_interworking_sections \
bfd_elf32_arm_oabi_allocate_interworking_sections
#define bfd_elf32_arm_get_bfd_for_interworking \
bfd_elf32_arm_oabi_get_bfd_for_interworking
#define bfd_elf32_arm_process_before_allocation \
bfd_elf32_arm_oabi_process_before_allocation
#include "elf32-arm.h"

View File

@ -1,6 +1,6 @@
/* ELF executable support for BFD.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001 Free Software Foundation, Inc.
2001, 2002 Free Software Foundation, Inc.
Written by Fred Fish @ Cygnus Support, from information published
in "UNIX System V Release 4, Programmers Guide: ANSI C and
@ -203,12 +203,14 @@ static char *elf_symbol_flags PARAMS ((flagword));
format. */
void
elf_swap_symbol_in (abfd, src, shndx, dst)
elf_swap_symbol_in (abfd, psrc, pshn, dst)
bfd *abfd;
const Elf_External_Sym *src;
const Elf_External_Sym_Shndx *shndx;
const PTR psrc;
const PTR pshn;
Elf_Internal_Sym *dst;
{
const Elf_External_Sym *src = (const Elf_External_Sym *) psrc;
const Elf_External_Sym_Shndx *shndx = (const Elf_External_Sym_Shndx *) pshn;
int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
dst->st_name = H_GET_32 (abfd, src->st_name);
@ -557,9 +559,9 @@ elf_object_p (abfd)
section header table (FIXME: See comments re sections at top of this
file). */
if ((elf_file_p (&x_ehdr) == false) ||
(x_ehdr.e_ident[EI_VERSION] != EV_CURRENT) ||
(x_ehdr.e_ident[EI_CLASS] != ELFCLASS))
if (! elf_file_p (&x_ehdr)
|| x_ehdr.e_ident[EI_VERSION] != EV_CURRENT
|| x_ehdr.e_ident[EI_CLASS] != ELFCLASS)
goto got_wrong_format_error;
/* Check that file's byte order matches xvec's */
@ -622,6 +624,10 @@ elf_object_p (abfd)
if (i_ehdrp->e_shentsize != sizeof (x_shdr) && i_ehdrp->e_shnum != 0)
goto got_wrong_format_error;
/* Further sanity check. */
if (i_ehdrp->e_shoff == 0 && i_ehdrp->e_shnum != 0)
goto got_wrong_format_error;
ebd = get_elf_backend_data (abfd);
/* Check that the ELF e_machine field matches what this particular
@ -675,25 +681,28 @@ elf_object_p (abfd)
/* Remember the entry point specified in the ELF file header. */
bfd_set_start_address (abfd, i_ehdrp->e_entry);
/* Seek to the section header table in the file. */
if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_shoff, SEEK_SET) != 0)
goto got_no_match;
if (i_ehdrp->e_shoff != 0)
{
/* Seek to the section header table in the file. */
if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_shoff, SEEK_SET) != 0)
goto got_no_match;
/* Read the first section header at index 0, and convert to internal
form. */
if (bfd_bread ((PTR) & x_shdr, (bfd_size_type) sizeof x_shdr, abfd)
!= sizeof (x_shdr))
goto got_no_match;
elf_swap_shdr_in (abfd, &x_shdr, &i_shdr);
/* Read the first section header at index 0, and convert to internal
form. */
if (bfd_bread ((PTR) & x_shdr, (bfd_size_type) sizeof x_shdr, abfd)
!= sizeof (x_shdr))
goto got_no_match;
elf_swap_shdr_in (abfd, &x_shdr, &i_shdr);
/* If the section count is zero, the actual count is in the first
section header. */
if (i_ehdrp->e_shnum == SHN_UNDEF)
i_ehdrp->e_shnum = i_shdr.sh_size;
/* If the section count is zero, the actual count is in the first
section header. */
if (i_ehdrp->e_shnum == SHN_UNDEF)
i_ehdrp->e_shnum = i_shdr.sh_size;
/* And similarly for the string table index. */
if (i_ehdrp->e_shstrndx == SHN_XINDEX)
i_ehdrp->e_shstrndx = i_shdr.sh_link;
/* And similarly for the string table index. */
if (i_ehdrp->e_shstrndx == SHN_XINDEX)
i_ehdrp->e_shstrndx = i_shdr.sh_link;
}
/* Allocate space for a copy of the section header table in
internal form. */
@ -749,7 +758,7 @@ elf_object_p (abfd)
}
}
if (i_ehdrp->e_shstrndx)
if (i_ehdrp->e_shstrndx && i_ehdrp->e_shoff)
{
if (! bfd_section_from_shdr (abfd, i_ehdrp->e_shstrndx))
goto got_no_match;
@ -787,7 +796,7 @@ elf_object_p (abfd)
bfd_section_from_shdr with it (since this particular strtab is
used to find all of the ELF section names.) */
if (i_ehdrp->e_shstrndx != 0)
if (i_ehdrp->e_shstrndx != 0 && i_ehdrp->e_shoff)
{
unsigned int num_sec;
@ -812,7 +821,7 @@ elf_object_p (abfd)
information. */
if (ebd->elf_backend_object_p)
{
if ((*ebd->elf_backend_object_p) (abfd) == false)
if (! (*ebd->elf_backend_object_p) (abfd))
goto got_wrong_format_error;
}
@ -1124,10 +1133,12 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
unsigned long symcount; /* Number of external ELF symbols */
elf_symbol_type *sym; /* Pointer to current bfd symbol */
elf_symbol_type *symbase; /* Buffer for generated bfd symbols */
Elf_Internal_Sym i_sym;
Elf_External_Sym *x_symp = NULL;
Elf_External_Sym_Shndx *x_shndx = NULL;
Elf_External_Versym *x_versymp = NULL;
Elf_Internal_Sym *isym;
Elf_Internal_Sym *isymend;
Elf_Internal_Sym *isymbuf = NULL;
Elf_External_Versym *xver;
Elf_External_Versym *xverbuf = NULL;
struct elf_backend_data *ebd;
bfd_size_type amt;
/* Read each raw ELF symbol, converting from external ELF form to
@ -1142,24 +1153,8 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
if (! dynamic)
{
Elf_Internal_Shdr *shndx_hdr;
hdr = &elf_tdata (abfd)->symtab_hdr;
shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
verhdr = NULL;
/* If we have a SHT_SYMTAB_SHNDX section for the symbol table,
read the raw contents. */
if (elf_elfsections (abfd) != NULL
&& elf_elfsections (abfd)[shndx_hdr->sh_link] == hdr)
{
amt = shndx_hdr->sh_size;
x_shndx = (Elf_External_Sym_Shndx *) bfd_malloc (amt);
if (x_shndx == NULL
|| bfd_seek (abfd, shndx_hdr->sh_offset, SEEK_SET) != 0
|| bfd_bread ((PTR) x_shndx, amt, abfd) != amt)
goto error_return;
}
}
else
{
@ -1178,39 +1173,24 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
}
}
if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0)
goto error_return;
ebd = get_elf_backend_data (abfd);
symcount = hdr->sh_size / sizeof (Elf_External_Sym);
if (symcount == 0)
sym = symbase = NULL;
else
{
unsigned long i;
if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0)
goto error_return;
isymbuf = bfd_elf_get_elf_syms (abfd, hdr, symcount, 0,
NULL, NULL, NULL);
if (isymbuf == NULL)
return -1;
amt = symcount;
amt *= sizeof (elf_symbol_type);
symbase = (elf_symbol_type *) bfd_zalloc (abfd, amt);
if (symbase == (elf_symbol_type *) NULL)
goto error_return;
sym = symbase;
/* Temporarily allocate room for the raw ELF symbols. */
amt = symcount;
amt *= sizeof (Elf_External_Sym);
x_symp = (Elf_External_Sym *) bfd_malloc (amt);
if (x_symp == NULL)
goto error_return;
if (bfd_bread ((PTR) x_symp, amt, abfd) != amt)
goto error_return;
/* Read the raw ELF version symbol information. */
if (verhdr != NULL
&& verhdr->sh_size / sizeof (Elf_External_Versym) != symcount)
{
@ -1230,41 +1210,40 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
if (bfd_seek (abfd, verhdr->sh_offset, SEEK_SET) != 0)
goto error_return;
x_versymp = (Elf_External_Versym *) bfd_malloc (verhdr->sh_size);
if (x_versymp == NULL && verhdr->sh_size != 0)
xverbuf = (Elf_External_Versym *) bfd_malloc (verhdr->sh_size);
if (xverbuf == NULL && verhdr->sh_size != 0)
goto error_return;
if (bfd_bread ((PTR) x_versymp, verhdr->sh_size, abfd)
if (bfd_bread ((PTR) xverbuf, verhdr->sh_size, abfd)
!= verhdr->sh_size)
goto error_return;
}
/* Skip first symbol, which is a null dummy. */
for (i = 1; i < symcount; i++)
xver = xverbuf;
if (xver != NULL)
++xver;
isymend = isymbuf + symcount;
for (isym = isymbuf + 1, sym = symbase; isym < isymend; isym++, sym++)
{
elf_swap_symbol_in (abfd, x_symp + i,
x_shndx + (x_shndx != NULL ? i : 0), &i_sym);
memcpy (&sym->internal_elf_sym, &i_sym, sizeof (Elf_Internal_Sym));
#ifdef ELF_KEEP_EXTSYM
memcpy (&sym->native_elf_sym, x_symp + i, sizeof (Elf_External_Sym));
#endif
memcpy (&sym->internal_elf_sym, isym, sizeof (Elf_Internal_Sym));
sym->symbol.the_bfd = abfd;
sym->symbol.name = bfd_elf_string_from_elf_section (abfd,
hdr->sh_link,
i_sym.st_name);
isym->st_name);
sym->symbol.value = i_sym.st_value;
sym->symbol.value = isym->st_value;
if (i_sym.st_shndx == SHN_UNDEF)
if (isym->st_shndx == SHN_UNDEF)
{
sym->symbol.section = bfd_und_section_ptr;
}
else if (i_sym.st_shndx < SHN_LORESERVE
|| i_sym.st_shndx > SHN_HIRESERVE)
else if (isym->st_shndx < SHN_LORESERVE
|| isym->st_shndx > SHN_HIRESERVE)
{
sym->symbol.section = section_from_elf_index (abfd,
i_sym.st_shndx);
isym->st_shndx);
if (sym->symbol.section == NULL)
{
/* This symbol is in a section for which we did not
@ -1273,18 +1252,18 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
sym->symbol.section = bfd_abs_section_ptr;
}
}
else if (i_sym.st_shndx == SHN_ABS)
else if (isym->st_shndx == SHN_ABS)
{
sym->symbol.section = bfd_abs_section_ptr;
}
else if (i_sym.st_shndx == SHN_COMMON)
else if (isym->st_shndx == SHN_COMMON)
{
sym->symbol.section = bfd_com_section_ptr;
/* Elf puts the alignment into the `value' field, and
the size into the `size' field. BFD wants to see the
size in the value field, and doesn't care (at the
moment) about the alignment. */
sym->symbol.value = i_sym.st_size;
sym->symbol.value = isym->st_size;
}
else
sym->symbol.section = bfd_abs_section_ptr;
@ -1294,14 +1273,13 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
if ((abfd->flags & (EXEC_P | DYNAMIC)) != 0)
sym->symbol.value -= sym->symbol.section->vma;
switch (ELF_ST_BIND (i_sym.st_info))
switch (ELF_ST_BIND (isym->st_info))
{
case STB_LOCAL:
sym->symbol.flags |= BSF_LOCAL;
break;
case STB_GLOBAL:
if (i_sym.st_shndx != SHN_UNDEF
&& i_sym.st_shndx != SHN_COMMON)
if (isym->st_shndx != SHN_UNDEF && isym->st_shndx != SHN_COMMON)
sym->symbol.flags |= BSF_GLOBAL;
break;
case STB_WEAK:
@ -1309,7 +1287,7 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
break;
}
switch (ELF_ST_TYPE (i_sym.st_info))
switch (ELF_ST_TYPE (isym->st_info))
{
case STT_SECTION:
sym->symbol.flags |= BSF_SECTION_SYM | BSF_DEBUGGING;
@ -1328,31 +1306,24 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
if (dynamic)
sym->symbol.flags |= BSF_DYNAMIC;
if (x_versymp != NULL)
if (xver != NULL)
{
Elf_Internal_Versym iversym;
_bfd_elf_swap_versym_in (abfd, x_versymp + i, &iversym);
_bfd_elf_swap_versym_in (abfd, xver, &iversym);
sym->version = iversym.vs_vers;
xver++;
}
/* Do some backend-specific processing on this symbol. */
{
struct elf_backend_data *ebd = get_elf_backend_data (abfd);
if (ebd->elf_backend_symbol_processing)
(*ebd->elf_backend_symbol_processing) (abfd, &sym->symbol);
}
sym++;
if (ebd->elf_backend_symbol_processing)
(*ebd->elf_backend_symbol_processing) (abfd, &sym->symbol);
}
}
/* Do some backend-specific processing on this symbol table. */
{
struct elf_backend_data *ebd = get_elf_backend_data (abfd);
if (ebd->elf_backend_symbol_table_processing)
(*ebd->elf_backend_symbol_table_processing) (abfd, symbase, symcount);
}
if (ebd->elf_backend_symbol_table_processing)
(*ebd->elf_backend_symbol_table_processing) (abfd, symbase, symcount);
/* We rely on the zalloc to clear out the final symbol entry. */
@ -1372,21 +1343,17 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
*symptrs = 0; /* Final null pointer */
}
if (x_shndx != NULL)
free (x_shndx);
if (x_versymp != NULL)
free (x_versymp);
if (x_symp != NULL)
free (x_symp);
if (xverbuf != NULL)
free (xverbuf);
if (isymbuf != NULL && hdr->contents != (unsigned char *) isymbuf)
free (isymbuf);
return symcount;
error_return:
if (x_shndx != NULL)
free (x_shndx);
if (x_versymp != NULL)
free (x_versymp);
if (x_symp != NULL)
free (x_symp);
if (xverbuf != NULL)
free (xverbuf);
if (isymbuf != NULL && hdr->contents != (unsigned char *) isymbuf)
free (isymbuf);
return -1;
}
@ -1410,6 +1377,7 @@ elf_slurp_reloc_table_from_section (abfd, asect, rel_hdr, reloc_count,
arelent *relent;
unsigned int i;
int entsize;
unsigned int symcount;
allocated = (PTR) bfd_malloc (rel_hdr->sh_size);
if (allocated == NULL)
@ -1426,6 +1394,11 @@ elf_slurp_reloc_table_from_section (abfd, asect, rel_hdr, reloc_count,
BFD_ASSERT (entsize == sizeof (Elf_External_Rel)
|| entsize == sizeof (Elf_External_Rela));
if (dynamic)
symcount = bfd_get_dynamic_symcount (abfd);
else
symcount = bfd_get_symcount (abfd);
for (i = 0, relent = relents;
i < reloc_count;
i++, relent++, native_relocs += entsize)
@ -1454,6 +1427,13 @@ elf_slurp_reloc_table_from_section (abfd, asect, rel_hdr, reloc_count,
if (ELF_R_SYM (rela.r_info) == 0)
relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
else if (ELF_R_SYM (rela.r_info) > symcount)
{
(*_bfd_error_handler)
(_("%s(%s): relocation %d has invalid symbol index %ld"),
abfd->filename, asect->name, i, ELF_R_SYM (rela.r_info));
relent->sym_ptr_ptr = bfd_abs_section.symbol_ptr_ptr;
}
else
{
asymbol **ps, *s;
@ -1695,6 +1675,7 @@ const struct elf_size_info NAME(_bfd_elf,size_info) = {
elf_write_out_phdrs,
elf_write_shdrs_and_ehdr,
elf_write_relocs,
elf_swap_symbol_in,
elf_swap_symbol_out,
elf_slurp_reloc_table,
elf_slurp_symbol_table,

View File

@ -1,5 +1,5 @@
/* ELF core file support for BFD.
Copyright 1995, 1996, 1997, 1998, 2000, 2001
Copyright 1995, 1996, 1997, 1998, 2000, 2001, 2002
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@ -100,7 +100,7 @@ elf_core_file_p (abfd)
}
/* Check the magic number. */
if (elf_file_p (&x_ehdr) == false)
if (! elf_file_p (&x_ehdr))
goto wrong;
/* FIXME: Check EI_VERSION here ! */
@ -244,7 +244,7 @@ elf_core_file_p (abfd)
information. */
if (ebd->elf_backend_object_p)
{
if ((*ebd->elf_backend_object_p) (abfd) == false)
if (! (*ebd->elf_backend_object_p) (abfd))
goto wrong;
}

View File

@ -278,11 +278,13 @@ _bfd_elf_link_record_dynamic_symbol (info, h)
}
else
{
alc = bfd_malloc ((bfd_size_type) (p - name + 1));
size_t len = p - name + 1;
alc = bfd_malloc ((bfd_size_type) len);
if (alc == NULL)
return false;
strncpy (alc, name, (size_t) (p - name));
alc[p - name] = '\0';
memcpy (alc, name, len - 1);
alc[len - 1] = '\0';
name = alc;
copy = true;
}
@ -300,6 +302,98 @@ _bfd_elf_link_record_dynamic_symbol (info, h)
return true;
}
/* Record a new local dynamic symbol. Returns 0 on failure, 1 on
success, and 2 on a failure caused by attempting to record a symbol
in a discarded section, eg. a discarded link-once section symbol. */
int
elf_link_record_local_dynamic_symbol (info, input_bfd, input_indx)
struct bfd_link_info *info;
bfd *input_bfd;
long input_indx;
{
bfd_size_type amt;
struct elf_link_local_dynamic_entry *entry;
struct elf_link_hash_table *eht;
struct elf_strtab_hash *dynstr;
unsigned long dynstr_index;
char *name;
Elf_External_Sym_Shndx eshndx;
char esym[sizeof (Elf64_External_Sym)];
if (! is_elf_hash_table (info))
return 0;
/* See if the entry exists already. */
for (entry = elf_hash_table (info)->dynlocal; entry ; entry = entry->next)
if (entry->input_bfd == input_bfd && entry->input_indx == input_indx)
return 1;
amt = sizeof (*entry);
entry = (struct elf_link_local_dynamic_entry *) bfd_alloc (input_bfd, amt);
if (entry == NULL)
return 0;
/* Go find the symbol, so that we can find it's name. */
if (!bfd_elf_get_elf_syms (input_bfd, &elf_tdata (input_bfd)->symtab_hdr,
(size_t) 1, (size_t) input_indx,
&entry->isym, esym, &eshndx))
{
bfd_release (input_bfd, entry);
return 0;
}
if (entry->isym.st_shndx != SHN_UNDEF
&& (entry->isym.st_shndx < SHN_LORESERVE
|| entry->isym.st_shndx > SHN_HIRESERVE))
{
asection *s;
s = bfd_section_from_elf_index (input_bfd, entry->isym.st_shndx);
if (s == NULL || bfd_is_abs_section (s->output_section))
{
/* We can still bfd_release here as nothing has done another
bfd_alloc. We can't do this later in this function. */
bfd_release (input_bfd, entry);
return 2;
}
}
name = (bfd_elf_string_from_elf_section
(input_bfd, elf_tdata (input_bfd)->symtab_hdr.sh_link,
entry->isym.st_name));
dynstr = elf_hash_table (info)->dynstr;
if (dynstr == NULL)
{
/* Create a strtab to hold the dynamic symbol names. */
elf_hash_table (info)->dynstr = dynstr = _bfd_elf_strtab_init ();
if (dynstr == NULL)
return 0;
}
dynstr_index = _bfd_elf_strtab_add (dynstr, name, false);
if (dynstr_index == (unsigned long) -1)
return 0;
entry->isym.st_name = dynstr_index;
eht = elf_hash_table (info);
entry->next = eht->dynlocal;
eht->dynlocal = entry;
entry->input_bfd = input_bfd;
entry->input_indx = input_indx;
eht->dynsymcount++;
/* Whatever binding the symbol had before, it's now local. */
entry->isym.st_info
= ELF_ST_INFO (STB_LOCAL, ELF_ST_TYPE (entry->isym.st_info));
/* The dynindx will be set at the end of size_dynamic_sections. */
return 1;
}
/* Return the dynindex of a local dynamic symbol. */
long
@ -355,7 +449,8 @@ _bfd_elf_link_renumber_dynsyms (output_bfd, info)
{
asection *p;
for (p = output_bfd->sections; p ; p = p->next)
elf_section_data (p)->dynindx = ++dynsymcount;
if ((p->flags & SEC_EXCLUDE) == 0)
elf_section_data (p)->dynindx = ++dynsymcount;
}
if (elf_hash_table (info)->dynlocal)

File diff suppressed because it is too large Load Diff

View File

@ -79,6 +79,9 @@ struct elfNN_ia64_dyn_sym_info
bfd_vma pltoff_offset;
bfd_vma plt_offset;
bfd_vma plt2_offset;
bfd_vma tprel_offset;
bfd_vma dtpmod_offset;
bfd_vma dtprel_offset;
/* The symbol table entry, if any, that this was derrived from. */
struct elf_link_hash_entry *h;
@ -97,6 +100,9 @@ struct elfNN_ia64_dyn_sym_info
unsigned got_done : 1;
unsigned fptr_done : 1;
unsigned pltoff_done : 1;
unsigned tprel_done : 1;
unsigned dtpmod_done : 1;
unsigned dtprel_done : 1;
/* True for the different kinds of linker data we want created. */
unsigned want_got : 1;
@ -105,6 +111,9 @@ struct elfNN_ia64_dyn_sym_info
unsigned want_plt : 1;
unsigned want_plt2 : 1;
unsigned want_pltoff : 1;
unsigned want_tprel : 1;
unsigned want_dtpmod : 1;
unsigned want_dtprel : 1;
};
struct elfNN_ia64_local_hash_entry
@ -165,7 +174,7 @@ static boolean elfNN_ia64_relax_section
static boolean is_unwind_section_name
PARAMS ((bfd *abfd, const char *));
static boolean elfNN_ia64_section_from_shdr
PARAMS ((bfd *, ElfNN_Internal_Shdr *, char *));
PARAMS ((bfd *, ElfNN_Internal_Shdr *, const char *));
static boolean elfNN_ia64_section_flags
PARAMS ((flagword *, ElfNN_Internal_Shdr *));
static boolean elfNN_ia64_fake_sections
@ -202,7 +211,8 @@ static struct bfd_hash_entry *elfNN_ia64_new_elf_hash_entry
PARAMS ((struct bfd_hash_entry *entry, struct bfd_hash_table *table,
const char *string));
static void elfNN_ia64_hash_copy_indirect
PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
struct elf_link_hash_entry *));
static void elfNN_ia64_hash_hide_symbol
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, boolean));
static struct bfd_link_hash_table *elfNN_ia64_hash_table_create
@ -285,6 +295,10 @@ static bfd_vma set_pltoff_entry
PARAMS ((bfd *abfd, struct bfd_link_info *info,
struct elfNN_ia64_dyn_sym_info *dyn_i,
bfd_vma value, boolean));
static bfd_vma elfNN_ia64_tprel_base
PARAMS ((struct bfd_link_info *info));
static bfd_vma elfNN_ia64_dtprel_base
PARAMS ((struct bfd_link_info *info));
static int elfNN_ia64_unwind_entry_compare
PARAMS ((const PTR, const PTR));
static boolean elfNN_ia64_final_link
@ -423,10 +437,25 @@ static reloc_howto_type ia64_howto_table[] =
IA64_HOWTO (R_IA64_LTOFF22X, "LTOFF22X", 0, false, true),
IA64_HOWTO (R_IA64_LDXMOV, "LDXMOV", 0, false, true),
IA64_HOWTO (R_IA64_TPREL14, "TPREL14", 0, false, false),
IA64_HOWTO (R_IA64_TPREL22, "TPREL22", 0, false, false),
IA64_HOWTO (R_IA64_TPREL64I, "TPREL64I", 0, false, false),
IA64_HOWTO (R_IA64_TPREL64MSB, "TPREL64MSB", 8, false, false),
IA64_HOWTO (R_IA64_TPREL64LSB, "TPREL64LSB", 8, false, false),
IA64_HOWTO (R_IA64_LTOFF_TP22, "LTOFF_TP22", 0, false, false),
IA64_HOWTO (R_IA64_LTOFF_TPREL22, "LTOFF_TPREL22", 0, false, false),
IA64_HOWTO (R_IA64_DTPMOD64MSB, "TPREL64MSB", 8, false, false),
IA64_HOWTO (R_IA64_DTPMOD64LSB, "TPREL64LSB", 8, false, false),
IA64_HOWTO (R_IA64_LTOFF_DTPMOD22, "LTOFF_DTPMOD22", 0, false, false),
IA64_HOWTO (R_IA64_DTPREL14, "DTPREL14", 0, false, false),
IA64_HOWTO (R_IA64_DTPREL22, "DTPREL22", 0, false, false),
IA64_HOWTO (R_IA64_DTPREL64I, "DTPREL64I", 0, false, false),
IA64_HOWTO (R_IA64_DTPREL32MSB, "DTPREL32MSB", 4, false, false),
IA64_HOWTO (R_IA64_DTPREL32LSB, "DTPREL32LSB", 4, false, false),
IA64_HOWTO (R_IA64_DTPREL64MSB, "DTPREL64MSB", 8, false, false),
IA64_HOWTO (R_IA64_DTPREL64LSB, "DTPREL64LSB", 8, false, false),
IA64_HOWTO (R_IA64_LTOFF_DTPREL22, "LTOFF_DTPREL22", 0, false, false),
};
static unsigned char elf_code_to_howto_index[R_IA64_MAX_RELOC_CODE + 1];
@ -541,10 +570,25 @@ elfNN_ia64_reloc_type_lookup (abfd, bfd_code)
case BFD_RELOC_IA64_LTOFF22X: rtype = R_IA64_LTOFF22X; break;
case BFD_RELOC_IA64_LDXMOV: rtype = R_IA64_LDXMOV; break;
case BFD_RELOC_IA64_TPREL14: rtype = R_IA64_TPREL14; break;
case BFD_RELOC_IA64_TPREL22: rtype = R_IA64_TPREL22; break;
case BFD_RELOC_IA64_TPREL64I: rtype = R_IA64_TPREL64I; break;
case BFD_RELOC_IA64_TPREL64MSB: rtype = R_IA64_TPREL64MSB; break;
case BFD_RELOC_IA64_TPREL64LSB: rtype = R_IA64_TPREL64LSB; break;
case BFD_RELOC_IA64_LTOFF_TP22: rtype = R_IA64_LTOFF_TP22; break;
case BFD_RELOC_IA64_LTOFF_TPREL22: rtype = R_IA64_LTOFF_TPREL22; break;
case BFD_RELOC_IA64_DTPMOD64MSB: rtype = R_IA64_DTPMOD64MSB; break;
case BFD_RELOC_IA64_DTPMOD64LSB: rtype = R_IA64_DTPMOD64LSB; break;
case BFD_RELOC_IA64_LTOFF_DTPMOD22: rtype = R_IA64_LTOFF_DTPMOD22; break;
case BFD_RELOC_IA64_DTPREL14: rtype = R_IA64_DTPREL14; break;
case BFD_RELOC_IA64_DTPREL22: rtype = R_IA64_DTPREL22; break;
case BFD_RELOC_IA64_DTPREL64I: rtype = R_IA64_DTPREL64I; break;
case BFD_RELOC_IA64_DTPREL32MSB: rtype = R_IA64_DTPREL32MSB; break;
case BFD_RELOC_IA64_DTPREL32LSB: rtype = R_IA64_DTPREL32LSB; break;
case BFD_RELOC_IA64_DTPREL64MSB: rtype = R_IA64_DTPREL64MSB; break;
case BFD_RELOC_IA64_DTPREL64LSB: rtype = R_IA64_DTPREL64LSB; break;
case BFD_RELOC_IA64_LTOFF_DTPREL22: rtype = R_IA64_LTOFF_DTPREL22; break;
default: return 0;
}
@ -648,15 +692,10 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
};
Elf_Internal_Shdr *symtab_hdr;
Elf_Internal_Shdr *shndx_hdr;
Elf_Internal_Rela *internal_relocs;
Elf_Internal_Rela *free_relocs = NULL;
Elf_Internal_Rela *irel, *irelend;
bfd_byte *contents;
bfd_byte *free_contents = NULL;
ElfNN_External_Sym *extsyms;
ElfNN_External_Sym *free_extsyms = NULL;
Elf_External_Sym_Shndx *shndx_buf = NULL;
Elf_Internal_Sym *isymbuf = NULL;
struct elfNN_ia64_link_hash_table *ia64_info;
struct one_fixup *fixups = NULL;
boolean changed_contents = false;
@ -683,10 +722,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
(abfd, sec, (PTR) NULL, (Elf_Internal_Rela *) NULL,
link_info->keep_memory));
if (internal_relocs == NULL)
goto error_return;
if (! link_info->keep_memory)
free_relocs = internal_relocs;
return false;
ia64_info = elfNN_ia64_hash_table (link_info);
irelend = internal_relocs + sec->reloc_count;
@ -698,8 +734,8 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
/* No branch-type relocations. */
if (irel == irelend)
{
if (free_relocs != NULL)
free (free_relocs);
if (elf_section_data (sec)->relocs != internal_relocs)
free (internal_relocs);
return true;
}
@ -711,48 +747,15 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
contents = (bfd_byte *) bfd_malloc (sec->_raw_size);
if (contents == NULL)
goto error_return;
free_contents = contents;
if (! bfd_get_section_contents (abfd, sec, contents,
(file_ptr) 0, sec->_raw_size))
goto error_return;
}
/* Read this BFD's local symbols. */
if (symtab_hdr->contents != NULL)
extsyms = (ElfNN_External_Sym *) symtab_hdr->contents;
else
{
bfd_size_type amt;
amt = symtab_hdr->sh_info * sizeof (ElfNN_External_Sym);
extsyms = (ElfNN_External_Sym *) bfd_malloc (amt);
if (extsyms == NULL)
goto error_return;
free_extsyms = extsyms;
if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0
|| bfd_bread (extsyms, amt, abfd) != amt)
goto error_return;
}
shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
if (shndx_hdr->sh_size != 0)
{
bfd_size_type amt;
amt = symtab_hdr->sh_info * sizeof (Elf_External_Sym_Shndx);
shndx_buf = (Elf_External_Sym_Shndx *) bfd_malloc (amt);
if (shndx_buf == NULL)
goto error_return;
if (bfd_seek (abfd, shndx_hdr->sh_offset, SEEK_SET) != 0
|| bfd_bread (shndx_buf, amt, abfd) != amt)
goto error_return;
}
for (; irel < irelend; irel++)
{
bfd_vma symaddr, reladdr, trampoff, toff, roff;
Elf_Internal_Sym isym;
asection *tsec;
struct one_fixup *f;
bfd_size_type amt;
@ -763,25 +766,34 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
/* Get the value of the symbol referred to by the reloc. */
if (ELFNN_R_SYM (irel->r_info) < symtab_hdr->sh_info)
{
ElfNN_External_Sym *esym;
Elf_External_Sym_Shndx *shndx;
/* A local symbol. */
esym = extsyms + ELFNN_R_SYM (irel->r_info);
shndx = shndx_buf + (shndx_buf ? ELFNN_R_SYM (irel->r_info) : 0);
bfd_elfNN_swap_symbol_in (abfd, esym, shndx, &isym);
if (isym.st_shndx == SHN_UNDEF)
Elf_Internal_Sym *isym;
/* Read this BFD's local symbols. */
if (isymbuf == NULL)
{
isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
if (isymbuf == NULL)
isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr,
symtab_hdr->sh_info, 0,
NULL, NULL, NULL);
if (isymbuf == 0)
goto error_return;
}
isym = isymbuf + ELF64_R_SYM (irel->r_info);
if (isym->st_shndx == SHN_UNDEF)
continue; /* We can't do anthing with undefined symbols. */
else if (isym.st_shndx == SHN_ABS)
else if (isym->st_shndx == SHN_ABS)
tsec = bfd_abs_section_ptr;
else if (isym.st_shndx == SHN_COMMON)
else if (isym->st_shndx == SHN_COMMON)
tsec = bfd_com_section_ptr;
else if (isym.st_shndx == SHN_IA_64_ANSI_COMMON)
else if (isym->st_shndx == SHN_IA_64_ANSI_COMMON)
tsec = bfd_com_section_ptr;
else
tsec = bfd_section_from_elf_index (abfd, isym.st_shndx);
tsec = bfd_section_from_elf_index (abfd, isym->st_shndx);
toff = isym.st_value;
toff = isym->st_value;
}
else
{
@ -929,17 +941,23 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
free (f);
}
if (changed_relocs)
elf_section_data (sec)->relocs = internal_relocs;
else if (free_relocs != NULL)
free (free_relocs);
if (changed_contents)
elf_section_data (sec)->this_hdr.contents = contents;
else if (free_contents != NULL)
if (isymbuf != NULL
&& symtab_hdr->contents != (unsigned char *) isymbuf)
{
if (! link_info->keep_memory)
free (free_contents);
free (isymbuf);
else
{
/* Cache the symbols for elf_link_input_bfd. */
symtab_hdr->contents = (unsigned char *) isymbuf;
}
}
if (contents != NULL
&& elf_section_data (sec)->this_hdr.contents != contents)
{
if (!changed_contents && !link_info->keep_memory)
free (contents);
else
{
/* Cache the section contents for elf_link_input_bfd. */
@ -947,32 +965,26 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
}
}
if (shndx_buf != NULL)
free (shndx_buf);
if (free_extsyms != NULL)
if (elf_section_data (sec)->relocs != internal_relocs)
{
if (! link_info->keep_memory)
free (free_extsyms);
if (!changed_relocs)
free (internal_relocs);
else
{
/* Cache the symbols for elf_link_input_bfd. */
symtab_hdr->contents = (unsigned char *) extsyms;
}
elf_section_data (sec)->relocs = internal_relocs;
}
*again = changed_contents || changed_relocs;
return true;
error_return:
if (free_relocs != NULL)
free (free_relocs);
if (free_contents != NULL)
free (free_contents);
if (shndx_buf != NULL)
free (shndx_buf);
if (free_extsyms != NULL)
free (free_extsyms);
if (isymbuf != NULL && (unsigned char *) isymbuf != symtab_hdr->contents)
free (isymbuf);
if (contents != NULL
&& elf_section_data (sec)->this_hdr.contents != contents)
free (contents);
if (internal_relocs != NULL
&& elf_section_data (sec)->relocs != internal_relocs)
free (internal_relocs);
return false;
}
@ -1004,7 +1016,7 @@ static boolean
elfNN_ia64_section_from_shdr (abfd, hdr, name)
bfd *abfd;
ElfNN_Internal_Shdr *hdr;
char *name;
const char *name;
{
asection *newsect;
@ -1358,8 +1370,6 @@ elfNN_ia64_modify_segment_map (abfd)
struct elf_segment_map *m, **pm;
Elf_Internal_Shdr *hdr;
asection *s;
boolean unwind_found;
asection *unwind_sec;
/* If we need a PT_IA_64_ARCHEXT segment, it must come before
all PT_LOAD segments. */
@ -1404,20 +1414,16 @@ elfNN_ia64_modify_segment_map (abfd)
for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
if (m->p_type == PT_IA_64_UNWIND)
{
int i;
/* Look through all sections in the unwind segment
for a match since there may be multiple sections
to a segment. */
for (i = m->count - 1; i >= 0; --i)
if (m->sections[i] == s)
break;
unwind_sec = m->sections[0];
unwind_found = false;
while (unwind_sec != NULL && !unwind_found)
{
if (unwind_sec == s)
unwind_found = true;
else
unwind_sec = unwind_sec -> next;
}
if (unwind_found)
if (i >= 0)
break;
}
@ -1588,7 +1594,8 @@ elfNN_ia64_new_elf_hash_entry (entry, table, string)
}
static void
elfNN_ia64_hash_copy_indirect (xdir, xind)
elfNN_ia64_hash_copy_indirect (bed, xdir, xind)
struct elf_backend_data *bed ATTRIBUTE_UNUSED;
struct elf_link_hash_entry *xdir, *xind;
{
struct elfNN_ia64_link_hash_entry *dir, *ind;
@ -2097,6 +2104,9 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
NEED_FULL_PLT = 16,
NEED_DYNREL = 32,
NEED_LTOFF_FPTR = 64,
NEED_TPREL = 128,
NEED_DTPMOD = 256,
NEED_DTPREL = 512
};
struct elf_link_hash_entry *h = NULL;
@ -2134,11 +2144,42 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
need_entry = 0;
switch (ELFNN_R_TYPE (rel->r_info))
{
case R_IA64_TPREL22:
case R_IA64_TPREL64MSB:
case R_IA64_TPREL64LSB:
case R_IA64_LTOFF_TP22:
return false;
if (info->shared || maybe_dynamic)
need_entry = NEED_DYNREL;
dynrel_type = R_IA64_TPREL64LSB;
if (info->shared)
info->flags |= DF_STATIC_TLS;
break;
case R_IA64_LTOFF_TPREL22:
need_entry = NEED_TPREL;
if (info->shared)
info->flags |= DF_STATIC_TLS;
break;
case R_IA64_DTPREL64MSB:
case R_IA64_DTPREL64LSB:
if (info->shared || maybe_dynamic)
need_entry = NEED_DYNREL;
dynrel_type = R_IA64_DTPREL64LSB;
break;
case R_IA64_LTOFF_DTPREL22:
need_entry = NEED_DTPREL;
break;
case R_IA64_DTPMOD64MSB:
case R_IA64_DTPMOD64LSB:
if (info->shared || maybe_dynamic)
need_entry = NEED_DYNREL;
dynrel_type = R_IA64_DTPMOD64LSB;
break;
case R_IA64_LTOFF_DTPMOD22:
need_entry = NEED_DTPMOD;
break;
case R_IA64_LTOFF_FPTR22:
case R_IA64_LTOFF_FPTR64I:
@ -2248,7 +2289,7 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
dyn_i->h = h;
/* Create what's needed. */
if (need_entry & NEED_GOT)
if (need_entry & (NEED_GOT | NEED_TPREL | NEED_DTPMOD | NEED_DTPREL))
{
if (!got)
{
@ -2256,7 +2297,14 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
if (!got)
return false;
}
dyn_i->want_got = 1;
if (need_entry & NEED_GOT)
dyn_i->want_got = 1;
if (need_entry & NEED_TPREL)
dyn_i->want_tprel = 1;
if (need_entry & NEED_DTPMOD)
dyn_i->want_dtpmod = 1;
if (need_entry & NEED_DTPREL)
dyn_i->want_dtprel = 1;
}
if (need_entry & NEED_FPTR)
{
@ -2336,6 +2384,21 @@ allocate_global_data_got (dyn_i, data)
dyn_i->got_offset = x->ofs;
x->ofs += 8;
}
if (dyn_i->want_tprel)
{
dyn_i->tprel_offset = x->ofs;
x->ofs += 8;
}
if (dyn_i->want_dtpmod)
{
dyn_i->dtpmod_offset = x->ofs;
x->ofs += 8;
}
if (dyn_i->want_dtprel)
{
dyn_i->dtprel_offset = x->ofs;
x->ofs += 8;
}
return true;
}
@ -2582,6 +2645,10 @@ allocate_dynrel_entries (dyn_i, data)
if (!dynamic_symbol)
count *= 2;
break;
case R_IA64_TPREL64LSB:
case R_IA64_DTPREL64LSB:
case R_IA64_DTPMOD64LSB:
break;
default:
abort ();
}
@ -2593,6 +2660,12 @@ allocate_dynrel_entries (dyn_i, data)
if (((dynamic_symbol || shared) && dyn_i->want_got)
|| (dyn_i->want_ltoff_fptr && dyn_i->h && dyn_i->h->dynindx != -1))
ia64_info->rel_got_sec->_raw_size += sizeof (ElfNN_External_Rela);
if ((dynamic_symbol || shared) && dyn_i->want_tprel)
ia64_info->rel_got_sec->_raw_size += sizeof (ElfNN_External_Rela);
if ((dynamic_symbol || shared) && dyn_i->want_dtpmod)
ia64_info->rel_got_sec->_raw_size += sizeof (ElfNN_External_Rela);
if (dynamic_symbol && dyn_i->want_dtprel)
ia64_info->rel_got_sec->_raw_size += sizeof (ElfNN_External_Rela);
if (dyn_i->want_pltoff)
{
@ -2903,7 +2976,11 @@ elfNN_ia64_install_value (abfd, hit_addr, v, r_type)
/* Instruction relocations. */
case R_IA64_IMM14: opnd = IA64_OPND_IMM14; break;
case R_IA64_IMM14:
case R_IA64_TPREL14:
case R_IA64_DTPREL14:
opnd = IA64_OPND_IMM14;
break;
case R_IA64_PCREL21F: opnd = IA64_OPND_TGT25; break;
case R_IA64_PCREL21M: opnd = IA64_OPND_TGT25b; break;
@ -2920,6 +2997,11 @@ elfNN_ia64_install_value (abfd, hit_addr, v, r_type)
case R_IA64_PLTOFF22:
case R_IA64_PCREL22:
case R_IA64_LTOFF_FPTR22:
case R_IA64_TPREL22:
case R_IA64_DTPREL22:
case R_IA64_LTOFF_TPREL22:
case R_IA64_LTOFF_DTPMOD22:
case R_IA64_LTOFF_DTPREL22:
opnd = IA64_OPND_IMM22;
break;
@ -2930,6 +3012,8 @@ elfNN_ia64_install_value (abfd, hit_addr, v, r_type)
case R_IA64_PCREL64I:
case R_IA64_FPTR64I:
case R_IA64_LTOFF_FPTR64I:
case R_IA64_TPREL64I:
case R_IA64_DTPREL64I:
opnd = IA64_OPND_IMMU64;
break;
@ -2943,6 +3027,7 @@ elfNN_ia64_install_value (abfd, hit_addr, v, r_type)
case R_IA64_SEGREL32MSB:
case R_IA64_SECREL32MSB:
case R_IA64_LTV32MSB:
case R_IA64_DTPREL32MSB:
size = 4; bigendian = 1;
break;
@ -2954,6 +3039,7 @@ elfNN_ia64_install_value (abfd, hit_addr, v, r_type)
case R_IA64_SEGREL32LSB:
case R_IA64_SECREL32LSB:
case R_IA64_LTV32LSB:
case R_IA64_DTPREL32LSB:
size = 4; bigendian = 0;
break;
@ -2966,6 +3052,9 @@ elfNN_ia64_install_value (abfd, hit_addr, v, r_type)
case R_IA64_SEGREL64MSB:
case R_IA64_SECREL64MSB:
case R_IA64_LTV64MSB:
case R_IA64_TPREL64MSB:
case R_IA64_DTPMOD64MSB:
case R_IA64_DTPREL64MSB:
size = 8; bigendian = 1;
break;
@ -2978,6 +3067,9 @@ elfNN_ia64_install_value (abfd, hit_addr, v, r_type)
case R_IA64_SEGREL64LSB:
case R_IA64_SECREL64LSB:
case R_IA64_LTV64LSB:
case R_IA64_TPREL64LSB:
case R_IA64_DTPMOD64LSB:
case R_IA64_DTPREL64LSB:
size = 8; bigendian = 0;
break;
@ -3132,26 +3224,53 @@ set_got_entry (abfd, info, dyn_i, dynindx, addend, value, dyn_r_type)
{
struct elfNN_ia64_link_hash_table *ia64_info;
asection *got_sec;
boolean done;
bfd_vma got_offset;
ia64_info = elfNN_ia64_hash_table (info);
got_sec = ia64_info->got_sec;
BFD_ASSERT ((dyn_i->got_offset & 7) == 0);
if (! dyn_i->got_done)
switch (dyn_r_type)
{
case R_IA64_TPREL64LSB:
done = dyn_i->tprel_done;
dyn_i->tprel_done = true;
got_offset = dyn_i->tprel_offset;
break;
case R_IA64_DTPMOD64LSB:
done = dyn_i->dtpmod_done;
dyn_i->dtpmod_done = true;
got_offset = dyn_i->dtpmod_offset;
break;
case R_IA64_DTPREL64LSB:
done = dyn_i->dtprel_done;
dyn_i->dtprel_done = true;
got_offset = dyn_i->dtprel_offset;
break;
default:
done = dyn_i->got_done;
dyn_i->got_done = true;
got_offset = dyn_i->got_offset;
break;
}
BFD_ASSERT ((got_offset & 7) == 0);
if (! done)
{
/* Store the target address in the linkage table entry. */
bfd_put_64 (abfd, value, got_sec->contents + dyn_i->got_offset);
bfd_put_64 (abfd, value, got_sec->contents + got_offset);
/* Install a dynamic relocation if needed. */
if (info->shared
if ((info->shared && dyn_r_type != R_IA64_DTPREL64LSB)
|| elfNN_ia64_dynamic_symbol_p (dyn_i->h, info)
|| elfNN_ia64_aix_vec (abfd->xvec)
|| (dynindx != -1 && dyn_r_type == R_IA64_FPTR64LSB))
{
if (dynindx == -1)
if (dynindx == -1
&& dyn_r_type != R_IA64_TPREL64LSB
&& dyn_r_type != R_IA64_DTPMOD64LSB
&& dyn_r_type != R_IA64_DTPREL64LSB)
{
dyn_r_type = R_IA64_REL64LSB;
dynindx = 0;
@ -3171,6 +3290,15 @@ set_got_entry (abfd, info, dyn_i, dynindx, addend, value, dyn_r_type)
case R_IA64_FPTR64LSB:
dyn_r_type = R_IA64_FPTR64MSB;
break;
case R_IA64_TPREL64LSB:
dyn_r_type = R_IA64_TPREL64MSB;
break;
case R_IA64_DTPMOD64LSB:
dyn_r_type = R_IA64_DTPMOD64MSB;
break;
case R_IA64_DTPREL64LSB:
dyn_r_type = R_IA64_DTPREL64MSB;
break;
default:
BFD_ASSERT (false);
break;
@ -3179,7 +3307,7 @@ set_got_entry (abfd, info, dyn_i, dynindx, addend, value, dyn_r_type)
elfNN_ia64_install_dyn_reloc (abfd, NULL, got_sec,
ia64_info->rel_got_sec,
dyn_i->got_offset, dyn_r_type,
got_offset, dyn_r_type,
dynindx, addend);
}
}
@ -3187,7 +3315,7 @@ set_got_entry (abfd, info, dyn_i, dynindx, addend, value, dyn_r_type)
/* Return the address of the linkage table entry. */
value = (got_sec->output_section->vma
+ got_sec->output_offset
+ dyn_i->got_offset);
+ got_offset);
return value;
}
@ -3285,6 +3413,35 @@ set_pltoff_entry (abfd, info, dyn_i, value, is_plt)
return value;
}
/* Return the base VMA address which should be subtracted from real addresses
when resolving @tprel() relocation.
Main program TLS (whose template starts at PT_TLS p_vaddr)
is assigned offset round(16, PT_TLS p_align). */
static bfd_vma
elfNN_ia64_tprel_base (info)
struct bfd_link_info *info;
{
struct elf_link_tls_segment *tls_segment
= elf_hash_table (info)->tls_segment;
BFD_ASSERT (tls_segment != NULL);
return (tls_segment->start
- align_power ((bfd_vma) 16, tls_segment->align));
}
/* Return the base VMA address which should be subtracted from real addresses
when resolving @dtprel() relocation.
This is PT_TLS segment p_vaddr. */
static bfd_vma
elfNN_ia64_dtprel_base (info)
struct bfd_link_info *info;
{
BFD_ASSERT (elf_hash_table (info)->tls_segment != NULL);
return elf_hash_table (info)->tls_segment->start;
}
/* Called through qsort to sort the .IA_64.unwind section during a
non-relocatable link. Set elfNN_ia64_unwind_entry_compare_bfd
to the output bfd so we can do proper endianness frobbing. */
@ -4030,6 +4187,55 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
r_type);
break;
case R_IA64_TPREL14:
case R_IA64_TPREL22:
case R_IA64_TPREL64I:
value -= elfNN_ia64_tprel_base (info);
r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
break;
case R_IA64_DTPREL14:
case R_IA64_DTPREL22:
case R_IA64_DTPREL64I:
value -= elfNN_ia64_dtprel_base (info);
r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
break;
case R_IA64_LTOFF_TPREL22:
case R_IA64_LTOFF_DTPMOD22:
case R_IA64_LTOFF_DTPREL22:
{
int got_r_type;
switch (r_type)
{
default:
case R_IA64_LTOFF_TPREL22:
if (!dynamic_symbol_p && !info->shared)
value -= elfNN_ia64_tprel_base (info);
got_r_type = R_IA64_TPREL64LSB;
break;
case R_IA64_LTOFF_DTPMOD22:
if (!dynamic_symbol_p && !info->shared)
value = 1;
got_r_type = R_IA64_DTPMOD64LSB;
break;
case R_IA64_LTOFF_DTPREL22:
if (!dynamic_symbol_p)
value -= elfNN_ia64_dtprel_base (info);
got_r_type = R_IA64_DTPREL64LSB;
break;
}
dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, false);
value = set_got_entry (input_bfd, info, dyn_i,
(h ? h->dynindx : -1), rel->r_addend,
value, got_r_type);
value -= gp_val;
r = elfNN_ia64_install_value (output_bfd, hit_addr, value,
r_type);
}
break;
default:
r = bfd_reloc_notsupported;
break;
@ -4592,6 +4798,9 @@ elfNN_hpux_backend_section_from_bfd_section (abfd, sec, retval)
#undef elf_backend_section_from_bfd_section
#define elf_backend_section_from_bfd_section elfNN_hpux_backend_section_from_bfd_section
#undef elf_backend_want_p_paddr_set_to_zero
#define elf_backend_want_p_paddr_set_to_zero 1
#undef ELF_MAXPAGESIZE
#define ELF_MAXPAGESIZE 0x1000 /* 1K */
@ -4599,3 +4808,5 @@ elfNN_hpux_backend_section_from_bfd_section (abfd, sec, retval)
#define elfNN_bed elfNN_ia64_hpux_bed
#include "elfNN-target.h"
#undef elf_backend_want_p_paddr_set_to_zero

View File

@ -44,7 +44,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef bfd_elfNN_get_reloc_upper_bound
#define bfd_elfNN_get_reloc_upper_bound _bfd_elf_get_reloc_upper_bound
#endif
#ifndef bfd_elfNN_get_symbol_info
#define bfd_elfNN_get_symbol_info _bfd_elf_get_symbol_info
#endif
#define bfd_elfNN_get_symtab _bfd_elf_get_symtab
#define bfd_elfNN_get_symtab_upper_bound _bfd_elf_get_symtab_upper_bound
#if 0 /* done in elf-bfd.h */
@ -87,6 +89,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef elf_backend_want_dynbss
#define elf_backend_want_dynbss 1
#endif
#ifndef elf_backend_want_p_paddr_set_to_zero
#define elf_backend_want_p_paddr_set_to_zero 0
#endif
#define bfd_elfNN_bfd_debug_info_start bfd_void
#define bfd_elfNN_bfd_debug_info_end bfd_void
@ -126,6 +131,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
_bfd_elf_merge_sections
#endif
#ifndef bfd_elfNN_bfd_discard_group
#define bfd_elfNN_bfd_discard_group bfd_elf_discard_group
#endif
#ifndef bfd_elfNN_bfd_make_debug_symbol
#define bfd_elfNN_bfd_make_debug_symbol \
((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
@ -169,6 +178,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
_bfd_elf_canonicalize_dynamic_reloc
#endif
#ifndef bfd_elfNN_bfd_link_hash_table_free
#define bfd_elfNN_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#endif
#ifdef elf_backend_relocate_section
#ifndef bfd_elfNN_bfd_link_hash_table_create
#define bfd_elfNN_bfd_link_hash_table_create _bfd_elf_link_hash_table_create
@ -190,6 +203,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define bfd_elfNN_bfd_final_link _bfd_generic_final_link
#endif
#endif /* ! defined (elf_backend_relocate_section) */
#ifndef bfd_elfNN_bfd_link_just_syms
#define bfd_elfNN_bfd_link_just_syms _bfd_elf_link_just_syms
#endif
#ifndef bfd_elfNN_bfd_link_split_section
#define bfd_elfNN_bfd_link_split_section _bfd_generic_link_split_section
#endif
@ -367,6 +385,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef elf_backend_write_section
#define elf_backend_write_section NULL
#endif
#ifndef elf_backend_set_nonloadable_filepos
#define elf_backend_set_nonloadable_filepos NULL
#endif
#ifndef elf_backend_is_contained_by_filepos
#define elf_backend_is_contained_by_filepos NULL
#endif
#ifndef elf_backend_copy_private_bfd_data_p
#define elf_backend_copy_private_bfd_data_p NULL
#endif
#ifndef elf_backend_mips_irix_compat
#define elf_backend_mips_irix_compat NULL
#endif
#ifndef elf_backend_mips_rtype_to_howto
#define elf_backend_mips_rtype_to_howto NULL
#endif
/* Previously, backends could only use SHT_REL or SHT_RELA relocation
sections, but not both. They defined USE_REL to indicate SHT_REL
@ -462,6 +495,11 @@ static const struct elf_backend_data elfNN_bed =
elf_backend_discard_info,
elf_backend_ignore_discarded_relocs,
elf_backend_write_section,
elf_backend_set_nonloadable_filepos,
elf_backend_is_contained_by_filepos,
elf_backend_copy_private_bfd_data_p,
elf_backend_mips_irix_compat,
elf_backend_mips_rtype_to_howto,
elf_backend_ecoff_debug_swap,
ELF_MACHINE_ALT1,
ELF_MACHINE_ALT2,
@ -484,7 +522,8 @@ static const struct elf_backend_data elfNN_bed =
elf_backend_can_gc_sections,
elf_backend_can_refcount,
elf_backend_want_got_sym,
elf_backend_want_dynbss
elf_backend_want_dynbss,
elf_backend_want_p_paddr_set_to_zero
};
#endif

View File

@ -1,5 +1,5 @@
/* Generic BFD support for file formats.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
Written by Cygnus Support.
@ -355,7 +355,7 @@ bfd_set_format (abfd, format)
}
if (abfd->format != bfd_unknown)
return (abfd->format == format) ? true : false;
return abfd->format == format;
/* Presume the answer is yes. */
abfd->format = format;

View File

@ -1,5 +1,5 @@
/* hash.c -- hash table routines for BFD
Copyright 1993, 1994, 1995, 1997, 1999, 2001
Copyright 1993, 1994, 1995, 1997, 1999, 2001, 2002
Free Software Foundation, Inc.
Written by Steve Chamberlain <sac@cygnus.com>
@ -375,8 +375,8 @@ bfd_hash_lookup (table, string, create, copy)
{
hash += c + (c << 17);
hash ^= hash >> 2;
++len;
}
len = (s - (const unsigned char *) string) - 1;
hash += len + (len << 17);
hash ^= hash >> 2;
@ -407,7 +407,7 @@ bfd_hash_lookup (table, string, create, copy)
bfd_set_error (bfd_error_no_memory);
return (struct bfd_hash_entry *) NULL;
}
strcpy (new, string);
memcpy (new, string, len + 1);
string = new;
}
hashp->string = string;

View File

@ -597,10 +597,9 @@ bfd_i386linux_size_dynamic_sections (output_bfd, info)
{
s->_raw_size = linux_hash_table (info)->fixup_count + 1;
s->_raw_size *= 8;
s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size);
s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->_raw_size);
if (s->contents == NULL)
return false;
memset (s->contents, 0, (size_t) s->_raw_size);
}
return true;

View File

@ -471,7 +471,7 @@ must_parse_int (ieee)
common_header_type *ieee;
{
bfd_vma result;
BFD_ASSERT (parse_int (ieee, &result) == true);
BFD_ASSERT (parse_int (ieee, &result));
return result;
}
@ -983,7 +983,7 @@ ieee_slurp_external_symbols (abfd)
/* Fetch the default size if not resolved */
size = must_parse_int (&(ieee->h));
/* Fetch the defautlt value if available */
if (parse_int (&(ieee->h), &value) == false)
if (! parse_int (&(ieee->h), &value))
{
value = 0;
}
@ -1058,7 +1058,7 @@ static boolean
ieee_slurp_symbol_table (abfd)
bfd *abfd;
{
if (IEEE_DATA (abfd)->read_symbols == false)
if (! IEEE_DATA (abfd)->read_symbols)
{
if (! ieee_slurp_external_symbols (abfd))
return false;
@ -1112,7 +1112,7 @@ ieee_get_symtab (abfd, location)
if (! ieee_slurp_symbol_table (abfd))
return -1;
if (ieee->symbol_table_full == false)
if (! ieee->symbol_table_full)
{
/* Arrgh - there are gaps in the table, run through and fill them */
/* up with pointers to a null place */
@ -1414,7 +1414,7 @@ ieee_archive_p (abfd)
abfd->tdata.ieee_ar_data = (ieee_ar_data_type *) bfd_alloc (abfd, amt);
if (!abfd->tdata.ieee_ar_data)
goto error_return;
goto error_ret_restore;
ieee = IEEE_AR_DATA (abfd);
/* Ignore the return value here. It doesn't matter if we don't read
@ -1530,13 +1530,13 @@ ieee_archive_p (abfd)
return abfd->xvec;
got_wrong_format_error:
bfd_release (abfd, ieee);
abfd->tdata.ieee_ar_data = save;
bfd_set_error (bfd_error_wrong_format);
error_return:
if (elts != NULL)
free (elts);
bfd_release (abfd, ieee);
error_ret_restore:
abfd->tdata.ieee_ar_data = save;
return NULL;
}
@ -1663,11 +1663,11 @@ ieee_object_p (abfd)
}
next_byte (&(ieee->h));
if (parse_int (&(ieee->h), &ieee->ad.number_of_bits_mau) == false)
if (! parse_int (&(ieee->h), &ieee->ad.number_of_bits_mau))
{
goto fail;
}
if (parse_int (&(ieee->h), &ieee->ad.number_of_maus_in_address) == false)
if (! parse_int (&(ieee->h), &ieee->ad.number_of_maus_in_address))
{
goto fail;
}
@ -1690,7 +1690,7 @@ ieee_object_p (abfd)
}
ieee->w.offset[part] = parse_i (&(ieee->h), &ok);
if (ok == false)
if (! ok)
{
goto fail;
}
@ -1732,7 +1732,7 @@ ieee_object_p (abfd)
got_wrong_format:
bfd_set_error (bfd_error_wrong_format);
fail:
(void) bfd_release (abfd, ieee);
bfd_release (abfd, ieee);
abfd->tdata.ieee_data = save;
return (const bfd_target *) NULL;
}
@ -1895,7 +1895,7 @@ do_one (ieee, current_map, location_ptr, s, iterations)
case 0:
case 4:
if (pcrel == true)
if (pcrel)
{
#if KEEPMINUSPCININST
bfd_put_32 (ieee->h.abfd, -current_map->pc,
@ -1917,7 +1917,7 @@ do_one (ieee, current_map, location_ptr, s, iterations)
current_map->pc += 4;
break;
case 2:
if (pcrel == true)
if (pcrel)
{
#if KEEPMINUSPCININST
bfd_put_16 (ieee->h.abfd, (bfd_vma) -current_map->pc,
@ -1941,7 +1941,7 @@ do_one (ieee, current_map, location_ptr, s, iterations)
current_map->pc += 2;
break;
case 1:
if (pcrel == true)
if (pcrel)
{
#if KEEPMINUSPCININST
bfd_put_8 (ieee->h.abfd, (int) (-current_map->pc), location_ptr + current_map->pc);
@ -1969,7 +1969,7 @@ do_one (ieee, current_map, location_ptr, s, iterations)
default:
{
bfd_vma this_size;
if (parse_int (&(ieee->h), &this_size) == true)
if (parse_int (&(ieee->h), &this_size))
{
unsigned int i;
for (i = 0; i < this_size; i++)
@ -2007,7 +2007,7 @@ ieee_slurp_section_data (abfd)
ieee_per_section_type *current_map = (ieee_per_section_type *) NULL;
asection *s;
/* Seek to the start of the data area */
if (ieee->read_data == true)
if (ieee->read_data)
return true;
ieee->read_data = true;
ieee_seek (ieee, ieee->w.r.data_part);
@ -2398,10 +2398,9 @@ do_with_relocs (abfd, s)
if ((PTR) stream == (PTR) NULL)
{
/* Outputting a section without data, fill it up */
stream = (unsigned char *) (bfd_alloc (abfd, s->_raw_size));
stream = (unsigned char *) bfd_zalloc (abfd, s->_raw_size);
if (!stream)
return false;
memset ((PTR) stream, 0, (size_t) s->_raw_size);
}
while (current_byte_index < s->_raw_size)
{
@ -2626,7 +2625,7 @@ ieee_mkobject (abfd)
output_buffer = 0;
amt = sizeof (ieee_data_type);
abfd->tdata.ieee_data = (ieee_data_type *) bfd_zalloc (abfd, amt);
return abfd->tdata.ieee_data ? true : false;
return abfd->tdata.ieee_data != NULL;
}
static void
@ -3943,7 +3942,7 @@ ieee_bfd_debug_info_accumulate (abfd, section)
if (section->owner->xvec != abfd->xvec)
return;
/* Only bother once per bfd */
if (ieee->done_debug == true)
if (ieee->done_debug)
return;
ieee->done_debug = true;
@ -4010,8 +4009,11 @@ ieee_bfd_debug_info_accumulate (abfd, section)
#define ieee_bfd_relax_section bfd_generic_relax_section
#define ieee_bfd_gc_sections bfd_generic_gc_sections
#define ieee_bfd_merge_sections bfd_generic_merge_sections
#define ieee_bfd_discard_group bfd_generic_discard_group
#define ieee_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define ieee_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define ieee_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define ieee_bfd_link_just_syms _bfd_generic_link_just_syms
#define ieee_bfd_final_link _bfd_generic_final_link
#define ieee_bfd_link_split_section _bfd_generic_link_split_section
@ -4084,6 +4086,7 @@ const bfd_target ieee_vec =
/* ieee_sizeof_headers, ieee_bfd_get_relocated_section_contents,
ieee_bfd_relax_section, ieee_bfd_link_hash_table_create,
_bfd_generic_link_hash_table_free,
ieee_bfd_link_add_symbols, ieee_bfd_final_link,
ieee_bfd_link_split_section, ieee_bfd_gc_sections,
ieee_bfd_merge_sections */

View File

@ -3,21 +3,21 @@
Free Software Foundation, Inc.
Written by Ian Lance Taylor of Cygnus Support <ian@cygnus.com>.
This file is part of BFD, the Binary File Descriptor library.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* This is what Intel Hex files look like:
@ -147,12 +147,12 @@ static int ihex_sizeof_headers PARAMS ((bfd *, boolean));
#define CHUNK 16
/* Macros for converting between hex and binary. */
/* Macros for converting between hex and binary. */
#define NIBBLE(x) (hex_value (x))
#define NIBBLE(x) (hex_value (x))
#define HEX2(buffer) ((NIBBLE ((buffer)[0]) << 4) + NIBBLE ((buffer)[1]))
#define HEX4(buffer) ((HEX2 (buffer) << 8) + HEX2 ((buffer) + 2))
#define ISHEX(x) (hex_p (x))
#define ISHEX(x) (hex_p (x))
/* When we write out an ihex value, the values can not be output as
they are seen. Instead, we hold them in memory in this structure. */
@ -193,19 +193,16 @@ static boolean
ihex_mkobject (abfd)
bfd *abfd;
{
if (abfd->tdata.ihex_data == NULL)
{
struct ihex_data_struct *tdata;
bfd_size_type amt = sizeof (struct ihex_data_struct);
struct ihex_data_struct *tdata;
bfd_size_type amt = sizeof (struct ihex_data_struct);
tdata = (struct ihex_data_struct *) bfd_alloc (abfd, amt);
if (tdata == NULL)
return false;
abfd->tdata.ihex_data = tdata;
tdata->head = NULL;
tdata->tail = NULL;
}
tdata = (struct ihex_data_struct *) bfd_alloc (abfd, amt);
if (tdata == NULL)
return false;
abfd->tdata.ihex_data = tdata;
tdata->head = NULL;
tdata->tail = NULL;
return true;
}
@ -288,6 +285,7 @@ ihex_scan (abfd)
lineno = 1;
error = false;
bufsize = 0;
while ((c = ihex_get_byte (abfd, &error)) != EOF)
{
if (c == '\r')
@ -314,11 +312,9 @@ ihex_scan (abfd)
unsigned int chksum;
/* This is a data record. */
pos = bfd_tell (abfd) - 1;
/* Read the header bytes. */
if (bfd_bread (hdr, (bfd_size_type) 8, abfd) != 8)
goto error_return;
@ -336,7 +332,6 @@ ihex_scan (abfd)
type = HEX2 (hdr + 6);
/* Read the data bytes. */
chars = len * 2 + 2;
if (chars >= bufsize)
{
@ -515,6 +510,7 @@ static const bfd_target *
ihex_object_p (abfd)
bfd *abfd;
{
PTR tdata_save;
bfd_byte b[9];
unsigned int i;
unsigned int type;
@ -553,10 +549,14 @@ ihex_object_p (abfd)
}
/* OK, it looks like it really is an Intel Hex file. */
if (! ihex_mkobject (abfd)
|| ! ihex_scan (abfd))
return NULL;
tdata_save = abfd->tdata.any;
if (! ihex_mkobject (abfd) || ! ihex_scan (abfd))
{
if (abfd->tdata.any != tdata_save && abfd->tdata.any != NULL)
bfd_release (abfd, abfd->tdata.any);
abfd->tdata.any = tdata_save;
return NULL;
}
return abfd->xvec;
}
@ -980,8 +980,11 @@ ihex_sizeof_headers (abfd, exec)
#define ihex_bfd_relax_section bfd_generic_relax_section
#define ihex_bfd_gc_sections bfd_generic_gc_sections
#define ihex_bfd_merge_sections bfd_generic_merge_sections
#define ihex_bfd_discard_group bfd_generic_discard_group
#define ihex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define ihex_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define ihex_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define ihex_bfd_link_just_syms _bfd_generic_link_just_syms
#define ihex_bfd_final_link _bfd_generic_final_link
#define ihex_bfd_link_split_section _bfd_generic_link_split_section

View File

@ -302,6 +302,7 @@ enum machine_type {
M_ALPHA_NETBSD = 141, /* NetBSD/alpha binary */
M_ARM6_NETBSD = 143, /* NetBSD/arm32 binary */
M_SPARCLET_1 = 147, /* 0x93, reserved */
M_VAX4K_NETBSD = 150, /* NetBSD/vax 4K pages binary */
M_MIPS1 = 151, /* MIPS R2000/R3000 binary */
M_MIPS2 = 152, /* MIPS R4000/R6000 binary */
M_SPARCLET_2 = 163, /* 0xa3, reserved */

View File

@ -1,7 +1,7 @@
/* libbfd.h -- Declarations used by bfd library *implementation*.
(This include file is not for users of the library.)
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001
2000, 2001, 2002
Free Software Foundation, Inc.
Written by Cygnus Support.
@ -322,10 +322,18 @@ extern boolean _bfd_generic_set_section_contents
((boolean (*) \
PARAMS ((bfd *, struct bfd_link_info *))) \
bfd_false)
#define _bfd_nolink_bfd_discard_group \
((boolean (*) \
PARAMS ((bfd *, struct sec *))) \
bfd_false)
#define _bfd_nolink_bfd_link_hash_table_create \
((struct bfd_link_hash_table *(*) PARAMS ((bfd *))) bfd_nullvoidptr)
#define _bfd_nolink_bfd_link_hash_table_free \
((void (*) PARAMS ((struct bfd_link_hash_table *))) bfd_void)
#define _bfd_nolink_bfd_link_add_symbols \
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
#define _bfd_nolink_bfd_link_just_syms \
((void (*) PARAMS ((asection *, struct bfd_link_info *))) bfd_void)
#define _bfd_nolink_bfd_final_link \
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
#define _bfd_nolink_bfd_link_split_section \
@ -389,6 +397,10 @@ extern boolean _bfd_link_hash_table_init
extern struct bfd_link_hash_table *_bfd_generic_link_hash_table_create
PARAMS ((bfd *));
/* Generic link hash table destruction routine. */
extern void _bfd_generic_link_hash_table_free
PARAMS ((struct bfd_link_hash_table *));
/* Generic add symbol routine. */
extern boolean _bfd_generic_link_add_symbols
PARAMS ((bfd *, struct bfd_link_info *));
@ -404,8 +416,6 @@ extern boolean _bfd_generic_link_add_archive_symbols
PARAMS ((bfd *, struct bfd_link_info *,
boolean (*checkfn) (bfd *, struct bfd_link_info *, boolean *)));
/* Forward declaration to avoid prototype errors. */
typedef struct bfd_link_hash_entry _bfd_link_hash_entry;
@ -415,6 +425,10 @@ extern boolean _bfd_generic_link_add_one_symbol
asection *, bfd_vma, const char *, boolean copy,
boolean constructor, struct bfd_link_hash_entry **));
/* Generic routine to mark section as supplying symbols only. */
extern void _bfd_generic_link_just_syms
PARAMS ((asection *, struct bfd_link_info *));
/* Generic link routine. */
extern boolean _bfd_generic_final_link
PARAMS ((bfd *, struct bfd_link_info *));
@ -579,5 +593,3 @@ extern boolean _bfd_sh_align_load_span
boolean (*) (bfd *, asection *, PTR, bfd_byte *, bfd_vma),
PTR, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, boolean *));
/* And more follows */

View File

@ -1353,8 +1353,8 @@ _bfd_generic_get_section_contents_in_window (abfd, section, w, offset, count)
return bfd_get_section_contents (abfd, section, w->data, offset, count);
}
if (offset + count > section->_raw_size
|| (bfd_get_file_window (abfd, section->filepos + offset, count, w, true)
== false))
|| ! bfd_get_file_window (abfd, section->filepos + offset, count, w,
true))
return false;
return true;
#else

View File

@ -6,7 +6,7 @@
/* libbfd.h -- Declarations used by bfd library *implementation*.
(This include file is not for users of the library.)
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001
2000, 2001, 2002
Free Software Foundation, Inc.
Written by Cygnus Support.
@ -327,10 +327,18 @@ extern boolean _bfd_generic_set_section_contents
((boolean (*) \
PARAMS ((bfd *, struct bfd_link_info *))) \
bfd_false)
#define _bfd_nolink_bfd_discard_group \
((boolean (*) \
PARAMS ((bfd *, struct sec *))) \
bfd_false)
#define _bfd_nolink_bfd_link_hash_table_create \
((struct bfd_link_hash_table *(*) PARAMS ((bfd *))) bfd_nullvoidptr)
#define _bfd_nolink_bfd_link_hash_table_free \
((void (*) PARAMS ((struct bfd_link_hash_table *))) bfd_void)
#define _bfd_nolink_bfd_link_add_symbols \
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
#define _bfd_nolink_bfd_link_just_syms \
((void (*) PARAMS ((asection *, struct bfd_link_info *))) bfd_void)
#define _bfd_nolink_bfd_final_link \
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
#define _bfd_nolink_bfd_link_split_section \
@ -394,6 +402,10 @@ extern boolean _bfd_link_hash_table_init
extern struct bfd_link_hash_table *_bfd_generic_link_hash_table_create
PARAMS ((bfd *));
/* Generic link hash table destruction routine. */
extern void _bfd_generic_link_hash_table_free
PARAMS ((struct bfd_link_hash_table *));
/* Generic add symbol routine. */
extern boolean _bfd_generic_link_add_symbols
PARAMS ((bfd *, struct bfd_link_info *));
@ -409,8 +421,6 @@ extern boolean _bfd_generic_link_add_archive_symbols
PARAMS ((bfd *, struct bfd_link_info *,
boolean (*checkfn) (bfd *, struct bfd_link_info *, boolean *)));
/* Forward declaration to avoid prototype errors. */
typedef struct bfd_link_hash_entry _bfd_link_hash_entry;
@ -420,6 +430,10 @@ extern boolean _bfd_generic_link_add_one_symbol
asection *, bfd_vma, const char *, boolean copy,
boolean constructor, struct bfd_link_hash_entry **));
/* Generic routine to mark section as supplying symbols only. */
extern void _bfd_generic_link_just_syms
PARAMS ((asection *, struct bfd_link_info *));
/* Generic link routine. */
extern boolean _bfd_generic_final_link
PARAMS ((bfd *, struct bfd_link_info *));
@ -584,14 +598,15 @@ extern boolean _bfd_sh_align_load_span
boolean (*) (bfd *, asection *, PTR, bfd_byte *, bfd_vma),
PTR, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, boolean *));
/* And more follows */
/* Extracted from init.c. */
/* Extracted from libbfd.c. */
boolean
bfd_write_bigendian_4byte_int PARAMS ((bfd *, unsigned int));
unsigned int
bfd_log2 PARAMS ((bfd_vma x));
/* Extracted from cache.c. */
#define BFD_CACHE_MAX_OPEN 10
extern bfd *bfd_last_cache;
@ -611,6 +626,7 @@ bfd_open_file PARAMS ((bfd *abfd));
FILE *
bfd_cache_lookup_worker PARAMS ((bfd *abfd));
/* Extracted from reloc.c. */
#ifdef _BFD_MAKE_TABLE_bfd_reloc_code_real
static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
@ -722,6 +738,19 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_ALPHA_GPREL_HI16",
"BFD_RELOC_ALPHA_GPREL_LO16",
"BFD_RELOC_ALPHA_BRSGP",
"BFD_RELOC_ALPHA_TLSGD",
"BFD_RELOC_ALPHA_TLSLDM",
"BFD_RELOC_ALPHA_DTPMOD64",
"BFD_RELOC_ALPHA_GOTDTPREL16",
"BFD_RELOC_ALPHA_DTPREL64",
"BFD_RELOC_ALPHA_DTPREL_HI16",
"BFD_RELOC_ALPHA_DTPREL_LO16",
"BFD_RELOC_ALPHA_DTPREL16",
"BFD_RELOC_ALPHA_GOTTPREL16",
"BFD_RELOC_ALPHA_TPREL64",
"BFD_RELOC_ALPHA_TPREL_HI16",
"BFD_RELOC_ALPHA_TPREL_LO16",
"BFD_RELOC_ALPHA_TPREL16",
"BFD_RELOC_MIPS_JMP",
"BFD_RELOC_MIPS16_JMP",
"BFD_RELOC_MIPS16_GPREL",
@ -752,6 +781,15 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_MIPS_REL16",
"BFD_RELOC_MIPS_RELGOT",
"BFD_RELOC_MIPS_JALR",
"BFD_RELOC_FRV_LABEL16",
"BFD_RELOC_FRV_LABEL24",
"BFD_RELOC_FRV_LO16",
"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_386_GOT32",
"BFD_RELOC_386_PLT32",
@ -761,6 +799,18 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_386_RELATIVE",
"BFD_RELOC_386_GOTOFF",
"BFD_RELOC_386_GOTPC",
"BFD_RELOC_386_TLS_TPOFF",
"BFD_RELOC_386_TLS_IE",
"BFD_RELOC_386_TLS_GOTIE",
"BFD_RELOC_386_TLS_LE",
"BFD_RELOC_386_TLS_GD",
"BFD_RELOC_386_TLS_LDM",
"BFD_RELOC_386_TLS_LDO_32",
"BFD_RELOC_386_TLS_IE_32",
"BFD_RELOC_386_TLS_LE_32",
"BFD_RELOC_386_TLS_DTPMOD32",
"BFD_RELOC_386_TLS_DTPOFF32",
"BFD_RELOC_386_TLS_TPOFF32",
"BFD_RELOC_X86_64_GOT32",
"BFD_RELOC_X86_64_PLT32",
"BFD_RELOC_X86_64_COPY",
@ -967,6 +1017,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_D30V_21_PCREL_R",
"BFD_RELOC_D30V_32",
"BFD_RELOC_D30V_32_PCREL",
"BFD_RELOC_DLX_HI16_S",
"BFD_RELOC_DLX_LO16",
"BFD_RELOC_DLX_JMP26",
"BFD_RELOC_M32R_24",
"BFD_RELOC_M32R_10_PCREL",
"BFD_RELOC_M32R_18_PCREL",
@ -1132,12 +1185,25 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_IA64_IPLTMSB",
"BFD_RELOC_IA64_IPLTLSB",
"BFD_RELOC_IA64_COPY",
"BFD_RELOC_IA64_TPREL22",
"BFD_RELOC_IA64_TPREL64MSB",
"BFD_RELOC_IA64_TPREL64LSB",
"BFD_RELOC_IA64_LTOFF_TP22",
"BFD_RELOC_IA64_LTOFF22X",
"BFD_RELOC_IA64_LDXMOV",
"BFD_RELOC_IA64_TPREL14",
"BFD_RELOC_IA64_TPREL22",
"BFD_RELOC_IA64_TPREL64I",
"BFD_RELOC_IA64_TPREL64MSB",
"BFD_RELOC_IA64_TPREL64LSB",
"BFD_RELOC_IA64_LTOFF_TPREL22",
"BFD_RELOC_IA64_DTPMOD64MSB",
"BFD_RELOC_IA64_DTPMOD64LSB",
"BFD_RELOC_IA64_LTOFF_DTPMOD22",
"BFD_RELOC_IA64_DTPREL14",
"BFD_RELOC_IA64_DTPREL22",
"BFD_RELOC_IA64_DTPREL64I",
"BFD_RELOC_IA64_DTPREL32MSB",
"BFD_RELOC_IA64_DTPREL32LSB",
"BFD_RELOC_IA64_DTPREL64MSB",
"BFD_RELOC_IA64_DTPREL64LSB",
"BFD_RELOC_IA64_LTOFF_DTPREL22",
"BFD_RELOC_M68HC11_HI8",
"BFD_RELOC_M68HC11_LO8",
"BFD_RELOC_M68HC11_3B",
@ -1199,6 +1265,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_XSTORMY16_REL_12",
"BFD_RELOC_XSTORMY16_24",
"BFD_RELOC_XSTORMY16_FPTR16",
"BFD_RELOC_VAX_GLOB_DAT",
"BFD_RELOC_VAX_JMP_SLOT",
"BFD_RELOC_VAX_RELATIVE",
"@@overflow: BFD_RELOC_UNUSED@@",
};
#endif
@ -1226,6 +1295,7 @@ bfd_generic_get_relocated_section_contents PARAMS ((bfd *abfd,
boolean relocateable,
asymbol **symbols));
/* Extracted from archures.c. */
extern const bfd_arch_info_type bfd_default_arch_struct;
boolean
bfd_default_set_arch_mach PARAMS ((bfd *abfd,
@ -1239,6 +1309,7 @@ bfd_default_compatible PARAMS ((const bfd_arch_info_type *a,
boolean
bfd_default_scan PARAMS ((const struct bfd_arch_info *info, const char *string));
/* Extracted from elf.c. */
struct elf_internal_shdr *
bfd_elf_find_section PARAMS ((bfd *abfd, char *name));

View File

@ -1,6 +1,6 @@
/* BFD COFF object file private structure.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001
2000, 2001, 2002
Free Software Foundation, Inc.
Written by Cygnus Support.
@ -580,6 +580,8 @@ extern long _bfd_xcoff_canonicalize_dynamic_reloc
PARAMS ((bfd *, arelent **, asymbol **));
extern struct bfd_link_hash_table *_bfd_xcoff_bfd_link_hash_table_create
PARAMS ((bfd *));
extern void _bfd_xcoff_bfd_link_hash_table_free
PARAMS ((struct bfd_link_hash_table *));
extern boolean _bfd_xcoff_bfd_link_add_symbols
PARAMS ((bfd *, struct bfd_link_info *));
extern boolean _bfd_xcoff_bfd_final_link
@ -596,5 +598,3 @@ extern boolean ppc_allocate_toc_section
extern boolean ppc_process_before_allocation
PARAMS ((bfd *, struct bfd_link_info *));
/* And more taken from the source .. */

View File

@ -4,7 +4,7 @@
/* BFD COFF object file private structure.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001
2000, 2001, 2002
Free Software Foundation, Inc.
Written by Cygnus Support.
@ -584,6 +584,8 @@ extern long _bfd_xcoff_canonicalize_dynamic_reloc
PARAMS ((bfd *, arelent **, asymbol **));
extern struct bfd_link_hash_table *_bfd_xcoff_bfd_link_hash_table_create
PARAMS ((bfd *));
extern void _bfd_xcoff_bfd_link_hash_table_free
PARAMS ((struct bfd_link_hash_table *));
extern boolean _bfd_xcoff_bfd_link_add_symbols
PARAMS ((bfd *, struct bfd_link_info *));
extern boolean _bfd_xcoff_bfd_final_link
@ -600,8 +602,7 @@ extern boolean ppc_allocate_toc_section
extern boolean ppc_process_before_allocation
PARAMS ((bfd *, struct bfd_link_info *));
/* And more taken from the source .. */
/* Extracted from coffcode.h. */
typedef struct coff_ptr_struct
{
/* Remembers the offset from the first symbol in the file for

View File

@ -1,5 +1,5 @@
/* BFD ECOFF object file private structure.
Copyright 1993, 1994, 1995, 1996, 1999, 2001
Copyright 1993, 1994, 1995, 1996, 1999, 2001, 2002
Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
@ -330,8 +330,10 @@ extern int _bfd_ecoff_sizeof_headers PARAMS ((bfd *abfd, boolean reloc));
/* ecoff_bfd_relax_section defined by backend. */
extern struct bfd_link_hash_table *_bfd_ecoff_bfd_link_hash_table_create
PARAMS ((bfd *));
#define _bfd_ecoff_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
extern boolean _bfd_ecoff_bfd_link_add_symbols
PARAMS ((bfd *, struct bfd_link_info *));
#define _bfd_ecoff_bfd_link_just_syms _bfd_generic_link_just_syms
extern boolean _bfd_ecoff_bfd_final_link
PARAMS ((bfd *, struct bfd_link_info *));

View File

@ -1,5 +1,5 @@
/* linker.c -- BFD linker routines
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support
@ -426,7 +426,7 @@ static void set_symbol_from_hash
PARAMS ((asymbol *, struct bfd_link_hash_entry *));
static boolean generic_add_output_symbol
PARAMS ((bfd *, size_t *psymalloc, asymbol *));
static boolean default_fill_link_order
static boolean default_data_link_order
PARAMS ((bfd *, struct bfd_link_info *, asection *,
struct bfd_link_order *));
static boolean default_indirect_link_order
@ -675,7 +675,7 @@ _bfd_generic_link_hash_table_create (abfd)
struct generic_link_hash_table *ret;
bfd_size_type amt = sizeof (struct generic_link_hash_table);
ret = (struct generic_link_hash_table *) bfd_alloc (abfd, amt);
ret = (struct generic_link_hash_table *) bfd_malloc (amt);
if (ret == NULL)
return (struct bfd_link_hash_table *) NULL;
if (! _bfd_link_hash_table_init (&ret->root, abfd,
@ -687,6 +687,17 @@ _bfd_generic_link_hash_table_create (abfd)
return &ret->root;
}
void
_bfd_generic_link_hash_table_free (hash)
struct bfd_link_hash_table *hash;
{
struct generic_link_hash_table *ret
= (struct generic_link_hash_table *) hash;
bfd_hash_table_free (&ret->root.table);
free (ret);
}
/* Grab the symbols for an object file when doing a generic link. We
store the symbols in the outsymbols field. We need to keep them
around for the entire link to ensure that we only read them once.
@ -746,6 +757,19 @@ _bfd_generic_link_add_symbols_collect (abfd, info)
return generic_link_add_symbols (abfd, info, true);
}
/* Indicate that we are only retrieving symbol values from this
section. We want the symbols to act as though the values in the
file are absolute. */
void
_bfd_generic_link_just_syms (sec, info)
asection *sec;
struct bfd_link_info *info ATTRIBUTE_UNUSED;
{
sec->output_section = bfd_abs_section_ptr;
sec->output_offset = sec->vma;
}
/* Add symbols from an object file to the global hash table. */
static boolean
@ -1650,8 +1674,7 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
abort ();
if (! ((*info->callbacks->constructor)
(info,
c == 'I' ? true : false,
(info, c == 'I',
h->root.string, abfd, section, value)))
return false;
}
@ -1789,37 +1812,38 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
/* Fall through. */
case MDEF:
/* Handle a multiple definition. */
{
asection *msec = NULL;
bfd_vma mval = 0;
if (!info->allow_multiple_definition)
{
asection *msec = NULL;
bfd_vma mval = 0;
switch (h->type)
{
case bfd_link_hash_defined:
msec = h->u.def.section;
mval = h->u.def.value;
switch (h->type)
{
case bfd_link_hash_defined:
msec = h->u.def.section;
mval = h->u.def.value;
break;
case bfd_link_hash_indirect:
msec = bfd_ind_section_ptr;
mval = 0;
break;
default:
abort ();
}
/* Ignore a redefinition of an absolute symbol to the
same value; it's harmless. */
if (h->type == bfd_link_hash_defined
&& bfd_is_abs_section (msec)
&& bfd_is_abs_section (section)
&& value == mval)
break;
case bfd_link_hash_indirect:
msec = bfd_ind_section_ptr;
mval = 0;
break;
default:
abort ();
}
/* Ignore a redefinition of an absolute symbol to the same
value; it's harmless. */
if (h->type == bfd_link_hash_defined
&& bfd_is_abs_section (msec)
&& bfd_is_abs_section (section)
&& value == mval)
break;
if (! ((*info->callbacks->multiple_definition)
(info, h->root.string, msec->owner, msec, mval, abfd,
section, value)))
return false;
}
if (! ((*info->callbacks->multiple_definition)
(info, h->root.string, msec->owner, msec, mval,
abfd, section, value)))
return false;
}
break;
case CIND:
@ -1950,12 +1974,12 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
else
{
char *w;
size_t len = strlen (string) + 1;
w = bfd_hash_allocate (&info->hash->table,
strlen (string) + 1);
w = bfd_hash_allocate (&info->hash->table, len);
if (w == NULL)
return false;
strcpy (w, string);
memcpy (w, string, len);
sub->u.i.warning = w;
}
@ -2366,7 +2390,7 @@ _bfd_generic_link_output_symbols (output_bfd, input_bfd, info, psymalloc)
Gross. .bss and similar sections won't have the linker_mark
field set. */
if ((sym->section->flags & SEC_HAS_CONTENTS) != 0
&& sym->section->linker_mark == false)
&& ! sym->section->linker_mark)
output = false;
if (output)
@ -2611,14 +2635,13 @@ bfd_new_link_order (abfd, section)
asection *section;
{
bfd_size_type amt = sizeof (struct bfd_link_order);
struct bfd_link_order *new = (struct bfd_link_order *) bfd_alloc (abfd, amt);
struct bfd_link_order *new;
new = (struct bfd_link_order *) bfd_zalloc (abfd, amt);
if (!new)
return NULL;
new->type = bfd_undefined_link_order;
new->offset = 0;
new->size = 0;
new->next = (struct bfd_link_order *) NULL;
if (section->link_order_tail != (struct bfd_link_order *) NULL)
section->link_order_tail->next = new;
@ -2640,8 +2663,6 @@ _bfd_default_link_order (abfd, info, sec, link_order)
asection *sec;
struct bfd_link_order *link_order;
{
file_ptr loc;
switch (link_order->type)
{
case bfd_undefined_link_order:
@ -2652,29 +2673,23 @@ _bfd_default_link_order (abfd, info, sec, link_order)
case bfd_indirect_link_order:
return default_indirect_link_order (abfd, info, sec, link_order,
false);
case bfd_fill_link_order:
return default_fill_link_order (abfd, info, sec, link_order);
case bfd_data_link_order:
loc = link_order->offset * bfd_octets_per_byte (abfd);
return bfd_set_section_contents (abfd, sec,
(PTR) link_order->u.data.contents,
loc, link_order->size);
return default_data_link_order (abfd, info, sec, link_order);
}
}
/* Default routine to handle a bfd_fill_link_order. */
/* Default routine to handle a bfd_data_link_order. */
static boolean
default_fill_link_order (abfd, info, sec, link_order)
default_data_link_order (abfd, info, sec, link_order)
bfd *abfd;
struct bfd_link_info *info ATTRIBUTE_UNUSED;
asection *sec;
struct bfd_link_order *link_order;
{
bfd_size_type size;
unsigned char *space;
size_t i;
unsigned int fill;
size_t fill_size;
bfd_byte *fill;
file_ptr loc;
boolean result;
@ -2684,24 +2699,37 @@ default_fill_link_order (abfd, info, sec, link_order)
if (size == 0)
return true;
space = (unsigned char *) bfd_malloc (size);
if (space == NULL)
return false;
fill = link_order->u.fill.value;
for (i = 0; i < size; i += 4)
space[i] = fill >> 24;
for (i = 1; i < size; i += 4)
space[i] = fill >> 16;
for (i = 2; i < size; i += 4)
space[i] = fill >> 8;
for (i = 3; i < size; i += 4)
space[i] = fill;
fill = link_order->u.data.contents;
fill_size = link_order->u.data.size;
if (fill_size != 0 && fill_size < size)
{
bfd_byte *p;
fill = (bfd_byte *) bfd_malloc (size);
if (fill == NULL)
return false;
p = fill;
if (fill_size == 1)
memset (p, (int) link_order->u.data.contents[0], (size_t) size);
else
{
do
{
memcpy (p, link_order->u.data.contents, fill_size);
p += fill_size;
size -= fill_size;
}
while (size >= fill_size);
if (size != 0)
memcpy (p, link_order->u.data.contents, (size_t) size);
size = link_order->size;
}
}
loc = link_order->offset * bfd_octets_per_byte (abfd);
result = bfd_set_section_contents (abfd, sec, space, loc, size);
result = bfd_set_section_contents (abfd, sec, fill, loc, size);
free (space);
if (fill != link_order->u.data.contents)
free (fill);
return result;
}

View File

@ -1,22 +1,22 @@
/* SEC_MERGE support.
Copyright 2001 Free Software Foundation, Inc.
Copyright 2001, 2002 Free Software Foundation, Inc.
Written by Jakub Jelinek <jakub@redhat.com>.
This file is part of BFD, the Binary File Descriptor library.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* This file contains support for merging duplicate entities within sections,
as used in ELF SHF_MERGE. */
@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "sysdep.h"
#include "libbfd.h"
#include "hashtab.h"
#include "libiberty.h"
struct sec_merge_sec_info;
@ -38,7 +39,8 @@ struct sec_merge_hash_entry
/* Start of this string needs to be aligned to
alignment octets (not 1 << align). */
unsigned int alignment;
union {
union
{
/* Index within the merged section. */
bfd_size_type index;
/* Entity size (if present in suffix hash tables). */
@ -144,7 +146,7 @@ sec_merge_hash_newfunc (entry, table, string)
ret->next = NULL;
}
return (struct bfd_hash_entry *)ret;
return (struct bfd_hash_entry *) ret;
}
/* Look up an entry in a section merge hash table. */
@ -381,14 +383,6 @@ _bfd_merge_section (abfd, psinfo, sec, psecinfo)
return true;
}
if (sec->output_section != NULL
&& bfd_is_abs_section (sec->output_section))
{
/* The section is being discarded from the link, so we should
just ignore it. */
return true;
}
align = bfd_get_section_alignment (sec->owner, sec);
if ((sec->entsize < (unsigned int)(1 << align)
&& ((sec->entsize & (sec->entsize - 1))
@ -415,15 +409,14 @@ _bfd_merge_section (abfd, psinfo, sec, psecinfo)
if (sinfo == NULL)
{
/* Initialize the information we need to keep track of. */
sinfo = (struct sec_merge_info *)
bfd_alloc (abfd, (bfd_size_type) sizeof (struct sec_merge_info));
amt = sizeof (struct sec_merge_info);
sinfo = (struct sec_merge_info *) bfd_alloc (abfd, amt);
if (sinfo == NULL)
goto error_return;
sinfo->next = (struct sec_merge_info *) *psinfo;
sinfo->chain = NULL;
*psinfo = (PTR) sinfo;
sinfo->htab =
sec_merge_init (sec->entsize, (sec->flags & SEC_STRINGS));
sinfo->htab = sec_merge_init (sec->entsize, (sec->flags & SEC_STRINGS));
if (sinfo->htab == NULL)
goto error_return;
}
@ -650,8 +643,10 @@ merge_strings (sinfo)
qsort (array, (size_t) sinfo->htab->size,
sizeof (struct sec_merge_hash_entry *), cmplengthentry);
last4tab = htab_create ((size_t) sinfo->htab->size * 4, NULL, last4_eq, NULL);
lasttab = htab_create ((size_t) sinfo->htab->size * 4, NULL, last_eq, NULL);
last4tab = htab_create_alloc ((size_t) sinfo->htab->size * 4,
NULL, last4_eq, NULL, calloc, free);
lasttab = htab_create_alloc ((size_t) sinfo->htab->size * 4,
NULL, last_eq, NULL, calloc, free);
if (lasttab == NULL || last4tab == NULL)
goto alloc_failure;
@ -839,10 +834,7 @@ _bfd_merge_sections (abfd, xsinfo, remove_hook)
the hash table at all. */
for (secinfo = sinfo->chain; secinfo; secinfo = secinfo->next)
if (secinfo->first == NULL)
{
secinfo->sec->_cooked_size = 0;
secinfo->sec->flags |= SEC_EXCLUDE;
}
secinfo->sec->_cooked_size = 0;
}
return true;
@ -908,7 +900,7 @@ _bfd_merged_section_offset (output_bfd, psec, psecinfo, offset, addend)
if (sec->entsize == 1)
{
p = secinfo->contents + offset + addend - 1;
while (*p && p >= secinfo->contents)
while (p >= secinfo->contents && *p)
--p;
++p;
}

View File

@ -5,21 +5,21 @@
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
@ -39,9 +39,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* fdopen is a loser -- we should use stdio exclusively. Unfortunately
if we do that we can't use fcntl. */
/* FIXME: This is no longer used. */
long _bfd_chunksize = -1;
/* Return a new BFD. All BFD's are allocated through this routine. */
bfd *
@ -155,7 +152,6 @@ bfd_openr (filename, target)
target_vec = bfd_find_target (target, nbfd);
if (target_vec == NULL)
{
bfd_set_error (bfd_error_invalid_target);
_bfd_delete_bfd (nbfd);
return NULL;
}
@ -165,7 +161,7 @@ bfd_openr (filename, target)
if (bfd_open_file (nbfd) == NULL)
{
/* File didn't exist, or some such */
/* File didn't exist, or some such. */
bfd_set_error (bfd_error_system_call);
_bfd_delete_bfd (nbfd);
return NULL;
@ -180,8 +176,7 @@ bfd_openr (filename, target)
won't cause a storage leak.
o - We open the file stream last, since we don't want to have to
close it if anything goes wrong. Closing the stream means closing
the file descriptor too, even though we didn't open it.
*/
the file descriptor too, even though we didn't open it. */
/*
FUNCTION
bfd_fdopenr
@ -220,11 +215,12 @@ bfd_fdopenr (filename, target, fd)
bfd_set_error (bfd_error_system_call);
#if ! defined(HAVE_FCNTL) || ! defined(F_GETFL)
fdflags = O_RDWR; /* Assume full access */
fdflags = O_RDWR; /* Assume full access. */
#else
fdflags = fcntl (fd, F_GETFL, NULL);
#endif
if (fdflags == -1) return NULL;
if (fdflags == -1)
return NULL;
nbfd = _bfd_new_bfd ();
if (nbfd == NULL)
@ -233,7 +229,6 @@ bfd_fdopenr (filename, target, fd)
target_vec = bfd_find_target (target, nbfd);
if (target_vec == NULL)
{
bfd_set_error (bfd_error_invalid_target);
_bfd_delete_bfd (nbfd);
return NULL;
}
@ -241,7 +236,7 @@ bfd_fdopenr (filename, target, fd)
#ifndef HAVE_FDOPEN
nbfd->iostream = (PTR) fopen (filename, FOPEN_RB);
#else
/* (O_ACCMODE) parens are to avoid Ultrix header file bug */
/* (O_ACCMODE) parens are to avoid Ultrix header file bug. */
switch (fdflags & (O_ACCMODE))
{
case O_RDONLY: nbfd->iostream = (PTR) fdopen (fd, FOPEN_RB); break;
@ -257,14 +252,13 @@ bfd_fdopenr (filename, target, fd)
return NULL;
}
/* OK, put everything where it belongs */
/* OK, put everything where it belongs. */
nbfd->filename = filename;
/* As a special case we allow a FD open for read/write to
be written through, although doing so requires that we end
the previous clause with a preposition. */
/* (O_ACCMODE) parens are to avoid Ultrix header file bug */
/* (O_ACCMODE) parens are to avoid Ultrix header file bug. */
switch (fdflags & (O_ACCMODE))
{
case O_RDONLY: nbfd->direction = read_direction; break;
@ -313,7 +307,6 @@ bfd_openstreamr (filename, target, streamarg)
target_vec = bfd_find_target (target, nbfd);
if (target_vec == NULL)
{
bfd_set_error (bfd_error_invalid_target);
_bfd_delete_bfd (nbfd);
return NULL;
}
@ -331,10 +324,10 @@ bfd_openstreamr (filename, target, streamarg)
return nbfd;
}
/** bfd_openw -- open for writing.
Returns a pointer to a freshly-allocated BFD on success, or NULL.
/* bfd_openw -- open for writing.
Returns a pointer to a freshly-allocated BFD on success, or NULL.
See comment by bfd_fdopenr before you try to modify this function. */
See comment by bfd_fdopenr before you try to modify this function. */
/*
FUNCTION
@ -359,11 +352,8 @@ bfd_openw (filename, target)
bfd *nbfd;
const bfd_target *target_vec;
bfd_set_error (bfd_error_system_call);
/* nbfd has to point to head of malloc'ed block so that bfd_close may
reclaim it correctly. */
reclaim it correctly. */
nbfd = _bfd_new_bfd ();
if (nbfd == NULL)
return NULL;
@ -380,7 +370,8 @@ bfd_openw (filename, target)
if (bfd_open_file (nbfd) == NULL)
{
bfd_set_error (bfd_error_system_call); /* File not writeable, etc */
/* File not writeable, etc. */
bfd_set_error (bfd_error_system_call);
_bfd_delete_bfd (nbfd);
return NULL;
}
@ -419,7 +410,7 @@ bfd_close (abfd)
{
boolean ret;
if (!bfd_read_p (abfd))
if (bfd_write_p (abfd))
{
if (! BFD_SEND_FMT (abfd, _bfd_write_contents, (abfd)))
return false;
@ -431,7 +422,7 @@ bfd_close (abfd)
ret = bfd_cache_close (abfd);
/* If the file was open for writing and is now executable,
make it so */
make it so. */
if (ret
&& abfd->direction == write_direction
&& abfd->flags & EXEC_P)
@ -441,6 +432,7 @@ bfd_close (abfd)
if (stat (abfd->filename, &buf) == 0)
{
unsigned int mask = umask (0);
umask (mask);
chmod (abfd->filename,
(0777
@ -473,7 +465,6 @@ DESCRIPTION
RETURNS
<<true>> is returned if all is ok, otherwise <<false>>.
*/
boolean
@ -485,7 +476,7 @@ bfd_close_all_done (abfd)
ret = bfd_cache_close (abfd);
/* If the file was open for writing and is now executable,
make it so */
make it so. */
if (ret
&& abfd->direction == write_direction
&& abfd->flags & EXEC_P)
@ -495,6 +486,7 @@ bfd_close_all_done (abfd)
if (stat (abfd->filename, &buf) == 0)
{
unsigned int mask = umask (0);
umask (mask);
chmod (abfd->filename,
(0777
@ -519,7 +511,6 @@ DESCRIPTION
<<bfd_openw>>, but without opening a file. The new BFD
takes the target from the target used by @var{template}. The
format is always set to <<bfd_object>>.
*/
bfd *
@ -537,6 +528,7 @@ bfd_create (filename, templ)
nbfd->xvec = templ->xvec;
nbfd->direction = no_direction;
bfd_set_format (nbfd, bfd_object);
return nbfd;
}
@ -572,7 +564,7 @@ bfd_make_writable(abfd)
bim = ((struct bfd_in_memory *)
bfd_malloc ((bfd_size_type) sizeof (struct bfd_in_memory)));
abfd->iostream = (PTR) bim;
/* bfd_bwrite will grow these as needed */
/* bfd_bwrite will grow these as needed. */
bim->size = 0;
bim->buffer = 0;
@ -639,7 +631,7 @@ bfd_make_readable(abfd)
abfd->tdata.any = 0;
bfd_section_list_clear (abfd);
bfd_check_format(abfd, bfd_object);
bfd_check_format (abfd, bfd_object);
return true;
}

View File

@ -1,21 +1,21 @@
/* BFD back-end for Intel 386 PECOFF files.
Copyright 1995, 1996, 1999, 2001 Free Software Foundation, Inc.
Copyright 1995, 1996, 1999, 2001, 2002 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
@ -29,6 +29,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define COFF_LONG_FILENAMES
#define COFF_SECTION_ALIGNMENT_ENTRIES \
{ COFF_SECTION_NAME_EXACT_MATCH (".bss"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
{ COFF_SECTION_NAME_EXACT_MATCH (".data"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
{ COFF_SECTION_NAME_EXACT_MATCH (".text"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
{ COFF_SECTION_NAME_PARTIAL_MATCH (".idata"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
{ COFF_SECTION_NAME_EXACT_MATCH (".pdata"), \

View File

@ -3,21 +3,21 @@
Free Software Foundation, Inc.
Written by Cygnus Solutions.
This file is part of BFD, the Binary File Descriptor library.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Most of this hacked by Steve Chamberlain <sac@cygnus.com>.
@ -620,7 +620,7 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out)
extra->NumberOfRvaAndSizes = IMAGE_NUMBEROF_DIRECTORY_ENTRIES;
/* first null out all data directory entries .. */
memset (extra->DataDirectory, sizeof (extra->DataDirectory), 0);
memset (extra->DataDirectory, 0, sizeof (extra->DataDirectory));
add_data_entry (abfd, extra, 0, ".edata", ib);
@ -1142,6 +1142,7 @@ pe_print_idata (abfd, vfile)
adj = section->vma - extra->ImageBase;
/* Print all image import descriptors. */
for (i = 0; i < datasize; i += onaline)
{
bfd_vma hint_addr;
@ -1153,7 +1154,7 @@ pe_print_idata (abfd, vfile)
bfd_size_type j;
char *dll;
/* print (i + extra->DataDirectory[1].VirtualAddress) */
/* Print (i + extra->DataDirectory[1].VirtualAddress). */
fprintf (file, " %08lx\t", (unsigned long) (i + adj + dataoff));
#if 0
if (i + 20 > datasize)
@ -1181,19 +1182,83 @@ pe_print_idata (abfd, vfile)
if (hint_addr != 0)
{
fprintf (file, _("\tvma: Hint/Ord Member-Name\n"));
bfd_byte *ft_data;
asection *ft_section;
bfd_vma ft_addr;
bfd_size_type ft_datasize;
int ft_idx;
int ft_allocated = 0;
fprintf (file, _("\tvma: Hint/Ord Member-Name Bound-To\n"));
idx = hint_addr - adj;
ft_addr = first_thunk + extra->ImageBase;
ft_data = data;
ft_idx = first_thunk - adj;
ft_allocated = 0;
if (first_thunk != hint_addr)
{
/* Find the section which contains the first thunk. */
for (ft_section = abfd->sections;
ft_section != NULL;
ft_section = ft_section->next)
{
ft_datasize = bfd_section_size (abfd, ft_section);
if (ft_addr >= ft_section->vma
&& ft_addr < ft_section->vma + ft_datasize)
break;
}
if (ft_section == NULL)
{
fprintf (file,
_("\nThere is a first thunk, but the section containing it could not be found\n"));
continue;
}
/* Now check to see if this section is the same as our current
section. If it is not then we will have to load its data in. */
if (ft_section == section)
{
ft_data = data;
ft_idx = first_thunk - adj;
}
else
{
ft_idx = first_thunk - (ft_section->vma - extra->ImageBase);
ft_data = (bfd_byte *) bfd_malloc (datasize);
if (ft_data == NULL)
continue;
/* Read datasize bfd_bytes starting at offset ft_idx. */
if (! bfd_get_section_contents (abfd, ft_section,
(PTR) ft_data,
(bfd_vma) ft_idx,
datasize))
{
free (ft_data);
continue;
}
ft_idx = 0;
ft_allocated = 1;
}
}
/* Print HintName vector entries. */
for (j = 0; j < datasize; j += 4)
{
unsigned long member = bfd_get_32 (abfd, data + idx + j);
/* Print single IMAGE_IMPORT_BY_NAME vector. */
if (member == 0)
break;
if (member & 0x80000000)
fprintf (file, "\t%04lx\t %4lu", member,
member & 0x7fffffff);
fprintf (file, "\t%04lx\t %4lu <none>",
member, member & 0x7fffffff);
else
{
int ordinal;
@ -1206,69 +1271,18 @@ pe_print_idata (abfd, vfile)
}
/* If the time stamp is not zero, the import address
table holds actual addresses. */
table holds actual addresses. */
if (time_stamp != 0
&& first_thunk != 0
&& first_thunk != hint_addr)
fprintf (file, "\t%04lx",
(long) bfd_get_32 (abfd, data + first_thunk - adj + j));
(long) bfd_get_32 (abfd, ft_data + ft_idx + j));
fprintf (file, "\n");
}
}
if (hint_addr != first_thunk && time_stamp == 0)
{
int differ = 0;
int idx2;
idx2 = first_thunk - adj;
for (j = 0; j < datasize; j += 4)
{
int ordinal;
char *member_name;
bfd_vma hint_member = 0;
bfd_vma iat_member;
if (hint_addr != 0)
hint_member = bfd_get_32 (abfd, data + idx + j);
iat_member = bfd_get_32 (abfd, data + idx2 + j);
if (hint_addr == 0 && iat_member == 0)
break;
if (hint_addr == 0 || hint_member != iat_member)
{
if (differ == 0)
{
fprintf (file,
_("\tThe Import Address Table (difference found)\n"));
fprintf (file, _("\tvma: Hint/Ord Member-Name\n"));
differ = 1;
}
if (iat_member == 0)
fprintf (file,
_("\t>>> Ran out of IAT members!\n"));
else
{
ordinal = bfd_get_16 (abfd, data + iat_member - adj);
member_name = (char *) data + iat_member - adj + 2;
fprintf (file, "\t%04lx\t %4d %s\n",
(unsigned long) iat_member,
ordinal,
member_name);
}
}
if (hint_addr != 0 && hint_member == 0)
break;
}
if (differ == 0)
fprintf (file,
_("\tThe Import Address Table is identical\n"));
if (ft_allocated)
free (ft_data);
}
fprintf (file, "\n");

View File

@ -1,4 +1,5 @@
aix386-core.c
aix5ppc-core.c
aout-adobe.c
aout-arm.c
aout-cris.c
@ -64,7 +65,9 @@ cpu-avr.c
cpu-cris.c
cpu-d10v.c
cpu-d30v.c
cpu-dlx.c
cpu-fr30.c
cpu-frv.c
cpu-h8300.c
cpu-h8500.c
cpu-hppa.c
@ -123,13 +126,16 @@ elf32-avr.c
elf32-cris.c
elf32-d10v.c
elf32-d30v.c
elf32-dlx.c
elf32-fr30.c
elf32-frv.c
elf32-gen.c
elf32-h8300.c
elf32-hppa.c
elf32-hppa.h
elf32-i370.c
elf32-i386.c
elf32-i386qnx.c
elf32-i860.c
elf32-i960.c
elf32-m32r.c
@ -147,9 +153,12 @@ elf32-s390.c
elf32-sh-lin.c
elf32-sh-nbsd.c
elf32-sh.c
elf32-sh64-com.c
elf32-sh64-nbsd.c
elf32-sh64.c
elf32-sparc.c
elf32-v850.c
elf32-vax.c
elf32-xstormy16.c
elf32.c
elf64-alpha.c
@ -160,6 +169,7 @@ elf64-mips.c
elf64-mmix.c
elf64-ppc.c
elf64-s390.c
elf64-sh64-nbsd.c
elf64-sh64.c
elf64-sparc.c
elf64-x86-64.c
@ -170,6 +180,7 @@ elfcode.h
elfcore.h
elflink.c
elflink.h
elfxx-mips.c
epoc-pe-arm.c
epoc-pei-arm.c
format.c
@ -266,6 +277,8 @@ syms.c
targets.c
tekhex.c
trad-core.c
vax1knetbsd.c
vaxbsd.c
vaxnetbsd.c
versados.c
version.h

File diff suppressed because it is too large Load Diff

View File

@ -469,8 +469,11 @@ ppcboot_bfd_print_private_bfd_data (abfd, farg)
#define ppcboot_bfd_relax_section bfd_generic_relax_section
#define ppcboot_bfd_gc_sections bfd_generic_gc_sections
#define ppcboot_bfd_merge_sections bfd_generic_merge_sections
#define ppcboot_bfd_discard_group bfd_generic_discard_group
#define ppcboot_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define ppcboot_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define ppcboot_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define ppcboot_bfd_link_just_syms _bfd_generic_link_just_syms
#define ppcboot_bfd_final_link _bfd_generic_final_link
#define ppcboot_bfd_link_split_section _bfd_generic_link_split_section
#define ppcboot_get_section_contents_in_window \

View File

@ -645,7 +645,7 @@ bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd,
reloc_target_output_section = symbol->section->output_section;
/* Convert input-section-relative symbol value to absolute. */
if (output_bfd && howto->partial_inplace == false)
if (output_bfd && ! howto->partial_inplace)
output_base = 0;
else
output_base = reloc_target_output_section->vma;
@ -658,7 +658,7 @@ bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd,
/* Here the variable relocation holds the final address of the
symbol we are relocating against, plus any addend. */
if (howto->pc_relative == true)
if (howto->pc_relative)
{
/* This is a PC relative relocation. We want to set RELOCATION
to the distance between the address of the symbol and the
@ -691,13 +691,13 @@ bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd,
relocation -=
input_section->output_section->vma + input_section->output_offset;
if (howto->pcrel_offset == true)
if (howto->pcrel_offset)
relocation -= reloc_entry->address;
}
if (output_bfd != (bfd *) NULL)
{
if (howto->partial_inplace == false)
if (! howto->partial_inplace)
{
/* This is a partial relocation, and we want to apply the relocation
to the reloc entry rather than the raw data. Modify the reloc
@ -1037,7 +1037,7 @@ bfd_install_relocation (abfd, reloc_entry, data_start, data_start_offset,
reloc_target_output_section = symbol->section->output_section;
/* Convert input-section-relative symbol value to absolute. */
if (howto->partial_inplace == false)
if (! howto->partial_inplace)
output_base = 0;
else
output_base = reloc_target_output_section->vma;
@ -1050,7 +1050,7 @@ bfd_install_relocation (abfd, reloc_entry, data_start, data_start_offset,
/* Here the variable relocation holds the final address of the
symbol we are relocating against, plus any addend. */
if (howto->pc_relative == true)
if (howto->pc_relative)
{
/* This is a PC relative relocation. We want to set RELOCATION
to the distance between the address of the symbol and the
@ -1083,11 +1083,11 @@ bfd_install_relocation (abfd, reloc_entry, data_start, data_start_offset,
relocation -=
input_section->output_section->vma + input_section->output_offset;
if (howto->pcrel_offset == true && howto->partial_inplace == true)
if (howto->pcrel_offset && howto->partial_inplace)
relocation -= reloc_entry->address;
}
if (howto->partial_inplace == false)
if (! howto->partial_inplace)
{
/* This is a partial relocation, and we want to apply the relocation
to the reloc entry rather than the raw data. Modify the reloc
@ -1962,6 +1962,35 @@ ENUMDOC
share a common GP, and the target address is adjusted for
STO_ALPHA_STD_GPLOAD.
ENUM
BFD_RELOC_ALPHA_TLSGD
ENUMX
BFD_RELOC_ALPHA_TLSLDM
ENUMX
BFD_RELOC_ALPHA_DTPMOD64
ENUMX
BFD_RELOC_ALPHA_GOTDTPREL16
ENUMX
BFD_RELOC_ALPHA_DTPREL64
ENUMX
BFD_RELOC_ALPHA_DTPREL_HI16
ENUMX
BFD_RELOC_ALPHA_DTPREL_LO16
ENUMX
BFD_RELOC_ALPHA_DTPREL16
ENUMX
BFD_RELOC_ALPHA_GOTTPREL16
ENUMX
BFD_RELOC_ALPHA_TPREL64
ENUMX
BFD_RELOC_ALPHA_TPREL_HI16
ENUMX
BFD_RELOC_ALPHA_TPREL_LO16
ENUMX
BFD_RELOC_ALPHA_TPREL16
ENUMDOC
Alpha thread-local storage relocations.
ENUM
BFD_RELOC_MIPS_JMP
ENUMDOC
@ -2050,6 +2079,27 @@ ENUMX
ENUMX
BFD_RELOC_MIPS_JALR
COMMENT
ENUM
BFD_RELOC_FRV_LABEL16
ENUMX
BFD_RELOC_FRV_LABEL24
ENUMX
BFD_RELOC_FRV_LO16
ENUMX
BFD_RELOC_FRV_HI16
ENUMX
BFD_RELOC_FRV_GPREL12
ENUMX
BFD_RELOC_FRV_GPRELU12
ENUMX
BFD_RELOC_FRV_GPREL32
ENUMX
BFD_RELOC_FRV_GPRELHI
ENUMX
BFD_RELOC_FRV_GPRELLO
ENUMDOC
Fujitsu Frv Relocations.
COMMENT
COMMENT
ENUMDOC
MIPS ELF relocations.
@ -2072,6 +2122,30 @@ ENUMX
BFD_RELOC_386_GOTOFF
ENUMX
BFD_RELOC_386_GOTPC
ENUMX
BFD_RELOC_386_TLS_TPOFF
ENUMX
BFD_RELOC_386_TLS_IE
ENUMX
BFD_RELOC_386_TLS_GOTIE
ENUMX
BFD_RELOC_386_TLS_LE
ENUMX
BFD_RELOC_386_TLS_GD
ENUMX
BFD_RELOC_386_TLS_LDM
ENUMX
BFD_RELOC_386_TLS_LDO_32
ENUMX
BFD_RELOC_386_TLS_IE_32
ENUMX
BFD_RELOC_386_TLS_LE_32
ENUMX
BFD_RELOC_386_TLS_DTPMOD32
ENUMX
BFD_RELOC_386_TLS_DTPOFF32
ENUMX
BFD_RELOC_386_TLS_TPOFF32
ENUMDOC
i386/elf relocations
@ -2597,6 +2671,19 @@ ENUM
ENUMDOC
This is a 32-bit pc-relative reloc.
ENUM
BFD_RELOC_DLX_HI16_S
ENUMDOC
DLX relocs
ENUM
BFD_RELOC_DLX_LO16
ENUMDOC
DLX relocs
ENUM
BFD_RELOC_DLX_JMP26
ENUMDOC
DLX relocs
ENUM
BFD_RELOC_M32R_24
ENUMDOC
@ -3184,18 +3271,44 @@ ENUMX
BFD_RELOC_IA64_IPLTLSB
ENUMX
BFD_RELOC_IA64_COPY
ENUMX
BFD_RELOC_IA64_LTOFF22X
ENUMX
BFD_RELOC_IA64_LDXMOV
ENUMX
BFD_RELOC_IA64_TPREL14
ENUMX
BFD_RELOC_IA64_TPREL22
ENUMX
BFD_RELOC_IA64_TPREL64I
ENUMX
BFD_RELOC_IA64_TPREL64MSB
ENUMX
BFD_RELOC_IA64_TPREL64LSB
ENUMX
BFD_RELOC_IA64_LTOFF_TP22
BFD_RELOC_IA64_LTOFF_TPREL22
ENUMX
BFD_RELOC_IA64_LTOFF22X
BFD_RELOC_IA64_DTPMOD64MSB
ENUMX
BFD_RELOC_IA64_LDXMOV
BFD_RELOC_IA64_DTPMOD64LSB
ENUMX
BFD_RELOC_IA64_LTOFF_DTPMOD22
ENUMX
BFD_RELOC_IA64_DTPREL14
ENUMX
BFD_RELOC_IA64_DTPREL22
ENUMX
BFD_RELOC_IA64_DTPREL64I
ENUMX
BFD_RELOC_IA64_DTPREL32MSB
ENUMX
BFD_RELOC_IA64_DTPREL32LSB
ENUMX
BFD_RELOC_IA64_DTPREL64MSB
ENUMX
BFD_RELOC_IA64_DTPREL64LSB
ENUMX
BFD_RELOC_IA64_LTOFF_DTPREL22
ENUMDOC
Intel IA64 Relocations.
@ -3363,6 +3476,15 @@ ENUMX
ENUMDOC
Sony Xstormy16 Relocations.
ENUM
BFD_RELOC_VAX_GLOB_DAT
ENUMX
BFD_RELOC_VAX_JMP_SLOT
ENUMX
BFD_RELOC_VAX_RELATIVE
ENUMDOC
Relocations used by VAX ELF.
ENDSENUM
BFD_RELOC_UNUSED
CODE_FRAGMENT

View File

@ -196,8 +196,7 @@ bfd_coff_reloc16_relax_section (abfd, input_section, link_info, again)
The last element is used as an accumlator of shrinks. */
amt = reloc_count + 1;
amt *= sizeof (unsigned);
shrinks = (unsigned *) bfd_malloc (amt);
memset (shrinks, 0, (size_t) amt);
shrinks = (unsigned *) bfd_zmalloc (amt);
/* Loop until nothing changes in this section. */
do {

View File

@ -11,21 +11,21 @@
Archive support from Damon A. Permezel.
Contributed by IBM Corporation and Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* This port currently only handles reading object files, except when
compiled on an RS/6000 host. -- no archive support, no core files.

View File

@ -230,12 +230,6 @@ CODE_FRAGMENT
. standard data. *}
.#define SEC_CONSTRUCTOR 0x100
.
. {* The section is a constructor, and should be placed at the
. end of the text, data, or bss section(?). *}
.#define SEC_CONSTRUCTOR_TEXT 0x1100
.#define SEC_CONSTRUCTOR_DATA 0x2100
.#define SEC_CONSTRUCTOR_BSS 0x3100
.
. {* The section has contents - a data section could be
. <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be
. <<SEC_HAS_CONTENTS>> *}
@ -256,6 +250,9 @@ CODE_FRAGMENT
. sections. *}
.#define SEC_COFF_SHARED_LIBRARY 0x800
.
. {* The section contains thread local data. *}
.#define SEC_THREAD_LOCAL 0x1000
.
. {* The section has GOT references. This flag is only for the
. linker, and is currently only used by the elf32-hppa back end.
. It will be set if global offset table references were detected
@ -801,7 +798,7 @@ bfd_get_unique_section_name (abfd, templat, count)
sname = bfd_malloc ((bfd_size_type) len + 8);
if (sname == NULL)
return NULL;
strcpy (sname, templat);
memcpy (sname, templat, len);
num = 1;
if (count != NULL)
num = *count;
@ -1304,77 +1301,57 @@ SYNOPSIS
DESCRIPTION
Remove @var{section} from the output. If the output section
becomes empty, remove it from the output bfd. @var{info} may
be NULL; if it is not, it is used to decide whether the output
section is empty.
becomes empty, remove it from the output bfd.
This function won't actually do anything except twiddle flags
if called too late in the linking process, when it's not safe
to remove sections.
*/
void
_bfd_strip_section_from_output (info, s)
struct bfd_link_info *info;
asection *s;
{
asection **spp, *os;
struct bfd_link_order *p, *pp;
boolean keep_os;
/* Excise the input section from the link order.
FIXME: For all calls that I can see to this function, the link
orders have not yet been set up. So why are we checking them? --
Ian */
os = s->output_section;
/* Handle a section that wasn't output. */
if (os == NULL)
return;
for (p = os->link_order_head, pp = NULL; p != NULL; pp = p, p = p->next)
if (p->type == bfd_indirect_link_order
&& p->u.indirect.section == s)
{
if (pp)
pp->next = p->next;
else
os->link_order_head = p->next;
if (!p->next)
os->link_order_tail = pp;
break;
}
keep_os = os->link_order_head != NULL;
if (! keep_os && info != NULL)
{
bfd *abfd;
for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link_next)
{
asection *is;
for (is = abfd->sections; is != NULL; is = is->next)
{
if (is != s && is->output_section == os
&& (is->flags & SEC_EXCLUDE) == 0)
break;
}
if (is != NULL)
break;
}
if (abfd != NULL)
keep_os = true;
}
/* If the output section is empty, remove it too. Careful about sections
that have been discarded in the link script -- they are mapped to
bfd_abs_section, which has no owner. */
if (!keep_os && os->owner != NULL)
{
for (spp = &os->owner->sections; *spp; spp = &(*spp)->next)
if (*spp == os)
{
bfd_section_list_remove (os->owner, spp);
os->owner->section_count--;
break;
}
}
asection *os;
asection *is;
bfd *abfd;
s->flags |= SEC_EXCLUDE;
/* If the section wasn't assigned to an output section, or the
section has been discarded by the linker script, there's nothing
more to do. */
os = s->output_section;
if (os == NULL || os->owner == NULL)
return;
/* If the output section has other (non-excluded) input sections, we
can't remove it. */
for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link_next)
for (is = abfd->sections; is != NULL; is = is->next)
if (is->output_section == os && (is->flags & SEC_EXCLUDE) == 0)
return;
/* If the output section is empty, flag it for removal too.
See ldlang.c:strip_excluded_output_sections for the action. */
os->flags |= SEC_EXCLUDE;
}
/*
FUNCTION
bfd_generic_discard_group
SYNOPSIS
boolean bfd_generic_discard_group (bfd *abfd, asection *group);
DESCRIPTION
Remove all members of @var{group} from the output.
*/
boolean
bfd_generic_discard_group (abfd, group)
bfd *abfd ATTRIBUTE_UNUSED;
asection *group ATTRIBUTE_UNUSED;
{
return true;
}

View File

@ -230,7 +230,7 @@ linux_link_hash_table_create (abfd)
struct linux_link_hash_table *ret;
bfd_size_type amt = sizeof (struct linux_link_hash_table);
ret = (struct linux_link_hash_table *) bfd_alloc (abfd, amt);
ret = (struct linux_link_hash_table *) bfd_malloc (amt);
if (ret == (struct linux_link_hash_table *) NULL)
return (struct bfd_link_hash_table *) NULL;
if (! NAME(aout,link_hash_table_init) (&ret->root, abfd,
@ -599,10 +599,9 @@ bfd_sparclinux_size_dynamic_sections (output_bfd, info)
{
s->_raw_size = linux_hash_table (info)->fixup_count + 1;
s->_raw_size *= 8;
s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size);
s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->_raw_size);
if (s->contents == NULL)
return false;
memset (s->contents, 0, (size_t) s->_raw_size);
}
return true;

View File

@ -160,7 +160,7 @@ srec_init ()
{
static boolean inited = false;
if (inited == false)
if (! inited)
{
inited = true;
hex_init ();
@ -230,22 +230,23 @@ static boolean
srec_mkobject (abfd)
bfd *abfd;
{
bfd_size_type amt;
tdata_type *tdata;
srec_init ();
if (abfd->tdata.srec_data == NULL)
{
bfd_size_type amt = sizeof (tdata_type);
tdata_type *tdata = (tdata_type *) bfd_alloc (abfd, amt);
if (tdata == NULL)
return false;
abfd->tdata.srec_data = tdata;
tdata->type = 1;
tdata->head = NULL;
tdata->tail = NULL;
tdata->symbols = NULL;
tdata->symtail = NULL;
tdata->csymbols = NULL;
}
amt = sizeof (tdata_type);
tdata = (tdata_type *) bfd_alloc (abfd, amt);
if (tdata == NULL)
return false;
abfd->tdata.srec_data = tdata;
tdata->type = 1;
tdata->head = NULL;
tdata->tail = NULL;
tdata->symbols = NULL;
tdata->symtail = NULL;
tdata->csymbols = NULL;
return true;
}
@ -640,6 +641,7 @@ static const bfd_target *
srec_object_p (abfd)
bfd *abfd;
{
PTR tdata_save;
bfd_byte b[4];
srec_init ();
@ -654,9 +656,14 @@ srec_object_p (abfd)
return NULL;
}
if (! srec_mkobject (abfd)
|| ! srec_scan (abfd))
return NULL;
tdata_save = abfd->tdata.any;
if (! srec_mkobject (abfd) || ! srec_scan (abfd))
{
if (abfd->tdata.any != tdata_save && abfd->tdata.any != NULL)
bfd_release (abfd, abfd->tdata.any);
abfd->tdata.any = tdata_save;
return NULL;
}
if (abfd->symcount > 0)
abfd->flags |= HAS_SYMS;
@ -670,6 +677,7 @@ static const bfd_target *
symbolsrec_object_p (abfd)
bfd *abfd;
{
PTR tdata_save;
char b[2];
srec_init ();
@ -684,9 +692,14 @@ symbolsrec_object_p (abfd)
return NULL;
}
if (! srec_mkobject (abfd)
|| ! srec_scan (abfd))
return NULL;
tdata_save = abfd->tdata.any;
if (! srec_mkobject (abfd) || ! srec_scan (abfd))
{
if (abfd->tdata.any != tdata_save && abfd->tdata.any != NULL)
bfd_release (abfd, abfd->tdata.any);
abfd->tdata.any = tdata_save;
return NULL;
}
if (abfd->symcount > 0)
abfd->flags |= HAS_SYMS;
@ -1270,8 +1283,11 @@ srec_print_symbol (abfd, afile, symbol, how)
#define srec_bfd_relax_section bfd_generic_relax_section
#define srec_bfd_gc_sections bfd_generic_gc_sections
#define srec_bfd_merge_sections bfd_generic_merge_sections
#define srec_bfd_discard_group bfd_generic_discard_group
#define srec_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define srec_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define srec_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define srec_bfd_link_just_syms _bfd_generic_link_just_syms
#define srec_bfd_final_link _bfd_generic_final_link
#define srec_bfd_link_split_section _bfd_generic_link_split_section

View File

@ -284,6 +284,7 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo)
sym < symend;
sym += STABSIZE, ++pstridx)
{
bfd_size_type symstroff;
int type;
const char *string;
@ -311,9 +312,18 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo)
}
/* Store the string in the hash table, and record the index. */
string = ((char *) stabstrbuf
+ stroff
+ bfd_get_32 (abfd, sym + STRDXOFF));
symstroff = stroff + bfd_get_32 (abfd, sym + STRDXOFF);
if (symstroff >= stabstrsec->_raw_size)
{
(*_bfd_error_handler)
(_("%s(%s+0x%lx): Stabs entry has invalid string index."),
bfd_archive_filename (abfd),
bfd_get_section_name (abfd, stabsec),
(long) (sym - stabbuf));
bfd_set_error (bfd_error_bad_value);
goto error_return;
}
string = (char *) stabstrbuf + symstroff;
*pstridx = _bfd_stringtab_add (sinfo->strings, string, true, true);
/* An N_BINCL symbol indicates the start of the stabs entries

View File

@ -717,13 +717,13 @@ sunos_link_hash_table_create (abfd)
struct sunos_link_hash_table *ret;
bfd_size_type amt = sizeof (struct sunos_link_hash_table);
ret = (struct sunos_link_hash_table *) bfd_alloc (abfd, amt);
ret = (struct sunos_link_hash_table *) bfd_malloc (amt);
if (ret == (struct sunos_link_hash_table *) NULL)
return (struct bfd_link_hash_table *) NULL;
if (! NAME(aout,link_hash_table_init) (&ret->root, abfd,
sunos_link_hash_newfunc))
{
bfd_release (abfd, ret);
free (ret);
return (struct bfd_link_hash_table *) NULL;
}
@ -1434,10 +1434,9 @@ bfd_sunos_size_dynamic_sections (output_bfd, info, sdynptr, sneedptr,
s = bfd_get_section_by_name (dynobj, ".hash");
BFD_ASSERT (s != NULL);
hashalloc = (dynsymcount + bucketcount - 1) * HASH_ENTRY_SIZE;
s->contents = (bfd_byte *) bfd_alloc (dynobj, hashalloc);
s->contents = (bfd_byte *) bfd_zalloc (dynobj, hashalloc);
if (s->contents == NULL && dynsymcount > 0)
return false;
memset (s->contents, 0, (size_t) hashalloc);
for (i = 0; i < bucketcount; i++)
PUT_WORD (output_bfd, (bfd_vma) -1, s->contents + i * HASH_ENTRY_SIZE);
s->_raw_size = bucketcount * HASH_ENTRY_SIZE;

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