Merge ^vendor/binutils/dist@214082 into contrib/binutils.

This commit is contained in:
Dimitry Andric 2010-10-21 19:11:14 +00:00
commit dfd2f2d4bb
836 changed files with 244335 additions and 159394 deletions

File diff suppressed because it is too large Load diff

View file

@ -4,8 +4,12 @@ Please do not make ChangeLog entries.
COPYING, COPYING.LIB, README
http://gnu.org.
Makefile.in; configure; configure.in; src-release
Please notify the following of any committed patches.
Makefile.*; configure; configure.in; src-release
Any global maintainer can approve changes to these
files, but they should be aware that they need to
be kept in sync with their counterparts in the GCC
repository. Also please notify the following of
any committed patches:
binutils@sources.redhat.com
gdb-patches@sources.redhat.com
@ -21,8 +25,7 @@ cgen/; cgen parts of opcodes/, sim/ & include/
May need separate opcodes/ or sim/ approval for
commits of regenerated files there.
config.guess; config.sub; dejagnu/config.guess; dejagnu/config.sub;
readline/support/config.sub; readline/support/config.guess
config.guess; config.sub; readline/support/config.{sub,guess}
config: http://savannah.gnu.org/projects/config
Patches to config-patches@gnu.org.
Changes need to be done in tandem with the official CONFIG
@ -33,18 +36,13 @@ readline/support/config.sub; readline/support/config.guess
binutils@sources.redhat.com
gdb-patches@sources.redhat.com
dejagnu/
dejagnu: http://www.gnu.org/software/dejagnu/
Patches to bug-dejagnu@gnu.org
Avoid making changes to the local repository; please send
patches upstream. Important and approved patches can be
checked into the src repository, otheriwse patches will be
imported from the next release.
depcomp
Send bug reports and patches to bug-automake@gnu.org.
gdb/; mmalloc/; readline/; sim/; GDB's part of include/ & dejagnu/
gdb: http://sources.redhat.com/gdb/
gdb/; readline/; sim/; GDB's part of include/
GDB: http://www.gnu.org/software/gdb/
Patches to gdb-patches@sources.redhat.com.
See also gdb/MAINTAINERS, sim/MAINTAINERS, mmalloc/MAINTAINERS.
See also gdb/MAINTAINERS and sim/MAINTAINERS.
include/
See binutils/, gdb/, sid/, gcc/, libiberty/ etc.
@ -59,8 +57,8 @@ libiberty/; libiberty's part of include/
Otherwise, changes are automatically merged, usually within
a day.
ltconfig; ltmain.sh
libtool: http://gnu.org
ltconfig; ltmain.sh; ltcf-*.sh
libtool: http://www.gnu.org/software/libtool/
Changes need to be done in tandem with the official LIBTOOL
sources or submitted to the master file maintainer and brought
in via a merge.
@ -80,7 +78,7 @@ newlib/; libgloss/
http://sources.redhat.com/newlib/
Patches to newlib@sources.redhat.com.
sid/; SID's part of cgen/ & dejagnu/
sid/; SID's part of cgen/
sid: http://sources.redhat.com/sid/
Patches to sid@sources.redhat.com
@ -100,10 +98,17 @@ winsup/
General discussion cygwin@sources.redhat.com.
See also winsup/MAINTAINERS.
expect/; config-ml.in; setup.com; missing; makefile.vms; utils/;
config/; config.if; makefile.vms; missing; ylwrap; mkdep; etc/;
install-sh; intl/
Ask DJ Delorie <dj@redhat.com> after reading the libiberty entry.
config-ml.in; makefile.vms; mkdep; setup.com;
etc/; intl/; utils/;
Any global maintainer can approve changes to these
files and directories.
compile; depcomp; install-sh; missing; ylwrap;
config/
Any global maintainer can approve changes to these
files and directories, but they should be aware
that they need to be kept in sync with their
counterparts in the GCC repository.
modules file
Obviously changes to this file should not go through

View file

@ -4,7 +4,7 @@ AutoGen definitions Makefile.tpl;
// Makefile.in is generated from Makefile.tpl by 'autogen Makefile.def'.
// This file was originally written by Nathanael Nerode.
//
// Copyright 2002, 2003 Free Software Foundation
// Copyright 2002, 2003, 2004, 2005, 2006 Free Software Foundation
//
// This file is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -18,21 +18,28 @@ AutoGen definitions Makefile.tpl;
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// "missing" indicates that that module doesn't supply
// that recursive target in its Makefile.
build_modules= { module= libiberty; };
build_modules= { module= bison; };
build_modules= { module= byacc; };
build_modules= { module= flex; };
build_modules= { module= m4; };
build_modules= { module= texinfo; };
build_modules= { module= fixincludes;
extra_configure_args='--target=$(target)'; };
host_modules= { module= ash; };
host_modules= { module= autoconf; };
host_modules= { module= automake; };
host_modules= { module= bash; };
host_modules= { module= bfd; };
host_modules= { module= opcodes; };
host_modules= { module= binutils; };
host_modules= { module= bfd; lib_path=.; bootstrap=true; };
host_modules= { module= opcodes; lib_path=.; bootstrap=true; };
host_modules= { module= binutils; bootstrap=true; };
host_modules= { module= bison; no_check_cross= true; };
host_modules= { module= byacc; no_check_cross= true; };
host_modules= { module= bzip2; };
@ -44,8 +51,17 @@ host_modules= { module= fastjar; no_check_cross= true; };
host_modules= { module= fileutils; };
host_modules= { module= findutils; };
host_modules= { module= find; };
host_modules= { module= fixincludes;
missing= info;
missing= dvi;
missing= TAGS;
missing= install-info;
missing= installcheck; };
host_modules= { module= flex; no_check_cross= true; };
host_modules= { module= gas; };
host_modules= { module= gas; bootstrap=true; };
host_modules= { module= gcc; bootstrap=true;
target="`if [ -f stage_last ]; then echo quickstrap ; else echo all; fi`";
extra_make_flags="$(EXTRA_GCC_FLAGS)"; };
host_modules= { module= gawk; };
host_modules= { module= gettext; };
host_modules= { module= gnuserv; };
@ -53,13 +69,15 @@ host_modules= { module= gprof; };
host_modules= { module= gzip; };
host_modules= { module= hello; };
host_modules= { module= indent; };
host_modules= { module= intl; };
host_modules= { module= intl; bootstrap=true; };
host_modules= { module= tcl;
missing=mostlyclean; };
host_modules= { module= itcl; };
host_modules= { module= ld; };
host_modules= { module= ld; bootstrap=true; };
host_modules= { module= libcpp; bootstrap=true; };
host_modules= { module= libdecnumber; bootstrap=true; };
host_modules= { module= libgui; };
host_modules= { module= libiberty; };
host_modules= { module= libiberty; bootstrap=true; };
host_modules= { module= libtool; };
host_modules= { module= m4; };
host_modules= { module= make; };
@ -83,24 +101,27 @@ host_modules= { module= time; };
host_modules= { module= uudecode; };
host_modules= { module= wdiff; };
host_modules= { module= zip; no_check_cross=true; };
host_modules= { module= zlib; no_install=true; no_check=true; };
host_modules= { module= gdb; with_x=true; };
host_modules= { module= expect; with_x=true; };
host_modules= { module= guile; with_x=true; };
host_modules= { module= tk; with_x=true; };
host_modules= { module= tix; with_x=true; };
host_modules= { module= zlib; no_install=true; no_check=true; bootstrap=true; };
host_modules= { module= gdb; extra_make_flags="$(X11_FLAGS_TO_PASS)"; };
host_modules= { module= expect; extra_make_flags="$(X11_FLAGS_TO_PASS)"; };
host_modules= { module= guile; extra_make_flags="$(X11_FLAGS_TO_PASS)"; };
host_modules= { module= tk; extra_make_flags="$(X11_FLAGS_TO_PASS)"; };
host_modules= { module= libtermcap; no_check=true;
missing=mostlyclean;
missing=clean;
missing=distclean;
missing=maintainer-clean; };
host_modules= { module= utils; no_check=true; };
host_modules= { module= gnattools; };
target_modules = { module= libstdc++-v3; raw_cxx=true; };
target_modules = { module= libstdc++-v3; lib_path=.libs; raw_cxx=true; };
target_modules = { module= libmudflap; lib_path=.libs; };
target_modules = { module= libssp; lib_path=.libs; };
target_modules = { module= libgcc-math; lib_path=.libs; };
target_modules = { module= newlib; };
target_modules = { module= libf2c; };
target_modules = { module= libgfortran; };
target_modules = { module= libobjc; };
target_modules = { module= libtermcap; no_check=true; stage=true;
target_modules = { module= libtermcap; no_check=true;
missing=mostlyclean;
missing=clean;
missing=distclean;
@ -112,11 +133,12 @@ target_modules = { module= gperf; };
target_modules = { module= examples; no_check=true; no_install=true; };
target_modules = { module= libffi; };
target_modules = { module= libjava; raw_cxx=true; };
target_modules = { module= zlib; stage=true; };
target_modules = { module= zlib; };
target_modules = { module= boehm-gc; };
target_modules = { module= qthreads; };
target_modules = { module= rda; };
target_modules = { module= libada; };
target_modules = { module= libgomp; lib_path=.libs; };
// These are (some of) the make targets to be done in each subdirectory.
// Not all; these are the ones which don't have special options.
@ -126,11 +148,16 @@ recursive_targets = { make_target= info;
depend=configure; };
recursive_targets = { make_target= dvi;
depend=configure; };
recursive_targets = { make_target= html;
depend=configure; };
recursive_targets = { make_target= TAGS;
depend=configure; };
recursive_targets = { make_target= install-info;
depend=configure;
depend=info; };
recursive_targets = { make_target= install-html;
depend=configure;
depend=html; };
recursive_targets = { make_target= installcheck;
depend=configure; };
recursive_targets = { make_target= mostlyclean; };
@ -148,12 +175,13 @@ flags_to_pass = { flag= bindir ; };
flags_to_pass = { flag= datadir ; };
flags_to_pass = { flag= exec_prefix ; };
flags_to_pass = { flag= includedir ; };
flags_to_pass = { flag= datarootdir ; };
flags_to_pass = { flag= docdir ; };
flags_to_pass = { flag= infodir ; };
flags_to_pass = { flag= htmldir ; };
flags_to_pass = { flag= libdir ; };
flags_to_pass = { flag= libexecdir ; };
flags_to_pass = { flag= lispdir ; };
flags_to_pass = { flag= libstdcxx_incdir ; };
flags_to_pass = { flag= libsubdir ; };
flags_to_pass = { flag= localstatedir ; };
flags_to_pass = { flag= mandir ; };
flags_to_pass = { flag= oldincludedir ; };
@ -163,16 +191,15 @@ flags_to_pass = { flag= sharedstatedir ; };
flags_to_pass = { flag= sysconfdir ; };
flags_to_pass = { flag= tooldir ; };
flags_to_pass = { flag= build_tooldir ; };
flags_to_pass = { flag= gxx_include_dir ; };
flags_to_pass = { flag= gcc_version ; };
flags_to_pass = { flag= gcc_version_trigger ; };
flags_to_pass = { flag= target_alias ; };
// Build tools
flags_to_pass = { flag= BISON ; };
flags_to_pass = { flag= CC_FOR_BUILD ; };
flags_to_pass = { flag= CFLAGS_FOR_BUILD ; };
flags_to_pass = { flag= CXX_FOR_BUILD ; };
flags_to_pass = { flag= EXPECT ; };
flags_to_pass = { flag= FLEX ; };
flags_to_pass = { flag= INSTALL ; };
flags_to_pass = { flag= INSTALL_DATA ; };
flags_to_pass = { flag= INSTALL_PROGRAM ; };
@ -186,25 +213,288 @@ flags_to_pass = { flag= SHELL ; };
flags_to_pass = { flag= YACC ; };
// Host tools
flags_to_pass = { flag= ADAFLAGS ; optional=true ; };
flags_to_pass = { flag= AR_FLAGS ; };
flags_to_pass = { flag= BOOT_ADAFLAGS ; optional=true ; };
flags_to_pass = { flag= BOOT_CFLAGS ; };
flags_to_pass = { flag= BOOT_LDFLAGS ; };
flags_to_pass = { flag= CFLAGS ; };
flags_to_pass = { flag= CXXFLAGS ; };
flags_to_pass = { flag= LDFLAGS ; };
flags_to_pass = { flag= LIBCFLAGS ; };
flags_to_pass = { flag= LIBCXXFLAGS ; };
flags_to_pass = { flag= STAGE1_CFLAGS ; };
flags_to_pass = { flag= STAGE1_LANGUAGES ; };
// Target tools
flags_to_pass = { flag= AR_FOR_TARGET ; };
flags_to_pass = { flag= AS_FOR_TARGET ; };
flags_to_pass = { flag= CC_FOR_TARGET ; };
flags_to_pass = { flag= CFLAGS_FOR_TARGET ; };
flags_to_pass = { flag= CPPFLAGS_FOR_TARGET ; };
flags_to_pass = { flag= CXX_FOR_TARGET ; };
flags_to_pass = { flag= CXXFLAGS_FOR_TARGET ; };
flags_to_pass = { flag= DLLTOOL_FOR_TARGET ; };
flags_to_pass = { flag= GCJ_FOR_TARGET ; };
flags_to_pass = { flag= GFORTRAN_FOR_TARGET ; };
flags_to_pass = { flag= LD_FOR_TARGET ; };
flags_to_pass = { flag= LIPO_FOR_TARGET ; };
flags_to_pass = { flag= LDFLAGS_FOR_TARGET ; };
flags_to_pass = { flag= LIBCFLAGS_FOR_TARGET ; };
flags_to_pass = { flag= LIBCXXFLAGS_FOR_TARGET ; };
flags_to_pass = { flag= NM_FOR_TARGET ; };
flags_to_pass = { flag= OBJDUMP_FOR_TARGET ; };
flags_to_pass = { flag= RANLIB_FOR_TARGET ; };
flags_to_pass = { flag= STRIP_FOR_TARGET ; };
flags_to_pass = { flag= WINDRES_FOR_TARGET ; };
// Miscellaneous
flags_to_pass = { flag= LANGUAGES ; optional=true ; };
flags_to_pass = { flag= LEAN ; };
// Inter-module dependencies
// Build modules
dependencies = { module=all-build-bison; on=all-build-texinfo; };
dependencies = { module=all-build-byacc; on=all-build-texinfo; };
dependencies = { module=all-build-flex; on=all-build-texinfo; };
dependencies = { module=all-build-flex; on=all-build-bison; };
dependencies = { module=all-build-flex; on=all-build-byacc; };
dependencies = { module=all-build-flex; on=all-build-m4; };
dependencies = { module=all-build-libiberty; on=all-build-texinfo; };
dependencies = { module=all-build-m4; on=all-build-texinfo; };
dependencies = { module=all-build-fixincludes; on=all-build-libiberty; };
// Host modules specific to gcc.
dependencies = { module=configure-gcc; on=configure-intl; };
dependencies = { module=configure-gcc; on=all-binutils; };
dependencies = { module=configure-gcc; on=all-gas; };
dependencies = { module=configure-gcc; on=all-ld; };
dependencies = { module=all-gcc; on=all-libiberty; hard=true; };
dependencies = { module=all-gcc; on=all-intl; };
dependencies = { module=all-gcc; on=all-build-texinfo; };
dependencies = { module=all-gcc; on=all-build-bison; };
dependencies = { module=all-gcc; on=all-build-byacc; };
dependencies = { module=all-gcc; on=all-build-flex; };
dependencies = { module=all-gcc; on=all-build-libiberty; };
dependencies = { module=all-gcc; on=all-build-fixincludes; };
dependencies = { module=all-gcc; on=all-zlib; };
dependencies = { module=all-gcc; on=all-libcpp; hard=true; };
dependencies = { module=all-gcc; on=all-libdecnumber; hard=true; };
dependencies = { module=all-gcc; on=all-libiberty; };
dependencies = { module=all-gcc; on=all-fixincludes; };
dependencies = { module=install-gcc ; on=install-fixincludes; };
dependencies = { module=configure-libcpp; on=configure-libiberty; hard=true; };
dependencies = { module=configure-libcpp; on=configure-intl; };
dependencies = { module=all-libcpp; on=all-libiberty; hard=true; };
dependencies = { module=all-libcpp; on=all-intl; };
dependencies = { module=all-fixincludes; on=all-libiberty; };
dependencies = { module=all-gnattools; on=all-target-libada; };
// Host modules specific to gdb.
dependencies = { module=configure-gdb; on=configure-sim; };
dependencies = { module=all-gdb; on=all-libiberty; };
dependencies = { module=all-gdb; on=all-opcodes; };
dependencies = { module=all-gdb; on=all-bfd; };
dependencies = { module=all-gdb; on=all-readline; };
dependencies = { module=all-gdb; on=all-build-bison; };
dependencies = { module=all-gdb; on=all-build-byacc; };
dependencies = { module=all-gdb; on=all-sim; };
dependencies = { module=configure-libgui; on=configure-tcl; };
dependencies = { module=configure-libgui; on=configure-tk; };
dependencies = { module=all-libgui; on=all-tcl; };
dependencies = { module=all-libgui; on=all-tk; };
dependencies = { module=all-libgui; on=all-itcl; };
// Host modules specific to binutils.
dependencies = { module=configure-bfd; on=configure-libiberty; hard=true; };
dependencies = { module=all-bfd; on=all-libiberty; };
dependencies = { module=all-bfd; on=all-intl; };
dependencies = { module=all-binutils; on=all-libiberty; };
dependencies = { module=all-binutils; on=all-opcodes; };
dependencies = { module=all-binutils; on=all-bfd; };
dependencies = { module=all-binutils; on=all-build-flex; };
dependencies = { module=all-binutils; on=all-build-bison; };
dependencies = { module=all-binutils; on=all-build-byacc; };
dependencies = { module=all-binutils; on=all-intl; };
// We put install-opcodes before install-binutils because the installed
// binutils might be on PATH, and they might need the shared opcodes
// library.
dependencies = { module=install-binutils; on=install-opcodes; };
// libopcodes depends on libbfd
dependencies = { module=install-opcodes; on=install-bfd; };
dependencies = { module=all-gas; on=all-libiberty; };
dependencies = { module=all-gas; on=all-opcodes; };
dependencies = { module=all-gas; on=all-bfd; };
dependencies = { module=all-gas; on=all-intl; };
dependencies = { module=all-gprof; on=all-libiberty; };
dependencies = { module=all-gprof; on=all-bfd; };
dependencies = { module=all-gprof; on=all-opcodes; };
dependencies = { module=all-gprof; on=all-intl; };
dependencies = { module=all-ld; on=all-libiberty; };
dependencies = { module=all-ld; on=all-bfd; };
dependencies = { module=all-ld; on=all-opcodes; };
dependencies = { module=all-ld; on=all-build-bison; };
dependencies = { module=all-ld; on=all-build-byacc; };
dependencies = { module=all-ld; on=all-build-flex; };
dependencies = { module=all-ld; on=all-intl; };
dependencies = { module=all-opcodes; on=all-bfd; };
dependencies = { module=all-opcodes; on=all-libiberty; };
// Other host modules in the 'src' repository.
dependencies = { module=all-dejagnu; on=all-tcl; };
dependencies = { module=all-dejagnu; on=all-expect; };
dependencies = { module=all-dejagnu; on=all-tk; };
dependencies = { module=configure-expect; on=configure-tcl; };
dependencies = { module=configure-expect; on=configure-tk; };
dependencies = { module=all-expect; on=all-tcl; };
dependencies = { module=all-expect; on=all-tk; };
// We put install-tcl before install-itcl because itcl wants to run a
// program on installation which uses the Tcl libraries.
dependencies = { module=configure-itcl; on=configure-tcl; };
dependencies = { module=configure-itcl; on=configure-tk; };
dependencies = { module=all-itcl; on=all-tcl; };
dependencies = { module=all-itcl; on=all-tk; };
dependencies = { module=install-itcl; on=install-tcl; };
dependencies = { module=configure-tk; on=configure-tcl; };
dependencies = { module=all-tk; on=all-tcl; };
dependencies = { module=all-sid; on=all-libiberty; };
dependencies = { module=all-sid; on=all-bfd; };
dependencies = { module=all-sid; on=all-opcodes; };
dependencies = { module=all-sid; on=all-tcl; };
dependencies = { module=all-sid; on=all-tk; };
dependencies = { module=install-sid; on=install-tcl; };
dependencies = { module=install-sid; on=install-tk; };
dependencies = { module=all-sim; on=all-libiberty; };
dependencies = { module=all-sim; on=all-bfd; };
dependencies = { module=all-sim; on=all-opcodes; };
dependencies = { module=all-sim; on=all-readline; };
dependencies = { module=all-sim; on=configure-gdb; };
// Other host modules.
dependencies = { module=all-fastjar; on=all-zlib; };
dependencies = { module=all-fastjar; on=all-build-texinfo; };
dependencies = { module=all-fastjar; on=all-libiberty; };
// Warning, these are not well tested.
dependencies = { module=all-autoconf; on=all-m4; };
dependencies = { module=all-autoconf; on=all-build-texinfo; };
dependencies = { module=all-automake; on=all-m4; };
dependencies = { module=all-automake; on=all-build-texinfo; };
dependencies = { module=all-automake; on=all-autoconf; };
dependencies = { module=all-bison; on=all-intl; };
dependencies = { module=all-bison; on=all-build-texinfo; };
dependencies = { module=all-diff; on=all-intl; };
dependencies = { module=all-diff; on=all-build-texinfo; };
dependencies = { module=all-fileutils; on=all-intl; };
dependencies = { module=all-fileutils; on=all-build-texinfo; };
dependencies = { module=all-flex; on=all-build-bison; };
dependencies = { module=all-flex; on=all-build-byacc; };
dependencies = { module=all-flex; on=all-intl; };
dependencies = { module=all-flex; on=all-m4; };
dependencies = { module=all-flex; on=all-build-texinfo; };
dependencies = { module=all-gzip; on=all-intl; };
dependencies = { module=all-gzip; on=all-zlib; };
dependencies = { module=all-gzip; on=all-build-texinfo; };
dependencies = { module=all-hello; on=all-intl; };
dependencies = { module=all-hello; on=all-build-texinfo; };
dependencies = { module=all-m4; on=all-intl; };
dependencies = { module=all-m4; on=all-build-texinfo; };
dependencies = { module=all-make; on=all-intl; };
dependencies = { module=all-make; on=all-build-texinfo; };
dependencies = { module=all-patch; on=all-build-texinfo; };
dependencies = { module=all-make; on=all-build-texinfo; };
dependencies = { module=all-prms; on=all-libiberty; };
dependencies = { module=all-recode; on=all-build-texinfo; };
dependencies = { module=all-sed; on=all-build-texinfo; };
dependencies = { module=all-send-pr; on=all-prms; };
dependencies = { module=all-tar; on=all-build-texinfo; };
dependencies = { module=all-uudecode; on=all-build-texinfo; };
// Target modules. These can also have dependencies on the language
// environment (e.g. on libstdc++).
lang_env_dependencies = { module=boehm-gc; };
lang_env_dependencies = { module=gperf; cxx=true; };
lang_env_dependencies = { module=libada; };
lang_env_dependencies = { module=libgfortran; };
lang_env_dependencies = { module=libffi; };
lang_env_dependencies = { module=libjava; cxx=true; };
lang_env_dependencies = { module=libmudflap; };
lang_env_dependencies = { module=libobjc; };
lang_env_dependencies = { module=libssp; };
lang_env_dependencies = { module=libstdc++-v3; };
lang_env_dependencies = { module=zlib; };
dependencies = { module=configure-target-boehm-gc; on=configure-target-qthreads; };
dependencies = { module=configure-target-fastjar; on=configure-target-zlib; };
dependencies = { module=all-target-fastjar; on=all-target-zlib; };
dependencies = { module=all-target-fastjar; on=all-target-libiberty; };
dependencies = { module=configure-target-libjava; on=configure-target-zlib; };
dependencies = { module=configure-target-libjava; on=configure-target-boehm-gc; };
dependencies = { module=configure-target-libjava; on=configure-target-qthreads; };
dependencies = { module=configure-target-libjava; on=configure-target-libffi; };
dependencies = { module=all-target-libjava; on=all-fastjar; };
dependencies = { module=all-target-libjava; on=all-target-zlib; };
dependencies = { module=all-target-libjava; on=all-target-boehm-gc; };
dependencies = { module=all-target-libjava; on=all-target-qthreads; };
dependencies = { module=all-target-libjava; on=all-target-libffi; };
dependencies = { module=all-target-libobjc; on=all-target-libiberty; };
dependencies = { module=all-target-libstdc++-v3; on=all-target-libiberty; };
// Target modules in the 'src' repository.
lang_env_dependencies = { module=examples; };
lang_env_dependencies = { module=libtermcap; };
lang_env_dependencies = { module=rda; };
lang_env_dependencies = { module=winsup; };
lang_env_dependencies = { module=qthreads; };
dependencies = { module=all-target-libgloss; on=configure-target-newlib; };
dependencies = { module=all-target-winsup; on=all-target-libiberty; };
dependencies = { module=all-target-winsup; on=all-target-libtermcap; };
// Toplevel bootstrap
bootstrap_stage = {
id=1 ;
stage_configure_flags='--disable-intermodule \
--disable-coverage --enable-languages="$(STAGE1_LANGUAGES)"' ;
stage_make_flags='CFLAGS="$(STAGE1_CFLAGS)" LIBCFLAGS="$(STAGE1_CFLAGS)"' ; };
bootstrap_stage = {
id=2 ; prev=1 ;
bootstrap_target=bootstrap2 ;
stage_configure_flags="@stage2_werror_flag@" ;
stage_make_flags="" ; };
bootstrap_stage = {
id=3 ; prev=2 ; lean=1 ;
compare_target=compare ;
bootstrap_target=bootstrap ;
cleanstrap_target=cleanstrap ;
stage_configure_flags="@stage2_werror_flag@" ;
stage_make_flags="" ; };
bootstrap_stage = {
id=4 ; prev=3 ; lean=2 ;
compare_target=compare3 ;
bootstrap_target=bootstrap4 ;
stage_configure_flags="@stage2_werror_flag@" ;
stage_make_flags="" ; };
bootstrap_stage = {
id=profile ; prev=1 ;
stage_configure_flags="@stage2_werror_flag@" ;
stage_make_flags='CFLAGS="$(BOOT_CFLAGS) -fprofile-generate"' ; };
bootstrap_stage = {
id=feedback ; prev=profile ;
bootstrap_target=profiledbootstrap ;
stage_configure_flags="@stage2_werror_flag@" ;
stage_make_flags='CFLAGS="$(BOOT_CFLAGS) -fprofile-use"' ; };

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,8 +1,10 @@
sinclude(../config/accross.m4)
sinclude(../config/acx.m4)
sinclude(../bfd/bfd.m4)
sinclude(../bfd/warning.m4)
dnl See whether we need to use fopen-bin.h rather than fopen-same.h.
AC_DEFUN([BFD_BINARY_FOPEN],
[AC_REQUIRE([AC_CANONICAL_SYSTEM])
[AC_REQUIRE([AC_CANONICAL_TARGET])
case "${host}" in
changequote(,)dnl
*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
@ -43,73 +45,6 @@ else
fi
AC_SUBST(EXEEXT_FOR_BUILD)])dnl
dnl See whether we need a declaration for a function.
AC_DEFUN([BFD_NEED_DECLARATION],
[AC_MSG_CHECKING([whether $1 must be declared])
AC_CACHE_VAL(bfd_cv_decl_needed_$1,
[AC_TRY_COMPILE([
#include <stdio.h>
#ifdef HAVE_STRING_H
#include <string.h>
#else
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif],
[char *(*pfn) = (char *(*)) $1],
bfd_cv_decl_needed_$1=no, bfd_cv_decl_needed_$1=yes)])
AC_MSG_RESULT($bfd_cv_decl_needed_$1)
if test $bfd_cv_decl_needed_$1 = yes; then
AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1,
[Define if $1 is not declared in system header files.])
fi
])dnl
dnl Check for existence of a type $1 in sys/procfs.h
AC_DEFUN([BFD_HAVE_SYS_PROCFS_TYPE],
[AC_MSG_CHECKING([for $1 in sys/procfs.h])
AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1,
[AC_TRY_COMPILE([
#define _SYSCALL32
#include <sys/procfs.h>],
[$1 avar],
bfd_cv_have_sys_procfs_type_$1=yes,
bfd_cv_have_sys_procfs_type_$1=no
)])
if test $bfd_cv_have_sys_procfs_type_$1 = yes; then
AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z]), 1,
[Define if <sys/procfs.h> has $1.])
fi
AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_$1)
])
dnl Check for existence of member $2 in type $1 in sys/procfs.h
AC_DEFUN([BFD_HAVE_SYS_PROCFS_TYPE_MEMBER],
[AC_MSG_CHECKING([for $1.$2 in sys/procfs.h])
AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2,
[AC_TRY_COMPILE([
#define _SYSCALL32
#include <sys/procfs.h>],
[$1 avar; void* aref = (void*) &avar.$2],
bfd_cv_have_sys_procfs_type_member_$1_$2=yes,
bfd_cv_have_sys_procfs_type_member_$1_$2=no
)])
if test $bfd_cv_have_sys_procfs_type_member_$1_$2 = yes; then
AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z])[_]translit($2, [a-z], [A-Z]), 1,
[Define if <sys/procfs.h> has $1.$2.])
fi
AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_member_$1_$2)
])
sinclude(../libtool.m4)
dnl The lines below arrange for aclocal not to bring libtool.m4
dnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake
@ -138,12 +73,15 @@ AC_DEFUN([AM_INSTALL_LIBBFD],
fi)
AC_MSG_RESULT($install_libbfd_p)
AM_CONDITIONAL(INSTALL_LIBBFD, test $install_libbfd_p = yes)
# Need _noncanonical variables for this.
ACX_NONCANONICAL_HOST
ACX_NONCANONICAL_TARGET
# libbfd.a is a host library containing target dependent code
bfdlibdir='$(libdir)'
bfdincludedir='$(includedir)'
if test "${host}" != "${target}"; then
bfdlibdir='$(exec_prefix)/$(host_alias)/$(target_alias)/lib'
bfdincludedir='$(exec_prefix)/$(host_alias)/$(target_alias)/include'
bfdlibdir='$(exec_prefix)/$(host_noncanonical)/$(target_noncanonical)/lib'
bfdincludedir='$(exec_prefix)/$(host_noncanonical)/$(target_noncanonical)/include'
fi
AC_SUBST(bfdlibdir)
AC_SUBST(bfdincludedir)

File diff suppressed because it is too large Load diff

View file

@ -1,23 +1,23 @@
/* BFD back-end for raw ARM a.out binaries.
Copyright 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002
Copyright 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005
Free Software Foundation, Inc.
Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
This file is part of BFD, the Binary File Descriptor library.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "bfd.h"
#include "sysdep.h"
@ -54,66 +54,49 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "libaout.h"
#include "aout/aout64.h"
static bfd_boolean MY(write_object_contents)
PARAMS ((bfd *));
static bfd_reloc_status_type MY(fix_pcrel_26_done)
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
static bfd_reloc_status_type MY(fix_pcrel_26)
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
static void MY(swap_std_reloc_in)
PARAMS ((bfd *, struct reloc_std_external *, arelent *, asymbol **,
bfd_size_type));
reloc_howto_type *MY(bfd_reloc_type_lookup)
PARAMS ((bfd *, bfd_reloc_code_real_type));
reloc_howto_type * MY(reloc_howto)
PARAMS ((bfd *, struct reloc_std_external *, int *, int *, int *));
void MY(put_reloc)
PARAMS ((bfd *, int, int, bfd_vma, reloc_howto_type *,
struct reloc_std_external *));
void MY(relocatable_reloc)
PARAMS ((reloc_howto_type *, bfd *, struct reloc_std_external *, bfd_vma *,
bfd_vma));
void MY(swap_std_reloc_out)
PARAMS ((bfd *, arelent *, struct reloc_std_external *));
reloc_howto_type MY(howto_table)[] =
{
/* Type rs size bsz pcrel bitpos ovrf sf name part_inpl
readmask setmask pcdone. */
HOWTO (0, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, 0, "8", TRUE,
0x000000ff, 0x000000ff, FALSE),
HOWTO (1, 0, 1, 16, FALSE, 0, complain_overflow_bitfield, 0, "16", TRUE,
0x0000ffff, 0x0000ffff, FALSE),
HOWTO (2, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, 0, "32", TRUE,
0xffffffff, 0xffffffff, FALSE),
HOWTO (3, 2, 2, 26, TRUE, 0, complain_overflow_signed, MY(fix_pcrel_26),
"ARM26", TRUE, 0x00ffffff, 0x00ffffff, TRUE),
HOWTO (4, 0, 0, 8, TRUE, 0, complain_overflow_signed, 0, "DISP8", TRUE,
0x000000ff, 0x000000ff, TRUE),
HOWTO (5, 0, 1, 16, TRUE, 0, complain_overflow_signed, 0, "DISP16", TRUE,
0x0000ffff, 0x0000ffff, TRUE),
HOWTO (6, 0, 2, 32, TRUE, 0, complain_overflow_signed, 0, "DISP32", TRUE,
0xffffffff, 0xffffffff, TRUE),
HOWTO (7, 2, 2, 26, FALSE, 0, complain_overflow_signed,
MY(fix_pcrel_26_done), "ARM26D", TRUE, 0x0, 0x0,
FALSE),
EMPTY_HOWTO (-1),
HOWTO (9, 0, -1, 16, FALSE, 0, complain_overflow_bitfield, 0, "NEG16", TRUE,
0x0000ffff, 0x0000ffff, FALSE),
HOWTO (10, 0, -2, 32, FALSE, 0, complain_overflow_bitfield, 0, "NEG32", TRUE,
0xffffffff, 0xffffffff, FALSE)
};
static bfd_reloc_status_type
MY (fix_pcrel_26) (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
static bfd_reloc_status_type
MY (fix_pcrel_26_done) (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
reloc_howto_type MY (howto_table)[] =
{
/* Type rs size bsz pcrel bitpos ovrf sf name part_inpl
readmask setmask pcdone. */
HOWTO (0, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, 0, "8", TRUE,
0x000000ff, 0x000000ff, FALSE),
HOWTO (1, 0, 1, 16, FALSE, 0, complain_overflow_bitfield, 0, "16", TRUE,
0x0000ffff, 0x0000ffff, FALSE),
HOWTO (2, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, 0, "32", TRUE,
0xffffffff, 0xffffffff, FALSE),
HOWTO (3, 2, 2, 26, TRUE, 0, complain_overflow_signed, MY (fix_pcrel_26),
"ARM26", TRUE, 0x00ffffff, 0x00ffffff, TRUE),
HOWTO (4, 0, 0, 8, TRUE, 0, complain_overflow_signed, 0, "DISP8", TRUE,
0x000000ff, 0x000000ff, TRUE),
HOWTO (5, 0, 1, 16, TRUE, 0, complain_overflow_signed, 0, "DISP16", TRUE,
0x0000ffff, 0x0000ffff, TRUE),
HOWTO (6, 0, 2, 32, TRUE, 0, complain_overflow_signed, 0, "DISP32", TRUE,
0xffffffff, 0xffffffff, TRUE),
HOWTO (7, 2, 2, 26, FALSE, 0, complain_overflow_signed,
MY (fix_pcrel_26_done), "ARM26D", TRUE, 0x0, 0x0,
FALSE),
EMPTY_HOWTO (-1),
HOWTO (9, 0, -1, 16, FALSE, 0, complain_overflow_bitfield, 0, "NEG16", TRUE,
0x0000ffff, 0x0000ffff, FALSE),
HOWTO (10, 0, -2, 32, FALSE, 0, complain_overflow_bitfield, 0, "NEG32", TRUE,
0xffffffff, 0xffffffff, FALSE)
};
#define RELOC_ARM_BITS_NEG_BIG ((unsigned int) 0x08)
#define RELOC_ARM_BITS_NEG_LITTLE ((unsigned int) 0x10)
reloc_howto_type *
MY(reloc_howto) (abfd, rel, r_index, r_extern, r_pcrel)
bfd *abfd;
struct reloc_std_external *rel;
int *r_index;
int *r_extern;
int *r_pcrel;
static reloc_howto_type *
MY (reloc_howto) (bfd *abfd,
struct reloc_std_external *rel,
int *r_index,
int *r_extern,
int *r_pcrel)
{
unsigned int r_length;
unsigned int r_pcrel_done;
@ -147,20 +130,19 @@ MY(reloc_howto) (abfd, rel, r_index, r_extern, r_pcrel)
if (index == 3)
*r_pcrel = 1;
return MY(howto_table) + index;
return MY (howto_table) + index;
}
#define MY_reloc_howto(BFD, REL, IN, EX, PC) \
MY(reloc_howto) (BFD, REL, &IN, &EX, &PC)
MY (reloc_howto) (BFD, REL, &IN, &EX, &PC)
void
MY(put_reloc) (abfd, r_extern, r_index, value, howto, reloc)
bfd *abfd;
int r_extern;
int r_index;
bfd_vma value;
reloc_howto_type *howto;
struct reloc_std_external *reloc;
static void
MY (put_reloc) (bfd *abfd,
int r_extern,
int r_index,
bfd_vma value,
reloc_howto_type *howto,
struct reloc_std_external *reloc)
{
unsigned int r_length;
int r_pcrel;
@ -202,25 +184,22 @@ MY(put_reloc) (abfd, r_extern, r_index, value, howto, reloc)
}
#define MY_put_reloc(BFD, EXT, IDX, VAL, HOWTO, RELOC) \
MY(put_reloc) (BFD, EXT, IDX, VAL, HOWTO, RELOC)
MY (put_reloc) (BFD, EXT, IDX, VAL, HOWTO, RELOC)
void
MY(relocatable_reloc) (howto, abfd, reloc, amount, r_addr)
reloc_howto_type *howto;
bfd *abfd;
struct reloc_std_external *reloc;
bfd_vma *amount;
bfd_vma r_addr;
static void
MY (relocatable_reloc) (reloc_howto_type *howto,
bfd *abfd,
struct reloc_std_external *reloc,
bfd_vma *amount,
bfd_vma r_addr)
{
if (howto->type == 3)
{
if (reloc->r_type[0]
& (bfd_header_big_endian (abfd)
? RELOC_STD_BITS_EXTERN_BIG : RELOC_STD_BITS_EXTERN_LITTLE))
{
/* The reloc is still external, so don't modify anything. */
*amount = 0;
}
/* The reloc is still external, so don't modify anything. */
*amount = 0;
else
{
*amount -= r_addr;
@ -237,33 +216,29 @@ MY(relocatable_reloc) (howto, abfd, reloc, amount, r_addr)
}
#define MY_relocatable_reloc(HOW, BFD, REL, AMOUNT, ADDR) \
MY(relocatable_reloc) (HOW, BFD, REL, &(AMOUNT), ADDR)
MY (relocatable_reloc) (HOW, BFD, REL, &(AMOUNT), ADDR)
static bfd_reloc_status_type
MY(fix_pcrel_26_done) (abfd, reloc_entry, symbol, data, input_section,
output_bfd, error_message)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *reloc_entry ATTRIBUTE_UNUSED;
asymbol *symbol ATTRIBUTE_UNUSED;
PTR data ATTRIBUTE_UNUSED;
asection *input_section ATTRIBUTE_UNUSED;
bfd *output_bfd ATTRIBUTE_UNUSED;
char **error_message ATTRIBUTE_UNUSED;
MY (fix_pcrel_26_done) (bfd *abfd ATTRIBUTE_UNUSED,
arelent *reloc_entry ATTRIBUTE_UNUSED,
asymbol *symbol ATTRIBUTE_UNUSED,
void * data ATTRIBUTE_UNUSED,
asection *input_section ATTRIBUTE_UNUSED,
bfd *output_bfd ATTRIBUTE_UNUSED,
char **error_message ATTRIBUTE_UNUSED)
{
/* This is dead simple at present. */
return bfd_reloc_ok;
}
static bfd_reloc_status_type
MY(fix_pcrel_26) (abfd, reloc_entry, symbol, data, input_section,
output_bfd, error_message)
bfd *abfd;
arelent *reloc_entry;
asymbol *symbol;
PTR data;
asection *input_section;
bfd *output_bfd;
char **error_message ATTRIBUTE_UNUSED;
MY (fix_pcrel_26) (bfd *abfd,
arelent *reloc_entry,
asymbol *symbol,
void * data,
asection *input_section,
bfd *output_bfd,
char **error_message ATTRIBUTE_UNUSED)
{
bfd_vma relocation;
bfd_size_type addr = reloc_entry->address;
@ -278,7 +253,7 @@ MY(fix_pcrel_26) (abfd, reloc_entry, symbol, data, input_section,
/* If the sections are different, and we are doing a partial relocation,
just ignore it for now. */
if (symbol->section->name != input_section->name
&& output_bfd != (bfd *)NULL)
&& output_bfd != NULL)
return bfd_reloc_ok;
relocation = (target & 0x00ffffff) << 2;
@ -308,17 +283,17 @@ MY(fix_pcrel_26) (abfd, reloc_entry, symbol, data, input_section,
/* Now the ARM magic... Change the reloc type so that it is marked as done.
Strictly this is only necessary if we are doing a partial relocation. */
reloc_entry->howto = &MY(howto_table)[7];
reloc_entry->howto = &MY (howto_table)[7];
return flag;
}
reloc_howto_type *
MY(bfd_reloc_type_lookup) (abfd,code)
bfd *abfd;
bfd_reloc_code_real_type code;
static reloc_howto_type *
MY (bfd_reloc_type_lookup) (bfd *abfd,
bfd_reloc_code_real_type code)
{
#define ASTD(i,j) case i: return &MY(howto_table)[j]
#define ASTD(i,j) case i: return & MY (howto_table)[j]
if (code == BFD_RELOC_CTOR)
switch (bfd_get_arch_info (abfd)->bits_per_address)
{
@ -326,7 +301,7 @@ MY(bfd_reloc_type_lookup) (abfd,code)
code = BFD_RELOC_32;
break;
default:
return (const struct reloc_howto_struct *) 0;
return NULL;
}
switch (code)
@ -338,26 +313,25 @@ MY(bfd_reloc_type_lookup) (abfd,code)
ASTD (BFD_RELOC_16_PCREL, 5);
ASTD (BFD_RELOC_32_PCREL, 6);
default:
return (const struct reloc_howto_struct *) 0;
return NULL;
}
}
#define MY_swap_std_reloc_in MY(swap_std_reloc_in)
#define MY_swap_std_reloc_out MY(swap_std_reloc_out)
#define MY_get_section_contents _bfd_generic_get_section_contents
/* #define MY_bfd_link_hash_table_create _bfd_generic_link_hash_table_create */
/* #define MY_bfd_link_add_symbols _bfd_generic_link_add_symbols */
/* #define MY_bfd_final_link _bfd_generic_final_link */
#define MY_swap_std_reloc_in MY (swap_std_reloc_in)
#define MY_swap_std_reloc_out MY (swap_std_reloc_out)
#define MY_get_section_contents _bfd_generic_get_section_contents
void MY_swap_std_reloc_in (bfd *, struct reloc_std_external *, arelent *, asymbol **, bfd_size_type);
void MY_swap_std_reloc_out (bfd *, arelent *, struct reloc_std_external *);
#include "aoutx.h"
static void
MY_swap_std_reloc_in (abfd, bytes, cache_ptr, symbols, symcount)
bfd *abfd;
struct reloc_std_external *bytes;
arelent *cache_ptr;
asymbol **symbols;
bfd_size_type symcount ATTRIBUTE_UNUSED;
void
MY_swap_std_reloc_in (bfd *abfd,
struct reloc_std_external *bytes,
arelent *cache_ptr,
asymbol **symbols,
bfd_size_type symcount ATTRIBUTE_UNUSED)
{
int r_index;
int r_extern;
@ -372,10 +346,9 @@ MY_swap_std_reloc_in (abfd, bytes, cache_ptr, symbols, symcount)
}
void
MY_swap_std_reloc_out (abfd, g, natptr)
bfd *abfd;
arelent *g;
struct reloc_std_external *natptr;
MY_swap_std_reloc_out (bfd *abfd,
arelent *g,
struct reloc_std_external *natptr)
{
int r_index;
asymbol *sym = *(g->sym_ptr_ptr);
@ -385,21 +358,19 @@ MY_swap_std_reloc_out (abfd, g, natptr)
int r_neg = 0; /* Negative relocs use the BASEREL bit. */
asection *output_section = sym->section->output_section;
PUT_WORD(abfd, g->address, natptr->r_address);
PUT_WORD (abfd, g->address, natptr->r_address);
r_length = g->howto->size ; /* Size as a power of two */
r_length = g->howto->size ; /* Size as a power of two. */
if (r_length < 0)
{
r_length = -r_length;
r_neg = 1;
}
r_pcrel = (int) g->howto->pc_relative; /* Relative to PC? */
r_pcrel = (int) g->howto->pc_relative; /* Relative to PC? */
/* For RISC iX, in pc-relative relocs the r_pcrel bit means that the
relocation has been done already (Only for the 26-bit one I think)???!!!
*/
relocation has been done already (Only for the 26-bit one I think). */
if (g->howto->type == 3)
{
r_length = 3;
@ -411,20 +382,14 @@ MY_swap_std_reloc_out (abfd, g, natptr)
r_pcrel = 1;
}
#if 0
/* For a standard reloc, the addend is in the object file. */
r_addend = g->addend + (*(g->sym_ptr_ptr))->section->output_section->vma;
#endif
/* name was clobbered by aout_write_syms to be symbol index */
/* Name was clobbered by aout_write_syms to be symbol index. */
/* If this relocation is relative to a symbol then set the
r_index to the symbols index, and the r_extern bit.
Absolute symbols can come in in two ways, either as an offset
from the abs section, or as a symbol which has an abs value.
check for that here
*/
check for that here. */
if (bfd_is_com_section (output_section)
|| output_section == &bfd_abs_section
@ -483,83 +448,83 @@ MY_swap_std_reloc_out (abfd, g, natptr)
extern const bfd_target aout_arm_big_vec;
const bfd_target aout_arm_little_vec =
{
"a.out-arm-little", /* name */
bfd_target_aout_flavour,
BFD_ENDIAN_LITTLE, /* target byte order (little) */
BFD_ENDIAN_LITTLE, /* target headers byte order (little) */
(HAS_RELOC | EXEC_P | /* object flags */
HAS_LINENO | HAS_DEBUG |
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
MY_symbol_leading_char,
AR_PAD_CHAR, /* ar_pad_char */
15, /* ar_max_namelen */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
{_bfd_dummy_target, MY_object_p, /* bfd_check_format */
bfd_generic_archive_p, MY_core_file_p},
{bfd_false, MY_mkobject, /* bfd_set_format */
_bfd_generic_mkarchive, bfd_false},
{bfd_false, MY_write_object_contents, /* bfd_write_contents */
_bfd_write_archive_contents, bfd_false},
{
"a.out-arm-little", /* Name. */
bfd_target_aout_flavour,
BFD_ENDIAN_LITTLE, /* Target byte order (little). */
BFD_ENDIAN_LITTLE, /* Target headers byte order (little). */
(HAS_RELOC | EXEC_P | /* Object flags. */
HAS_LINENO | HAS_DEBUG |
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
MY_symbol_leading_char,
AR_PAD_CHAR, /* AR_pad_char. */
15, /* AR_max_namelen. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Data. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Headers. */
{_bfd_dummy_target, MY_object_p, /* bfd_check_format. */
bfd_generic_archive_p, MY_core_file_p},
{bfd_false, MY_mkobject, /* bfd_set_format. */
_bfd_generic_mkarchive, bfd_false},
{bfd_false, MY_write_object_contents, /* bfd_write_contents. */
_bfd_write_archive_contents, bfd_false},
BFD_JUMP_TABLE_GENERIC (MY),
BFD_JUMP_TABLE_COPY (MY),
BFD_JUMP_TABLE_CORE (MY),
BFD_JUMP_TABLE_ARCHIVE (MY),
BFD_JUMP_TABLE_SYMBOLS (MY),
BFD_JUMP_TABLE_RELOCS (MY),
BFD_JUMP_TABLE_WRITE (MY),
BFD_JUMP_TABLE_LINK (MY),
BFD_JUMP_TABLE_DYNAMIC (MY),
BFD_JUMP_TABLE_GENERIC (MY),
BFD_JUMP_TABLE_COPY (MY),
BFD_JUMP_TABLE_CORE (MY),
BFD_JUMP_TABLE_ARCHIVE (MY),
BFD_JUMP_TABLE_SYMBOLS (MY),
BFD_JUMP_TABLE_RELOCS (MY),
BFD_JUMP_TABLE_WRITE (MY),
BFD_JUMP_TABLE_LINK (MY),
BFD_JUMP_TABLE_DYNAMIC (MY),
& aout_arm_big_vec,
& aout_arm_big_vec,
(PTR) MY_backend_data,
};
(void *) MY_backend_data,
};
const bfd_target aout_arm_big_vec =
{
"a.out-arm-big", /* name */
bfd_target_aout_flavour,
BFD_ENDIAN_BIG, /* target byte order (big) */
BFD_ENDIAN_BIG, /* target headers byte order (big) */
(HAS_RELOC | EXEC_P | /* object flags */
HAS_LINENO | HAS_DEBUG |
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
MY_symbol_leading_char,
AR_PAD_CHAR, /* ar_pad_char */
15, /* ar_max_namelen */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
{_bfd_dummy_target, MY_object_p, /* bfd_check_format */
bfd_generic_archive_p, MY_core_file_p},
{bfd_false, MY_mkobject, /* bfd_set_format */
_bfd_generic_mkarchive, bfd_false},
{bfd_false, MY_write_object_contents, /* bfd_write_contents */
_bfd_write_archive_contents, bfd_false},
{
"a.out-arm-big", /* Name. */
bfd_target_aout_flavour,
BFD_ENDIAN_BIG, /* Target byte order (big). */
BFD_ENDIAN_BIG, /* Target headers byte order (big). */
(HAS_RELOC | EXEC_P | /* Object flags. */
HAS_LINENO | HAS_DEBUG |
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
MY_symbol_leading_char,
AR_PAD_CHAR, /* AR_pad_char. */
15, /* AR_max_namelen. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */
{_bfd_dummy_target, MY_object_p, /* bfd_check_format. */
bfd_generic_archive_p, MY_core_file_p},
{bfd_false, MY_mkobject, /* bfd_set_format. */
_bfd_generic_mkarchive, bfd_false},
{bfd_false, MY_write_object_contents, /* bfd_write_contents. */
_bfd_write_archive_contents, bfd_false},
BFD_JUMP_TABLE_GENERIC (MY),
BFD_JUMP_TABLE_COPY (MY),
BFD_JUMP_TABLE_CORE (MY),
BFD_JUMP_TABLE_ARCHIVE (MY),
BFD_JUMP_TABLE_SYMBOLS (MY),
BFD_JUMP_TABLE_RELOCS (MY),
BFD_JUMP_TABLE_WRITE (MY),
BFD_JUMP_TABLE_LINK (MY),
BFD_JUMP_TABLE_DYNAMIC (MY),
BFD_JUMP_TABLE_GENERIC (MY),
BFD_JUMP_TABLE_COPY (MY),
BFD_JUMP_TABLE_CORE (MY),
BFD_JUMP_TABLE_ARCHIVE (MY),
BFD_JUMP_TABLE_SYMBOLS (MY),
BFD_JUMP_TABLE_RELOCS (MY),
BFD_JUMP_TABLE_WRITE (MY),
BFD_JUMP_TABLE_LINK (MY),
BFD_JUMP_TABLE_DYNAMIC (MY),
& aout_arm_little_vec,
& aout_arm_little_vec,
(PTR) MY_backend_data,
};
(void *) MY_backend_data,
};

View file

@ -1,239 +0,0 @@
/* BFD back-end for a.out files encapsulated with COFF headers.
Copyright 1990, 1991, 1994, 1995, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* THIS MODULE IS NOT FINISHED. IT PROBABLY DOESN'T EVEN COMPILE. */
#if 0
#define TARGET_PAGE_SIZE 4096
#define SEGMENT_SIZE TARGET_PAGE_SIZE
#define TEXT_START_ADDR 0
#endif
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
#include "aout/aout64.h"
#include "aout/stab_gnu.h"
#include "aout/ar.h"
#include "libaout.h" /* BFD a.out internal data structures */
const bfd_target *encap_real_callback ();
const bfd_target *
encap_object_p (abfd)
bfd *abfd;
{
unsigned char magicbuf[4]; /* Raw bytes of magic number from file */
unsigned long magic; /* Swapped magic number */
short coff_magic;
struct external_exec exec_bytes;
struct internal_exec exec;
bfd_size_type amt = sizeof (magicbuf);
if (bfd_bread ((PTR) magicbuf, amt, abfd) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
return 0;
}
coff_magic = H_GET_16 (abfd, magicbuf);
if (coff_magic != COFF_MAGIC)
return 0; /* Not an encap coff file */
magic = H_GET_32 (abfd, magicbuf);
if (N_BADMAG (*((struct internal_exec *) &magic)))
return 0;
if (bfd_seek (abfd, (file_ptr) sizeof (struct coffheader), SEEK_SET) != 0)
return 0;
amt = EXEC_BYTES_SIZE;
if (bfd_bread ((PTR) &exec_bytes, amt, abfd) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
return 0;
}
NAME(aout,swap_exec_header_in) (abfd, &exec_bytes, &exec);
return aout_32_some_aout_object_p (abfd, &exec, encap_realcallback);
}
/* Finish up the reading of an encapsulated-coff a.out file header. */
const bfd_target *
encap_real_callback (abfd)
bfd *abfd;
{
struct internal_exec *execp = exec_hdr (abfd);
MY(callback) (abfd, execp);
/* If we have a coff header, it can give us better values for
text_start and exec_data_start. This is particularly useful
for remote debugging of embedded systems. */
if (N_FLAGS(exec_aouthdr) & N_FLAGS_COFF_ENCAPSULATE)
{
struct coffheader ch;
int val;
val = lseek (execchan, -(sizeof (AOUTHDR) + sizeof (ch)), 1);
if (val == -1)
perror_with_name (filename);
val = myread (execchan, &ch, sizeof (ch));
if (val < 0)
perror_with_name (filename);
text_start = ch.text_start;
exec_data_start = ch.data_start;
}
else
{
text_start =
IS_OBJECT_FILE (exec_aouthdr) ? 0 : N_TXTADDR (exec_aouthdr);
exec_data_start = (IS_OBJECT_FILE (exec_aouthdr)
? exec_aouthdr.a_text
: N_DATADDR (exec_aouthdr));
}
/* Determine the architecture and machine type of the object file. */
bfd_default_set_arch_mach(abfd, bfd_arch_m68k, 0); /* FIXME */
return abfd->xvec;
}
/* Write an object file in Encapsulated COFF format.
Section contents have already been written. We write the
file header, symbols, and relocation. */
bfd_boolean
encap_write_object_contents (abfd)
bfd *abfd;
{
bfd_size_type data_pad = 0;
struct external_exec exec_bytes;
struct internal_exec *execp = exec_hdr (abfd);
/* FIXME: Fragments from the old GNU LD program for dealing with
encap coff. */
struct coffheader coffheader;
int need_coff_header;
/* Determine whether to count the header as part of
the text size, and initialize the text size accordingly.
This depends on the kind of system and on the output format selected. */
N_SET_MAGIC (outheader, magic);
#ifdef INITIALIZE_HEADER
INITIALIZE_HEADER;
#endif
text_size = sizeof (struct exec);
#ifdef COFF_ENCAPSULATE
if (relocatable_output == 0 && file_table[0].just_syms_flag == 0)
{
need_coff_header = 1;
/* set this flag now, since it will change the values of N_TXTOFF, etc */
N_SET_FLAGS (outheader, aout_backend_info (abfd)->exec_hdr_flags);
text_size += sizeof (struct coffheader);
}
#endif
#ifdef COFF_ENCAPSULATE
if (need_coff_header)
{
/* We are encapsulating BSD format within COFF format. */
struct coffscn *tp, *dp, *bp;
tp = &coffheader.scns[0];
dp = &coffheader.scns[1];
bp = &coffheader.scns[2];
strcpy (tp->s_name, ".text");
tp->s_paddr = text_start;
tp->s_vaddr = text_start;
tp->s_size = text_size;
tp->s_scnptr = sizeof (struct coffheader) + sizeof (struct exec);
tp->s_relptr = 0;
tp->s_lnnoptr = 0;
tp->s_nreloc = 0;
tp->s_nlnno = 0;
tp->s_flags = 0x20;
strcpy (dp->s_name, ".data");
dp->s_paddr = data_start;
dp->s_vaddr = data_start;
dp->s_size = data_size;
dp->s_scnptr = tp->s_scnptr + tp->s_size;
dp->s_relptr = 0;
dp->s_lnnoptr = 0;
dp->s_nreloc = 0;
dp->s_nlnno = 0;
dp->s_flags = 0x40;
strcpy (bp->s_name, ".bss");
bp->s_paddr = dp->s_vaddr + dp->s_size;
bp->s_vaddr = bp->s_paddr;
bp->s_size = bss_size;
bp->s_scnptr = 0;
bp->s_relptr = 0;
bp->s_lnnoptr = 0;
bp->s_nreloc = 0;
bp->s_nlnno = 0;
bp->s_flags = 0x80;
coffheader.f_magic = COFF_MAGIC;
coffheader.f_nscns = 3;
/* store an unlikely time so programs can
* tell that there is a bsd header
*/
coffheader.f_timdat = 1;
coffheader.f_symptr = 0;
coffheader.f_nsyms = 0;
coffheader.f_opthdr = 28;
coffheader.f_flags = 0x103;
/* aouthdr */
coffheader.magic = ZMAGIC;
coffheader.vstamp = 0;
coffheader.tsize = tp->s_size;
coffheader.dsize = dp->s_size;
coffheader.bsize = bp->s_size;
coffheader.entry = outheader.a_entry;
coffheader.text_start = tp->s_vaddr;
coffheader.data_start = dp->s_vaddr;
}
#endif
#ifdef COFF_ENCAPSULATE
if (need_coff_header)
mywrite (&coffheader, sizeof coffheader, 1, outdesc);
#endif
#ifndef COFF_ENCAPSULATE
padfile (N_TXTOFF (outheader) - sizeof outheader, outdesc);
#endif
text_size -= N_TXTOFF (outheader);
WRITE_HEADERS(abfd, execp);
return TRUE;
}
#define MY_write_object_content encap_write_object_contents
#define MY_object_p encap_object_p
#define MY_exec_hdr_flags N_FLAGS_COFF_ENCAPSULATE
#include "aout-target.h"

View file

@ -16,7 +16,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#define TARGETNAME "a.out-sparc-little"

View file

@ -1,23 +1,23 @@
/* Define a target vector and some small routines for a variant of a.out.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003
2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "aout/aout64.h"
#include "aout/stab_gnu.h"
@ -28,30 +28,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define SEGMENT_SIZE TARGET_PAGE_SIZE
#endif
extern reloc_howto_type * NAME(aout,reloc_type_lookup)
PARAMS ((bfd *, bfd_reloc_code_real_type));
extern reloc_howto_type * NAME (aout, reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
/* Set parameters about this a.out file that are machine-dependent.
This routine is called from some_aout_object_p just before it returns. */
#ifndef MY_callback
static const bfd_target *MY(callback) PARAMS ((bfd *));
static const bfd_target *
MY(callback) (abfd)
bfd *abfd;
MY (callback) (bfd *abfd)
{
struct internal_exec *execp = exec_hdr (abfd);
unsigned int arch_align_power;
unsigned long arch_align;
/* Calculate the file positions of the parts of a newly read aout header */
obj_textsec (abfd)->_raw_size = N_TXTSIZE(*execp);
/* Calculate the file positions of the parts of a newly read aout header. */
obj_textsec (abfd)->size = N_TXTSIZE (*execp);
/* The virtual memory addresses of the sections */
obj_textsec (abfd)->vma = N_TXTADDR(*execp);
obj_datasec (abfd)->vma = N_DATADDR(*execp);
obj_bsssec (abfd)->vma = N_BSSADDR(*execp);
/* The virtual memory addresses of the sections. */
obj_textsec (abfd)->vma = N_TXTADDR (*execp);
obj_datasec (abfd)->vma = N_DATADDR (*execp);
obj_bsssec (abfd)->vma = N_BSSADDR (*execp);
/* For some targets, if the entry point is not in the same page
as the start of the text, then adjust the VMA so that it is.
@ -74,13 +70,13 @@ MY(callback) (abfd)
obj_datasec (abfd)->lma = obj_datasec (abfd)->vma;
obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma;
/* The file offsets of the sections */
/* The file offsets of the sections. */
obj_textsec (abfd)->filepos = N_TXTOFF (*execp);
obj_datasec (abfd)->filepos = N_DATOFF (*execp);
/* The file offsets of the relocation info */
obj_textsec (abfd)->rel_filepos = N_TRELOFF(*execp);
obj_datasec (abfd)->rel_filepos = N_DRELOFF(*execp);
/* The file offsets of the relocation info. */
obj_textsec (abfd)->rel_filepos = N_TRELOFF (*execp);
obj_datasec (abfd)->rel_filepos = N_DRELOFF (*execp);
/* The file offsets of the string table and symbol table. */
obj_sym_filepos (abfd) = N_SYMOFF (*execp);
@ -103,19 +99,19 @@ MY(callback) (abfd)
execp->a_drsize / obj_reloc_entry_size (abfd);
/* Now that we know the architecture, set the alignments of the
sections. This is normally done by NAME(aout,new_section_hook),
sections. This is normally done by NAME (aout,new_section_hook),
but when the initial sections were created the architecture had
not yet been set. However, for backward compatibility, we don't
set the alignment power any higher than as required by the size
of the section. */
arch_align_power = bfd_get_arch_info (abfd)->section_align_power;
arch_align = 1 << arch_align_power;
if ((BFD_ALIGN (obj_textsec (abfd)->_raw_size, arch_align)
== obj_textsec (abfd)->_raw_size)
&& (BFD_ALIGN (obj_datasec (abfd)->_raw_size, arch_align)
== obj_datasec (abfd)->_raw_size)
&& (BFD_ALIGN (obj_bsssec (abfd)->_raw_size, arch_align)
== obj_bsssec (abfd)->_raw_size))
if ((BFD_ALIGN (obj_textsec (abfd)->size, arch_align)
== obj_textsec (abfd)->size)
&& (BFD_ALIGN (obj_datasec (abfd)->size, arch_align)
== obj_datasec (abfd)->size)
&& (BFD_ALIGN (obj_bsssec (abfd)->size, arch_align)
== obj_bsssec (abfd)->size))
{
obj_textsec (abfd)->alignment_power = arch_align_power;
obj_datasec (abfd)->alignment_power = arch_align_power;
@ -124,31 +120,23 @@ MY(callback) (abfd)
/* Don't set sizes now -- can't be sure until we know arch & mach.
Sizes get set in set_sizes callback, later. */
#if 0
adata(abfd).page_size = TARGET_PAGE_SIZE;
adata(abfd).segment_size = SEGMENT_SIZE;
adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
#endif
return abfd->xvec;
}
#endif
#ifndef MY_object_p
/* Finish up the reading of an a.out file header */
static const bfd_target *MY(object_p) PARAMS ((bfd *));
/* Finish up the reading of an a.out file header. */
static const bfd_target *
MY(object_p) (abfd)
bfd *abfd;
MY (object_p) (bfd *abfd)
{
struct external_exec exec_bytes; /* Raw exec header from file */
struct internal_exec exec; /* Cleaned-up exec header */
struct external_exec exec_bytes; /* Raw exec header from file. */
struct internal_exec exec; /* Cleaned-up exec header. */
const bfd_target *target;
bfd_size_type amt = EXEC_BYTES_SIZE;
if (bfd_bread ((PTR) &exec_bytes, amt, abfd) != amt)
if (bfd_bread ((void *) &exec_bytes, amt, abfd) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
@ -159,28 +147,31 @@ MY(object_p) (abfd)
exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
#else
exec.a_info = GET_MAGIC (abfd, exec_bytes.e_info);
#endif /* SWAP_MAGIC */
if (N_BADMAG (exec)) return 0;
#ifdef MACHTYPE_OK
if (!(MACHTYPE_OK (N_MACHTYPE (exec)))) return 0;
#endif
NAME(aout,swap_exec_header_in) (abfd, &exec_bytes, &exec);
if (N_BADMAG (exec))
return 0;
#ifdef MACHTYPE_OK
if (!(MACHTYPE_OK (N_MACHTYPE (exec))))
return 0;
#endif
NAME (aout, swap_exec_header_in) (abfd, &exec_bytes, &exec);
#ifdef SWAP_MAGIC
/* swap_exec_header_in read in a_info with the wrong byte order */
/* Swap_exec_header_in read in a_info with the wrong byte order. */
exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
#endif /* SWAP_MAGIC */
#endif
target = NAME(aout,some_aout_object_p) (abfd, &exec, MY(callback));
target = NAME (aout, some_aout_object_p) (abfd, &exec, MY (callback));
#ifdef ENTRY_CAN_BE_ZERO
/* The NEWSOS3 entry-point is/was 0, which (amongst other lossage)
* means that it isn't obvious if EXEC_P should be set.
* All of the following must be true for an executable:
* There must be no relocations, the bfd can be neither an
* archive nor an archive element, and the file must be executable. */
means that it isn't obvious if EXEC_P should be set.
All of the following must be true for an executable:
There must be no relocations, the bfd can be neither an
archive nor an archive element, and the file must be executable. */
if (exec.a_trsize + exec.a_drsize == 0
&& bfd_get_format(abfd) == bfd_object && abfd->my_archive == NULL)
@ -196,28 +187,18 @@ MY(object_p) (abfd)
return target;
}
#define MY_object_p MY(object_p)
#define MY_object_p MY (object_p)
#endif
#ifndef MY_mkobject
static bfd_boolean MY(mkobject) PARAMS ((bfd *));
static bfd_boolean
MY(mkobject) (abfd)
bfd *abfd;
MY (mkobject) (bfd *abfd)
{
if (! NAME(aout,mkobject) (abfd))
return FALSE;
#if 0 /* Sizes get set in set_sizes callback, later, after we know
the architecture and machine. */
adata(abfd).page_size = TARGET_PAGE_SIZE;
adata(abfd).segment_size = SEGMENT_SIZE;
adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
#endif
return TRUE;
return NAME (aout, mkobject (abfd));
}
#define MY_mkobject MY(mkobject)
#define MY_mkobject MY (mkobject)
#endif
#ifndef MY_bfd_copy_private_section_data
@ -228,15 +209,11 @@ MY(mkobject) (abfd)
section contents, and copy_private_bfd_data is not called until
after the section contents have been set. */
static bfd_boolean MY_bfd_copy_private_section_data
PARAMS ((bfd *, asection *, bfd *, asection *));
static bfd_boolean
MY_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
bfd *ibfd;
asection *isec ATTRIBUTE_UNUSED;
bfd *obfd;
asection *osec ATTRIBUTE_UNUSED;
MY_bfd_copy_private_section_data (bfd *ibfd,
asection *isec ATTRIBUTE_UNUSED,
bfd *obfd,
asection *osec ATTRIBUTE_UNUSED)
{
if (bfd_get_flavour (ibfd) == bfd_target_aout_flavour
&& bfd_get_flavour (obfd) == bfd_target_aout_flavour)
@ -251,31 +228,26 @@ MY_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
file header, symbols, and relocation. */
#ifndef MY_write_object_contents
static bfd_boolean MY(write_object_contents) PARAMS ((bfd *));
static bfd_boolean
MY(write_object_contents) (abfd)
bfd *abfd;
MY (write_object_contents) (bfd *abfd)
{
struct external_exec exec_bytes;
struct internal_exec *execp = exec_hdr (abfd);
obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
WRITE_HEADERS(abfd, execp);
WRITE_HEADERS (abfd, execp);
return TRUE;
}
#define MY_write_object_contents MY(write_object_contents)
#define MY_write_object_contents MY (write_object_contents)
#endif
#ifndef MY_set_sizes
static bfd_boolean MY(set_sizes) PARAMS ((bfd *));
static bfd_boolean
MY(set_sizes) (abfd)
bfd *abfd;
MY (set_sizes) (bfd *abfd)
{
adata(abfd).page_size = TARGET_PAGE_SIZE;
adata(abfd).segment_size = SEGMENT_SIZE;
@ -289,7 +261,7 @@ MY(set_sizes) (abfd)
adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
return TRUE;
}
#define MY_set_sizes MY(set_sizes)
#define MY_set_sizes MY (set_sizes)
#endif
#ifndef MY_exec_hdr_flags
@ -329,12 +301,13 @@ MY(set_sizes) (abfd)
#define MY_finish_dynamic_link 0
#endif
static const struct aout_backend_data MY(backend_data) = {
static const struct aout_backend_data MY (backend_data) =
{
MY_zmagic_contiguous,
MY_text_includes_header,
MY_entry_is_text_address,
MY_exec_hdr_flags,
0, /* text vma? */
0, /* Text vma? */
MY_set_sizes,
MY_exec_header_not_counted,
MY_add_dynamic_symbols,
@ -344,22 +317,18 @@ static const struct aout_backend_data MY(backend_data) = {
MY_check_dynamic_reloc,
MY_finish_dynamic_link
};
#define MY_backend_data &MY(backend_data)
#define MY_backend_data &MY (backend_data)
#endif
#ifndef MY_final_link_callback
/* Callback for the final_link routine to set the section offsets. */
static void MY_final_link_callback
PARAMS ((bfd *, file_ptr *, file_ptr *, file_ptr *));
static void
MY_final_link_callback (abfd, ptreloff, pdreloff, psymoff)
bfd *abfd;
file_ptr *ptreloff;
file_ptr *pdreloff;
file_ptr *psymoff;
MY_final_link_callback (bfd *abfd,
file_ptr *ptreloff,
file_ptr *pdreloff,
file_ptr *psymoff)
{
struct internal_exec *execp = exec_hdr (abfd);
@ -375,14 +344,10 @@ MY_final_link_callback (abfd, ptreloff, pdreloff, psymoff)
/* Final link routine. We need to use a call back to get the correct
offsets in the output file. */
static bfd_boolean MY_bfd_final_link PARAMS ((bfd *, struct bfd_link_info *));
static bfd_boolean
MY_bfd_final_link (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
{
return NAME(aout,final_link) (abfd, info, MY_final_link_callback);
return NAME (aout, final_link) (abfd, info, MY_final_link_callback);
}
#endif
@ -443,62 +408,65 @@ MY_bfd_final_link (abfd, info)
#endif
#ifndef MY_bfd_debug_info_accumulate
#define MY_bfd_debug_info_accumulate \
(void (*) PARAMS ((bfd*, struct bfd_section *))) bfd_void
(void (*) (bfd *, struct bfd_section *)) bfd_void
#endif
#ifndef MY_core_file_failing_command
#define MY_core_file_failing_command NAME(aout,core_file_failing_command)
#define MY_core_file_failing_command NAME (aout, core_file_failing_command)
#endif
#ifndef MY_core_file_failing_signal
#define MY_core_file_failing_signal NAME(aout,core_file_failing_signal)
#define MY_core_file_failing_signal NAME (aout, core_file_failing_signal)
#endif
#ifndef MY_core_file_matches_executable_p
#define MY_core_file_matches_executable_p NAME(aout,core_file_matches_executable_p)
#define MY_core_file_matches_executable_p NAME (aout, core_file_matches_executable_p)
#endif
#ifndef MY_set_section_contents
#define MY_set_section_contents NAME(aout,set_section_contents)
#define MY_set_section_contents NAME (aout, set_section_contents)
#endif
#ifndef MY_get_section_contents
#define MY_get_section_contents NAME(aout,get_section_contents)
#define MY_get_section_contents NAME (aout, get_section_contents)
#endif
#ifndef MY_get_section_contents_in_window
#define MY_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
#endif
#ifndef MY_new_section_hook
#define MY_new_section_hook NAME(aout,new_section_hook)
#define MY_new_section_hook NAME (aout, new_section_hook)
#endif
#ifndef MY_get_symtab_upper_bound
#define MY_get_symtab_upper_bound NAME(aout,get_symtab_upper_bound)
#define MY_get_symtab_upper_bound NAME (aout, get_symtab_upper_bound)
#endif
#ifndef MY_canonicalize_symtab
#define MY_canonicalize_symtab NAME(aout,canonicalize_symtab)
#define MY_canonicalize_symtab NAME (aout, canonicalize_symtab)
#endif
#ifndef MY_get_reloc_upper_bound
#define MY_get_reloc_upper_bound NAME(aout,get_reloc_upper_bound)
#define MY_get_reloc_upper_bound NAME (aout,get_reloc_upper_bound)
#endif
#ifndef MY_canonicalize_reloc
#define MY_canonicalize_reloc NAME(aout,canonicalize_reloc)
#define MY_canonicalize_reloc NAME (aout, canonicalize_reloc)
#endif
#ifndef MY_make_empty_symbol
#define MY_make_empty_symbol NAME(aout,make_empty_symbol)
#define MY_make_empty_symbol NAME (aout, make_empty_symbol)
#endif
#ifndef MY_print_symbol
#define MY_print_symbol NAME(aout,print_symbol)
#define MY_print_symbol NAME (aout, print_symbol)
#endif
#ifndef MY_get_symbol_info
#define MY_get_symbol_info NAME(aout,get_symbol_info)
#define MY_get_symbol_info NAME (aout, get_symbol_info)
#endif
#ifndef MY_get_lineno
#define MY_get_lineno NAME(aout,get_lineno)
#define MY_get_lineno NAME (aout, get_lineno)
#endif
#ifndef MY_set_arch_mach
#define MY_set_arch_mach NAME(aout,set_arch_mach)
#define MY_set_arch_mach NAME (aout, set_arch_mach)
#endif
#ifndef MY_find_nearest_line
#define MY_find_nearest_line NAME(aout,find_nearest_line)
#define MY_find_nearest_line NAME (aout, find_nearest_line)
#endif
#ifndef MY_find_inliner_info
#define MY_find_inliner_info _bfd_nosymbols_find_inliner_info
#endif
#ifndef MY_sizeof_headers
#define MY_sizeof_headers NAME(aout,sizeof_headers)
#define MY_sizeof_headers NAME (aout, sizeof_headers)
#endif
#ifndef MY_bfd_get_relocated_section_contents
#define MY_bfd_get_relocated_section_contents \
@ -513,29 +481,36 @@ MY_bfd_final_link (abfd, info)
#ifndef MY_bfd_merge_sections
#define MY_bfd_merge_sections bfd_generic_merge_sections
#endif
#ifndef MY_bfd_is_group_section
#define MY_bfd_is_group_section bfd_generic_is_group_section
#endif
#ifndef MY_bfd_discard_group
#define MY_bfd_discard_group bfd_generic_discard_group
#endif
#ifndef MY_section_already_linked
#define MY_section_already_linked \
_bfd_generic_section_already_linked
#endif
#ifndef MY_bfd_reloc_type_lookup
#define MY_bfd_reloc_type_lookup NAME(aout,reloc_type_lookup)
#define MY_bfd_reloc_type_lookup NAME (aout, reloc_type_lookup)
#endif
#ifndef MY_bfd_make_debug_symbol
#define MY_bfd_make_debug_symbol 0
#endif
#ifndef MY_read_minisymbols
#define MY_read_minisymbols NAME(aout,read_minisymbols)
#define MY_read_minisymbols NAME (aout, read_minisymbols)
#endif
#ifndef MY_minisymbol_to_symbol
#define MY_minisymbol_to_symbol NAME(aout,minisymbol_to_symbol)
#define MY_minisymbol_to_symbol NAME (aout, minisymbol_to_symbol)
#endif
#ifndef MY_bfd_link_hash_table_create
#define MY_bfd_link_hash_table_create NAME(aout,link_hash_table_create)
#define MY_bfd_link_hash_table_create NAME (aout, link_hash_table_create)
#endif
#ifndef MY_bfd_link_hash_table_free
#define MY_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#endif
#ifndef MY_bfd_link_add_symbols
#define MY_bfd_link_add_symbols NAME(aout,link_add_symbols)
#define MY_bfd_link_add_symbols NAME (aout, link_add_symbols)
#endif
#ifndef MY_bfd_link_just_syms
#define MY_bfd_link_just_syms _bfd_generic_link_just_syms
@ -556,6 +531,10 @@ MY_bfd_final_link (abfd, info)
#define MY_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
#endif
#ifndef MY_bfd_copy_private_header_data
#define MY_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
#endif
#ifndef MY_bfd_print_private_bfd_data
#define MY_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data
#endif
@ -568,8 +547,12 @@ MY_bfd_final_link (abfd, info)
#define MY_bfd_is_local_label_name bfd_generic_is_local_label_name
#endif
#ifndef MY_bfd_is_target_special_symbol
#define MY_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
#endif
#ifndef MY_bfd_free_cached_info
#define MY_bfd_free_cached_info NAME(aout,bfd_free_cached_info)
#define MY_bfd_free_cached_info NAME (aout, bfd_free_cached_info)
#endif
#ifndef MY_close_and_cleanup
@ -584,6 +567,10 @@ MY_bfd_final_link (abfd, info)
#define MY_canonicalize_dynamic_symtab \
_bfd_nodynamic_canonicalize_dynamic_symtab
#endif
#ifndef MY_get_synthetic_symtab
#define MY_get_synthetic_symtab \
_bfd_nodynamic_get_synthetic_symtab
#endif
#ifndef MY_get_dynamic_reloc_upper_bound
#define MY_get_dynamic_reloc_upper_bound \
_bfd_nodynamic_get_dynamic_reloc_upper_bound
@ -593,55 +580,55 @@ MY_bfd_final_link (abfd, info)
_bfd_nodynamic_canonicalize_dynamic_reloc
#endif
/* Aout symbols normally have leading underscores */
/* Aout symbols normally have leading underscores. */
#ifndef MY_symbol_leading_char
#define MY_symbol_leading_char '_'
#endif
/* Aout archives normally use spaces for padding */
/* Aout archives normally use spaces for padding. */
#ifndef AR_PAD_CHAR
#define AR_PAD_CHAR ' '
#endif
#ifndef MY_BFD_TARGET
const bfd_target MY(vec) =
const bfd_target MY (vec) =
{
TARGETNAME, /* name */
TARGETNAME, /* Name. */
bfd_target_aout_flavour,
#ifdef TARGET_IS_BIG_ENDIAN_P
BFD_ENDIAN_BIG, /* target byte order (big) */
BFD_ENDIAN_BIG, /* target headers byte order (big) */
BFD_ENDIAN_BIG, /* Target byte order (big). */
BFD_ENDIAN_BIG, /* Target headers byte order (big). */
#else
BFD_ENDIAN_LITTLE, /* target byte order (little) */
BFD_ENDIAN_LITTLE, /* target headers byte order (little) */
BFD_ENDIAN_LITTLE, /* Target byte order (little). */
BFD_ENDIAN_LITTLE, /* Target headers byte order (little). */
#endif
(HAS_RELOC | EXEC_P | /* object flags */
(HAS_RELOC | EXEC_P | /* Object flags. */
HAS_LINENO | HAS_DEBUG |
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
MY_symbol_leading_char,
AR_PAD_CHAR, /* ar_pad_char */
15, /* ar_max_namelen */
AR_PAD_CHAR, /* AR_pad_char. */
15, /* AR_max_namelen. */
#ifdef TARGET_IS_BIG_ENDIAN_P
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */
#else
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Data. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Headers. */
#endif
{_bfd_dummy_target, MY_object_p, /* bfd_check_format */
{_bfd_dummy_target, MY_object_p, /* bfd_check_format. */
bfd_generic_archive_p, MY_core_file_p},
{bfd_false, MY_mkobject, /* bfd_set_format */
{bfd_false, MY_mkobject, /* bfd_set_format. */
_bfd_generic_mkarchive, bfd_false},
{bfd_false, MY_write_object_contents, /* bfd_write_contents */
{bfd_false, MY_write_object_contents, /* bfd_write_contents. */
_bfd_write_archive_contents, bfd_false},
BFD_JUMP_TABLE_GENERIC (MY),
@ -654,9 +641,9 @@ const bfd_target MY(vec) =
BFD_JUMP_TABLE_LINK (MY),
BFD_JUMP_TABLE_DYNAMIC (MY),
/* Alternative_target */
/* Alternative_target. */
NULL,
(PTR) MY_backend_data
MY_backend_data
};
#endif /* MY_BFD_TARGET */

View file

@ -17,7 +17,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#define TARGETNAME "a.out-zero-big"

View file

@ -16,7 +16,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#define ARCH_SIZE 32

View file

@ -16,7 +16,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#define ARCH_SIZE 64

View file

@ -1,31 +1,31 @@
/* A.out "format 1" file handling code for BFD.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
2001, 2002, 2003
2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
#include "aout/sun4.h"
#include "libaout.h" /* BFD a.out internal data structures */
#include "libaout.h" /* BFD a.out internal data structures. */
#include "aout/aout64.h"
#include "aout/stab_gnu.h"
@ -42,30 +42,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
&& bfd_lookup_arch (bfd_arch_m68k, 0) != NULL))
#endif
/*
The file @code{aoutf1.h} contains the code for BFD's
a.out back end. Control over the generated back end is given by these
two preprocessor names:
@table @code
@item ARCH_SIZE
This value should be either 32 or 64, depending upon the size of an
int in the target format. It changes the sizes of the structs which
perform the memory/disk mapping of structures.
/* The file @code{aoutf1.h} contains the code for BFD's
a.out back end. Control over the generated back end is given by these
two preprocessor names:
@table @code
@item ARCH_SIZE
This value should be either 32 or 64, depending upon the size of an
int in the target format. It changes the sizes of the structs which
perform the memory/disk mapping of structures.
The 64 bit backend may only be used if the host compiler supports 64
ints (eg long long with gcc), by defining the name @code{BFD_HOST_64_BIT} in @code{bfd.h}.
With this name defined, @emph{all} bfd operations are performed with 64bit
arithmetic, not just those to a 64bit target.
The 64 bit backend may only be used if the host compiler supports 64
ints (eg long long with gcc), by defining the name @code{BFD_HOST_64_BIT} in @code{bfd.h}.
With this name defined, @emph{all} bfd operations are performed with 64bit
arithmetic, not just those to a 64bit target.
@item TARGETNAME
The name put into the target vector.
@item
@end table
*/
/*SUPPRESS558*/
/*SUPPRESS529*/
@item TARGETNAME
The name put into the target vector.
@item
@end table. */
#if ARCH_SIZE == 64
#define sunos_set_arch_mach sunos_64_set_arch_mach
@ -75,25 +69,6 @@ The name put into the target vector.
#define sunos_write_object_contents aout_32_sunos4_write_object_contents
#endif
static bfd_boolean sunos_merge_private_bfd_data
PARAMS ((bfd *, bfd *));
static void sunos_set_arch_mach
PARAMS ((bfd *, enum machine_type));
static void choose_reloc_size
PARAMS ((bfd *));
static bfd_boolean sunos_write_object_contents
PARAMS ((bfd *));
static const bfd_target *sunos4_core_file_p
PARAMS ((bfd *));
static char *sunos4_core_file_failing_command
PARAMS ((bfd *));
static int sunos4_core_file_failing_signal
PARAMS ((bfd *));
static bfd_boolean sunos4_core_file_matches_executable_p
PARAMS ((bfd *, bfd *));
static bfd_boolean sunos4_set_sizes
PARAMS ((bfd *));
/* Merge backend data into the output file.
This is necessary on sparclet-aout where we want the resultant machine
number to be M_SPARCLET if any input file is M_SPARCLET. */
@ -101,8 +76,7 @@ static bfd_boolean sunos4_set_sizes
#define MY_bfd_merge_private_bfd_data sunos_merge_private_bfd_data
static bfd_boolean
sunos_merge_private_bfd_data (ibfd, obfd)
bfd *ibfd, *obfd;
sunos_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
{
if (bfd_get_flavour (ibfd) != bfd_target_aout_flavour
|| bfd_get_flavour (obfd) != bfd_target_aout_flavour)
@ -121,16 +95,14 @@ sunos_merge_private_bfd_data (ibfd, obfd)
depending upon ARCH_SIZE. */
static void
sunos_set_arch_mach (abfd, machtype)
bfd *abfd;
enum machine_type machtype;
sunos_set_arch_mach (bfd *abfd, enum machine_type machtype)
{
/* Determine the architecture and machine type of the object file. */
enum bfd_architecture arch;
unsigned long machine;
switch (machtype)
{
case M_UNKNOWN:
/* Some Sun3s make magic numbers without cpu types in them, so
we'll default to the 68000. */
@ -171,11 +143,6 @@ sunos_set_arch_mach (abfd, machtype)
machine = 0;
break;
case M_29K:
arch = bfd_arch_a29k;
machine = 0;
break;
case M_HPUX:
arch = bfd_arch_m68k;
machine = 0;
@ -193,15 +160,14 @@ sunos_set_arch_mach (abfd, machtype)
NAME(sunos,set_arch_mach) (ABFD, N_MACHTYPE (EXEC)); \
choose_reloc_size(ABFD);
/* Determine the size of a relocation entry, based on the architecture */
/* Determine the size of a relocation entry, based on the architecture. */
static void
choose_reloc_size (abfd)
bfd *abfd;
choose_reloc_size (bfd *abfd)
{
switch (bfd_get_arch (abfd))
{
case bfd_arch_sparc:
case bfd_arch_a29k:
obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;
break;
default:
@ -217,8 +183,7 @@ choose_reloc_size (abfd)
aout_32_sunos4_write_object_contents, depending upon ARCH_SIZE. */
static bfd_boolean
sunos_write_object_contents (abfd)
bfd *abfd;
sunos_write_object_contents (bfd *abfd)
{
struct external_exec exec_bytes;
struct internal_exec *execp = exec_hdr (abfd);
@ -258,9 +223,6 @@ sunos_write_object_contents (abfd)
case bfd_arch_i386:
N_SET_MACHTYPE (*execp, M_386);
break;
case bfd_arch_a29k:
N_SET_MACHTYPE (*execp, M_29K);
break;
default:
N_SET_MACHTYPE (*execp, M_UNKNOWN);
}
@ -276,9 +238,9 @@ sunos_write_object_contents (abfd)
return TRUE;
}
/* core files */
/* Core files. */
#define CORE_MAGIC 0x080456
#define CORE_MAGIC 0x080456
#define CORE_NAMELEN 16
/* The core structure is taken from the Sun documentation.
@ -320,121 +282,112 @@ struct regs
even portably access the stuff in between! */
struct external_sparc_core
{
int c_magic; /* Corefile magic number */
int c_len; /* Sizeof (struct core) */
{
int c_magic; /* Corefile magic number. */
int c_len; /* Sizeof (struct core). */
#define SPARC_CORE_LEN 432
int c_regs[19]; /* General purpose registers -- MACHDEP SIZE */
struct external_exec c_aouthdr; /* A.out header */
int c_signo; /* Killing signal, if any */
int c_tsize; /* Text size (bytes) */
int c_dsize; /* Data size (bytes) */
int c_ssize; /* Stack size (bytes) */
char c_cmdname[CORE_NAMELEN + 1]; /* Command name */
double fp_stuff[1]; /* external FPU state (size unknown by us) */
/* The type "double" is critical here, for alignment.
SunOS declares a struct here, but the struct's alignment
is double since it contains doubles. */
int c_ucode; /* Exception no. from u_code */
/* (this member is not accessible by name since we don't
portably know the size of fp_stuff.) */
};
struct regs c_regs; /* General purpose registers -- MACHDEP SIZE. */
struct external_exec c_aouthdr; /* A.out header. */
int c_signo; /* Killing signal, if any. */
int c_tsize; /* Text size (bytes). */
int c_dsize; /* Data size (bytes). */
int c_ssize; /* Stack size (bytes). */
char c_cmdname[CORE_NAMELEN + 1]; /* Command name. */
double fp_stuff[1]; /* External FPU state (size unknown by us). */
/* The type "double" is critical here, for alignment.
SunOS declares a struct here, but the struct's
alignment is double since it contains doubles. */
int c_ucode; /* Exception no. from u_code. */
/* This member is not accessible by name since
we don't portably know the size of fp_stuff. */
};
/* Core files generated by the BCP (the part of Solaris which allows
it to run SunOS4 a.out files). */
struct external_solaris_bcp_core
{
int c_magic; /* Corefile magic number */
int c_len; /* Sizeof (struct core) */
{
int c_magic; /* Corefile magic number. */
int c_len; /* Sizeof (struct core). */
#define SOLARIS_BCP_CORE_LEN 456
int c_regs[19]; /* General purpose registers -- MACHDEP SIZE */
int c_exdata_vp; /* exdata structure */
int c_exdata_tsize;
int c_exdata_dsize;
int c_exdata_bsize;
int c_exdata_lsize;
int c_exdata_nshlibs;
short c_exdata_mach;
short c_exdata_mag;
int c_exdata_toffset;
int c_exdata_doffset;
int c_exdata_loffset;
int c_exdata_txtorg;
int c_exdata_datorg;
int c_exdata_entloc;
int c_signo; /* Killing signal, if any */
int c_tsize; /* Text size (bytes) */
int c_dsize; /* Data size (bytes) */
int c_ssize; /* Stack size (bytes) */
char c_cmdname[CORE_NAMELEN + 1]; /* Command name */
double fp_stuff[1]; /* external FPU state (size unknown by us) */
/* The type "double" is critical here, for alignment.
SunOS declares a struct here, but the struct's alignment
is double since it contains doubles. */
int c_ucode; /* Exception no. from u_code */
/* (this member is not accessible by name since we don't
portably know the size of fp_stuff.) */
};
struct regs c_regs; /* General purpose registers -- MACHDEP SIZE. */
int c_exdata_vp; /* Exdata structure. */
int c_exdata_tsize;
int c_exdata_dsize;
int c_exdata_bsize;
int c_exdata_lsize;
int c_exdata_nshlibs;
short c_exdata_mach;
short c_exdata_mag;
int c_exdata_toffset;
int c_exdata_doffset;
int c_exdata_loffset;
int c_exdata_txtorg;
int c_exdata_datorg;
int c_exdata_entloc;
int c_signo; /* Killing signal, if any. */
int c_tsize; /* Text size (bytes). */
int c_dsize; /* Data size (bytes). */
int c_ssize; /* Stack size (bytes). */
char c_cmdname[CORE_NAMELEN + 1]; /* Command name. */
double fp_stuff[1]; /* External FPU state (size unknown by us). */
/* The type "double" is critical here, for alignment.
SunOS declares a struct here, but the struct's
alignment is double since it contains doubles. */
int c_ucode; /* Exception no. from u_code. */
/* This member is not accessible by name since
we don't portably know the size of fp_stuff. */
};
struct external_sun3_core
{
int c_magic; /* Corefile magic number */
int c_len; /* Sizeof (struct core) */
#define SUN3_CORE_LEN 826 /* As of SunOS 4.1.1 */
int c_regs[18]; /* General purpose registers -- MACHDEP SIZE */
struct external_exec c_aouthdr; /* A.out header */
int c_signo; /* Killing signal, if any */
int c_tsize; /* Text size (bytes) */
int c_dsize; /* Data size (bytes) */
int c_ssize; /* Stack size (bytes) */
char c_cmdname[CORE_NAMELEN + 1]; /* Command name */
double fp_stuff[1]; /* external FPU state (size unknown by us) */
/* The type "double" is critical here, for alignment.
SunOS declares a struct here, but the struct's alignment
is double since it contains doubles. */
int c_ucode; /* Exception no. from u_code */
/* (this member is not accessible by name since we don't
portably know the size of fp_stuff.) */
};
{
int c_magic; /* Corefile magic number. */
int c_len; /* Sizeof (struct core). */
#define SUN3_CORE_LEN 826 /* As of SunOS 4.1.1. */
int c_regs[18]; /* General purpose registers -- MACHDEP SIZE. */
struct external_exec c_aouthdr; /* A.out header. */
int c_signo; /* Killing signal, if any. */
int c_tsize; /* Text size (bytes). */
int c_dsize; /* Data size (bytes). */
int c_ssize; /* Stack size (bytes). */
char c_cmdname[CORE_NAMELEN + 1]; /* Command name. */
double fp_stuff[1]; /* External FPU state (size unknown by us). */
/* The type "double" is critical here, for alignment.
SunOS declares a struct here, but the struct's
alignment is double since it contains doubles. */
int c_ucode; /* Exception no. from u_code. */
/* This member is not accessible by name since
we don't portably know the size of fp_stuff. */
};
struct internal_sunos_core
{
int c_magic; /* Corefile magic number */
int c_len; /* Sizeof (struct core) */
long c_regs_pos; /* file offset of General purpose registers */
int c_regs_size; /* size of General purpose registers */
struct internal_exec c_aouthdr; /* A.out header */
int c_signo; /* Killing signal, if any */
int c_tsize; /* Text size (bytes) */
int c_dsize; /* Data size (bytes) */
bfd_vma c_data_addr; /* Data start (address) */
int c_ssize; /* Stack size (bytes) */
bfd_vma c_stacktop; /* Stack top (address) */
char c_cmdname[CORE_NAMELEN + 1]; /* Command name */
long fp_stuff_pos; /* file offset of external FPU state (regs) */
int fp_stuff_size; /* Size of it */
int c_ucode; /* Exception no. from u_code */
};
{
int c_magic; /* Corefile magic number. */
int c_len; /* Sizeof (struct core). */
long c_regs_pos; /* File offset of General purpose registers. */
int c_regs_size; /* Size of General purpose registers. */
struct internal_exec c_aouthdr; /* A.out header. */
int c_signo; /* Killing signal, if any. */
int c_tsize; /* Text size (bytes). */
int c_dsize; /* Data size (bytes). */
bfd_vma c_data_addr; /* Data start (address). */
int c_ssize; /* Stack size (bytes). */
bfd_vma c_stacktop; /* Stack top (address). */
char c_cmdname[CORE_NAMELEN + 1]; /* Command name. */
long fp_stuff_pos; /* File offset of external FPU state (regs). */
int fp_stuff_size; /* Size of it. */
int c_ucode; /* Exception no. from u_code. */
};
static void swapcore_sun3
PARAMS ((bfd *, char *, struct internal_sunos_core *));
static void swapcore_sparc
PARAMS ((bfd *, char *, struct internal_sunos_core *));
static void swapcore_solaris_bcp
PARAMS ((bfd *, char *, struct internal_sunos_core *));
/* Byte-swap in the Sun-3 core structure. */
/* byte-swap in the Sun-3 core structure */
static void
swapcore_sun3 (abfd, ext, intcore)
bfd *abfd;
char *ext;
struct internal_sunos_core *intcore;
swapcore_sun3 (bfd *abfd, char *ext, struct internal_sunos_core *intcore)
{
struct external_sun3_core *extcore = (struct external_sun3_core *) ext;
intcore->c_magic = H_GET_32 (abfd, &extcore->c_magic);
intcore->c_len = H_GET_32 (abfd, &extcore->c_len);
intcore->c_regs_pos = (long) (((struct external_sun3_core *) 0)->c_regs);
intcore->c_regs_pos = offsetof (struct external_sun3_core, c_regs);
intcore->c_regs_size = sizeof (extcore->c_regs);
#if ARCH_SIZE == 64
aout_64_swap_exec_header_in
@ -448,30 +401,28 @@ swapcore_sun3 (abfd, ext, intcore)
intcore->c_data_addr = N_DATADDR (intcore->c_aouthdr);
intcore->c_ssize = H_GET_32 (abfd, &extcore->c_ssize);
memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname));
intcore->fp_stuff_pos = (long) (((struct external_sun3_core *) 0)->fp_stuff);
intcore->fp_stuff_pos = offsetof (struct external_sun3_core, fp_stuff);
/* FP stuff takes up whole rest of struct, except c_ucode. */
intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) -
(file_ptr) (((struct external_sun3_core *) 0)->fp_stuff);
/* Ucode is the last thing in the struct -- just before the end */
offsetof (struct external_sun3_core, fp_stuff);
/* Ucode is the last thing in the struct -- just before the end. */
intcore->c_ucode = H_GET_32 (abfd,
(intcore->c_len
- sizeof (extcore->c_ucode)
+ (unsigned char *) extcore));
intcore->c_stacktop = 0x0E000000; /* By experimentation */
intcore->c_stacktop = 0x0E000000; /* By experimentation. */
}
/* byte-swap in the Sparc core structure */
/* Byte-swap in the Sparc core structure. */
static void
swapcore_sparc (abfd, ext, intcore)
bfd *abfd;
char *ext;
struct internal_sunos_core *intcore;
swapcore_sparc (bfd *abfd, char *ext, struct internal_sunos_core *intcore)
{
struct external_sparc_core *extcore = (struct external_sparc_core *) ext;
intcore->c_magic = H_GET_32 (abfd, &extcore->c_magic);
intcore->c_len = H_GET_32 (abfd, &extcore->c_len);
intcore->c_regs_pos = (long) (((struct external_sparc_core *) 0)->c_regs);
intcore->c_regs_pos = offsetof (struct external_sparc_core, c_regs);
intcore->c_regs_size = sizeof (extcore->c_regs);
#if ARCH_SIZE == 64
aout_64_swap_exec_header_in
@ -485,11 +436,11 @@ swapcore_sparc (abfd, ext, intcore)
intcore->c_data_addr = N_DATADDR (intcore->c_aouthdr);
intcore->c_ssize = H_GET_32 (abfd, &extcore->c_ssize);
memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname));
intcore->fp_stuff_pos = (long) (((struct external_sparc_core *) 0)->fp_stuff);
intcore->fp_stuff_pos = offsetof (struct external_sparc_core, fp_stuff);
/* FP stuff takes up whole rest of struct, except c_ucode. */
intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) -
(file_ptr) (((struct external_sparc_core *) 0)->fp_stuff);
/* Ucode is the last thing in the struct -- just before the end */
offsetof (struct external_sparc_core, fp_stuff);
/* Ucode is the last thing in the struct -- just before the end. */
intcore->c_ucode = H_GET_32 (abfd,
(intcore->c_len
- sizeof (extcore->c_ucode)
@ -511,7 +462,7 @@ swapcore_sparc (abfd, ext, intcore)
#define SPARC_USRSTACK_SPARC2 ((bfd_vma)0xf8000000)
#define SPARC_USRSTACK_SPARC10 ((bfd_vma)0xf0000000)
{
bfd_vma sp = H_GET_32 (abfd, &((struct regs *) &extcore->c_regs[0])->r_o6);
bfd_vma sp = H_GET_32 (abfd, &extcore->c_regs.r_o6);
if (sp < SPARC_USRSTACK_SPARC10)
intcore->c_stacktop = SPARC_USRSTACK_SPARC10;
else
@ -519,19 +470,17 @@ swapcore_sparc (abfd, ext, intcore)
}
}
/* byte-swap in the Solaris BCP core structure */
/* Byte-swap in the Solaris BCP core structure. */
static void
swapcore_solaris_bcp (abfd, ext, intcore)
bfd *abfd;
char *ext;
struct internal_sunos_core *intcore;
swapcore_solaris_bcp (bfd *abfd, char *ext, struct internal_sunos_core *intcore)
{
struct external_solaris_bcp_core *extcore =
(struct external_solaris_bcp_core *) ext;
intcore->c_magic = H_GET_32 (abfd, &extcore->c_magic);
intcore->c_len = H_GET_32 (abfd, &extcore->c_len);
intcore->c_regs_pos = (long) (((struct external_solaris_bcp_core *) 0)->c_regs);
intcore->c_regs_pos = offsetof (struct external_solaris_bcp_core, c_regs);
intcore->c_regs_size = sizeof (extcore->c_regs);
/* The Solaris BCP exdata structure does not contain an a_syms field,
@ -544,7 +493,7 @@ swapcore_solaris_bcp (abfd, ext, intcore)
are buggy. The exdata structure is not properly filled in, and
the data section is written from address zero instead of the data
start address. */
memset ((PTR) &intcore->c_aouthdr, 0, sizeof (struct internal_exec));
memset ((void *) &intcore->c_aouthdr, 0, sizeof (struct internal_exec));
intcore->c_data_addr = H_GET_32 (abfd, &extcore->c_exdata_datorg);
intcore->c_signo = H_GET_32 (abfd, &extcore->c_signo);
intcore->c_tsize = H_GET_32 (abfd, &extcore->c_tsize);
@ -552,10 +501,10 @@ swapcore_solaris_bcp (abfd, ext, intcore)
intcore->c_ssize = H_GET_32 (abfd, &extcore->c_ssize);
memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname));
intcore->fp_stuff_pos =
(long) (((struct external_solaris_bcp_core *) 0)->fp_stuff);
offsetof (struct external_solaris_bcp_core, fp_stuff);
/* FP stuff takes up whole rest of struct, except c_ucode. */
intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) -
(file_ptr) (((struct external_solaris_bcp_core *) 0)->fp_stuff);
offsetof (struct external_solaris_bcp_core, fp_stuff);
/* Ucode is the last thing in the struct -- just before the end */
intcore->c_ucode = H_GET_32 (abfd,
(intcore->c_len
@ -578,7 +527,7 @@ swapcore_solaris_bcp (abfd, ext, intcore)
#define SPARC_USRSTACK_SPARC2 ((bfd_vma)0xf8000000)
#define SPARC_USRSTACK_SPARC10 ((bfd_vma)0xf0000000)
{
bfd_vma sp = H_GET_32 (abfd, &((struct regs *) &extcore->c_regs[0])->r_o6);
bfd_vma sp = H_GET_32 (abfd, &extcore->c_regs.r_o6);
if (sp < SPARC_USRSTACK_SPARC10)
intcore->c_stacktop = SPARC_USRSTACK_SPARC10;
else
@ -586,17 +535,17 @@ swapcore_solaris_bcp (abfd, ext, intcore)
}
}
/* need this cast because ptr is really void * */
#define core_hdr(bfd) ((bfd)->tdata.sun_core_data)
#define core_datasec(bfd) (core_hdr(bfd)->data_section)
#define core_stacksec(bfd) (core_hdr(bfd)->stack_section)
#define core_regsec(bfd) (core_hdr(bfd)->reg_section)
#define core_reg2sec(bfd) (core_hdr(bfd)->reg2_section)
/* Need this cast because ptr is really void *. */
#define core_hdr(bfd) ((bfd)->tdata.sun_core_data)
#define core_datasec(bfd) (core_hdr (bfd)->data_section)
#define core_stacksec(bfd) (core_hdr (bfd)->stack_section)
#define core_regsec(bfd) (core_hdr (bfd)->reg_section)
#define core_reg2sec(bfd) (core_hdr (bfd)->reg2_section)
/* These are stored in the bfd's tdata */
/* These are stored in the bfd's tdata. */
struct sun_core_struct
{
struct internal_sunos_core *hdr; /* core file header */
struct internal_sunos_core *hdr; /* Core file header. */
asection *data_section;
asection *stack_section;
asection *reg_section;
@ -604,10 +553,9 @@ struct sun_core_struct
};
static const bfd_target *
sunos4_core_file_p (abfd)
bfd *abfd;
sunos4_core_file_p (bfd *abfd)
{
unsigned char longbuf[4]; /* Raw bytes of various header fields */
unsigned char longbuf[4]; /* Raw bytes of various header fields. */
bfd_size_type core_size, amt;
unsigned long core_mag;
struct internal_sunos_core *core;
@ -619,40 +567,40 @@ sunos4_core_file_p (abfd)
char external_core[1];
} *mergem;
if (bfd_bread ((PTR) longbuf, (bfd_size_type) sizeof (longbuf), abfd)
if (bfd_bread ((void *) longbuf, (bfd_size_type) sizeof (longbuf), abfd)
!= sizeof (longbuf))
return 0;
return NULL;
core_mag = H_GET_32 (abfd, longbuf);
if (core_mag != CORE_MAGIC)
return 0;
return NULL;
/* SunOS core headers can vary in length; second word is size; */
if (bfd_bread ((PTR) longbuf, (bfd_size_type) sizeof (longbuf), abfd)
if (bfd_bread ((void *) longbuf, (bfd_size_type) sizeof (longbuf), abfd)
!= sizeof (longbuf))
return 0;
return NULL;
core_size = H_GET_32 (abfd, longbuf);
/* Sanity check */
/* Sanity check. */
if (core_size > 20000)
return 0;
return NULL;
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
return 0;
return NULL;
amt = core_size + sizeof (struct mergem);
mergem = (struct mergem *) bfd_zalloc (abfd, amt);
mergem = bfd_zalloc (abfd, amt);
if (mergem == NULL)
return 0;
return NULL;
extcore = mergem->external_core;
if ((bfd_bread ((PTR) extcore, core_size, abfd)) != core_size)
if ((bfd_bread ((void *) extcore, core_size, abfd)) != core_size)
{
loser:
bfd_release (abfd, (char *) mergem);
abfd->tdata.any = NULL;
bfd_section_list_clear (abfd);
return 0;
return NULL;
}
/* Validate that it's a core file we know how to handle, due to sun
@ -671,7 +619,7 @@ sunos4_core_file_p (abfd)
swapcore_solaris_bcp (abfd, extcore, core);
break;
default:
bfd_set_error (bfd_error_system_call); /* FIXME */
bfd_set_error (bfd_error_system_call); /* FIXME. */
goto loser;
}
@ -701,10 +649,10 @@ sunos4_core_file_p (abfd)
core_regsec (abfd)->flags = SEC_HAS_CONTENTS;
core_reg2sec (abfd)->flags = SEC_HAS_CONTENTS;
core_stacksec (abfd)->_raw_size = core->c_ssize;
core_datasec (abfd)->_raw_size = core->c_dsize;
core_regsec (abfd)->_raw_size = core->c_regs_size;
core_reg2sec (abfd)->_raw_size = core->fp_stuff_size;
core_stacksec (abfd)->size = core->c_ssize;
core_datasec (abfd)->size = core->c_dsize;
core_regsec (abfd)->size = core->c_regs_size;
core_reg2sec (abfd)->size = core->fp_stuff_size;
core_stacksec (abfd)->vma = (core->c_stacktop - core->c_ssize);
core_datasec (abfd)->vma = core->c_data_addr;
@ -713,11 +661,11 @@ sunos4_core_file_p (abfd)
core_stacksec (abfd)->filepos = core->c_len + core->c_dsize;
core_datasec (abfd)->filepos = core->c_len;
/* We'll access the regs afresh in the core file, like any section: */
/* We'll access the regs afresh in the core file, like any section: */
core_regsec (abfd)->filepos = (file_ptr) core->c_regs_pos;
core_reg2sec (abfd)->filepos = (file_ptr) core->fp_stuff_pos;
/* Align to word at least */
/* Align to word at least. */
core_stacksec (abfd)->alignment_power = 2;
core_datasec (abfd)->alignment_power = 2;
core_regsec (abfd)->alignment_power = 2;
@ -727,23 +675,19 @@ sunos4_core_file_p (abfd)
}
static char *
sunos4_core_file_failing_command (abfd)
bfd *abfd;
sunos4_core_file_failing_command (bfd *abfd)
{
return core_hdr (abfd)->hdr->c_cmdname;
}
static int
sunos4_core_file_failing_signal (abfd)
bfd *abfd;
sunos4_core_file_failing_signal (bfd *abfd)
{
return core_hdr (abfd)->hdr->c_signo;
}
static bfd_boolean
sunos4_core_file_matches_executable_p (core_bfd, exec_bfd)
bfd *core_bfd;
bfd *exec_bfd;
sunos4_core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd)
{
if (core_bfd->xvec != exec_bfd->xvec)
{
@ -755,15 +699,15 @@ sunos4_core_file_matches_executable_p (core_bfd, exec_bfd)
if ((core_hdr (core_bfd)->hdr)->c_len == SOLARIS_BCP_CORE_LEN)
return TRUE;
return (memcmp ((char *) &((core_hdr (core_bfd)->hdr)->c_aouthdr),
(char *) exec_hdr (exec_bfd),
sizeof (struct internal_exec)) == 0);
return memcmp ((char *) &((core_hdr (core_bfd)->hdr)->c_aouthdr),
(char *) exec_hdr (exec_bfd),
sizeof (struct internal_exec)) == 0;
}
#define MY_set_sizes sunos4_set_sizes
static bfd_boolean
sunos4_set_sizes (abfd)
bfd *abfd;
sunos4_set_sizes (bfd *abfd)
{
switch (bfd_get_arch (abfd))
{
@ -812,13 +756,13 @@ sunos4_set_sizes (abfd)
static const struct aout_backend_data sunos4_aout_backend =
{
0, /* zmagic files are not contiguous */
1, /* text includes header */
0, /* Zmagic files are not contiguous. */
1, /* Text includes header. */
MY_entry_is_text_address,
MY_exec_hdr_flags,
0, /* default text vma */
0, /* Default text vma. */
sunos4_set_sizes,
0, /* header is counted in zmagic text */
0, /* Header is counted in zmagic text. */
MY_add_dynamic_symbols,
MY_add_one_symbol,
MY_link_dynamic_object,
@ -833,11 +777,10 @@ static const struct aout_backend_data sunos4_aout_backend =
#define MY_bfd_debug_info_start bfd_void
#define MY_bfd_debug_info_end bfd_void
#define MY_bfd_debug_info_accumulate \
(void (*) PARAMS ((bfd *, struct bfd_section *))) bfd_void
#define MY_bfd_debug_info_accumulate (void (*) (bfd *, struct bfd_section *)) bfd_void
#define MY_core_file_p sunos4_core_file_p
#define MY_write_object_contents NAME(aout,sunos4_write_object_contents)
#define MY_backend_data &sunos4_aout_backend
#define MY_write_object_contents NAME(aout, sunos4_write_object_contents)
#define MY_backend_data & sunos4_aout_backend
#ifndef TARGET_IS_LITTLE_ENDIAN_P
#define TARGET_IS_BIG_ENDIAN_P

File diff suppressed because it is too large Load diff

View file

@ -1,24 +1,24 @@
/* BFD back-end for archive files (libraries).
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003
2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Written by Cygnus Support. Mostly Gumby Henkel-Wallace's fault.
This file is part of BFD, the Binary File Descriptor library.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/*
@setfilename archive-info
@ -74,6 +74,8 @@ DESCRIPTION
Archives are supported in BFD in <<archive.c>>.
SUBSECTION
Archive functions
*/
/* Assumes:
@ -121,7 +123,7 @@ DESCRIPTION
Regular files with long names (or embedded spaces, for BSD variants):
"/18 " - SVR4 style, name at offset 18 in name table.
"#1/23 " - Long name (or embedded paces) 23 characters long,
"#1/23 " - Long name (or embedded spaces) 23 characters long,
BSD 4.4 style, full name follows header.
Implemented for reading, not writing.
" 18 " - Long name 18 characters long, extended pseudo-BSD.
@ -129,19 +131,17 @@ DESCRIPTION
#include "bfd.h"
#include "sysdep.h"
#include "libiberty.h"
#include "libbfd.h"
#include "aout/ar.h"
#include "aout/ranlib.h"
#include "safe-ctype.h"
#include "hashtab.h"
#ifndef errno
extern int errno;
#endif
#ifdef GNU960
#define BFD_GNU960_ARMAG(abfd) (BFD_COFF_FILE_P((abfd)) ? ARMAG : ARMAGB)
#endif
/* We keep a cache of archive filepointers to archive elements to
speed up searching the archive by filepos. We only add an entry to
the cache when we actually read one. We also don't sort the cache;
@ -150,8 +150,7 @@ extern int errno;
to the front of the contents! */
struct ar_cache {
file_ptr ptr;
bfd *arelt;
struct ar_cache *next;
bfd *arbfd;
};
#define ar_padchar(abfd) ((abfd)->xvec->ar_pad_char)
@ -159,7 +158,22 @@ struct ar_cache {
#define arch_eltdata(bfd) ((struct areltdata *) ((bfd)->arelt_data))
#define arch_hdr(bfd) ((struct ar_hdr *) arch_eltdata(bfd)->arch_header)
void
_bfd_ar_spacepad (char *p, size_t n, const char *fmt, long val)
{
static char buf[20];
size_t len;
snprintf (buf, sizeof (buf), fmt, val);
len = strlen (buf);
if (len < n)
{
memcpy (p, buf, len);
memset (p + len, ' ', n - len);
}
else
memcpy (p, buf, n);
}
bfd_boolean
_bfd_generic_mkarchive (bfd *abfd)
@ -170,11 +184,13 @@ _bfd_generic_mkarchive (bfd *abfd)
if (bfd_ardata (abfd) == NULL)
return FALSE;
bfd_ardata (abfd)->cache = NULL;
bfd_ardata (abfd)->archive_head = NULL;
bfd_ardata (abfd)->symdefs = NULL;
bfd_ardata (abfd)->extended_names = NULL;
bfd_ardata (abfd)->tdata = NULL;
/* Already cleared by bfd_zalloc above.
bfd_ardata (abfd)->cache = NULL;
bfd_ardata (abfd)->archive_head = NULL;
bfd_ardata (abfd)->symdefs = NULL;
bfd_ardata (abfd)->extended_names = NULL;
bfd_ardata (abfd)->extended_names_size = 0;
bfd_ardata (abfd)->tdata = NULL; */
return TRUE;
}
@ -221,7 +237,7 @@ bfd_get_next_mapent (bfd *abfd, symindex prev, carsym **entry)
return prev;
}
/* To be called by backends only */
/* To be called by backends only. */
bfd *
_bfd_create_empty_archive_element_shell (bfd *obfd)
@ -251,40 +267,62 @@ bfd_set_archive_head (bfd *output_archive, bfd *new_head)
bfd *
_bfd_look_for_bfd_in_cache (bfd *arch_bfd, file_ptr filepos)
{
struct ar_cache *current;
htab_t hash_table = bfd_ardata (arch_bfd)->cache;
struct ar_cache m;
m.ptr = filepos;
for (current = bfd_ardata (arch_bfd)->cache; current != NULL;
current = current->next)
if (current->ptr == filepos)
return current->arelt;
return NULL;
if (hash_table)
{
struct ar_cache *entry = (struct ar_cache *) htab_find (hash_table, &m);
if (!entry)
return NULL;
else
return entry->arbfd;
}
else
return NULL;
}
/* Kind of stupid to call cons for each one, but we don't do too many */
static hashval_t
hash_file_ptr (const PTR p)
{
return (hashval_t) (((struct ar_cache *) p)->ptr);
}
/* Returns non-zero if P1 and P2 are equal. */
static int
eq_file_ptr (const PTR p1, const PTR p2)
{
struct ar_cache *arc1 = (struct ar_cache *) p1;
struct ar_cache *arc2 = (struct ar_cache *) p2;
return arc1->ptr == arc2->ptr;
}
/* Kind of stupid to call cons for each one, but we don't do too many. */
bfd_boolean
_bfd_add_bfd_to_archive_cache (bfd *arch_bfd, file_ptr filepos, bfd *new_elt)
{
bfd_size_type amt = sizeof (struct ar_cache);
struct ar_cache *cache;
htab_t hash_table = bfd_ardata (arch_bfd)->cache;
struct ar_cache *new_cache = bfd_zalloc (arch_bfd, amt);
if (new_cache == NULL)
return FALSE;
new_cache->ptr = filepos;
new_cache->arelt = new_elt;
new_cache->next = NULL;
if (bfd_ardata (arch_bfd)->cache == NULL)
bfd_ardata (arch_bfd)->cache = new_cache;
else
/* If the hash table hasn't been created, create it. */
if (hash_table == NULL)
{
struct ar_cache *current = bfd_ardata (arch_bfd)->cache;
while (current->next != NULL)
current = current->next;
current->next = new_cache;
hash_table = htab_create_alloc (16, hash_file_ptr, eq_file_ptr,
NULL, calloc, free);
if (hash_table == NULL)
return FALSE;
bfd_ardata (arch_bfd)->cache = hash_table;
}
/* Insert new_elt into the hash table by filepos. */
cache = bfd_zalloc (arch_bfd, sizeof (struct ar_cache));
cache->ptr = filepos;
cache->arbfd = new_elt;
*htab_find_slot (hash_table, (const void *) cache, INSERT) = cache;
return TRUE;
}
@ -301,7 +339,7 @@ get_extended_arelt_filename (bfd *arch, const char *name)
errno = 0;
/* Skip first char, which is '/' in SVR4 or ' ' in some other variants. */
index = strtol (name + 1, NULL, 10);
if (errno != 0)
if (errno != 0 || index >= bfd_ardata (arch)->extended_names_size)
{
bfd_set_error (bfd_error_malformed_archive);
return NULL;
@ -316,8 +354,7 @@ get_extended_arelt_filename (bfd *arch, const char *name)
Presumes the file pointer is already in the right place (ie pointing
to the ar_hdr in the file). Moves the file pointer; on success it
should be pointing to the front of the file contents; on failure it
could have been moved arbitrarily.
*/
could have been moved arbitrarily. */
void *
_bfd_generic_read_ar_hdr (bfd *abfd)
@ -372,10 +409,7 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag)
{
filename = get_extended_arelt_filename (abfd, hdr.ar_name);
if (filename == NULL)
{
bfd_set_error (bfd_error_malformed_archive);
return NULL;
}
return NULL;
}
/* BSD4.4-style long filename.
Only implemented for reading, so far! */
@ -467,6 +501,12 @@ _bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos)
struct areltdata *new_areldata;
bfd *n_nfd;
if (archive->my_archive)
{
filepos += archive->origin;
archive = archive->my_archive;
}
n_nfd = _bfd_look_for_bfd_in_cache (archive, filepos);
if (n_nfd)
return n_nfd;
@ -549,10 +589,12 @@ bfd_generic_openr_next_archived_file (bfd *archive, bfd *last_file)
else
{
unsigned int size = arelt_size (last_file);
filestart = last_file->origin + size;
if (archive->my_archive)
filestart -= archive->origin;
/* Pad to an even boundary...
Note that last_file->origin can be odd in the case of
BSD-4.4-style element with a long odd size. */
filestart = last_file->origin + size;
filestart += filestart % 2;
}
@ -573,14 +615,9 @@ bfd_generic_archive_p (bfd *abfd)
return NULL;
}
#ifdef GNU960
if (strncmp (armag, BFD_GNU960_ARMAG (abfd), SARMAG) != 0)
return 0;
#else
if (strncmp (armag, ARMAG, SARMAG) != 0 &&
strncmp (armag, ARMAGB, SARMAG) != 0)
return 0;
#endif
tdata_hold = bfd_ardata (abfd);
@ -593,11 +630,13 @@ bfd_generic_archive_p (bfd *abfd)
}
bfd_ardata (abfd)->first_file_filepos = SARMAG;
bfd_ardata (abfd)->cache = NULL;
bfd_ardata (abfd)->archive_head = NULL;
bfd_ardata (abfd)->symdefs = NULL;
bfd_ardata (abfd)->extended_names = NULL;
bfd_ardata (abfd)->tdata = NULL;
/* Cleared by bfd_zalloc above.
bfd_ardata (abfd)->cache = NULL;
bfd_ardata (abfd)->archive_head = NULL;
bfd_ardata (abfd)->symdefs = NULL;
bfd_ardata (abfd)->extended_names = NULL;
bfd_ardata (abfd)->extended_names_size = 0;
bfd_ardata (abfd)->tdata = NULL; */
if (!BFD_SEND (abfd, _bfd_slurp_armap, (abfd))
|| !BFD_SEND (abfd, _bfd_slurp_extended_name_table, (abfd)))
@ -634,14 +673,6 @@ bfd_generic_archive_p (bfd *abfd)
if (bfd_check_format (first, bfd_object)
&& first->xvec != abfd->xvec)
{
#if 0
/* We ought to close `first' here, but we can't, because
we have no way to remove it from the archive cache.
It's close to impossible to figure out when we can
release bfd_ardata. FIXME. */
bfd_close (first);
bfd_release (abfd, bfd_ardata (abfd));
#endif
bfd_set_error (bfd_error_wrong_object_format);
bfd_ardata (abfd) = tdata_hold;
return NULL;
@ -670,7 +701,7 @@ bfd_generic_archive_p (bfd *abfd)
/* The size of the string count. */
#define BSD_STRING_COUNT_SIZE 4
/* Returns FALSE on error, TRUE otherwise */
/* Returns FALSE on error, TRUE otherwise. */
static bfd_boolean
do_slurp_bsd_armap (bfd *abfd)
@ -776,7 +807,6 @@ do_slurp_coff_armap (bfd *abfd)
nsymz = bfd_getb32 (int_buf);
stringsize = parsed_size - (4 * nsymz) - 4;
#if 1
/* ... except that some archive formats are broken, and it may be our
fault - the i960 little endian coff sometimes has big and sometimes
little, because our tools changed. Here's a horrible hack to clean
@ -791,14 +821,19 @@ do_slurp_coff_armap (bfd *abfd)
stringsize = parsed_size - (4 * nsymz) - 4;
swap = bfd_getl32;
}
#endif
/* The coff armap must be read sequentially. So we construct a
bsd-style one in core all at once, for simplicity. */
if (nsymz > ~ (bfd_size_type) 0 / sizeof (carsym))
return FALSE;
carsym_size = (nsymz * sizeof (carsym));
ptrsize = (4 * nsymz);
if (carsym_size + stringsize + 1 <= carsym_size)
return FALSE;
ardata->symdefs = bfd_zalloc (abfd, carsym_size + stringsize + 1);
if (ardata->symdefs == NULL)
return FALSE;
@ -901,8 +936,8 @@ bfd_slurp_armap (bfd *abfd)
return TRUE;
}
/* Returns FALSE on error, TRUE otherwise */
/* flavor 2 of a bsd armap, similar to bfd_slurp_bsd_armap except the
/* Returns FALSE on error, TRUE otherwise. */
/* Flavor 2 of a bsd armap, similar to bfd_slurp_bsd_armap except the
header is in a slightly different order and the map name is '/'.
This flavour is used by hp300hpux. */
@ -932,7 +967,7 @@ bfd_slurp_bsd_armap_f2 (bfd *abfd)
return FALSE;
if (!strncmp (nextname, "__.SYMDEF ", 16)
|| !strncmp (nextname, "__.SYMDEF/ ", 16)) /* old Linux archives */
|| !strncmp (nextname, "__.SYMDEF/ ", 16)) /* Old Linux archives. */
return do_slurp_bsd_armap (abfd);
if (strncmp (nextname, "/ ", 16))
@ -1035,6 +1070,7 @@ _bfd_slurp_extended_name_table (bfd *abfd)
strncmp (nextname, "// ", 16) != 0)
{
bfd_ardata (abfd)->extended_names = NULL;
bfd_ardata (abfd)->extended_names_size = 0;
return TRUE;
}
@ -1043,7 +1079,11 @@ _bfd_slurp_extended_name_table (bfd *abfd)
return FALSE;
amt = namedata->parsed_size;
bfd_ardata (abfd)->extended_names = bfd_zalloc (abfd, amt);
if (amt + 1 == 0)
goto byebye;
bfd_ardata (abfd)->extended_names_size = amt;
bfd_ardata (abfd)->extended_names = bfd_zalloc (abfd, amt + 1);
if (bfd_ardata (abfd)->extended_names == NULL)
{
byebye:
@ -1066,15 +1106,17 @@ _bfd_slurp_extended_name_table (bfd *abfd)
trailing '/'. DOS/NT created archive often have \ in them
We'll fix all problems here.. */
{
char *temp = bfd_ardata (abfd)->extended_names;
char *ext_names = bfd_ardata (abfd)->extended_names;
char *temp = ext_names;
char *limit = temp + namedata->parsed_size;
for (; temp < limit; ++temp)
{
if (*temp == '\012')
temp[temp[-1] == '/' ? -1 : 0] = '\0';
temp[temp > ext_names && temp[-1] == '/' ? -1 : 0] = '\0';
if (*temp == '\\')
*temp = '/';
}
*limit = '\0';
}
/* Pad to an even boundary if you have to. */
@ -1084,9 +1126,6 @@ _bfd_slurp_extended_name_table (bfd *abfd)
/* FIXME, we can't release namedata here because it was allocated
below extended_names on the objalloc... */
#if 0
bfd_release (abfd, namedata);
#endif
}
return TRUE;
}
@ -1276,17 +1315,8 @@ _bfd_construct_extended_name_table (bfd *abfd,
strptr[thislen + 1] = '\012';
}
hdr->ar_name[0] = ar_padchar (current);
/* We know there will always be enough room (one of the few
cases where you may safely use sprintf). */
sprintf ((hdr->ar_name) + 1, "%-d", (unsigned) (strptr - *tabloc));
/* Kinda Kludgy. We should just use the returned value of
sprintf but not all implementations get this right. */
{
char *temp = hdr->ar_name + 2;
for (; temp < hdr->ar_name + maxname; temp++)
if (*temp == '\0')
*temp = ' ';
}
_bfd_ar_spacepad (hdr->ar_name + 1, maxname - 1, "%-ld",
strptr - *tabloc);
strptr += thislen + 1;
if (trailing_slash)
++strptr;
@ -1296,7 +1326,7 @@ _bfd_construct_extended_name_table (bfd *abfd,
return TRUE;
}
/** A couple of functions for creating ar_hdrs */
/* A couple of functions for creating ar_hdrs. */
#ifdef HPUX_LARGE_AR_IDS
/* Function to encode large UID/GID values according to HP. */
@ -1333,7 +1363,6 @@ bfd_ar_hdr_from_filesystem (bfd *abfd, const char *filename, bfd *member)
struct stat status;
struct areltdata *ared;
struct ar_hdr *hdr;
char *temp, *temp1;
bfd_size_type amt;
if (member && (member->flags & BFD_IN_MEMORY) != 0)
@ -1361,39 +1390,31 @@ bfd_ar_hdr_from_filesystem (bfd *abfd, const char *filename, bfd *member)
/* ar headers are space padded, not null padded! */
memset (hdr, ' ', sizeof (struct ar_hdr));
strncpy (hdr->ar_fmag, ARFMAG, 2);
/* Goddamned sprintf doesn't permit MAXIMUM field lengths. */
sprintf ((hdr->ar_date), "%-12ld", (long) status.st_mtime);
_bfd_ar_spacepad (hdr->ar_date, sizeof (hdr->ar_date), "%-12ld",
status.st_mtime);
#ifdef HPUX_LARGE_AR_IDS
/* HP has a very "special" way to handle UID/GID's with numeric values
> 99999. */
if (status.st_uid > 99999)
hpux_uid_gid_encode (hdr->ar_gid, (long) status.st_uid);
hpux_uid_gid_encode (hdr->ar_uid, (long) status.st_uid);
else
#endif
sprintf ((hdr->ar_uid), "%ld", (long) status.st_uid);
_bfd_ar_spacepad (hdr->ar_uid, sizeof (hdr->ar_uid), "%ld",
status.st_uid);
#ifdef HPUX_LARGE_AR_IDS
/* HP has a very "special" way to handle UID/GID's with numeric values
> 99999. */
if (status.st_gid > 99999)
hpux_uid_gid_encode (hdr->ar_uid, (long) status.st_gid);
hpux_uid_gid_encode (hdr->ar_gid, (long) status.st_gid);
else
#endif
sprintf ((hdr->ar_gid), "%ld", (long) status.st_gid);
sprintf ((hdr->ar_mode), "%-8o", (unsigned int) status.st_mode);
sprintf ((hdr->ar_size), "%-10ld", (long) status.st_size);
/* Correct for a lossage in sprintf whereby it null-terminates. I cannot
understand how these C losers could design such a ramshackle bunch of
IO operations. */
temp = (char *) hdr;
temp1 = temp + sizeof (struct ar_hdr) - 2;
for (; temp < temp1; temp++)
{
if (*temp == '\0')
*temp = ' ';
}
strncpy (hdr->ar_fmag, ARFMAG, 2);
_bfd_ar_spacepad (hdr->ar_gid, sizeof (hdr->ar_gid), "%ld",
status.st_gid);
_bfd_ar_spacepad (hdr->ar_mode, sizeof (hdr->ar_mode), "%-8lo",
status.st_mode);
_bfd_ar_spacepad (hdr->ar_size, sizeof (hdr->ar_size), "%-10ld",
status.st_size);
memcpy (hdr->ar_fmag, ARFMAG, 2);
ared->parsed_size = status.st_size;
ared->arch_header = (char *) hdr;
@ -1614,7 +1635,6 @@ _bfd_write_archive_contents (bfd *arch)
/* If no .o's, don't bother to make a map. */
bfd_boolean hasobjects = FALSE;
bfd_size_type wrote;
unsigned int i;
int tries;
/* Verify the viability of all entries; if any of them live in the
@ -1646,11 +1666,7 @@ _bfd_write_archive_contents (bfd *arch)
if (makemap && ! hasobjects)
{ /* Don't bother if we won't make a map! */
if ((bfd_check_format (current, bfd_object))
#if 0 /* FIXME -- these are not set correctly */
&& ((bfd_get_file_flags (current) & HAS_SYMS))
#endif
)
if ((bfd_check_format (current, bfd_object)))
hasobjects = TRUE;
}
}
@ -1661,11 +1677,7 @@ _bfd_write_archive_contents (bfd *arch)
if (bfd_seek (arch, (file_ptr) 0, SEEK_SET) != 0)
return FALSE;
#ifdef GNU960
wrote = bfd_bwrite (BFD_GNU960_ARMAG (arch), SARMAG, arch);
#else
wrote = bfd_bwrite (ARMAG, SARMAG, arch);
#endif
if (wrote != SARMAG)
return FALSE;
@ -1679,15 +1691,12 @@ _bfd_write_archive_contents (bfd *arch)
{
struct ar_hdr hdr;
memset (&hdr, 0, sizeof (struct ar_hdr));
strcpy (hdr.ar_name, ename);
memset (&hdr, ' ', sizeof (struct ar_hdr));
memcpy (hdr.ar_name, ename, strlen (ename));
/* Round size up to even number in archive header. */
sprintf (&(hdr.ar_size[0]), "%-10d",
(int) ((elength + 1) & ~(bfd_size_type) 1));
strncpy (hdr.ar_fmag, ARFMAG, 2);
for (i = 0; i < sizeof (struct ar_hdr); i++)
if (((char *) (&hdr))[i] == '\0')
(((char *) (&hdr))[i]) = ' ';
_bfd_ar_spacepad (hdr.ar_size, sizeof (hdr.ar_size), "%-10ld",
(elength + 1) & ~(bfd_size_type) 1);
memcpy (hdr.ar_fmag, ARFMAG, 2);
if ((bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch)
!= sizeof (struct ar_hdr))
|| bfd_bwrite (etable, elength, arch) != elength)
@ -1765,9 +1774,9 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
bfd *current;
file_ptr elt_no = 0;
struct orl *map = NULL;
unsigned int orl_max = 1024; /* fine initial default */
unsigned int orl_max = 1024; /* Fine initial default. */
unsigned int orl_count = 0;
int stridx = 0; /* string index */
int stridx = 0;
asymbol **syms = NULL;
long syms_max = 0;
bfd_boolean ret;
@ -1916,30 +1925,27 @@ bsd_write_armap (bfd *arch,
unsigned int mapsize = ranlibsize + stringsize + 8;
file_ptr firstreal;
bfd *current = arch->archive_head;
bfd *last_elt = current; /* last element arch seen */
bfd *last_elt = current; /* Last element arch seen. */
bfd_byte temp[4];
unsigned int count;
struct ar_hdr hdr;
struct stat statbuf;
unsigned int i;
firstreal = mapsize + elength + sizeof (struct ar_hdr) + SARMAG;
stat (arch->filename, &statbuf);
memset (&hdr, 0, sizeof (struct ar_hdr));
sprintf (hdr.ar_name, RANLIBMAG);
memset (&hdr, ' ', sizeof (struct ar_hdr));
memcpy (hdr.ar_name, RANLIBMAG, strlen (RANLIBMAG));
/* Remember the timestamp, to keep it holy. But fudge it a little. */
bfd_ardata (arch)->armap_timestamp = statbuf.st_mtime + ARMAP_TIME_OFFSET;
bfd_ardata (arch)->armap_datepos = (SARMAG
+ offsetof (struct ar_hdr, ar_date[0]));
sprintf (hdr.ar_date, "%ld", bfd_ardata (arch)->armap_timestamp);
sprintf (hdr.ar_uid, "%ld", (long) getuid ());
sprintf (hdr.ar_gid, "%ld", (long) getgid ());
sprintf (hdr.ar_size, "%-10d", (int) mapsize);
strncpy (hdr.ar_fmag, ARFMAG, 2);
for (i = 0; i < sizeof (struct ar_hdr); i++)
if (((char *) (&hdr))[i] == '\0')
(((char *) (&hdr))[i]) = ' ';
_bfd_ar_spacepad (hdr.ar_date, sizeof (hdr.ar_date), "%ld",
bfd_ardata (arch)->armap_timestamp);
_bfd_ar_spacepad (hdr.ar_uid, sizeof (hdr.ar_uid), "%ld", getuid ());
_bfd_ar_spacepad (hdr.ar_gid, sizeof (hdr.ar_gid), "%ld", getgid ());
_bfd_ar_spacepad (hdr.ar_size, sizeof (hdr.ar_size), "%-10ld", mapsize);
memcpy (hdr.ar_fmag, ARFMAG, 2);
if (bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch)
!= sizeof (struct ar_hdr))
return FALSE;
@ -1960,7 +1966,7 @@ bsd_write_armap (bfd *arch,
current = current->next;
}
while (current != map[count].u.abfd);
} /* if new archive element */
}
last_elt = current;
H_PUT_32 (arch, map[count].namidx, buf);
@ -2004,7 +2010,6 @@ _bfd_archive_bsd_update_armap_timestamp (bfd *arch)
{
struct stat archstat;
struct ar_hdr hdr;
unsigned int i;
/* Flush writes, get last-write timestamp from file, and compare it
to the timestamp IN the file. */
@ -2024,11 +2029,9 @@ _bfd_archive_bsd_update_armap_timestamp (bfd *arch)
bfd_ardata (arch)->armap_timestamp = archstat.st_mtime + ARMAP_TIME_OFFSET;
/* Prepare an ASCII version suitable for writing. */
memset (hdr.ar_date, 0, sizeof (hdr.ar_date));
sprintf (hdr.ar_date, "%ld", bfd_ardata (arch)->armap_timestamp);
for (i = 0; i < sizeof (hdr.ar_date); i++)
if (hdr.ar_date[i] == '\0')
(hdr.ar_date)[i] = ' ';
memset (hdr.ar_date, ' ', sizeof (hdr.ar_date));
_bfd_ar_spacepad (hdr.ar_date, sizeof (hdr.ar_date), "%ld",
bfd_ardata (arch)->armap_timestamp);
/* Write it into the file. */
bfd_ardata (arch)->armap_datepos = (SARMAG
@ -2058,8 +2061,7 @@ _bfd_archive_bsd_update_armap_timestamp (bfd *arch)
symbol name 0
symbol name 1
symbol name n-1
*/
symbol name n-1 */
bfd_boolean
coff_write_armap (bfd *arch,
@ -2077,7 +2079,6 @@ coff_write_armap (bfd *arch,
bfd *current = arch->archive_head;
unsigned int count;
struct ar_hdr hdr;
unsigned int i;
int padit = mapsize & 1;
if (padit)
@ -2089,22 +2090,19 @@ coff_write_armap (bfd *arch,
+ sizeof (struct ar_hdr)
+ SARMAG);
memset (&hdr, 0, sizeof (struct ar_hdr));
memset (&hdr, ' ', sizeof (struct ar_hdr));
hdr.ar_name[0] = '/';
sprintf (hdr.ar_size, "%-10d", (int) mapsize);
sprintf (hdr.ar_date, "%ld", (long) time (NULL));
_bfd_ar_spacepad (hdr.ar_size, sizeof (hdr.ar_size), "%-10ld",
mapsize);
_bfd_ar_spacepad (hdr.ar_date, sizeof (hdr.ar_date), "%ld",
time (NULL));
/* This, at least, is what Intel coff sets the values to. */
sprintf ((hdr.ar_uid), "%d", 0);
sprintf ((hdr.ar_gid), "%d", 0);
sprintf ((hdr.ar_mode), "%-7o", (unsigned) 0);
strncpy (hdr.ar_fmag, ARFMAG, 2);
for (i = 0; i < sizeof (struct ar_hdr); i++)
if (((char *) (&hdr))[i] == '\0')
(((char *) (&hdr))[i]) = ' ';
_bfd_ar_spacepad (hdr.ar_uid, sizeof (hdr.ar_uid), "%ld", 0);
_bfd_ar_spacepad (hdr.ar_gid, sizeof (hdr.ar_gid), "%ld", 0);
_bfd_ar_spacepad (hdr.ar_mode, sizeof (hdr.ar_mode), "%-7lo", 0);
memcpy (hdr.ar_fmag, ARFMAG, 2);
/* Write the ar header for this item and the number of symbols. */
if (bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch)
!= sizeof (struct ar_hdr))
return FALSE;

View file

@ -19,7 +19,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* This file supports the 64-bit (MIPS) ELF archives. */
@ -156,7 +156,6 @@ bfd_elf64_archive_write_armap (bfd *arch,
bfd *current = arch->archive_head;
unsigned int count;
struct ar_hdr hdr;
unsigned int i;
int padding;
bfd_byte buf[8];
@ -169,19 +168,17 @@ bfd_elf64_archive_write_armap (bfd *arch,
+ sizeof (struct ar_hdr)
+ SARMAG);
memset (&hdr, 0, sizeof (struct ar_hdr));
strcpy (hdr.ar_name, "/SYM64/");
sprintf (hdr.ar_size, "%-10d", (int) mapsize);
sprintf (hdr.ar_date, "%ld", (long) time (NULL));
memset (&hdr, ' ', sizeof (struct ar_hdr));
memcpy (hdr.ar_name, "/SYM64/", strlen ("/SYM64/"));
_bfd_ar_spacepad (hdr.ar_size, sizeof (hdr.ar_size), "%-10ld",
mapsize);
_bfd_ar_spacepad (hdr.ar_date, sizeof (hdr.ar_date), "%ld",
time (NULL));
/* This, at least, is what Intel coff sets the values to.: */
sprintf ((hdr.ar_uid), "%d", 0);
sprintf ((hdr.ar_gid), "%d", 0);
sprintf ((hdr.ar_mode), "%-7o", (unsigned) 0);
strncpy (hdr.ar_fmag, ARFMAG, 2);
for (i = 0; i < sizeof (struct ar_hdr); i++)
if (((char *) (&hdr))[i] == '\0')
(((char *) (&hdr))[i]) = ' ';
_bfd_ar_spacepad (hdr.ar_uid, sizeof (hdr.ar_uid), "%ld", 0);
_bfd_ar_spacepad (hdr.ar_gid, sizeof (hdr.ar_gid), "%ld", 0);
_bfd_ar_spacepad (hdr.ar_mode, sizeof (hdr.ar_mode), "%-7lo", 0);
memcpy (hdr.ar_fmag, ARFMAG, 2);
/* Write the ar header for this item and the number of symbols */

View file

@ -80,11 +80,22 @@ DESCRIPTION
.#define bfd_mach_m68040 6
.#define bfd_mach_m68060 7
.#define bfd_mach_cpu32 8
.#define bfd_mach_mcf5200 9
.#define bfd_mach_mcf5206e 10
.#define bfd_mach_mcf5307 11
.#define bfd_mach_mcf5407 12
.#define bfd_mach_mcf528x 13
.#define bfd_mach_mcf_isa_a_nodiv 9
.#define bfd_mach_mcf_isa_a 10
.#define bfd_mach_mcf_isa_a_mac 11
.#define bfd_mach_mcf_isa_a_emac 12
.#define bfd_mach_mcf_isa_aplus 13
.#define bfd_mach_mcf_isa_aplus_mac 14
.#define bfd_mach_mcf_isa_aplus_emac 15
.#define bfd_mach_mcf_isa_b_nousp 16
.#define bfd_mach_mcf_isa_b_nousp_mac 17
.#define bfd_mach_mcf_isa_b_nousp_emac 18
.#define bfd_mach_mcf_isa_b 19
.#define bfd_mach_mcf_isa_b_mac 20
.#define bfd_mach_mcf_isa_b_emac 21
.#define bfd_mach_mcf_isa_b_float 22
.#define bfd_mach_mcf_isa_b_float_mac 23
.#define bfd_mach_mcf_isa_b_float_emac 24
. bfd_arch_vax, {* DEC Vax *}
. bfd_arch_i960, {* Intel 960 *}
. {* The order of the following is important.
@ -106,7 +117,6 @@ DESCRIPTION
.
. bfd_arch_or32, {* OpenRISC 32 *}
.
. bfd_arch_a29k, {* AMD 29000 *}
. bfd_arch_sparc, {* SPARC *}
.#define bfd_mach_sparc 1
.{* The difference between v8plus and v9 is that v9 is a true 64 bit env. *}
@ -123,6 +133,9 @@ DESCRIPTION
.#define bfd_mach_sparc_v9_p(mach) \
. ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \
. && (mach) != bfd_mach_sparc_sparclite_le)
.{* Nonzero if MACH is a 64 bit sparc architecture. *}
.#define bfd_mach_sparc_64bit_p(mach) \
. ((mach) >= bfd_mach_sparc_v9 && (mach) != bfd_mach_sparc_v8plusb)
. bfd_arch_mips, {* MIPS Rxxxx *}
.#define bfd_mach_mips3000 3000
.#define bfd_mach_mips3900 3900
@ -163,7 +176,6 @@ DESCRIPTION
. bfd_arch_i860, {* Intel 860 *}
. bfd_arch_i370, {* IBM 360/370 Mainframes *}
. bfd_arch_romp, {* IBM ROMP PC/RT *}
. bfd_arch_alliant, {* Alliant *}
. bfd_arch_convex, {* Convex *}
. bfd_arch_m88k, {* Motorola 88xxx *}
. bfd_arch_m98k, {* Motorola 98xxx *}
@ -226,12 +238,20 @@ DESCRIPTION
.#define bfd_mach_sh 1
.#define bfd_mach_sh2 0x20
.#define bfd_mach_sh_dsp 0x2d
.#define bfd_mach_sh2a 0x2a
.#define bfd_mach_sh2a_nofpu 0x2b
.#define bfd_mach_sh2a_nofpu_or_sh4_nommu_nofpu 0x2a1
.#define bfd_mach_sh2a_nofpu_or_sh3_nommu 0x2a2
.#define bfd_mach_sh2a_or_sh4 0x2a3
.#define bfd_mach_sh2a_or_sh3e 0x2a4
.#define bfd_mach_sh2e 0x2e
.#define bfd_mach_sh3 0x30
.#define bfd_mach_sh3_nommu 0x31
.#define bfd_mach_sh3_dsp 0x3d
.#define bfd_mach_sh3e 0x3e
.#define bfd_mach_sh4 0x40
.#define bfd_mach_sh4_nofpu 0x41
.#define bfd_mach_sh4_nommu_nofpu 0x42
.#define bfd_mach_sh4a 0x4a
.#define bfd_mach_sh4a_nofpu 0x4b
.#define bfd_mach_sh4al_dsp 0x4d
@ -271,6 +291,9 @@ DESCRIPTION
.#define bfd_mach_arc_6 6
.#define bfd_mach_arc_7 7
.#define bfd_mach_arc_8 8
. bfd_arch_m32c, {* Renesas M16C/M32C. *}
.#define bfd_mach_m16c 0x75
.#define bfd_mach_m32c 0x78
. bfd_arch_m32r, {* Renesas M32R (formerly Mitsubishi M32R/D) *}
.#define bfd_mach_m32r 1 {* For backwards compatibility. *}
.#define bfd_mach_m32rx 'x'
@ -287,6 +310,7 @@ DESCRIPTION
.#define bfd_mach_frvsimple 2
.#define bfd_mach_fr300 300
.#define bfd_mach_fr400 400
.#define bfd_mach_fr450 450
.#define bfd_mach_frvtomcat 499 {* fr500 prototype *}
.#define bfd_mach_fr500 500
.#define bfd_mach_fr550 550
@ -300,6 +324,10 @@ DESCRIPTION
. bfd_arch_iq2000, {* Vitesse IQ2000. *}
.#define bfd_mach_iq2000 1
.#define bfd_mach_iq10 2
. bfd_arch_mt,
.#define bfd_mach_ms1 1
.#define bfd_mach_mrisc2 2
.#define bfd_mach_ms2 3
. bfd_arch_pj,
. bfd_arch_avr, {* Atmel AVR microcontrollers. *}
.#define bfd_mach_avr1 1
@ -307,7 +335,16 @@ DESCRIPTION
.#define bfd_mach_avr3 3
.#define bfd_mach_avr4 4
.#define bfd_mach_avr5 5
. bfd_arch_bfin, {* ADI Blackfin *}
.#define bfd_mach_bfin 1
. bfd_arch_cr16c, {* National Semiconductor CompactRISC. *}
.#define bfd_mach_cr16c 1
. bfd_arch_crx, {* National Semiconductor CRX. *}
.#define bfd_mach_crx 1
. bfd_arch_cris, {* Axis CRIS *}
.#define bfd_mach_cris_v0_v10 255
.#define bfd_mach_cris_v32 32
.#define bfd_mach_cris_v10_v32 1032
. bfd_arch_s390, {* IBM s390 *}
.#define bfd_mach_s390_31 31
.#define bfd_mach_s390_64 64
@ -322,7 +359,8 @@ DESCRIPTION
.#define bfd_mach_msp13 13
.#define bfd_mach_msp14 14
.#define bfd_mach_msp15 15
.#define bfd_mach_msp16 16
.#define bfd_mach_msp16 16
.#define bfd_mach_msp21 21
.#define bfd_mach_msp31 31
.#define bfd_mach_msp32 32
.#define bfd_mach_msp33 33
@ -330,8 +368,20 @@ DESCRIPTION
.#define bfd_mach_msp42 42
.#define bfd_mach_msp43 43
.#define bfd_mach_msp44 44
. bfd_arch_xc16x, {* Infineon's XC16X Series. *}
.#define bfd_mach_xc16x 1
.#define bfd_mach_xc16xl 2
.#define bfd_mach_xc16xs 3
. bfd_arch_xtensa, {* Tensilica's Xtensa cores. *}
.#define bfd_mach_xtensa 1
. bfd_arch_maxq, {* Dallas MAXQ 10/20 *}
.#define bfd_mach_maxq10 10
.#define bfd_mach_maxq20 20
. bfd_arch_z80,
.#define bfd_mach_z80strict 1 {* No undocumented opcodes. *}
.#define bfd_mach_z80 3 {* With ixl, ixh, iyl, and iyh. *}
.#define bfd_mach_z80full 7 {* All undocumented instructions. *}
.#define bfd_mach_r800 11 {* R800: successor with multiplication. *}
. bfd_arch_last
. };
*/
@ -370,12 +420,14 @@ DESCRIPTION
.
*/
extern const bfd_arch_info_type bfd_a29k_arch;
extern const bfd_arch_info_type bfd_alpha_arch;
extern const bfd_arch_info_type bfd_arc_arch;
extern const bfd_arch_info_type bfd_arm_arch;
extern const bfd_arch_info_type bfd_avr_arch;
extern const bfd_arch_info_type bfd_bfin_arch;
extern const bfd_arch_info_type bfd_cr16c_arch;
extern const bfd_arch_info_type bfd_cris_arch;
extern const bfd_arch_info_type bfd_crx_arch;
extern const bfd_arch_info_type bfd_d10v_arch;
extern const bfd_arch_info_type bfd_d30v_arch;
extern const bfd_arch_info_type bfd_dlx_arch;
@ -391,17 +443,20 @@ extern const bfd_arch_info_type bfd_i960_arch;
extern const bfd_arch_info_type bfd_ia64_arch;
extern const bfd_arch_info_type bfd_ip2k_arch;
extern const bfd_arch_info_type bfd_iq2000_arch;
extern const bfd_arch_info_type bfd_m32c_arch;
extern const bfd_arch_info_type bfd_m32r_arch;
extern const bfd_arch_info_type bfd_m68hc11_arch;
extern const bfd_arch_info_type bfd_m68hc12_arch;
extern const bfd_arch_info_type bfd_m68k_arch;
extern const bfd_arch_info_type bfd_m88k_arch;
extern const bfd_arch_info_type bfd_maxq_arch;
extern const bfd_arch_info_type bfd_mcore_arch;
extern const bfd_arch_info_type bfd_mips_arch;
extern const bfd_arch_info_type bfd_mmix_arch;
extern const bfd_arch_info_type bfd_mn10200_arch;
extern const bfd_arch_info_type bfd_mn10300_arch;
extern const bfd_arch_info_type bfd_msp430_arch;
extern const bfd_arch_info_type bfd_mt_arch;
extern const bfd_arch_info_type bfd_ns32k_arch;
extern const bfd_arch_info_type bfd_openrisc_arch;
extern const bfd_arch_info_type bfd_or32_arch;
@ -423,6 +478,8 @@ extern const bfd_arch_info_type bfd_we32k_arch;
extern const bfd_arch_info_type bfd_w65_arch;
extern const bfd_arch_info_type bfd_xstormy16_arch;
extern const bfd_arch_info_type bfd_xtensa_arch;
extern const bfd_arch_info_type bfd_xc16x_arch;
extern const bfd_arch_info_type bfd_z80_arch;
extern const bfd_arch_info_type bfd_z8k_arch;
static const bfd_arch_info_type * const bfd_archures_list[] =
@ -430,12 +487,14 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
#ifdef SELECT_ARCHITECTURES
SELECT_ARCHITECTURES,
#else
&bfd_a29k_arch,
&bfd_alpha_arch,
&bfd_arc_arch,
&bfd_arm_arch,
&bfd_avr_arch,
&bfd_bfin_arch,
&bfd_cr16c_arch,
&bfd_cris_arch,
&bfd_crx_arch,
&bfd_d10v_arch,
&bfd_d30v_arch,
&bfd_dlx_arch,
@ -451,16 +510,19 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
&bfd_ia64_arch,
&bfd_ip2k_arch,
&bfd_iq2000_arch,
&bfd_m32c_arch,
&bfd_m32r_arch,
&bfd_m68hc11_arch,
&bfd_m68hc12_arch,
&bfd_m68k_arch,
&bfd_m88k_arch,
&bfd_maxq_arch,
&bfd_mcore_arch,
&bfd_mips_arch,
&bfd_mmix_arch,
&bfd_mn10200_arch,
&bfd_mn10300_arch,
&bfd_mt_arch,
&bfd_msp430_arch,
&bfd_ns32k_arch,
&bfd_openrisc_arch,
@ -481,6 +543,8 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
&bfd_we32k_arch,
&bfd_xstormy16_arch,
&bfd_xtensa_arch,
&bfd_xc16x_arch,
&bfd_z80_arch,
&bfd_z8k_arch,
#endif
0
@ -953,23 +1017,23 @@ bfd_default_scan (const bfd_arch_info_type *info, const char *string)
break;
case 5200:
arch = bfd_arch_m68k;
number = bfd_mach_mcf5200;
number = bfd_mach_mcf_isa_a_nodiv;
break;
case 5206:
arch = bfd_arch_m68k;
number = bfd_mach_mcf5206e;
number = bfd_mach_mcf_isa_a_mac;
break;
case 5307:
arch = bfd_arch_m68k;
number = bfd_mach_mcf5307;
number = bfd_mach_mcf_isa_a_mac;
break;
case 5407:
arch = bfd_arch_m68k;
number = bfd_mach_mcf5407;
number = bfd_mach_mcf_isa_b_nousp_mac;
break;
case 5282:
arch = bfd_arch_m68k;
number = bfd_mach_mcf528x;
number = bfd_mach_mcf_isa_aplus_emac;
break;
case 32000:

View file

@ -1,5 +1,6 @@
/* BFD back-end for NetBSD/ARM a.out-ish binaries.
Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Copyright 1999, 2000, 2001, 2002, 2005
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@ -15,7 +16,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#define BYTES_IN_WORD 4
#undef TARGET_IS_BIG_ENDIAN_P
@ -35,19 +36,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* This needs to start with a.out so GDB knows it is an a.out variant. */
#define TARGETNAME "a.out-arm-netbsd"
#if 0
#define NAME(x,y) CONCAT3 (aoutarm,_32_,y)
#define aoutarm_32_get_section_contents aout_32_get_section_contents
#define MY_bfd_reloc_type_lookup aoutarm_bfd_reloc_type_lookup
#include "bfd.h" /* To ensure following declaration is OK */
const struct reloc_howto_struct *
MY_bfd_reloc_type_lookup
PARAMS ((bfd * abfd AND
bfd_reloc_code_real_type code));
#endif
#include "netbsd.h"

View file

@ -1,7 +1,8 @@
/* Main header file for the bfd library -- portable access to object files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Contributed by Cygnus Support.
@ -19,7 +20,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef __BFD_H_SEEN__
#define __BFD_H_SEEN__
@ -89,14 +90,6 @@ typedef int bfd_boolean;
#define FALSE 0
#define TRUE 1
#if 0
/* Poison. */
#undef false
#undef true
#define false dont_use_false_in_bfd
#define true dont_use_true_in_bfd
#endif
#ifdef BFD64
#ifndef BFD_HOST_64_BIT
@ -144,6 +137,9 @@ typedef unsigned long bfd_size_type;
#endif /* not BFD64 */
#define HALF_BFD_SIZE_TYPE \
(((bfd_size_type) 1) << (8 * sizeof (bfd_size_type) / 2))
#ifndef BFD_HOST_64_BIT
/* Fall back on a 32 bit type. The idea is to make these types always
available for function return types, but in the case that
@ -238,6 +234,10 @@ bfd_format;
/* The sections in this BFD specify a memory page. */
#define HAS_LOAD_PAGE 0x1000
/* This BFD has been created by the linker and doesn't correspond
to any input file. */
#define BFD_LINKER_CREATED 0x2000
/* Symbols and relocation. */
@ -308,7 +308,8 @@ typedef struct bfd_section *sec_ptr;
#define bfd_get_section_lma(bfd, ptr) ((ptr)->lma + 0)
#define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0)
#define bfd_section_name(bfd, ptr) ((ptr)->name)
#define bfd_section_size(bfd, ptr) (bfd_get_section_size_before_reloc(ptr))
#define bfd_section_size(bfd, ptr) ((ptr)->size)
#define bfd_get_section_size(ptr) ((ptr)->size)
#define bfd_section_vma(bfd, ptr) ((ptr)->vma)
#define bfd_section_lma(bfd, ptr) ((ptr)->lma)
#define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power)
@ -320,6 +321,10 @@ typedef struct bfd_section *sec_ptr;
#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE)
#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE)
#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE)
/* Find the address one past the end of SEC. */
#define bfd_get_section_limit(bfd, sec) \
(((sec)->rawsize ? (sec)->rawsize : (sec)->size) \
/ bfd_octets_per_byte (bfd))
typedef struct stat stat_type;
@ -371,6 +376,8 @@ struct bfd_hash_table
struct bfd_hash_entry **table;
/* The number of slots in the hash table. */
unsigned int size;
/* The size of elements. */
unsigned int entsize;
/* A function used to create new elements in the hash table. The
first entry is itself a pointer to an element. When this
function is first invoked, this pointer will be NULL. However,
@ -390,7 +397,8 @@ extern bfd_boolean bfd_hash_table_init
(struct bfd_hash_table *,
struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
struct bfd_hash_table *,
const char *));
const char *),
unsigned int);
/* Initialize a hash table specifying a size. */
extern bfd_boolean bfd_hash_table_init_n
@ -398,7 +406,7 @@ extern bfd_boolean bfd_hash_table_init_n
struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
struct bfd_hash_table *,
const char *),
unsigned int size);
unsigned int, unsigned int);
/* Free up a hash table. */
extern void bfd_hash_table_free
@ -433,6 +441,24 @@ extern void bfd_hash_traverse
bfd_boolean (*) (struct bfd_hash_entry *, void *),
void *info);
/* Allows the default size of a hash table to be configured. New hash
tables allocated using bfd_hash_table_init will be created with
this size. */
extern void bfd_hash_set_default_size (bfd_size_type);
/* This structure is used to keep track of stabs in sections
information while linking. */
struct stab_info
{
/* A hash table used to hold stabs strings. */
struct bfd_strtab_hash *strings;
/* The header file hash table. */
struct bfd_hash_table includes;
/* The first .stabstr section. */
struct bfd_section *stabstr;
};
#define COFF_SWAP_TABLE (void *) &bfd_coff_std_swap_table
/* User program access to BFD facilities. */
@ -505,6 +531,8 @@ extern bfd_boolean bfd_cache_close
(bfd *abfd);
/* NB: This declaration should match the autogenerated one in libbfd.h. */
extern bfd_boolean bfd_cache_close_all (void);
extern bfd_boolean bfd_record_phdr
(bfd *, unsigned long, bfd_boolean, flagword, bfd_boolean, bfd_vma,
bfd_boolean, bfd_boolean, unsigned int, struct bfd_section **);
@ -534,6 +562,9 @@ void bfd_putl16 (bfd_vma, void *);
bfd_uint64_t bfd_get_bits (const void *, int, bfd_boolean);
void bfd_put_bits (bfd_uint64_t, void *, int, bfd_boolean);
extern bfd_boolean bfd_section_already_linked_table_init (void);
extern void bfd_section_already_linked_table_free (void);
/* Externally visible ECOFF routines. */
@ -587,8 +618,6 @@ extern bfd_boolean bfd_ecoff_write_accumulated_debug
(void *handle, bfd *abfd, struct ecoff_debug_info *debug,
const struct ecoff_debug_swap *swap,
struct bfd_link_info *info, file_ptr where);
extern bfd_boolean bfd_mips_ecoff_create_embedded_relocs
(bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **);
/* Externally visible ELF routines. */
@ -602,28 +631,44 @@ struct bfd_link_needed_list
enum dynamic_lib_link_class {
DYN_NORMAL = 0,
DYN_AS_NEEDED = 1,
DYN_DT_NEEDED = 2
DYN_DT_NEEDED = 2,
DYN_NO_ADD_NEEDED = 4,
DYN_NO_NEEDED = 8
};
enum notice_asneeded_action {
notice_as_needed,
notice_not_needed,
notice_needed
};
extern bfd_boolean bfd_elf_record_link_assignment
(bfd *, struct bfd_link_info *, const char *, bfd_boolean);
(bfd *, struct bfd_link_info *, const char *, bfd_boolean,
bfd_boolean);
extern struct bfd_link_needed_list *bfd_elf_get_needed_list
(bfd *, struct bfd_link_info *);
extern bfd_boolean bfd_elf_get_bfd_needed_list
(bfd *, struct bfd_link_needed_list **);
extern bfd_boolean bfd_elf_size_dynamic_sections
(bfd *, const char *, const char *, const char *, const char * const *,
struct bfd_link_info *, struct bfd_section **, struct bfd_elf_version_tree *);
struct bfd_link_info *, struct bfd_section **,
struct bfd_elf_version_tree *);
extern bfd_boolean bfd_elf_size_dynsym_hash_dynstr
(bfd *, struct bfd_link_info *);
extern void bfd_elf_set_dt_needed_name
(bfd *, const char *);
extern const char *bfd_elf_get_dt_soname
(bfd *);
extern void bfd_elf_set_dyn_lib_class
(bfd *, int);
extern int bfd_elf_get_dyn_lib_class
(bfd *);
extern struct bfd_link_needed_list *bfd_elf_get_runpath_list
(bfd *, struct bfd_link_info *);
extern bfd_boolean bfd_elf_discard_info
(bfd *, struct bfd_link_info *);
extern unsigned int _bfd_elf_default_action_discarded
(struct bfd_section *);
/* Return an upper bound on the number of bytes required to store a
copy of ABFD's program header table entries. Return -1 if an error
@ -655,7 +700,7 @@ extern int bfd_get_elf_phdrs
the remote memory. */
extern bfd *bfd_elf_bfd_from_remote_memory
(bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
int (*target_read_memory) (bfd_vma vma, char *myaddr, int len));
int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr, int len));
/* Return the arch_size field of an elf bfd, or -1 if not elf. */
extern int bfd_get_arch_size
@ -668,10 +713,20 @@ extern int bfd_get_sign_extend_vma
extern struct bfd_section *_bfd_elf_tls_setup
(bfd *, struct bfd_link_info *);
extern void _bfd_fix_excluded_sec_syms
(bfd *, struct bfd_link_info *);
extern unsigned bfd_m68k_mach_to_features (int);
extern int bfd_m68k_features_to_mach (unsigned);
extern bfd_boolean bfd_m68k_elf32_create_embedded_relocs
(bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **);
extern bfd_boolean bfd_mips_elf32_create_embedded_relocs
(bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **);
(bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *,
char **);
extern bfd_boolean bfd_bfin_elf32_create_embedded_relocs
(bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *,
char **);
/* SunOS shared library support routines for the linker. */
@ -680,7 +735,8 @@ extern struct bfd_link_needed_list *bfd_sunos_get_needed_list
extern bfd_boolean bfd_sunos_record_link_assignment
(bfd *, struct bfd_link_info *, const char *);
extern bfd_boolean bfd_sunos_size_dynamic_sections
(bfd *, struct bfd_link_info *, struct bfd_section **, struct bfd_section **, struct bfd_section **);
(bfd *, struct bfd_link_info *, struct bfd_section **,
struct bfd_section **, struct bfd_section **);
/* Linux shared library support routines for the linker. */
@ -788,12 +844,19 @@ extern bfd_boolean bfd_elf32_arm_allocate_interworking_sections
extern bfd_boolean bfd_elf32_arm_process_before_allocation
(bfd *, struct bfd_link_info *, int);
void bfd_elf32_arm_set_target_relocs
(struct bfd_link_info *, int, char *, int, int);
extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking
(bfd *, struct bfd_link_info *);
extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd
(bfd *, struct bfd_link_info *);
/* ELF ARM mapping symbol support */
extern bfd_boolean bfd_is_arm_mapping_symbol_name
(const char * name);
/* ARM Note section processing. */
extern bfd_boolean bfd_arm_merge_machines
(bfd *, bfd *);
@ -822,3 +885,23 @@ extern void bfd_elf32_ia64_after_parse
extern void bfd_elf64_ia64_after_parse
(int);
/* This structure is used for a comdat section, as in PE. A comdat
section is associated with a particular symbol. When the linker
sees a comdat section, it keeps only one of the sections with a
given name and associated with a given symbol. */
struct coff_comdat_info
{
/* The name of the symbol associated with a comdat section. */
const char *name;
/* The local symbol table index of the symbol associated with a
comdat section. This is only meaningful to the object file format
specific code; it is not an index into the list returned by
bfd_canonicalize_symtab. */
long symbol;
};
extern struct coff_comdat_info *bfd_coff_get_comdat_section
(bfd *, struct bfd_section *);

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
/* Generic BFD library interface and support routines.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003
2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Written by Cygnus Support.
@ -18,7 +18,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/*
SECTION
@ -45,14 +45,10 @@ CODE_FRAGMENT
. {* A pointer to the target jump table. *}
. const struct bfd_target *xvec;
.
. {* To avoid dragging too many header files into every file that
. includes `<<bfd.h>>', IOSTREAM has been declared as a "char *",
. and MTIME as a "long". Their correct types, to which they
. are cast when used, are "FILE *" and "time_t". The iostream
. is the result of an fopen on the filename. However, if the
. BFD_IN_MEMORY flag is set, then iostream is actually a pointer
. to a bfd_in_memory struct. *}
. {* The IOSTREAM, and corresponding IO vector that provide access
. to the file backing the BFD. *}
. void *iostream;
. const struct bfd_iovec *iovec;
.
. {* Is the file descriptor being cached? That is, can it be closed as
. needed, and re-opened when accessed later? *}
@ -115,8 +111,8 @@ CODE_FRAGMENT
. {* Pointer to linked list of sections. *}
. struct bfd_section *sections;
.
. {* The place where we add to the section list. *}
. struct bfd_section **section_tail;
. {* The last section on the section list. *}
. struct bfd_section *section_last;
.
. {* The number of sections. *}
. unsigned int section_count;
@ -137,6 +133,9 @@ CODE_FRAGMENT
. {* Pointer to structure which contains architecture information. *}
. const struct bfd_arch_info *arch_info;
.
. {* Flag set if symbols from this BFD should not be exported. *}
. bfd_boolean no_export;
.
. {* Stuff only useful for archives. *}
. void *arelt_data;
. struct bfd *my_archive; {* The containing archive BFD. *}
@ -217,6 +216,11 @@ CODE_FRAGMENT
#include "libecoff.h"
#undef obj_symbols
#include "elf-bfd.h"
#ifndef EXIT_FAILURE
#define EXIT_FAILURE 1
#endif
/* provide storage for subsystem, stack and heap data which may have been
passed in on the command line. Ld puts this data into a bfd_link_info
@ -410,23 +414,152 @@ CODE_FRAGMENT
static const char *_bfd_error_program_name;
/* This is the default routine to handle BFD error messages. */
/* This is the default routine to handle BFD error messages.
Like fprintf (stderr, ...), but also handles some extra format specifiers.
static void
_bfd_default_error_handler (const char *s, ...)
%A section name from section. For group components, print group name too.
%B file name from bfd. For archive components, prints archive too.
*/
void
_bfd_default_error_handler (const char *fmt, ...)
{
va_list p;
va_list ap;
char *bufp;
const char *new_fmt, *p;
size_t avail = 1000;
char buf[1000];
if (_bfd_error_program_name != NULL)
fprintf (stderr, "%s: ", _bfd_error_program_name);
else
fprintf (stderr, "BFD: ");
va_start (p, s);
vfprintf (stderr, s, p);
va_end (p);
va_start (ap, fmt);
new_fmt = fmt;
bufp = buf;
fprintf (stderr, "\n");
/* Reserve enough space for the existing format string. */
avail -= strlen (fmt) + 1;
if (avail > 1000)
_exit (EXIT_FAILURE);
p = fmt;
while (1)
{
char *q;
size_t len, extra, trim;
p = strchr (p, '%');
if (p == NULL || p[1] == '\0')
{
if (new_fmt == buf)
{
len = strlen (fmt);
memcpy (bufp, fmt, len + 1);
}
break;
}
if (p[1] == 'A' || p[1] == 'B')
{
len = p - fmt;
memcpy (bufp, fmt, len);
bufp += len;
fmt = p + 2;
new_fmt = buf;
/* If we run out of space, tough, you lose your ridiculously
long file or section name. It's not safe to try to alloc
memory here; We might be printing an out of memory message. */
if (avail == 0)
{
*bufp++ = '*';
*bufp++ = '*';
*bufp = '\0';
}
else
{
if (p[1] == 'B')
{
bfd *abfd = va_arg (ap, bfd *);
if (abfd->my_archive)
snprintf (bufp, avail, "%s(%s)",
abfd->my_archive->filename, abfd->filename);
else
snprintf (bufp, avail, "%s", abfd->filename);
}
else
{
asection *sec = va_arg (ap, asection *);
bfd *abfd = sec->owner;
const char *group = NULL;
struct coff_comdat_info *ci;
if (abfd != NULL
&& bfd_get_flavour (abfd) == bfd_target_elf_flavour
&& elf_next_in_group (sec) != NULL
&& (sec->flags & SEC_GROUP) == 0)
group = elf_group_name (sec);
else if (abfd != NULL
&& bfd_get_flavour (abfd) == bfd_target_coff_flavour
&& (ci = bfd_coff_get_comdat_section (sec->owner,
sec)) != NULL)
group = ci->name;
if (group != NULL)
snprintf (bufp, avail, "%s[%s]", sec->name, group);
else
snprintf (bufp, avail, "%s", sec->name);
}
len = strlen (bufp);
avail = avail - len + 2;
/* We need to replace any '%' we printed by "%%".
First count how many. */
q = bufp;
bufp += len;
extra = 0;
while ((q = strchr (q, '%')) != NULL)
{
++q;
++extra;
}
/* If there isn't room, trim off the end of the string. */
q = bufp;
bufp += extra;
if (extra > avail)
{
trim = extra - avail;
bufp -= trim;
do
{
if (*--q == '%')
--extra;
}
while (--trim != 0);
*q = '\0';
avail = extra;
}
avail -= extra;
/* Now double all '%' chars, shuffling the string as we go. */
while (extra != 0)
{
while ((q[extra] = *q) != '%')
--q;
q[--extra] = '%';
--q;
}
}
}
p = p + 2;
}
vfprintf (stderr, new_fmt, ap);
va_end (ap);
putc ('\n', stderr);
}
/* This is a function pointer to the routine which should handle BFD
@ -495,60 +628,13 @@ bfd_get_error_handler (void)
{
return _bfd_error_handler;
}
/*
FUNCTION
bfd_archive_filename
SYNOPSIS
const char *bfd_archive_filename (bfd *);
DESCRIPTION
For a BFD that is a component of an archive, returns a string
with both the archive name and file name. For other BFDs, just
returns the file name.
*/
const char *
bfd_archive_filename (bfd *abfd)
{
if (abfd == NULL)
return _("<unknown>");
if (abfd->my_archive)
{
static size_t curr = 0;
static char *buf;
size_t needed;
needed = (strlen (bfd_get_filename (abfd->my_archive))
+ strlen (bfd_get_filename (abfd)) + 3);
if (needed > curr)
{
if (curr)
free (buf);
curr = needed + (needed >> 1);
buf = bfd_malloc (curr);
/* If we can't malloc, fail safe by returning just the file
name. This function is only used when building error
messages. */
if (!buf)
{
curr = 0;
return bfd_get_filename (abfd);
}
}
sprintf (buf, "%s(%s)", bfd_get_filename (abfd->my_archive),
bfd_get_filename (abfd));
return buf;
}
else
return bfd_get_filename (abfd);
}
/*
SECTION
Symbols
Miscellaneous
SUBSECTION
Miscellaneous functions
*/
/*
@ -694,10 +780,6 @@ bfd_assert (const char *file, int line)
/* A more or less friendly abort message. In libbfd.h abort is
defined to call this function. */
#ifndef EXIT_FAILURE
#define EXIT_FAILURE 1
#endif
void
_bfd_abort (const char *file, int line, const char *fn)
{
@ -710,7 +792,7 @@ _bfd_abort (const char *file, int line, const char *fn)
(_("BFD %s internal error, aborting at %s line %d\n"),
BFD_VERSION_STRING, file, line);
(*_bfd_error_handler) (_("Please report this bug.\n"));
xexit (EXIT_FAILURE);
_exit (EXIT_FAILURE);
}
/*
@ -769,12 +851,14 @@ bfd_get_sign_extend_vma (bfd *abfd)
name = bfd_get_target (abfd);
/* Return a proper value for DJGPP COFF (an x86 COFF variant).
/* Return a proper value for DJGPP & PE COFF (x86 COFF variants).
This function is required for DWARF2 support, but there is
no place to store this information in the COFF back end.
Should enough other COFF targets add support for DWARF2,
a place will have to be found. Until then, this hack will do. */
if (strncmp (name, "coff-go32", sizeof ("coff-go32") - 1) == 0)
if (strncmp (name, "coff-go32", sizeof ("coff-go32") - 1) == 0
|| strcmp (name, "pe-i386") == 0
|| strcmp (name, "pei-i386") == 0)
return 1;
bfd_set_error (bfd_error_wrong_format);
@ -982,6 +1066,29 @@ bfd_scan_vma (const char *string, const char **end, int base)
return value;
}
/*
FUNCTION
bfd_copy_private_header_data
SYNOPSIS
bfd_boolean bfd_copy_private_header_data (bfd *ibfd, bfd *obfd);
DESCRIPTION
Copy private BFD header information from the BFD @var{ibfd} to the
the BFD @var{obfd}. This copies information that may require
sections to exist, but does not require symbol tables. Return
<<true>> on success, <<false>> on error.
Possible error returns are:
o <<bfd_error_no_memory>> -
Not enough memory exists to create private data for @var{obfd}.
.#define bfd_copy_private_header_data(ibfd, obfd) \
. BFD_SEND (obfd, _bfd_copy_private_header_data, \
. (ibfd, obfd))
*/
/*
FUNCTION
bfd_copy_private_bfd_data
@ -1058,6 +1165,14 @@ DESCRIPTION
. BFD_SEND (abfd, _bfd_find_nearest_line, \
. (abfd, sec, syms, off, file, func, line))
.
.#define bfd_find_line(abfd, syms, sym, file, line) \
. BFD_SEND (abfd, _bfd_find_line, \
. (abfd, syms, sym, file, line))
.
.#define bfd_find_inliner_info(abfd, file, func, line) \
. BFD_SEND (abfd, _bfd_find_inliner_info, \
. (abfd, file, func, line))
.
.#define bfd_debug_info_start(abfd) \
. BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
.
@ -1085,6 +1200,9 @@ DESCRIPTION
.#define bfd_merge_sections(abfd, link_info) \
. BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
.
.#define bfd_is_group_section(abfd, sec) \
. BFD_SEND (abfd, _bfd_is_group_section, (abfd, sec))
.
.#define bfd_discard_group(abfd, sec) \
. BFD_SEND (abfd, _bfd_discard_group, (abfd, sec))
.
@ -1097,7 +1215,7 @@ DESCRIPTION
.#define bfd_link_add_symbols(abfd, info) \
. BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
.
.#define bfd_link_just_syms(sec, info) \
.#define bfd_link_just_syms(abfd, sec, info) \
. BFD_SEND (abfd, _bfd_link_just_syms, (sec, info))
.
.#define bfd_final_link(abfd, info) \
@ -1115,6 +1233,10 @@ DESCRIPTION
.#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \
. BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols))
.
.#define bfd_get_synthetic_symtab(abfd, count, syms, dyncount, dynsyms, ret) \
. BFD_SEND (abfd, _bfd_get_synthetic_symtab, (abfd, count, syms, \
. dyncount, dynsyms, ret))
.
.#define bfd_get_dynamic_reloc_upper_bound(abfd) \
. BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd))
.
@ -1280,7 +1402,7 @@ CODE_FRAGMENT
. flagword flags;
. const struct bfd_arch_info *arch_info;
. struct bfd_section *sections;
. struct bfd_section **section_tail;
. struct bfd_section *section_last;
. unsigned int section_count;
. struct bfd_hash_table section_htab;
.};
@ -1314,18 +1436,19 @@ bfd_preserve_save (bfd *abfd, struct bfd_preserve *preserve)
preserve->arch_info = abfd->arch_info;
preserve->flags = abfd->flags;
preserve->sections = abfd->sections;
preserve->section_tail = abfd->section_tail;
preserve->section_last = abfd->section_last;
preserve->section_count = abfd->section_count;
preserve->section_htab = abfd->section_htab;
if (! bfd_hash_table_init (&abfd->section_htab, bfd_section_hash_newfunc))
if (! bfd_hash_table_init (&abfd->section_htab, bfd_section_hash_newfunc,
sizeof (struct section_hash_entry)))
return FALSE;
abfd->tdata.any = NULL;
abfd->arch_info = &bfd_default_arch_struct;
abfd->flags &= BFD_IN_MEMORY;
abfd->sections = NULL;
abfd->section_tail = &abfd->sections;
abfd->section_last = NULL;
abfd->section_count = 0;
return TRUE;
@ -1355,7 +1478,7 @@ bfd_preserve_restore (bfd *abfd, struct bfd_preserve *preserve)
abfd->flags = preserve->flags;
abfd->section_htab = preserve->section_htab;
abfd->sections = preserve->sections;
abfd->section_tail = preserve->section_tail;
abfd->section_last = preserve->section_last;
abfd->section_count = preserve->section_count;
/* bfd_release frees all memory more recently bfd_alloc'd than

View file

@ -1,7 +1,8 @@
/* Low-level I/O routines for BFDs.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Written by Cygnus Support.
@ -19,7 +20,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "sysdep.h"
@ -62,38 +63,52 @@ real_fseek (FILE *file, file_ptr offset, int whence)
#endif
}
/* Note that archive entries don't have streams; they share their parent's.
This allows someone to play with the iostream behind BFD's back.
Also, note that the origin pointer points to the beginning of a file's
contents (0 for non-archive elements). For archive entries this is the
first octet in the file, NOT the beginning of the archive header. */
static size_t
real_read (void *where, size_t a, size_t b, FILE *file)
FILE *
real_fopen (const char *filename, const char *modes)
{
/* FIXME - this looks like an optimization, but it's really to cover
up for a feature of some OSs (not solaris - sigh) that
ld/pe-dll.c takes advantage of (apparently) when it creates BFDs
internally and tries to link against them. BFD seems to be smart
enough to realize there are no symbol records in the "file" that
doesn't exist but attempts to read them anyway. On Solaris,
attempting to read zero bytes from a NULL file results in a core
dump, but on other platforms it just returns zero bytes read.
This makes it to something reasonable. - DJ */
if (a == 0 || b == 0)
return 0;
#if defined (__VAX) && defined (VMS)
/* Apparently fread on Vax VMS does not keep the record length
information. */
return read (fileno (file), where, a * b);
#if defined (HAVE_FOPEN64)
return fopen64 (filename, modes);
#else
return fread (where, a, b, file);
return fopen (filename, modes);
#endif
}
/*
INTERNAL_DEFINITION
struct bfd_iovec
DESCRIPTION
The <<struct bfd_iovec>> contains the internal file I/O class.
Each <<BFD>> has an instance of this class and all file I/O is
routed through it (it is assumed that the instance implements
all methods listed below).
.struct bfd_iovec
.{
. {* To avoid problems with macros, a "b" rather than "f"
. prefix is prepended to each method name. *}
. {* Attempt to read/write NBYTES on ABFD's IOSTREAM storing/fetching
. bytes starting at PTR. Return the number of bytes actually
. transfered (a read past end-of-file returns less than NBYTES),
. or -1 (setting <<bfd_error>>) if an error occurs. *}
. file_ptr (*bread) (struct bfd *abfd, void *ptr, file_ptr nbytes);
. file_ptr (*bwrite) (struct bfd *abfd, const void *ptr,
. file_ptr nbytes);
. {* Return the current IOSTREAM file offset, or -1 (setting <<bfd_error>>
. if an error occurs. *}
. file_ptr (*btell) (struct bfd *abfd);
. {* For the following, on successful completion a value of 0 is returned.
. Otherwise, a value of -1 is returned (and <<bfd_error>> is set). *}
. int (*bseek) (struct bfd *abfd, file_ptr offset, int whence);
. int (*bclose) (struct bfd *abfd);
. int (*bflush) (struct bfd *abfd);
. int (*bstat) (struct bfd *abfd, struct stat *sb);
.};
*/
/* Return value is amount read. */
bfd_size_type
@ -121,25 +136,13 @@ bfd_bread (void *ptr, bfd_size_type size, bfd *abfd)
return get;
}
nread = real_read (ptr, 1, (size_t) size, bfd_cache_lookup (abfd));
if (abfd->iovec)
nread = abfd->iovec->bread (abfd, ptr, size);
else
nread = 0;
if (nread != (size_t) -1)
abfd->where += nread;
/* Set bfd_error if we did not read as much data as we expected.
If the read failed due to an error set the bfd_error_system_call,
else set bfd_error_file_truncated.
A BFD backend may wish to override bfd_error_file_truncated to
provide something more useful (eg. no_symbols or wrong_format). */
if (nread != size)
{
if (ferror (bfd_cache_lookup (abfd)))
bfd_set_error (bfd_error_system_call);
else
bfd_set_error (bfd_error_file_truncated);
}
return nread;
}
@ -151,6 +154,7 @@ bfd_bwrite (const void *ptr, bfd_size_type size, bfd *abfd)
if ((abfd->flags & BFD_IN_MEMORY) != 0)
{
struct bfd_in_memory *bim = abfd->iostream;
size = (size_t) size;
if (abfd->where + size > bim->size)
{
@ -175,7 +179,11 @@ bfd_bwrite (const void *ptr, bfd_size_type size, bfd *abfd)
return size;
}
nwrote = fwrite (ptr, 1, (size_t) size, bfd_cache_lookup (abfd));
if (abfd->iovec)
nwrote = abfd->iovec->bwrite (abfd, ptr, size);
else
nwrote = 0;
if (nwrote != (size_t) -1)
abfd->where += nwrote;
if (nwrote != size)
@ -196,10 +204,16 @@ bfd_tell (bfd *abfd)
if ((abfd->flags & BFD_IN_MEMORY) != 0)
return abfd->where;
ptr = real_ftell (bfd_cache_lookup (abfd));
if (abfd->iovec)
{
ptr = abfd->iovec->btell (abfd);
if (abfd->my_archive)
ptr -= abfd->origin;
}
else
ptr = 0;
if (abfd->my_archive)
ptr -= abfd->origin;
abfd->where = ptr;
return ptr;
}
@ -209,7 +223,10 @@ bfd_flush (bfd *abfd)
{
if ((abfd->flags & BFD_IN_MEMORY) != 0)
return 0;
return fflush (bfd_cache_lookup(abfd));
if (abfd->iovec)
return abfd->iovec->bflush (abfd);
return 0;
}
/* Returns 0 for success, negative value for failure (in which case
@ -217,19 +234,16 @@ bfd_flush (bfd *abfd)
int
bfd_stat (bfd *abfd, struct stat *statbuf)
{
FILE *f;
int result;
if ((abfd->flags & BFD_IN_MEMORY) != 0)
abort ();
f = bfd_cache_lookup (abfd);
if (f == NULL)
{
bfd_set_error (bfd_error_system_call);
return -1;
}
result = fstat (fileno (f), statbuf);
if (abfd->iovec)
result = abfd->iovec->bstat (abfd, statbuf);
else
result = -1;
if (result < 0)
bfd_set_error (bfd_error_system_call);
return result;
@ -242,7 +256,6 @@ int
bfd_seek (bfd *abfd, file_ptr position, int direction)
{
int result;
FILE *f;
file_ptr file_position;
/* For the time being, a BFD may not seek to it's end. The problem
is that we don't easily have a way to recognize the end of an
@ -270,6 +283,7 @@ bfd_seek (bfd *abfd, file_ptr position, int direction)
(abfd->direction == both_direction))
{
bfd_size_type newsize, oldsize;
oldsize = (bim->size + 127) & ~(bfd_size_type) 127;
bim->size = abfd->where;
/* Round up to cut down on memory fragmentation */
@ -296,20 +310,6 @@ bfd_seek (bfd *abfd, file_ptr position, int direction)
if (abfd->format != bfd_archive && abfd->my_archive == 0)
{
#if 0
/* Explanation for this code: I'm only about 95+% sure that the above
conditions are sufficient and that all i/o calls are properly
adjusting the `where' field. So this is sort of an `assert'
that the `where' field is correct. If we can go a while without
tripping the abort, we can probably safely disable this code,
so that the real optimizations happen. */
file_ptr where_am_i_now;
where_am_i_now = real_ftell (bfd_cache_lookup (abfd));
if (abfd->my_archive)
where_am_i_now -= abfd->origin;
if (where_am_i_now != abfd->where)
abort ();
#endif
if (direction == SEEK_SET && (bfd_vma) position == abfd->where)
return 0;
}
@ -328,12 +328,15 @@ bfd_seek (bfd *abfd, file_ptr position, int direction)
In the meantime, no optimization for archives. */
}
f = bfd_cache_lookup (abfd);
file_position = position;
if (direction == SEEK_SET && abfd->my_archive != NULL)
file_position += abfd->origin;
result = real_fseek (f, file_position, direction);
if (abfd->iovec)
result = abfd->iovec->bseek (abfd, file_position, direction);
else
result = -1;
if (result != 0)
{
int hold_errno = errno;
@ -378,14 +381,15 @@ DESCRIPTION
long
bfd_get_mtime (bfd *abfd)
{
FILE *fp;
struct stat buf;
if (abfd->mtime_set)
return abfd->mtime;
fp = bfd_cache_lookup (abfd);
if (0 != fstat (fileno (fp), &buf))
if (abfd->iovec == NULL)
return 0;
if (abfd->iovec->bstat (abfd, &buf) != 0)
return 0;
abfd->mtime = buf.st_mtime; /* Save value in case anyone wants it */
@ -428,14 +432,15 @@ DESCRIPTION
long
bfd_get_size (bfd *abfd)
{
FILE *fp;
struct stat buf;
if ((abfd->flags & BFD_IN_MEMORY) != 0)
return ((struct bfd_in_memory *) abfd->iostream)->size;
fp = bfd_cache_lookup (abfd);
if (0 != fstat (fileno (fp), & buf))
if (abfd->iovec == NULL)
return 0;
if (abfd->iovec->bstat (abfd, &buf) != 0)
return 0;
return buf.st_size;

View file

@ -1,5 +1,6 @@
/* Support for memory-mapped windows into a BFD.
Copyright 1995, 1996, 2001, 2002, 2003 Free Software Foundation, Inc.
Copyright 1995, 1996, 2001, 2002, 2003, 2005
Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@ -16,7 +17,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "sysdep.h"
@ -144,7 +145,6 @@ bfd_get_file_window (bfd *abfd,
file_ptr file_offset, offset2;
size_t real_size;
int fd;
FILE *f;
/* Find the real file and the real offset into it. */
while (abfd->my_archive != NULL)
@ -152,8 +152,13 @@ bfd_get_file_window (bfd *abfd,
offset += abfd->origin;
abfd = abfd->my_archive;
}
f = bfd_cache_lookup (abfd);
fd = fileno (f);
/* Seek into the file, to ensure it is open if cacheable. */
if (abfd->iostream == NULL
&& (abfd->iovec == NULL
|| abfd->iovec->bseek (abfd, offset, SEEK_SET) != 0))
return FALSE;
fd = fileno ((FILE *) abfd->iostream);
/* Compute offsets and size for mmap and for the user's data. */
offset2 = offset % pagesize;

View file

@ -1,6 +1,6 @@
/* BFD back-end for binary objects.
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2004, 2005 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>
This file is part of BFD, the Binary File Descriptor library.
@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* This is a BFD backend which may be used to write binary objects.
It may only be used for output, not input. The intention is that
@ -41,18 +41,6 @@
a start symbol, an end symbol, and an absolute length symbol. */
#define BIN_SYMS 3
static bfd_boolean binary_mkobject PARAMS ((bfd *));
static const bfd_target *binary_object_p PARAMS ((bfd *));
static bfd_boolean binary_get_section_contents
PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
static long binary_get_symtab_upper_bound PARAMS ((bfd *));
static char *mangle_name PARAMS ((bfd *, char *));
static long binary_canonicalize_symtab PARAMS ((bfd *, asymbol **));
static void binary_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
static bfd_boolean binary_set_section_contents
PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type));
static int binary_sizeof_headers PARAMS ((bfd *, bfd_boolean));
/* Set by external programs - specifies the BFD architecture and
machine number to be uses when creating binary BFDs. */
enum bfd_architecture bfd_external_binary_architecture = bfd_arch_unknown;
@ -61,8 +49,7 @@ unsigned long bfd_external_machine = 0;
/* Create a binary object. Invoked via bfd_set_format. */
static bfd_boolean
binary_mkobject (abfd)
bfd *abfd ATTRIBUTE_UNUSED;
binary_mkobject (bfd *abfd ATTRIBUTE_UNUSED)
{
return TRUE;
}
@ -72,8 +59,7 @@ binary_mkobject (abfd)
being binary. */
static const bfd_target *
binary_object_p (abfd)
bfd *abfd;
binary_object_p (bfd *abfd)
{
struct stat statbuf;
asection *sec;
@ -99,10 +85,10 @@ binary_object_p (abfd)
return NULL;
sec->flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS;
sec->vma = 0;
sec->_raw_size = statbuf.st_size;
sec->size = statbuf.st_size;
sec->filepos = 0;
abfd->tdata.any = (PTR) sec;
abfd->tdata.any = (void *) sec;
if (bfd_get_arch_info (abfd) != NULL)
{
@ -115,19 +101,18 @@ binary_object_p (abfd)
return abfd->xvec;
}
#define binary_close_and_cleanup _bfd_generic_close_and_cleanup
#define binary_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
#define binary_new_section_hook _bfd_generic_new_section_hook
#define binary_close_and_cleanup _bfd_generic_close_and_cleanup
#define binary_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
#define binary_new_section_hook _bfd_generic_new_section_hook
/* Get contents of the only section. */
static bfd_boolean
binary_get_section_contents (abfd, section, location, offset, count)
bfd *abfd;
asection *section ATTRIBUTE_UNUSED;
PTR location;
file_ptr offset;
bfd_size_type count;
binary_get_section_contents (bfd *abfd,
asection *section ATTRIBUTE_UNUSED,
void * location,
file_ptr offset,
bfd_size_type count)
{
if (bfd_seek (abfd, offset, SEEK_SET) != 0
|| bfd_bread (location, count, abfd) != count)
@ -138,8 +123,7 @@ binary_get_section_contents (abfd, section, location, offset, count)
/* Return the amount of memory needed to read the symbol table. */
static long
binary_get_symtab_upper_bound (abfd)
bfd *abfd ATTRIBUTE_UNUSED;
binary_get_symtab_upper_bound (bfd *abfd ATTRIBUTE_UNUSED)
{
return (BIN_SYMS + 1) * sizeof (asymbol *);
}
@ -147,9 +131,7 @@ binary_get_symtab_upper_bound (abfd)
/* Create a symbol name based on the bfd's filename. */
static char *
mangle_name (abfd, suffix)
bfd *abfd;
char *suffix;
mangle_name (bfd *abfd, char *suffix)
{
bfd_size_type size;
char *buf;
@ -159,7 +141,7 @@ mangle_name (abfd, suffix)
+ strlen (suffix)
+ sizeof "_binary__");
buf = (char *) bfd_alloc (abfd, size);
buf = bfd_alloc (abfd, size);
if (buf == NULL)
return "";
@ -176,16 +158,14 @@ mangle_name (abfd, suffix)
/* Return the symbol table. */
static long
binary_canonicalize_symtab (abfd, alocation)
bfd *abfd;
asymbol **alocation;
binary_canonicalize_symtab (bfd *abfd, asymbol **alocation)
{
asection *sec = (asection *) abfd->tdata.any;
asymbol *syms;
unsigned int i;
bfd_size_type amt = BIN_SYMS * sizeof (asymbol);
syms = (asymbol *) bfd_alloc (abfd, amt);
syms = bfd_alloc (abfd, amt);
if (syms == NULL)
return 0;
@ -200,7 +180,7 @@ binary_canonicalize_symtab (abfd, alocation)
/* End symbol. */
syms[1].the_bfd = abfd;
syms[1].name = mangle_name (abfd, "end");
syms[1].value = sec->_raw_size;
syms[1].value = sec->size;
syms[1].flags = BSF_GLOBAL;
syms[1].section = sec;
syms[1].udata.p = NULL;
@ -208,7 +188,7 @@ binary_canonicalize_symtab (abfd, alocation)
/* Size symbol. */
syms[2].the_bfd = abfd;
syms[2].name = mangle_name (abfd, "size");
syms[2].value = sec->_raw_size;
syms[2].value = sec->size;
syms[2].flags = BSF_GLOBAL;
syms[2].section = bfd_abs_section_ptr;
syms[2].udata.p = NULL;
@ -220,32 +200,30 @@ binary_canonicalize_symtab (abfd, alocation)
return BIN_SYMS;
}
#define binary_make_empty_symbol _bfd_generic_make_empty_symbol
#define binary_print_symbol _bfd_nosymbols_print_symbol
#define binary_make_empty_symbol _bfd_generic_make_empty_symbol
#define binary_print_symbol _bfd_nosymbols_print_symbol
/* Get information about a symbol. */
static void
binary_get_symbol_info (ignore_abfd, symbol, ret)
bfd *ignore_abfd ATTRIBUTE_UNUSED;
asymbol *symbol;
symbol_info *ret;
binary_get_symbol_info (bfd *ignore_abfd ATTRIBUTE_UNUSED,
asymbol *symbol,
symbol_info *ret)
{
bfd_symbol_info (symbol, ret);
}
#define binary_bfd_is_local_label_name bfd_generic_is_local_label_name
#define binary_get_lineno _bfd_nosymbols_get_lineno
#define binary_find_nearest_line _bfd_nosymbols_find_nearest_line
#define binary_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
#define binary_read_minisymbols _bfd_generic_read_minisymbols
#define binary_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
#define binary_get_reloc_upper_bound \
((long (*) PARAMS ((bfd *, asection *))) bfd_0l)
#define binary_canonicalize_reloc \
((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) bfd_0l)
#define binary_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
#define binary_bfd_is_local_label_name bfd_generic_is_local_label_name
#define binary_get_lineno _bfd_nosymbols_get_lineno
#define binary_find_nearest_line _bfd_nosymbols_find_nearest_line
#define binary_find_inliner_info _bfd_nosymbols_find_inliner_info
#define binary_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
#define binary_read_minisymbols _bfd_generic_read_minisymbols
#define binary_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
#define binary_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
#define binary_get_reloc_upper_bound ((long (*) (bfd *, asection *)) bfd_0l)
#define binary_canonicalize_reloc ((long (*) (bfd *, asection *, arelent **, asymbol **)) bfd_0l)
#define binary_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
/* Set the architecture of a binary file. */
#define binary_set_arch_mach _bfd_generic_set_arch_mach
@ -253,12 +231,11 @@ binary_get_symbol_info (ignore_abfd, symbol, ret)
/* Write section contents of a binary file. */
static bfd_boolean
binary_set_section_contents (abfd, sec, data, offset, size)
bfd *abfd;
asection *sec;
const PTR data;
file_ptr offset;
bfd_size_type size;
binary_set_section_contents (bfd *abfd,
asection *sec,
const void * data,
file_ptr offset,
bfd_size_type size)
{
if (size == 0)
return TRUE;
@ -278,7 +255,7 @@ binary_set_section_contents (abfd, sec, data, offset, size)
if (((s->flags
& (SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_NEVER_LOAD))
== (SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC))
&& (s->_raw_size > 0)
&& (s->size > 0)
&& (! found_low || s->lma < low))
{
low = s->lma;
@ -294,7 +271,7 @@ binary_set_section_contents (abfd, sec, data, offset, size)
if ((s->flags
& (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_NEVER_LOAD))
!= (SEC_HAS_CONTENTS | SEC_ALLOC)
|| (s->_raw_size == 0))
|| (s->size == 0))
continue;
/* If attempting to generate a binary file from a bfd with
@ -327,27 +304,26 @@ binary_set_section_contents (abfd, sec, data, offset, size)
/* No space is required for header information. */
static int
binary_sizeof_headers (abfd, exec)
bfd *abfd ATTRIBUTE_UNUSED;
bfd_boolean exec ATTRIBUTE_UNUSED;
binary_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
bfd_boolean exec ATTRIBUTE_UNUSED)
{
return 0;
}
#define binary_bfd_get_relocated_section_contents \
bfd_generic_get_relocated_section_contents
#define binary_bfd_relax_section bfd_generic_relax_section
#define binary_bfd_gc_sections bfd_generic_gc_sections
#define binary_bfd_merge_sections bfd_generic_merge_sections
#define binary_bfd_discard_group bfd_generic_discard_group
#define binary_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define binary_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define binary_bfd_link_just_syms _bfd_generic_link_just_syms
#define binary_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define binary_bfd_final_link _bfd_generic_final_link
#define binary_bfd_link_split_section _bfd_generic_link_split_section
#define binary_get_section_contents_in_window \
_bfd_generic_get_section_contents_in_window
#define binary_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
#define binary_bfd_relax_section bfd_generic_relax_section
#define binary_bfd_gc_sections bfd_generic_gc_sections
#define binary_bfd_merge_sections bfd_generic_merge_sections
#define binary_bfd_is_group_section bfd_generic_is_group_section
#define binary_bfd_discard_group bfd_generic_discard_group
#define binary_section_already_linked _bfd_generic_section_already_linked
#define binary_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define binary_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define binary_bfd_link_just_syms _bfd_generic_link_just_syms
#define binary_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define binary_bfd_final_link _bfd_generic_final_link
#define binary_bfd_link_split_section _bfd_generic_link_split_section
#define binary_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
const bfd_target binary_vec =
{
@ -369,7 +345,7 @@ const bfd_target binary_vec =
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
{ /* bfd_check_format */
_bfd_dummy_target,
binary_object_p, /* bfd_check_format */
binary_object_p,
_bfd_dummy_target,
_bfd_dummy_target,
},

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
/* BFD library -- caching of file descriptors.
Copyright 1990, 1991, 1992, 1993, 1994, 1996, 2000, 2001, 2002,
2003, 2004 Free Software Foundation, Inc.
2003, 2004, 2005 Free Software Foundation, Inc.
Hacked by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
@ -19,7 +19,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/*
SECTION
@ -36,61 +36,44 @@ SECTION
close, closes it and opens the one wanted, returning its file
handle.
SUBSECTION
Caching functions
*/
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
#include "libiberty.h"
static bfd_boolean bfd_cache_delete (bfd *);
/* In some cases we can optimize cache operation when reopening files.
For instance, a flush is entirely unnecessary if the file is already
closed, so a flush would use CACHE_NO_OPEN. Similarly, a seek using
SEEK_SET or SEEK_END need not first seek to the current position.
For stat we ignore seek errors, just in case the file has changed
while we weren't looking. If it has, then it's possible that the
file is shorter and we don't want a seek error to prevent us doing
the stat. */
enum cache_flag {
CACHE_NORMAL = 0,
CACHE_NO_OPEN = 1,
CACHE_NO_SEEK = 2,
CACHE_NO_SEEK_ERROR = 4
};
/*
INTERNAL_FUNCTION
BFD_CACHE_MAX_OPEN macro
/* The maximum number of files which the cache will keep open at
one time. */
DESCRIPTION
The maximum number of files which the cache will keep open at
one time.
.#define BFD_CACHE_MAX_OPEN 10
*/
#define BFD_CACHE_MAX_OPEN 10
/* The number of BFD files we have open. */
static int open_files;
/*
INTERNAL_FUNCTION
bfd_last_cache
/* Zero, or a pointer to the topmost BFD on the chain. This is
used by the <<bfd_cache_lookup>> macro in @file{libbfd.h} to
determine when it can avoid a function call. */
SYNOPSIS
extern bfd *bfd_last_cache;
DESCRIPTION
Zero, or a pointer to the topmost BFD on the chain. This is
used by the <<bfd_cache_lookup>> macro in @file{libbfd.h} to
determine when it can avoid a function call.
*/
bfd *bfd_last_cache;
/*
INTERNAL_FUNCTION
bfd_cache_lookup
DESCRIPTION
Check to see if the required BFD is the same as the last one
looked up. If so, then it can use the stream in the BFD with
impunity, since it can't have changed since the last lookup;
otherwise, it has to perform the complicated lookup function.
.#define bfd_cache_lookup(x) \
. ((x)==bfd_last_cache? \
. (FILE*) (bfd_last_cache->iostream): \
. bfd_cache_lookup_worker(x))
*/
static bfd *bfd_last_cache = NULL;
/* Insert a BFD into the cache. */
@ -127,6 +110,29 @@ snip (bfd *abfd)
}
}
/* Close a BFD and remove it from the cache. */
static bfd_boolean
bfd_cache_delete (bfd *abfd)
{
bfd_boolean ret;
if (fclose ((FILE *) abfd->iostream) == 0)
ret = TRUE;
else
{
ret = FALSE;
bfd_set_error (bfd_error_system_call);
}
snip (abfd);
abfd->iostream = NULL;
--open_files;
return ret;
}
/* We need to open a new file, and the cache is full. Find the least
recently used cacheable BFD and close it. */
@ -159,32 +165,205 @@ close_one (void)
kill->where = real_ftell ((FILE *) kill->iostream);
/* Save the file st_mtime. This is a hack so that gdb can detect when
an executable has been deleted and recreated. The only thing that
makes this reasonable is that st_mtime doesn't change when a file
is unlinked, so saving st_mtime makes BFD's file cache operation
a little more transparent for this particular usage pattern. If we
hadn't closed the file then we would not have lost the original
contents, st_mtime etc. Of course, if something is writing to an
existing file, then this is the wrong thing to do.
FIXME: gdb should save these times itself on first opening a file,
and this hack be removed. */
if (kill->direction == no_direction || kill->direction == read_direction)
{
bfd_get_mtime (kill);
kill->mtime_set = TRUE;
}
return bfd_cache_delete (kill);
}
/* Close a BFD and remove it from the cache. */
/* Check to see if the required BFD is the same as the last one
looked up. If so, then it can use the stream in the BFD with
impunity, since it can't have changed since the last lookup;
otherwise, it has to perform the complicated lookup function. */
static bfd_boolean
bfd_cache_delete (bfd *abfd)
#define bfd_cache_lookup(x, flag) \
((x) == bfd_last_cache \
? (FILE *) (bfd_last_cache->iostream) \
: bfd_cache_lookup_worker (x, flag))
/* Called when the macro <<bfd_cache_lookup>> fails to find a
quick answer. Find a file descriptor for @var{abfd}. If
necessary, it open it. If there are already more than
<<BFD_CACHE_MAX_OPEN>> files open, it tries to close one first, to
avoid running out of file descriptors. It will return NULL
if it is unable to (re)open the @var{abfd}. */
static FILE *
bfd_cache_lookup_worker (bfd *abfd, enum cache_flag flag)
{
bfd_boolean ret;
bfd *orig_bfd = abfd;
if ((abfd->flags & BFD_IN_MEMORY) != 0)
abort ();
if (fclose ((FILE *) abfd->iostream) == 0)
ret = TRUE;
else
if (abfd->my_archive)
abfd = abfd->my_archive;
if (abfd->iostream != NULL)
{
ret = FALSE;
bfd_set_error (bfd_error_system_call);
/* Move the file to the start of the cache. */
if (abfd != bfd_last_cache)
{
snip (abfd);
insert (abfd);
}
return (FILE *) abfd->iostream;
}
snip (abfd);
if (flag & CACHE_NO_OPEN)
return NULL;
abfd->iostream = NULL;
--open_files;
if (bfd_open_file (abfd) == NULL)
;
else if (!(flag & CACHE_NO_SEEK)
&& real_fseek ((FILE *) abfd->iostream, abfd->where, SEEK_SET) != 0
&& !(flag & CACHE_NO_SEEK_ERROR))
bfd_set_error (bfd_error_system_call);
else
return (FILE *) abfd->iostream;
return ret;
(*_bfd_error_handler) (_("reopening %B: %s\n"),
orig_bfd, bfd_errmsg (bfd_get_error ()));
return NULL;
}
static file_ptr
cache_btell (struct bfd *abfd)
{
FILE *f = bfd_cache_lookup (abfd, CACHE_NO_OPEN);
if (f == NULL)
return abfd->where;
return real_ftell (f);
}
static int
cache_bseek (struct bfd *abfd, file_ptr offset, int whence)
{
FILE *f = bfd_cache_lookup (abfd, whence != SEEK_CUR ? CACHE_NO_SEEK : 0);
if (f == NULL)
return -1;
return real_fseek (f, offset, whence);
}
/* Note that archive entries don't have streams; they share their parent's.
This allows someone to play with the iostream behind BFD's back.
Also, note that the origin pointer points to the beginning of a file's
contents (0 for non-archive elements). For archive entries this is the
first octet in the file, NOT the beginning of the archive header. */
static file_ptr
cache_bread (struct bfd *abfd, void *buf, file_ptr nbytes)
{
FILE *f;
file_ptr nread;
/* FIXME - this looks like an optimization, but it's really to cover
up for a feature of some OSs (not solaris - sigh) that
ld/pe-dll.c takes advantage of (apparently) when it creates BFDs
internally and tries to link against them. BFD seems to be smart
enough to realize there are no symbol records in the "file" that
doesn't exist but attempts to read them anyway. On Solaris,
attempting to read zero bytes from a NULL file results in a core
dump, but on other platforms it just returns zero bytes read.
This makes it to something reasonable. - DJ */
if (nbytes == 0)
return 0;
f = bfd_cache_lookup (abfd, 0);
if (f == NULL)
return 0;
#if defined (__VAX) && defined (VMS)
/* Apparently fread on Vax VMS does not keep the record length
information. */
nread = read (fileno (f), buf, nbytes);
/* Set bfd_error if we did not read as much data as we expected. If
the read failed due to an error set the bfd_error_system_call,
else set bfd_error_file_truncated. */
if (nread == (file_ptr)-1)
{
bfd_set_error (bfd_error_system_call);
return -1;
}
#else
nread = fread (buf, 1, nbytes, f);
/* Set bfd_error if we did not read as much data as we expected. If
the read failed due to an error set the bfd_error_system_call,
else set bfd_error_file_truncated. */
if (nread < nbytes && ferror (f))
{
bfd_set_error (bfd_error_system_call);
return -1;
}
#endif
return nread;
}
static file_ptr
cache_bwrite (struct bfd *abfd, const void *where, file_ptr nbytes)
{
file_ptr nwrite;
FILE *f = bfd_cache_lookup (abfd, 0);
if (f == NULL)
return 0;
nwrite = fwrite (where, 1, nbytes, f);
if (nwrite < nbytes && ferror (f))
{
bfd_set_error (bfd_error_system_call);
return -1;
}
return nwrite;
}
static int
cache_bclose (struct bfd *abfd)
{
return bfd_cache_close (abfd);
}
static int
cache_bflush (struct bfd *abfd)
{
int sts;
FILE *f = bfd_cache_lookup (abfd, CACHE_NO_OPEN);
if (f == NULL)
return 0;
sts = fflush (f);
if (sts < 0)
bfd_set_error (bfd_error_system_call);
return sts;
}
static int
cache_bstat (struct bfd *abfd, struct stat *sb)
{
int sts;
FILE *f = bfd_cache_lookup (abfd, CACHE_NO_SEEK_ERROR);
if (f == NULL)
return -1;
sts = fstat (fileno (f), sb);
if (sts < 0)
bfd_set_error (bfd_error_system_call);
return sts;
}
static const struct bfd_iovec cache_iovec = {
&cache_bread, &cache_bwrite, &cache_btell, &cache_bseek,
&cache_bclose, &cache_bflush, &cache_bstat
};
/*
INTERNAL_FUNCTION
bfd_cache_init
@ -205,6 +384,7 @@ bfd_cache_init (bfd *abfd)
if (! close_one ())
return FALSE;
}
abfd->iovec = &cache_iovec;
insert (abfd);
++open_files;
return TRUE;
@ -229,13 +409,43 @@ RETURNS
bfd_boolean
bfd_cache_close (bfd *abfd)
{
if (abfd->iostream == NULL
|| (abfd->flags & BFD_IN_MEMORY) != 0)
if (abfd->iovec != &cache_iovec)
return TRUE;
if (abfd->iostream == NULL)
/* Previously closed. */
return TRUE;
return bfd_cache_delete (abfd);
}
/*
FUNCTION
bfd_cache_close_all
SYNOPSIS
bfd_boolean bfd_cache_close_all (void);
DESCRIPTION
Remove all BFDs from the cache. If the attached file is open,
then close it too.
RETURNS
<<FALSE>> is returned if closing one of the file fails, <<TRUE>> is
returned if all is well.
*/
bfd_boolean
bfd_cache_close_all ()
{
bfd_boolean ret = TRUE;
while (bfd_last_cache != NULL)
ret &= bfd_cache_close (bfd_last_cache);
return ret;
}
/*
INTERNAL_FUNCTION
bfd_open_file
@ -266,15 +476,15 @@ bfd_open_file (bfd *abfd)
{
case read_direction:
case no_direction:
abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_RB);
abfd->iostream = (PTR) real_fopen (abfd->filename, FOPEN_RB);
break;
case both_direction:
case write_direction:
if (abfd->opened_once)
{
abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_RUB);
abfd->iostream = (PTR) real_fopen (abfd->filename, FOPEN_RUB);
if (abfd->iostream == NULL)
abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_WUB);
abfd->iostream = (PTR) real_fopen (abfd->filename, FOPEN_WUB);
}
else
{
@ -302,15 +512,17 @@ bfd_open_file (bfd *abfd)
struct stat s;
if (stat (abfd->filename, &s) == 0 && s.st_size != 0)
unlink (abfd->filename);
unlink_if_ordinary (abfd->filename);
#endif
abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_WUB);
abfd->iostream = (PTR) real_fopen (abfd->filename, FOPEN_WUB);
abfd->opened_once = TRUE;
}
break;
}
if (abfd->iostream != NULL)
if (abfd->iostream == NULL)
bfd_set_error (bfd_error_system_call);
else
{
if (! bfd_cache_init (abfd))
return NULL;
@ -318,49 +530,3 @@ bfd_open_file (bfd *abfd)
return (FILE *) abfd->iostream;
}
/*
INTERNAL_FUNCTION
bfd_cache_lookup_worker
SYNOPSIS
FILE *bfd_cache_lookup_worker (bfd *abfd);
DESCRIPTION
Called when the macro <<bfd_cache_lookup>> fails to find a
quick answer. Find a file descriptor for @var{abfd}. If
necessary, it open it. If there are already more than
<<BFD_CACHE_MAX_OPEN>> files open, it tries to close one first, to
avoid running out of file descriptors.
*/
FILE *
bfd_cache_lookup_worker (bfd *abfd)
{
if ((abfd->flags & BFD_IN_MEMORY) != 0)
abort ();
if (abfd->my_archive)
abfd = abfd->my_archive;
if (abfd->iostream != NULL)
{
/* Move the file to the start of the cache. */
if (abfd != bfd_last_cache)
{
snip (abfd);
insert (abfd);
}
}
else
{
if (bfd_open_file (abfd) == NULL)
return NULL;
if (abfd->where != (unsigned long) abfd->where)
return NULL;
if (real_fseek ((FILE *) abfd->iostream, abfd->where, SEEK_SET) != 0)
return NULL;
}
return (FILE *) abfd->iostream;
}

View file

@ -1,6 +1,6 @@
/* BFD back-end for ALPHA Extended-Coff files.
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
2003, 2004, 2005 Free Software Foundation, Inc.
Modified from coff-mips.c by Steve Chamberlain <sac@cygnus.com> and
Ian Lance Taylor <ian@cygnus.com>.
@ -18,7 +18,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "bfd.h"
#include "sysdep.h"
@ -462,8 +462,8 @@ alpha_ecoff_object_p (abfd)
bfd_size_type size;
size = sec->line_filepos * 8;
BFD_ASSERT (size == bfd_section_size (abfd, sec)
|| size + 8 == bfd_section_size (abfd, sec));
BFD_ASSERT (size == sec->size
|| size + 8 == sec->size);
if (! bfd_set_section_size (abfd, sec, size))
return NULL;
}
@ -481,10 +481,16 @@ alpha_ecoff_bad_format_hook (abfd, filehdr)
{
struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
if (ALPHA_ECOFF_BADMAG (*internal_f))
return FALSE;
if (! ALPHA_ECOFF_BADMAG (*internal_f))
return TRUE;
return TRUE;
if (ALPHA_ECOFF_COMPRESSEDMAG (*internal_f))
(*_bfd_error_handler)
(_("%B: Cannot handle compressed Alpha binaries.\n"
" Use compiler flags, or objZ, to generate uncompressed binaries."),
abfd);
return FALSE;
}
/* This is a hook called by coff_real_object_p to create any backend
@ -603,8 +609,11 @@ alpha_ecoff_swap_reloc_out (abfd, intern, dst)
size = intern->r_size;
}
/* XXX FIXME: The maximum symndx value used to be 14 but this
fails with object files produced by DEC's C++ compiler.
Where does the value 14 (or 15) come from anyway ? */
BFD_ASSERT (intern->r_extern
|| (intern->r_symndx >= 0 && intern->r_symndx <= 14));
|| (intern->r_symndx >= 0 && intern->r_symndx <= 15));
H_PUT_64 (abfd, intern->r_vaddr, ext->r_vaddr);
H_PUT_32 (abfd, symndx, ext->r_symndx);
@ -632,7 +641,15 @@ alpha_adjust_reloc_in (abfd, intern, rptr)
arelent *rptr;
{
if (intern->r_type > ALPHA_R_GPVALUE)
abort ();
{
(*_bfd_error_handler)
(_("%B: unknown/unsupported relocation type %d"),
abfd, intern->r_type);
bfd_set_error (bfd_error_bad_value);
rptr->addend = 0;
rptr->howto = NULL;
return;
}
switch (intern->r_type)
{
@ -668,7 +685,7 @@ alpha_adjust_reloc_in (abfd, intern, rptr)
case ALPHA_R_OP_STORE:
/* The STORE reloc needs the size and offset fields. We store
them in the addend. */
BFD_ASSERT (intern->r_offset <= 256 && intern->r_size <= 256);
BFD_ASSERT (intern->r_offset <= 256);
rptr->addend = (intern->r_offset << 8) + intern->r_size;
break;
@ -768,6 +785,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
long reloc_count;
bfd *output_bfd = relocatable ? abfd : (bfd *) NULL;
bfd_vma gp;
bfd_size_type sz;
bfd_boolean gp_undefined;
bfd_vma stack[RELOC_STACKSIZE];
int tos = 0;
@ -778,14 +796,10 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
if (reloc_vector == NULL && reloc_size != 0)
goto error_return;
if (! bfd_get_section_contents (input_bfd, input_section, data,
(file_ptr) 0, input_section->_raw_size))
sz = input_section->rawsize ? input_section->rawsize : input_section->size;
if (! bfd_get_section_contents (input_bfd, input_section, data, 0, sz))
goto error_return;
/* The section size is not going to change. */
input_section->_cooked_size = input_section->_raw_size;
input_section->reloc_done = TRUE;
reloc_count = bfd_canonicalize_reloc (input_bfd, input_section,
reloc_vector, symbols);
if (reloc_count < 0)
@ -1148,7 +1162,8 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
break;
case bfd_reloc_overflow:
if (! ((*link_info->callbacks->reloc_overflow)
(link_info, bfd_asymbol_name (*rel->sym_ptr_ptr),
(link_info, NULL,
bfd_asymbol_name (*rel->sym_ptr_ptr),
rel->howto->name, rel->addend, input_bfd,
input_section, rel->address)))
goto error_return;
@ -1223,23 +1238,6 @@ alpha_bfd_reloc_type_lookup (abfd, code)
case BFD_RELOC_64_PCREL:
alpha_type = ALPHA_R_SREL64;
break;
#if 0
case ???:
alpha_type = ALPHA_R_OP_PUSH;
break;
case ???:
alpha_type = ALPHA_R_OP_STORE;
break;
case ???:
alpha_type = ALPHA_R_OP_PSUB;
break;
case ???:
alpha_type = ALPHA_R_OP_PRSHIFT;
break;
case ???:
alpha_type = ALPHA_R_GPVALUE;
break;
#endif
default:
return (reloc_howto_type *) NULL;
}
@ -1455,7 +1453,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
amt = sizeof (struct ecoff_section_tdata);
lita_sec_data = ((struct ecoff_section_tdata *)
bfd_zalloc (input_bfd, amt));
ecoff_section_data (input_bfd, lita_sec) = lita_sec_data;
lita_sec->used_by_bfd = lita_sec_data;
}
if (lita_sec_data->gp != 0)
@ -1470,9 +1468,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_size_type lita_size;
lita_vma = lita_sec->output_offset + lita_sec->output_section->vma;
lita_size = lita_sec->_cooked_size;
if (lita_size == 0)
lita_size = lita_sec->_raw_size;
lita_size = lita_sec->size;
if (gp == 0
|| lita_vma < gp - 0x8000
@ -1542,8 +1538,26 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
switch (r_type)
{
case ALPHA_R_GPRELHIGH:
(*_bfd_error_handler)
(_("%B: unsupported relocation: ALPHA_R_GPRELHIGH"),
input_bfd);
bfd_set_error (bfd_error_bad_value);
continue;
case ALPHA_R_GPRELLOW:
(*_bfd_error_handler)
(_("%B: unsupported relocation: ALPHA_R_GPRELLOW"),
input_bfd);
bfd_set_error (bfd_error_bad_value);
continue;
default:
abort ();
(*_bfd_error_handler)
(_("%B: unknown relocation type %d"),
input_bfd, (int) r_type);
bfd_set_error (bfd_error_bad_value);
continue;
case ALPHA_R_IGNORE:
/* This reloc appears after a GPDISP reloc. On earlier
@ -1965,7 +1979,8 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
name = bfd_section_name (input_bfd,
symndx_to_section[r_symndx]);
if (! ((*info->callbacks->reloc_overflow)
(info, name, alpha_howto_table[r_type].name,
(info, NULL, name,
alpha_howto_table[r_type].name,
(bfd_vma) 0, input_bfd, input_section,
r_vaddr - input_section->vma)))
return FALSE;
@ -2359,7 +2374,10 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data =
#define _bfd_ecoff_bfd_relax_section bfd_generic_relax_section
#define _bfd_ecoff_bfd_gc_sections bfd_generic_gc_sections
#define _bfd_ecoff_bfd_merge_sections bfd_generic_merge_sections
#define _bfd_ecoff_bfd_is_group_section bfd_generic_is_group_section
#define _bfd_ecoff_bfd_discard_group bfd_generic_discard_group
#define _bfd_ecoff_section_already_linked \
_bfd_generic_section_already_linked
const bfd_target ecoffalpha_little_vec =
{

File diff suppressed because it is too large Load diff

View file

@ -16,7 +16,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#define TARGET_SYM m68kaux_coff_vec
#define TARGET_NAME "coff-m68k-aux"

View file

@ -1,24 +1,24 @@
/* BFD back-end for Intel 386 COFF files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003
2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "bfd.h"
#include "sysdep.h"
@ -119,6 +119,8 @@ coff_i386_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
here. */
if (howto->pc_relative && howto->pcrel_offset)
diff = -(1 << howto->size);
else if (symbol->flags & BSF_WEAK)
diff = reloc_entry->addend - symbol->value;
else
diff = -reloc_entry->addend;
}
@ -234,7 +236,24 @@ static reloc_howto_type howto_table[] =
EMPTY_HOWTO (010),
EMPTY_HOWTO (011),
EMPTY_HOWTO (012),
#ifdef COFF_WITH_PE
/* 32-bit longword section relative relocation (013). */
HOWTO (R_SECREL32, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
coff_i386_reloc, /* special_function */
"secrel32", /* name */
TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
TRUE), /* pcrel_offset */
#else
EMPTY_HOWTO (013),
#endif
EMPTY_HOWTO (014),
EMPTY_HOWTO (015),
EMPTY_HOWTO (016),
@ -497,6 +516,30 @@ coff_i386_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
{
*addendp -= pe_data(sec->output_section->owner)->pe_opthdr.ImageBase;
}
if (rel->r_type == R_SECREL32)
{
bfd_vma osect_vma;
if (h && (h->type == bfd_link_hash_defined
|| h->type == bfd_link_hash_defweak))
osect_vma = h->root.u.def.section->output_section->vma;
else
{
asection *sec;
int i;
/* Sigh, the only way to get the section to offset against
is to find it the hard way. */
for (sec = abfd->sections, i = 1; i < sym->n_scnum; i++)
sec = sec->next;
osect_vma = sec->output_section->vma;
}
*addendp -= osect_vma;
}
#endif
return howto;
@ -525,6 +568,10 @@ coff_i386_reloc_type_lookup (abfd, code)
return howto_table + R_RELBYTE;
case BFD_RELOC_8_PCREL:
return howto_table + R_PCRBYTE;
#ifdef COFF_WITH_PE
case BFD_RELOC_32_SECREL:
return howto_table + R_SECREL32;
#endif
default:
BFD_FAIL ();
return 0;

View file

@ -16,7 +16,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "bfd.h"
#include "sysdep.h"

File diff suppressed because it is too large Load diff

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, 2002, 2003
2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Original version pieced together by Kim Knuttila (krk@cygnus.com)
@ -23,8 +23,8 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
Foundation, 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
/* Current State:
- objdump works
@ -127,11 +127,6 @@ struct ppc_coff_link_hash_table
static struct bfd_hash_entry *ppc_coff_link_hash_newfunc
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *,
const char *));
static bfd_boolean ppc_coff_link_hash_table_init
PARAMS ((struct ppc_coff_link_hash_table *, bfd *,
struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
struct bfd_hash_table *,
const char *)));
static struct bfd_link_hash_table *ppc_coff_link_hash_table_create
PARAMS ((bfd *));
static bfd_boolean coff_ppc_relocate_section
@ -184,14 +179,14 @@ ppc_coff_link_hash_newfunc (entry, table, string)
/* Initialize a PE linker hash table. */
static bfd_boolean
ppc_coff_link_hash_table_init (table, abfd, newfunc)
struct ppc_coff_link_hash_table *table;
bfd *abfd;
struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *,
struct bfd_hash_table *,
const char *));
ppc_coff_link_hash_table_init (struct ppc_coff_link_hash_table *table,
bfd *abfd,
struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *,
struct bfd_hash_table *,
const char *),
unsigned int entsize)
{
return _bfd_coff_link_hash_table_init (&table->root, abfd, newfunc);
return _bfd_coff_link_hash_table_init (&table->root, abfd, newfunc, entsize);
}
/* Create a PE linker hash table. */
@ -206,8 +201,9 @@ ppc_coff_link_hash_table_create (abfd)
ret = (struct ppc_coff_link_hash_table *) bfd_malloc (amt);
if (ret == NULL)
return NULL;
if (! ppc_coff_link_hash_table_init (ret, abfd,
ppc_coff_link_hash_newfunc))
if (!ppc_coff_link_hash_table_init (ret, abfd,
ppc_coff_link_hash_newfunc,
sizeof (struct ppc_coff_link_hash_entry)))
{
free (ret);
return (struct bfd_link_hash_table *) NULL;
@ -326,15 +322,6 @@ static bfd_reloc_status_type ppc_refhi_reloc PARAMS ((bfd *abfd,
asection *section,
bfd *output_bfd,
char **error));
#if 0
static bfd_reloc_status_type ppc_reflo_reloc PARAMS ((bfd *abfd,
arelent *reloc,
asymbol *symbol,
PTR data,
asection *section,
bfd *output_bfd,
char **error));
#endif
static bfd_reloc_status_type ppc_pair_reloc PARAMS ((bfd *abfd,
arelent *reloc,
asymbol *symbol,
@ -351,15 +338,6 @@ static bfd_reloc_status_type ppc_toc16_reloc PARAMS ((bfd *abfd,
bfd *output_bfd,
char **error));
#if 0
static bfd_reloc_status_type ppc_addr32nb_reloc PARAMS ((bfd *abfd,
arelent *reloc,
asymbol *symbol,
PTR data,
asection *section,
bfd *output_bfd,
char **error));
#endif
static bfd_reloc_status_type ppc_section_reloc PARAMS ((bfd *abfd,
arelent *reloc,
asymbol *symbol,
@ -1005,67 +983,6 @@ static bfd_boolean in_reloc_p(abfd, howto)
&& (howto->type != IMAGE_REL_PPC_TOCREL16_DEFN) ;
}
#if 0
/* This function is in charge of performing all the ppc PE relocations
Don't yet know if we want to do this this particular way ... (krk). */
/* FIXME: (it is not yet enabled). */
static bfd_reloc_status_type
pe_ppc_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
error_message)
bfd *abfd;
arelent *reloc_entry;
asymbol *symbol_in;
PTR data;
asection *input_section;
bfd *output_bfd;
char **error_message;
{
/* The consth relocation comes in two parts, we have to remember
the state between calls, in these variables. */
static bfd_boolean part1_consth_active = FALSE;
static unsigned long part1_consth_value;
unsigned long sym_value;
unsigned short r_type;
unsigned long addr = reloc_entry->address ; /*+ input_section->vma*/
r_type = reloc_entry->howto->type;
if (output_bfd)
{
/* Partial linking - do nothing. */
reloc_entry->address += input_section->output_offset;
return bfd_reloc_ok;
}
if (symbol_in != NULL
&& bfd_is_und_section (symbol_in->section))
{
/* Keep the state machine happy in case we're called again. */
if (r_type == IMAGE_REL_PPC_REFHI)
{
part1_consth_active = TRUE;
part1_consth_value = 0;
}
return(bfd_reloc_undefined);
}
if ((part1_consth_active) && (r_type != IMAGE_REL_PPC_PAIR))
{
part1_consth_active = FALSE;
*error_message = (char *) _("Missing PAIR");
return(bfd_reloc_dangerous);
}
sym_value = get_symbol_value(symbol_in);
return(bfd_reloc_ok);
}
#endif /* 0 */
/* The reloc processing routine for the optimized COFF linker. */
static bfd_boolean
@ -1188,8 +1105,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
{
default:
(*_bfd_error_handler)
(_("%s: unsupported relocation type 0x%02x"),
bfd_archive_filename (input_bfd), r_type);
(_("%B: unsupported relocation type 0x%02x"), input_bfd, r_type);
bfd_set_error (bfd_error_bad_value);
return FALSE;
case IMAGE_REL_PPC_TOCREL16:
@ -1278,8 +1194,8 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
if ((bfd_vma) our_toc_offset >= 65535)
{
(*_bfd_error_handler)
(_("%s: Relocation for %s of %lx exceeds Toc size limit"),
bfd_archive_filename (input_bfd), name,
(_("%B: Relocation for %s of %lx exceeds Toc size limit"),
input_bfd, name,
(unsigned long) our_toc_offset);
bfd_set_error (bfd_error_bad_value);
return FALSE;
@ -1330,12 +1246,11 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
/* FIXME: this test is conservative. */
if ((r_flags & IMAGE_REL_PPC_TOCDEFN) != IMAGE_REL_PPC_TOCDEFN
&& (bfd_vma) our_toc_offset > toc_section->_raw_size)
&& (bfd_vma) our_toc_offset > toc_section->size)
{
(*_bfd_error_handler)
(_("%s: Relocation exceeds allocated TOC (%lx)"),
bfd_archive_filename (input_bfd),
(unsigned long) toc_section->_raw_size);
(_("%B: Relocation exceeds allocated TOC (%lx)"),
input_bfd, (unsigned long) toc_section->size);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
@ -1387,15 +1302,12 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
else
my_name = h->root.root.root.string;
fprintf (stderr,
_("Warning: unsupported reloc %s <file %s, section %s>\n"),
howto->name,
bfd_archive_filename(input_bfd),
input_section->name);
fprintf (stderr,"sym %ld (%s), r_vaddr %ld (%lx)\n",
rel->r_symndx, my_name, (long) rel->r_vaddr,
(unsigned long) rel->r_vaddr);
(*_bfd_error_handler)
(_("Warning: unsupported reloc %s <file %B, section %A>\n"
"sym %ld (%s), r_vaddr %ld (%lx)"),
input_bfd, input_section, howto->name,
rel->r_symndx, my_name, (long) rel->r_vaddr,
(unsigned long) rel->r_vaddr);
}
break;
case IMAGE_REL_PPC_IMGLUE:
@ -1409,8 +1321,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
my_name = h->root.root.root.string;
(*_bfd_error_handler)
(_("%s: Out of order IMGLUE reloc for %s"),
bfd_archive_filename (input_bfd), my_name);
(_("%B: Out of order IMGLUE reloc for %s"), input_bfd, my_name);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
@ -1569,7 +1480,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
if (symndx == -1)
name = "*ABS*";
else if (h != NULL)
name = h->root.root.root.string;
name = NULL;
else if (sym == NULL)
name = "*unknown*";
else if (sym->_n._n_n._n_zeroes == 0
@ -1583,7 +1494,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
}
if (! ((*info->callbacks->reloc_overflow)
(info, name, howto->name,
(info, (h ? &h->root.root : NULL), name, howto->name,
(bfd_vma) 0, input_bfd,
input_section, rel->r_vaddr - input_section->vma)))
return FALSE;
@ -1690,7 +1601,7 @@ ppc_allocate_toc_section (info)
foo = (bfd_byte *) bfd_alloc (bfd_of_toc_owner, amt);
memset(foo, test_char, (size_t) global_toc_size);
s->_raw_size = s->_cooked_size = global_toc_size;
s->size = global_toc_size;
s->contents = foo;
return TRUE;
@ -1779,30 +1690,6 @@ ppc_refhi_reloc (abfd, reloc_entry, symbol, data,
return bfd_reloc_undefined;
}
#if 0
static bfd_reloc_status_type
ppc_reflo_reloc (abfd, reloc_entry, symbol, data,
input_section, output_bfd, error_message)
bfd *abfd;
arelent *reloc_entry;
asymbol *symbol;
PTR data;
asection *input_section;
bfd *output_bfd;
char **error_message;
{
UN_IMPL("REFLO");
DUMP_RELOC("REFLO",reloc_entry);
if (output_bfd == (bfd *) NULL)
return bfd_reloc_continue;
return bfd_reloc_undefined;
}
#endif
static bfd_reloc_status_type
ppc_pair_reloc (abfd, reloc_entry, symbol, data,
input_section, output_bfd, error_message)
@ -1843,31 +1730,6 @@ ppc_toc16_reloc (abfd, reloc_entry, symbol, data,
return bfd_reloc_ok;
}
#if 0
/* ADDR32NB : 32 bit address relative to the virtual origin.
(On the alpha, this is always a linker generated thunk)
(i.e. 32bit addr relative to the image base). */
static bfd_reloc_status_type
ppc_addr32nb_reloc (abfd, reloc_entry, symbol, data,
input_section, output_bfd, error_message)
bfd *abfd;
arelent *reloc_entry;
asymbol *symbol;
PTR data;
asection *input_section;
bfd *output_bfd;
char **error_message;
{
UN_IMPL("ADDR32NB");
DUMP_RELOC("ADDR32NB",reloc_entry);
return bfd_reloc_ok;
}
#endif
static bfd_reloc_status_type
ppc_secrel_reloc (abfd, reloc_entry, symbol, data,
input_section, output_bfd, error_message)
@ -2114,10 +1976,6 @@ ppc_coff_reloc_type_lookup (abfd, code)
#define coff_bfd_final_link ppc_bfd_coff_final_link
#ifndef COFF_IMAGE_WITH_PE
/* FIXME: This no longer works. */
#if 0
#define coff_swap_sym_in_hook ppc_coff_swap_sym_in_hook
#endif
#endif
#define SELECT_RELOC(internal, howto) {internal.r_type=howto->type;}
@ -2145,62 +2003,6 @@ ppc_coff_reloc_type_lookup (abfd, code)
#include "coffcode.h"
#ifndef COFF_IMAGE_WITH_PE
/* FIXME: This no longer works. */
#if 0
/* FIXME:
What we're trying to do here is allocate a toc section (early), and attach
it to the last bfd to be processed. This avoids the problem of having a toc
written out before all files have been processed. This code allocates
a toc section for every file, and records the last one seen. There are
at least two problems with this approach:
1. We allocate whole bunches of toc sections that are ignored, but at
at least we will not allocate a toc if no .toc is present.
2. It's not clear to me that being the last bfd read necessarily means
that you are the last bfd closed.
3. Doing it on a "swap in" hook depends on when the "swap in" is called,
and how often, etc. It's not clear to me that there isn't a hole here. */
static void ppc_coff_swap_sym_in_hook PARAMS ((bfd *, PTR, PTR));
static void
ppc_coff_swap_sym_in_hook (abfd, ext1, in1)
bfd *abfd;
PTR ext1 ATTRIBUTE_UNUSED;
PTR in1;
{
struct internal_syment * in = (struct internal_syment *)in1;
if (bfd_of_toc_owner != 0) /* We already have a toc, so go home. */
return;
if (strcmp (in->_n._n_name, ".toc") == 0)
{
flagword flags;
register asection *s;
s = bfd_get_section_by_name (abfd, TOC_SECTION_NAME);
if (s != NULL)
return;
flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY ;
s = bfd_make_section (abfd, TOC_SECTION_NAME);
if (s == NULL
|| !bfd_set_section_flags (abfd, s, flags)
|| !bfd_set_section_alignment (abfd, s, 2))
/* FIXME: set appropriate bfd error. */
abort ();
/* Save the bfd for later allocation. */
bfd_of_toc_owner = abfd;
}
return;
}
#endif
#endif
#ifndef COFF_IMAGE_WITH_PE
static bfd_boolean ppc_do_last PARAMS ((bfd *));
@ -2307,7 +2109,7 @@ ppc_bfd_coff_final_link (abfd, info)
o->reloc_count = 0;
o->lineno_count = 0;
for (p = o->link_order_head; p != NULL; p = p->next)
for (p = o->map_head.link_order; p != NULL; p = p->next)
{
if (p->type == bfd_indirect_link_order)
{
@ -2328,8 +2130,10 @@ ppc_bfd_coff_final_link (abfd, info)
if (info->relocatable)
o->reloc_count += sec->reloc_count;
if (sec->_raw_size > max_contents_size)
max_contents_size = sec->_raw_size;
if (sec->rawsize > max_contents_size)
max_contents_size = sec->rawsize;
if (sec->size > max_contents_size)
max_contents_size = sec->size;
if (sec->lineno_count > max_lineno_count)
max_lineno_count = sec->lineno_count;
if (sec->reloc_count > max_reloc_count)
@ -2487,7 +2291,7 @@ ppc_bfd_coff_final_link (abfd, info)
for (o = abfd->sections; o != NULL; o = o->next)
{
for (p = o->link_order_head; p != NULL; p = p->next)
for (p = o->map_head.link_order; p != NULL; p = p->next)
{
if (p->type == bfd_indirect_link_order
&& (bfd_get_flavour (p->u.indirect.section->owner)
@ -2663,7 +2467,7 @@ ppc_bfd_coff_final_link (abfd, info)
}
/* If we have optimized stabs strings, output them. */
if (coff_hash_table (info)->stab_info != NULL)
if (coff_hash_table (info)->stab_info.stabstr != NULL)
{
if (! _bfd_write_stab_strings (abfd, &coff_hash_table (info)->stab_info))
return FALSE;

View file

@ -1,5 +1,5 @@
/* BFD back-end for IBM RS/6000 "XCOFF" files.
Copyright 1990-1999, 2000, 2001, 2002, 2003
Copyright 1990-1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
FIXME: Can someone provide a transliteration of this name into ASCII?
Using the following chars caused a compiler warning on HIUX (so I replaced
@ -24,7 +24,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "bfd.h"
#include "sysdep.h"
@ -180,7 +180,7 @@ static bfd_boolean do_pad
static bfd_boolean do_copy
PARAMS ((bfd *, bfd *));
static bfd_boolean do_shared_object_padding
PARAMS ((bfd *, bfd *, ufile_ptr *, int));
PARAMS ((bfd *, bfd *, file_ptr *, int));
/* Relocation functions */
static bfd_boolean xcoff_reloc_type_br
@ -1294,10 +1294,12 @@ _bfd_xcoff_archive_p (abfd)
if (bfd_ardata (abfd) == (struct artdata *) NULL)
goto error_ret_restore;
bfd_ardata (abfd)->cache = NULL;
bfd_ardata (abfd)->archive_head = NULL;
bfd_ardata (abfd)->symdefs = NULL;
bfd_ardata (abfd)->extended_names = NULL;
/* Cleared by bfd_zalloc above.
bfd_ardata (abfd)->cache = NULL;
bfd_ardata (abfd)->archive_head = NULL;
bfd_ardata (abfd)->symdefs = NULL;
bfd_ardata (abfd)->extended_names = NULL;
bfd_ardata (abfd)->extended_names_size = 0; */
/* Now handle the two formats. */
if (magic[1] != 'b')
@ -1742,7 +1744,7 @@ static bfd_boolean
do_shared_object_padding (out_bfd, in_bfd, offset, ar_header_size)
bfd *out_bfd;
bfd *in_bfd;
ufile_ptr *offset;
file_ptr *offset;
int ar_header_size;
{
if (bfd_check_format (in_bfd, bfd_object)
@ -1779,7 +1781,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
const bfd_arch_info_type *arch_info = NULL;
bfd *current_bfd;
size_t string_length;
ufile_ptr nextoff, prevoff;
file_ptr nextoff, prevoff;
/* First, we look through the symbols and work out which are
from 32-bit objects and which from 64-bit ones. */
@ -1849,8 +1851,8 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
if (sym_32)
{
struct xcoff_ar_hdr_big *hdr;
bfd_byte *symbol_table;
bfd_byte *st;
char *symbol_table;
char *st;
file_ptr fileoff;
bfd_vma symbol_table_size =
@ -1860,8 +1862,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
+ 8 * sym_32
+ str_32 + (str_32 & 1);
symbol_table = NULL;
symbol_table = (bfd_byte *) bfd_zmalloc (symbol_table_size);
symbol_table = bfd_zmalloc (symbol_table_size);
if (symbol_table == NULL)
return FALSE;
@ -1941,7 +1942,6 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
bfd_bwrite (symbol_table, symbol_table_size, abfd);
free (symbol_table);
symbol_table = NULL;
prevoff = nextoff;
nextoff = nextoff + symbol_table_size;
@ -1952,8 +1952,8 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
if (sym_64)
{
struct xcoff_ar_hdr_big *hdr;
bfd_byte *symbol_table;
bfd_byte *st;
char *symbol_table;
char *st;
file_ptr fileoff;
bfd_vma symbol_table_size =
@ -1963,8 +1963,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
+ 8 * sym_64
+ str_64 + (str_64 & 1);
symbol_table = NULL;
symbol_table = (bfd_byte *) bfd_zmalloc (symbol_table_size);
symbol_table = bfd_zmalloc (symbol_table_size);
if (symbol_table == NULL)
return FALSE;
@ -2039,7 +2038,6 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
bfd_bwrite (symbol_table, symbol_table_size, abfd);
free (symbol_table);
symbol_table = NULL;
PRINT20 (fhdr->symoff64, nextoff);
}
@ -2076,7 +2074,7 @@ xcoff_write_archive_contents_old (abfd)
file_ptr *offsets;
bfd_boolean makemap;
bfd_boolean hasobjects;
ufile_ptr prevoff, nextoff;
file_ptr prevoff, nextoff;
bfd *sub;
size_t i;
struct xcoff_ar_hdr ahdr;
@ -2085,7 +2083,7 @@ xcoff_write_archive_contents_old (abfd)
char decbuf[XCOFFARMAG_ELEMENT_SIZE + 1];
memset (&fhdr, 0, sizeof fhdr);
strncpy (fhdr.magic, XCOFFARMAG, SXCOFFARMAG);
(void) strncpy (fhdr.magic, XCOFFARMAG, SXCOFFARMAG);
sprintf (fhdr.firstmemoff, "%d", SIZEOF_AR_FILE_HDR);
sprintf (fhdr.freeoff, "%d", 0);
@ -2306,12 +2304,12 @@ xcoff_write_archive_contents_big (abfd)
file_ptr *offsets;
bfd_boolean makemap;
bfd_boolean hasobjects;
ufile_ptr prevoff, nextoff;
file_ptr prevoff, nextoff;
bfd *current_bfd;
size_t i;
struct xcoff_ar_hdr_big *hdr, ahdr;
bfd_size_type size;
bfd_byte *member_table, *mt;
char *member_table, *mt;
bfd_vma member_table_size;
memset (&fhdr, 0, SIZEOF_AR_FILE_HDR_BIG);
@ -2476,8 +2474,7 @@ xcoff_write_archive_contents_big (abfd)
+ total_namlen);
member_table_size += member_table_size & 1;
member_table = NULL;
member_table = (bfd_byte *) bfd_zmalloc (member_table_size);
member_table = bfd_zmalloc (member_table_size);
if (member_table == NULL)
return FALSE;
@ -2530,7 +2527,6 @@ xcoff_write_archive_contents_big (abfd)
return FALSE;
free (member_table);
member_table = NULL;
PRINT20 (fhdr.memoff, nextoff);
@ -2948,8 +2944,7 @@ xcoff_reloc_type_br (input_bfd, input_section, output_bfd, rel, sym, howto,
cror. */
if (NULL != h
&& bfd_link_hash_defined == h->root.type
&& (rel->r_vaddr - input_section->vma + 8
<= input_section->_cooked_size))
&& rel->r_vaddr - input_section->vma + 8 <= input_section->size)
{
bfd_byte *pnext;
unsigned long next;
@ -3449,7 +3444,7 @@ xcoff_ppc_relocate_section (output_bfd, info, input_bfd,
address = rel->r_vaddr - input_section->vma;
location = contents + address;
if (address > input_section->_raw_size)
if (address > input_section->size)
abort ();
/* Get the value we are going to relocate. */
@ -3482,7 +3477,7 @@ xcoff_ppc_relocate_section (output_bfd, info, input_bfd,
}
else if (h != NULL)
{
name = h->root.root.string;
name = NULL;
}
else
{
@ -3493,8 +3488,9 @@ xcoff_ppc_relocate_section (output_bfd, info, input_bfd,
sprintf (reloc_type_name, "0x%02x", rel->r_type);
if (! ((*info->callbacks->reloc_overflow)
(info, name, reloc_type_name, (bfd_vma) 0, input_bfd,
input_section, rel->r_vaddr - input_section->vma)))
(info, (h ? &h->root : NULL), name, reloc_type_name,
(bfd_vma) 0, input_bfd, input_section,
rel->r_vaddr - input_section->vma)))
return FALSE;
}
@ -3530,7 +3526,7 @@ _bfd_xcoff_put_ldsymbol_name (abfd, ldinfo, ldsym, name)
if (ldinfo->string_size + len + 3 > ldinfo->string_alc)
{
bfd_size_type newalc;
bfd_byte *newstrings;
char *newstrings;
newalc = ldinfo->string_alc * 2;
if (newalc == 0)
@ -3538,8 +3534,7 @@ _bfd_xcoff_put_ldsymbol_name (abfd, ldinfo, ldsym, name)
while (ldinfo->string_size + len + 3 > newalc)
newalc *= 2;
newstrings = ((bfd_byte *)
bfd_realloc ((PTR) ldinfo->strings, newalc));
newstrings = bfd_realloc (ldinfo->strings, newalc);
if (newstrings == NULL)
{
ldinfo->failed = TRUE;
@ -3612,8 +3607,8 @@ xcoff_create_csect_from_smclas (abfd, aux, symbol_name)
else
{
(*_bfd_error_handler)
(_("%s: symbol `%s' has unrecognized smclas %d"),
bfd_archive_filename (abfd), symbol_name, aux->x_csect.x_smclas);
(_("%B: symbol `%s' has unrecognized smclas %d"),
abfd, symbol_name, aux->x_csect.x_smclas);
bfd_set_error (bfd_error_bad_value);
}
@ -4140,8 +4135,10 @@ const bfd_target rs6000coff_vec =
/* Copy */
_bfd_xcoff_copy_private_bfd_data,
((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
_bfd_generic_init_private_section_data,
((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
((bfd_boolean (*) (bfd *, flagword)) bfd_true),
((bfd_boolean (*) (bfd *, void * )) bfd_true),
@ -4169,8 +4166,11 @@ const bfd_target rs6000coff_vec =
coff_print_symbol,
coff_get_symbol_info,
_bfd_xcoff_is_local_label_name,
coff_bfd_is_target_special_symbol,
coff_get_lineno,
coff_find_nearest_line,
_bfd_generic_find_line,
coff_find_inliner_info,
coff_bfd_make_debug_symbol,
_bfd_generic_read_minisymbols,
_bfd_generic_minisymbol_to_symbol,
@ -4196,11 +4196,14 @@ const bfd_target rs6000coff_vec =
_bfd_generic_link_split_section,
bfd_generic_gc_sections,
bfd_generic_merge_sections,
bfd_generic_is_group_section,
bfd_generic_discard_group,
_bfd_generic_section_already_linked,
/* Dynamic */
_bfd_xcoff_get_dynamic_symtab_upper_bound,
_bfd_xcoff_canonicalize_dynamic_symtab,
_bfd_nodynamic_get_synthetic_symtab,
_bfd_xcoff_get_dynamic_reloc_upper_bound,
_bfd_xcoff_canonicalize_dynamic_reloc,
@ -4382,8 +4385,10 @@ const bfd_target pmac_xcoff_vec =
/* Copy */
_bfd_xcoff_copy_private_bfd_data,
((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
_bfd_generic_init_private_section_data,
((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
((bfd_boolean (*) (bfd *, flagword)) bfd_true),
((bfd_boolean (*) (bfd *, void * )) bfd_true),
@ -4411,8 +4416,11 @@ const bfd_target pmac_xcoff_vec =
coff_print_symbol,
coff_get_symbol_info,
_bfd_xcoff_is_local_label_name,
coff_bfd_is_target_special_symbol,
coff_get_lineno,
coff_find_nearest_line,
_bfd_generic_find_line,
coff_find_inliner_info,
coff_bfd_make_debug_symbol,
_bfd_generic_read_minisymbols,
_bfd_generic_minisymbol_to_symbol,
@ -4438,11 +4446,14 @@ const bfd_target pmac_xcoff_vec =
_bfd_generic_link_split_section,
bfd_generic_gc_sections,
bfd_generic_merge_sections,
bfd_generic_is_group_section,
bfd_generic_discard_group,
_bfd_generic_section_already_linked,
/* Dynamic */
_bfd_xcoff_get_dynamic_symtab_upper_bound,
_bfd_xcoff_canonicalize_dynamic_symtab,
_bfd_nodynamic_get_synthetic_symtab,
_bfd_xcoff_get_dynamic_reloc_upper_bound,
_bfd_xcoff_canonicalize_dynamic_reloc,

View file

@ -1,6 +1,6 @@
/* BFD back-end for Sparc COFF files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001,
2002, 2003 Free Software Foundation, Inc.
2002, 2003, 2005 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@ -17,7 +17,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "bfd.h"
#include "sysdep.h"
@ -56,25 +56,6 @@ enum reloc_type
R_SPARC_max
};
#if 0
static const char *const reloc_type_names[] =
{
"R_SPARC_NONE",
"R_SPARC_8", "R_SPARC_16", "R_SPARC_32",
"R_SPARC_DISP8", "R_SPARC_DISP16", "R_SPARC_DISP32",
"R_SPARC_WDISP30", "R_SPARC_WDISP22",
"R_SPARC_HI22", "R_SPARC_22",
"R_SPARC_13", "R_SPARC_LO10",
"R_SPARC_GOT10", "R_SPARC_GOT13", "R_SPARC_GOT22",
"R_SPARC_PC10", "R_SPARC_PC22",
"R_SPARC_WPLT30",
"R_SPARC_COPY",
"R_SPARC_GLOB_DAT", "R_SPARC_JMP_SLOT",
"R_SPARC_RELATIVE",
"R_SPARC_UA32",
};
#endif
/* This is stolen pretty directly from elf.c. */
static bfd_reloc_status_type
bfd_coff_generic_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR,

View file

@ -1,5 +1,5 @@
/* BFD back-end for IBM RS/6000 "XCOFF64" files.
Copyright 2000, 2001, 2002, 2003
Copyright 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Written Clinton Popetz.
Contributed by Cygnus Support.
@ -18,7 +18,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "bfd.h"
#include "sysdep.h"
@ -564,7 +564,7 @@ _bfd_xcoff64_put_ldsymbol_name (abfd, ldinfo, ldsym, name)
if (ldinfo->string_size + len + 3 > ldinfo->string_alc)
{
bfd_size_type newalc;
bfd_byte *newstrings;
char *newstrings;
newalc = ldinfo->string_alc * 2;
if (newalc == 0)
@ -572,8 +572,7 @@ _bfd_xcoff64_put_ldsymbol_name (abfd, ldinfo, ldsym, name)
while (ldinfo->string_size + len + 3 > newalc)
newalc *= 2;
newstrings = ((bfd_byte *)
bfd_realloc ((PTR) ldinfo->strings, newalc));
newstrings = bfd_realloc (ldinfo->strings, newalc);
if (newstrings == NULL)
{
ldinfo->failed = TRUE;
@ -845,11 +844,11 @@ xcoff64_write_object_contents (abfd)
section.s_vaddr = current->vma;
section.s_paddr = current->lma;
section.s_size = current->_raw_size;
section.s_size = current->size;
/* If this section has no size or is unloadable then the scnptr
will be 0 too. */
if (current->_raw_size == 0
if (current->size == 0
|| (current->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0)
{
section.s_scnptr = 0;
@ -965,19 +964,19 @@ xcoff64_write_object_contents (abfd)
if (text_sec)
{
internal_a.tsize = bfd_get_section_size_before_reloc (text_sec);
internal_a.tsize = text_sec->size;
internal_a.text_start = internal_a.tsize ? text_sec->vma : 0;
}
if (data_sec)
{
internal_a.dsize = bfd_get_section_size_before_reloc (data_sec);
internal_a.dsize = data_sec->size;
internal_a.data_start = internal_a.dsize ? data_sec->vma : 0;
}
if (bss_sec)
{
internal_a.bsize = bfd_get_section_size_before_reloc (bss_sec);
internal_a.bsize = bss_sec->size;
if (internal_a.bsize && bss_sec->vma < internal_a.data_start)
internal_a.data_start = bss_sec->vma;
}
@ -1127,8 +1126,7 @@ xcoff64_reloc_type_br (input_bfd, input_section, output_bfd, rel, sym, howto,
cror. */
if (NULL != h
&& bfd_link_hash_defined == h->root.type
&& (rel->r_vaddr - input_section->vma + 8
<= input_section->_cooked_size))
&& rel->r_vaddr - input_section->vma + 8 <= input_section->size)
{
bfd_byte *pnext;
unsigned long next;
@ -1301,7 +1299,7 @@ xcoff64_ppc_relocate_section (output_bfd, info, input_bfd,
address = rel->r_vaddr - input_section->vma;
location = contents + address;
if (address > input_section->_raw_size)
if (address > input_section->size)
abort ();
/* Get the value we are going to relocate. */
@ -1336,7 +1334,7 @@ xcoff64_ppc_relocate_section (output_bfd, info, input_bfd,
}
else if (h != NULL)
{
name = h->root.root.string;
name = NULL;
}
else
{
@ -1347,8 +1345,9 @@ xcoff64_ppc_relocate_section (output_bfd, info, input_bfd,
sprintf (reloc_type_name, "0x%02x", rel->r_type);
if (! ((*info->callbacks->reloc_overflow)
(info, name, reloc_type_name, (bfd_vma) 0, input_bfd,
input_section, rel->r_vaddr - input_section->vma)))
(info, (h ? &h->root : NULL), name, reloc_type_name,
(bfd_vma) 0, input_bfd, input_section,
rel->r_vaddr - input_section->vma)))
return FALSE;
}
@ -1984,10 +1983,12 @@ xcoff64_archive_p (abfd)
if (bfd_ardata (abfd) == (struct artdata *) NULL)
goto error_ret_restore;
bfd_ardata (abfd)->cache = NULL;
bfd_ardata (abfd)->archive_head = NULL;
bfd_ardata (abfd)->symdefs = NULL;
bfd_ardata (abfd)->extended_names = NULL;
/* Already cleared by bfd_zalloc above.
bfd_ardata (abfd)->cache = NULL;
bfd_ardata (abfd)->archive_head = NULL;
bfd_ardata (abfd)->symdefs = NULL;
bfd_ardata (abfd)->extended_names = NULL;
bfd_ardata (abfd)->extended_names_size = 0; */
bfd_ardata (abfd)->first_file_filepos = bfd_scan_vma (hdr.firstmemoff,
(const char **) NULL,
10);
@ -2105,8 +2106,8 @@ xcoff64_create_csect_from_smclas (abfd, aux, symbol_name)
else
{
(*_bfd_error_handler)
(_("%s: symbol `%s' has unrecognized smclas %d"),
bfd_archive_filename (abfd), symbol_name, aux->x_csect.x_smclas);
(_("%B: symbol `%s' has unrecognized smclas %d"),
abfd, symbol_name, aux->x_csect.x_smclas);
bfd_set_error (bfd_error_bad_value);
}
@ -2681,8 +2682,10 @@ const bfd_target rs6000coff64_vec =
/* Copy */
_bfd_xcoff_copy_private_bfd_data,
((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
_bfd_generic_init_private_section_data,
((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
((bfd_boolean (*) (bfd *, flagword)) bfd_true),
((bfd_boolean (*) (bfd *, void * )) bfd_true),
@ -2710,8 +2713,11 @@ const bfd_target rs6000coff64_vec =
coff_print_symbol,
coff_get_symbol_info,
_bfd_xcoff_is_local_label_name,
coff_bfd_is_target_special_symbol,
coff_get_lineno,
coff_find_nearest_line,
_bfd_generic_find_line,
coff_find_inliner_info,
coff_bfd_make_debug_symbol,
_bfd_generic_read_minisymbols,
_bfd_generic_minisymbol_to_symbol,
@ -2737,11 +2743,14 @@ const bfd_target rs6000coff64_vec =
_bfd_generic_link_split_section,
bfd_generic_gc_sections,
bfd_generic_merge_sections,
bfd_generic_is_group_section,
bfd_generic_discard_group,
_bfd_generic_section_already_linked,
/* Dynamic */
_bfd_xcoff_get_dynamic_symtab_upper_bound,
_bfd_xcoff_canonicalize_dynamic_symtab,
_bfd_nodynamic_get_synthetic_symtab,
_bfd_xcoff_get_dynamic_reloc_upper_bound,
_bfd_xcoff_canonicalize_dynamic_reloc,
@ -2924,8 +2933,10 @@ const bfd_target aix5coff64_vec =
/* Copy */
_bfd_xcoff_copy_private_bfd_data,
((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
_bfd_generic_init_private_section_data,
((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
((bfd_boolean (*) (bfd *, flagword)) bfd_true),
((bfd_boolean (*) (bfd *, void * )) bfd_true),
@ -2953,8 +2964,11 @@ const bfd_target aix5coff64_vec =
coff_print_symbol,
coff_get_symbol_info,
_bfd_xcoff_is_local_label_name,
coff_bfd_is_target_special_symbol,
coff_get_lineno,
coff_find_nearest_line,
_bfd_generic_find_line,
coff_find_inliner_info,
coff_bfd_make_debug_symbol,
_bfd_generic_read_minisymbols,
_bfd_generic_minisymbol_to_symbol,
@ -2980,11 +2994,14 @@ const bfd_target aix5coff64_vec =
_bfd_generic_link_split_section,
bfd_generic_gc_sections,
bfd_generic_merge_sections,
bfd_generic_is_group_section,
bfd_generic_discard_group,
_bfd_generic_section_already_linked,
/* Dynamic */
_bfd_xcoff_get_dynamic_symtab_upper_bound,
_bfd_xcoff_canonicalize_dynamic_symtab,
_bfd_nodynamic_get_synthetic_symtab,
_bfd_xcoff_get_dynamic_reloc_upper_bound,
_bfd_xcoff_canonicalize_dynamic_reloc,

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
/* COFF specific linker code.
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2004, 2005, 2006 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* This file contains the COFF backend linker code. */
@ -94,10 +94,11 @@ _bfd_coff_link_hash_table_init (struct coff_link_hash_table *table,
bfd *abfd,
struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *,
struct bfd_hash_table *,
const char *))
const char *),
unsigned int entsize)
{
table->stab_info = NULL;
return _bfd_link_hash_table_init (&table->root, abfd, newfunc);
memset (&table->stab_info, 0, sizeof (table->stab_info));
return _bfd_link_hash_table_init (&table->root, abfd, newfunc, entsize);
}
/* Create a COFF linker hash table. */
@ -113,7 +114,8 @@ _bfd_coff_link_hash_table_create (bfd *abfd)
return NULL;
if (! _bfd_coff_link_hash_table_init (ret, abfd,
_bfd_coff_link_hash_newfunc))
_bfd_coff_link_hash_newfunc,
sizeof (struct coff_link_hash_entry)))
{
free (ret);
return (struct bfd_link_hash_table *) NULL;
@ -435,18 +437,19 @@ coff_link_add_symbols (bfd *abfd,
if (obj_pe (abfd)
&& (classification == COFF_SYMBOL_GLOBAL
|| classification == COFF_SYMBOL_PE_SECTION)
&& section->comdat != NULL
&& coff_section_data (abfd, section) != NULL
&& coff_section_data (abfd, section)->comdat != NULL
&& strncmp (name, "??_", 3) == 0
&& strcmp (name, section->comdat->name) == 0)
&& strcmp (name, coff_section_data (abfd, section)->comdat->name) == 0)
{
if (*sym_hash == NULL)
*sym_hash = coff_link_hash_lookup (coff_hash_table (info),
name, FALSE, copy, FALSE);
if (*sym_hash != NULL
&& (*sym_hash)->root.type == bfd_link_hash_defined
&& (*sym_hash)->root.u.def.section->comdat != NULL
&& strcmp ((*sym_hash)->root.u.def.section->comdat->name,
section->comdat->name) == 0)
&& coff_section_data (abfd, (*sym_hash)->root.u.def.section)->comdat != NULL
&& strcmp (coff_section_data (abfd, (*sym_hash)->root.u.def.section)->comdat->name,
coff_section_data (abfd, section)->comdat->name) == 0)
addit = FALSE;
}
@ -503,9 +506,8 @@ coff_link_add_symbols (bfd *abfd,
&& (BTYPE ((*sym_hash)->type) == T_NULL
|| BTYPE (sym.n_type) == T_NULL)))
(*_bfd_error_handler)
(_("Warning: type of symbol `%s' changed from %d to %d in %s"),
name, (*sym_hash)->type, sym.n_type,
bfd_archive_filename (abfd));
(_("Warning: type of symbol `%s' changed from %d to %d in %B"),
abfd, name, (*sym_hash)->type, sym.n_type);
/* We don't want to change from a meaningful
base type to a null one, but if we know
@ -551,8 +553,8 @@ coff_link_add_symbols (bfd *abfd,
For example, it won't help objdump. This needs to be
done when we swap in the section header. */
BFD_ASSERT ((*sym_hash)->numaux == 1);
if (section->_raw_size == 0)
section->_raw_size = (*sym_hash)->aux[0].x_scn.x_scnlen;
if (section->size == 0)
section->size = (*sym_hash)->aux[0].x_scn.x_scnlen;
/* FIXME: We could test whether the section sizes
matches the size in the aux entry, but apparently
@ -693,7 +695,7 @@ _bfd_coff_final_link (bfd *abfd,
{
o->reloc_count = 0;
o->lineno_count = 0;
for (p = o->link_order_head; p != NULL; p = p->next)
for (p = o->map_head.link_order; p != NULL; p = p->next)
{
if (p->type == bfd_indirect_link_order)
{
@ -714,8 +716,10 @@ _bfd_coff_final_link (bfd *abfd,
if (info->relocatable)
o->reloc_count += sec->reloc_count;
if (sec->_raw_size > max_contents_size)
max_contents_size = sec->_raw_size;
if (sec->rawsize > max_contents_size)
max_contents_size = sec->rawsize;
if (sec->size > max_contents_size)
max_contents_size = sec->size;
if (sec->lineno_count > max_lineno_count)
max_lineno_count = sec->lineno_count;
if (sec->reloc_count > max_reloc_count)
@ -886,7 +890,7 @@ _bfd_coff_final_link (bfd *abfd,
for (o = abfd->sections; o != NULL; o = o->next)
{
for (p = o->link_order_head; p != NULL; p = p->next)
for (p = o->map_head.link_order; p != NULL; p = p->next)
{
if (p->type == bfd_indirect_link_order
&& bfd_family_coff (p->u.indirect.section->owner))
@ -1080,7 +1084,7 @@ _bfd_coff_final_link (bfd *abfd,
}
/* If we have optimized stabs strings, output them. */
if (coff_hash_table (info)->stab_info != NULL)
if (coff_hash_table (info)->stab_info.stabstr != NULL)
{
if (! _bfd_write_stab_strings (abfd, &coff_hash_table (info)->stab_info))
return FALSE;
@ -1208,30 +1212,27 @@ process_embedded_commands (bfd *output_bfd,
asection *sec = bfd_get_section_by_name (abfd, ".drectve");
char *s;
char *e;
char *copy;
bfd_byte *copy;
if (!sec)
return 1;
copy = bfd_malloc (sec->_raw_size);
if (!copy)
return 0;
if (! bfd_get_section_contents (abfd, sec, copy, (bfd_vma) 0, sec->_raw_size))
if (!bfd_malloc_and_get_section (abfd, sec, &copy))
{
free (copy);
if (copy != NULL)
free (copy);
return 0;
}
e = copy + sec->_raw_size;
e = (char *) copy + sec->size;
for (s = copy; s < e ; )
for (s = (char *) copy; s < e ; )
{
if (s[0]!= '-')
if (s[0] != '-')
{
s++;
continue;
}
if (strncmp (s,"-attr", 5) == 0)
if (strncmp (s, "-attr", 5) == 0)
{
char *name;
char *attribs;
@ -1346,9 +1347,6 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *finfo, bfd *input_bfd)
{
unsigned int n_tmask = coff_data (input_bfd)->local_n_tmask;
unsigned int n_btshft = coff_data (input_bfd)->local_n_btshft;
#if 0
unsigned int n_btmask = coff_data (input_bfd)->local_n_btmask;
#endif
bfd_boolean (*adjust_symndx)
(bfd *, struct bfd_link_info *, bfd *, asection *,
struct internal_reloc *, bfd_boolean *);
@ -1977,7 +1975,8 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *finfo, bfd *input_bfd)
auxp->x_file.x_n.x_offset = STRING_SIZE_SIZE + indx;
}
}
else if (isymp->n_sclass != C_STAT || isymp->n_type != T_NULL)
else if ((isymp->n_sclass != C_STAT || isymp->n_type != T_NULL)
&& isymp->n_sclass != C_NT_WEAK)
{
unsigned long indx;
@ -2283,16 +2282,18 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *finfo, bfd *input_bfd)
/* This section was omitted from the link. */
continue;
if ((o->flags & SEC_LINKER_CREATED) != 0)
continue;
if ((o->flags & SEC_HAS_CONTENTS) == 0
|| (o->_raw_size == 0 && (o->flags & SEC_RELOC) == 0))
|| (o->size == 0 && (o->flags & SEC_RELOC) == 0))
{
if ((o->flags & SEC_RELOC) != 0
&& o->reloc_count != 0)
{
((*_bfd_error_handler)
(_("%s: relocs in section `%s', but it has no contents"),
bfd_archive_filename (input_bfd),
bfd_get_section_name (input_bfd, o)));
(*_bfd_error_handler)
(_("%B: relocs in section `%A', but it has no contents"),
input_bfd, o);
bfd_set_error (bfd_error_no_contents);
return FALSE;
}
@ -2305,8 +2306,8 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *finfo, bfd *input_bfd)
contents = secdata->contents;
else
{
if (! bfd_get_section_contents (input_bfd, o, finfo->contents,
(file_ptr) 0, o->_raw_size))
bfd_size_type x = o->rawsize ? o->rawsize : o->size;
if (! bfd_get_section_contents (input_bfd, o, finfo->contents, 0, x))
return FALSE;
contents = finfo->contents;
}
@ -2431,10 +2432,8 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *finfo, bfd *input_bfd)
if (secdata == NULL || secdata->stab_info == NULL)
{
file_ptr loc = o->output_offset * bfd_octets_per_byte (output_bfd);
bfd_size_type amt = (o->_cooked_size != 0
? o->_cooked_size : o->_raw_size);
if (! bfd_set_section_contents (output_bfd, o->output_section,
contents, loc, amt))
contents, loc, o->size))
return FALSE;
}
else
@ -2616,9 +2615,7 @@ _bfd_coff_write_global_sym (struct coff_link_hash_entry *h, void *data)
sec = h->root.u.def.section->output_section;
if (sec != NULL)
{
auxp->x_scn.x_scnlen = (sec->_cooked_size != 0
? sec->_cooked_size
: sec->_raw_size);
auxp->x_scn.x_scnlen = sec->size;
/* For PE, an overflow on the final link reportedly does
not matter. FIXME: Why not? */
@ -2738,7 +2735,7 @@ _bfd_coff_reloc_link_order (bfd *output_bfd,
abort ();
case bfd_reloc_overflow:
if (! ((*finfo->info->callbacks->reloc_overflow)
(finfo->info,
(finfo->info, NULL,
(link_order->type == bfd_section_reloc_link_order
? bfd_section_name (output_bfd,
link_order->u.reloc.p->u.section)
@ -2863,8 +2860,7 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd,
|| (unsigned long) symndx >= obj_raw_syment_count (input_bfd))
{
(*_bfd_error_handler)
("%s: illegal symbol index %ld in relocs",
bfd_archive_filename (input_bfd), symndx);
("%B: illegal symbol index %ld in relocs", input_bfd, symndx);
return FALSE;
}
else
@ -2925,16 +2921,50 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd,
if (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
{
/* Defined weak symbols are a GNU extension. */
asection *sec;
sec = h->root.u.def.section;
val = (h->root.u.def.value
+ sec->output_section->vma
+ sec->output_offset);
}
}
else if (h->root.type == bfd_link_hash_undefweak)
val = 0;
{
if (h->class == C_NT_WEAK && h->numaux == 1)
{
/* See _Microsoft Portable Executable and Common Object
File Format Specification_, section 5.5.3.
Note that weak symbols without aux records are a GNU
extension.
FIXME: All weak externals are treated as having
characteristic IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY (1).
These behave as per SVR4 ABI: A library member
will resolve a weak external only if a normal
external causes the library member to be linked.
See also linker.c: generic_link_check_archive_element. */
asection *sec;
struct coff_link_hash_entry *h2 =
input_bfd->tdata.coff_obj_data->sym_hashes[
h->aux->x_sym.x_tagndx.l];
if (!h2 || h2->root.type == bfd_link_hash_undefined)
{
sec = bfd_abs_section_ptr;
val = 0;
}
else
{
sec = h2->root.u.def.section;
val = h2->root.u.def.value
+ sec->output_section->vma + sec->output_offset;
}
}
else
/* This is a GNU extension. */
val = 0;
}
else if (! info->relocatable)
{
@ -2984,10 +3014,8 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd,
break;
case bfd_reloc_outofrange:
(*_bfd_error_handler)
(_("%s: bad reloc address 0x%lx in section `%s'"),
bfd_archive_filename (input_bfd),
(unsigned long) rel->r_vaddr,
bfd_get_section_name (input_bfd, input_section));
(_("%B: bad reloc address 0x%lx in section `%A'"),
input_bfd, input_section, (unsigned long) rel->r_vaddr);
return FALSE;
case bfd_reloc_overflow:
{
@ -2997,7 +3025,7 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd,
if (symndx == -1)
name = "*ABS*";
else if (h != NULL)
name = h->root.root.string;
name = NULL;
else
{
name = _bfd_coff_internal_syment_name (input_bfd, sym, buf);
@ -3006,8 +3034,9 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd,
}
if (! ((*info->callbacks->reloc_overflow)
(info, name, howto->name, (bfd_vma) 0, input_bfd,
input_section, rel->r_vaddr - input_section->vma)))
(info, (h ? &h->root : NULL), name, howto->name,
(bfd_vma) 0, input_bfd, input_section,
rel->r_vaddr - input_section->vma)))
return FALSE;
}
}

View file

@ -1,6 +1,6 @@
/* Generic COFF swapping routines, for BFD.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000,
2001, 2002
2001, 2002, 2005
Free Software Foundation, Inc.
Written by Cygnus Support.
@ -18,7 +18,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* This file contains routines used to swap COFF data. It is a header
file because the details of swapping depend on the details of the
@ -210,41 +210,17 @@
#define PUT_RELOC_VADDR H_PUT_32
#endif
static void coff_swap_aouthdr_in PARAMS ((bfd *, PTR, PTR));
static unsigned int coff_swap_aouthdr_out PARAMS ((bfd *, PTR, PTR));
static void coff_swap_scnhdr_in PARAMS ((bfd *, PTR, PTR));
static unsigned int coff_swap_scnhdr_out PARAMS ((bfd *, PTR, PTR));
static void coff_swap_filehdr_in PARAMS ((bfd *, PTR, PTR));
static unsigned int coff_swap_filehdr_out PARAMS ((bfd *, PTR, PTR));
#ifndef NO_COFF_RELOCS
static void coff_swap_reloc_in PARAMS ((bfd *, PTR, PTR));
static unsigned int coff_swap_reloc_out PARAMS ((bfd *, PTR, PTR));
#endif /* NO_COFF_RELOCS */
#ifndef NO_COFF_SYMBOLS
static void coff_swap_sym_in PARAMS ((bfd *, PTR, PTR));
static unsigned int coff_swap_sym_out PARAMS ((bfd *, PTR, PTR));
static void coff_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR));
static unsigned int coff_swap_aux_out PARAMS ((bfd *, PTR, int, int, int, int, PTR));
#endif /* NO_COFF_SYMBOLS */
#ifndef NO_COFF_LINENOS
static void coff_swap_lineno_in PARAMS ((bfd *, PTR, PTR));
static unsigned int coff_swap_lineno_out PARAMS ((bfd *, PTR, PTR));
#endif /* NO_COFF_LINENOS */
#ifndef NO_COFF_RELOCS
static void
coff_swap_reloc_in (abfd, src, dst)
bfd *abfd;
PTR src;
PTR dst;
coff_swap_reloc_in (bfd * abfd, void * src, void * dst)
{
RELOC *reloc_src = (RELOC *) src;
struct internal_reloc *reloc_dst = (struct internal_reloc *) dst;
reloc_dst->r_vaddr = GET_RELOC_VADDR (abfd, reloc_src->r_vaddr);
reloc_dst->r_vaddr = GET_RELOC_VADDR (abfd, reloc_src->r_vaddr);
reloc_dst->r_symndx = H_GET_S32 (abfd, reloc_src->r_symndx);
reloc_dst->r_type = H_GET_16 (abfd, reloc_src->r_type);
reloc_dst->r_type = H_GET_16 (abfd, reloc_src->r_type);
#ifdef SWAP_IN_RELOC_OFFSET
reloc_dst->r_offset = SWAP_IN_RELOC_OFFSET (abfd, reloc_src->r_offset);
@ -252,13 +228,11 @@ coff_swap_reloc_in (abfd, src, dst)
}
static unsigned int
coff_swap_reloc_out (abfd, src, dst)
bfd *abfd;
PTR src;
PTR dst;
coff_swap_reloc_out (bfd * abfd, void * src, void * dst)
{
struct internal_reloc *reloc_src = (struct internal_reloc *) src;
struct external_reloc *reloc_dst = (struct external_reloc *) dst;
PUT_RELOC_VADDR (abfd, reloc_src->r_vaddr, reloc_dst->r_vaddr);
H_PUT_32 (abfd, reloc_src->r_symndx, reloc_dst->r_symndx);
H_PUT_16 (abfd, reloc_src->r_type, reloc_dst->r_type);
@ -276,10 +250,7 @@ coff_swap_reloc_out (abfd, src, dst)
#endif /* NO_COFF_RELOCS */
static void
coff_swap_filehdr_in (abfd, src, dst)
bfd *abfd;
PTR src;
PTR dst;
coff_swap_filehdr_in (bfd * abfd, void * src, void * dst)
{
FILHDR *filehdr_src = (FILHDR *) src;
struct internal_filehdr *filehdr_dst = (struct internal_filehdr *) dst;
@ -287,13 +258,13 @@ coff_swap_filehdr_in (abfd, src, dst)
#ifdef COFF_ADJUST_FILEHDR_IN_PRE
COFF_ADJUST_FILEHDR_IN_PRE (abfd, src, dst);
#endif
filehdr_dst->f_magic = H_GET_16 (abfd, filehdr_src->f_magic);
filehdr_dst->f_nscns = H_GET_16 (abfd, filehdr_src->f_nscns);
filehdr_dst->f_magic = H_GET_16 (abfd, filehdr_src->f_magic);
filehdr_dst->f_nscns = H_GET_16 (abfd, filehdr_src->f_nscns);
filehdr_dst->f_timdat = H_GET_32 (abfd, filehdr_src->f_timdat);
filehdr_dst->f_symptr = GET_FILEHDR_SYMPTR (abfd, filehdr_src->f_symptr);
filehdr_dst->f_nsyms = H_GET_32 (abfd, filehdr_src->f_nsyms);
filehdr_dst->f_nsyms = H_GET_32 (abfd, filehdr_src->f_nsyms);
filehdr_dst->f_opthdr = H_GET_16 (abfd, filehdr_src->f_opthdr);
filehdr_dst->f_flags = H_GET_16 (abfd, filehdr_src->f_flags);
filehdr_dst->f_flags = H_GET_16 (abfd, filehdr_src->f_flags);
#ifdef TIC80_TARGET_ID
filehdr_dst->f_target_id = H_GET_16 (abfd, filehdr_src->f_target_id);
#endif
@ -304,10 +275,7 @@ coff_swap_filehdr_in (abfd, src, dst)
}
static unsigned int
coff_swap_filehdr_out (abfd, in, out)
bfd *abfd;
PTR in;
PTR out;
coff_swap_filehdr_out (bfd *abfd, void * in, void * out)
{
struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in;
FILHDR *filehdr_out = (FILHDR *) out;
@ -335,10 +303,7 @@ coff_swap_filehdr_out (abfd, in, out)
#ifndef NO_COFF_SYMBOLS
static void
coff_swap_sym_in (abfd, ext1, in1)
bfd *abfd;
PTR ext1;
PTR in1;
coff_swap_sym_in (bfd * abfd, void * ext1, void * in1)
{
SYMENT *ext = (SYMENT *) ext1;
struct internal_syment *in = (struct internal_syment *) in1;
@ -351,21 +316,18 @@ coff_swap_sym_in (abfd, ext1, in1)
else
{
#if SYMNMLEN != E_SYMNMLEN
-> Error, we need to cope with truncating or extending SYMNMLEN!;
#error we need to cope with truncating or extending SYMNMLEN
#else
memcpy (in->_n._n_name, ext->e.e_name, SYMNMLEN);
#endif
}
in->n_value = H_GET_32 (abfd, ext->e_value);
in->n_scnum = H_GET_16 (abfd, ext->e_scnum);
if (sizeof (ext->e_type) == 2)
{
in->n_type = H_GET_16 (abfd, ext->e_type);
}
in->n_type = H_GET_16 (abfd, ext->e_type);
else
{
in->n_type = H_GET_32 (abfd, ext->e_type);
}
in->n_type = H_GET_32 (abfd, ext->e_type);
in->n_sclass = H_GET_8 (abfd, ext->e_sclass);
in->n_numaux = H_GET_8 (abfd, ext->e_numaux);
#ifdef COFF_ADJUST_SYM_IN_POST
@ -374,10 +336,7 @@ coff_swap_sym_in (abfd, ext1, in1)
}
static unsigned int
coff_swap_sym_out (abfd, inp, extp)
bfd *abfd;
PTR inp;
PTR extp;
coff_swap_sym_out (bfd * abfd, void * inp, void * extp)
{
struct internal_syment *in = (struct internal_syment *) inp;
SYMENT *ext =(SYMENT *) extp;
@ -394,7 +353,7 @@ coff_swap_sym_out (abfd, inp, extp)
else
{
#if SYMNMLEN != E_SYMNMLEN
-> Error, we need to cope with truncating or extending SYMNMLEN!;
#error we need to cope with truncating or extending SYMNMLEN
#else
memcpy (ext->e.e_name, in->_n._n_name, SYMNMLEN);
#endif
@ -404,13 +363,9 @@ coff_swap_sym_out (abfd, inp, extp)
H_PUT_16 (abfd, in->n_scnum, ext->e_scnum);
if (sizeof (ext->e_type) == 2)
{
H_PUT_16 (abfd, in->n_type, ext->e_type);
}
H_PUT_16 (abfd, in->n_type, ext->e_type);
else
{
H_PUT_32 (abfd, in->n_type, ext->e_type);
}
H_PUT_32 (abfd, in->n_type, ext->e_type);
H_PUT_8 (abfd, in->n_sclass, ext->e_sclass);
H_PUT_8 (abfd, in->n_numaux, ext->e_numaux);
@ -423,14 +378,13 @@ coff_swap_sym_out (abfd, inp, extp)
}
static void
coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
bfd *abfd;
PTR ext1;
int type;
int class;
int indx;
int numaux;
PTR in1;
coff_swap_aux_in (bfd *abfd,
void * ext1,
int type,
int class,
int indx,
int numaux,
void * in1)
{
AUXENT *ext = (AUXENT *) ext1;
union internal_auxent *in = (union internal_auxent *) in1;
@ -450,7 +404,7 @@ coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
else
{
#if FILNMLEN != E_FILNMLEN
-> Error, we need to cope with truncating or extending FILNMLEN!;
#error we need to cope with truncating or extending FILNMLEN
#else
if (numaux > 1)
{
@ -512,9 +466,7 @@ coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
}
if (ISFCN (type))
{
in->x_sym.x_misc.x_fsize = H_GET_32 (abfd, ext->x_sym.x_misc.x_fsize);
}
in->x_sym.x_misc.x_fsize = H_GET_32 (abfd, ext->x_sym.x_misc.x_fsize);
else
{
in->x_sym.x_misc.x_lnsz.x_lnno = GET_LNSZ_LNNO (abfd, ext);
@ -529,23 +481,22 @@ coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
}
static unsigned int
coff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
bfd *abfd;
PTR inp;
int type;
int class;
int indx ATTRIBUTE_UNUSED;
int numaux ATTRIBUTE_UNUSED;
PTR extp;
coff_swap_aux_out (bfd * abfd,
void * inp,
int type,
int class,
int indx ATTRIBUTE_UNUSED,
int numaux ATTRIBUTE_UNUSED,
void * extp)
{
union internal_auxent *in = (union internal_auxent *) inp;
union internal_auxent * in = (union internal_auxent *) inp;
AUXENT *ext = (AUXENT *) extp;
#ifdef COFF_ADJUST_AUX_OUT_PRE
COFF_ADJUST_AUX_OUT_PRE (abfd, inp, type, class, indx, numaux, extp);
#endif
memset ((PTR)ext, 0, AUXESZ);
memset (ext, 0, AUXESZ);
switch (class)
{
@ -558,7 +509,7 @@ coff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
else
{
#if FILNMLEN != E_FILNMLEN
-> Error, we need to cope with truncating or extending FILNMLEN!;
#error we need to cope with truncating or extending FILNMLEN
#else
memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
#endif
@ -625,10 +576,7 @@ coff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
#ifndef NO_COFF_LINENOS
static void
coff_swap_lineno_in (abfd, ext1, in1)
bfd *abfd;
PTR ext1;
PTR in1;
coff_swap_lineno_in (bfd * abfd, void * ext1, void * in1)
{
LINENO *ext = (LINENO *) ext1;
struct internal_lineno *in = (struct internal_lineno *) in1;
@ -638,10 +586,7 @@ coff_swap_lineno_in (abfd, ext1, in1)
}
static unsigned int
coff_swap_lineno_out (abfd, inp, outp)
bfd *abfd;
PTR inp;
PTR outp;
coff_swap_lineno_out (bfd * abfd, void * inp, void * outp)
{
struct internal_lineno *in = (struct internal_lineno *) inp;
struct external_lineno *ext = (struct external_lineno *) outp;
@ -654,10 +599,7 @@ coff_swap_lineno_out (abfd, inp, outp)
#endif /* NO_COFF_LINENOS */
static void
coff_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
bfd *abfd;
PTR aouthdr_ext1;
PTR aouthdr_int1;
coff_swap_aouthdr_in (bfd * abfd, void * aouthdr_ext1, void * aouthdr_int1)
{
AOUTHDR *aouthdr_ext;
struct internal_aouthdr *aouthdr_int;
@ -730,10 +672,7 @@ coff_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
}
static unsigned int
coff_swap_aouthdr_out (abfd, in, out)
bfd *abfd;
PTR in;
PTR out;
coff_swap_aouthdr_out (bfd * abfd, void * in, void * out)
{
struct internal_aouthdr *aouthdr_in = (struct internal_aouthdr *) in;
AOUTHDR *aouthdr_out = (AOUTHDR *) out;
@ -807,10 +746,7 @@ coff_swap_aouthdr_out (abfd, in, out)
}
static void
coff_swap_scnhdr_in (abfd, ext, in)
bfd *abfd;
PTR ext;
PTR in;
coff_swap_scnhdr_in (bfd * abfd, void * ext, void * in)
{
SCNHDR *scnhdr_ext = (SCNHDR *) ext;
struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
@ -839,10 +775,7 @@ coff_swap_scnhdr_in (abfd, ext, in)
}
static unsigned int
coff_swap_scnhdr_out (abfd, in, out)
bfd *abfd;
PTR in;
PTR out;
coff_swap_scnhdr_out (bfd * abfd, void * in, void * out)
{
struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
SCNHDR *scnhdr_ext = (SCNHDR *) out;

View file

@ -31,8 +31,13 @@ targ_underscore=no
# Catch obsolete configurations.
case $targ in
vax-*-vms* \
)
m68*-apple-aux* | \
m68*-apollo-* | \
m68*-bull-sysv* | \
m68*-*-rtemscoff* | \
i960-*-rtems* | \
or32-*-rtems* | \
null)
if test "x$enable_obsolete" != xyes; then
echo "*** Configuration $targ is obsolete." >&2
echo "*** Specify --enable-obsolete to build it anyway." >&2
@ -42,40 +47,64 @@ case $targ in
fi;;
esac
case $targ in
m68*-*-lynxos* | \
sparc-*-lynxos* | \
vax-*-vms* | \
arm-*-oabi | \
thumb-*-oabi | \
a29k-* | \
hppa*-*-rtems* | \
*-go32-rtems* | \
i[3-7]86*-*-rtemscoff* | \
mips*el-*-rtems* | \
powerpcle-*-rtems* | \
sparc*-*-rtemsaout* | \
null)
echo "*** Configuration $targ is obsolete." >&2
echo "*** Support has been REMOVED." >&2
exit 1
;;
esac
targ_cpu=`echo $targ | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
case "${targ_cpu}" in
alpha*) targ_archs=bfd_alpha_arch ;;
arm*) targ_archs=bfd_arm_arch ;;
c30*) targ_archs=bfd_tic30_arch ;;
c4x*) targ_archs=bfd_tic4x_arch ;;
c54x*) targ_archs=bfd_tic54x_arch ;;
alpha*) targ_archs=bfd_alpha_arch ;;
arm*) targ_archs=bfd_arm_arch ;;
bfin*) targ_archs=bfd_bfin_arch ;;
c30*) targ_archs=bfd_tic30_arch ;;
c4x*) targ_archs=bfd_tic4x_arch ;;
c54x*) targ_archs=bfd_tic54x_arch ;;
crisv32) targ_archs=bfd_cris_arch ;;
crx*) targ_archs=bfd_crx_arch ;;
dlx*) targ_archs=bfd_dlx_arch ;;
hppa*) targ_archs=bfd_hppa_arch ;;
i[3-7]86) targ_archs=bfd_i386_arch ;;
i370) targ_archs=bfd_i370_arch ;;
hppa*) targ_archs=bfd_hppa_arch ;;
i[3-7]86) targ_archs=bfd_i386_arch ;;
i370) targ_archs=bfd_i370_arch ;;
m6811*|m68hc11*) targ_archs="bfd_m68hc11_arch bfd_m68hc12_arch" ;;
m6812*|m68hc12*) targ_archs="bfd_m68hc12_arch bfd_m68hc11_arch" ;;
m68*) targ_archs=bfd_m68k_arch ;;
m88*) targ_archs=bfd_m88k_arch ;;
mips*) targ_archs=bfd_mips_arch ;;
m68*) targ_archs=bfd_m68k_arch ;;
m88*) targ_archs=bfd_m88k_arch ;;
maxq*) targ_archs=bfd_maxq_arch ;;
mips*) targ_archs=bfd_mips_arch ;;
or32*) targ_archs=bfd_or32_arch ;;
pdp11*) targ_archs=bfd_pdp11_arch ;;
pj*) targ_archs="bfd_pj_arch bfd_i386_arch";;
powerpc*) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
rs6000) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
s390*) targ_archs=bfd_s390_arch ;;
sh*) targ_archs=bfd_sh_arch ;;
sparc*) targ_archs=bfd_sparc_arch ;;
strongarm*) targ_archs=bfd_arm_arch ;;
thumb*) targ_archs=bfd_arm_arch ;;
v850*) targ_archs=bfd_v850_arch ;;
x86_64) targ_archs=bfd_i386_arch ;;
xscale*) targ_archs=bfd_arm_arch ;;
xtensa*) targ_archs=bfd_xtensa_arch ;;
z8k*) targ_archs=bfd_z8k_arch ;;
am33_2.0) targ_archs=bfd_mn10300_arch ;;
*) targ_archs=bfd_${targ_cpu}_arch ;;
pdp11*) targ_archs=bfd_pdp11_arch ;;
pj*) targ_archs="bfd_pj_arch bfd_i386_arch";;
powerpc*) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
rs6000) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
s390*) targ_archs=bfd_s390_arch ;;
sh*) targ_archs=bfd_sh_arch ;;
sparc*) targ_archs=bfd_sparc_arch ;;
strongarm*) targ_archs=bfd_arm_arch ;;
thumb*) targ_archs=bfd_arm_arch ;;
v850*) targ_archs=bfd_v850_arch ;;
x86_64) targ_archs=bfd_i386_arch ;;
xscale*) targ_archs=bfd_arm_arch ;;
xtensa*) targ_archs=bfd_xtensa_arch ;;
z80|r800) targ_archs=bfd_z80_arch ;;
z8k*) targ_archs=bfd_z8k_arch ;;
am33_2.0) targ_archs=bfd_mn10300_arch ;;
*) targ_archs=bfd_${targ_cpu}_arch ;;
esac
@ -126,7 +155,7 @@ case "${targ}" in
targ_defvec=ecoffalpha_little_vec
targ_selvecs=bfd_elf64_alpha_vec
;;
alpha*-*-linux-gnu* | alpha*-*-elf*)
alpha*-*-linux-* | alpha*-*-elf*)
targ_defvec=bfd_elf64_alpha_vec
targ_selvecs=ecoffalpha_little_vec
;;
@ -136,7 +165,7 @@ case "${targ}" in
alpha*-*-*)
targ_defvec=ecoffalpha_little_vec
;;
ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu)
ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu)
targ_defvec=bfd_elf64_ia64_little_vec
targ_selvecs="bfd_elf64_ia64_big_vec bfd_efi_app_ia64_vec"
;;
@ -213,7 +242,7 @@ case "${targ}" in
targ_defvec=bfd_elf32_littlearm_vec
targ_selvecs=bfd_elf32_bigarm_vec
;;
armeb-*-elf | arm*b-*-linux-gnu*)
armeb-*-elf | arm*b-*-linux-*)
targ_defvec=bfd_elf32_bigarm_vec
targ_selvecs=bfd_elf32_littlearm_vec
;;
@ -225,29 +254,30 @@ case "${targ}" in
targ_defvec=bfd_elf32_bigarm_vec
targ_selvecs=bfd_elf32_littlearm_vec
;;
arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-conix* | \
arm*-*-uclinux* | arm-*-kfreebsd*-gnu | arm-*-vxworks)
arm-*-elf | arm-*-freebsd* | arm*-*-linux-* | arm*-*-conix* | \
arm*-*-uclinux* | arm-*-kfreebsd*-gnu | \
arm*-*-eabi* )
targ_defvec=bfd_elf32_littlearm_vec
targ_selvecs=bfd_elf32_bigarm_vec
;;
arm*-*-vxworks | arm*-*-windiss)
targ_defvec=bfd_elf32_littlearm_vxworks_vec
targ_selvecs=bfd_elf32_bigarm_vxworks_vec
;;
arm*-*-symbianelf*)
targ_defvec=bfd_elf32_littlearm_symbian_vec
targ_selvecs=bfd_elf32_bigarm_symbian_vec
;;
arm9e-*-elf)
targ_defvec=bfd_elf32_littlearm_vec
targ_selvecs=bfd_elf32_bigarm_vec
;;
arm-*-oabi)
targ_defvec=bfd_elf32_littlearm_oabi_vec
targ_selvecs=bfd_elf32_bigarm_oabi_vec
;;
thumb-*-coff)
targ_defvec=armcoff_little_vec
targ_selvecs=armcoff_big_vec
targ_underscore=yes
;;
thumb-*-oabi)
targ_defvec=bfd_elf32_littlearm_oabi_vec
targ_selvecs=bfd_elf32_bigarm_oabi_vec
;;
thumb-*-elf)
targ_defvec=bfd_elf32_littlearm_vec
targ_selvecs=bfd_elf32_bigarm_vec
@ -281,21 +311,16 @@ case "${targ}" in
targ_underscore=yes
;;
a29k-*-ebmon* | a29k-*-udi* | a29k-*-coff* | a29k-*-sym1* | \
a29k-*-vxworks* | a29k-*-sysv* | a29k-*rtems*)
targ_defvec=a29kcoff_big_vec
targ_selvecs=sunos_big_vec
targ_underscore=yes
;;
a29k-*-aout* | a29k-*-bsd* | a29k-*-vsta*)
targ_defvec=sunos_big_vec
targ_underscore=yes
;;
avr-*-*)
targ_defvec=bfd_elf32_avr_vec
;;
bfin-*-*)
targ_defvec=bfd_elf32_bfin_vec
targ_selvecs=bfd_elf32_bfinfdpic_vec
targ_underscore=yes
;;
c30-*-*aout* | tic30-*-*aout*)
targ_defvec=tic30_aout_vec
;;
@ -315,12 +340,22 @@ case "${targ}" in
targ_underscore=yes
;;
cris-*-*)
cr16c-*-elf*)
targ_defvec=bfd_elf32_cr16c_vec
targ_underscore=yes
;;
cris-*-* | crisv32-*-*)
targ_defvec=cris_aout_vec
targ_selvecs="bfd_elf32_us_cris_vec bfd_elf32_cris_vec ieee_vec"
targ_underscore=yes # Note: not true for bfd_elf32_cris_vec.
;;
crx-*-elf*)
targ_defvec=bfd_elf32_crx_vec
targ_underscore=yes
;;
d10v-*-*)
targ_defvec=bfd_elf32_d10v_vec
;;
@ -348,7 +383,12 @@ case "${targ}" in
targ_selvecs=bfd_elf32_frv_vec
;;
h8300*-*-elf)
h8300*-*-rtemscoff*)
targ_defvec=h8300coff_vec
targ_underscore=yes
;;
h8300*-*-elf | h8300*-*-rtems*)
targ_defvec=bfd_elf32_h8300_vec
targ_underscore=yes
;;
@ -364,7 +404,7 @@ case "${targ}" in
;;
#ifdef BFD64
hppa*64*-*-linux-gnu*)
hppa*64*-*-linux-*)
targ_defvec=bfd_elf64_hppa_linux_vec
targ_selvecs=bfd_elf64_hppa_vec
;;
@ -375,7 +415,7 @@ case "${targ}" in
;;
#endif
hppa*-*-linux-gnu*)
hppa*-*-linux-*)
targ_defvec=bfd_elf32_hppa_linux_vec
targ_selvecs=bfd_elf32_hppa_vec
;;
@ -383,7 +423,7 @@ case "${targ}" in
targ_defvec=bfd_elf32_hppa_nbsd_vec
targ_selvecs="bfd_elf32_hppa_vec bfd_elf32_hppa_linux_vec"
;;
hppa*-*-*elf* | hppa*-*-lites* | hppa*-*-sysv4* | hppa*-*-rtems* | hppa*-*-openbsd*)
hppa*-*-*elf* | hppa*-*-lites* | hppa*-*-sysv4* | hppa*-*-openbsd*)
targ_defvec=bfd_elf32_hppa_vec
targ_selvecs=bfd_elf32_hppa_linux_vec
;;
@ -402,7 +442,7 @@ case "${targ}" in
;;
#endif /* defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF) */
i370-*-*)
i370-*-*)
targ_defvec=bfd_elf32_i370_vec
targ_selvecs="bfd_elf32_i370_vec"
;;
@ -410,12 +450,18 @@ case "${targ}" in
targ_defvec=i386coff_vec
targ_selvecs=bfd_elf32_i386_vec
;;
i[3-7]86-*-sysv4* | i[3-7]86-*-unixware* | i[3-7]86-*-solaris2* | \
i[3-7]86-*-sysv4* | i[3-7]86-*-unixware* | \
i[3-7]86-*-elf | i[3-7]86-*-sco3.2v5* | \
i[3-7]86-*-dgux* | i[3-7]86-*-sysv5*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs=i386coff_vec
;;
i[3-7]86-*-solaris2*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs=i386coff_vec
targ64_selvecs=bfd_elf64_x86_64_vec
want64=true
;;
i[3-7]86-*-kaos*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs=bfd_elf32_i386_vec
@ -430,7 +476,7 @@ case "${targ}" in
i[3-7]86-*-chorus*)
targ_defvec=bfd_elf32_i386_vec
;;
*-*-msdosdjgpp* | *-*-go32* | *-go32-rtems* )
*-*-msdosdjgpp* | *-*-go32* )
targ_defvec=go32coff_vec
targ_selvecs="go32stubbedcoff_vec i386aout_vec"
;;
@ -438,11 +484,7 @@ case "${targ}" in
i[3-7]86-*-aix*)
targ_defvec=i386coff_vec
;;
i[3-7]86*-*-rtemscoff*)
targ_defvec=i386coff_vec
targ_selvecs="bfd_elf32_i386_vec i386aout_vec"
;;
i[3-7]86-*-rtemself* | i[3-7]86-*-rtems*)
i[3-7]86-*-rtems*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs="i386coff_vec i386aout_vec"
;;
@ -489,7 +531,7 @@ case "${targ}" in
targ_selvecs="bfd_elf32_i386_vec i386bsd_vec"
targ_underscore=yes
;;
i[3-7]86-*-openbsd*)
i[3-7]86-*-openbsd*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs=i386netbsd_vec
;;
@ -502,12 +544,16 @@ case "${targ}" in
targ_selvecs=bfd_elf32_i386_vec
targ_underscore=yes
;;
i[3-7]86-*-linux-gnu*)
i[3-7]86-*-linux-*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs="i386linux_vec bfd_efi_app_ia32_vec"
targ64_selvecs=bfd_elf64_x86_64_vec
;;
#ifdef BFD64
x86_64-*-elf*)
targ_defvec=bfd_elf64_x86_64_vec
targ_selvecs="bfd_elf32_i386_vec i386coff_vec"
;;
x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
targ_defvec=bfd_elf64_x86_64_vec
targ_selvecs="bfd_elf32_i386_vec i386coff_vec bfd_efi_app_ia32_vec"
@ -516,14 +562,14 @@ case "${targ}" in
targ_defvec=bfd_elf64_x86_64_vec
targ_selvecs="bfd_elf32_i386_vec i386netbsd_vec i386coff_vec bfd_efi_app_ia32_vec"
;;
x86_64-*-linux-gnu*)
x86_64-*-linux-*)
targ_defvec=bfd_elf64_x86_64_vec
targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec"
;;
#endif
i[3-7]86-*-lynxos*)
targ_defvec=i386lynx_coff_vec
targ_selvecs=i386lynx_aout_vec
targ_defvec=bfd_elf32_i386_vec
targ_selvecs="i386lynx_coff_vec i386lynx_aout_vec"
;;
i[3-7]86-*-gnu*)
targ_defvec=bfd_elf32_i386_vec
@ -558,9 +604,14 @@ case "${targ}" in
# FIXME: This should eventually be checked at runtime.
targ_cflags=-DSTRICT_PE_FORMAT
;;
i[3-7]86-*-rdos*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs=i386coff_vec
;;
i[3-7]86-*-mingw32* | i[3-7]86-*-cygwin* | i[3-7]86-*-winnt | i[3-7]86-*-pe)
targ_defvec=i386pe_vec
targ_selvecs="i386pe_vec i386pei_vec bfd_elf32_i386_vec"
targ_underscore=yes
;;
i[3-7]86-none-*)
targ_defvec=i386coff_vec
@ -568,8 +619,8 @@ case "${targ}" in
i[3-7]86-*-aout* | i[3-7]86*-*-vsta*)
targ_defvec=i386aout_vec
;;
i[3-7]86-*-vxworks)
targ_defvec=bfd_elf32_i386_vec
i[3-7]86-*-vxworks*)
targ_defvec=bfd_elf32_i386_vxworks_vec
targ_underscore=yes
;;
i[3-7]86-*-chaos)
@ -616,16 +667,20 @@ case "${targ}" in
targ_defvec=bfd_elf32_iq2000_vec
;;
m32c-*-elf)
targ_defvec=bfd_elf32_m32c_vec
;;
m32r*le-*-linux*)
targ_defvec=bfd_elf32_m32rlelin_vec
targ_selvecs="bfd_elf32_m32rlin_vec bfd_elf32_m32rlelin_vec"
;;
m32r*-*-linux*)
targ_defvec=bfd_elf32_m32rlin_vec
targ_selvecs="bfd_elf32_m32rlin_vec bfd_elf32_m32rlelin_vec"
;;
m32r*le-*-*)
targ_defvec=bfd_elf32_m32rle_vec
targ_selvecs="bfd_elf32_m32r_vec bfd_elf32_m32rle_vec"
@ -691,7 +746,7 @@ case "${targ}" in
targ_selvecs=bfd_elf32_m68k_vec
targ_underscore=yes
;;
m68*-*-linux-gnu*)
m68*-*-linux-*)
targ_defvec=bfd_elf32_m68k_vec
targ_selvecs=m68klinux_vec
;;
@ -700,16 +755,12 @@ case "${targ}" in
# targ_selvecs=m68kmach3_vec
# targ_cflags=-DSTAT_FOR_EXEC
;;
m68*-*-lynxos*)
targ_defvec=m68klynx_coff_vec
targ_selvecs=m68klynx_aout_vec
;;
m68*-hp*-netbsd*)
targ_defvec=m68k4knetbsd_vec
targ_selvecs="m68knetbsd_vec hp300bsd_vec sunos_big_vec"
targ_underscore=yes
;;
m68*-*-netbsdelf*)
m68*-*-netbsdelf*)
targ_defvec=bfd_elf32_m68k_vec
targ_selvecs="m68knetbsd_vec m68k4knetbsd_vec hp300bsd_vec sunos_big_vec"
;;
@ -754,11 +805,19 @@ case "${targ}" in
targ_defvec=m88kmach3_vec
targ_cflags=-DSTAT_FOR_EXEC
;;
m88*-*-openbsd*)
targ_defvec=m88kopenbsd_vec
targ_underscore=yes
;;
m88*-*-*)
targ_defvec=m88kbcs_vec
targ_underscore=yes
;;
maxq-*-coff)
targ_defvec=maxqcoff_vec
;;
mcore-*-elf)
targ_defvec=bfd_elf32_mcore_big_vec
targ_selvecs="bfd_elf32_mcore_big_vec bfd_elf32_mcore_little_vec"
@ -773,16 +832,16 @@ case "${targ}" in
targ_selvecs=ecoff_little_vec
;;
mips*el-*-netbsd*)
targ_defvec=bfd_elf32_littlemips_vec
targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec ecoff_little_vec ecoff_big_vec"
targ_defvec=bfd_elf32_tradlittlemips_vec
targ_selvecs="bfd_elf32_tradbigmips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec ecoff_little_vec ecoff_big_vec"
;;
mips*-*-freebsd*)
targ_defvec=bfd_elf32_tradbigmips_vec
targ_selvecs="bfd_elf32_tradlittlemips_vec bfd_elf32_ntradbigmisp_vec bfd_elf32_ntradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec ecoff_big_vec ecoff_little_vec"
;;
mips*-*-netbsd*)
targ_defvec=bfd_elf32_bigmips_vec
targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec ecoff_big_vec ecoff_little_vec"
targ_defvec=bfd_elf32_tradbigmips_vec
targ_selvecs="bfd_elf32_tradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec ecoff_big_vec ecoff_little_vec"
;;
mips*-dec-* | mips*el-*-ecoff*)
targ_defvec=ecoff_little_vec
@ -818,7 +877,17 @@ case "${targ}" in
targ_defvec=ecoff_big_vec
targ_selvecs=ecoff_little_vec
;;
mips*el-*-elf* | mips*el-*-rtems* | mips*el-*-vxworks* | mips*-*-chorus*)
#ifdef BFD64
mips*el-*-vxworks*)
targ_defvec=bfd_elf32_littlemips_vxworks_vec
targ_selvecs="bfd_elf32_littlemips_vec bfd_elf32_bigmips_vxworks_vec bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
;;
mips*-*-vxworks*)
targ_defvec=bfd_elf32_bigmips_vxworks_vec
targ_selvecs="bfd_elf32_bigmips_vec bfd_elf32_littlemips_vxworks_vec bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
;;
#endif
mips*el-*-elf* | mips*el-*-vxworks* | mips*-*-chorus*)
targ_defvec=bfd_elf32_littlemips_vec
targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
;;
@ -830,6 +899,12 @@ case "${targ}" in
targ_defvec=bfd_elf32_bigmips_vec
targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
;;
#ifdef BFD64
mips64*-*-openbsd*)
targ_defvec=bfd_elf64_tradbigmips_vec
targ_selvecs="bfd_elf32_ntradlittlemips_vec bfd_elf32_ntradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf32_tradbigmips_vec bfd_elf64_tradlittlemips_vec"
;;
#endif
mips*el-*-openbsd*)
targ_defvec=bfd_elf32_littlemips_vec
targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec ecoff_little_vec ecoff_big_vec"
@ -873,6 +948,10 @@ case "${targ}" in
targ_underscore=yes
;;
mt-*-elf)
targ_defvec=bfd_elf32_mt_vec
;;
msp430-*-*)
targ_defvec=bfd_elf32_msp430_vec
;;
@ -890,12 +969,12 @@ case "${targ}" in
targ_defvec=bfd_elf32_openrisc_vec
;;
or32-*-coff)
or32-*-coff | or32-*-rtems* )
targ_defvec=or32coff_big_vec
targ_underscore=yes
;;
or32-*-elf | or32-*-rtems*)
or32-*-elf)
targ_defvec=bfd_elf32_or32_big_vec
;;
@ -945,7 +1024,7 @@ case "${targ}" in
targ_defvec=rs6000coff_vec
targ64_selvecs=rs6000coff64_vec
case "${targ}" in
*-*-aix4.[3456789]* | *-*-aix[56789]*)
*-*-aix4.[3456789]* | *-*-aix[56789]*)
want64=true;;
*)
targ_cflags=-DSMALL_ARCHIVE;;
@ -967,8 +1046,8 @@ case "${targ}" in
;;
#endif
powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \
powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-rtems* | \
powerpc-*-chorus* | powerpc-*-vxworks* | powerpc-*-windiss*)
powerpc-*-solaris2* | powerpc-*-linux-* | powerpc-*-rtems* | \
powerpc-*-chorus*)
targ_defvec=bfd_elf32_powerpc_vec
targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec"
targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec"
@ -983,9 +1062,14 @@ case "${targ}" in
targ_selvecs="mach_o_be_vec mach_o_le_vec mach_o_fat_vec pef_vec pef_xlib_vec sym_vec"
targ_archs="bfd_powerpc_arch bfd_rs6000_arch bfd_i386_arch"
;;
powerpc-*-macos* | powerpc-*-mpw*)
powerpc-*-macos*)
targ_defvec=pmac_xcoff_vec
;;
powerpc-*-lynxos*)
targ_defvec=bfd_elf32_powerpc_vec
targ_selvecs="rs6000coff_vec"
targ_cflags=-DSMALL_ARCHIVE
;;
powerpc-*-netware*)
targ_defvec=bfd_elf32_powerpc_vec
targ_selvecs="nlm32_powerpc_vec rs6000coff_vec"
@ -994,13 +1078,17 @@ case "${targ}" in
targ_defvec=bfd_elf32_powerpc_vec
targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec"
;;
powerpc-*-vxworks* | powerpc-*-windiss*)
targ_defvec=bfd_elf32_powerpc_vxworks_vec
targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec bfd_elf32_powerpcle_vec ppcboot_vec"
targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec"
;;
powerpcle-*-nto*)
targ_defvec=bfd_elf32_powerpcle_vec
targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec"
;;
powerpcle-*-elf* | powerpcle-*-sysv4* | powerpcle-*-eabi* | \
powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-vxworks* |\
powerpcle-*-rtems*)
powerpcle-*-solaris2* | powerpcle-*-linux-* | powerpcle-*-vxworks*)
targ_defvec=bfd_elf32_powerpcle_vec
targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec"
targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec"
@ -1013,12 +1101,16 @@ case "${targ}" in
s390-*-linux*)
targ_defvec=bfd_elf32_s390_vec
targ64_selvecs=bfd_elf64_s390_vec
want64=true
;;
#ifdef BFD64
s390x-*-linux*)
targ_defvec=bfd_elf64_s390_vec
targ_selvecs=bfd_elf32_s390_vec
;;
s390x-*-tpf*)
targ_defvec=bfd_elf64_s390_vec
;;
#endif
#ifdef BFD64
@ -1061,20 +1153,20 @@ case "${targ}" in
#ifdef BFD64
sh5le-*-netbsd*)
targ_defvec=bfd_elf32_sh64lnbsd_vec
targ_selvecs="bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec"
targ_selvecs="bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec bfd_elf32_shnbsd_vec bfd_elf32_shlnbsd_vec"
;;
sh5-*-netbsd*)
targ_defvec=bfd_elf32_sh64nbsd_vec
targ_selvecs="bfd_elf32_sh64lnbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec"
targ_selvecs="bfd_elf32_sh64lnbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec bfd_elf32_shnbsd_vec bfd_elf32_shlnbsd_vec"
;;
sh64le-*-netbsd*)
targ_defvec=bfd_elf64_sh64lnbsd_vec
targ_selvecs="bfd_elf64_sh64nbsd_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec"
targ_selvecs="bfd_elf64_sh64nbsd_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec bfd_elf32_shnbsd_vec bfd_elf32_shlnbsd_vec"
;;
sh64-*-netbsd*)
targ_defvec=bfd_elf64_sh64nbsd_vec
targ_selvecs="bfd_elf64_sh64lnbsd_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec"
targ_selvecs="bfd_elf64_sh64lnbsd_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec bfd_elf32_shnbsd_vec bfd_elf32_shlnbsd_vec"
;;
#endif
@ -1096,6 +1188,11 @@ case "${targ}" in
targ_defvec=bfd_elf32_shnbsd_vec
targ_selvecs="bfd_elf32_shlnbsd_vec shcoff_vec shlcoff_vec"
;;
sh*-*-symbianelf*)
targ_defvec=bfd_elf32_shl_symbian_vec
targ_selvecs="shlcoff_vec shlcoff_small_vec"
targ_underscore=yes
;;
shl*-*-elf* | sh[1234]l*-*-elf* | sh3el*-*-elf* | shl*-*-kaos*)
targ_defvec=bfd_elf32_shl_vec
targ_selvecs="bfd_elf32_sh_vec shlcoff_vec shcoff_vec shlcoff_small_vec shcoff_small_vec"
@ -1161,14 +1258,10 @@ case "${targ}" in
targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec"
targ_underscore=yes
;;
sparc-*-linux-gnu*)
sparc-*-linux-*)
targ_defvec=bfd_elf32_sparc_vec
targ_selvecs="sparclinux_vec bfd_elf64_sparc_vec sunos_big_vec"
;;
sparc-*-lynxos*)
targ_defvec=sparclynx_coff_vec
targ_selvecs=sparclynx_aout_vec
;;
sparc-*-netbsdelf*)
targ_defvec=bfd_elf32_sparc_vec
targ_selvecs=sparcnetbsd_vec
@ -1199,6 +1292,10 @@ case "${targ}" in
sparc-*-sysv4*)
targ_defvec=bfd_elf32_sparc_vec
;;
sparc-*-vxworks*)
targ_defvec=bfd_elf32_sparc_vxworks_vec
targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec"
;;
sparc-*-netware*)
targ_defvec=bfd_elf32_sparc_vec
targ_selvecs="nlm32_sparc_vec sunos_big_vec"
@ -1208,7 +1305,7 @@ case "${targ}" in
targ_defvec=sunos_big_vec
targ_underscore=yes
;;
sparc64-*-linux-gnu*)
sparc64-*-linux-*)
targ_defvec=bfd_elf64_sparc_vec
targ_selvecs="bfd_elf32_sparc_vec sparclinux_vec sunos_big_vec"
;;
@ -1220,16 +1317,11 @@ case "${targ}" in
sparc*-*-coff*)
targ_defvec=sparccoff_vec
;;
sparc*-*-rtemsaout*)
targ_defvec=sunos_big_vec
targ_selvecs="bfd_elf32_sparc_vec sparccoff_vec"
targ_underscore=yes
;;
sparc*-*-rtems* | sparc*-*-rtemself*)
sparc*-*-rtems*)
targ_defvec=bfd_elf32_sparc_vec
targ_selvecs="sunos_big_vec sparccoff_vec"
;;
sparc*-*-* | sparc*-*-rtems*)
sparc*-*-*)
targ_defvec=sunos_big_vec
targ_underscore=yes
;;
@ -1277,7 +1369,7 @@ case "${targ}" in
targ_underscore=yes
;;
vax-*-linux-gnu*)
vax-*-linux-*)
targ_defvec=bfd_elf32_vax_vec
;;
@ -1301,6 +1393,14 @@ case "${targ}" in
targ_defvec=bfd_elf32_xtensa_le_vec
targ_selvecs=bfd_elf32_xtensa_be_vec
;;
xc16x-*-elf)
targ_defvec=bfd_elf32_xc16x_vec
;;
z80-*-*)
targ_defvec=z80coff_vec
targ_underscore=no
;;
z8k*-*-*)
targ_defvec=z8kcoff_vec

View file

@ -1,288 +1,375 @@
/* config.in. Generated automatically from configure.in by autoheader. */
/* config.in. Generated from configure.in by autoheader. */
/* Define if using alloca.c. */
#undef C_ALLOCA
/* Define to empty if the keyword does not work. */
#undef const
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
This function is required for alloca.c support on those systems. */
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
systems. This function is required for `alloca.c' support on those systems.
*/
#undef CRAY_STACKSEG_END
/* Define if you have alloca, as a function or macro. */
#undef HAVE_ALLOCA
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
#undef HAVE_ALLOCA_H
/* Define if you have a working `mmap' system call. */
#undef HAVE_MMAP
/* Define as __inline if that's what the C compiler calls it. */
#undef inline
/* Define to `long' if <sys/types.h> doesn't define. */
#undef off_t
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown
*/
#undef STACK_DIRECTION
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Define if you have the __argz_count function. */
#undef HAVE___ARGZ_COUNT
/* Define if you have the __argz_next function. */
#undef HAVE___ARGZ_NEXT
/* Define if you have the __argz_stringify function. */
#undef HAVE___ARGZ_STRINGIFY
/* Define if you have the dcgettext function. */
#undef HAVE_DCGETTEXT
/* Define if you have the fcntl function. */
#undef HAVE_FCNTL
/* Define if you have the fdopen function. */
#undef HAVE_FDOPEN
/* Define if you have the fseeko function. */
#undef HAVE_FSEEKO
/* Define if you have the fseeko64 function. */
#undef HAVE_FSEEKO64
/* Define if you have the ftello function. */
#undef HAVE_FTELLO
/* Define if you have the ftello64 function. */
#undef HAVE_FTELLO64
/* Define if you have the getcwd function. */
#undef HAVE_GETCWD
/* Define if you have the getgid function. */
#undef HAVE_GETGID
/* Define if you have the getpagesize function. */
#undef HAVE_GETPAGESIZE
/* Define if you have the getuid function. */
#undef HAVE_GETUID
/* Define if you have the madvise function. */
#undef HAVE_MADVISE
/* Define if you have the mprotect function. */
#undef HAVE_MPROTECT
/* Define if you have the munmap function. */
#undef HAVE_MUNMAP
/* Define if you have the putenv function. */
#undef HAVE_PUTENV
/* Define if you have the setenv function. */
#undef HAVE_SETENV
/* Define if you have the setitimer function. */
#undef HAVE_SETITIMER
/* Define if you have the setlocale function. */
#undef HAVE_SETLOCALE
/* Define if you have the stpcpy function. */
#undef HAVE_STPCPY
/* Define if you have the strcasecmp function. */
#undef HAVE_STRCASECMP
/* Define if you have the strchr function. */
#undef HAVE_STRCHR
/* Define if you have the strtoull function. */
#undef HAVE_STRTOULL
/* Define if you have the sysconf function. */
#undef HAVE_SYSCONF
/* Define if you have the <argz.h> header file. */
#undef HAVE_ARGZ_H
/* Define if you have the <dirent.h> header file. */
#undef HAVE_DIRENT_H
/* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
/* Define if you have the <ndir.h> header file. */
#undef HAVE_NDIR_H
/* Define if you have the <nl_types.h> header file. */
#undef HAVE_NL_TYPES_H
/* Define if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_H
/* Define if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define if you have the <sys/dir.h> header file. */
#undef HAVE_SYS_DIR_H
/* Define if you have the <sys/file.h> header file. */
#undef HAVE_SYS_FILE_H
/* Define if you have the <sys/ndir.h> header file. */
#undef HAVE_SYS_NDIR_H
/* Define if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define if you have the <sys/procfs.h> header file. */
#undef HAVE_SYS_PROCFS_H
/* Define if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define if you have the <time.h> header file. */
#undef HAVE_TIME_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if you have the <values.h> header file. */
#undef HAVE_VALUES_H
/* Name of package */
#undef PACKAGE
/* Version number of package */
#undef VERSION
/* Define if you have the stpcpy function */
#undef HAVE_STPCPY
/* Define if your locale.h file contains LC_MESSAGES. */
#undef HAVE_LC_MESSAGES
/* Define to 1 if using `alloca.c'. */
#undef C_ALLOCA
/* Define to 1 if NLS is requested */
#undef ENABLE_NLS
/* Define to 1 if you have `alloca', as a function or macro. */
#undef HAVE_ALLOCA
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
*/
#undef HAVE_ALLOCA_H
/* Define to 1 if you have the <argz.h> header file. */
#undef HAVE_ARGZ_H
/* Define to 1 if you have the `dcgettext' function. */
#undef HAVE_DCGETTEXT
/* Define to 1 if you have the declaration of `basename', and to 0 if you
don't. */
#undef HAVE_DECL_BASENAME
/* Define to 1 if you have the declaration of `ffs', and to 0 if you don't. */
#undef HAVE_DECL_FFS
/* Define to 1 if you have the declaration of `free', and to 0 if you don't.
*/
#undef HAVE_DECL_FREE
/* Define to 1 if you have the declaration of `fseeko', and to 0 if you don't.
*/
#undef HAVE_DECL_FSEEKO
/* Define to 1 if you have the declaration of `fseeko64', and to 0 if you
don't. */
#undef HAVE_DECL_FSEEKO64
/* Define to 1 if you have the declaration of `ftello', and to 0 if you don't.
*/
#undef HAVE_DECL_FTELLO
/* Define to 1 if you have the declaration of `ftello64', and to 0 if you
don't. */
#undef HAVE_DECL_FTELLO64
/* Define to 1 if you have the declaration of `getenv', and to 0 if you don't.
*/
#undef HAVE_DECL_GETENV
/* Define to 1 if you have the declaration of `malloc', and to 0 if you don't.
*/
#undef HAVE_DECL_MALLOC
/* Define to 1 if you have the declaration of `realloc', and to 0 if you
don't. */
#undef HAVE_DECL_REALLOC
/* Define to 1 if you have the declaration of `snprintf', and to 0 if you
don't. */
#undef HAVE_DECL_SNPRINTF
/* Define to 1 if you have the declaration of `stpcpy', and to 0 if you don't.
*/
#undef HAVE_DECL_STPCPY
/* Define to 1 if you have the declaration of `strstr', and to 0 if you don't.
*/
#undef HAVE_DECL_STRSTR
/* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you
don't. */
#undef HAVE_DECL_VSNPRINTF
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
#undef HAVE_DIRENT_H
/* Define to 1 if you have the `fcntl' function. */
#undef HAVE_FCNTL
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define to 1 if you have the `fdopen' function. */
#undef HAVE_FDOPEN
/* Define to 1 if you have the `fopen64' function. */
#undef HAVE_FOPEN64
/* Define to 1 if you have the `fseeko' function. */
#undef HAVE_FSEEKO
/* Define to 1 if you have the `fseeko64' function. */
#undef HAVE_FSEEKO64
/* Define to 1 if you have the `ftello' function. */
#undef HAVE_FTELLO
/* Define to 1 if you have the `ftello64' function. */
#undef HAVE_FTELLO64
/* Define to 1 if you have the `getcwd' function. */
#undef HAVE_GETCWD
/* Define to 1 if you have the `getgid' function. */
#undef HAVE_GETGID
/* Define to 1 if you have the `getpagesize' function. */
#undef HAVE_GETPAGESIZE
/* Define as 1 if you have gettext and don't want to use GNU gettext. */
#undef HAVE_GETTEXT
/* The number of bytes in type long long */
#undef SIZEOF_LONG_LONG
/* Define to 1 if you have the `getuid' function. */
#undef HAVE_GETUID
/* The number of bytes in type long */
#undef SIZEOF_LONG
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Use b modifier when opening binary files? */
#undef USE_BINARY_FOPEN
/* Define if your locale.h file contains LC_MESSAGES. */
#undef HAVE_LC_MESSAGES
/* Define if strstr is not declared in system header files. */
#undef NEED_DECLARATION_STRSTR
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define if malloc is not declared in system header files. */
#undef NEED_DECLARATION_MALLOC
/* Define if realloc is not declared in system header files. */
#undef NEED_DECLARATION_REALLOC
/* Define if free is not declared in system header files. */
#undef NEED_DECLARATION_FREE
/* Define if getenv is not declared in system header files. */
#undef NEED_DECLARATION_GETENV
/* Define if struct core_dumpx has member c_impl */
#undef HAVE_ST_C_IMPL
/* Define if <sys/procfs.h> has prstatus_t. */
#undef HAVE_PRSTATUS_T
/* Define if <sys/procfs.h> has prstatus32_t. */
#undef HAVE_PRSTATUS32_T
/* Define if <sys/procfs.h> has prstatus_t.pr_who. */
#undef HAVE_PRSTATUS_T_PR_WHO
/* Define if <sys/procfs.h> has prstatus32_t.pr_who. */
#undef HAVE_PRSTATUS32_T_PR_WHO
/* Define if <sys/procfs.h> has pstatus_t. */
#undef HAVE_PSTATUS_T
/* Define if <sys/procfs.h> has pxstatus_t. */
#undef HAVE_PXSTATUS_T
/* Define if <sys/procfs.h> has pstatus32_t. */
#undef HAVE_PSTATUS32_T
/* Define if <sys/procfs.h> has prpsinfo_t. */
#undef HAVE_PRPSINFO_T
/* Define if <sys/procfs.h> has prpsinfo32_t. */
#undef HAVE_PRPSINFO32_T
/* Define if <sys/procfs.h> has psinfo_t. */
#undef HAVE_PSINFO_T
/* Define if <sys/procfs.h> has psinfo32_t. */
#undef HAVE_PSINFO32_T
/* Define to 1 if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define if <sys/procfs.h> has lwpstatus_t. */
#undef HAVE_LWPSTATUS_T
/* Define if <sys/procfs.h> has lwpxstatus_t. */
#undef HAVE_LWPXSTATUS_T
/* Define if <sys/procfs.h> has lwpstatus_t.pr_context. */
#undef HAVE_LWPSTATUS_T_PR_CONTEXT
/* Define if <sys/procfs.h> has lwpstatus_t.pr_reg. */
#undef HAVE_LWPSTATUS_T_PR_REG
/* Define if <sys/procfs.h> has lwpxstatus_t. */
#undef HAVE_LWPXSTATUS_T
/* Define to 1 if you have the `madvise' function. */
#undef HAVE_MADVISE
/* Define to 1 if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have a working `mmap' system call. */
#undef HAVE_MMAP
/* Define to 1 if you have the `mprotect' function. */
#undef HAVE_MPROTECT
/* Define to 1 if you have the `munmap' function. */
#undef HAVE_MUNMAP
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
#undef HAVE_NDIR_H
/* Define to 1 if you have the <nl_types.h> header file. */
#undef HAVE_NL_TYPES_H
/* Define if <sys/procfs.h> has prpsinfo32_t. */
#undef HAVE_PRPSINFO32_T
/* Define if <sys/procfs.h> has prpsinfo_t. */
#undef HAVE_PRPSINFO_T
/* Define if <sys/procfs.h> has prstatus32_t. */
#undef HAVE_PRSTATUS32_T
/* Define if <sys/procfs.h> has prstatus32_t.pr_who. */
#undef HAVE_PRSTATUS32_T_PR_WHO
/* Define if <sys/procfs.h> has prstatus_t. */
#undef HAVE_PRSTATUS_T
/* Define if <sys/procfs.h> has prstatus_t.pr_who. */
#undef HAVE_PRSTATUS_T_PR_WHO
/* Define if <sys/procfs.h> has psinfo32_t. */
#undef HAVE_PSINFO32_T
/* Define if <sys/procfs.h> has psinfo_t. */
#undef HAVE_PSINFO_T
/* Define if <sys/procfs.h> has pstatus32_t. */
#undef HAVE_PSTATUS32_T
/* Define if <sys/procfs.h> has pstatus_t. */
#undef HAVE_PSTATUS_T
/* Define to 1 if you have the `putenv' function. */
#undef HAVE_PUTENV
/* Define if <sys/procfs.h> has pxstatus_t. */
#undef HAVE_PXSTATUS_T
/* Define to 1 if you have the `setenv' function. */
#undef HAVE_SETENV
/* Define to 1 if you have the `setitimer' function. */
#undef HAVE_SETITIMER
/* Define to 1 if you have the `setlocale' function. */
#undef HAVE_SETLOCALE
/* Define to 1 if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define if you have the stpcpy function */
#undef HAVE_STPCPY
/* Define to 1 if you have the `strcasecmp' function. */
#undef HAVE_STRCASECMP
/* Define to 1 if you have the `strchr' function. */
#undef HAVE_STRCHR
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strtoull' function. */
#undef HAVE_STRTOULL
/* Define if struct core_dumpx has member c_impl */
#undef HAVE_ST_C_IMPL
/* Define to 1 if you have the `sysconf' function. */
#undef HAVE_SYSCONF
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_DIR_H
/* Define to 1 if you have the <sys/file.h> header file. */
#undef HAVE_SYS_FILE_H
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_NDIR_H
/* Define to 1 if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define to 1 if you have the <sys/procfs.h> header file. */
#undef HAVE_SYS_PROCFS_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <time.h> header file. */
#undef HAVE_TIME_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the <values.h> header file. */
#undef HAVE_VALUES_H
/* Define if <sys/procfs.h> has win32_pstatus_t. */
#undef HAVE_WIN32_PSTATUS_T
/* Define to 1 if you have the `__argz_count' function. */
#undef HAVE___ARGZ_COUNT
/* Define to 1 if you have the `__argz_next' function. */
#undef HAVE___ARGZ_NEXT
/* Define to 1 if you have the `__argz_stringify' function. */
#undef HAVE___ARGZ_STRINGIFY
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* The size of a `long', as computed by sizeof. */
#undef SIZEOF_LONG
/* The size of a `long long', as computed by sizeof. */
#undef SIZEOF_LONG_LONG
/* The size of a `off_t', as computed by sizeof. */
#undef SIZEOF_OFF_T
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown */
#undef STACK_DIRECTION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if you can safely include both <string.h> and <strings.h>. */
#undef STRING_WITH_STRINGS
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Name of host specific header file to include in trad-core.c. */
#undef TRAD_HEADER
/* The number of bytes in type off_t */
#undef SIZEOF_OFF_T
/* Use b modifier when opening binary files? */
#undef USE_BINARY_FOPEN
/* Use mmap if it's available? */
#undef USE_MMAP
/* Define if we should default to creating read-only plt entries */
#undef USE_SECUREPLT
/* Version number of package */
#undef VERSION
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#undef inline
#endif
/* Define to `long' if <sys/types.h> does not define. */
#undef off_t
/* Define to `unsigned' if <sys/types.h> does not define. */
#undef size_t

File diff suppressed because it is too large Load diff

View file

@ -19,16 +19,20 @@ HOST_U_64BIT_TYPE=
case "${host}" in
hppa*-*-hpux*) # HP/UX's ftello64 et.al. declarations are only
hppa*64*-*-hpux*) # HP/UX's ftello64 et.al. declarations are only
# visible when _LARGEFILE64_SOURCE is defined.
# Without those declarations, real_ftell et.al.
# get mis-compiled.
HDEFINES="-DHOST_HPPAHPUX -D_LARGEFILE64_SOURCE" ;;
HDEFINES="-DHOST_HPPAHPUX -D_LARGEFILE64_SOURCE"
host64=true;;
hppa*-*-hpux*) HDEFINES="-DHOST_HPPAHPUX -D_LARGEFILE64_SOURCE" ;;
hppa*-*-hiux*) HDEFINES=-DHOST_HPPAHPUX ;;
hppa*-*-mpeix*) HDEFINES=-DHOST_HPPAMPEIX ;;
hppa*-*-bsd*) HDEFINES=-DHOST_HPPABSD ;;
hppa*-*-osf*) HDEFINES=-DHOST_HPPAOSF ;;
ia64-*-hpux*) HDEFINES=-D_LARGEFILE64_SOURCE
host64=true;;
ia64-*-*) host64=true;;
# Workaround for limitations on win9x where file contents are

View file

@ -1,27 +1,14 @@
dnl Process this file with autoconf to produce a configure script.
dnl
AC_PREREQ(2.13)
AC_INIT(libbfd.c)
AC_PREREQ(2.59)
AC_INIT
AC_CONFIG_SRCDIR([libbfd.c])
AC_CANONICAL_SYSTEM
AC_CANONICAL_TARGET
AC_ISC_POSIX
AM_INIT_AUTOMAKE(bfd, 2.15)
# Uncomment the next line to remove the date from the reported bfd version
#is_release=y
changequote(,)dnl
bfd_version=`echo "${VERSION}" | sed -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$/\1\2\3\4\5/'`
changequote([,])dnl
bfd_version_string="\"${VERSION}\""
if test x${is_release} = x; then
bfd_version_date=`sed -n -e 's/.*DATE //p' < ${srcdir}/version.h`
bfd_version_string="\"${VERSION} ${bfd_version_date}\""
fi
AC_SUBST(bfd_version)
AC_SUBST(bfd_version_string)
AM_INIT_AUTOMAKE(bfd, 2.17)
dnl These must be called before AM_PROG_LIBTOOL, because it may want
dnl to call AC_CHECK_PROG.
@ -44,7 +31,7 @@ esac],[want64=false])dnl
AC_ARG_ENABLE(targets,
[ --enable-targets alternative target configurations],
[case "${enableval}" in
yes | "") AC_ERROR(enable-targets option must specify target names or 'all')
yes | "") AC_MSG_ERROR([enable-targets option must specify target names or 'all'])
;;
no) enable_targets= ;;
*) enable_targets=$enableval ;;
@ -64,26 +51,19 @@ AC_ARG_WITH(mmap,
*) AC_MSG_ERROR(bad value ${withval} for BFD with-mmap option) ;;
esac],[want_mmap=false])dnl
build_warnings="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
AC_ARG_ENABLE(build-warnings,
[ --enable-build-warnings Enable build-time compiler warnings if gcc is used],
AC_ARG_ENABLE(secureplt,
[ --enable-secureplt Default to creating read-only plt entries],
[case "${enableval}" in
yes) ;;
no) build_warnings="-w";;
,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
build_warnings="${build_warnings} ${t}";;
*,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
build_warnings="${t} ${build_warnings}";;
*) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
esac
if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
echo "Setting warning flags = $build_warnings" 6>&1
fi])dnl
WARN_CFLAGS=""
if test "x${build_warnings}" != x && test "x$GCC" = xyes ; then
WARN_CFLAGS="${build_warnings}"
yes) use_secureplt=true ;;
no) use_secureplt=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for secureplt option) ;;
esac],[use_secureplt=false])dnl
if test $use_secureplt = true; then
AC_DEFINE(USE_SECUREPLT, 1,
[Define if we should default to creating read-only plt entries])
fi
AC_SUBST(WARN_CFLAGS)
AM_BINUTILS_WARNINGS
AM_CONFIG_HEADER(config.h:config.in)
@ -102,8 +82,9 @@ bfd_default_target_size=32
# host stuff:
AC_PROG_CC
AC_GNU_SOURCE
ALL_LINGUAS="fr tr ja es sv da zh_CN ro"
ALL_LINGUAS="fr tr ja es sv da zh_CN ro rw vi"
CY_GNU_GETTEXT
# Permit host specific settings.
@ -120,16 +101,14 @@ BFD_HOST_U_64_BIT=
AC_MSG_CHECKING([for long long])
AC_CACHE_VAL(bfd_cv_has_long_long,
[AC_TRY_COMPILE(,
[unsigned long long ll = 18446744073709551615ULL;],
bfd_cv_has_long_long=yes, bfd_cv_has_long_long=no)])
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[unsigned long long ll = 18446744073709551615ULL;]])],[bfd_cv_has_long_long=yes],[bfd_cv_has_long_long=no])])
AC_MSG_RESULT($bfd_cv_has_long_long)
if test $bfd_cv_has_long_long = yes; then
BFD_HOST_LONG_LONG=1
AC_COMPILE_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(long long)
fi
AC_COMPILE_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long)
if test "x${ac_cv_sizeof_long}" = "x8"; then
host64=true
BFD_HOST_64BIT_LONG=1
@ -158,16 +137,27 @@ AC_CHECK_HEADERS(stddef.h string.h strings.h stdlib.h time.h unistd.h)
AC_CHECK_HEADERS(fcntl.h sys/file.h sys/time.h)
AC_HEADER_TIME
AC_HEADER_DIRENT
ACX_HEADER_STRING
AC_CHECK_FUNCS(fcntl getpagesize setitimer sysconf fdopen getuid getgid)
AC_CHECK_FUNCS(strtoull)
AC_CHECK_DECLS(basename)
AC_CHECK_DECLS(ftello)
AC_CHECK_DECLS(ftello64)
AC_CHECK_DECLS(fseeko)
AC_CHECK_DECLS(fseeko64)
BFD_BINARY_FOPEN
BFD_NEED_DECLARATION(strstr)
BFD_NEED_DECLARATION(malloc)
BFD_NEED_DECLARATION(realloc)
BFD_NEED_DECLARATION(free)
BFD_NEED_DECLARATION(getenv)
AC_CHECK_DECLS(ffs)
AC_CHECK_DECLS(free)
AC_CHECK_DECLS(getenv)
AC_CHECK_DECLS(malloc)
AC_CHECK_DECLS(realloc)
AC_CHECK_DECLS(stpcpy)
AC_CHECK_DECLS(strstr)
AC_CHECK_DECLS(snprintf)
AC_CHECK_DECLS(vsnprintf)
# If we are configured native, pick a core file support file.
COREFILE=
@ -178,7 +168,7 @@ if test "${target}" = "${host}"; then
alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
COREFILE=''
;;
alpha*-*-linux-gnu*)
alpha*-*-linux-*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/alphalinux.h"'
;;
@ -195,6 +185,10 @@ if test "${target}" = "${host}"; then
hppa*-*-mpeix*) COREFILE=hpux-core.lo ;;
hppa*-*-bsd*) COREFILE="hpux-core.lo hppabsd-core.lo"
COREFLAG="-DHPUX_CORE -DHPPABSD_CORE" ;;
hppa*-*-netbsd* | hppa*-*-openbsd*)
COREFILE=netbsd-core.lo
;;
i370-*-*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i370linux.h"'
@ -219,7 +213,7 @@ changequote([,])dnl
COREFILE=
;;
changequote(,)dnl
i[3-7]86-*-bsd* | i[3-7]86-*-freebsd[123] | i[3-7]86-*-freebsd[123]\.* | i[3-7]86-*-freebsd4\.[01234]* | i[3-7]86-*-freebsd*aout*)
i[3-7]86-*-bsd* | i[3-7]86-*-freebsd[123] | i[3-7]86-*-freebsd[123]\.* | i[3-7]86-*-freebsd4\.[01234] | i[3-7]86-*-freebsd4\.[01234]\.* | i[3-7]86-*-freebsd*aout*)
changequote([,])dnl
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i386bsd.h"'
@ -259,7 +253,7 @@ changequote([,])dnl
TRAD_HEADER='"hosts/i386mach3.h"'
;;
changequote(,)dnl
i[3-7]86-*-linux-gnu*)
i[3-7]86-*-linux-*)
changequote([,])dnl
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i386linux.h"'
@ -300,7 +294,7 @@ changequote([,])dnl
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/hp300bsd.h"'
;;
m68*-*-linux-gnu*)
m68*-*-linux-*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/m68klinux.h"'
;;
@ -328,6 +322,9 @@ changequote([,])dnl
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/m88kmach3.h"'
;;
m88*-*-openbsd*)
COREFILE=netbsd-core.lo
;;
ns32k-pc532-mach)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/pc532mach.h"'
@ -350,9 +347,7 @@ changequote([,])dnl
# Not all versions of AIX with -DAIX_CORE_DUMPX_CORE
# have c_impl as a member of struct core_dumpx
AC_MSG_CHECKING([for c_impl in struct core_dumpx])
AC_TRY_COMPILE([#include <core.h>],
[struct core_dumpx c; c.c_impl = 0;],
[AC_DEFINE(HAVE_ST_C_IMPL, 1,
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <core.h>]], [[struct core_dumpx c; c.c_impl = 0;]])],[AC_DEFINE(HAVE_ST_C_IMPL, 1,
[Define if struct core_dumpx has member c_impl])
AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
;;
@ -385,7 +380,7 @@ changequote([,])dnl
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/vaxult2.h"'
;;
vax-*-linux-gnu*)
vax-*-linux-*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/vaxlinux.h"'
;;
@ -565,7 +560,6 @@ do
# This list is alphabetized to make it easy to compare
# with the two vector lists in targets.c. For the same reason,
# use one entry per line, even though this leads to long lines.
a29kcoff_big_vec) tb="$tb coff-a29k.lo cofflink.lo" ;;
a_out_adobe_vec) tb="$tb aout-adobe.lo aout32.lo" ;;
aix5coff64_vec) tb="$tb coff64-rs6000.lo xcofflink.lo aix5ppc-core.lo"; target_size=64 ;;
aout0_big_vec) tb="$tb aout0.lo aout32.lo" ;;
@ -589,12 +583,21 @@ do
bfd_efi_app_ia64_vec) tb="$tb efi-app-ia64.lo pepigen.lo cofflink.lo"; target_size=64 ;;
bfd_elf32_am33lin_vec) tb="$tb elf32-am33lin.lo elf32.lo $elf" ;;
bfd_elf32_avr_vec) tb="$tb elf32-avr.lo elf32.lo $elf" ;;
bfd_elf32_bfin_vec) tb="$tb elf32-bfin.lo elf32.lo $elf" ;;
bfd_elf32_bfinfdpic_vec) tb="$tb elf32-bfin.lo elf32.lo $elf" ;;
bfd_elf32_big_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
bfd_elf32_bigarc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;;
bfd_elf32_bigarm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;;
bfd_elf32_bigarm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;;
bfd_elf32_bigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_bigarm_vec) tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;;
bfd_elf32_bigarm_symbian_vec)
tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;;
bfd_elf32_bigarm_vxworks_vec)
tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;;
bfd_elf32_bigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_bigmips_vxworks_vec)
tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_cr16c_vec) tb="$tb elf32-cr16c.lo elf32.lo $elf" ;;
bfd_elf32_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;;
bfd_elf32_crx_vec) tb="$tb elf32-crx.lo elf32.lo $elf" ;;
bfd_elf32_d10v_vec) tb="$tb elf32-d10v.lo elf32.lo $elf" ;;
bfd_elf32_d30v_vec) tb="$tb elf32-d30v.lo elf32.lo $elf" ;;
bfd_elf32_dlx_big_vec) tb="$tb elf32-dlx.lo elf32.lo $elf" ;;
@ -606,8 +609,9 @@ do
bfd_elf32_hppa_nbsd_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_i370_vec) tb="$tb elf32-i370.lo elf32.lo $elf" ;;
bfd_elf32_i386_freebsd_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;;
bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;;
bfd_elf32_i386_freebsd_vec) tb="$tb elf32-i386.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_i386_vxworks_vec) tb="$tb elf32-i386.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_i860_little_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
bfd_elf32_i860_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
bfd_elf32_i960_vec) tb="$tb elf32-i960.lo elf32.lo $elf" ;;
@ -617,9 +621,15 @@ do
bfd_elf32_iq2000_vec) tb="$tb elf32-iq2000.lo elf32.lo $elf" ;;
bfd_elf32_little_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
bfd_elf32_littlearc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;;
bfd_elf32_littlearm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;;
bfd_elf32_littlearm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;;
bfd_elf32_littlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_littlearm_symbian_vec)
tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;;
bfd_elf32_littlearm_vxworks_vec)
tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;;
bfd_elf32_littlearm_vec) tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;;
bfd_elf32_littlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_littlemips_vxworks_vec)
tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_m32c_vec) tb="$tb elf32-m32c.lo elf32.lo $elf" ;;
bfd_elf32_m32r_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
bfd_elf32_m32rle_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
bfd_elf32_m32rlin_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
@ -632,17 +642,19 @@ do
bfd_elf32_mcore_little_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
bfd_elf32_mn10200_vec) tb="$tb elf-m10200.lo elf32.lo $elf" ;;
bfd_elf32_mn10300_vec) tb="$tb elf-m10300.lo elf32.lo $elf" ;;
bfd_elf32_mt_vec) tb="$tb elf32-mt.lo elf32.lo $elf" ;;
bfd_elf32_msp430_vec) tb="$tb elf32-msp430.lo elf32.lo $elf" ;;
bfd_elf32_nbigmips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf32_nlittlemips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf32_ntradbigmips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf32_ntradlittlemips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf32_nbigmips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf32_nlittlemips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf32_ntradbigmips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf32_ntradlittlemips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf32_openrisc_vec) tb="$tb elf32-openrisc.lo elf32.lo $elf" ;;
bfd_elf32_or32_big_vec) tb="$tb elf32-or32.lo elf32.lo $elf" ;;
bfd_elf32_pj_vec) tb="$tb elf32-pj.lo elf32.lo $elf";;
bfd_elf32_pjl_vec) tb="$tb elf32-pj.lo elf32.lo $elf";;
bfd_elf32_powerpc_vec) tb="$tb elf32-ppc.lo elf32.lo $elf" ;;
bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.lo elf32.lo $elf" ;;
bfd_elf32_powerpc_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_powerpc_vxworks_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_s390_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;;
# 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
@ -656,29 +668,32 @@ do
bfd_elf32_sh_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
bfd_elf32_shblin_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
bfd_elf32_shl_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
bfd_elf32_shl_symbian_vec) tb="$tb elf32-sh-symbian.lo elf32-sh64-com.lo elf32.lo $elf coff-sh.lo" ;;
bfd_elf32_shlin_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
bfd_elf32_shlnbsd_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
bfd_elf32_shnbsd_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elf32.lo $elf" ;;
bfd_elf32_tradbigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_sparc_vxworks_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_tradbigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_us_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;;
bfd_elf32_v850_vec) tb="$tb elf32-v850.lo elf32.lo $elf" ;;
bfd_elf32_vax_vec) tb="$tb elf32-vax.lo elf32.lo $elf" ;;
bfd_elf32_xstormy16_vec) tb="$tb elf32-xstormy16.lo elf32.lo $elf" ;;
bfd_elf32_xc16x_vec) tb="$tb elf32-xc16x.lo elf32.lo $elf" ;;
bfd_elf32_xtensa_le_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;;
bfd_elf32_xtensa_be_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;;
bfd_elf64_alpha_freebsd_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_bigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_bigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_hppa_linux_vec) tb="$tb elf64-hppa.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_hppa_vec) tb="$tb elf64-hppa.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_ia64_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_ia64_hpux_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_ia64_little_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_little_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_littlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_littlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_mmix_vec) tb="$tb elf64-mmix.lo elf64.lo $elf" target_size=64 ;;
bfd_elf64_powerpc_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_powerpcle_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf" target_size=64 ;;
@ -689,9 +704,9 @@ do
bfd_elf64_sh64blin_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
bfd_elf64_sh64lnbsd_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
bfd_elf64_sh64nbsd_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_tradbigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_tradbigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_x86_64_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" ;;
@ -734,12 +749,12 @@ do
m68kcoff_vec) tb="$tb coff-m68k.lo cofflink.lo" ;;
m68kcoffun_vec) tb="$tb coff-u68k.lo coff-m68k.lo cofflink.lo" ;;
m68klinux_vec) tb="$tb m68klinux.lo aout32.lo" ;;
m68klynx_aout_vec) tb="$tb m68klynx.lo lynx-core.lo aout32.lo" ;;
m68klynx_coff_vec) tb="$tb cf-m68klynx.lo coff-m68k.lo cofflink.lo lynx-core.lo" ;;
m68knetbsd_vec) tb="$tb m68knetbsd.lo aout32.lo" ;;
m68ksysvcoff_vec) tb="$tb coff-svm68k.lo cofflink.lo" ;;
m88kbcs_vec) tb="$tb coff-m88k.lo" ;;
m88kmach3_vec) tb="$tb m88kmach3.lo aout32.lo" ;;
m88kopenbsd_vec) tb="$tb m88kopenbsd.lo aout32.lo" ;;
maxqcoff_vec) tb="$tb coff-maxq.lo" ;;
mach_o_be_vec) tb="$tb mach-o.lo" ;;
mach_o_le_vec) tb="$tb mach-o.lo" ;;
mach_o_fat_vec) tb="$tb mach-o.lo" ;;
@ -803,7 +818,8 @@ do
vms_vax_vec) tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo" ;;
w65_vec) tb="$tb coff-w65.lo reloc16.lo" ;;
we32kcoff_vec) tb="$tb coff-we32k.lo" ;;
z8kcoff_vec) tb="$tb coff-z8k.lo reloc16.lo" ;;
z80coff_vec) tb="$tb coff-z80.lo reloc16.lo" ;;
z8kcoff_vec) tb="$tb coff-z8k.lo reloc16.lo cofflink.lo" ;;
# These appear out of order in targets.c
srec_vec) tb="$tb srec.lo" ;;
@ -889,7 +905,7 @@ case ${host64}-${target64}-${want64} in
AC_MSG_RESULT([yes: egcs-1.1.2 on ix86 spotted]),
AC_MSG_RESULT(no))
if test $bad_64bit_gcc = yes ; then
AC_ERROR([A newer version of gcc is needed for the requested 64-bit BFD configuration])
AC_MSG_ERROR([A newer version of gcc is needed for the requested 64-bit BFD configuration])
fi
fi
;;
@ -912,9 +928,9 @@ AC_SUBST(bfd_default_target_size)
# fseeko, long. This assumes that sizeof off_t is .ge. sizeof long.
# Hopefully a reasonable assumption since fseeko et.al. should be
# upward compatible.
AC_CHECK_FUNCS(ftello ftello64 fseeko fseeko64)
AC_CHECK_FUNCS(ftello ftello64 fseeko fseeko64 fopen64)
if test x"$ac_cv_func_ftello" = xyes -a x"$ac_cv_func_fseeko" = xyes; then
AC_COMPILE_CHECK_SIZEOF(off_t)
AC_CHECK_SIZEOF(off_t)
fi
AC_MSG_CHECKING([file_ptr type])
bfd_file_ptr="long"
@ -945,6 +961,13 @@ case ${want_mmap}+${ac_cv_func_mmap_fixed_mapped} in
esac
rm -f doc/config.status
AC_OUTPUT(Makefile doc/Makefile bfd-in3.h:bfd-in2.h bfdver.h:version.h po/Makefile.in:po/Make-in,
[sed -e '/SRC-POTFILES =/r po/SRC-POTFILES' -e '/BLD-POTFILES =/r po/BLD-POTFILES' po/Makefile.in > po/Makefile])
AC_CONFIG_FILES([Makefile doc/Makefile bfd-in3.h:bfd-in2.h po/Makefile.in:po/Make-in])
AC_CONFIG_COMMANDS([default],[[sed -e '/SRC-POTFILES =/r po/SRC-POTFILES' -e '/BLD-POTFILES =/r po/BLD-POTFILES' po/Makefile.in > po/Makefile]],[[]])
dnl Required by html and install-html
AC_SUBST(datarootdir)
AC_SUBST(docdir)
AC_SUBST(htmldir)
AC_OUTPUT

View file

@ -1,5 +1,5 @@
/* Core file generic interface routines for BFD.
Copyright 1990, 1991, 1992, 1993, 1994, 2000, 2001, 2002, 2003
Copyright 1990, 1991, 1992, 1993, 1994, 2000, 2001, 2002, 2003, 2005
Free Software Foundation, Inc.
Written by Cygnus Support.
@ -17,12 +17,15 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/*
SECTION
Core files
SUBSECTION
Core file functions
DESCRIPTION
These are functions pertaining to core files.
*/
@ -104,3 +107,59 @@ core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd)
return BFD_SEND (core_bfd, _core_file_matches_executable_p,
(core_bfd, exec_bfd));
}
/*
FUNCTION
generic_core_file_matches_executable_p
SYNOPSIS
bfd_boolean generic_core_file_matches_executable_p
(bfd *core_bfd, bfd *exec_bfd);
DESCRIPTION
Return TRUE if the core file attached to @var{core_bfd}
was generated by a run of the executable file attached
to @var{exec_bfd}. The match is based on executable
basenames only.
Note: When not able to determine the core file failing
command or the executable name, we still return TRUE even
though we're not sure that core file and executable match.
This is to avoid generating a false warning in situations
where we really don't know whether they match or not.
*/
bfd_boolean
generic_core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd)
{
char *exec;
char *core;
char *last_slash;
if (exec_bfd == NULL || core_bfd == NULL)
return TRUE;
/* The cast below is to avoid a compiler warning due to the assignment
of the const char * returned by bfd_core_file_failing_command to a
non-const char *. In this case, the assignement does not lead to
breaking the const, as we're only reading the string. */
core = (char *) bfd_core_file_failing_command (core_bfd);
if (core == NULL)
return TRUE;
exec = bfd_get_filename (exec_bfd);
if (exec == NULL)
return TRUE;
last_slash = strrchr (core, '/');
if (last_slash != NULL)
core = last_slash + 1;
last_slash = strrchr (exec, '/');
if (last_slash != NULL)
exec = last_slash + 1;
return strcmp (exec, core) == 0;
}

View file

@ -1,5 +1,6 @@
/* BFD support for the Alpha architecture.
Copyright 1992, 1993, 1998, 2000, 2002 Free Software Foundation, Inc.
Copyright 1992, 1993, 1998, 2000, 2002, 2003
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@ -15,7 +16,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "bfd.h"
#include "sysdep.h"

View file

@ -16,7 +16,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "bfd.h"
#include "sysdep.h"

View file

@ -1,5 +1,6 @@
/* BFD support for the ARM processor
Copyright 1994, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
Copyright 1994, 1997, 1999, 2000, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
This file is part of BFD, the Binary File Descriptor library.
@ -16,28 +17,19 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
#include "libiberty.h"
static const bfd_arch_info_type * compatible
PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
static bfd_boolean scan
PARAMS ((const struct bfd_arch_info *, const char *));
static bfd_boolean arm_check_note
PARAMS ((bfd *, char *, bfd_size_type, const char *, char **));
/* This routine is provided two arch_infos and works out which ARM
machine which would be compatible with both and returns a pointer
to its info structure. */
static const bfd_arch_info_type *
compatible (a,b)
const bfd_arch_info_type * a;
const bfd_arch_info_type * b;
compatible (const bfd_arch_info_type *a, const bfd_arch_info_type *b)
{
/* If a & b are for different architecture we can do nothing. */
if (a->arch != b->arch)
@ -104,9 +96,7 @@ processors[] =
};
static bfd_boolean
scan (info, string)
const struct bfd_arch_info * info;
const char * string;
scan (const struct bfd_arch_info *info, const char *string)
{
int i;
@ -161,9 +151,7 @@ const bfd_arch_info_type bfd_arm_arch =
Returns TRUE if they were merged successfully or FALSE otherwise. */
bfd_boolean
bfd_arm_merge_machines (ibfd, obfd)
bfd * ibfd;
bfd * obfd;
bfd_arm_merge_machines (bfd *ibfd, bfd *obfd)
{
unsigned int in = bfd_get_mach (ibfd);
unsigned int out = bfd_get_mach (obfd);
@ -194,9 +182,8 @@ bfd_arm_merge_machines (ibfd, obfd)
&& (out == bfd_mach_arm_XScale || out == bfd_mach_arm_iWMMXt))
{
_bfd_error_handler (_("\
ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale"),
bfd_archive_filename (ibfd),
bfd_get_filename (obfd));
ERROR: %B is compiled for the EP9312, whereas %B is compiled for XScale"),
ibfd, obfd);
bfd_set_error (bfd_error_wrong_format);
return FALSE;
}
@ -204,9 +191,8 @@ ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale"),
&& (in == bfd_mach_arm_XScale || in == bfd_mach_arm_iWMMXt))
{
_bfd_error_handler (_("\
ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale"),
bfd_archive_filename (obfd),
bfd_get_filename (ibfd));
ERROR: %B is compiled for the EP9312, whereas %B is compiled for XScale"),
obfd, ibfd);
bfd_set_error (bfd_error_wrong_format);
return FALSE;
}
@ -227,12 +213,11 @@ typedef struct
} arm_Note;
static bfd_boolean
arm_check_note (abfd, buffer, buffer_size, expected_name, description_return)
bfd * abfd;
char * buffer;
bfd_size_type buffer_size;
const char * expected_name;
char ** description_return;
arm_check_note (bfd *abfd,
bfd_byte *buffer,
bfd_size_type buffer_size,
const char *expected_name,
char **description_return)
{
unsigned long namesz;
unsigned long descsz;
@ -247,7 +232,7 @@ arm_check_note (abfd, buffer, buffer_size, expected_name, description_return)
namesz = bfd_get_32 (abfd, buffer);
descsz = bfd_get_32 (abfd, buffer + offsetof (arm_Note, descsz));
type = bfd_get_32 (abfd, buffer + offsetof (arm_Note, type));
descr = buffer + offsetof (arm_Note, name);
descr = (char *) buffer + offsetof (arm_Note, name);
/* Check for buffer overflow. */
if (namesz + descsz + offsetof (arm_Note, name) > buffer_size)
@ -280,13 +265,11 @@ arm_check_note (abfd, buffer, buffer_size, expected_name, description_return)
#define NOTE_ARCH_STRING "arch: "
bfd_boolean
bfd_arm_update_notes (abfd, note_section)
bfd * abfd;
const char * note_section;
bfd_arm_update_notes (bfd *abfd, const char *note_section)
{
asection * arm_arch_section;
bfd_size_type buffer_size;
char * buffer;
bfd_byte * buffer;
char * arch_string;
char * expected;
@ -298,16 +281,11 @@ bfd_arm_update_notes (abfd, note_section)
if (arm_arch_section == NULL)
return TRUE;
buffer_size = arm_arch_section->_raw_size;
buffer_size = arm_arch_section->size;
if (buffer_size == 0)
return FALSE;
buffer = bfd_malloc (buffer_size);
if (buffer == NULL)
return FALSE;
if (! bfd_get_section_contents (abfd, arm_arch_section, buffer,
(file_ptr) 0, buffer_size))
if (!bfd_malloc_and_get_section (abfd, arm_arch_section, &buffer))
goto FAIL;
/* Parse the note. */
@ -335,7 +313,9 @@ bfd_arm_update_notes (abfd, note_section)
if (strcmp (arch_string, expected) != 0)
{
strcpy (buffer + offsetof (arm_Note, name) + ((strlen (NOTE_ARCH_STRING) + 3) & ~3), expected);
strcpy ((char *) buffer + (offsetof (arm_Note, name)
+ ((strlen (NOTE_ARCH_STRING) + 3) & ~3)),
expected);
if (! bfd_set_section_contents (abfd, arm_arch_section, buffer,
(file_ptr) 0, buffer_size))
@ -351,7 +331,8 @@ bfd_arm_update_notes (abfd, note_section)
return TRUE;
FAIL:
free (buffer);
if (buffer != NULL)
free (buffer);
return FALSE;
}
@ -379,13 +360,11 @@ architectures[] =
/* Extract the machine number stored in a note section. */
unsigned int
bfd_arm_get_mach_from_notes (abfd, note_section)
bfd * abfd;
const char * note_section;
bfd_arm_get_mach_from_notes (bfd *abfd, const char *note_section)
{
asection * arm_arch_section;
bfd_size_type buffer_size;
char * buffer;
bfd_byte * buffer;
char * arch_string;
int i;
@ -397,16 +376,11 @@ bfd_arm_get_mach_from_notes (abfd, note_section)
if (arm_arch_section == NULL)
return bfd_mach_arm_unknown;
buffer_size = arm_arch_section->_raw_size;
buffer_size = arm_arch_section->size;
if (buffer_size == 0)
return bfd_mach_arm_unknown;
buffer = bfd_malloc (buffer_size);
if (buffer == NULL)
return bfd_mach_arm_unknown;
if (! bfd_get_section_contents (abfd, arm_arch_section, buffer,
(file_ptr) 0, buffer_size))
if (!bfd_malloc_and_get_section (abfd, arm_arch_section, &buffer))
goto FAIL;
/* Parse the note. */
@ -422,6 +396,20 @@ bfd_arm_get_mach_from_notes (abfd, note_section)
}
FAIL:
free (buffer);
if (buffer != NULL)
free (buffer);
return bfd_mach_arm_unknown;
}
bfd_boolean
bfd_is_arm_mapping_symbol_name (const char * name)
{
/* The ARM compiler outputs several obsolete forms. Recognize them
in addition to the standard $a, $t and $d. */
return (name != NULL)
&& (name[0] == '$')
&& ((name[1] == 'a') || (name[1] == 't') || (name[1] == 'd')
|| (name[1] == 'm') || (name[1] == 'f') || (name[1] == 'p'))
&& (name[2] == 0 || name[2] == '.');
}

View file

@ -1,5 +1,5 @@
/* BFD support for the Intel 386 architecture.
Copyright 1992, 1994, 1995, 1996, 1998, 2000, 2001, 2002
Copyright 1992, 1994, 1995, 1996, 1998, 2000, 2001, 2002, 2004
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@ -16,12 +16,28 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_x86_64_arch_intel_syntax =
{
64, /* 64 bits in a word */
64, /* 64 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_i386,
bfd_mach_x86_64_intel_syntax,
"i386:intel",
"i386:x86-64:intel",
3,
FALSE,
bfd_default_compatible,
bfd_default_scan,
0
};
const bfd_arch_info_type bfd_i386_arch_intel_syntax =
{
32, /* 32 bits in a word */
@ -34,25 +50,11 @@ const bfd_arch_info_type bfd_i386_arch_intel_syntax =
3,
TRUE,
bfd_default_compatible,
bfd_default_scan ,
0,
bfd_default_scan,
&bfd_x86_64_arch_intel_syntax
};
const bfd_arch_info_type bfd_x86_64_arch_intel_syntax =
{
64, /* 64 bits in a word */
64, /* 64 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_i386,
bfd_mach_x86_64_intel_syntax,
"i386:intel",
"i386:x86-64:intel",
3,
TRUE,
bfd_default_compatible,
bfd_default_scan ,
&bfd_i386_arch_intel_syntax,
};
static const bfd_arch_info_type i8086_arch =
const bfd_arch_info_type i8086_arch =
{
32, /* 32 bits in a word */
32, /* 32 bits in an address (well, not really) */
@ -64,8 +66,8 @@ static const bfd_arch_info_type i8086_arch =
3,
FALSE,
bfd_default_compatible,
bfd_default_scan ,
&bfd_x86_64_arch_intel_syntax,
bfd_default_scan,
&bfd_i386_arch_intel_syntax
};
const bfd_arch_info_type bfd_x86_64_arch =
@ -78,10 +80,10 @@ const bfd_arch_info_type bfd_x86_64_arch =
"i386",
"i386:x86-64",
3,
TRUE,
FALSE,
bfd_default_compatible,
bfd_default_scan ,
&i8086_arch,
bfd_default_scan,
&i8086_arch
};
const bfd_arch_info_type bfd_i386_arch =
@ -96,6 +98,6 @@ const bfd_arch_info_type bfd_i386_arch =
3,
TRUE,
bfd_default_compatible,
bfd_default_scan ,
bfd_default_scan,
&bfd_x86_64_arch
};

View file

@ -1,4 +1,4 @@
/* Copyright 1998, 1999, 2000, 2001, 2002, 2003
/* Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006
Free Software Foundation, Inc.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
@ -16,7 +16,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* Logically, this code should be part of libopcode but since some of
the operand insertion/extraction functions help bfd to implement
@ -113,6 +113,29 @@ ext_immu (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
return 0;
}
static const char*
ins_immu5b (const struct ia64_operand *self, ia64_insn value,
ia64_insn *code)
{
if (value < 32 || value > 63)
return "value must be between 32 and 63";
return ins_immu (self, value - 32, code);
}
static const char*
ext_immu5b (const struct ia64_operand *self, ia64_insn code,
ia64_insn *valuep)
{
const char *result;
result = ext_immu (self, code, valuep);
if (result)
return result;
*valuep = *valuep + 32;
return 0;
}
static const char*
ins_immus8 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
{
@ -457,6 +480,10 @@ const struct ia64_operand elf64_ia64_operands[IA64_OPND_COUNT] =
{ REG, ins_reg, ext_reg, "r", {{ 2, 20}}, 0, /* R3_2 */
"a general register r0-r3" },
/* memory operands: */
{ IND, ins_reg, ext_reg, "", {{7, 20}}, 0, /* MR3 */
"a memory address" },
/* indirect operands: */
{ IND, ins_reg, ext_reg, "cpuid", {{7, 20}}, 0, /* CPUID_R3 */
"a cpuid register" },
@ -468,8 +495,6 @@ const struct ia64_operand elf64_ia64_operands[IA64_OPND_COUNT] =
"an itr register" },
{ IND, ins_reg, ext_reg, "ibr", {{7, 20}}, 0, /* IBR_R3 */
"an ibr register" },
{ IND, ins_reg, ext_reg, "", {{7, 20}}, 0, /* MR3 */
"an indirect memory address" },
{ IND, ins_reg, ext_reg, "msr", {{7, 20}}, 0, /* MSR_R3 */
"an msr register" },
{ IND, ins_reg, ext_reg, "pkr", {{7, 20}}, 0, /* PKR_R3 */
@ -504,6 +529,8 @@ const struct ia64_operand elf64_ia64_operands[IA64_OPND_COUNT] =
"a 1-bit integer (-1, 0)" },
{ ABS, ins_immu, ext_immu, 0, {{ 2, 13}}, UDEC, /* IMMU2 */
"a 2-bit unsigned (0-3)" },
{ ABS, ins_immu5b, ext_immu5b, 0, {{ 5, 14}}, UDEC, /* IMMU5b */
"a 5-bit unsigned (32 + (0-31))" },
{ ABS, ins_immu, ext_immu, 0, {{ 7, 13}}, 0, /* IMMU7a */
"a 7-bit unsigned (0-127)" },
{ ABS, ins_immu, ext_immu, 0, {{ 7, 20}}, 0, /* IMMU7b */

View file

@ -16,7 +16,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "bfd.h"
#include "sysdep.h"

View file

@ -1,5 +1,5 @@
/* BFD PowerPC CPU definition
Copyright 1994, 1995, 1996, 2000, 2001, 2002
Copyright 1994, 1995, 1996, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Contributed by Ian Lance Taylor, Cygnus Support.
@ -17,7 +17,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "bfd.h"
#include "sysdep.h"
@ -295,6 +295,20 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
FALSE, /* not the default */
powerpc_compatible,
bfd_default_scan,
&bfd_powerpc_archs[15]
},
{
32, /* 32 bits in a word */
32, /* 32 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_powerpc,
bfd_mach_ppc_750,
"powerpc",
"powerpc:750",
3,
FALSE, /* not the default */
powerpc_compatible,
bfd_default_scan,
0
}
};

View file

@ -22,7 +22,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "bfd.h"
#include "sysdep.h"

View file

@ -16,8 +16,8 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
#include "bfd.h"
#include "sysdep.h"

View file

@ -16,7 +16,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "bfd.h"
#include "sysdep.h"

View file

@ -17,7 +17,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#define ARCH_SIZE 64

View file

@ -4,6 +4,7 @@ s/\\\n */ /g
t loop
s!\.o:!.lo:!
s! \./! !g
s! @BFD_H@!!g
s!@SRCDIR@/../include!$(INCDIR)!g
s!@TOPDIR@/include!$(INCDIR)!g

View file

@ -1,9 +1,104 @@
2004-04-08 Alan Modra <amodra@bigpond.net.au>
2006-06-07 Joseph S. Myers <joseph@codesourcery.com>
* bfd.texinfo: Remove local @tex code.
2006-04-06 Carlos O'Donell <carlos@codesourcery.com>
* Makefile.am: Add install-html and install-html-am targets.
Define datarootdir, docdir and htmldir.
* Makefile.in: Regenerate.
2006-02-27 Carlos O'Donell <carlos@codesourcery.com>
* Makefile.am: Add html target.
* Makefile.in: Regenerate.
2005-07-24 Daniel Jacobowitz <dan@codesourcery.com>
* chew.c: Include <string.h>.
2005-07-22 DJ Delorie <dj@redhat.com>
* chew.c: Include stdlib.h.
2005-07-22 Kazu Hirata <kazu@codesourcery.com>
* chew.c: Don't include sysdep.h.
2005-05-09 Daniel Jacobowitz <dan@codesourcery.com>
* Makefile.am: Use a temporary file to build chew.
* Makefile.in: Regenerated.
2005-05-04 Nick Clifton <nickc@redhat.com>
* chew.c: Update the address and phone number of the FSF
organization in the GPL notice.
2005-05-05 H.J. Lu <hongjiu.lu@intel.com>
* Makefile.am (INCLUDES): Remove -D_GNU_SOURCE.
* Makefile.in: Regenerate.
2005-04-29 Daniel Jacobowitz <dan@codesourcery.com>
* Makefile.am: Remove stamp rules. Depend on chew.c
instead of $(MKDOC).
* Makefile.in: Regnerated.
2005-04-21 H.J. Lu <hongjiu.lu@intel.com>
* Makefile.am (INCLUDES): New. Add -D_GNU_SOURCE.
(chew.o): Use it.
* Makefile.in: Regenerate.
2005-04-14 Alan Modra <amodra@bigpond.net.au>
* Makefile.in: Regenerate.
2005-04-12 Alan Modra <amodra@bigpond.net.au>
* Makefile.in: Regenerate.
2005-02-21 Alan Modra <amodra@bigpond.net.au>
* Makefile.in: Regenerate.
2005-02-13 Maciej W. Rozycki <macro@linux-mips.org>
* Makefile.am: Use CFLAGS_FOR_BUILD and LDFLAGS_FOR_BUILD for
building chew.
* Makefile.in: Regenerate.
2005-02-01 Ben Elliston <bje@au.ibm.com>
* chew.c: Remove #if 0'd code throughout. Similarly, collapse #if
1'd code.
2004-12-20 Ian Lance Taylor <ian@c2microsystems.com>
* Makefile.am: Use $(SHELL) whenever we run move-if-change.
* Makefile.in: Rebuild.
2004-09-19 H.J. Lu <hongjiu.lu@intel.com>
* Makefile.am (AUTOMAKE_OPTIONS): Require 1.9.
(bfd.info): Rename the target to ...
($(srcdir)/bfd.info): This.
* Makefile.in: Regenerated.
2004-09-17 Alan Modra <amodra@bigpond.net.au>
* Makefile.in: Regenerate.
2004-03-27 Alan Modra <amodra@bigpond.net.au>
Apply from mainline.
2004-03-27 Alan Modra <amodra@bigpond.net.au>
* bfdint.texi: Remove all mention of elflink.h.
2004-03-19 Alan Modra <amodra@bigpond.net.au>
* Makefile.in: Regenerate.
For older changes see ChangeLog-9103
Local Variables:

View file

@ -1,6 +1,6 @@
## Process this file with automake to generate Makefile.in
AUTOMAKE_OPTIONS = cygnus
AUTOMAKE_OPTIONS = 1.9 cygnus
DOCFILES = aoutx.texi archive.texi archures.texi \
bfdt.texi cache.texi coffcode.texi \
@ -54,159 +54,141 @@ info_TEXINFOS = bfd.texinfo
MKDOC = chew$(EXEEXT_FOR_BUILD)
$(MKDOC): chew.o
$(CC_FOR_BUILD) -o $(MKDOC) chew.o $(CFLAGS) $(LOADLIBES) $(LDFLAGS)
INCLUDES = -I.. -I$(srcdir)/.. -I$(srcdir)/../../include \
-I$(srcdir)/../../intl -I../../intl
$(MKDOC): $(srcdir)/chew.c
$(CC_FOR_BUILD) -o chew.$$$$ $(srcdir)/chew.c \
$(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(H_CFLAGS) \
$(INCLUDES); \
$(SHELL) $(srcdir)/../../move-if-change chew.$$$$ $(MKDOC)
chew.o: chew.c
$(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS) $(srcdir)/chew.c
$(CC_FOR_BUILD) -c $(INCLUDES) $(H_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/chew.c
protos: libbfd.h libcoff.h bfd.h
bfd.info bfd.dvi: $(DOCFILES) bfdsumm.texi bfd.texinfo
$(srcdir)/bfd.info bfd.dvi bfd.html: $(DOCFILES) bfdsumm.texi bfd.texinfo
# We can't replace these rules with an implicit rule, because
# makes without VPATH support couldn't find the .h files in `..'.
# We use s-XXX targets so that we can distribute the info files,
# and permit people to rebuild them, without requiring the makeinfo
# program. If somebody tries to rebuild info, but none of the .texi
# files have changed, then this Makefile will build chew, and will
# build all of the stamp files, but will not actually have to rebuild
# bfd.info.
# We do not depend on chew directly so that we can distribute the info
# files, and permit people to rebuild them, without requiring the makeinfo
# program. If somebody tries to rebuild info, but none of the .texi files
# have changed, then nothing will be rebuilt.
s-aoutx: $(MKDOC) $(srcdir)/../aoutx.h $(srcdir)/doc.str
aoutx.texi: chew.c $(srcdir)/../aoutx.h $(srcdir)/doc.str
$(MAKE) $(MKDOC)
./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../aoutx.h >aoutx.tmp
$(srcdir)/../../move-if-change aoutx.tmp aoutx.texi
touch s-aoutx
aoutx.texi: s-aoutx
$(SHELL) $(srcdir)/../../move-if-change aoutx.tmp aoutx.texi
s-archive: $(MKDOC) $(srcdir)/../archive.c $(srcdir)/doc.str
archive.texi: chew.c $(srcdir)/../archive.c $(srcdir)/doc.str
$(MAKE) $(MKDOC)
./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../archive.c >archive.tmp
$(srcdir)/../../move-if-change archive.tmp archive.texi
touch s-archive
archive.texi: s-archive
$(SHELL) $(srcdir)/../../move-if-change archive.tmp archive.texi
s-archures: $(MKDOC) $(srcdir)/../archures.c $(srcdir)/doc.str
archures.texi: chew.c $(srcdir)/../archures.c $(srcdir)/doc.str
$(MAKE) $(MKDOC)
./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../archures.c >archures.tmp
$(srcdir)/../../move-if-change archures.tmp archures.texi
touch s-archures
archures.texi: s-archures
$(SHELL) $(srcdir)/../../move-if-change archures.tmp archures.texi
# We use bfdt.texi, rather than bfd.texi, to avoid conflicting with
# bfd.texinfo on an 8.3 filesystem.
s-bfd: $(MKDOC) $(srcdir)/../bfd.c $(srcdir)/doc.str
bfdt.texi: chew.c $(srcdir)/../bfd.c $(srcdir)/doc.str
$(MAKE) $(MKDOC)
./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfd.c >bfd.tmp
$(srcdir)/../../move-if-change bfd.tmp bfdt.texi
touch s-bfd
bfdt.texi: s-bfd
$(SHELL) $(srcdir)/../../move-if-change bfd.tmp bfdt.texi
s-cache: $(MKDOC) $(srcdir)/../cache.c $(srcdir)/doc.str
cache.texi: chew.c $(srcdir)/../cache.c $(srcdir)/doc.str
$(MAKE) $(MKDOC)
./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../cache.c >cache.tmp
$(srcdir)/../../move-if-change cache.tmp cache.texi
touch s-cache
cache.texi: s-cache
$(SHELL) $(srcdir)/../../move-if-change cache.tmp cache.texi
s-coffcode: $(MKDOC) $(srcdir)/../coffcode.h $(srcdir)/doc.str
coffcode.texi: chew.c $(srcdir)/../coffcode.h $(srcdir)/doc.str
$(MAKE) $(MKDOC)
./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../coffcode.h >coffcode.tmp
$(srcdir)/../../move-if-change coffcode.tmp coffcode.texi
touch s-coffcode
coffcode.texi: s-coffcode
$(SHELL) $(srcdir)/../../move-if-change coffcode.tmp coffcode.texi
s-core: $(MKDOC) $(srcdir)/../corefile.c $(srcdir)/doc.str
core.texi: chew.c $(srcdir)/../corefile.c $(srcdir)/doc.str
$(MAKE) $(MKDOC)
./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../corefile.c >core.tmp
$(srcdir)/../../move-if-change core.tmp core.texi
touch s-core
core.texi: s-core
$(SHELL) $(srcdir)/../../move-if-change core.tmp core.texi
s-elf: $(MKDOC) $(srcdir)/../elf.c $(srcdir)/doc.str
elf.texi: chew.c $(srcdir)/../elf.c $(srcdir)/doc.str
$(MAKE) $(MKDOC)
./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../elf.c >elf.tmp
$(srcdir)/../../move-if-change elf.tmp elf.texi
touch s-elf
elf.texi: s-elf
$(SHELL) $(srcdir)/../../move-if-change elf.tmp elf.texi
s-elfcode: $(MKDOC) $(srcdir)/../elfcode.h $(srcdir)/doc.str
elfcode.texi: chew.c $(srcdir)/../elfcode.h $(srcdir)/doc.str
$(MAKE) $(MKDOC)
./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../elfcode.h >elfcode.tmp
$(srcdir)/../../move-if-change elfcode.tmp elfcode.texi
touch s-elfcode
elfcode.texi: s-elfcode
$(SHELL) $(srcdir)/../../move-if-change elfcode.tmp elfcode.texi
s-mmo: $(MKDOC) $(srcdir)/../mmo.c $(srcdir)/doc.str
mmo.texi: chew.c $(srcdir)/../mmo.c $(srcdir)/doc.str
$(MAKE) $(MKDOC)
./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../mmo.c >mmo.tmp
$(srcdir)/../../move-if-change mmo.tmp mmo.texi
touch s-mmo
mmo.texi: s-mmo
$(SHELL) $(srcdir)/../../move-if-change mmo.tmp mmo.texi
s-format: $(MKDOC) $(srcdir)/../format.c $(srcdir)/doc.str
format.texi: chew.c $(srcdir)/../format.c $(srcdir)/doc.str
$(MAKE) $(MKDOC)
./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../format.c >format.tmp
$(srcdir)/../../move-if-change format.tmp format.texi
touch s-format
format.texi: s-format
$(SHELL) $(srcdir)/../../move-if-change format.tmp format.texi
s-libbfd: $(MKDOC) $(srcdir)/../libbfd.c $(srcdir)/doc.str
libbfd.texi: chew.c $(srcdir)/../libbfd.c $(srcdir)/doc.str
$(MAKE) $(MKDOC)
./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../libbfd.c >libbfd.tmp
$(srcdir)/../../move-if-change libbfd.tmp libbfd.texi
touch s-libbfd
libbfd.texi: s-libbfd
$(SHELL) $(srcdir)/../../move-if-change libbfd.tmp libbfd.texi
s-bfdio: $(MKDOC) $(srcdir)/../bfdio.c $(srcdir)/doc.str
bfdio.texi: chew.c $(srcdir)/../bfdio.c $(srcdir)/doc.str
$(MAKE) $(MKDOC)
./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfdio.c >bfdio.tmp
$(srcdir)/../../move-if-change bfdio.tmp bfdio.texi
touch s-bfdio
bfdio.texi: s-bfdio
$(SHELL) $(srcdir)/../../move-if-change bfdio.tmp bfdio.texi
s-bfdwin: $(MKDOC) $(srcdir)/../bfdwin.c $(srcdir)/doc.str
bfdwin.texi: chew.c $(srcdir)/../bfdwin.c $(srcdir)/doc.str
$(MAKE) $(MKDOC)
./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfdwin.c >bfdwin.tmp
$(srcdir)/../../move-if-change bfdwin.tmp bfdwin.texi
touch s-bfdwin
bfdwin.texi: s-bfdwin
$(SHELL) $(srcdir)/../../move-if-change bfdwin.tmp bfdwin.texi
s-opncls: $(MKDOC) $(srcdir)/../opncls.c $(srcdir)/doc.str
opncls.texi: chew.c $(srcdir)/../opncls.c $(srcdir)/doc.str
$(MAKE) $(MKDOC)
./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../opncls.c >opncls.tmp
$(srcdir)/../../move-if-change opncls.tmp opncls.texi
touch s-opncls
opncls.texi: s-opncls
$(SHELL) $(srcdir)/../../move-if-change opncls.tmp opncls.texi
s-reloc: $(MKDOC) $(srcdir)/../reloc.c $(srcdir)/doc.str
reloc.texi: chew.c $(srcdir)/../reloc.c $(srcdir)/doc.str
$(MAKE) $(MKDOC)
./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../reloc.c >reloc.tmp
$(srcdir)/../../move-if-change reloc.tmp reloc.texi
touch s-reloc
reloc.texi: s-reloc
$(SHELL) $(srcdir)/../../move-if-change reloc.tmp reloc.texi
s-section: $(MKDOC) $(srcdir)/../section.c $(srcdir)/doc.str
section.texi: chew.c $(srcdir)/../section.c $(srcdir)/doc.str
$(MAKE) $(MKDOC)
./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../section.c >section.tmp
$(srcdir)/../../move-if-change section.tmp section.texi
touch s-section
section.texi: s-section
$(SHELL) $(srcdir)/../../move-if-change section.tmp section.texi
s-syms: $(MKDOC) $(srcdir)/../syms.c $(srcdir)/doc.str
syms.texi: chew.c $(srcdir)/../syms.c $(srcdir)/doc.str
$(MAKE) $(MKDOC)
./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../syms.c >syms.tmp
$(srcdir)/../../move-if-change syms.tmp syms.texi
touch s-syms
syms.texi: s-syms
$(SHELL) $(srcdir)/../../move-if-change syms.tmp syms.texi
s-targets: $(MKDOC) $(srcdir)/../targets.c $(srcdir)/doc.str
targets.texi: chew.c $(srcdir)/../targets.c $(srcdir)/doc.str
$(MAKE) $(MKDOC)
./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../targets.c >targets.tmp
$(srcdir)/../../move-if-change targets.tmp targets.texi
touch s-targets
targets.texi: s-targets
$(SHELL) $(srcdir)/../../move-if-change targets.tmp targets.texi
s-init: $(MKDOC) $(srcdir)/../init.c $(srcdir)/doc.str
init.texi: chew.c $(srcdir)/../init.c $(srcdir)/doc.str
$(MAKE) $(MKDOC)
./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../init.c >init.tmp
$(srcdir)/../../move-if-change init.tmp init.texi
touch s-init
init.texi: s-init
$(SHELL) $(srcdir)/../../move-if-change init.tmp init.texi
s-hash: $(MKDOC) $(srcdir)/../hash.c $(srcdir)/doc.str
hash.texi: chew.c $(srcdir)/../hash.c $(srcdir)/doc.str
$(MAKE) $(MKDOC)
./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../hash.c >hash.tmp
$(srcdir)/../../move-if-change hash.tmp hash.texi
touch s-hash
hash.texi: s-hash
$(SHELL) $(srcdir)/../../move-if-change hash.tmp hash.texi
s-linker: $(MKDOC) $(srcdir)/../linker.c $(srcdir)/doc.str
linker.texi: chew.c $(srcdir)/../linker.c $(srcdir)/doc.str
$(MAKE) $(MKDOC)
./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../linker.c >linker.tmp
$(srcdir)/../../move-if-change linker.tmp linker.texi
touch s-linker
linker.texi: s-linker
$(SHELL) $(srcdir)/../../move-if-change linker.tmp linker.texi
LIBBFD_H_DEP = \
$(srcdir)/../libbfd-in.h \
@ -296,7 +278,7 @@ noinst_TEXINFOS = bfdint.texi
MOSTLYCLEANFILES = $(MKDOC) *.o
CLEANFILES = s-* *.p *.ip
CLEANFILES = *.p *.ip
DISTCLEANFILES = bfd.?? bfd.??? bfd.h libbfd.h libcoff.h texput.log
@ -305,3 +287,28 @@ MAINTAINERCLEANFILES = $(DOCFILES)
# We want install to imply install-info as per GNU standards, despite the
# cygnus option.
install: install-info
html__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
install-html: install-html-am
install-html-am: $(HTMLS)
@$(NORMAL_INSTALL)
test -z "$(htmldir)" || $(mkdir_p) "$(DESTDIR)$(htmldir)"
@list='$(HTMLS)'; for p in $$list; do \
if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \
f=$(html__strip_dir) \
if test -d "$$d$$p"; then \
echo " $(mkdir_p) '$(DESTDIR)$(htmldir)/$$f'"; \
$(mkdir_p) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \
$(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \
else \
echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \
$(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \
fi; \
done

File diff suppressed because it is too large Load diff

View file

@ -121,7 +121,7 @@ turn by various format specific files (eg sunos.c).
@example
void aout_@var{size}_swap_exec_header_in,
(bfd *abfd,
struct external_exec *raw_bytes,
struct external_exec *bytes,
struct internal_exec *execp);
@end example
@strong{Description}@*
@ -148,7 +148,8 @@ Swap the information in an internal exec header structure
@example
const bfd_target *aout_@var{size}_some_aout_object_p
(bfd *abfd,
const bfd_target *(*callback_to_real_object_p) ());
struct internal_exec *execp,
const bfd_target *(*callback_to_real_object_p) (bfd *));
@end example
@strong{Description}@*
Some a.out variant thinks that the file open in @var{abfd}
@ -172,7 +173,8 @@ Initialize BFD @var{abfd} for use with a.out files.
@example
enum machine_type aout_@var{size}_machine_type
(enum bfd_architecture arch,
unsigned long machine));
unsigned long machine,
bfd_boolean *unknown);
@end example
@strong{Description}@*
Keep track of machine architecture and machine type for
@ -190,7 +192,7 @@ is always understood.
bfd_boolean aout_@var{size}_set_arch_mach,
(bfd *,
enum bfd_architecture arch,
unsigned long machine));
unsigned long machine);
@end example
@strong{Description}@*
Set the architecture and the machine of the BFD @var{abfd} to the
@ -203,7 +205,7 @@ can support the architecture required.
@example
bfd_boolean aout_@var{size}_new_section_hook,
(bfd *abfd,
asection *newsect));
asection *newsect);
@end example
@strong{Description}@*
Called by the BFD in response to a @code{bfd_make_section}

View file

@ -50,6 +50,9 @@ of a restriction.
Archives are supported in BFD in @code{archive.c}.
@subsection Archive functions
@findex bfd_get_next_mapent
@subsubsection @code{bfd_get_next_mapent}
@strong{Synopsis}

View file

@ -46,11 +46,22 @@ enum bfd_architecture
#define bfd_mach_m68040 6
#define bfd_mach_m68060 7
#define bfd_mach_cpu32 8
#define bfd_mach_mcf5200 9
#define bfd_mach_mcf5206e 10
#define bfd_mach_mcf5307 11
#define bfd_mach_mcf5407 12
#define bfd_mach_mcf528x 13
#define bfd_mach_mcf_isa_a_nodiv 9
#define bfd_mach_mcf_isa_a 10
#define bfd_mach_mcf_isa_a_mac 11
#define bfd_mach_mcf_isa_a_emac 12
#define bfd_mach_mcf_isa_aplus 13
#define bfd_mach_mcf_isa_aplus_mac 14
#define bfd_mach_mcf_isa_aplus_emac 15
#define bfd_mach_mcf_isa_b_nousp 16
#define bfd_mach_mcf_isa_b_nousp_mac 17
#define bfd_mach_mcf_isa_b_nousp_emac 18
#define bfd_mach_mcf_isa_b 19
#define bfd_mach_mcf_isa_b_mac 20
#define bfd_mach_mcf_isa_b_emac 21
#define bfd_mach_mcf_isa_b_float 22
#define bfd_mach_mcf_isa_b_float_mac 23
#define bfd_mach_mcf_isa_b_float_emac 24
bfd_arch_vax, /* DEC Vax */
bfd_arch_i960, /* Intel 960 */
/* The order of the following is important.
@ -72,7 +83,6 @@ enum bfd_architecture
bfd_arch_or32, /* OpenRISC 32 */
bfd_arch_a29k, /* AMD 29000 */
bfd_arch_sparc, /* SPARC */
#define bfd_mach_sparc 1
/* The difference between v8plus and v9 is that v9 is a true 64 bit env. */
@ -89,6 +99,9 @@ enum bfd_architecture
#define bfd_mach_sparc_v9_p(mach) \
((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \
&& (mach) != bfd_mach_sparc_sparclite_le)
/* Nonzero if MACH is a 64 bit sparc architecture. */
#define bfd_mach_sparc_64bit_p(mach) \
((mach) >= bfd_mach_sparc_v9 && (mach) != bfd_mach_sparc_v8plusb)
bfd_arch_mips, /* MIPS Rxxxx */
#define bfd_mach_mips3000 3000
#define bfd_mach_mips3900 3900
@ -107,6 +120,7 @@ enum bfd_architecture
#define bfd_mach_mips6000 6000
#define bfd_mach_mips7000 7000
#define bfd_mach_mips8000 8000
#define bfd_mach_mips9000 9000
#define bfd_mach_mips10000 10000
#define bfd_mach_mips12000 12000
#define bfd_mach_mips16 16
@ -127,7 +141,6 @@ enum bfd_architecture
bfd_arch_i860, /* Intel 860 */
bfd_arch_i370, /* IBM 360/370 Mainframes */
bfd_arch_romp, /* IBM ROMP PC/RT */
bfd_arch_alliant, /* Alliant */
bfd_arch_convex, /* Convex */
bfd_arch_m88k, /* Motorola 88xxx */
bfd_arch_m98k, /* Motorola 98xxx */
@ -190,12 +203,20 @@ enum bfd_architecture
#define bfd_mach_sh 1
#define bfd_mach_sh2 0x20
#define bfd_mach_sh_dsp 0x2d
#define bfd_mach_sh2a 0x2a
#define bfd_mach_sh2a_nofpu 0x2b
#define bfd_mach_sh2a_nofpu_or_sh4_nommu_nofpu 0x2a1
#define bfd_mach_sh2a_nofpu_or_sh3_nommu 0x2a2
#define bfd_mach_sh2a_or_sh4 0x2a3
#define bfd_mach_sh2a_or_sh3e 0x2a4
#define bfd_mach_sh2e 0x2e
#define bfd_mach_sh3 0x30
#define bfd_mach_sh3_nommu 0x31
#define bfd_mach_sh3_dsp 0x3d
#define bfd_mach_sh3e 0x3e
#define bfd_mach_sh4 0x40
#define bfd_mach_sh4_nofpu 0x41
#define bfd_mach_sh4_nommu_nofpu 0x42
#define bfd_mach_sh4a 0x4a
#define bfd_mach_sh4a_nofpu 0x4b
#define bfd_mach_sh4al_dsp 0x4d
@ -235,6 +256,9 @@ enum bfd_architecture
#define bfd_mach_arc_6 6
#define bfd_mach_arc_7 7
#define bfd_mach_arc_8 8
bfd_arch_m32c, /* Renesas M16C/M32C. */
#define bfd_mach_m16c 0x75
#define bfd_mach_m32c 0x78
bfd_arch_m32r, /* Renesas M32R (formerly Mitsubishi M32R/D) */
#define bfd_mach_m32r 1 /* For backwards compatibility. */
#define bfd_mach_m32rx 'x'
@ -251,6 +275,7 @@ enum bfd_architecture
#define bfd_mach_frvsimple 2
#define bfd_mach_fr300 300
#define bfd_mach_fr400 400
#define bfd_mach_fr450 450
#define bfd_mach_frvtomcat 499 /* fr500 prototype */
#define bfd_mach_fr500 500
#define bfd_mach_fr550 550
@ -264,6 +289,10 @@ enum bfd_architecture
bfd_arch_iq2000, /* Vitesse IQ2000. */
#define bfd_mach_iq2000 1
#define bfd_mach_iq10 2
bfd_arch_mt,
#define bfd_mach_ms1 1
#define bfd_mach_mrisc2 2
#define bfd_mach_ms2 3
bfd_arch_pj,
bfd_arch_avr, /* Atmel AVR microcontrollers. */
#define bfd_mach_avr1 1
@ -271,7 +300,16 @@ enum bfd_architecture
#define bfd_mach_avr3 3
#define bfd_mach_avr4 4
#define bfd_mach_avr5 5
bfd_arch_bfin, /* ADI Blackfin */
#define bfd_mach_bfin 1
bfd_arch_cr16c, /* National Semiconductor CompactRISC. */
#define bfd_mach_cr16c 1
bfd_arch_crx, /* National Semiconductor CRX. */
#define bfd_mach_crx 1
bfd_arch_cris, /* Axis CRIS */
#define bfd_mach_cris_v0_v10 255
#define bfd_mach_cris_v32 32
#define bfd_mach_cris_v10_v32 1032
bfd_arch_s390, /* IBM s390 */
#define bfd_mach_s390_31 31
#define bfd_mach_s390_64 64
@ -286,7 +324,8 @@ enum bfd_architecture
#define bfd_mach_msp13 13
#define bfd_mach_msp14 14
#define bfd_mach_msp15 15
#define bfd_mach_msp16 16
#define bfd_mach_msp16 16
#define bfd_mach_msp21 21
#define bfd_mach_msp31 31
#define bfd_mach_msp32 32
#define bfd_mach_msp33 33
@ -294,8 +333,20 @@ enum bfd_architecture
#define bfd_mach_msp42 42
#define bfd_mach_msp43 43
#define bfd_mach_msp44 44
bfd_arch_xc16x, /* Infineon's XC16X Series. */
#define bfd_mach_xc16x 1
#define bfd_mach_xc16xl 2
#define bfd_mach_xc16xs 3
bfd_arch_xtensa, /* Tensilica's Xtensa cores. */
#define bfd_mach_xtensa 1
bfd_arch_maxq, /* Dallas MAXQ 10/20 */
#define bfd_mach_maxq10 10
#define bfd_mach_maxq20 20
bfd_arch_z80,
#define bfd_mach_z80strict 1 /* No undocumented opcodes. */
#define bfd_mach_z80 3 /* With ixl, ixh, iyl, and iyh. */
#define bfd_mach_z80full 7 /* All undocumented instructions. */
#define bfd_mach_r800 11 /* R800: successor with multiplication. */
bfd_arch_last
@};
@end example

View file

@ -1,22 +1,9 @@
\input texinfo.tex
@setfilename bfd.info
@c Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1997, 2000, 2003
@c Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1997, 2000,
@c 2001, 2002, 2003
@c Free Software Foundation, Inc.
@c
@tex
% NOTE LOCAL KLUGE TO AVOID TOO MUCH WHITESPACE
\global\long\def\example{%
\begingroup
\let\aboveenvbreak=\par
\let\afterenvbreak=\par
\parskip=0pt
\lisp}
\global\long\def\Eexample{%
\Elisp
\endgroup
\vskip -\parskip% to cancel out effect of following \par
}
@end tex
@synindex fn cp
@ifinfo

View file

@ -1,6 +1,6 @@
\input texinfo
@c Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998,
@c 2000, 2001, 2002, 2003
@c 2000, 2001, 2002, 2003, 2004
@c Free Software Foundation, Inc.
@setfilename bfdint.info

View file

@ -1,3 +1,34 @@
@findex struct bfd_iovec
@subsubsection @code{struct bfd_iovec}
@strong{Description}@*
The @code{struct bfd_iovec} contains the internal file I/O class.
Each @code{BFD} has an instance of this class and all file I/O is
routed through it (it is assumed that the instance implements
all methods listed below).
@example
struct bfd_iovec
@{
/* To avoid problems with macros, a "b" rather than "f"
prefix is prepended to each method name. */
/* Attempt to read/write NBYTES on ABFD's IOSTREAM storing/fetching
bytes starting at PTR. Return the number of bytes actually
transfered (a read past end-of-file returns less than NBYTES),
or -1 (setting @code{bfd_error}) if an error occurs. */
file_ptr (*bread) (struct bfd *abfd, void *ptr, file_ptr nbytes);
file_ptr (*bwrite) (struct bfd *abfd, const void *ptr,
file_ptr nbytes);
/* Return the current IOSTREAM file offset, or -1 (setting @code{bfd_error}
if an error occurs. */
file_ptr (*btell) (struct bfd *abfd);
/* For the following, on successful completion a value of 0 is returned.
Otherwise, a value of -1 is returned (and @code{bfd_error} is set). */
int (*bseek) (struct bfd *abfd, file_ptr offset, int whence);
int (*bclose) (struct bfd *abfd);
int (*bflush) (struct bfd *abfd);
int (*bstat) (struct bfd *abfd, struct stat *sb);
@};
@end example
@findex bfd_get_mtime
@subsubsection @code{bfd_get_mtime}
@strong{Synopsis}

View file

@ -21,14 +21,10 @@ struct bfd
/* A pointer to the target jump table. */
const struct bfd_target *xvec;
/* To avoid dragging too many header files into every file that
includes `@code{bfd.h}', IOSTREAM has been declared as a "char *",
and MTIME as a "long". Their correct types, to which they
are cast when used, are "FILE *" and "time_t". The iostream
is the result of an fopen on the filename. However, if the
BFD_IN_MEMORY flag is set, then iostream is actually a pointer
to a bfd_in_memory struct. */
/* The IOSTREAM, and corresponding IO vector that provide access
to the file backing the BFD. */
void *iostream;
const struct bfd_iovec *iovec;
/* Is the file descriptor being cached? That is, can it be closed as
needed, and re-opened when accessed later? */
@ -91,8 +87,8 @@ struct bfd
/* Pointer to linked list of sections. */
struct bfd_section *sections;
/* The place where we add to the section list. */
struct bfd_section **section_tail;
/* The last section on the section list. */
struct bfd_section *section_last;
/* The number of sections. */
unsigned int section_count;
@ -113,6 +109,9 @@ struct bfd
/* Pointer to structure which contains architecture information. */
const struct bfd_arch_info *arch_info;
/* Flag set if symbols from this BFD should not be exported. */
bfd_boolean no_export;
/* Stuff only useful for archives. */
void *arelt_data;
struct bfd *my_archive; /* The containing archive BFD. */
@ -307,18 +306,10 @@ bfd_error_handler_type bfd_get_error_handler (void);
@strong{Description}@*
Return the BFD error handler function.
@findex bfd_archive_filename
@subsubsection @code{bfd_archive_filename}
@strong{Synopsis}
@example
const char *bfd_archive_filename (bfd *);
@end example
@strong{Description}@*
For a BFD that is a component of an archive, returns a string
with both the archive name and file name. For other BFDs, just
returns the file name.
@section Miscellaneous
@section Symbols
@subsection Miscellaneous functions
@findex bfd_get_reloc_upper_bound
@ -472,6 +463,31 @@ in octal if a leading zero is found, otherwise in decimal.
If the value would overflow, the maximum @code{bfd_vma} value is
returned.
@findex bfd_copy_private_header_data
@subsubsection @code{bfd_copy_private_header_data}
@strong{Synopsis}
@example
bfd_boolean bfd_copy_private_header_data (bfd *ibfd, bfd *obfd);
@end example
@strong{Description}@*
Copy private BFD header information from the BFD @var{ibfd} to the
the BFD @var{obfd}. This copies information that may require
sections to exist, but does not require symbol tables. Return
@code{true} on success, @code{false} on error.
Possible error returns are:
@itemize @bullet
@item
@code{bfd_error_no_memory} -
Not enough memory exists to create private data for @var{obfd}.
@end itemize
@example
#define bfd_copy_private_header_data(ibfd, obfd) \
BFD_SEND (obfd, _bfd_copy_private_header_data, \
(ibfd, obfd))
@end example
@findex bfd_copy_private_bfd_data
@subsubsection @code{bfd_copy_private_bfd_data}
@strong{Synopsis}
@ -552,6 +568,14 @@ The following functions exist but have not yet been documented.
BFD_SEND (abfd, _bfd_find_nearest_line, \
(abfd, sec, syms, off, file, func, line))
#define bfd_find_line(abfd, syms, sym, file, line) \
BFD_SEND (abfd, _bfd_find_line, \
(abfd, syms, sym, file, line))
#define bfd_find_inliner_info(abfd, file, func, line) \
BFD_SEND (abfd, _bfd_find_inliner_info, \
(abfd, file, func, line))
#define bfd_debug_info_start(abfd) \
BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
@ -579,6 +603,9 @@ The following functions exist but have not yet been documented.
#define bfd_merge_sections(abfd, link_info) \
BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
#define bfd_is_group_section(abfd, sec) \
BFD_SEND (abfd, _bfd_is_group_section, (abfd, sec))
#define bfd_discard_group(abfd, sec) \
BFD_SEND (abfd, _bfd_discard_group, (abfd, sec))
@ -591,7 +618,7 @@ The following functions exist but have not yet been documented.
#define bfd_link_add_symbols(abfd, info) \
BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
#define bfd_link_just_syms(sec, info) \
#define bfd_link_just_syms(abfd, sec, info) \
BFD_SEND (abfd, _bfd_link_just_syms, (sec, info))
#define bfd_final_link(abfd, info) \
@ -609,6 +636,10 @@ The following functions exist but have not yet been documented.
#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \
BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols))
#define bfd_get_synthetic_symtab(abfd, count, syms, dyncount, dynsyms, ret) \
BFD_SEND (abfd, _bfd_get_synthetic_symtab, (abfd, count, syms, \
dyncount, dynsyms, ret))
#define bfd_get_dynamic_reloc_upper_bound(abfd) \
BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd))
@ -643,7 +674,7 @@ struct bfd_preserve
flagword flags;
const struct bfd_arch_info *arch_info;
struct bfd_section *sections;
struct bfd_section **section_tail;
struct bfd_section *section_last;
unsigned int section_count;
struct bfd_hash_table section_htab;
@};

View file

@ -10,39 +10,8 @@ the required BFD is open. If not, then it chooses a file to
close, closes it and opens the one wanted, returning its file
handle.
@findex BFD_CACHE_MAX_OPEN macro
@subsubsection @code{BFD_CACHE_MAX_OPEN macro}
@strong{Description}@*
The maximum number of files which the cache will keep open at
one time.
@example
#define BFD_CACHE_MAX_OPEN 10
@end example
@subsection Caching functions
@findex bfd_last_cache
@subsubsection @code{bfd_last_cache}
@strong{Synopsis}
@example
extern bfd *bfd_last_cache;
@end example
@strong{Description}@*
Zero, or a pointer to the topmost BFD on the chain. This is
used by the @code{bfd_cache_lookup} macro in @file{libbfd.h} to
determine when it can avoid a function call.
@findex bfd_cache_lookup
@subsubsection @code{bfd_cache_lookup}
@strong{Description}@*
Check to see if the required BFD is the same as the last one
looked up. If so, then it can use the stream in the BFD with
impunity, since it can't have changed since the last lookup;
otherwise, it has to perform the complicated lookup function.
@example
#define bfd_cache_lookup(x) \
((x)==bfd_last_cache? \
(FILE*) (bfd_last_cache->iostream): \
bfd_cache_lookup_worker(x))
@end example
@findex bfd_cache_init
@subsubsection @code{bfd_cache_init}
@ -67,6 +36,20 @@ then close it too.
@code{FALSE} is returned if closing the file fails, @code{TRUE} is
returned if all is well.
@findex bfd_cache_close_all
@subsubsection @code{bfd_cache_close_all}
@strong{Synopsis}
@example
bfd_boolean bfd_cache_close_all (void);
@end example
@strong{Description}@*
Remove all BFDs from the cache. If the attached file is open,
then close it too.
@strong{Returns}@*
@code{FALSE} is returned if closing one of the file fails, @code{TRUE} is
returned if all is well.
@findex bfd_open_file
@subsubsection @code{bfd_open_file}
@strong{Synopsis}
@ -80,16 +63,3 @@ BFD so that future accesses know the file is open. If the @code{FILE *}
returned is @code{NULL}, then it won't have been put in the
cache, so it won't have to be removed from it.
@findex bfd_cache_lookup_worker
@subsubsection @code{bfd_cache_lookup_worker}
@strong{Synopsis}
@example
FILE *bfd_cache_lookup_worker (bfd *abfd);
@end example
@strong{Description}@*
Called when the macro @code{bfd_cache_lookup} fails to find a
quick answer. Find a file descriptor for @var{abfd}. If
necessary, it open it. If there are already more than
@code{BFD_CACHE_MAX_OPEN} files open, it tries to close one first, to
avoid running out of file descriptors.

View file

@ -1,6 +1,6 @@
/* chew
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001,
2002, 2003
2002, 2003, 2005
Free Software Foundation, Inc.
Contributed by steve chamberlain @cygnus
@ -18,7 +18,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* Yet another way of extracting documentation from source.
No, I haven't finished it yet, but I hope you people like it better
@ -83,10 +83,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foo. */
#include "ansidecl.h"
#include "sysdep.h"
#include <assert.h>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#define DEF_SIZE 5000
#define STACK 50
@ -588,45 +589,6 @@ translatecomments ()
pc++;
}
#if 0
/* This is not currently used. */
/* turn everything not starting with a . into a comment */
static void
manglecomments ()
{
unsigned int idx = 0;
string_type out;
init_string (&out);
while (at (tos, idx))
{
if (at (tos, idx) == '\n' && at (tos, idx + 1) == '*')
{
cattext (&out, " /*");
idx += 2;
}
else if (at (tos, idx) == '*' && at (tos, idx + 1) == '}')
{
cattext (&out, "*/");
idx += 2;
}
else
{
catchar (&out, at (tos, idx));
idx++;
}
}
overwrite_string (tos, &out);
pc++;
}
#endif
/* Mod tos so that only lines with leading dots remain */
static void
outputdots ()

View file

@ -288,34 +288,34 @@ Special entry points for gdb to swap in coff symbol table parts:
typedef struct
@{
void (*_bfd_coff_swap_aux_in)
PARAMS ((bfd *, PTR, int, int, int, int, PTR));
(bfd *, void *, int, int, int, int, void *);
void (*_bfd_coff_swap_sym_in)
PARAMS ((bfd *, PTR, PTR));
(bfd *, void *, void *);
void (*_bfd_coff_swap_lineno_in)
PARAMS ((bfd *, PTR, PTR));
(bfd *, void *, void *);
unsigned int (*_bfd_coff_swap_aux_out)
PARAMS ((bfd *, PTR, int, int, int, int, PTR));
(bfd *, void *, int, int, int, int, void *);
unsigned int (*_bfd_coff_swap_sym_out)
PARAMS ((bfd *, PTR, PTR));
(bfd *, void *, void *);
unsigned int (*_bfd_coff_swap_lineno_out)
PARAMS ((bfd *, PTR, PTR));
(bfd *, void *, void *);
unsigned int (*_bfd_coff_swap_reloc_out)
PARAMS ((bfd *, PTR, PTR));
(bfd *, void *, void *);
unsigned int (*_bfd_coff_swap_filehdr_out)
PARAMS ((bfd *, PTR, PTR));
(bfd *, void *, void *);
unsigned int (*_bfd_coff_swap_aouthdr_out)
PARAMS ((bfd *, PTR, PTR));
(bfd *, void *, void *);
unsigned int (*_bfd_coff_swap_scnhdr_out)
PARAMS ((bfd *, PTR, PTR));
(bfd *, void *, void *);
unsigned int _bfd_filhsz;
unsigned int _bfd_aoutsz;
@ -332,86 +332,86 @@ typedef struct
unsigned int _bfd_coff_debug_string_prefix_length;
void (*_bfd_coff_swap_filehdr_in)
PARAMS ((bfd *, PTR, PTR));
(bfd *, void *, void *);
void (*_bfd_coff_swap_aouthdr_in)
PARAMS ((bfd *, PTR, PTR));
(bfd *, void *, void *);
void (*_bfd_coff_swap_scnhdr_in)
PARAMS ((bfd *, PTR, PTR));
(bfd *, void *, void *);
void (*_bfd_coff_swap_reloc_in)
PARAMS ((bfd *abfd, PTR, PTR));
(bfd *abfd, void *, void *);
bfd_boolean (*_bfd_coff_bad_format_hook)
PARAMS ((bfd *, PTR));
(bfd *, void *);
bfd_boolean (*_bfd_coff_set_arch_mach_hook)
PARAMS ((bfd *, PTR));
(bfd *, void *);
PTR (*_bfd_coff_mkobject_hook)
PARAMS ((bfd *, PTR, PTR));
void * (*_bfd_coff_mkobject_hook)
(bfd *, void *, void *);
bfd_boolean (*_bfd_styp_to_sec_flags_hook)
PARAMS ((bfd *, PTR, const char *, asection *, flagword *));
(bfd *, void *, const char *, asection *, flagword *);
void (*_bfd_set_alignment_hook)
PARAMS ((bfd *, asection *, PTR));
(bfd *, asection *, void *);
bfd_boolean (*_bfd_coff_slurp_symbol_table)
PARAMS ((bfd *));
(bfd *);
bfd_boolean (*_bfd_coff_symname_in_debug)
PARAMS ((bfd *, struct internal_syment *));
(bfd *, struct internal_syment *);
bfd_boolean (*_bfd_coff_pointerize_aux_hook)
PARAMS ((bfd *, combined_entry_type *, combined_entry_type *,
unsigned int, combined_entry_type *));
(bfd *, combined_entry_type *, combined_entry_type *,
unsigned int, combined_entry_type *);
bfd_boolean (*_bfd_coff_print_aux)
PARAMS ((bfd *, FILE *, combined_entry_type *, combined_entry_type *,
combined_entry_type *, unsigned int));
(bfd *, FILE *, combined_entry_type *, combined_entry_type *,
combined_entry_type *, unsigned int);
void (*_bfd_coff_reloc16_extra_cases)
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *,
bfd_byte *, unsigned int *, unsigned int *));
(bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *,
bfd_byte *, unsigned int *, unsigned int *);
int (*_bfd_coff_reloc16_estimate)
PARAMS ((bfd *, asection *, arelent *, unsigned int,
struct bfd_link_info *));
(bfd *, asection *, arelent *, unsigned int,
struct bfd_link_info *);
enum coff_symbol_classification (*_bfd_coff_classify_symbol)
PARAMS ((bfd *, struct internal_syment *));
(bfd *, struct internal_syment *);
bfd_boolean (*_bfd_coff_compute_section_file_positions)
PARAMS ((bfd *));
(bfd *);
bfd_boolean (*_bfd_coff_start_final_link)
PARAMS ((bfd *, struct bfd_link_info *));
(bfd *, struct bfd_link_info *);
bfd_boolean (*_bfd_coff_relocate_section)
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
struct internal_reloc *, struct internal_syment *, asection **));
(bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
struct internal_reloc *, struct internal_syment *, asection **);
reloc_howto_type *(*_bfd_coff_rtype_to_howto)
PARAMS ((bfd *, asection *, struct internal_reloc *,
(bfd *, asection *, struct internal_reloc *,
struct coff_link_hash_entry *, struct internal_syment *,
bfd_vma *));
bfd_vma *);
bfd_boolean (*_bfd_coff_adjust_symndx)
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
struct internal_reloc *, bfd_boolean *));
(bfd *, struct bfd_link_info *, bfd *, asection *,
struct internal_reloc *, bfd_boolean *);
bfd_boolean (*_bfd_coff_link_add_one_symbol)
PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword,
(struct bfd_link_info *, bfd *, const char *, flagword,
asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean,
struct bfd_link_hash_entry **));
struct bfd_link_hash_entry **);
bfd_boolean (*_bfd_coff_link_output_has_begun)
PARAMS ((bfd *, struct coff_final_link_info *));
(bfd *, struct coff_final_link_info *);
bfd_boolean (*_bfd_coff_final_link_postscript)
PARAMS ((bfd *, struct coff_final_link_info *));
(bfd *, struct coff_final_link_info *);
@} bfd_coff_backend_data;
@ -541,9 +541,9 @@ typedef struct
(info, abfd, name, flags, section, value, string, cp, coll, hashp))
#define bfd_coff_link_output_has_begun(a,p) \
((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a,p))
((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a, p))
#define bfd_coff_final_link_postscript(a,p) \
((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a,p))
((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a, p))
@end example
@subsubsection Writing relocations

View file

@ -1,6 +1,9 @@
@section Core files
@subsection Core file functions
@strong{Description}@*
These are functions pertaining to core files.
@ -36,3 +39,22 @@ Return @code{TRUE} if the core file attached to @var{core_bfd}
was generated by a run of the executable file attached to
@var{exec_bfd}, @code{FALSE} otherwise.
@findex generic_core_file_matches_executable_p
@subsubsection @code{generic_core_file_matches_executable_p}
@strong{Synopsis}
@example
bfd_boolean generic_core_file_matches_executable_p
(bfd *core_bfd, bfd *exec_bfd);
@end example
@strong{Description}@*
Return TRUE if the core file attached to @var{core_bfd}
was generated by a run of the executable file attached
to @var{exec_bfd}. The match is based on executable
basenames only.
Note: When not able to determine the core file failing
command or the executable name, we still return TRUE even
though we're not sure that core file and executable match.
This is to avoid generating a false warning in situations
where we really don't know whether they match or not.

View file

@ -1,6 +1,4 @@
@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

@ -3,8 +3,8 @@
@center Version 1.1, March 2000
@display
Copyright (C) 2000, Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Copyright (C) 2000, 2003 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

View file

@ -23,6 +23,9 @@ The BFD contains other BFDs and an optional index.
@end itemize
The BFD contains the result of an executable core dump.
@subsection File format functions
@findex bfd_check_format
@subsubsection @code{bfd_check_format}
@strong{Synopsis}

View file

@ -55,6 +55,10 @@ Use @code{bfd_hash_table_free} to free up all the memory that has
been allocated for a hash table. This will not free up the
@code{struct bfd_hash_table} itself, which you must provide.
@findex bfd_hash_set_default_size
Use @code{bfd_hash_set_default_size} to set the default size of
hash table to use.
@node Looking Up or Entering a String, Traversing a Hash Table, Creating and Freeing a Hash Table, Hash Tables
@subsection Looking up or entering a string
@findex bfd_hash_lookup
@ -178,20 +182,18 @@ from.
@example
struct bfd_hash_entry *
@var{function_name} (entry, table, string)
struct bfd_hash_entry *entry;
struct bfd_hash_table *table;
const char *string;
@var{function_name} (struct bfd_hash_entry *entry,
struct bfd_hash_table *table,
const char *string)
@{
struct @var{entry_type} *ret = (@var{entry_type} *) entry;
/* Allocate the structure if it has not already been allocated by a
derived class. */
if (ret == (@var{entry_type} *) NULL)
if (ret == NULL)
@{
ret = ((@var{entry_type} *)
bfd_hash_allocate (table, sizeof (@var{entry_type})));
if (ret == (@var{entry_type} *) NULL)
ret = bfd_hash_allocate (table, sizeof (* ret));
if (ret == NULL)
return NULL;
@}

View file

@ -1,4 +1,7 @@
@section Initialization
@subsection Initialization functions
These are the functions that handle initializing a BFD.
@findex bfd_init

View file

@ -1,4 +1,7 @@
@section Internal functions
@section Implementation details
@subsection Internal functions
@strong{Description}@*

View file

@ -258,7 +258,7 @@ link. These files are linked through the @code{link_next} field
of the @code{bfd} structure.
Each section in the output file will have a list of
@code{link_order} structures attached to the @code{link_order_head}
@code{link_order} structures attached to the @code{map_head.link_order}
field (the @code{link_order} structure is defined in
@code{bfdlink.h}). These structures describe how to create the
contents of the output section in terms of the contents of
@ -363,3 +363,18 @@ reloceatable or final link.
@end example
@findex bfd_section_already_linked
@subsubsection @code{bfd_section_already_linked}
@strong{Synopsis}
@example
void bfd_section_already_linked (bfd *abfd, asection *sec);
@end example
@strong{Description}@*
Check if @var{sec} has been already linked during a reloceatable
or final link.
@example
#define bfd_section_already_linked(abfd, sec) \
BFD_SEND (abfd, _section_already_linked, (abfd, sec))
@end example

View file

@ -32,6 +32,12 @@ it is used for code (and constants) and the area
@samp{0x2000@dots{}00} to @samp{0x20ff@dots{}ff} is used for
writable data. @xref{mmo section mapping}.
There is provision for specifying ``special data'' of 65536
different types. We use type 80 (decimal), arbitrarily chosen the
same as the ELF @code{e_machine} number for MMIX, filling it with
section information normally found in ELF objects. @xref{mmo
section mapping}.
Contents is entered as 32-bit words, xor:ed over previous
contents, always zero-initialized. A word that starts with the
byte @samp{0x98} forms a command called a @samp{lopcode}, where
@ -42,12 +48,6 @@ various purposes different for each lopcode. As documented in
@url{http://www-cs-faculty.stanford.edu/~knuth/mmixal-intro.ps.gz},
the lopcodes are:
There is provision for specifying ``special data'' of 65536
different types. We use type 80 (decimal), arbitrarily chosen the
same as the ELF @code{e_machine} number for MMIX, filling it with
section information normally found in ELF objects. @xref{mmo
section mapping}.
@table @code
@item lop_quote
0x98000001. The next word is contents, regardless of whether it

View file

@ -1,6 +1,32 @@
@section Opening and closing BFDs
@subsection Functions for opening and closing
@findex bfd_fopen
@subsubsection @code{bfd_fopen}
@strong{Synopsis}
@example
bfd *bfd_fopen (const char *filename, const char *target,
const char *mode, int fd);
@end example
@strong{Description}@*
Open the file @var{filename} with the target @var{target}.
Return a pointer to the created BFD. If @var{fd} is not -1,
then @code{fdopen} is used to open the file; otherwise, @code{fopen}
is used. @var{mode} is passed directly to @code{fopen} or
@code{fdopen}.
Calls @code{bfd_find_target}, so @var{target} is interpreted as by
that function.
The new BFD is marked as cacheable iff @var{fd} is -1.
If @code{NULL} is returned then an error has occured. Possible errors
are @code{bfd_error_no_memory}, @code{bfd_error_invalid_target} or
@code{system_call} error.
@findex bfd_openr
@subsubsection @code{bfd_openr}
@strong{Synopsis}
@ -52,6 +78,50 @@ bfd *bfd_openstreamr (const char *, const char *, void *);
Open a BFD for read access on an existing stdio stream. When
the BFD is passed to @code{bfd_close}, the stream will be closed.
@findex bfd_openr_iovec
@subsubsection @code{bfd_openr_iovec}
@strong{Synopsis}
@example
bfd *bfd_openr_iovec (const char *filename, const char *target,
void *(*open) (struct bfd *nbfd,
void *open_closure),
void *open_closure,
file_ptr (*pread) (struct bfd *nbfd,
void *stream,
void *buf,
file_ptr nbytes,
file_ptr offset),
int (*close) (struct bfd *nbfd,
void *stream));
@end example
@strong{Description}@*
Create and return a BFD backed by a read-only @var{stream}.
The @var{stream} is created using @var{open}, accessed using
@var{pread} and destroyed using @var{close}.
Calls @code{bfd_find_target}, so @var{target} is interpreted as by
that function.
Calls @var{open} (which can call @code{bfd_zalloc} and
@code{bfd_get_filename}) to obtain the read-only stream backing
the BFD. @var{open} either succeeds returning the
non-@code{NULL} @var{stream}, or fails returning @code{NULL}
(setting @code{bfd_error}).
Calls @var{pread} to request @var{nbytes} of data from
@var{stream} starting at @var{offset} (e.g., via a call to
@code{bfd_read}). @var{pread} either succeeds returning the
number of bytes read (which can be less than @var{nbytes} when
end-of-file), or fails returning -1 (setting @code{bfd_error}).
Calls @var{close} when the BFD is later closed using
@code{bfd_close}. @var{close} either succeeds returning 0, or
fails returning -1 (setting @code{bfd_error}).
If @code{bfd_openr_iovec} returns @code{NULL} then an error has
occurred. Possible errors are @code{bfd_error_no_memory},
@code{bfd_error_invalid_target} and @code{bfd_error_system_call}.
@findex bfd_openw
@subsubsection @code{bfd_openw}
@strong{Synopsis}
@ -151,12 +221,42 @@ direction.
@subsubsection @code{bfd_alloc}
@strong{Synopsis}
@example
void *bfd_alloc (bfd *abfd, size_t wanted);
void *bfd_alloc (bfd *abfd, bfd_size_type wanted);
@end example
@strong{Description}@*
Allocate a block of @var{wanted} bytes of memory attached to
@code{abfd} and return a pointer to it.
@findex bfd_alloc2
@subsubsection @code{bfd_alloc2}
@strong{Synopsis}
@example
void *bfd_alloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size);
@end example
@strong{Description}@*
Allocate a block of @var{nmemb} elements of @var{size} bytes each
of memory attached to @code{abfd} and return a pointer to it.
@findex bfd_zalloc
@subsubsection @code{bfd_zalloc}
@strong{Synopsis}
@example
void *bfd_zalloc (bfd *abfd, bfd_size_type wanted);
@end example
@strong{Description}@*
Allocate a block of @var{wanted} bytes of zeroed memory
attached to @code{abfd} and return a pointer to it.
@findex bfd_zalloc2
@subsubsection @code{bfd_zalloc2}
@strong{Synopsis}
@example
void *bfd_zalloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size);
@end example
@strong{Description}@*
Allocate a block of @var{nmemb} elements of @var{size} bytes each
of zeroed memory attached to @code{abfd} and return a pointer to it.
@findex bfd_calc_gnu_debuglink_crc32
@subsubsection @code{bfd_calc_gnu_debuglink_crc32}
@strong{Synopsis}

View file

@ -236,11 +236,12 @@ enum complain_overflow
/* Do not complain on overflow. */
complain_overflow_dont,
/* Complain if the bitfield overflows, whether it is considered
as signed or unsigned. */
/* Complain if the value overflows when considered as a signed
number one bit larger than the field. ie. A bitfield of N bits
is allowed to represent -2**n to 2**n-1. */
complain_overflow_bitfield,
/* Complain if the value overflows when considered as signed
/* Complain if the value overflows when considered as a signed
number. */
complain_overflow_signed,
@ -486,7 +487,7 @@ assembler.
@node howto manager, , typedef arelent, Relocations
@section The howto manager
@subsection The howto manager
When an application wants to create a relocation, but doesn't
know what the target machine might call it, it can find out by
using this bit of code.
@ -526,6 +527,9 @@ the section containing the relocation. It depends on the specific target.
The 24-bit relocation is used in some Intel 960 configurations.
@end deffn
@deffn {} BFD_RELOC_32_SECREL
Section relative relocations. Some targets need this for DWARF2.
@end deffn
@deffn {} BFD_RELOC_32_GOT_PCREL
@deffnx {} BFD_RELOC_16_GOT_PCREL
@deffnx {} BFD_RELOC_8_GOT_PCREL
@ -776,11 +780,26 @@ to compensate for the borrow when the low bits are added.
@deffn {} BFD_RELOC_LO16
Low 16 bits.
@end deffn
@deffn {} BFD_RELOC_PCREL_HI16_S
Like BFD_RELOC_HI16_S, but PC relative.
@deffn {} BFD_RELOC_HI16_PCREL
High 16 bits of 32-bit pc-relative value
@end deffn
@deffn {} BFD_RELOC_PCREL_LO16
Like BFD_RELOC_LO16, but PC relative.
@deffn {} BFD_RELOC_HI16_S_PCREL
High 16 bits of 32-bit pc-relative value, adjusted
@end deffn
@deffn {} BFD_RELOC_LO16_PCREL
Low 16 bits of pc-relative value
@end deffn
@deffn {} BFD_RELOC_MIPS16_HI16
MIPS16 high 16 bits of 32-bit value.
@end deffn
@deffn {} BFD_RELOC_MIPS16_HI16_S
MIPS16 high 16 bits of 32-bit value but the low 16 bits will be sign
extended and added to form the final result. If the low 16
bits form a negative number, we need to add one to the high value
to compensate for the borrow when the low bits are added.
@end deffn
@deffn {} BFD_RELOC_MIPS16_LO16
MIPS16 low 16 bits.
@end deffn
@deffn {} BFD_RELOC_MIPS_LITERAL
Relocation against a MIPS literal section.
@ -806,8 +825,25 @@ Relocation against a MIPS literal section.
@deffnx {} BFD_RELOC_MIPS_REL16
@deffnx {} BFD_RELOC_MIPS_RELGOT
@deffnx {} BFD_RELOC_MIPS_JALR
@deffnx {} BFD_RELOC_MIPS_TLS_DTPMOD32
@deffnx {} BFD_RELOC_MIPS_TLS_DTPREL32
@deffnx {} BFD_RELOC_MIPS_TLS_DTPMOD64
@deffnx {} BFD_RELOC_MIPS_TLS_DTPREL64
@deffnx {} BFD_RELOC_MIPS_TLS_GD
@deffnx {} BFD_RELOC_MIPS_TLS_LDM
@deffnx {} BFD_RELOC_MIPS_TLS_DTPREL_HI16
@deffnx {} BFD_RELOC_MIPS_TLS_DTPREL_LO16
@deffnx {} BFD_RELOC_MIPS_TLS_GOTTPREL
@deffnx {} BFD_RELOC_MIPS_TLS_TPREL32
@deffnx {} BFD_RELOC_MIPS_TLS_TPREL64
@deffnx {} BFD_RELOC_MIPS_TLS_TPREL_HI16
@deffnx {} BFD_RELOC_MIPS_TLS_TPREL_LO16
MIPS ELF relocations.
@end deffn
@deffn {} BFD_RELOC_MIPS_COPY
@deffnx {} BFD_RELOC_MIPS_JUMP_SLOT
MIPS ELF relocations (VxWorks extensions).
@end deffn
@deffn {} BFD_RELOC_FRV_LABEL16
@deffnx {} BFD_RELOC_FRV_LABEL24
@deffnx {} BFD_RELOC_FRV_LO16
@ -831,6 +867,22 @@ MIPS ELF relocations.
@deffnx {} BFD_RELOC_FRV_GOTOFF12
@deffnx {} BFD_RELOC_FRV_GOTOFFHI
@deffnx {} BFD_RELOC_FRV_GOTOFFLO
@deffnx {} BFD_RELOC_FRV_GETTLSOFF
@deffnx {} BFD_RELOC_FRV_TLSDESC_VALUE
@deffnx {} BFD_RELOC_FRV_GOTTLSDESC12
@deffnx {} BFD_RELOC_FRV_GOTTLSDESCHI
@deffnx {} BFD_RELOC_FRV_GOTTLSDESCLO
@deffnx {} BFD_RELOC_FRV_TLSMOFF12
@deffnx {} BFD_RELOC_FRV_TLSMOFFHI
@deffnx {} BFD_RELOC_FRV_TLSMOFFLO
@deffnx {} BFD_RELOC_FRV_GOTTLSOFF12
@deffnx {} BFD_RELOC_FRV_GOTTLSOFFHI
@deffnx {} BFD_RELOC_FRV_GOTTLSOFFLO
@deffnx {} BFD_RELOC_FRV_TLSOFF
@deffnx {} BFD_RELOC_FRV_TLSDESC_RELAX
@deffnx {} BFD_RELOC_FRV_GETTLSOFF_RELAX
@deffnx {} BFD_RELOC_FRV_TLSOFF_RELAX
@deffnx {} BFD_RELOC_FRV_TLSMOFF
Fujitsu Frv Relocations.
@end deffn
@deffn {} BFD_RELOC_MN10300_GOTOFF24
@ -880,6 +932,9 @@ Adjust by program base.
@deffnx {} BFD_RELOC_386_TLS_DTPMOD32
@deffnx {} BFD_RELOC_386_TLS_DTPOFF32
@deffnx {} BFD_RELOC_386_TLS_TPOFF32
@deffnx {} BFD_RELOC_386_TLS_GOTDESC
@deffnx {} BFD_RELOC_386_TLS_DESC_CALL
@deffnx {} BFD_RELOC_386_TLS_DESC
i386/elf relocations
@end deffn
@deffn {} BFD_RELOC_X86_64_GOT32
@ -898,6 +953,16 @@ i386/elf relocations
@deffnx {} BFD_RELOC_X86_64_DTPOFF32
@deffnx {} BFD_RELOC_X86_64_GOTTPOFF
@deffnx {} BFD_RELOC_X86_64_TPOFF32
@deffnx {} BFD_RELOC_X86_64_GOTOFF64
@deffnx {} BFD_RELOC_X86_64_GOTPC32
@deffnx {} BFD_RELOC_X86_64_GOT64
@deffnx {} BFD_RELOC_X86_64_GOTPCREL64
@deffnx {} BFD_RELOC_X86_64_GOTPC64
@deffnx {} BFD_RELOC_X86_64_GOTPLT64
@deffnx {} BFD_RELOC_X86_64_PLTOFF64
@deffnx {} BFD_RELOC_X86_64_GOTPC32_TLSDESC
@deffnx {} BFD_RELOC_X86_64_TLSDESC_CALL
@deffnx {} BFD_RELOC_X86_64_TLSDESC
x86-64/elf relocations
@end deffn
@deffn {} BFD_RELOC_NS32K_IMM_8
@ -1045,38 +1110,104 @@ Thumb 22 bit pc-relative branch. The lowest bit must be zero and is
not stored in the instruction. The 2nd lowest bit comes from a 1 bit
field in the instruction.
@end deffn
@deffn {} BFD_RELOC_ARM_PCREL_CALL
ARM 26-bit pc-relative branch for an unconditional BL or BLX instruction.
@end deffn
@deffn {} BFD_RELOC_ARM_PCREL_JUMP
ARM 26-bit pc-relative branch for B or conditional BL instruction.
@end deffn
@deffn {} BFD_RELOC_THUMB_PCREL_BRANCH7
@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH9
@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH12
@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH20
@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH23
@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH25
Thumb 7-, 9-, 12-, 20-, 23-, and 25-bit pc-relative branches.
The lowest bit must be zero and is not stored in the instruction.
Note that the corresponding ELF R_ARM_THM_JUMPnn constant has an
"nn" one smaller in all cases. Note further that BRANCH23
corresponds to R_ARM_THM_CALL.
@end deffn
@deffn {} BFD_RELOC_ARM_OFFSET_IMM
12-bit immediate offset, used in ARM-format ldr and str instructions.
@end deffn
@deffn {} BFD_RELOC_ARM_THUMB_OFFSET
5-bit immediate offset, used in Thumb-format ldr and str instructions.
@end deffn
@deffn {} BFD_RELOC_ARM_TARGET1
Pc-relative or absolute relocation depending on target. Used for
entries in .init_array sections.
@end deffn
@deffn {} BFD_RELOC_ARM_ROSEGREL32
Read-only segment base relative address.
@end deffn
@deffn {} BFD_RELOC_ARM_SBREL32
Data segment base relative address.
@end deffn
@deffn {} BFD_RELOC_ARM_TARGET2
This reloc is used for references to RTTI data from exception handling
tables. The actual definition depends on the target. It may be a
pc-relative or some form of GOT-indirect relocation.
@end deffn
@deffn {} BFD_RELOC_ARM_PREL31
31-bit PC relative address.
@end deffn
@deffn {} BFD_RELOC_ARM_JUMP_SLOT
@deffnx {} BFD_RELOC_ARM_GLOB_DAT
@deffnx {} BFD_RELOC_ARM_GOT32
@deffnx {} BFD_RELOC_ARM_PLT32
@deffnx {} BFD_RELOC_ARM_RELATIVE
@deffnx {} BFD_RELOC_ARM_GOTOFF
@deffnx {} BFD_RELOC_ARM_GOTPC
Relocations for setting up GOTs and PLTs for shared libraries.
@end deffn
@deffn {} BFD_RELOC_ARM_TLS_GD32
@deffnx {} BFD_RELOC_ARM_TLS_LDO32
@deffnx {} BFD_RELOC_ARM_TLS_LDM32
@deffnx {} BFD_RELOC_ARM_TLS_DTPOFF32
@deffnx {} BFD_RELOC_ARM_TLS_DTPMOD32
@deffnx {} BFD_RELOC_ARM_TLS_TPOFF32
@deffnx {} BFD_RELOC_ARM_TLS_IE32
@deffnx {} BFD_RELOC_ARM_TLS_LE32
ARM thread-local storage relocations.
@end deffn
@deffn {} BFD_RELOC_ARM_IMMEDIATE
@deffnx {} BFD_RELOC_ARM_ADRL_IMMEDIATE
@deffnx {} BFD_RELOC_ARM_OFFSET_IMM
@deffnx {} BFD_RELOC_ARM_T32_IMMEDIATE
@deffnx {} BFD_RELOC_ARM_T32_IMM12
@deffnx {} BFD_RELOC_ARM_T32_ADD_PC12
@deffnx {} BFD_RELOC_ARM_SHIFT_IMM
@deffnx {} BFD_RELOC_ARM_SMC
@deffnx {} BFD_RELOC_ARM_SWI
@deffnx {} BFD_RELOC_ARM_MULTI
@deffnx {} BFD_RELOC_ARM_CP_OFF_IMM
@deffnx {} BFD_RELOC_ARM_CP_OFF_IMM_S2
@deffnx {} BFD_RELOC_ARM_T32_CP_OFF_IMM
@deffnx {} BFD_RELOC_ARM_T32_CP_OFF_IMM_S2
@deffnx {} BFD_RELOC_ARM_ADR_IMM
@deffnx {} BFD_RELOC_ARM_LDR_IMM
@deffnx {} BFD_RELOC_ARM_LITERAL
@deffnx {} BFD_RELOC_ARM_IN_POOL
@deffnx {} BFD_RELOC_ARM_OFFSET_IMM8
@deffnx {} BFD_RELOC_ARM_T32_OFFSET_U8
@deffnx {} BFD_RELOC_ARM_T32_OFFSET_IMM
@deffnx {} BFD_RELOC_ARM_HWLITERAL
@deffnx {} BFD_RELOC_ARM_THUMB_ADD
@deffnx {} BFD_RELOC_ARM_THUMB_IMM
@deffnx {} BFD_RELOC_ARM_THUMB_SHIFT
@deffnx {} BFD_RELOC_ARM_THUMB_OFFSET
@deffnx {} BFD_RELOC_ARM_GOT12
@deffnx {} BFD_RELOC_ARM_GOT32
@deffnx {} BFD_RELOC_ARM_JUMP_SLOT
@deffnx {} BFD_RELOC_ARM_COPY
@deffnx {} BFD_RELOC_ARM_GLOB_DAT
@deffnx {} BFD_RELOC_ARM_PLT32
@deffnx {} BFD_RELOC_ARM_RELATIVE
@deffnx {} BFD_RELOC_ARM_GOTOFF
@deffnx {} BFD_RELOC_ARM_GOTPC
These relocs are only used within the ARM assembler. They are not
(at present) written to any object files.
@end deffn
@deffn {} BFD_RELOC_SH_PCDISP8BY2
@deffnx {} BFD_RELOC_SH_PCDISP12BY2
@deffnx {} BFD_RELOC_SH_IMM3
@deffnx {} BFD_RELOC_SH_IMM3U
@deffnx {} BFD_RELOC_SH_DISP12
@deffnx {} BFD_RELOC_SH_DISP12BY2
@deffnx {} BFD_RELOC_SH_DISP12BY4
@deffnx {} BFD_RELOC_SH_DISP12BY8
@deffnx {} BFD_RELOC_SH_DISP20
@deffnx {} BFD_RELOC_SH_DISP20BY8
@deffnx {} BFD_RELOC_SH_IMM4
@deffnx {} BFD_RELOC_SH_IMM4BY2
@deffnx {} BFD_RELOC_SH_IMM4BY4
@ -1159,12 +1290,6 @@ These relocs are only used within the ARM assembler. They are not
@deffnx {} BFD_RELOC_SH_TLS_TPOFF32
Renesas / SuperH SH relocs. Not all of these appear in object files.
@end deffn
@deffn {} BFD_RELOC_THUMB_PCREL_BRANCH9
@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH12
@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH23
Thumb 23-, 12- and 9-bit pc-relative branches. The lowest bit must
be zero and is not stored in the instruction.
@end deffn
@deffn {} BFD_RELOC_ARC_B22_PCREL
ARC Cores relocs.
ARC 22 bit pc-relative branch. The lowest two bits must be zero and are
@ -1176,6 +1301,121 @@ ARC 26 bit absolute branch. The lowest two bits must be zero and are not
stored in the instruction. The high 24 bits are installed in bits 23
through 0.
@end deffn
@deffn {} BFD_RELOC_BFIN_16_IMM
ADI Blackfin 16 bit immediate absolute reloc.
@end deffn
@deffn {} BFD_RELOC_BFIN_16_HIGH
ADI Blackfin 16 bit immediate absolute reloc higher 16 bits.
@end deffn
@deffn {} BFD_RELOC_BFIN_4_PCREL
ADI Blackfin 'a' part of LSETUP.
@end deffn
@deffn {} BFD_RELOC_BFIN_5_PCREL
ADI Blackfin.
@end deffn
@deffn {} BFD_RELOC_BFIN_16_LOW
ADI Blackfin 16 bit immediate absolute reloc lower 16 bits.
@end deffn
@deffn {} BFD_RELOC_BFIN_10_PCREL
ADI Blackfin.
@end deffn
@deffn {} BFD_RELOC_BFIN_11_PCREL
ADI Blackfin 'b' part of LSETUP.
@end deffn
@deffn {} BFD_RELOC_BFIN_12_PCREL_JUMP
ADI Blackfin.
@end deffn
@deffn {} BFD_RELOC_BFIN_12_PCREL_JUMP_S
ADI Blackfin Short jump, pcrel.
@end deffn
@deffn {} BFD_RELOC_BFIN_24_PCREL_CALL_X
ADI Blackfin Call.x not implemented.
@end deffn
@deffn {} BFD_RELOC_BFIN_24_PCREL_JUMP_L
ADI Blackfin Long Jump pcrel.
@end deffn
@deffn {} BFD_RELOC_BFIN_GOT17M4
@deffnx {} BFD_RELOC_BFIN_GOTHI
@deffnx {} BFD_RELOC_BFIN_GOTLO
@deffnx {} BFD_RELOC_BFIN_FUNCDESC
@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOT17M4
@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOTHI
@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOTLO
@deffnx {} BFD_RELOC_BFIN_FUNCDESC_VALUE
@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOTOFF17M4
@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOTOFFHI
@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOTOFFLO
@deffnx {} BFD_RELOC_BFIN_GOTOFF17M4
@deffnx {} BFD_RELOC_BFIN_GOTOFFHI
@deffnx {} BFD_RELOC_BFIN_GOTOFFLO
ADI Blackfin FD-PIC relocations.
@end deffn
@deffn {} BFD_RELOC_BFIN_GOT
ADI Blackfin GOT relocation.
@end deffn
@deffn {} BFD_RELOC_BFIN_PLTPC
ADI Blackfin PLTPC relocation.
@end deffn
@deffn {} BFD_ARELOC_BFIN_PUSH
ADI Blackfin arithmetic relocation.
@end deffn
@deffn {} BFD_ARELOC_BFIN_CONST
ADI Blackfin arithmetic relocation.
@end deffn
@deffn {} BFD_ARELOC_BFIN_ADD
ADI Blackfin arithmetic relocation.
@end deffn
@deffn {} BFD_ARELOC_BFIN_SUB
ADI Blackfin arithmetic relocation.
@end deffn
@deffn {} BFD_ARELOC_BFIN_MULT
ADI Blackfin arithmetic relocation.
@end deffn
@deffn {} BFD_ARELOC_BFIN_DIV
ADI Blackfin arithmetic relocation.
@end deffn
@deffn {} BFD_ARELOC_BFIN_MOD
ADI Blackfin arithmetic relocation.
@end deffn
@deffn {} BFD_ARELOC_BFIN_LSHIFT
ADI Blackfin arithmetic relocation.
@end deffn
@deffn {} BFD_ARELOC_BFIN_RSHIFT
ADI Blackfin arithmetic relocation.
@end deffn
@deffn {} BFD_ARELOC_BFIN_AND
ADI Blackfin arithmetic relocation.
@end deffn
@deffn {} BFD_ARELOC_BFIN_OR
ADI Blackfin arithmetic relocation.
@end deffn
@deffn {} BFD_ARELOC_BFIN_XOR
ADI Blackfin arithmetic relocation.
@end deffn
@deffn {} BFD_ARELOC_BFIN_LAND
ADI Blackfin arithmetic relocation.
@end deffn
@deffn {} BFD_ARELOC_BFIN_LOR
ADI Blackfin arithmetic relocation.
@end deffn
@deffn {} BFD_ARELOC_BFIN_LEN
ADI Blackfin arithmetic relocation.
@end deffn
@deffn {} BFD_ARELOC_BFIN_NEG
ADI Blackfin arithmetic relocation.
@end deffn
@deffn {} BFD_ARELOC_BFIN_COMP
ADI Blackfin arithmetic relocation.
@end deffn
@deffn {} BFD_ARELOC_BFIN_PAGE
ADI Blackfin arithmetic relocation.
@end deffn
@deffn {} BFD_ARELOC_BFIN_HWPAGE
ADI Blackfin arithmetic relocation.
@end deffn
@deffn {} BFD_ARELOC_BFIN_ADDR
ADI Blackfin arithmetic relocation.
@end deffn
@deffn {} BFD_RELOC_D10V_10_PCREL_R
Mitsubishi D10V relocs.
This is a 10-bit reloc with the right 2 bits
@ -1253,6 +1493,12 @@ DLX relocs
@deffn {} BFD_RELOC_DLX_JMP26
DLX relocs
@end deffn
@deffn {} BFD_RELOC_M32C_HI8
@deffnx {} BFD_RELOC_M32C_RL_JUMP
@deffnx {} BFD_RELOC_M32C_RL_1ADDR
@deffnx {} BFD_RELOC_M32C_RL_2ADDR
Renesas M16C/M32C Relocations.
@end deffn
@deffn {} BFD_RELOC_M32R_24
Renesas M32R (formerly Mitsubishi M32R) relocs.
This is a 24 bit absolute address.
@ -1288,6 +1534,9 @@ add3, load, and store instructions.
@deffnx {} BFD_RELOC_M32R_JMP_SLOT
@deffnx {} BFD_RELOC_M32R_RELATIVE
@deffnx {} BFD_RELOC_M32R_GOTOFF
@deffnx {} BFD_RELOC_M32R_GOTOFF_HI_ULO
@deffnx {} BFD_RELOC_M32R_GOTOFF_HI_SLO
@deffnx {} BFD_RELOC_M32R_GOTOFF_LO
@deffnx {} BFD_RELOC_M32R_GOTPC24
@deffnx {} BFD_RELOC_M32R_GOT16_HI_ULO
@deffnx {} BFD_RELOC_M32R_GOT16_HI_SLO
@ -1361,6 +1610,10 @@ Used for relaxing indirect jumps.
@deffn {} BFD_RELOC_V850_ALIGN
Used to maintain alignment whilst relaxing.
@end deffn
@deffn {} BFD_RELOC_V850_LO16_SPLIT_OFFSET
This is a variation of BFD_RELOC_LO16 that can be used in v850e ld.bu
instructions.
@end deffn
@deffn {} BFD_RELOC_MN10300_32_PCREL
This is a 32bit pcrel reloc for the mn10300, offset by two bytes in the
instruction.
@ -1509,6 +1762,10 @@ of data memory address) into 8 bit immediate value of LDI insn.
This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
of program memory address) into 8 bit immediate value of LDI insn.
@end deffn
@deffn {} BFD_RELOC_AVR_MS8_LDI
This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
of 32 bit value) into 8 bit immediate value of LDI insn.
@end deffn
@deffn {} BFD_RELOC_AVR_LO8_LDI_NEG
This is a 16 bit reloc for the AVR that stores negated 8 bit value
(usually data memory address) into 8 bit immediate value of SUBI insn.
@ -1523,6 +1780,10 @@ This is a 16 bit reloc for the AVR that stores negated 8 bit value
(most high 8 bit of program memory address) into 8 bit immediate value
of LDI or SUBI insn.
@end deffn
@deffn {} BFD_RELOC_AVR_MS8_LDI_NEG
This is a 16 bit reloc for the AVR that stores negated 8 bit value (msb
of 32 bit value) into 8 bit immediate value of LDI insn.
@end deffn
@deffn {} BFD_RELOC_AVR_LO8_LDI_PM
This is a 16 bit reloc for the AVR that stores 8 bit value (usually
command address) into 8 bit immediate value of LDI insn.
@ -1553,6 +1814,18 @@ value of SUBI insn.
This is a 32 bit reloc for the AVR that stores 23 bit value
into 22 bits.
@end deffn
@deffn {} BFD_RELOC_AVR_LDI
This is a 16 bit reloc for the AVR that stores all needed bits
for absolute addressing with ldi with overflow check to linktime
@end deffn
@deffn {} BFD_RELOC_AVR_6
This is a 6 bit reloc for the AVR that stores offset for ldd/std
instructions
@end deffn
@deffn {} BFD_RELOC_AVR_6_ADIW
This is a 6 bit reloc for the AVR that stores offset for adiw/sbiw
instructions
@end deffn
@deffn {} BFD_RELOC_390_12
Direct 12 bit.
@end deffn
@ -1841,10 +2114,79 @@ to follow the 16K memory bank of 68HC12 (seen as mapped in the window).
Motorola 68HC12 reloc.
This is the 5 bits of a value.
@end deffn
@deffn {} BFD_RELOC_16C_NUM08
@deffnx {} BFD_RELOC_16C_NUM08_C
@deffnx {} BFD_RELOC_16C_NUM16
@deffnx {} BFD_RELOC_16C_NUM16_C
@deffnx {} BFD_RELOC_16C_NUM32
@deffnx {} BFD_RELOC_16C_NUM32_C
@deffnx {} BFD_RELOC_16C_DISP04
@deffnx {} BFD_RELOC_16C_DISP04_C
@deffnx {} BFD_RELOC_16C_DISP08
@deffnx {} BFD_RELOC_16C_DISP08_C
@deffnx {} BFD_RELOC_16C_DISP16
@deffnx {} BFD_RELOC_16C_DISP16_C
@deffnx {} BFD_RELOC_16C_DISP24
@deffnx {} BFD_RELOC_16C_DISP24_C
@deffnx {} BFD_RELOC_16C_DISP24a
@deffnx {} BFD_RELOC_16C_DISP24a_C
@deffnx {} BFD_RELOC_16C_REG04
@deffnx {} BFD_RELOC_16C_REG04_C
@deffnx {} BFD_RELOC_16C_REG04a
@deffnx {} BFD_RELOC_16C_REG04a_C
@deffnx {} BFD_RELOC_16C_REG14
@deffnx {} BFD_RELOC_16C_REG14_C
@deffnx {} BFD_RELOC_16C_REG16
@deffnx {} BFD_RELOC_16C_REG16_C
@deffnx {} BFD_RELOC_16C_REG20
@deffnx {} BFD_RELOC_16C_REG20_C
@deffnx {} BFD_RELOC_16C_ABS20
@deffnx {} BFD_RELOC_16C_ABS20_C
@deffnx {} BFD_RELOC_16C_ABS24
@deffnx {} BFD_RELOC_16C_ABS24_C
@deffnx {} BFD_RELOC_16C_IMM04
@deffnx {} BFD_RELOC_16C_IMM04_C
@deffnx {} BFD_RELOC_16C_IMM16
@deffnx {} BFD_RELOC_16C_IMM16_C
@deffnx {} BFD_RELOC_16C_IMM20
@deffnx {} BFD_RELOC_16C_IMM20_C
@deffnx {} BFD_RELOC_16C_IMM24
@deffnx {} BFD_RELOC_16C_IMM24_C
@deffnx {} BFD_RELOC_16C_IMM32
@deffnx {} BFD_RELOC_16C_IMM32_C
NS CR16C Relocations.
@end deffn
@deffn {} BFD_RELOC_CRX_REL4
@deffnx {} BFD_RELOC_CRX_REL8
@deffnx {} BFD_RELOC_CRX_REL8_CMP
@deffnx {} BFD_RELOC_CRX_REL16
@deffnx {} BFD_RELOC_CRX_REL24
@deffnx {} BFD_RELOC_CRX_REL32
@deffnx {} BFD_RELOC_CRX_REGREL12
@deffnx {} BFD_RELOC_CRX_REGREL22
@deffnx {} BFD_RELOC_CRX_REGREL28
@deffnx {} BFD_RELOC_CRX_REGREL32
@deffnx {} BFD_RELOC_CRX_ABS16
@deffnx {} BFD_RELOC_CRX_ABS32
@deffnx {} BFD_RELOC_CRX_NUM8
@deffnx {} BFD_RELOC_CRX_NUM16
@deffnx {} BFD_RELOC_CRX_NUM32
@deffnx {} BFD_RELOC_CRX_IMM16
@deffnx {} BFD_RELOC_CRX_IMM32
@deffnx {} BFD_RELOC_CRX_SWITCH8
@deffnx {} BFD_RELOC_CRX_SWITCH16
@deffnx {} BFD_RELOC_CRX_SWITCH32
NS CRX Relocations.
@end deffn
@deffn {} BFD_RELOC_CRIS_BDISP8
@deffnx {} BFD_RELOC_CRIS_UNSIGNED_5
@deffnx {} BFD_RELOC_CRIS_SIGNED_6
@deffnx {} BFD_RELOC_CRIS_UNSIGNED_6
@deffnx {} BFD_RELOC_CRIS_SIGNED_8
@deffnx {} BFD_RELOC_CRIS_UNSIGNED_8
@deffnx {} BFD_RELOC_CRIS_SIGNED_16
@deffnx {} BFD_RELOC_CRIS_UNSIGNED_16
@deffnx {} BFD_RELOC_CRIS_LAPCQ_OFFSET
@deffnx {} BFD_RELOC_CRIS_UNSIGNED_4
These relocs are only used within the CRIS assembler. They are not
(at present) written to any object files.
@ -1927,16 +2269,42 @@ H8 elf Relocations.
@deffnx {} BFD_RELOC_XSTORMY16_FPTR16
Sony Xstormy16 Relocations.
@end deffn
@deffn {} BFD_RELOC_XC16X_PAG
@deffnx {} BFD_RELOC_XC16X_POF
@deffnx {} BFD_RELOC_XC16X_SEG
@deffnx {} BFD_RELOC_XC16X_SOF
Infineon Relocations.
@end deffn
@deffn {} BFD_RELOC_VAX_GLOB_DAT
@deffnx {} BFD_RELOC_VAX_JMP_SLOT
@deffnx {} BFD_RELOC_VAX_RELATIVE
Relocations used by VAX ELF.
@end deffn
@deffn {} BFD_RELOC_MT_PC16
Morpho MT - 16 bit immediate relocation.
@end deffn
@deffn {} BFD_RELOC_MT_HI16
Morpho MT - Hi 16 bits of an address.
@end deffn
@deffn {} BFD_RELOC_MT_LO16
Morpho MT - Low 16 bits of an address.
@end deffn
@deffn {} BFD_RELOC_MT_GNU_VTINHERIT
Morpho MT - Used to tell the linker which vtable entries are used.
@end deffn
@deffn {} BFD_RELOC_MT_GNU_VTENTRY
Morpho MT - Used to tell the linker which vtable entries are used.
@end deffn
@deffn {} BFD_RELOC_MT_PCINSN8
Morpho MT - 8 bit immediate relocation.
@end deffn
@deffn {} BFD_RELOC_MSP430_10_PCREL
@deffnx {} BFD_RELOC_MSP430_16_PCREL
@deffnx {} BFD_RELOC_MSP430_16
@deffnx {} BFD_RELOC_MSP430_16_PCREL_BYTE
@deffnx {} BFD_RELOC_MSP430_16_BYTE
@deffnx {} BFD_RELOC_MSP430_2X_PCREL
@deffnx {} BFD_RELOC_MSP430_RL_PCREL
msp430 specific relocation codes
@end deffn
@deffn {} BFD_RELOC_IQ2000_OFFSET_16
@ -1958,24 +2326,83 @@ Xtensa relocations for ELF shared objects.
Xtensa relocation used in ELF object files for symbols that may require
PLT entries. Otherwise, this is just a generic 32-bit relocation.
@end deffn
@deffn {} BFD_RELOC_XTENSA_DIFF8
@deffnx {} BFD_RELOC_XTENSA_DIFF16
@deffnx {} BFD_RELOC_XTENSA_DIFF32
Xtensa relocations to mark the difference of two local symbols.
These are only needed to support linker relaxation and can be ignored
when not relaxing. The field is set to the value of the difference
assuming no relaxation. The relocation encodes the position of the
first symbol so the linker can determine whether to adjust the field
value.
@end deffn
@deffn {} BFD_RELOC_XTENSA_SLOT0_OP
@deffnx {} BFD_RELOC_XTENSA_SLOT1_OP
@deffnx {} BFD_RELOC_XTENSA_SLOT2_OP
@deffnx {} BFD_RELOC_XTENSA_SLOT3_OP
@deffnx {} BFD_RELOC_XTENSA_SLOT4_OP
@deffnx {} BFD_RELOC_XTENSA_SLOT5_OP
@deffnx {} BFD_RELOC_XTENSA_SLOT6_OP
@deffnx {} BFD_RELOC_XTENSA_SLOT7_OP
@deffnx {} BFD_RELOC_XTENSA_SLOT8_OP
@deffnx {} BFD_RELOC_XTENSA_SLOT9_OP
@deffnx {} BFD_RELOC_XTENSA_SLOT10_OP
@deffnx {} BFD_RELOC_XTENSA_SLOT11_OP
@deffnx {} BFD_RELOC_XTENSA_SLOT12_OP
@deffnx {} BFD_RELOC_XTENSA_SLOT13_OP
@deffnx {} BFD_RELOC_XTENSA_SLOT14_OP
Generic Xtensa relocations for instruction operands. Only the slot
number is encoded in the relocation. The relocation applies to the
last PC-relative immediate operand, or if there are no PC-relative
immediates, to the last immediate operand.
@end deffn
@deffn {} BFD_RELOC_XTENSA_SLOT0_ALT
@deffnx {} BFD_RELOC_XTENSA_SLOT1_ALT
@deffnx {} BFD_RELOC_XTENSA_SLOT2_ALT
@deffnx {} BFD_RELOC_XTENSA_SLOT3_ALT
@deffnx {} BFD_RELOC_XTENSA_SLOT4_ALT
@deffnx {} BFD_RELOC_XTENSA_SLOT5_ALT
@deffnx {} BFD_RELOC_XTENSA_SLOT6_ALT
@deffnx {} BFD_RELOC_XTENSA_SLOT7_ALT
@deffnx {} BFD_RELOC_XTENSA_SLOT8_ALT
@deffnx {} BFD_RELOC_XTENSA_SLOT9_ALT
@deffnx {} BFD_RELOC_XTENSA_SLOT10_ALT
@deffnx {} BFD_RELOC_XTENSA_SLOT11_ALT
@deffnx {} BFD_RELOC_XTENSA_SLOT12_ALT
@deffnx {} BFD_RELOC_XTENSA_SLOT13_ALT
@deffnx {} BFD_RELOC_XTENSA_SLOT14_ALT
Alternate Xtensa relocations. Only the slot is encoded in the
relocation. The meaning of these relocations is opcode-specific.
@end deffn
@deffn {} BFD_RELOC_XTENSA_OP0
@deffnx {} BFD_RELOC_XTENSA_OP1
@deffnx {} BFD_RELOC_XTENSA_OP2
Generic Xtensa relocations. Only the operand number is encoded
in the relocation. The details are determined by extracting the
instruction opcode.
Xtensa relocations for backward compatibility. These have all been
replaced by BFD_RELOC_XTENSA_SLOT0_OP.
@end deffn
@deffn {} BFD_RELOC_XTENSA_ASM_EXPAND
Xtensa relocation to mark that the assembler expanded the
Xtensa relocation to mark that the assembler expanded the
instructions from an original target. The expansion size is
encoded in the reloc size.
@end deffn
@deffn {} BFD_RELOC_XTENSA_ASM_SIMPLIFY
Xtensa relocation to mark that the linker should simplify
assembler-expanded instructions. This is commonly used
internally by the linker after analysis of a
Xtensa relocation to mark that the linker should simplify
assembler-expanded instructions. This is commonly used
internally by the linker after analysis of a
BFD_RELOC_XTENSA_ASM_EXPAND.
@end deffn
@deffn {} BFD_RELOC_Z80_DISP8
8 bit signed offset in (ix+d) or (iy+d).
@end deffn
@deffn {} BFD_RELOC_Z8K_DISP7
DJNZ offset.
@end deffn
@deffn {} BFD_RELOC_Z8K_CALLR
CALR offset.
@end deffn
@deffn {} BFD_RELOC_Z8K_IMM4L
4 bit value.
@end deffn
@example
@ -2025,8 +2452,7 @@ bfd_boolean bfd_generic_relax_section
@end example
@strong{Description}@*
Provides default handling for relaxing for back ends which
don't do relaxing -- i.e., does nothing except make sure that the
final size of the section is set.
don't do relaxing.
@findex bfd_generic_gc_sections
@subsubsection @code{bfd_generic_gc_sections}

View file

@ -107,23 +107,6 @@ Here is the section structure:
@example
/* This structure is used for a comdat section, as in PE. A comdat
section is associated with a particular symbol. When the linker
sees a comdat section, it keeps only one of the sections with a
given name and associated with a given symbol. */
struct bfd_comdat_info
@{
/* The name of the symbol associated with a comdat section. */
const char *name;
/* The local symbol table index of the symbol associated with a
comdat section. This is only meaningful to the object file format
specific code; it is not an index into the list returned by
bfd_canonicalize_symtab. */
long symbol;
@};
typedef struct bfd_section
@{
/* The name of the section; the name isn't a copy, the pointer is
@ -139,6 +122,9 @@ typedef struct bfd_section
/* The next section in the list belonging to the BFD, or NULL. */
struct bfd_section *next;
/* The previous section in the list belonging to the BFD, or NULL. */
struct bfd_section *prev;
/* The field flags contains attributes of the section. Some
flags are read in from the object file, and some are
synthesized from other information. */
@ -158,23 +144,17 @@ typedef struct bfd_section
some relocation information too. */
#define SEC_RELOC 0x004
/* ELF reserves 4 processor specific bits and 8 operating system
specific bits in sh_flags; at present we can get away with just
one in communicating between the assembler and BFD, but this
isn't a good long-term solution. */
#define SEC_ARCH_BIT_0 0x008
/* A signal to the OS that the section contains read only data. */
#define SEC_READONLY 0x010
#define SEC_READONLY 0x008
/* The section contains code only. */
#define SEC_CODE 0x020
#define SEC_CODE 0x010
/* The section contains data only. */
#define SEC_DATA 0x040
#define SEC_DATA 0x020
/* The section will reside in ROM. */
#define SEC_ROM 0x080
#define SEC_ROM 0x040
/* The section contains constructor information. This section
type is used by the linker to create lists of constructors and
@ -186,16 +166,110 @@ typedef struct bfd_section
sections called @code{__CTOR_LIST__} and relocate the data
contained within - exactly the operations it would peform on
standard data. */
#define SEC_CONSTRUCTOR 0x100
#define SEC_CONSTRUCTOR 0x080
/* The section has contents - a data section could be
@code{SEC_ALLOC} | @code{SEC_HAS_CONTENTS}; a debug section could be
@code{SEC_HAS_CONTENTS} */
#define SEC_HAS_CONTENTS 0x200
#define SEC_HAS_CONTENTS 0x100
/* An instruction to the linker to not output the section
even if it has information which would normally be written. */
#define SEC_NEVER_LOAD 0x400
#define SEC_NEVER_LOAD 0x200
/* The section contains thread local data. */
#define SEC_THREAD_LOCAL 0x400
/* The section has GOT references. This flag is only for the
linker, and is currently only used by the elf32-hppa back end.
It will be set if global offset table references were detected
in this section, which indicate to the linker that the section
contains PIC code, and must be handled specially when doing a
static link. */
#define SEC_HAS_GOT_REF 0x800
/* The section contains common symbols (symbols may be defined
multiple times, the value of a symbol is the amount of
space it requires, and the largest symbol value is the one
used). Most targets have exactly one of these (which we
translate to bfd_com_section_ptr), but ECOFF has two. */
#define SEC_IS_COMMON 0x1000
/* The section contains only debugging information. For
example, this is set for ELF .debug and .stab sections.
strip tests this flag to see if a section can be
discarded. */
#define SEC_DEBUGGING 0x2000
/* The contents of this section are held in memory pointed to
by the contents field. This is checked by bfd_get_section_contents,
and the data is retrieved from memory if appropriate. */
#define SEC_IN_MEMORY 0x4000
/* The contents of this section are to be excluded by the
linker for executable and shared objects unless those
objects are to be further relocated. */
#define SEC_EXCLUDE 0x8000
/* The contents of this section are to be sorted based on the sum of
the symbol and addend values specified by the associated relocation
entries. Entries without associated relocation entries will be
appended to the end of the section in an unspecified order. */
#define SEC_SORT_ENTRIES 0x10000
/* When linking, duplicate sections of the same name should be
discarded, rather than being combined into a single section as
is usually done. This is similar to how common symbols are
handled. See SEC_LINK_DUPLICATES below. */
#define SEC_LINK_ONCE 0x20000
/* If SEC_LINK_ONCE is set, this bitfield describes how the linker
should handle duplicate sections. */
#define SEC_LINK_DUPLICATES 0x40000
/* This value for SEC_LINK_DUPLICATES means that duplicate
sections with the same name should simply be discarded. */
#define SEC_LINK_DUPLICATES_DISCARD 0x0
/* This value for SEC_LINK_DUPLICATES means that the linker
should warn if there are any duplicate sections, although
it should still only link one copy. */
#define SEC_LINK_DUPLICATES_ONE_ONLY 0x80000
/* This value for SEC_LINK_DUPLICATES means that the linker
should warn if any duplicate sections are a different size. */
#define SEC_LINK_DUPLICATES_SAME_SIZE 0x100000
/* This value for SEC_LINK_DUPLICATES means that the linker
should warn if any duplicate sections contain different
contents. */
#define SEC_LINK_DUPLICATES_SAME_CONTENTS \
(SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE)
/* This section was created by the linker as part of dynamic
relocation or other arcane processing. It is skipped when
going through the first-pass output, trusting that someone
else up the line will take care of it later. */
#define SEC_LINKER_CREATED 0x200000
/* This section should not be subject to garbage collection. */
#define SEC_KEEP 0x400000
/* This section contains "short" data, and should be placed
"near" the GP. */
#define SEC_SMALL_DATA 0x800000
/* Attempt to merge identical entities in the section.
Entity size is given in the entsize field. */
#define SEC_MERGE 0x1000000
/* If given with SEC_MERGE, entities to merge are zero terminated
strings where entsize specifies character size instead of fixed
size entries. */
#define SEC_STRINGS 0x2000000
/* This section contains data about section groups. */
#define SEC_GROUP 0x4000000
/* The section is a COFF shared library section. This flag is
only for the linker. If this type of section appears in
@ -206,114 +280,23 @@ typedef struct bfd_section
might be cleaner to have some more general mechanism to
allow the back end to control what the linker does with
sections. */
#define SEC_COFF_SHARED_LIBRARY 0x800
/* The section contains thread local data. */
#define SEC_THREAD_LOCAL 0x1000
/* The section has GOT references. This flag is only for the
linker, and is currently only used by the elf32-hppa back end.
It will be set if global offset table references were detected
in this section, which indicate to the linker that the section
contains PIC code, and must be handled specially when doing a
static link. */
#define SEC_HAS_GOT_REF 0x4000
/* The section contains common symbols (symbols may be defined
multiple times, the value of a symbol is the amount of
space it requires, and the largest symbol value is the one
used). Most targets have exactly one of these (which we
translate to bfd_com_section_ptr), but ECOFF has two. */
#define SEC_IS_COMMON 0x8000
/* The section contains only debugging information. For
example, this is set for ELF .debug and .stab sections.
strip tests this flag to see if a section can be
discarded. */
#define SEC_DEBUGGING 0x10000
/* The contents of this section are held in memory pointed to
by the contents field. This is checked by bfd_get_section_contents,
and the data is retrieved from memory if appropriate. */
#define SEC_IN_MEMORY 0x20000
/* The contents of this section are to be excluded by the
linker for executable and shared objects unless those
objects are to be further relocated. */
#define SEC_EXCLUDE 0x40000
/* The contents of this section are to be sorted based on the sum of
the symbol and addend values specified by the associated relocation
entries. Entries without associated relocation entries will be
appended to the end of the section in an unspecified order. */
#define SEC_SORT_ENTRIES 0x80000
/* When linking, duplicate sections of the same name should be
discarded, rather than being combined into a single section as
is usually done. This is similar to how common symbols are
handled. See SEC_LINK_DUPLICATES below. */
#define SEC_LINK_ONCE 0x100000
/* If SEC_LINK_ONCE is set, this bitfield describes how the linker
should handle duplicate sections. */
#define SEC_LINK_DUPLICATES 0x600000
/* This value for SEC_LINK_DUPLICATES means that duplicate
sections with the same name should simply be discarded. */
#define SEC_LINK_DUPLICATES_DISCARD 0x0
/* This value for SEC_LINK_DUPLICATES means that the linker
should warn if there are any duplicate sections, although
it should still only link one copy. */
#define SEC_LINK_DUPLICATES_ONE_ONLY 0x200000
/* This value for SEC_LINK_DUPLICATES means that the linker
should warn if any duplicate sections are a different size. */
#define SEC_LINK_DUPLICATES_SAME_SIZE 0x400000
/* This value for SEC_LINK_DUPLICATES means that the linker
should warn if any duplicate sections contain different
contents. */
#define SEC_LINK_DUPLICATES_SAME_CONTENTS 0x600000
/* This section was created by the linker as part of dynamic
relocation or other arcane processing. It is skipped when
going through the first-pass output, trusting that someone
else up the line will take care of it later. */
#define SEC_LINKER_CREATED 0x800000
/* This section should not be subject to garbage collection. */
#define SEC_KEEP 0x1000000
/* This section contains "short" data, and should be placed
"near" the GP. */
#define SEC_SMALL_DATA 0x2000000
#define SEC_COFF_SHARED_LIBRARY 0x10000000
/* This section contains data which may be shared with other
executables or shared objects. */
#define SEC_SHARED 0x4000000
executables or shared objects. This is for COFF only. */
#define SEC_COFF_SHARED 0x20000000
/* When a section with this flag is being linked, then if the size of
the input section is less than a page, it should not cross a page
boundary. If the size of the input section is one page or more, it
should be aligned on a page boundary. */
#define SEC_BLOCK 0x8000000
boundary. If the size of the input section is one page or more,
it should be aligned on a page boundary. This is for TI
TMS320C54X only. */
#define SEC_TIC54X_BLOCK 0x40000000
/* Conditionally link this section; do not link if there are no
references found to any symbol in the section. */
#define SEC_CLINK 0x10000000
/* Attempt to merge identical entities in the section.
Entity size is given in the entsize field. */
#define SEC_MERGE 0x20000000
/* If given with SEC_MERGE, entities to merge are zero terminated
strings where entsize specifies character size instead of fixed
size entries. */
#define SEC_STRINGS 0x40000000
/* This section contains data about section groups. */
#define SEC_GROUP 0x80000000
references found to any symbol in the section. This is for TI
TMS320C54X only. */
#define SEC_TIC54X_CLINK 0x80000000
/* End of section flags. */
@ -322,9 +305,6 @@ typedef struct bfd_section
/* See the vma field. */
unsigned int user_set_vma : 1;
/* Whether relocations have been processed. */
unsigned int reloc_done : 1;
/* A mark flag used by some of the linker backends. */
unsigned int linker_mark : 1;
@ -332,8 +312,9 @@ typedef struct bfd_section
output sections that have an input section. */
unsigned int linker_has_input : 1;
/* A mark flag used by some linker backends for garbage collection. */
/* Mark flags used by some linker backends for garbage collection. */
unsigned int gc_mark : 1;
unsigned int gc_mark_from_eh : 1;
/* The following flags are used by the ELF linker. */
@ -351,22 +332,20 @@ typedef struct bfd_section
/* Nonzero if this section uses RELA relocations, rather than REL. */
unsigned int use_rela_p:1;
/* Bits used by various backends. */
unsigned int has_tls_reloc:1;
/* Bits used by various backends. The generic code doesn't touch
these fields. */
/* Nonzero if this section needs the relax finalize pass. */
unsigned int need_finalize_relax:1;
/* Nonzero if this section has TLS related relocations. */
unsigned int has_tls_reloc:1;
/* Nonzero if this section has a gp reloc. */
unsigned int has_gp_reloc:1;
/* Unused bits. */
unsigned int flag13:1;
unsigned int flag14:1;
unsigned int flag15:1;
unsigned int flag16:4;
unsigned int flag20:4;
unsigned int flag24:8;
/* Nonzero if this section needs the relax finalize pass. */
unsigned int need_finalize_relax:1;
/* Whether relocations have been processed. */
unsigned int reloc_done : 1;
/* End of internal packed boolean fields. */
@ -385,13 +364,18 @@ typedef struct bfd_section
/* The size of the section in octets, as it will be output.
Contains a value even if the section has no contents (e.g., the
size of @code{.bss}). This will be filled in after relocation. */
bfd_size_type _cooked_size;
size of @code{.bss}). */
bfd_size_type size;
/* The original size on disk of the section, in octets. Normally this
value is the same as the size, but if some relaxing has
been done, then this value will be bigger. */
bfd_size_type _raw_size;
/* For input sections, the original size on disk of the section, in
octets. This field is used by the linker relaxation code. It is
currently only set for sections where the linker relaxation scheme
doesn't cache altered section and reloc contents (stabs, eh_frame,
SEC_MERGE, some coff relaxing targets), and thus the original size
needs to be kept to read the section multiple times.
For output sections, rawsize holds the section size calculated on
a previous linker relaxation pass. */
bfd_size_type rawsize;
/* If this section is going to be output, then this value is the
offset in *bytes* into the output section of the first byte in the
@ -448,9 +432,6 @@ typedef struct bfd_section
/* Entity size for merging purposes. */
unsigned int entsize;
/* Optional information about a COMDAT entry; NULL if not COMDAT. */
struct bfd_comdat_info *comdat;
/* Points to the kept section if this section is a link-once section,
and is discarded. */
struct bfd_section *kept_section;
@ -475,8 +456,14 @@ typedef struct bfd_section
struct bfd_symbol *symbol;
struct bfd_symbol **symbol_ptr_ptr;
struct bfd_link_order *link_order_head;
struct bfd_link_order *link_order_tail;
/* Early in the link process, map_head and map_tail are used to build
a list of input sections attached to an output section. Later,
output sections use these fields for a list of bfd_link_order
structs. */
union @{
struct bfd_link_order *link_order;
struct bfd_section *s;
@} map_head, map_tail;
@} asection;
/* These sections are global, and are managed by BFD. The application
@ -515,36 +502,137 @@ extern const struct bfd_symbol * const bfd_abs_symbol;
extern const struct bfd_symbol * const bfd_com_symbol;
extern const struct bfd_symbol * const bfd_und_symbol;
extern const struct bfd_symbol * const bfd_ind_symbol;
#define bfd_get_section_size_before_reloc(section) \
((section)->_raw_size)
#define bfd_get_section_size_after_reloc(section) \
((section)->reloc_done ? (section)->_cooked_size \
: (abort (), (bfd_size_type) 1))
/* Macros to handle insertion and deletion of a bfd's sections. These
only handle the list pointers, ie. do not adjust section_count,
target_index etc. */
#define bfd_section_list_remove(ABFD, PS) \
#define bfd_section_list_remove(ABFD, S) \
do \
@{ \
asection **_ps = PS; \
asection *_s = *_ps; \
*_ps = _s->next; \
if (_s->next == NULL) \
(ABFD)->section_tail = _ps; \
@} \
while (0)
#define bfd_section_list_insert(ABFD, PS, S) \
do \
@{ \
asection **_ps = PS; \
asection *_s = S; \
_s->next = *_ps; \
*_ps = _s; \
if (_s->next == NULL) \
(ABFD)->section_tail = &_s->next; \
asection *_next = _s->next; \
asection *_prev = _s->prev; \
if (_prev) \
_prev->next = _next; \
else \
(ABFD)->sections = _next; \
if (_next) \
_next->prev = _prev; \
else \
(ABFD)->section_last = _prev; \
@} \
while (0)
#define bfd_section_list_append(ABFD, S) \
do \
@{ \
asection *_s = S; \
bfd *_abfd = ABFD; \
_s->next = NULL; \
if (_abfd->section_last) \
@{ \
_s->prev = _abfd->section_last; \
_abfd->section_last->next = _s; \
@} \
else \
@{ \
_s->prev = NULL; \
_abfd->sections = _s; \
@} \
_abfd->section_last = _s; \
@} \
while (0)
#define bfd_section_list_prepend(ABFD, S) \
do \
@{ \
asection *_s = S; \
bfd *_abfd = ABFD; \
_s->prev = NULL; \
if (_abfd->sections) \
@{ \
_s->next = _abfd->sections; \
_abfd->sections->prev = _s; \
@} \
else \
@{ \
_s->next = NULL; \
_abfd->section_last = _s; \
@} \
_abfd->sections = _s; \
@} \
while (0)
#define bfd_section_list_insert_after(ABFD, A, S) \
do \
@{ \
asection *_a = A; \
asection *_s = S; \
asection *_next = _a->next; \
_s->next = _next; \
_s->prev = _a; \
_a->next = _s; \
if (_next) \
_next->prev = _s; \
else \
(ABFD)->section_last = _s; \
@} \
while (0)
#define bfd_section_list_insert_before(ABFD, B, S) \
do \
@{ \
asection *_b = B; \
asection *_s = S; \
asection *_prev = _b->prev; \
_s->prev = _prev; \
_s->next = _b; \
_b->prev = _s; \
if (_prev) \
_prev->next = _s; \
else \
(ABFD)->sections = _s; \
@} \
while (0)
#define bfd_section_removed_from_list(ABFD, S) \
((S)->next == NULL ? (ABFD)->section_last != (S) : (S)->next->prev != (S))
#define BFD_FAKE_SECTION(SEC, FLAGS, SYM, SYM_PTR, NAME, IDX) \
/* name, id, index, next, prev, flags, user_set_vma, */ \
@{ NAME, IDX, 0, NULL, NULL, FLAGS, 0, \
\
/* linker_mark, linker_has_input, gc_mark, gc_mark_from_eh, */ \
0, 0, 1, 0, \
\
/* segment_mark, sec_info_type, use_rela_p, has_tls_reloc, */ \
0, 0, 0, 0, \
\
/* has_gp_reloc, need_finalize_relax, reloc_done, */ \
0, 0, 0, \
\
/* vma, lma, size, rawsize */ \
0, 0, 0, 0, \
\
/* output_offset, output_section, alignment_power, */ \
0, (struct bfd_section *) &SEC, 0, \
\
/* relocation, orelocation, reloc_count, filepos, rel_filepos, */ \
NULL, NULL, 0, 0, 0, \
\
/* line_filepos, userdata, contents, lineno, lineno_count, */ \
0, NULL, NULL, NULL, 0, \
\
/* entsize, kept_section, moving_line_filepos, */ \
0, NULL, 0, \
\
/* target_index, used_by_bfd, constructor_chain, owner, */ \
0, NULL, NULL, NULL, \
\
/* symbol, */ \
(struct bfd_symbol *) SYM, \
\
/* symbol_ptr_ptr, */ \
(struct bfd_symbol **) SYM_PTR, \
\
/* map_head, map_tail */ \
@{ NULL @}, @{ NULL @} \
@}
@end example
@ -578,6 +666,29 @@ all sections of a given name is to use @code{bfd_map_over_sections} and
@code{strcmp} on the name (or better yet, base it on the section flags
or something else) for each section.
@findex bfd_get_section_by_name_if
@subsubsection @code{bfd_get_section_by_name_if}
@strong{Synopsis}
@example
asection *bfd_get_section_by_name_if
(bfd *abfd,
const char *name,
bfd_boolean (*func) (bfd *abfd, asection *sect, void *obj),
void *obj);
@end example
@strong{Description}@*
Call the provided function @var{func} for each section
attached to the BFD @var{abfd} whose name matches @var{name},
passing @var{obj} as an argument. The function will be called
as if by
@example
func (abfd, the_section, obj);
@end example
It returns the first section for which @var{func} returns true,
otherwise @code{NULL}.
@findex bfd_get_unique_section_name
@subsubsection @code{bfd_get_unique_section_name}
@strong{Synopsis}
@ -619,6 +730,28 @@ If output has already started for this BFD.
If memory allocation fails.
@end itemize
@findex bfd_make_section_anyway_with_flags
@subsubsection @code{bfd_make_section_anyway_with_flags}
@strong{Synopsis}
@example
asection *bfd_make_section_anyway_with_flags
(bfd *abfd, const char *name, flagword flags);
@end example
@strong{Description}@*
Create a new empty section called @var{name} and attach it to the end of
the chain of sections for @var{abfd}. Create a new section even if there
is already a section with that name. Also set the attributes of the
new section to the value @var{flags}.
Return @code{NULL} and set @code{bfd_error} on error; possible errors are:
@itemize @bullet
@item
@code{bfd_error_invalid_operation} - If output has already started for @var{abfd}.
@item
@code{bfd_error_no_memory} - If memory allocation fails.
@end itemize
@findex bfd_make_section_anyway
@subsubsection @code{bfd_make_section_anyway}
@strong{Synopsis}
@ -639,6 +772,20 @@ Return @code{NULL} and set @code{bfd_error} on error; possible errors are:
@code{bfd_error_no_memory} - If memory allocation fails.
@end itemize
@findex bfd_make_section_with_flags
@subsubsection @code{bfd_make_section_with_flags}
@strong{Synopsis}
@example
asection *bfd_make_section_with_flags
(bfd *, const char *name, flagword flags);
@end example
@strong{Description}@*
Like @code{bfd_make_section_anyway}, but return @code{NULL} (without calling
bfd_set_error ()) without changing the section chain if there is already a
section named @var{name}. Also set the attributes of the new section to
the value @var{flags}. If there is an error, return @code{NULL} and set
@code{bfd_error}.
@findex bfd_make_section
@subsubsection @code{bfd_make_section}
@strong{Synopsis}
@ -699,6 +846,26 @@ alternative would be to use a loop:
func (abfd, p, ...)
@end example
@findex bfd_sections_find_if
@subsubsection @code{bfd_sections_find_if}
@strong{Synopsis}
@example
asection *bfd_sections_find_if
(bfd *abfd,
bfd_boolean (*operation) (bfd *abfd, asection *sect, void *obj),
void *obj);
@end example
@strong{Description}@*
Call the provided function @var{operation} for each section
attached to the BFD @var{abfd}, passing @var{obj} as an
argument. The function will be called as if by
@example
operation (abfd, the_section, obj);
@end example
It returns the first section for which @var{operation} returns true.
@findex bfd_set_section_size
@subsubsection @code{bfd_set_section_size}
@strong{Synopsis}
@ -766,6 +933,17 @@ flag set are requested or if the section does not have the
with zeroes. If no errors occur, @code{TRUE} is returned, else
@code{FALSE}.
@findex bfd_malloc_and_get_section
@subsubsection @code{bfd_malloc_and_get_section}
@strong{Synopsis}
@example
bfd_boolean bfd_malloc_and_get_section
(bfd *abfd, asection *section, bfd_byte **buf);
@end example
@strong{Description}@*
Read all data from @var{section} in BFD @var{abfd}
into a buffer, *@var{buf}, malloc'd by this function.
@findex bfd_copy_private_section_data
@subsubsection @code{bfd_copy_private_section_data}
@strong{Synopsis}
@ -791,20 +969,14 @@ Not enough memory exists to create private data for @var{osec}.
(ibfd, isection, obfd, osection))
@end example
@findex _bfd_strip_section_from_output
@subsubsection @code{_bfd_strip_section_from_output}
@findex bfd_generic_is_group_section
@subsubsection @code{bfd_generic_is_group_section}
@strong{Synopsis}
@example
void _bfd_strip_section_from_output
(struct bfd_link_info *info, asection *section);
bfd_boolean bfd_generic_is_group_section (bfd *, const asection *sec);
@end example
@strong{Description}@*
Remove @var{section} from the output. If the output section
becomes empty, remove it from the output bfd.
This function won't actually do anything except twiddle flags
if called too late in the linking process, when it's not safe
to remove sections.
Returns TRUE if @var{sec} is a member of a group.
@findex bfd_generic_discard_group
@subsubsection @code{bfd_generic_discard_group}

View file

@ -309,6 +309,22 @@ local label.
@end example
@findex bfd_is_target_special_symbol
@subsubsection @code{bfd_is_target_special_symbol}
@strong{Synopsis}
@example
bfd_boolean bfd_is_target_special_symbol (bfd *abfd, asymbol *sym);
@end example
@strong{Description}@*
Return TRUE iff a symbol @var{sym} in the BFD @var{abfd} is something
special to the particular target represented by the BFD. Such symbols
should normally not be mentioned to the user.
@example
#define bfd_is_target_special_symbol(abfd, sym) \
BFD_SEND (abfd, _bfd_is_target_special_symbol, (abfd, sym))
@end example
@findex bfd_canonicalize_symtab
@subsubsection @code{bfd_canonicalize_symtab}
@strong{Description}@*

View file

@ -178,7 +178,7 @@ typedef struct bfd_target
unsigned short ar_max_namelen;
/* Entries for byte swapping for data. These are different from the
other entry points, since they don't take a BFD asthe first argument.
other entry points, since they don't take a BFD as the first argument.
Certain other handlers could do the same. */
bfd_uint64_t (*bfd_getx64) (const void *);
bfd_int64_t (*bfd_getx_signed_64) (const void *);
@ -242,8 +242,10 @@ BFD_JUMP_TABLE macros.
#define BFD_JUMP_TABLE_COPY(NAME) \
NAME##_bfd_copy_private_bfd_data, \
NAME##_bfd_merge_private_bfd_data, \
_bfd_generic_init_private_section_data, \
NAME##_bfd_copy_private_section_data, \
NAME##_bfd_copy_private_symbol_data, \
NAME##_bfd_copy_private_header_data, \
NAME##_bfd_set_private_flags, \
NAME##_bfd_print_private_bfd_data
@ -253,6 +255,12 @@ BFD_JUMP_TABLE macros.
/* Called to merge BFD general private data from one object file
to a common output file when linking. */
bfd_boolean (*_bfd_merge_private_bfd_data) (bfd *, bfd *);
/* Called to initialize BFD private section data from one object file
to another. */
#define bfd_init_private_section_data(ibfd, isec, obfd, osec, link_info) \
BFD_SEND (obfd, _bfd_init_private_section_data, (ibfd, isec, obfd, osec, link_info))
bfd_boolean (*_bfd_init_private_section_data)
(bfd *, sec_ptr, bfd *, sec_ptr, struct bfd_link_info *);
/* Called to copy BFD private section data from one object file
to another. */
bfd_boolean (*_bfd_copy_private_section_data)
@ -261,6 +269,10 @@ BFD_JUMP_TABLE macros.
to another. */
bfd_boolean (*_bfd_copy_private_symbol_data)
(bfd *, asymbol *, bfd *, asymbol *);
/* Called to copy BFD private header data from one object file
to another. */
bfd_boolean (*_bfd_copy_private_header_data)
(bfd *, bfd *);
/* Called to set private backend flags. */
bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword);
@ -312,8 +324,11 @@ BFD_JUMP_TABLE macros.
NAME##_print_symbol, \
NAME##_get_symbol_info, \
NAME##_bfd_is_local_label_name, \
NAME##_bfd_is_target_special_symbol, \
NAME##_get_lineno, \
NAME##_find_nearest_line, \
_bfd_generic_find_line, \
NAME##_find_inliner_info, \
NAME##_bfd_make_debug_symbol, \
NAME##_read_minisymbols, \
NAME##_minisymbol_to_symbol
@ -330,11 +345,16 @@ BFD_JUMP_TABLE macros.
(bfd *, struct bfd_symbol *, symbol_info *);
#define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e))
bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *);
bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *);
alent * (*_get_lineno) (bfd *, struct bfd_symbol *);
bfd_boolean (*_bfd_find_nearest_line)
(bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma,
const char **, const char **, unsigned int *);
bfd_boolean (*_bfd_find_line)
(bfd *, struct bfd_symbol **, struct bfd_symbol *,
const char **, unsigned int *);
bfd_boolean (*_bfd_find_inliner_info)
(bfd *, const char **, const char **, unsigned int *);
/* Back-door to allow format-aware applications to create debug symbols
while using BFD for everything else. Currently used by the assembler
when creating COFF files. */
@ -385,7 +405,9 @@ BFD_JUMP_TABLE macros.
NAME##_bfd_link_split_section, \
NAME##_bfd_gc_sections, \
NAME##_bfd_merge_sections, \
NAME##_bfd_discard_group
NAME##_bfd_is_group_section, \
NAME##_bfd_discard_group, \
NAME##_section_already_linked \
int (*_bfd_sizeof_headers) (bfd *, bfd_boolean);
bfd_byte * (*_bfd_get_relocated_section_contents)
@ -422,13 +444,21 @@ BFD_JUMP_TABLE macros.
/* Attempt to merge SEC_MERGE sections. */
bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *);
/* Is this section a member of a group? */
bfd_boolean (*_bfd_is_group_section) (bfd *, const struct bfd_section *);
/* Discard members of a group. */
bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *);
/* Check if SEC has been already linked during a reloceatable or
final link. */
void (*_section_already_linked) (bfd *, struct bfd_section *);
/* Routines to handle dynamic symbols and relocs. */
#define BFD_JUMP_TABLE_DYNAMIC(NAME) \
NAME##_get_dynamic_symtab_upper_bound, \
NAME##_canonicalize_dynamic_symtab, \
NAME##_get_synthetic_symtab, \
NAME##_get_dynamic_reloc_upper_bound, \
NAME##_canonicalize_dynamic_reloc
@ -437,6 +467,10 @@ BFD_JUMP_TABLE macros.
/* Read in the dynamic symbols. */
long (*_bfd_canonicalize_dynamic_symtab)
(bfd *, struct bfd_symbol **);
/* Create synthetized symbols. */
long (*_bfd_get_synthetic_symtab)
(bfd *, long, struct bfd_symbol **, long, struct bfd_symbol **,
struct bfd_symbol **);
/* Get the amount of memory required to hold the dynamic relocs. */
long (*_bfd_get_dynamic_reloc_upper_bound) (bfd *);
/* Read in the dynamic relocs. */

View file

@ -1,23 +1,24 @@
/* DWARF 1 find nearest line (_bfd_dwarf1_find_nearest_line).
Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Copyright 1998, 1999, 2000, 2001, 2002, 2004, 2005
Free Software Foundation, Inc.
Written by Gavin Romig-Koch of Cygnus Solutions (gavin@cygnus.com).
Written by Gavin Romig-Koch of Cygnus Solutions (gavin@cygnus.com).
This file is part of BFD.
This file is part of BFD.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "bfd.h"
#include "sysdep.h"
@ -28,8 +29,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* dwarf1_debug is the starting point for all dwarf1 info. */
struct dwarf1_debug {
struct dwarf1_debug
{
/* The bfd we are working with. */
bfd* abfd;
@ -55,7 +56,8 @@ struct dwarf1_debug {
/* One dwarf1_unit for each parsed compilation unit die. */
struct dwarf1_unit {
struct dwarf1_unit
{
/* Linked starting from stash->lastUnit. */
struct dwarf1_unit* prev;
@ -66,7 +68,7 @@ struct dwarf1_unit {
unsigned long low_pc;
unsigned long high_pc;
/* Does this unit have a statement list? */
/* Does this unit have a statement list? */
int has_stmt_list;
/* If any, the offset of the line number table in the .line section. */
@ -75,7 +77,7 @@ struct dwarf1_unit {
/* If non-zero, a pointer to the first child of this unit. */
char* first_child;
/* How many line entries? */
/* How many line entries? */
unsigned long line_count;
/* The decoded line number table (line_count entries). */
@ -87,7 +89,8 @@ struct dwarf1_unit {
/* One dwarf1_func for each parsed function die. */
struct dwarf1_func {
struct dwarf1_func
{
/* Linked starting from aUnit->func_list. */
struct dwarf1_func* prev;
@ -100,7 +103,8 @@ struct dwarf1_func {
};
/* Used to return info about a parsed die. */
struct die_info {
struct die_info
{
unsigned long length;
unsigned long sibling;
unsigned long low_pc;
@ -115,7 +119,8 @@ struct die_info {
};
/* Parsed line number information. */
struct linenumber {
struct linenumber
{
/* First address in the line. */
unsigned long addr;
@ -124,32 +129,17 @@ struct linenumber {
};
/* Find the form of an attr, from the attr field. */
#define FORM_FROM_ATTR(attr) ((attr) & 0xF) /* Implicitly specified */
static struct dwarf1_unit *alloc_dwarf1_unit
PARAMS ((struct dwarf1_debug *));
static struct dwarf1_func *alloc_dwarf1_func
PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *));
static bfd_boolean parse_die
PARAMS ((bfd *, struct die_info *, char *, char *));
static bfd_boolean parse_line_table
PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *));
static bfd_boolean parse_functions_in_unit
PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *));
static bfd_boolean dwarf1_unit_find_nearest_line
PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *, unsigned long,
const char **, const char **, unsigned int *));
#define FORM_FROM_ATTR(attr) ((attr) & 0xF) /* Implicitly specified. */
/* Return a newly allocated dwarf1_unit. It should be cleared and
then attached into the 'stash' at 'stash->lastUnit'. */
static struct dwarf1_unit*
alloc_dwarf1_unit (stash)
struct dwarf1_debug* stash;
alloc_dwarf1_unit (struct dwarf1_debug* stash)
{
bfd_size_type amt = sizeof (struct dwarf1_unit);
struct dwarf1_unit* x = (struct dwarf1_unit*) bfd_zalloc (stash->abfd, amt);
struct dwarf1_unit* x = bfd_zalloc (stash->abfd, amt);
x->prev = stash->lastUnit;
stash->lastUnit = x;
@ -159,14 +149,12 @@ alloc_dwarf1_unit (stash)
/* Return a newly allocated dwarf1_func. It must be cleared and
attached into 'aUnit' at 'aUnit->func_list'. */
static struct dwarf1_func*
alloc_dwarf1_func (stash, aUnit)
struct dwarf1_debug* stash;
struct dwarf1_unit* aUnit;
static struct dwarf1_func *
alloc_dwarf1_func (struct dwarf1_debug* stash, struct dwarf1_unit* aUnit)
{
bfd_size_type amt = sizeof (struct dwarf1_func);
struct dwarf1_func* x = (struct dwarf1_func*) bfd_zalloc (stash->abfd, amt);
struct dwarf1_func* x = bfd_zalloc (stash->abfd, amt);
x->prev = aUnit->func_list;
aUnit->func_list = x;
@ -181,16 +169,15 @@ alloc_dwarf1_func (stash, aUnit)
Return FALSE if the die is invalidly formatted; TRUE otherwise. */
static bfd_boolean
parse_die (abfd, aDieInfo, aDiePtr, aDiePtrEnd)
bfd* abfd;
struct die_info* aDieInfo;
char* aDiePtr;
char* aDiePtrEnd;
parse_die (bfd * abfd,
struct die_info * aDieInfo,
char * aDiePtr,
char * aDiePtrEnd)
{
char* this_die = aDiePtr;
char* xptr = this_die;
memset (aDieInfo,0,sizeof (*aDieInfo));
memset (aDieInfo, 0, sizeof (* aDieInfo));
/* First comes the length. */
aDieInfo->length = bfd_get_32 (abfd, (bfd_byte *) xptr);
@ -217,7 +204,6 @@ parse_die (abfd, aDieInfo, aDiePtr, aDiePtrEnd)
/* Parse the attribute based on its form. This section
must handle all dwarf1 forms, but need only handle the
actual attributes that we care about. */
attr = bfd_get_16 (abfd, (bfd_byte *) xptr);
xptr += 2;
@ -269,9 +255,7 @@ parse_die (abfd, aDieInfo, aDiePtr, aDiePtrEnd)
occurs; TRUE otherwise. */
static bfd_boolean
parse_line_table (stash, aUnit)
struct dwarf1_debug* stash;
struct dwarf1_unit* aUnit;
parse_line_table (struct dwarf1_debug* stash, struct dwarf1_unit* aUnit)
{
char* xptr;
@ -285,14 +269,14 @@ parse_line_table (stash, aUnit)
if (! msec)
return FALSE;
size = bfd_get_section_size_before_reloc (msec);
stash->line_section = (char *) bfd_alloc (stash->abfd, size);
size = msec->rawsize ? msec->rawsize : msec->size;
stash->line_section = bfd_alloc (stash->abfd, size);
if (! stash->line_section)
return FALSE;
if (! bfd_get_section_contents (stash->abfd, msec, stash->line_section,
(bfd_vma) 0, size))
0, size))
{
stash->line_section = 0;
return FALSE;
@ -318,13 +302,12 @@ parse_line_table (stash, aUnit)
xptr += 4;
/* How many line entrys?
10 = 4 (line number) + 2 (pos in line) + 4 (address in line) */
10 = 4 (line number) + 2 (pos in line) + 4 (address in line). */
aUnit->line_count = (tblend - xptr) / 10;
/* Allocate an array for the entries. */
amt = sizeof (struct linenumber) * aUnit->line_count;
aUnit->linenumber_table = ((struct linenumber *)
bfd_alloc (stash->abfd, amt));
aUnit->linenumber_table = bfd_alloc (stash->abfd, amt);
for (eachLine = 0; eachLine < aUnit->line_count; eachLine++)
{
@ -352,15 +335,13 @@ parse_line_table (stash, aUnit)
Return FALSE if error; TRUE otherwise. */
static bfd_boolean
parse_functions_in_unit (stash, aUnit)
struct dwarf1_debug* stash;
struct dwarf1_unit* aUnit;
parse_functions_in_unit (struct dwarf1_debug* stash, struct dwarf1_unit* aUnit)
{
char* eachDie;
if (aUnit->first_child)
for (eachDie = aUnit->first_child;
eachDie < stash->debug_section_end;
eachDie < stash->debug_section_end;
)
{
struct die_info eachDieInfo;
@ -395,15 +376,12 @@ parse_functions_in_unit (stash, aUnit)
Return whether we found the line (or a function) without error. */
static bfd_boolean
dwarf1_unit_find_nearest_line (stash, aUnit, addr,
filename_ptr, functionname_ptr,
linenumber_ptr)
struct dwarf1_debug* stash;
struct dwarf1_unit* aUnit;
unsigned long addr;
const char **filename_ptr;
const char **functionname_ptr;
unsigned int *linenumber_ptr;
dwarf1_unit_find_nearest_line (struct dwarf1_debug* stash,
struct dwarf1_unit* aUnit,
unsigned long addr,
const char **filename_ptr,
const char **functionname_ptr,
unsigned int *linenumber_ptr)
{
int line_p = FALSE;
int func_p = FALSE;
@ -461,15 +439,13 @@ dwarf1_unit_find_nearest_line (stash, aUnit, addr,
Return TRUE if the line is found without error. */
bfd_boolean
_bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
filename_ptr, functionname_ptr, linenumber_ptr)
bfd *abfd;
asection *section;
asymbol **symbols ATTRIBUTE_UNUSED;
bfd_vma offset;
const char **filename_ptr;
const char **functionname_ptr;
unsigned int *linenumber_ptr;
_bfd_dwarf1_find_nearest_line (bfd *abfd,
asection *section,
asymbol **symbols ATTRIBUTE_UNUSED,
bfd_vma offset,
const char **filename_ptr,
const char **functionname_ptr,
unsigned int *linenumber_ptr)
{
struct dwarf1_debug *stash = elf_tdata (abfd)->dwarf1_find_line_info;
@ -488,28 +464,26 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
bfd_size_type size = sizeof (struct dwarf1_debug);
stash = elf_tdata (abfd)->dwarf1_find_line_info
= (struct dwarf1_debug *) bfd_zalloc (abfd, size);
= bfd_zalloc (abfd, size);
if (! stash)
return FALSE;
msec = bfd_get_section_by_name (abfd, ".debug");
if (! msec)
{
/* No dwarf1 info. Note that at this point the stash
has been allocated, but contains zeros, this lets
future calls to this function fail quicker. */
return FALSE;
}
/* No dwarf1 info. Note that at this point the stash
has been allocated, but contains zeros, this lets
future calls to this function fail quicker. */
return FALSE;
size = bfd_get_section_size_before_reloc (msec);
stash->debug_section = (char *) bfd_alloc (abfd, size);
size = msec->rawsize ? msec->rawsize : msec->size;
stash->debug_section = bfd_alloc (abfd, size);
if (! stash->debug_section)
return FALSE;
if (! bfd_get_section_contents (abfd, msec, stash->debug_section,
(bfd_vma) 0, size))
0, size))
{
stash->debug_section = 0;
return FALSE;
@ -529,13 +503,11 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
/* Look at the previously parsed units to see if any contain
the addr. */
for (eachUnit = stash->lastUnit; eachUnit; eachUnit = eachUnit->prev)
{
if (eachUnit->low_pc <= addr && addr < eachUnit->high_pc)
return dwarf1_unit_find_nearest_line (stash, eachUnit, addr,
filename_ptr,
functionname_ptr,
linenumber_ptr);
}
if (eachUnit->low_pc <= addr && addr < eachUnit->high_pc)
return dwarf1_unit_find_nearest_line (stash, eachUnit, addr,
filename_ptr,
functionname_ptr,
linenumber_ptr);
while (stash->currentDie < stash->debug_section_end)
{
@ -582,5 +554,3 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
return FALSE;
}
/* EOF */

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
/* Routines to link ECOFF debugging information.
Copyright 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Copyright 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003,
2004, 2005, 2006 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>.
This file is part of BFD, the Binary File Descriptor library.
@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "bfd.h"
#include "sysdep.h"
@ -501,8 +501,8 @@ bfd_ecoff_debug_init (output_bfd, output_debug, output_swap, info)
ainfo = (struct accumulate *) bfd_malloc (amt);
if (!ainfo)
return NULL;
if (! bfd_hash_table_init_n (&ainfo->fdr_hash.table, string_hash_newfunc,
1021))
if (!bfd_hash_table_init_n (&ainfo->fdr_hash.table, string_hash_newfunc,
sizeof (struct string_hash_entry), 1021))
return NULL;
ainfo->line = NULL;
@ -528,7 +528,8 @@ bfd_ecoff_debug_init (output_bfd, output_debug, output_swap, info)
if (! info->relocatable)
{
if (! bfd_hash_table_init (&ainfo->str_hash.table, string_hash_newfunc))
if (!bfd_hash_table_init (&ainfo->str_hash.table, string_hash_newfunc,
sizeof (struct string_hash_entry)))
return NULL;
/* The first entry in the string table is the empty string. */
@ -800,20 +801,6 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
fdr_adr = fdr.adr;
/* Adjust the FDR address for any changes that may have been
made by relaxing. */
if (input_debug->adjust != (struct ecoff_value_adjust *) NULL)
{
struct ecoff_value_adjust *adjust;
for (adjust = input_debug->adjust;
adjust != (struct ecoff_value_adjust *) NULL;
adjust = adjust->next)
if (fdr_adr >= adjust->start
&& fdr_adr < adjust->end)
fdr.adr += adjust->adjust;
}
/* FIXME: It is conceivable that this FDR points to the .init or
.fini section, in which case this will not do the right
thing. */
@ -856,19 +843,6 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
case stLabel:
case stProc:
case stStaticProc:
if (input_debug->adjust != (struct ecoff_value_adjust *) NULL)
{
bfd_vma value;
struct ecoff_value_adjust *adjust;
value = internal_sym.value;
for (adjust = input_debug->adjust;
adjust != (struct ecoff_value_adjust *) NULL;
adjust = adjust->next)
if (value >= adjust->start
&& value < adjust->end)
internal_sym.value += adjust->adjust;
}
internal_sym.value += section_adjust[internal_sym.sc];
break;
@ -978,9 +952,8 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
output_symhdr->issMax += fdr.cbSs;
}
if ((output_bfd->xvec->header_byteorder
== input_bfd->xvec->header_byteorder)
&& input_debug->adjust == (struct ecoff_value_adjust *) NULL)
if (output_bfd->xvec->header_byteorder
== input_bfd->xvec->header_byteorder)
{
/* The two BFD's have the same endianness, and we don't have
to adjust the PDR addresses, so simply copying the
@ -1036,23 +1009,6 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
PDR pdr;
(*input_swap->swap_pdr_in) (input_bfd, (PTR) in, &pdr);
/* If we have been relaxing, we may have to adjust the
address. */
if (input_debug->adjust != (struct ecoff_value_adjust *) NULL)
{
bfd_vma adr;
struct ecoff_value_adjust *adjust;
adr = fdr_adr + pdr.adr;
for (adjust = input_debug->adjust;
adjust != (struct ecoff_value_adjust *) NULL;
adjust = adjust->next)
if (adr >= adjust->start
&& adr < adjust->end)
pdr.adr += adjust->adjust;
}
(*output_swap->swap_pdr_out) (output_bfd, &pdr, (PTR) out);
}
@ -1199,7 +1155,7 @@ bfd_ecoff_debug_accumulate_other (handle, output_bfd, output_debug,
fdr.issBase = output_symhdr->issMax;
fdr.cbSs = 0;
fdr.rss = ecoff_add_string (ainfo, info, output_debug, &fdr,
bfd_archive_filename (input_bfd));
input_bfd->filename);
if (fdr.rss == -1)
return FALSE;
fdr.isymBase = output_symhdr->isymMax;
@ -1383,10 +1339,14 @@ bfd_ecoff_debug_one_external (abfd, debug, swap, name, esym)
- (char *) debug->external_ext)
< (symhdr->iextMax + 1) * external_ext_size)
{
if (! ecoff_add_bytes ((char **) &debug->external_ext,
(char **) &debug->external_ext_end,
char *external_ext = debug->external_ext;
char *external_ext_end = debug->external_ext_end;
if (! ecoff_add_bytes ((char **) &external_ext,
(char **) &external_ext_end,
(symhdr->iextMax + 1) * (size_t) external_ext_size))
return FALSE;
debug->external_ext = external_ext;
debug->external_ext_end = external_ext_end;
}
esym->asym.iss = symhdr->issExtMax;
@ -1884,24 +1844,9 @@ mk_fdrtab (abfd, debug_info, debug_swap, line_info)
addresses do not equal the FDR vma, but they (the PDR address)
are still vma's and not offsets. Cf. comments in
'lookup_line'. */
#if 0
bfd_size_type external_pdr_size;
char *pdr_ptr;
PDR pdr;
external_pdr_size = debug_swap->external_pdr_size;
pdr_ptr = ((char *) debug_info->external_pdr
+ fdr_ptr->ipdFirst * external_pdr_size);
(*debug_swap->swap_pdr_in) (abfd, (PTR) pdr_ptr, &pdr);
/* The address of the first PDR is the offset of that
procedure relative to the beginning of file FDR. */
tab->base_addr = fdr_ptr->adr - pdr.adr;
#else
/* The address of the first PDR is the offset of that
procedure relative to the beginning of file FDR. */
tab->base_addr = fdr_ptr->adr;
#endif
}
else
{
@ -2160,11 +2105,6 @@ lookup_line (abfd, debug_info, debug_swap, line_info)
considerably, which is undesirable. */
external_pdr_size = debug_swap->external_pdr_size;
#if 0 /* eraxxon: PDR addresses (pdr.adr) are not relative to FDRs!
Leave 'offset' alone. */
/* Make offset relative to object file's start-address. */
offset -= tab[i].base_addr;
#endif
/* eraxxon: The Horrible Hack: Because of the problems above, set 'i'
to 0 so we look through all FDRs.

View file

@ -1,5 +1,5 @@
/* Generic ECOFF swapping routines, for BFD.
Copyright 1992, 1993, 1994, 1995, 1996, 2000, 2001, 2002
Copyright 1992, 1993, 1994, 1995, 1996, 2000, 2001, 2002, 2004, 2005
Free Software Foundation, Inc.
Written by Cygnus Support.
@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* NOTE: This is a header file, but it contains executable routines.
This is done this way because these routines are substantially
@ -65,40 +65,37 @@
for all ECOFF targets, so they are defined in ecofflink.c. */
extern void _bfd_ecoff_swap_tir_in
PARAMS ((int, const struct tir_ext *, TIR *));
(int, const struct tir_ext *, TIR *);
extern void _bfd_ecoff_swap_tir_out
PARAMS ((int, const TIR *, struct tir_ext *));
(int, const TIR *, struct tir_ext *);
extern void _bfd_ecoff_swap_rndx_in
PARAMS ((int, const struct rndx_ext *, RNDXR *));
(int, const struct rndx_ext *, RNDXR *);
extern void _bfd_ecoff_swap_rndx_out
PARAMS ((int, const RNDXR *, struct rndx_ext *));
(int, const RNDXR *, struct rndx_ext *);
/* Prototypes for functions defined in this file. */
static void ecoff_swap_hdr_in PARAMS ((bfd *, PTR, HDRR *));
static void ecoff_swap_hdr_out PARAMS ((bfd *, const HDRR *, PTR));
static void ecoff_swap_fdr_in PARAMS ((bfd *, PTR, FDR *));
static void ecoff_swap_fdr_out PARAMS ((bfd *, const FDR *, PTR));
static void ecoff_swap_pdr_in PARAMS ((bfd *, PTR, PDR *));
static void ecoff_swap_pdr_out PARAMS ((bfd *, const PDR *, PTR));
static void ecoff_swap_sym_in PARAMS ((bfd *, PTR, SYMR *));
static void ecoff_swap_sym_out PARAMS ((bfd *, const SYMR *, PTR));
static void ecoff_swap_ext_in PARAMS ((bfd *, PTR, EXTR *));
static void ecoff_swap_ext_out PARAMS ((bfd *, const EXTR *, PTR));
static void ecoff_swap_rfd_in PARAMS ((bfd *, PTR, RFDT *));
static void ecoff_swap_rfd_out PARAMS ((bfd *, const RFDT *, PTR));
static void ecoff_swap_opt_in PARAMS ((bfd *, PTR, OPTR *));
static void ecoff_swap_opt_out PARAMS ((bfd *, const OPTR *, PTR));
static void ecoff_swap_dnr_in PARAMS ((bfd *, PTR, DNR *));
static void ecoff_swap_dnr_out PARAMS ((bfd *, const DNR *, PTR));
static void ecoff_swap_hdr_in (bfd *, void *, HDRR *);
static void ecoff_swap_hdr_out (bfd *, const HDRR *, void *);
static void ecoff_swap_fdr_in (bfd *, void *, FDR *);
static void ecoff_swap_fdr_out (bfd *, const FDR *, void *);
static void ecoff_swap_pdr_in (bfd *, void *, PDR *);
static void ecoff_swap_pdr_out (bfd *, const PDR *, void *);
static void ecoff_swap_sym_in (bfd *, void *, SYMR *);
static void ecoff_swap_sym_out (bfd *, const SYMR *, void *);
static void ecoff_swap_ext_in (bfd *, void *, EXTR *);
static void ecoff_swap_ext_out (bfd *, const EXTR *, void *);
static void ecoff_swap_rfd_in (bfd *, void *, RFDT *);
static void ecoff_swap_rfd_out (bfd *, const RFDT *, void *);
static void ecoff_swap_opt_in (bfd *, void *, OPTR *);
static void ecoff_swap_opt_out (bfd *, const OPTR *, void *);
static void ecoff_swap_dnr_in (bfd *, void *, DNR *);
static void ecoff_swap_dnr_out (bfd *, const DNR *, void *);
/* Swap in the symbolic header. */
static void
ecoff_swap_hdr_in (abfd, ext_copy, intern)
bfd *abfd;
PTR ext_copy;
HDRR *intern;
ecoff_swap_hdr_in (bfd *abfd, void * ext_copy, HDRR *intern)
{
struct hdr_ext ext[1];
@ -131,7 +128,7 @@ ecoff_swap_hdr_in (abfd, ext_copy, intern)
intern->cbExtOffset = ECOFF_GET_OFF (abfd, ext->h_cbExtOffset);
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
abort ();
#endif
}
@ -139,10 +136,7 @@ ecoff_swap_hdr_in (abfd, ext_copy, intern)
/* Swap out the symbolic header. */
static void
ecoff_swap_hdr_out (abfd, intern_copy, ext_ptr)
bfd *abfd;
const HDRR *intern_copy;
PTR ext_ptr;
ecoff_swap_hdr_out (bfd *abfd, const HDRR *intern_copy, void * ext_ptr)
{
struct hdr_ext *ext = (struct hdr_ext *) ext_ptr;
HDRR intern[1];
@ -184,10 +178,7 @@ ecoff_swap_hdr_out (abfd, intern_copy, ext_ptr)
/* Swap in the file descriptor record. */
static void
ecoff_swap_fdr_in (abfd, ext_copy, intern)
bfd *abfd;
PTR ext_copy;
FDR *intern;
ecoff_swap_fdr_in (bfd *abfd, void * ext_copy, FDR *intern)
{
struct fdr_ext ext[1];
@ -247,7 +238,7 @@ ecoff_swap_fdr_in (abfd, ext_copy, intern)
intern->cbLine = ECOFF_GET_OFF (abfd, ext->f_cbLine);
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
abort ();
#endif
}
@ -255,10 +246,7 @@ ecoff_swap_fdr_in (abfd, ext_copy, intern)
/* Swap out the file descriptor record. */
static void
ecoff_swap_fdr_out (abfd, intern_copy, ext_ptr)
bfd *abfd;
const FDR *intern_copy;
PTR ext_ptr;
ecoff_swap_fdr_out (bfd *abfd, const FDR *intern_copy, void * ext_ptr)
{
struct fdr_ext *ext = (struct fdr_ext *) ext_ptr;
FDR intern[1];
@ -319,26 +307,21 @@ ecoff_swap_fdr_out (abfd, intern_copy, ext_ptr)
ECOFF_PUT_OFF (abfd, intern->cbLine, ext->f_cbLine);
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
abort ();
#endif
}
#ifndef MPW_C
/* Swap in the procedure descriptor record. */
static void
ecoff_swap_pdr_in (abfd, ext_copy, intern)
bfd *abfd;
PTR ext_copy;
PDR *intern;
ecoff_swap_pdr_in (bfd *abfd, void * ext_copy, PDR *intern)
{
struct pdr_ext ext[1];
*ext = *(struct pdr_ext *) ext_copy;
memset ((PTR) intern, 0, sizeof (*intern));
memset ((void *) intern, 0, sizeof (*intern));
intern->adr = ECOFF_GET_OFF (abfd, ext->p_adr);
intern->isym = H_GET_32 (abfd, ext->p_isym);
@ -386,7 +369,7 @@ ecoff_swap_pdr_in (abfd, ext_copy, intern)
#endif
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
abort ();
#endif
}
@ -394,10 +377,7 @@ ecoff_swap_pdr_in (abfd, ext_copy, intern)
/* Swap out the procedure descriptor record. */
static void
ecoff_swap_pdr_out (abfd, intern_copy, ext_ptr)
bfd *abfd;
const PDR *intern_copy;
PTR ext_ptr;
ecoff_swap_pdr_out (bfd *abfd, const PDR *intern_copy, void * ext_ptr)
{
struct pdr_ext *ext = (struct pdr_ext *) ext_ptr;
PDR intern[1];
@ -449,90 +429,15 @@ ecoff_swap_pdr_out (abfd, intern_copy, ext_ptr)
#endif
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
abort ();
#endif
}
#else /* MPW_C */
/* Same routines, but with ECOFF_64 code removed, so ^&%$#&! MPW C doesn't
corrupt itself and then freak out. */
/* Swap in the procedure descriptor record. */
static void
ecoff_swap_pdr_in (abfd, ext_copy, intern)
bfd *abfd;
PTR ext_copy;
PDR *intern;
{
struct pdr_ext ext[1];
*ext = *(struct pdr_ext *) ext_copy;
intern->adr = ECOFF_GET_OFF (abfd, ext->p_adr);
intern->isym = H_GET_32 (abfd, ext->p_isym);
intern->iline = H_GET_32 (abfd, ext->p_iline);
intern->regmask = H_GET_32 (abfd, ext->p_regmask);
intern->regoffset = H_GET_S32 (abfd, ext->p_regoffset);
intern->iopt = H_GET_S32 (abfd, ext->p_iopt);
intern->fregmask = H_GET_32 (abfd, ext->p_fregmask);
intern->fregoffset = H_GET_S32 (abfd, ext->p_fregoffset);
intern->frameoffset = H_GET_S32 (abfd, ext->p_frameoffset);
intern->framereg = H_GET_16 (abfd, ext->p_framereg);
intern->pcreg = H_GET_16 (abfd, ext->p_pcreg);
intern->lnLow = H_GET_32 (abfd, ext->p_lnLow);
intern->lnHigh = H_GET_32 (abfd, ext->p_lnHigh);
intern->cbLineOffset = ECOFF_GET_OFF (abfd, ext->p_cbLineOffset);
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
abort ();
#endif
}
/* Swap out the procedure descriptor record. */
static void
ecoff_swap_pdr_out (abfd, intern_copy, ext_ptr)
bfd *abfd;
const PDR *intern_copy;
PTR ext_ptr;
{
struct pdr_ext *ext = (struct pdr_ext *) ext_ptr;
PDR intern[1];
/* Make it reasonable to do in-place. */
*intern = *intern_copy;
ECOFF_PUT_OFF (abfd, intern->adr, ext->p_adr);
H_PUT_32 (abfd, intern->isym, ext->p_isym);
H_PUT_32 (abfd, intern->iline, ext->p_iline);
H_PUT_32 (abfd, intern->regmask, ext->p_regmask);
H_PUT_32 (abfd, intern->regoffset, ext->p_regoffset);
H_PUT_32 (abfd, intern->iopt, ext->p_iopt);
H_PUT_32 (abfd, intern->fregmask, ext->p_fregmask);
H_PUT_32 (abfd, intern->fregoffset, ext->p_fregoffset);
H_PUT_32 (abfd, intern->frameoffset, ext->p_frameoffset);
H_PUT_16 (abfd, intern->framereg, ext->p_framereg);
H_PUT_16 (abfd, intern->pcreg, ext->p_pcreg);
H_PUT_32 (abfd, intern->lnLow, ext->p_lnLow);
H_PUT_32 (abfd, intern->lnHigh, ext->p_lnHigh);
ECOFF_PUT_OFF (abfd, intern->cbLineOffset, ext->p_cbLineOffset);
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
abort ();
#endif
}
#endif /* MPW_C */
/* Swap in a symbol record. */
static void
ecoff_swap_sym_in (abfd, ext_copy, intern)
bfd *abfd;
PTR ext_copy;
SYMR *intern;
ecoff_swap_sym_in (bfd *abfd, void * ext_copy, SYMR *intern)
{
struct sym_ext ext[1];
@ -578,7 +483,7 @@ ecoff_swap_sym_in (abfd, ext_copy, intern)
}
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
abort ();
#endif
}
@ -586,10 +491,7 @@ ecoff_swap_sym_in (abfd, ext_copy, intern)
/* Swap out a symbol record. */
static void
ecoff_swap_sym_out (abfd, intern_copy, ext_ptr)
bfd *abfd;
const SYMR *intern_copy;
PTR ext_ptr;
ecoff_swap_sym_out (bfd *abfd, const SYMR *intern_copy, void * ext_ptr)
{
struct sym_ext *ext = (struct sym_ext *) ext_ptr;
SYMR intern[1];
@ -631,7 +533,7 @@ ecoff_swap_sym_out (abfd, intern_copy, ext_ptr)
}
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
abort ();
#endif
}
@ -639,10 +541,7 @@ ecoff_swap_sym_out (abfd, intern_copy, ext_ptr)
/* Swap in an external symbol record. */
static void
ecoff_swap_ext_in (abfd, ext_copy, intern)
bfd *abfd;
PTR ext_copy;
EXTR *intern;
ecoff_swap_ext_in (bfd *abfd, void * ext_copy, EXTR *intern)
{
struct ext_ext ext[1];
@ -673,7 +572,7 @@ ecoff_swap_ext_in (abfd, ext_copy, intern)
ecoff_swap_sym_in (abfd, &ext->es_asym, &intern->asym);
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
abort ();
#endif
}
@ -681,10 +580,7 @@ ecoff_swap_ext_in (abfd, ext_copy, intern)
/* Swap out an external symbol record. */
static void
ecoff_swap_ext_out (abfd, intern_copy, ext_ptr)
bfd *abfd;
const EXTR *intern_copy;
PTR ext_ptr;
ecoff_swap_ext_out (bfd *abfd, const EXTR *intern_copy, void * ext_ptr)
{
struct ext_ext *ext = (struct ext_ext *) ext_ptr;
EXTR intern[1];
@ -726,7 +622,7 @@ ecoff_swap_ext_out (abfd, intern_copy, ext_ptr)
ecoff_swap_sym_out (abfd, &intern->asym, &ext->es_asym);
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
abort ();
#endif
}
@ -734,17 +630,14 @@ ecoff_swap_ext_out (abfd, intern_copy, ext_ptr)
/* Swap in a relative file descriptor. */
static void
ecoff_swap_rfd_in (abfd, ext_ptr, intern)
bfd *abfd;
PTR ext_ptr;
RFDT *intern;
ecoff_swap_rfd_in (bfd *abfd, void * ext_ptr, RFDT *intern)
{
struct rfd_ext *ext = (struct rfd_ext *) ext_ptr;
*intern = H_GET_32 (abfd, ext->rfd);
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
abort ();
#endif
}
@ -752,17 +645,14 @@ ecoff_swap_rfd_in (abfd, ext_ptr, intern)
/* Swap out a relative file descriptor. */
static void
ecoff_swap_rfd_out (abfd, intern, ext_ptr)
bfd *abfd;
const RFDT *intern;
PTR ext_ptr;
ecoff_swap_rfd_out (bfd *abfd, const RFDT *intern, void * ext_ptr)
{
struct rfd_ext *ext = (struct rfd_ext *) ext_ptr;
H_PUT_32 (abfd, *intern, ext->rfd);
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
abort ();
#endif
}
@ -770,10 +660,7 @@ ecoff_swap_rfd_out (abfd, intern, ext_ptr)
/* Swap in an optimization symbol. */
static void
ecoff_swap_opt_in (abfd, ext_copy, intern)
bfd *abfd;
PTR ext_copy;
OPTR *intern;
ecoff_swap_opt_in (bfd *abfd, void * ext_copy, OPTR * intern)
{
struct opt_ext ext[1];
@ -803,7 +690,7 @@ ecoff_swap_opt_in (abfd, ext_copy, intern)
intern->offset = H_GET_32 (abfd, ext->o_offset);
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
abort ();
#endif
}
@ -811,10 +698,7 @@ ecoff_swap_opt_in (abfd, ext_copy, intern)
/* Swap out an optimization symbol. */
static void
ecoff_swap_opt_out (abfd, intern_copy, ext_ptr)
bfd *abfd;
const OPTR *intern_copy;
PTR ext_ptr;
ecoff_swap_opt_out (bfd *abfd, const OPTR *intern_copy, void * ext_ptr)
{
struct opt_ext *ext = (struct opt_ext *) ext_ptr;
OPTR intern[1];
@ -843,7 +727,7 @@ ecoff_swap_opt_out (abfd, intern_copy, ext_ptr)
H_PUT_32 (abfd, intern->value, ext->o_offset);
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
abort ();
#endif
}
@ -851,10 +735,7 @@ ecoff_swap_opt_out (abfd, intern_copy, ext_ptr)
/* Swap in a dense number. */
static void
ecoff_swap_dnr_in (abfd, ext_copy, intern)
bfd *abfd;
PTR ext_copy;
DNR *intern;
ecoff_swap_dnr_in (bfd *abfd, void * ext_copy, DNR *intern)
{
struct dnr_ext ext[1];
@ -864,7 +745,7 @@ ecoff_swap_dnr_in (abfd, ext_copy, intern)
intern->index = H_GET_32 (abfd, ext->d_index);
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
abort ();
#endif
}
@ -872,10 +753,7 @@ ecoff_swap_dnr_in (abfd, ext_copy, intern)
/* Swap out a dense number. */
static void
ecoff_swap_dnr_out (abfd, intern_copy, ext_ptr)
bfd *abfd;
const DNR *intern_copy;
PTR ext_ptr;
ecoff_swap_dnr_out (bfd *abfd, const DNR *intern_copy, void * ext_ptr)
{
struct dnr_ext *ext = (struct dnr_ext *) ext_ptr;
DNR intern[1];
@ -887,7 +765,7 @@ ecoff_swap_dnr_out (abfd, intern_copy, ext_ptr)
H_PUT_32 (abfd, intern->index, ext->d_index);
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
abort ();
#endif
}

View file

@ -16,7 +16,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "bfd.h"
#include "sysdep.h"

View file

@ -16,7 +16,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "bfd.h"
#include "sysdep.h"

View file

@ -1,6 +1,6 @@
/* BFD back-end data structures for ELF files.
Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002, 2003, 2004 Free Software Foundation, Inc.
2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _LIBELF_H_
#define _LIBELF_H_ 1
@ -104,40 +104,6 @@ struct elf_link_hash_entry
not visible outside this DSO. */
long dynindx;
/* String table index in .dynstr if this is a dynamic symbol. */
unsigned long dynstr_index;
/* Hash value of the name computed using the ELF hash function. */
unsigned long elf_hash_value;
/* If this is a weak defined symbol from a dynamic object, this
field points to a defined symbol with the same value, if there is
one. Otherwise it is NULL. */
struct elf_link_hash_entry *weakdef;
/* Version information. */
union
{
/* This field is used for a symbol which is not defined in a
regular object. It points to the version information read in
from the dynamic object. */
Elf_Internal_Verdef *verdef;
/* This field is used for a symbol which is defined in a regular
object. It is set up in size_dynamic_sections. It points to
the version information we should write out for this symbol. */
struct bfd_elf_version_tree *vertree;
} verinfo;
/* Virtual table entry use information. This array is nominally of size
size/sizeof(target_void_pointer), though we have to be able to assume
and track a size while the symbol is still undefined. It is indexed
via offset/sizeof(target_void_pointer). */
size_t vtable_entries_size;
bfd_boolean *vtable_entries_used;
/* Virtual table derivation info. */
struct elf_link_hash_entry *vtable_parent;
/* If this symbol requires an entry in the global offset table, the
processor specific backend uses this field to track usage and
final offset. Two schemes are supported: The first assumes that
@ -162,47 +128,89 @@ struct elf_link_hash_entry
bfd_size_type size;
/* Symbol type (STT_NOTYPE, STT_OBJECT, etc.). */
char type;
unsigned int type : 8;
/* Symbol st_other value, symbol visibility. */
unsigned char other;
unsigned int other : 8;
/* Some flags; legal values follow. */
unsigned short elf_link_hash_flags;
/* Symbol is referenced by a non-shared object. */
#define ELF_LINK_HASH_REF_REGULAR 01
unsigned int ref_regular : 1;
/* Symbol is defined by a non-shared object. */
#define ELF_LINK_HASH_DEF_REGULAR 02
unsigned int def_regular : 1;
/* Symbol is referenced by a shared object. */
#define ELF_LINK_HASH_REF_DYNAMIC 04
unsigned int ref_dynamic : 1;
/* Symbol is defined by a shared object. */
#define ELF_LINK_HASH_DEF_DYNAMIC 010
unsigned int def_dynamic : 1;
/* Symbol has a non-weak reference from a non-shared object. */
#define ELF_LINK_HASH_REF_REGULAR_NONWEAK 020
unsigned int ref_regular_nonweak : 1;
/* Dynamic symbol has been adjustd. */
#define ELF_LINK_HASH_DYNAMIC_ADJUSTED 040
unsigned int dynamic_adjusted : 1;
/* Symbol needs a copy reloc. */
#define ELF_LINK_HASH_NEEDS_COPY 0100
unsigned int needs_copy : 1;
/* Symbol needs a procedure linkage table entry. */
#define ELF_LINK_HASH_NEEDS_PLT 0200
unsigned int needs_plt : 1;
/* Symbol appears in a non-ELF input file. */
#define ELF_LINK_NON_ELF 0400
unsigned int non_elf : 1;
/* Symbol should be marked as hidden in the version information. */
#define ELF_LINK_HIDDEN 01000
unsigned int hidden : 1;
/* Symbol was forced to local scope due to a version script file. */
#define ELF_LINK_FORCED_LOCAL 02000
unsigned int forced_local : 1;
/* Symbol was marked during garbage collection. */
#define ELF_LINK_HASH_MARK 04000
unsigned int mark : 1;
/* Symbol is referenced by a non-GOT/non-PLT relocation. This is
not currently set by all the backends. */
#define ELF_LINK_NON_GOT_REF 010000
/* Symbol has a definition in a shared object. */
#define ELF_LINK_DYNAMIC_DEF 020000
unsigned int non_got_ref : 1;
/* Symbol has a definition in a shared object.
FIXME: There is no real need for this field if def_dynamic is never
cleared and all places that test def_dynamic also test def_regular. */
unsigned int dynamic_def : 1;
/* Symbol is weak in all shared objects. */
#define ELF_LINK_DYNAMIC_WEAK 040000
unsigned int dynamic_weak : 1;
/* Symbol is referenced with a relocation where C/C++ pointer equality
matters. */
#define ELF_LINK_POINTER_EQUALITY_NEEDED 0100000
unsigned int pointer_equality_needed : 1;
/* String table index in .dynstr if this is a dynamic symbol. */
unsigned long dynstr_index;
union
{
/* If this is a weak defined symbol from a dynamic object, this
field points to a defined symbol with the same value, if there is
one. Otherwise it is NULL. */
struct elf_link_hash_entry *weakdef;
/* Hash value of the name computed using the ELF hash function.
Used part way through size_dynamic_sections, after we've finished
with weakdefs. */
unsigned long elf_hash_value;
} u;
/* Version information. */
union
{
/* This field is used for a symbol which is not defined in a
regular object. It points to the version information read in
from the dynamic object. */
Elf_Internal_Verdef *verdef;
/* This field is used for a symbol which is defined in a regular
object. It is set up in size_dynamic_sections. It points to
the version information we should write out for this symbol. */
struct bfd_elf_version_tree *vertree;
} verinfo;
struct
{
/* Virtual table entry use information. This array is nominally of size
size/sizeof(target_void_pointer), though we have to be able to assume
and track a size while the symbol is still undefined. It is indexed
via offset/sizeof(target_void_pointer). */
size_t size;
bfd_boolean *used;
/* Virtual table derivation info. */
struct elf_link_hash_entry *parent;
} *vtable;
};
/* Will references to this symbol always reference the symbol
@ -218,6 +226,13 @@ struct elf_link_hash_entry
#define SYMBOL_CALLS_LOCAL(INFO, H) \
_bfd_elf_symbol_refs_local_p (H, INFO, 1)
/* Common symbols that are turned into definitions don't have the
DEF_REGULAR flag set, so they might appear to be undefined. */
#define ELF_COMMON_DEF_P(H) \
(!(H)->def_regular \
&& !(H)->def_dynamic \
&& (H)->root.type == bfd_link_hash_defined)
/* Records local symbols to be emitted in the dynamic symbol table. */
struct elf_link_local_dynamic_entry
@ -254,11 +269,11 @@ struct cie
{
struct cie_header hdr;
unsigned char version;
unsigned char augmentation[20];
unsigned int code_align;
int data_align;
unsigned int ra_column;
unsigned int augmentation_size;
char augmentation[20];
bfd_vma code_align;
bfd_signed_vma data_align;
bfd_vma ra_column;
bfd_vma augmentation_size;
struct elf_link_hash_entry *personality;
unsigned char per_encoding;
unsigned char lsda_encoding;
@ -271,18 +286,22 @@ struct cie
struct eh_cie_fde
{
unsigned int offset;
/* For FDEs, this points to the CIE used. */
struct eh_cie_fde *cie_inf;
unsigned int size;
asection *sec;
unsigned int offset;
unsigned int new_offset;
unsigned char fde_encoding;
unsigned char lsda_encoding;
unsigned char lsda_offset;
unsigned char cie : 1;
unsigned char removed : 1;
unsigned char make_relative : 1;
unsigned char make_lsda_relative : 1;
unsigned char per_encoding_relative : 1;
unsigned int cie : 1;
unsigned int removed : 1;
unsigned int add_augmentation_size : 1;
unsigned int add_fde_encoding : 1;
unsigned int make_relative : 1;
unsigned int make_lsda_relative : 1;
unsigned int need_lsda_relative : 1;
unsigned int per_encoding_relative : 1;
};
struct eh_frame_sec_info
@ -302,14 +321,15 @@ struct eh_frame_hdr_info
{
struct cie last_cie;
asection *last_cie_sec;
struct eh_cie_fde *last_cie_inf;
asection *hdr_sec;
unsigned int last_cie_offset;
unsigned int fde_count, array_count;
struct eh_frame_array_ent *array;
/* TRUE if .eh_frame_hdr should contain the sorted search table.
We build it if we successfully read all .eh_frame input sections
and recognize them. */
bfd_boolean table;
bfd_boolean offsets_adjusted;
};
/* ELF linker hash table. */
@ -329,13 +349,15 @@ struct elf_link_hash_table
/* The value to use when initialising got.refcount/offset and
plt.refcount/offset in an elf_link_hash_entry. Set to zero when
the values are refcounts. Set to init_offset in
size_dynamic_sections when the values may be offsets. */
union gotplt_union init_refcount;
the values are refcounts. Set to init_got_offset/init_plt_offset
in size_dynamic_sections when the values may be offsets. */
union gotplt_union init_got_refcount;
union gotplt_union init_plt_refcount;
/* The value to use for got.refcount/offset and plt.refcount/offset
when the values may be offsets. Normally (bfd_vma) -1. */
union gotplt_union init_offset;
union gotplt_union init_got_offset;
union gotplt_union init_plt_offset;
/* The number of symbols found in the link which must be put into
the .dynsym section. */
@ -356,12 +378,15 @@ struct elf_link_hash_table
/* The _GLOBAL_OFFSET_TABLE_ symbol. */
struct elf_link_hash_entry *hgot;
/* A pointer to information used to link stabs in sections. */
void *stab_info;
/* The _PROCEDURE_LINKAGE_TABLE_ symbol. */
struct elf_link_hash_entry *hplt;
/* A pointer to information used to merge SEC_MERGE sections. */
void *merge_info;
/* Used to link stabs in sections. */
struct stab_info stab_info;
/* Used by eh_frame code when editing .eh_frame. */
struct eh_frame_hdr_info eh_info;
@ -378,6 +403,10 @@ struct elf_link_hash_table
/* A linked list of BFD's loaded in the link. */
struct elf_link_loaded_list *loaded;
/* True if this target has relocatable executables, so needs dynamic
section symbols. */
bfd_boolean is_relocatable_executable;
};
/* Look up an entry in an ELF linker hash table. */
@ -520,6 +549,12 @@ struct bfd_elf_special_section
int attr;
};
enum action_discarded
{
COMPLAIN = 1,
PRETEND = 2
};
struct elf_backend_data
{
/* The architecture for this backend. */
@ -531,6 +566,14 @@ struct elf_backend_data
/* The maximum page size for this backend. */
bfd_vma maxpagesize;
/* The minimum page size for this backend. An input object will not be
considered page aligned unless its sections are correctly aligned for
pages at least this large. May be smaller than maxpagesize. */
bfd_vma minpagesize;
/* The BFD flags applied to sections created for dynamic linking. */
flagword dynamic_sec_flags;
/* A function to translate an ELF RELA relocation to a BFD arelent
structure. */
void (*elf_info_to_howto)
@ -572,11 +615,16 @@ struct elf_backend_data
bfd_boolean (*elf_backend_symbol_table_processing)
(bfd *, elf_symbol_type *, unsigned int);
/* A function to set the type of the info field. Processor-specific
/* A function to set the type of the info field. Processor-specific
types should be handled here. */
int (*elf_backend_get_symbol_type)
(Elf_Internal_Sym *, int);
/* A function to return the linker hash table entry of a symbol that
might be satisfied by an archive symbol. */
struct elf_link_hash_entry * (*elf_backend_archive_symbol_lookup)
(bfd *, struct bfd_link_info *, const char *);
/* Return true if local section symbols should have a non-null st_name.
NULL implies false. */
bfd_boolean (*elf_backend_name_local_section_symbols)
@ -592,17 +640,22 @@ struct elf_backend_data
/* A function to handle unusual section types when creating BFD
sections from ELF sections. */
bfd_boolean (*elf_backend_section_from_shdr)
(bfd *, Elf_Internal_Shdr *, const char *);
(bfd *, Elf_Internal_Shdr *, const char *, int);
/* A function to convert machine dependent section header flags to
/* A function to convert machine dependent ELF section header flags to
BFD internal section header flags. */
bfd_boolean (*elf_backend_section_flags)
(flagword *, Elf_Internal_Shdr *);
(flagword *, const Elf_Internal_Shdr *);
/* A function that returns a struct containing ELF section flags and
type for the given BFD section. */
const struct bfd_elf_special_section * (*get_sec_type_attr)
(bfd *, asection *);
/* A function to handle unusual program segment types when creating BFD
sections from ELF program segments. */
bfd_boolean (*elf_backend_section_from_phdr)
(bfd *, Elf_Internal_Phdr *, int);
(bfd *, Elf_Internal_Phdr *, int, const char *);
/* A function to set up the ELF section header for a BFD section in
preparation for writing it out. This is where the flags and type
@ -646,6 +699,11 @@ struct elf_backend_data
bfd_boolean (*elf_backend_create_dynamic_sections)
(bfd *abfd, struct bfd_link_info *info);
/* When creating a shared library, determine whether to omit the
dynamic symbol for the section. */
bfd_boolean (*elf_backend_omit_section_dynsym)
(bfd *output_bfd, struct bfd_link_info *info, asection *osec);
/* The CHECK_RELOCS function is called by the add_symbols phase of
the ELF backend linker. It is called once for each section with
relocs of an object file, just after the symbols for the object
@ -660,6 +718,13 @@ struct elf_backend_data
(bfd *abfd, struct bfd_link_info *info, asection *o,
const Elf_Internal_Rela *relocs);
/* The CHECK_DIRECTIVES function is called once per input file by
the add_symbols phase of the ELF backend linker. The function
must inspect the bfd and create any additional symbols according
to any custom directives in the bfd. */
bfd_boolean (*check_directives)
(bfd *abfd, struct bfd_link_info *info);
/* The ADJUST_DYNAMIC_SYMBOL function is called by the ELF backend
linker for every symbol which is defined by a dynamic object and
referenced by a regular object. This is called after all the
@ -768,6 +833,11 @@ struct elf_backend_data
bfd_boolean (*elf_backend_modify_segment_map)
(bfd *, struct bfd_link_info *);
/* This function is called during section garbage collection to
mark sections that define global symbols. */
bfd_boolean (*gc_mark_dynamic_ref)
(struct elf_link_hash_entry *h, void *inf);
/* This function is called during section gc to discover the section a
particular relocation refers to. */
asection * (*gc_mark_hook)
@ -808,7 +878,7 @@ struct elf_backend_data
newly created and plt/got refcounts and dynamic indices should not
be copied. */
void (*elf_backend_copy_indirect_symbol)
(const struct elf_backend_data *, struct elf_link_hash_entry *,
(struct bfd_link_info *, struct elf_link_hash_entry *,
struct elf_link_hash_entry *);
/* Modify any information related to dynamic linking such that the
@ -816,15 +886,26 @@ struct elf_backend_data
void (*elf_backend_hide_symbol)
(struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean);
/* A function to do additional symbol fixup, called by
_bfd_elf_fix_symbol_flags. */
bfd_boolean (*elf_backend_fixup_symbol)
(struct bfd_link_info *, struct elf_link_hash_entry *);
/* Merge the backend specific symbol attribute. */
void (*elf_backend_merge_symbol_attribute)
(struct elf_link_hash_entry *, const Elf_Internal_Sym *, bfd_boolean,
bfd_boolean);
/* Decide whether an undefined symbol is special and can be ignored.
This is the case for OPTIONAL symbols on IRIX. */
bfd_boolean (*elf_backend_ignore_undef_symbol)
(struct elf_link_hash_entry *);
/* Emit relocations. Overrides default routine for emitting relocs,
except during a relocatable link, or if all relocs are being emitted. */
bfd_boolean (*elf_backend_emit_relocs)
(bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *);
(bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *,
struct elf_link_hash_entry **);
/* Count relocations. Not called for relocatable links
or if all relocs are being preserved in the output. */
@ -861,6 +942,17 @@ struct elf_backend_data
bfd_boolean (*elf_backend_ignore_discarded_relocs)
(asection *);
/* What to do when ld finds relocations against symbols defined in
discarded sections. */
unsigned int (*action_discarded)
(asection *);
/* This function returns the width of FDE pointers in bytes, or 0 if
that can't be determined for some reason. The default definition
goes by the bfd's EI_CLASS. */
unsigned int (*elf_backend_eh_frame_address_size)
(bfd *, asection *);
/* These functions tell elf-eh-frame whether to attempt to turn
absolute or lsda encodings into pc-relative ones. The default
definition enables these transformations. */
@ -900,7 +992,41 @@ struct elf_backend_data
see elf.c, elfcode.h. */
bfd *(*elf_backend_bfd_from_remote_memory)
(bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
int (*target_read_memory) (bfd_vma vma, char *myaddr, int len));
int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr, int len));
/* This function is used by `_bfd_elf_get_synthetic_symtab';
see elf.c. */
bfd_vma (*plt_sym_val) (bfd_vma, const asection *, const arelent *);
/* Is symbol defined in common section? */
bfd_boolean (*common_definition) (Elf_Internal_Sym *);
/* Return a common section index for section. */
unsigned int (*common_section_index) (asection *);
/* Return a common section for section. */
asection *(*common_section) (asection *);
/* Return TRUE if we can merge 2 definitions. */
bfd_boolean (*merge_symbol) (struct bfd_link_info *,
struct elf_link_hash_entry **,
struct elf_link_hash_entry *,
Elf_Internal_Sym *, asection **,
bfd_vma *, unsigned int *,
bfd_boolean *, bfd_boolean *,
bfd_boolean *, bfd_boolean *,
bfd_boolean *, bfd_boolean *,
bfd_boolean *, bfd_boolean *,
bfd *, asection **,
bfd_boolean *, bfd_boolean *,
bfd_boolean *, bfd_boolean *,
bfd *, asection **);
/* Used to handle bad SHF_LINK_ORDER input. */
bfd_error_handler_type link_order_error_handler;
/* Name of the PLT relocation section. */
const char *relplt_name;
/* Alternate EM_xxxx machine codes for this backend. */
int elf_machine_alt1;
@ -908,13 +1034,9 @@ struct elf_backend_data
const struct elf_size_info *s;
/* An array of target specific special section map. */
/* An array of target specific special sections. */
const struct bfd_elf_special_section *special_sections;
/* offset of the _GLOBAL_OFFSET_TABLE_ symbol from the start of the
.got section */
bfd_vma got_symbol_offset;
/* The size in bytes of the header for the GOT. This includes the
so-called reserved entries on some systems. */
bfd_vma got_header_size;
@ -994,8 +1116,7 @@ struct bfd_elf_section_data
/* The number of relocations currently assigned to REL_HDR2. */
unsigned int rel_count2;
/* The ELF section number of this section. Only used for an output
file. */
/* The ELF section number of this section. */
int this_idx;
/* The ELF section number of the reloc section indicated by
@ -1012,6 +1133,9 @@ struct bfd_elf_section_data
no dynamic symbol for this section. */
int dynindx;
/* A pointer to the linked-to section for SHF_LINK_ORDER. */
asection *linked_to;
/* Used by the backend linker to store the symbol hash table entries
associated with relocs against global symbols. */
struct elf_link_hash_entry **rel_hashes;
@ -1036,6 +1160,10 @@ struct bfd_elf_section_data
struct bfd_symbol *id;
} group;
/* Optional information about section group; NULL if it doesn't
belongs to any section group. */
asection *sec_group;
/* A linked list of sections in the group. Circular when used by
the linker. */
asection *next_in_group;
@ -1044,19 +1172,21 @@ struct bfd_elf_section_data
void *sec_info;
};
#define elf_section_data(sec) ((struct bfd_elf_section_data*)sec->used_by_bfd)
#define elf_section_data(sec) ((struct bfd_elf_section_data*)(sec)->used_by_bfd)
#define elf_linked_to_section(sec) (elf_section_data(sec)->linked_to)
#define elf_section_type(sec) (elf_section_data(sec)->this_hdr.sh_type)
#define elf_section_flags(sec) (elf_section_data(sec)->this_hdr.sh_flags)
#define elf_group_name(sec) (elf_section_data(sec)->group.name)
#define elf_group_id(sec) (elf_section_data(sec)->group.id)
#define elf_next_in_group(sec) (elf_section_data(sec)->next_in_group)
#define elf_sec_group(sec) (elf_section_data(sec)->sec_group)
/* Return TRUE if section has been discarded. */
#define elf_discarded_section(sec) \
(!bfd_is_abs_section (sec) \
&& bfd_is_abs_section ((sec)->output_section) \
&& sec->sec_info_type != ELF_INFO_TYPE_MERGE \
&& sec->sec_info_type != ELF_INFO_TYPE_JUST_SYMS)
&& (sec)->sec_info_type != ELF_INFO_TYPE_MERGE \
&& (sec)->sec_info_type != ELF_INFO_TYPE_JUST_SYMS)
#define get_elf_backend_data(abfd) \
((const struct elf_backend_data *) (abfd)->xvec->backend_data)
@ -1202,7 +1332,10 @@ struct elf_obj_tdata
unsigned int cverrefs;
/* Segment flags for the PT_GNU_STACK segment. */
unsigned int stack_flags;
unsigned int stack_flags;
/* Should the PT_GNU_RELRO segment be emitted? */
bfd_boolean relro;
/* Symbol version definitions in external objects. */
Elf_Internal_Verdef *verdef;
@ -1295,8 +1428,8 @@ extern char *bfd_elf_get_str_section
extern Elf_Internal_Sym *bfd_elf_get_elf_syms
(bfd *, Elf_Internal_Shdr *, size_t, size_t, Elf_Internal_Sym *, void *,
Elf_External_Sym_Shndx *);
extern const char *bfd_elf_local_sym_name
(bfd *, Elf_Internal_Sym *);
extern const char *bfd_elf_sym_name
(bfd *, Elf_Internal_Shdr *, Elf_Internal_Sym *, asection *);
extern bfd_boolean _bfd_elf_copy_private_bfd_data
(bfd *, bfd *);
@ -1305,15 +1438,13 @@ extern bfd_boolean _bfd_elf_print_private_bfd_data
extern void bfd_elf_print_symbol
(bfd *, void *, asymbol *, bfd_print_symbol_type);
#define elf_string_from_elf_strtab(abfd, strindex) \
bfd_elf_string_from_elf_section (abfd, elf_elfheader(abfd)->e_shstrndx, \
strindex)
extern void _bfd_elf_sprintf_vma
(bfd *, char *, bfd_vma);
extern void _bfd_elf_fprintf_vma
(bfd *, void *, bfd_vma);
extern unsigned int _bfd_elf_eh_frame_address_size
(bfd *, asection *);
extern bfd_byte _bfd_elf_encode_eh_address
(bfd *abfd, struct bfd_link_info *info, asection *osec, bfd_vma offset,
asection *loc_sec, bfd_vma loc_offset, bfd_vma *encoded);
@ -1341,7 +1472,7 @@ extern bfd_boolean bfd_elf_mkcorefile
extern Elf_Internal_Shdr *bfd_elf_find_section
(bfd *, char *);
extern bfd_boolean _bfd_elf_make_section_from_shdr
(bfd *, Elf_Internal_Shdr *, const char *);
(bfd *, Elf_Internal_Shdr *, const char *, int);
extern bfd_boolean _bfd_elf_make_section_from_phdr
(bfd *, Elf_Internal_Phdr *, int, const char *);
extern struct bfd_hash_entry *_bfd_elf_link_hash_newfunc
@ -1349,26 +1480,41 @@ extern struct bfd_hash_entry *_bfd_elf_link_hash_newfunc
extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create
(bfd *);
extern void _bfd_elf_link_hash_copy_indirect
(const struct elf_backend_data *, struct elf_link_hash_entry *,
(struct bfd_link_info *, struct elf_link_hash_entry *,
struct elf_link_hash_entry *);
extern void _bfd_elf_link_hash_hide_symbol
(struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean);
extern bfd_boolean _bfd_elf_link_hash_fixup_symbol
(struct bfd_link_info *, struct elf_link_hash_entry *);
extern bfd_boolean _bfd_elf_link_hash_table_init
(struct elf_link_hash_table *, bfd *,
struct bfd_hash_entry *(*)
(struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
(struct bfd_hash_entry *, struct bfd_hash_table *, const char *),
unsigned int);
extern bfd_boolean _bfd_elf_slurp_version_tables
(bfd *);
(bfd *, bfd_boolean);
extern bfd_boolean _bfd_elf_merge_sections
(bfd *, struct bfd_link_info *);
extern bfd_boolean bfd_elf_discard_group
extern bfd_boolean _bfd_elf_match_sections_by_type
(bfd *, const asection *, bfd *, const asection *);
extern bfd_boolean bfd_elf_is_group_section
(bfd *, const struct bfd_section *);
extern void _bfd_elf_section_already_linked
(bfd *, struct bfd_section *);
extern void bfd_elf_set_group_contents
(bfd *, asection *, void *);
extern asection *_bfd_elf_check_kept_section
(asection *);
extern void _bfd_elf_link_just_syms
(asection *, struct bfd_link_info *);
extern bfd_boolean _bfd_elf_copy_private_header_data
(bfd *, bfd *);
extern bfd_boolean _bfd_elf_copy_private_symbol_data
(bfd *, asymbol *, bfd *, asymbol *);
#define _bfd_generic_init_private_section_data \
_bfd_elf_init_private_section_data
extern bfd_boolean _bfd_elf_init_private_section_data
(bfd *, asection *, bfd *, asection *, struct bfd_link_info *);
extern bfd_boolean _bfd_elf_copy_private_section_data
(bfd *, asection *, bfd *, asection *);
extern bfd_boolean _bfd_elf_write_object_contents
@ -1385,6 +1531,8 @@ extern long _bfd_elf_get_dynamic_symtab_upper_bound
(bfd *);
extern long _bfd_elf_canonicalize_dynamic_symtab
(bfd *, asymbol **);
extern long _bfd_elf_get_synthetic_symtab
(bfd *, long, asymbol **, long, asymbol **, asymbol **);
extern long _bfd_elf_get_reloc_upper_bound
(bfd *, sec_ptr);
extern long _bfd_elf_canonicalize_reloc
@ -1406,6 +1554,11 @@ extern bfd_boolean _bfd_elf_set_arch_mach
extern bfd_boolean _bfd_elf_find_nearest_line
(bfd *, asection *, asymbol **, bfd_vma, const char **, const char **,
unsigned int *);
extern bfd_boolean _bfd_elf_find_line
(bfd *, asymbol **, asymbol *, const char **, unsigned int *);
#define _bfd_generic_find_line _bfd_elf_find_line
extern bfd_boolean _bfd_elf_find_inliner_info
(bfd *, const char **, const char **, unsigned int *);
#define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols
#define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
extern int _bfd_elf_sizeof_headers
@ -1414,8 +1567,10 @@ extern bfd_boolean _bfd_elf_new_section_hook
(bfd *, asection *);
extern bfd_boolean _bfd_elf_init_reloc_shdr
(bfd *, Elf_Internal_Shdr *, asection *, bfd_boolean);
extern const struct bfd_elf_special_section *_bfd_elf_get_special_section
(const char *, const struct bfd_elf_special_section *, unsigned int);
extern const struct bfd_elf_special_section *_bfd_elf_get_sec_type_attr
(bfd *, const char *);
(bfd *, asection *);
/* If the target doesn't have reloc handling written yet: */
extern void _bfd_elf_no_info_to_howto
@ -1463,7 +1618,7 @@ extern bfd_boolean _bfd_elf_discard_section_eh_frame
extern bfd_boolean _bfd_elf_discard_section_eh_frame_hdr
(bfd *, struct bfd_link_info *);
extern bfd_vma _bfd_elf_eh_frame_section_offset
(bfd *, asection *, bfd_vma);
(bfd *, struct bfd_link_info *, asection *, bfd_vma);
extern bfd_boolean _bfd_elf_write_section_eh_frame
(bfd *, struct bfd_link_info *, asection *, bfd_byte *);
extern bfd_boolean _bfd_elf_write_section_eh_frame_hdr
@ -1473,7 +1628,8 @@ extern bfd_boolean _bfd_elf_maybe_strip_eh_frame_hdr
extern bfd_boolean _bfd_elf_merge_symbol
(bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *,
asection **, bfd_vma *, struct elf_link_hash_entry **, bfd_boolean *,
asection **, bfd_vma *, unsigned int *,
struct elf_link_hash_entry **, bfd_boolean *,
bfd_boolean *, bfd_boolean *, bfd_boolean *);
extern bfd_boolean _bfd_elf_add_default_symbol
@ -1504,12 +1660,14 @@ extern bfd_boolean _bfd_elf_validate_reloc
extern bfd_boolean _bfd_elf_link_create_dynamic_sections
(bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_elf_link_omit_section_dynsym
(bfd *, struct bfd_link_info *, asection *);
extern bfd_boolean _bfd_elf_create_dynamic_sections
(bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_elf_create_got_section
(bfd *, struct bfd_link_info *);
extern unsigned long _bfd_elf_link_renumber_dynsyms
(bfd *, struct bfd_link_info *);
extern struct elf_link_hash_entry *_bfd_elf_define_linkage_sym
(bfd *, struct bfd_link_info *, asection *, const char *);
extern bfd_boolean _bfd_elfcore_make_pseudosection
(bfd *, char *, size_t, ufile_ptr);
@ -1523,7 +1681,8 @@ extern bfd_boolean _bfd_elf_link_size_reloc_section
(bfd *, Elf_Internal_Shdr *, asection *);
extern bfd_boolean _bfd_elf_link_output_relocs
(bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *);
(bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *,
struct elf_link_hash_entry **);
extern bfd_boolean _bfd_elf_fix_symbol_flags
(struct elf_link_hash_entry *, struct elf_info_failed *);
@ -1540,6 +1699,12 @@ extern bfd_boolean _bfd_elf_dynamic_symbol_p
extern bfd_boolean _bfd_elf_symbol_refs_local_p
(struct elf_link_hash_entry *, struct bfd_link_info *, bfd_boolean);
extern bfd_boolean bfd_elf_match_symbols_in_sections
(asection *sec1, asection *sec2);
extern bfd_boolean _bfd_elf_setup_sections
(bfd *);
extern const bfd_target *bfd_elf32_object_p
(bfd *);
extern const bfd_target *bfd_elf32_core_file_p
@ -1624,6 +1789,8 @@ extern void bfd_elf64_write_relocs
extern bfd_boolean bfd_elf64_slurp_reloc_table
(bfd *, asection *, asymbol **, bfd_boolean);
extern struct elf_link_hash_entry *_bfd_elf_archive_symbol_lookup
(bfd *, struct bfd_link_info *, const char *);
extern bfd_boolean bfd_elf_link_add_symbols
(bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_elf_add_dynamic_entry
@ -1637,6 +1804,19 @@ extern int bfd_elf_link_record_local_dynamic_symbol
extern bfd_boolean _bfd_elf_close_and_cleanup
(bfd *);
extern bfd_boolean _bfd_elf_common_definition
(Elf_Internal_Sym *);
extern unsigned int _bfd_elf_common_section_index
(asection *);
extern asection *_bfd_elf_common_section
(asection *);
extern void _bfd_dwarf2_cleanup_debug_info
(bfd *);
extern bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn
(bfd *, arelent *, struct bfd_symbol *, void *,
asection *, bfd *, char **);
@ -1644,6 +1824,9 @@ extern bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn
extern bfd_boolean bfd_elf_final_link
(bfd *, struct bfd_link_info *);
extern bfd_boolean bfd_elf_gc_mark_dynamic_ref_symbol
(struct elf_link_hash_entry *h, void *inf);
extern bfd_boolean bfd_elf_gc_sections
(bfd *, struct bfd_link_info *);
@ -1653,6 +1836,11 @@ extern bfd_boolean bfd_elf_gc_record_vtinherit
extern bfd_boolean bfd_elf_gc_record_vtentry
(bfd *, asection *, struct elf_link_hash_entry *, bfd_vma);
extern bfd_boolean _bfd_elf_gc_mark
(struct bfd_link_info *, asection *,
asection * (*) (asection *, struct bfd_link_info *, Elf_Internal_Rela *,
struct elf_link_hash_entry *, Elf_Internal_Sym *));
extern bfd_boolean bfd_elf_gc_common_finalize_got_offsets
(bfd *, struct bfd_link_info *);
@ -1662,6 +1850,10 @@ extern bfd_boolean bfd_elf_gc_common_final_link
extern bfd_boolean bfd_elf_reloc_symbol_deleted_p
(bfd_vma, void *);
extern struct elf_segment_map *
_bfd_elf_make_dynamic_segment
(bfd *, asection *);
/* Exported interface for writing elf corefile notes. */
extern char *elfcore_write_note
(bfd *, char *, int *, const char *, int, const void *, int);
@ -1680,10 +1872,13 @@ extern char *elfcore_write_lwpstatus
extern bfd *_bfd_elf32_bfd_from_remote_memory
(bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
int (*target_read_memory) (bfd_vma, char *, int));
int (*target_read_memory) (bfd_vma, bfd_byte *, int));
extern bfd *_bfd_elf64_bfd_from_remote_memory
(bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
int (*target_read_memory) (bfd_vma, char *, int));
int (*target_read_memory) (bfd_vma, bfd_byte *, int));
/* Large common section. */
extern asection _bfd_elf_large_com_section;
/* SH ELF specific routine. */
@ -1695,10 +1890,8 @@ extern bfd_boolean _sh_elf_set_mach_from_flags
about initializing any .plt and .got entries in relocate_section. */
#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, SHARED, H) \
((DYN) \
&& ((SHARED) \
|| ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) \
&& ((H)->dynindx != -1 \
|| ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0))
&& ((SHARED) || !(H)->forced_local) \
&& ((H)->dynindx != -1 || (H)->forced_local))
/* This macro is to avoid lots of duplicated code in the body
of xxx_relocate_section() in the various elfxx-xxxx.c files. */

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
/* ELF strtab with GC and suffix merging support.
Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
Copyright 2001, 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
Written by Jakub Jelinek <jakub@redhat.com>.
This file is part of BFD, the Binary File Descriptor library.
@ -16,7 +16,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "bfd.h"
#include "sysdep.h"
@ -99,7 +99,8 @@ _bfd_elf_strtab_init (void)
if (table == NULL)
return NULL;
if (! bfd_hash_table_init (&table->table, elf_strtab_hash_newfunc))
if (!bfd_hash_table_init (&table->table, elf_strtab_hash_newfunc,
sizeof (struct elf_strtab_hash_entry)))
{
free (table);
return NULL;
@ -263,8 +264,8 @@ strrevcmp (const void *a, const void *b)
struct elf_strtab_hash_entry *B = *(struct elf_strtab_hash_entry **) b;
unsigned int lenA = A->len;
unsigned int lenB = B->len;
const unsigned char *s = A->root.string + lenA - 1;
const unsigned char *t = B->root.string + lenB - 1;
const unsigned char *s = (const unsigned char *) A->root.string + lenA - 1;
const unsigned char *t = (const unsigned char *) B->root.string + lenB - 1;
int l = lenA < lenB ? lenA : lenB;
while (l)

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