Import of GNU Binutils version 2.11.0.

Believe it or not, this is heavily stripped down.
This commit is contained in:
David E. O'Brien 2001-05-28 05:21:37 +00:00
parent bf9a5db426
commit c9edceadd8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/binutils/dist/; revision=77298
496 changed files with 115148 additions and 75084 deletions

View File

@ -1,7 +1,7 @@
#
# Makefile for directory with subdirs to build.
# Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 1998
# Free Software Foundation
# Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
# 1999, 2000, 2001 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
@ -37,7 +37,8 @@ infodir=${prefix}/info
mandir=${prefix}/man
gxx_include_dir=${includedir}/g++
tooldir = $(exec_prefix)/$(target)
tooldir = $(exec_prefix)/$(target_alias)
build_tooldir = $(exec_prefix)/$(target_alias)
program_transform_name =
@ -97,9 +98,9 @@ CHILL_LIB = -lchill
CXX = c++
# Use -O2 to stress test the compiler.
LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates -fexceptions
LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
CXXFLAGS_FOR_TARGET = $(CXXFLAGS)
LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates -fexceptions
LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
RANLIB = ranlib
@ -111,6 +112,7 @@ NM = nm
LD = ld
BZIPPROG = bzip2
MD5PROG = md5sum
# These values are substituted by configure.
DEFAULT_YACC = yacc
@ -167,9 +169,7 @@ OTHERS =
# This is set by the configure script to the list of directories which
# should be built using the target tools.
TARGET_CONFIGDIRS = libiberty libgloss $(SPECIAL_LIBS) newlib libio librx libstdc++ libg++ winsup opcodes bsp libstub cygmon
TARGET_CONFIGDIRS = libiberty libgloss $(SPECIAL_LIBS) newlib libio librx libstdc++ libg++ winsup opcodes bsp libstub cygmon libf2c libchill libobjc
# Target libraries are put under this directory:
# Changed by configure to $(target_alias) if cross.
@ -186,14 +186,19 @@ SET_LIB_PATH =
# the libraries. This may be changed by configure.in.
RPATH_ENVVAR = LD_LIBRARY_PATH
# This is the list of directories that may be needed in RPATH_ENVVAR
# so that programs built for the host machine work.
HOST_LIB_PATH = $$r/bfd:$$r/opcodes
# This is the list of directories that may be needed in RPATH_ENVVAR
# so that prorgams built for the target machine work.
TARGET_LIB_PATH = $$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs:$$r/$(TARGET_SUBDIR)/libstdc++
# configure.in sets SET_LIB_PATH to this if --enable-shared was used.
# Some platforms don't like blank entries, so we remove duplicate,
# leading and trailing colons.
REALLY_SET_LIB_PATH = \
if [ x"$$$(RPATH_ENVVAR)" != x ]; then \
$(RPATH_ENVVAR)=$$r/bfd:$$r/opcodes:$$$(RPATH_ENVVAR); \
else \
$(RPATH_ENVVAR)=$$r/bfd:$$r/opcodes; \
fi; \
export $(RPATH_ENVVAR);
$(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH):$(TARGET_LIB_PATH):$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
ALL = all.normal
INSTALL_TARGET = installdirs \
@ -210,66 +215,17 @@ INSTALL_TARGET_CROSS = installdirs \
$(INSTALL_X11_MODULES) \
$(INSTALL_DOSREL)
CC_FOR_TARGET = ` \
if [ -f $$r/gcc/xgcc ] ; then \
if [ -f $$r/$(TARGET_SUBDIR)/newlib/Makefile ] ; then \
case "$(target_canonical)" in \
i[3456]86-*-cygwin*) \
echo $$r/gcc/xgcc -B$$r/gcc/ -B$$r/$(TARGET_SUBDIR)/newlib/ -L$$r/$(TARGET_SUBDIR)/winsup -idirafter $$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter $$s/winsup/include -idirafter $$s/newlib/libc/include -idirafter $$s/newlib/libc/sys/cygwin -idirafter $$s/newlib/libc/sys/cygwin32 -nostdinc; \
;; \
*) \
echo $$r/gcc/xgcc -B$$r/gcc/ -idirafter $$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter $$s/newlib/libc/include -nostdinc; \
;; \
esac \
else \
echo $$r/gcc/xgcc -B$$r/gcc/; \
fi; \
else \
if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
echo $(CC); \
else \
t='$(program_transform_name)'; echo gcc | sed -e 's/x/x/' $$t; \
fi; \
fi`
# Should be substed by configure.in
FLAGS_FOR_TARGET =
CC_FOR_TARGET =
CHILL_FOR_TARGET =
CXX_FOR_TARGET =
# If CC_FOR_TARGET is not overriden on the command line, then this
# If GCC_FOR_TARGET is not overriden on the command line, then this
# variable is passed down to the gcc Makefile, where it is used to
# build libgcc2.a. We define it here so that it can itself be
# overridden on the command line.
GCC_FOR_TARGET = $$r/gcc/xgcc -B$$r/gcc/
CHILL_FOR_TARGET = ` \
if [ -f $$r/gcc/xgcc ] ; then \
echo $$r/gcc/xgcc -B$$r/gcc/ -L$$r/gcc/ch/runtime/; \
else \
if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
echo $(CC); \
else \
t='$(program_transform_name)'; echo gcc | sed -e 's/x/x/' $$t; \
fi; \
fi`
CXX_FOR_TARGET = ` \
if [ -f $$r/gcc/xgcc ] ; then \
if [ -f $$r/$(TARGET_SUBDIR)/newlib/Makefile ] ; then \
case "$(target_canonical)" in \
i[3456]86-*-cygwin*) \
echo $$r/gcc/xgcc -B$$r/gcc/ -B$$r/$(TARGET_SUBDIR)/newlib/ -L$$r/$(TARGET_SUBDIR)/winsup -idirafter $$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter $$s/winsup/include -idirafter $$s/newlib/libc/include -idirafter $$s/newlib/libc/sys/cygwin -idirafter $$s/newlib/libc/sys/cygwin32 -nostdinc; \
;; \
*) \
echo $$r/gcc/xgcc -B$$r/gcc/ -idirafter $$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter $$s/newlib/libc/include -nostdinc; \
;; \
esac \
else \
echo $$r/gcc/xgcc -B$$r/gcc/; \
fi; \
else \
if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
echo $(CXX); \
else \
t='$(program_transform_name)'; echo c++ | sed -e 's/x/x/' $$t; \
fi; \
fi`
GCC_FOR_TARGET = $$r/gcc/xgcc -B$$r/gcc/ $(FLAGS_FOR_TARGET)
AS_FOR_TARGET = ` \
if [ -f $$r/gas/as-new ] ; then \
@ -422,6 +378,7 @@ BASE_FLAGS_TO_PASS = \
"sharedstatedir=$(sharedstatedir)" \
"sysconfdir=$(sysconfdir)" \
"tooldir=$(tooldir)" \
"build_tooldir=$(build_tooldir)" \
"gxx_include_dir=$(gxx_include_dir)" \
"gcc_version=$(gcc_version)" \
"gcc_version_trigger=$(gcc_version_trigger)" \
@ -521,6 +478,7 @@ ALL_MODULES = \
all-bison \
all-byacc \
all-bzip2 \
all-cgen \
all-cvssrc \
all-db \
all-dejagnu \
@ -563,7 +521,9 @@ ALL_MODULES = \
all-sed \
all-send-pr \
all-shellutils \
all-sid \
all-sim \
all-snavigator \
all-tar \
all-tcl \
all-tcl8.1 \
@ -574,6 +534,7 @@ ALL_MODULES = \
all-uudecode \
all-wdiff \
all-zip \
all-zlib \
$(EXTRA_TARGET_HOST_ALL_MODULES)
# This is a list of the check targets for all of the modules which are
@ -597,6 +558,7 @@ CROSS_CHECK_MODULES = \
check-bfd \
check-binutils \
check-bzip2 \
check-cgen \
check-cvssrc \
check-db \
check-dejagnu \
@ -635,6 +597,8 @@ CROSS_CHECK_MODULES = \
check-sed \
check-send-pr \
check-shellutils \
check-snavigator \
check-sid \
check-sim \
check-tar \
check-tcl \
@ -667,6 +631,7 @@ INSTALL_MODULES = \
install-binutils \
install-bison \
install-byacc \
install-cgen \
install-cvssrc \
install-db \
install-dejagnu \
@ -709,7 +674,9 @@ INSTALL_MODULES = \
install-sed \
install-send-pr \
install-shellutils \
install-sid \
install-sim \
install-snavigator \
install-tar \
install-textutils \
install-tgas \
@ -764,9 +731,13 @@ INSTALL_X11_MODULES = \
ALL_TARGET_MODULES = \
all-target-libio \
all-target-libstdc++ \
all-target-libstdc++-v3 \
all-target-librx \
all-target-libg++ \
all-target-newlib \
all-target-libf2c \
all-target-libchill \
all-target-libobjc \
all-target-libtermcap \
all-target-winsup \
all-target-libgloss \
@ -774,6 +745,11 @@ ALL_TARGET_MODULES = \
all-target-gperf \
all-target-examples \
all-target-libstub \
all-target-libffi \
all-target-libjava \
all-target-zlib \
all-target-boehm-gc \
all-target-qthreads \
all-target-bsp \
all-target-cygmon
@ -782,9 +758,13 @@ ALL_TARGET_MODULES = \
CONFIGURE_TARGET_MODULES = \
configure-target-libio \
configure-target-libstdc++ \
configure-target-libstdc++-v3 \
configure-target-librx \
configure-target-libg++ \
configure-target-newlib \
configure-target-libf2c \
configure-target-libchill \
configure-target-libobjc \
configure-target-libtermcap \
configure-target-winsup \
configure-target-libgloss \
@ -792,6 +772,11 @@ CONFIGURE_TARGET_MODULES = \
configure-target-gperf \
configure-target-examples \
configure-target-libstub \
configure-target-libffi \
configure-target-libjava \
configure-target-zlib \
configure-target-boehm-gc \
configure-target-qthreads \
configure-target-bsp \
configure-target-cygmon
@ -800,10 +785,19 @@ CONFIGURE_TARGET_MODULES = \
CHECK_TARGET_MODULES = \
check-target-libio \
check-target-libstdc++ \
check-target-libstdc++-v3 \
check-target-libg++ \
check-target-newlib \
check-target-libf2c \
check-target-libchill \
check-target-libobjc \
check-target-winsup \
check-target-libiberty \
check-target-libffi \
check-target-libjava \
check-target-zlib \
check-target-boehm-gc \
check-target-qthreads \
check-target-gperf
# This is a list of the install targets for all of the modules which are
@ -811,13 +805,21 @@ CHECK_TARGET_MODULES = \
INSTALL_TARGET_MODULES = \
install-target-libio \
install-target-libstdc++ \
install-target-libstdc++-v3 \
install-target-libg++ \
install-target-newlib \
install-target-libf2c \
install-target-libchill \
install-target-libobjc \
install-target-libtermcap \
install-target-winsup \
install-target-libgloss \
install-target-libiberty \
install-target-bsp \
install-target-libjava \
install-target-zlib \
install-target-boehm-gc \
install-target-qthreads \
install-target-gperf
# This is a list of the targets for which we can do a clean-{target}.
@ -832,6 +834,7 @@ CLEAN_MODULES = \
clean-bison \
clean-byacc \
clean-bzip2 \
clean-cgen \
clean-cvssrc \
clean-db \
clean-dejagnu \
@ -874,7 +877,9 @@ CLEAN_MODULES = \
clean-sed \
clean-send-pr \
clean-shellutils \
clean-sid \
clean-sim \
clean-snavigator \
clean-tar \
clean-tcl \
clean-texinfo \
@ -883,21 +888,31 @@ CLEAN_MODULES = \
clean-time \
clean-uudecode \
clean-wdiff \
clean-zip
clean-zip \
clean-zlib
# All of the target modules that can be cleaned
CLEAN_TARGET_MODULES = \
clean-target-libio \
clean-target-libstdc++ \
clean-target-libstdc++-v3 \
clean-target-librx \
clean-target-libg++ \
clean-target-newlib \
clean-target-libf2c \
clean-target-libchill \
clean-target-libobjc \
clean-target-winsup \
clean-target-libgloss \
clean-target-libiberty \
clean-target-gperf \
clean-target-examples \
clean-target-libstub \
clean-target-libffi \
clean-target-libjava \
clean-target-zlib \
clean-target-boehm-gc \
clean-target-qthreads \
clean-target-bsp \
clean-target-cygmon
@ -1052,7 +1067,12 @@ $(CLEAN_TARGET_MODULES):
true; \
fi
clean-target: $(CLEAN_TARGET_MODULES)
clean-target: $(CLEAN_TARGET_MODULES) clean-target-libgcc
clean-target-libgcc:
test ! -d gcc/libgcc || \
(cd gcc/libgcc && find . -type d -print) | \
while read d; do rm -f gcc/$$d/libgcc.a || : ; done
-rm -rf gcc/libgcc
# Check target.
@ -1154,7 +1174,6 @@ gcc-no-fixedincludes:
mv gcc/tmp-include gcc/include 2>/dev/null; \
else true; fi
# This rule is used to build the modules which use FLAGS_TO_PASS. To
# build a target all-X means to cd to X and make all.
#
@ -1433,12 +1452,12 @@ all-gcc:
# in parallel.
#
.PHONY: bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean
bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean: all-texinfo all-bison all-byacc all-binutils all-gas all-ld
bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean: all-bootstrap
@r=`pwd`; export r; \
s=`cd $(srcdir); pwd`; export s; \
$(SET_LIB_PATH) \
echo "Bootstrapping the compiler"; \
cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) $@
cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $@
@r=`pwd`; export r; \
s=`cd $(srcdir); pwd`; export s; \
case "$@" in \
@ -1454,7 +1473,7 @@ bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean b
esac; \
$(SET_LIB_PATH) \
echo "$$msg"; \
cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) $$compare
cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $$compare
@r=`pwd`; export r; \
s=`cd $(srcdir); pwd` ; export s; \
$(SET_LIB_PATH) \
@ -1467,7 +1486,7 @@ cross: all-texinfo all-bison all-byacc all-binutils all-gas all-ld
s=`cd $(srcdir); pwd`; export s; \
$(SET_LIB_PATH) \
echo "Building the C and C++ compiler"; \
cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
@r=`pwd`; export r; \
s=`cd $(srcdir); pwd` ; export s; \
$(SET_LIB_PATH) \
@ -1533,20 +1552,23 @@ all-bash:
all-bfd: all-libiberty all-intl
all-binutils: all-libiberty all-opcodes all-bfd all-flex all-bison all-byacc all-intl
all-bison: all-texinfo
configure-target-bsp: $(ALL_GCC)
all-target-bsp: configure-target-bsp all-gcc all-binutils all-target-newlib
configure-target-boehm-gc: $(ALL_GCC_CXX) configure-target-qthreads
all-target-boehm-gc: configure-target-boehm-gc
configure-target-bsp: $(ALL_GCC_C)
all-target-bsp: configure-target-bsp
all-byacc:
all-bzip2:
all-cgen: all-libiberty
all-cvssrc:
configure-target-cygmon: $(ALL_GCC)
all-target-cygmon: configure-target-cygmon all-gas all-ld all-gcc all-target-libiberty all-target-newlib all-target-libio all-target-libstub all-target-bsp
configure-target-cygmon: $(ALL_GCC_C)
all-target-cygmon: configure-target-cygmon all-target-libiberty all-target-libio all-target-libstub all-target-bsp
all-db:
all-dejagnu: all-tcl all-expect all-tk
all-diff: all-libiberty
all-emacs:
all-emacs19: all-bison all-byacc
all-etc:
configure-target-examples: $(ALL_GCC)
configure-target-examples: $(ALL_GCC_C)
all-target-examples: configure-target-examples
all-expect: all-tcl all-tk
all-fileutils: all-libiberty
@ -1557,15 +1579,18 @@ all-gas: all-libiberty all-opcodes all-bfd all-intl
all-gash: all-tcl
all-gawk:
ALL_GCC = all-gcc
all-gcc: all-bison all-byacc all-binutils all-gas all-ld
all-bootstrap: all-libiberty all-bison all-byacc all-binutils all-gas all-ld
ALL_GCC_C = $(ALL_GCC) all-target-newlib all-target-libgloss
ALL_GCC_CXX = $(ALL_GCC_C) all-target-libstdc++ all-target-libstdc++-v3
all-gcc: all-bison all-byacc all-binutils all-gas all-ld all-zlib
all-bootstrap: all-libiberty all-texinfo all-bison all-byacc all-binutils all-gas all-ld all-zlib
GDB_TK = all-tk all-tcl all-itcl all-tix all-libgui
all-gdb: all-libiberty all-opcodes all-bfd all-mmalloc all-readline all-bison all-byacc all-sim $(gdbnlmrequirements) $(GDB_TK)
all-gettext:
all-gnuserv:
configure-target-gperf: $(ALL_GCC)
configure-target-gperf: $(ALL_GCC_C)
all-target-gperf: configure-target-gperf all-target-libiberty all-target-libstdc++
all-gprof: all-libiberty all-bfd all-opcodes all-intl
all-grep: all-libiberty
all-grez: all-libiberty all-bfd all-opcodes
all-gui: all-gdb all-libproc all-target-librx
all-guile:
@ -1577,40 +1602,56 @@ all-intl:
all-ispell: all-emacs19
all-itcl: all-tcl all-tk all-tcl8.1 all-tk8.1
all-ld: all-libiberty all-bfd all-opcodes all-bison all-byacc all-flex all-intl
configure-target-libg++: $(ALL_GCC) configure-target-librx
all-target-libg++: configure-target-libg++ all-gas all-ld all-gcc all-target-libiberty all-target-newlib all-target-libio all-target-librx all-target-libstdc++
configure-target-libg++: $(ALL_GCC_CXX) configure-target-librx
all-target-libg++: configure-target-libg++ all-target-libiberty all-target-librx
configure-target-libgloss: $(ALL_GCC)
all-target-libgloss: configure-target-libgloss configure-target-newlib
configure-target-libio: $(ALL_GCC)
configure-target-libio: $(ALL_GCC_C)
all-target-libio: configure-target-libio all-gas all-ld all-gcc all-target-libiberty all-target-newlib
check-target-libio:
check-target-libio: all-target-libstdc++
all-libgui: all-tcl all-tk all-tcl8.1 all-tk8.1 all-itcl
all-libiberty:
configure-target-librx: $(ALL_GCC) configure-target-newlib
configure-target-libffi: $(ALL_GCC_C)
all-target-libffi: configure-target-libffi
configure-target-libjava: $(ALL_GCC_CXX) configure-target-zlib configure-target-boehm-gc configure-target-qthreads configure-target-libffi
all-target-libjava: configure-target-libjava all-zip all-target-zlib all-target-boehm-gc all-target-qthreads all-target-libffi
configure-target-librx: $(ALL_GCC_C)
all-target-librx: configure-target-librx
configure-target-libstdc++: $(ALL_GCC)
all-target-libstdc++: configure-target-libstdc++ all-gas all-ld all-gcc all-target-libiberty all-target-newlib all-target-libio
configure-target-libstub: $(ALL_GCC)
configure-target-libstdc++: $(ALL_GCC_C)
all-target-libstdc++: configure-target-libstdc++ all-target-libiberty all-target-libio
configure-target-libstdc++-v3: $(ALL_GCC_C)
all-target-libstdc++-v3: configure-target-libstdc++-v3 all-target-libiberty
configure-target-libstub: $(ALL_GCC_C)
all-target-libstub: configure-target-libstub
all-libtool:
configure-target-libf2c: $(ALL_GCC_C)
all-target-libf2c: configure-target-libf2c all-target-libiberty
configure-target-libchill: $(ALL_GCC_C)
all-target-libchill: configure-target-libchill all-target-libiberty
configure-target-libobjc: $(ALL_GCC_C)
all-target-libobjc: configure-target-libobjc all-target-libiberty
all-m4: all-libiberty
all-make: all-libiberty
all-mmalloc:
configure-target-newlib: $(ALL_GCC)
configure-target-libtermcap: $(ALL_GCC)
all-target-newlib: configure-target-newlib all-binutils all-gas all-gcc
all-target-libtermcap: configure-target-libtermcap all-binutils all-gas all-gcc
all-opcodes: all-bfd all-libiberty
all-target-newlib: configure-target-newlib
configure-target-libtermcap: $(ALL_GCC_C)
all-target-libtermcap: configure-target-libtermcap
all-opcodes: all-bfd all-libiberty all-cgen
all-patch: all-libiberty
all-perl:
all-prms: all-libiberty
configure-target-qthreads: $(ALL_GCC_C)
all-target-qthreads: configure-target-qthreads
all-rcs:
all-readline:
all-recode: all-libiberty
all-sed: all-libiberty
all-send-pr: all-prms
all-shellutils:
all-sim: all-libiberty all-bfd all-opcodes all-readline
all-sid: all-tcl all-tk
all-sim: all-libiberty all-bfd all-opcodes all-readline all-cgen
all-snavigator: all-tcl all-tk all-itcl all-db all-grep all-libgui
all-tar: all-libiberty
all-tcl:
all-tcl8.1:
@ -1623,15 +1664,19 @@ all-tgas: all-libiberty all-bfd all-opcodes
all-time:
all-tix: all-tcl all-tk all-tcl8.1 all-tk8.1
all-wdiff:
all-target-winsup: all-target-newlib all-target-libiberty all-target-libtermcap configure-target-winsup
configure-target-winsup: configure-target-newlib
configure-target-winsup: $(ALL_GCC_C)
all-target-winsup: all-target-libiberty all-target-libtermcap configure-target-winsup
all-uudecode: all-libiberty
all-zip:
configure-target-libiberty: $(ALL_GCC)
all-target-libiberty: configure-target-libiberty all-gcc all-ld all-target-newlib
all-zlib:
configure-target-zlib: $(ALL_GCC_C)
all-target-zlib: configure-target-zlib
configure-target-libiberty: $(ALL_GCC_C)
all-target-libiberty: configure-target-libiberty
all-target: $(ALL_TARGET_MODULES)
install-target: $(INSTALL_TARGET_MODULES)
install-gdb: install-tcl install-tk install-itcl install-tix install-libgui
install-sid: install-tcl install-tk
### other supporting targets
MAKEDIRS= \
@ -1677,22 +1722,67 @@ DEVO_SUPPORT= README Makefile.in configure configure.in \
config.guess config.if config.sub config move-if-change \
mpw-README mpw-build.in mpw-config.in mpw-configure mpw-install \
COPYING COPYING.LIB install-sh config-ml.in symlink-tree \
mkinstalldirs ltconfig ltmain.sh missing ylwrap
mkinstalldirs ltconfig ltmain.sh missing ylwrap \
libtool.m4 gettext.m4 ltcf-c.sh ltcf-cxx.sh ltcf-gcj.sh
# Files in devo/etc used in any net release.
# ChangeLog omitted because it may refer to files which are not in this
# distribution (perhaps it would be better to include it anyway).
ETC_SUPPORT= Makefile.in configure configure.in standards.texi \
make-stds.texi standards.info* configure.texi configure.info* \
configbuild.* configdev.*
configbuild.* configdev.*
# When you use `make setup-dirs' or `make taz' you should always redefine
# this macro.
SUPPORT_FILES = list-of-support-files-for-tool-in-question
.PHONY: taz
# NOTE: No double quotes in the below. It is used within shell script
# as VER="$(VER)"
VER = ` if grep AM_INIT_AUTOMAKE $(TOOL)/configure.in >/dev/null 2>&1; then \
sed < $(TOOL)/configure.in -n 's/AM_INIT_AUTOMAKE[^,]*, *\([^)]*\))/\1/p'; \
else \
sed < $(TOOL)/Makefile.in -n 's/^VERSION *= *//p'; \
fi`
PACKAGE = $(TOOL)
.PHONY: taz
taz: $(DEVO_SUPPORT) $(SUPPORT_FILES) texinfo/texinfo.tex
$(MAKE) -f Makefile.in do-proto-toplev \
TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(SUPPORT_FILES)"
$(MAKE) -f Makefile.in do-md5sum \
TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(SUPPORT_FILES)"
$(MAKE) -f Makefile.in do-tar-bz2 \
TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(SUPPORT_FILES)"
.PHONY: gdb-taz
gdb-taz: $(DEVO_SUPPORT) $(SUPPORT_FILES) texinfo/texinfo.tex
$(MAKE) -f Makefile.in do-proto-toplev \
TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(SUPPORT_FILES)"
$(MAKE) -f Makefile.in do-md5sum \
TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(SUPPORT_FILES)"
$(MAKE) -f Makefile.in do-djunpack \
TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(SUPPORT_FILES)"
$(MAKE) -f Makefile.in do-tar-bz2 \
TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(SUPPORT_FILES)"
.PHONY: do-proto-toplev
do-proto-toplev: $(DEVO_SUPPORT) $(SUPPORT_FILES) texinfo/texinfo.tex
echo "==> Making $(PACKAGE)-$(VER)/"
# Take out texinfo from a few places.
sed -e '/^all\.normal: /s/\all-texinfo //' \
-e '/^ install-texinfo /d' \
@ -1701,7 +1791,8 @@ taz: $(DEVO_SUPPORT) $(SUPPORT_FILES) texinfo/texinfo.tex
#
./configure sun4
[ -z "$(CONFIGURE_TARGET_MODULES)" ] \
|| $(MAKE) $(CONFIGURE_TARGET_MODULES) ALL_GCC="" \
|| $(MAKE) $(CONFIGURE_TARGET_MODULES) \
ALL_GCC="" ALL_GCC_C="" ALL_GCC_CXX="" \
CC_FOR_TARGET="$(CC)" CXX_FOR_TARGET="$(CXX)"
# Make links, and run "make diststuff" or "make info" when needed.
rm -rf proto-toplev ; mkdir proto-toplev
@ -1721,7 +1812,7 @@ taz: $(DEVO_SUPPORT) $(SUPPORT_FILES) texinfo/texinfo.tex
fi ; \
else ln -s ../$$d proto-toplev/$$d ; fi ; \
done
cd etc ; $(MAKE) info
cd etc && $(MAKE) info
$(MAKE) distclean
#
mkdir proto-toplev/etc
@ -1742,25 +1833,35 @@ taz: $(DEVO_SUPPORT) $(SUPPORT_FILES) texinfo/texinfo.tex
ln -s ../../../texinfo/util/tex3patch proto-toplev/texinfo/util ; \
else true; fi
chmod -R og=u . || chmod og=u `find . -print`
if grep AM_INIT_AUTOMAKE $(TOOL)/configure.in >/dev/null 2>&1; then \
ver=`sed < $(TOOL)/configure.in -n 's/AM_INIT_AUTOMAKE[^,]*, *\([^)]*\))/\1/p'`; \
else \
ver=`sed <$(TOOL)/Makefile.in -n 's/^VERSION *= *//p'`; \
fi; \
if test x"$(PACKAGE)" = x; then \
package="$(TOOL)"; \
else \
package="$(PACKAGE)"; \
fi; \
$(MAKE) -f Makefile.in do-tar-bz2 TOOL=$(TOOL) VER=$$ver PACKAGE=$$package
do-tar-bz2:
echo "==> Making $(PACKAGE)-$(VER).tar.bz2"
#
-rm -f $(PACKAGE)-$(VER)
ln -s proto-toplev $(PACKAGE)-$(VER)
tar cfh $(PACKAGE)-$(VER).tar $(PACKAGE)-$(VER)
.PHONY: do-tar-bz2
do-tar-bz2:
echo "==> Making $(PACKAGE)-$(VER).tar.bz2"
-rm -f $(PACKAGE)-$(VER).tar.bz2
find $(PACKAGE)-$(VER) -follow -name CVS -prune -o -type f -print \
| tar cTfh - $(PACKAGE)-$(VER).tar
$(BZIPPROG) -v -9 $(PACKAGE)-$(VER).tar
.PHONY: do-md5sum
do-md5sum:
echo "==> Adding md5 checksum to top-level directory"
cd proto-toplev && find * -follow -name CVS -prune -o -type f -print \
| xargs $(MD5PROG) > ../md5.sum
mv md5.sum proto-toplev
.PHONY: do-djunpack
do-djunpack:
echo "==> Adding updated djunpack.bat to top-level directory"
echo - 's /gdb-[0-9\.]*/gdb-'"$(VER)"'/'
sed < djunpack.bat > djunpack.new \
-e 's/gdb-[0-9][0-9\.]*/gdb-'"$(VER)"'/'
mv djunpack.new djunpack.bat
-rm -f proto-toplev/djunpack.bat
ln -s ../djunpack.bat proto-toplev/djunpack.bat
TEXINFO_SUPPORT= texinfo/texinfo.tex
DIST_SUPPORT= $(DEVO_SUPPORT) $(TEXINFO_SUPPORT)
@ -1768,6 +1869,7 @@ DIST_SUPPORT= $(DEVO_SUPPORT) $(TEXINFO_SUPPORT)
GAS_SUPPORT_DIRS= bfd include libiberty opcodes intl setup.com makefile.vms mkdep
gas.tar.bz2: $(DIST_SUPPORT) $(GAS_SUPPORT_DIRS) gas
$(MAKE) -f Makefile.in taz TOOL=gas \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(GAS_SUPPORT_DIRS)"
# The FSF "binutils" release includes gprof and ld.
@ -1775,53 +1877,62 @@ gas.tar.bz2: $(DIST_SUPPORT) $(GAS_SUPPORT_DIRS) gas
BINUTILS_SUPPORT_DIRS= bfd gas include libiberty opcodes ld gprof intl setup.com makefile.vms mkdep
binutils.tar.bz2: $(DIST_SUPPORT) $(BINUTILS_SUPPORT_DIRS) binutils
$(MAKE) -f Makefile.in taz TOOL=binutils \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(BINUTILS_SUPPORT_DIRS)"
.PHONY: gas+binutils.tar.bz2
GASB_SUPPORT_DIRS= $(GAS_SUPPORT_DIRS) binutils ld gprof
gas+binutils.tar.bz2: $(DIST_SUPPORT) $(GASB_SUPPORT_DIRS) gas
$(MAKE) -f Makefile.in taz TOOL=gas \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(GASB_SUPPORT_DIRS)"
.PHONY: libg++.tar.bz2
LIBGXX_SUPPORT_DIRS=include libstdc++ libio librx libiberty
libg++.tar.bz2: $(DIST_SUPPORT) libg++
$(MAKE) -f Makefile.in taz TOOL=libg++ \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(LIBGXX_SUPPORT_DIRS)"
GNATS_SUPPORT_DIRS=include libiberty send-pr
gnats.tar.bz2: $(DIST_SUPPORT) $(GNATS_SUPPORT_DIRS) gnats
$(MAKE) -f Makefile.in taz TOOL=gnats \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(GNATS_SUPPORT_DIRS)"
.PHONY: gdb.tar.bz2
GDB_SUPPORT_DIRS= bfd include libiberty mmalloc opcodes readline sim utils intl
gdb.tar.bz2: $(DIST_SUPPORT) $(GDB_SUPPORT_DIRS) gdb
$(MAKE) -f Makefile.in taz TOOL=gdb \
$(MAKE) -f Makefile.in gdb-taz TOOL=gdb \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(GDB_SUPPORT_DIRS)"
.PHONY: dejagnu.tar.bz2
DEJAGNU_SUPPORT_DIRS= tcl expect libiberty
dejagnu.tar.bz2: $(DIST_SUPPORT) $(DEJAGNU_SUPPORT_DIRS) dejagnu
$(MAKE) -f Makefile.in taz TOOL=dejagnu \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(DEJAGNU_SUPPORT_DIRS)"
.PHONY: gdb+dejagnu.tar.bz2
GDBD_SUPPORT_DIRS= $(GDB_SUPPORT_DIRS) tcl expect dejagnu
gdb+dejagnu.tar.bz2: $(DIST_SUPPORT) $(GDBD_SUPPORT_DIRS) gdb
$(MAKE) -f Makefile.in taz TOOL=gdb PACKAGE=gdb+dejagnu \
$(MAKE) -f Makefile.in gdb-taz TOOL=gdb PACKAGE=gdb+dejagnu \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(GDBD_SUPPORT_DIRS)"
.PHONY: insight.tar.bz2
INSIGHT_SUPPORT_DIRS= $(GDB_SUPPORT_DIRS) tcl tk itcl tix libgui
insight.tar.bz2: $(DIST_SUPPORT) $(GDB_SUPPORT_DIRS) gdb
$(MAKE) -f Makefile.in taz TOOL=gdb PACKAGE=insight \
$(MAKE) -f Makefile.in gdb-taz TOOL=gdb PACKAGE=insight \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(INSIGHT_SUPPORT_DIRS)"
.PHONY: insight+dejagnu.tar.bz2
INSIGHTD_SUPPORT_DIRS= $(INSIGHT_SUPPORT_DIRS) expect dejagnu
insight+dejagnu.tar.bz2: $(DIST_SUPPORT) $(INSIGHTD_SUPPORT_DIRS) gdb
$(MAKE) -f Makefile.in taz TOOL=gdb PACKAGE="insight+dejagnu" \
$(MAKE) -f Makefile.in gdb-taz TOOL=gdb PACKAGE="insight+dejagnu" \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(INSIGHTD_SUPPORT_DIRS)"
.PHONY: newlib.tar.bz2
@ -1839,6 +1950,7 @@ NEWLIB_SUPPORT_DIRS=libgloss
# supports newlib (if only minimally).
newlib.tar.bz2: $(DIST_SUPPORT) $(NEWLIB_SUPPORT_DIRS) newlib
$(MAKE) -f Makefile.in taz TOOL=newlib \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(NEWLIB_SUPPORT_DIRS)" \
DEVO_SUPPORT="$(DEVO_SUPPORT) COPYING.NEWLIB" newlib

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
See ../binutils/MAINTAINERS

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ BFD supports the following configure options:
Use mmap when accessing files. This is faster on some hosts,
but slower on others. It may not work on all hosts.
Report bugs with BFD to bug-gnu-utils@gnu.org.
Report bugs with BFD to bug-binutils@gnu.org.
Patches are encouraged. When sending patches, always send the output
of diff -u or diff -c from the original file to the new file. Do not

View File

@ -74,7 +74,9 @@ 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([#include <sys/procfs.h>],
[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
@ -92,7 +94,9 @@ 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([#include <sys/procfs.h>],
[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
@ -104,4 +108,18 @@ AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE_MEMBER,
AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_member_$1_$2)
])
sinclude(../libtool.m4)
dnl The lines below arrange for aclocal not to bring libtool.m4
dnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake
dnl to add a definition of LIBTOOL to Makefile.in.
ifelse(yes,no,[
AC_DEFUN([AM_PROG_LIBTOOL],)
AC_DEFUN([AM_DISABLE_SHARED],)
AC_SUBST(LIBTOOL)
])
sinclude(../gettext.m4)
ifelse(yes,no,[
AC_DEFUN([CY_WITH_NLS],)
AC_SUBST(INTLLIBS)
])

View File

@ -86,7 +86,9 @@ 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([#include <sys/procfs.h>],
[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
@ -104,7 +106,9 @@ 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([#include <sys/procfs.h>],
[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
@ -116,7 +120,39 @@ AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE_MEMBER,
AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_member_$1_$2)
])
sinclude(../libtool.m4)
dnl The lines below arrange for aclocal not to bring libtool.m4
dnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake
dnl to add a definition of LIBTOOL to Makefile.in.
ifelse(yes,no,[
AC_DEFUN([AM_PROG_LIBTOOL],)
AC_DEFUN([AM_DISABLE_SHARED],)
AC_SUBST(LIBTOOL)
])
sinclude(../gettext.m4)
ifelse(yes,no,[
AC_DEFUN([CY_WITH_NLS],)
AC_SUBST(INTLLIBS)
])
#serial 1
# This test replaces the one in autoconf.
# Currently this macro should have the same name as the autoconf macro
# because gettext's gettext.m4 (distributed in the automake package)
# still uses it. Otherwise, the use in gettext.m4 makes autoheader
# give these diagnostics:
# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
undefine([AC_ISC_POSIX])
AC_DEFUN(AC_ISC_POSIX,
[
dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
]
)
# Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things.
@ -210,415 +246,6 @@ else
fi
AC_SUBST($1)])
# serial 40 AC_PROG_LIBTOOL
AC_DEFUN(AC_PROG_LIBTOOL,
[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
# Save cache, so that ltconfig can load it
AC_CACHE_SAVE
# Actually configure libtool. ac_aux_dir is where install-sh is found.
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
|| AC_MSG_ERROR([libtool configure failed])
# Reload cache, that may have been modified by ltconfig
AC_CACHE_LOAD
# This can be used to rebuild libtool when needed
LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
# Always use our own libtool.
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
AC_SUBST(LIBTOOL)dnl
# Redirect the config.log output again, so that the ltconfig log is not
# clobbered by the next message.
exec 5>>./config.log
])
AC_DEFUN(AC_LIBTOOL_SETUP,
[AC_PREREQ(2.13)dnl
AC_REQUIRE([AC_ENABLE_SHARED])dnl
AC_REQUIRE([AC_ENABLE_STATIC])dnl
AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
AC_REQUIRE([AC_PROG_RANLIB])dnl
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_LD])dnl
AC_REQUIRE([AC_PROG_NM])dnl
AC_REQUIRE([AC_PROG_LN_S])dnl
dnl
case "$target" in
NONE) lt_target="$host" ;;
*) lt_target="$target" ;;
esac
# Check for any special flags to pass to ltconfig.
libtool_flags="--cache-file=$cache_file"
test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
[libtool_flags="$libtool_flags --enable-dlopen"])
ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
[libtool_flags="$libtool_flags --enable-win32-dll"])
AC_ARG_ENABLE(libtool-lock,
[ --disable-libtool-lock avoid locking (might break parallel builds)])
test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
# Some flags need to be propagated to the compiler or linker for good
# libtool support.
case "$lt_target" in
*-*-irix6*)
# Find out which ABI we are using.
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
case "`/usr/bin/file conftest.o`" in
*32-bit*)
LD="${LD-ld} -32"
;;
*N32*)
LD="${LD-ld} -n32"
;;
*64-bit*)
LD="${LD-ld} -64"
;;
esac
fi
rm -rf conftest*
;;
*-*-sco3.2v5*)
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -belf"
AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
[AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
if test x"$lt_cv_cc_needs_belf" != x"yes"; then
# this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
CFLAGS="$SAVE_CFLAGS"
fi
;;
ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
[*-*-cygwin* | *-*-mingw*)
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
AC_CHECK_TOOL(AS, as, false)
AC_CHECK_TOOL(OBJDUMP, objdump, false)
;;
])
esac
])
# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
# AC_ENABLE_SHARED - implement the --enable-shared flag
# Usage: AC_ENABLE_SHARED[(DEFAULT)]
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
# `yes'.
AC_DEFUN(AC_ENABLE_SHARED, [dnl
define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
AC_ARG_ENABLE(shared,
changequote(<<, >>)dnl
<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
changequote([, ])dnl
[p=${PACKAGE-default}
case "$enableval" in
yes) enable_shared=yes ;;
no) enable_shared=no ;;
*)
enable_shared=no
# Look at the argument we got. We use all the common list separators.
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
for pkg in $enableval; do
if test "X$pkg" = "X$p"; then
enable_shared=yes
fi
done
IFS="$ac_save_ifs"
;;
esac],
enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
])
# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
AC_ENABLE_SHARED(no)])
# AC_ENABLE_STATIC - implement the --enable-static flag
# Usage: AC_ENABLE_STATIC[(DEFAULT)]
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
# `yes'.
AC_DEFUN(AC_ENABLE_STATIC, [dnl
define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
AC_ARG_ENABLE(static,
changequote(<<, >>)dnl
<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
changequote([, ])dnl
[p=${PACKAGE-default}
case "$enableval" in
yes) enable_static=yes ;;
no) enable_static=no ;;
*)
enable_static=no
# Look at the argument we got. We use all the common list separators.
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
for pkg in $enableval; do
if test "X$pkg" = "X$p"; then
enable_static=yes
fi
done
IFS="$ac_save_ifs"
;;
esac],
enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
])
# AC_DISABLE_STATIC - set the default static flag to --disable-static
AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
AC_ENABLE_STATIC(no)])
# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
# `yes'.
AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
AC_ARG_ENABLE(fast-install,
changequote(<<, >>)dnl
<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
changequote([, ])dnl
[p=${PACKAGE-default}
case "$enableval" in
yes) enable_fast_install=yes ;;
no) enable_fast_install=no ;;
*)
enable_fast_install=no
# Look at the argument we got. We use all the common list separators.
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
for pkg in $enableval; do
if test "X$pkg" = "X$p"; then
enable_fast_install=yes
fi
done
IFS="$ac_save_ifs"
;;
esac],
enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
])
# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
AC_ENABLE_FAST_INSTALL(no)])
# AC_PROG_LD - find the path to the GNU or non-GNU linker
AC_DEFUN(AC_PROG_LD,
[AC_ARG_WITH(gnu-ld,
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
ac_prog=ld
if test "$ac_cv_prog_gcc" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
AC_MSG_CHECKING([for ld used by GCC])
ac_prog=`($CC -print-prog-name=ld) 2>&5`
case "$ac_prog" in
# Accept absolute paths.
changequote(,)dnl
[\\/]* | [A-Za-z]:[\\/]*)
re_direlt='/[^/][^/]*/\.\./'
changequote([,])dnl
# Canonicalize the path of ld
ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
done
test -z "$LD" && LD="$ac_prog"
;;
"")
# If it fails, then pretend we aren't using GCC.
ac_prog=ld
;;
*)
# If it is relative, then search for the first ld in PATH.
with_gnu_ld=unknown
;;
esac
elif test "$with_gnu_ld" = yes; then
AC_MSG_CHECKING([for GNU ld])
else
AC_MSG_CHECKING([for non-GNU ld])
fi
AC_CACHE_VAL(ac_cv_path_LD,
[if test -z "$LD"; then
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
ac_cv_path_LD="$ac_dir/$ac_prog"
# Check to see if the program is GNU ld. I'd rather use --version,
# but apparently some GNU ld's only accept -v.
# Break only if it was the GNU/non-GNU ld that we prefer.
if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
test "$with_gnu_ld" != no && break
else
test "$with_gnu_ld" != yes && break
fi
fi
done
IFS="$ac_save_ifs"
else
ac_cv_path_LD="$LD" # Let the user override the test with a path.
fi])
LD="$ac_cv_path_LD"
if test -n "$LD"; then
AC_MSG_RESULT($LD)
else
AC_MSG_RESULT(no)
fi
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
AC_PROG_LD_GNU
])
AC_DEFUN(AC_PROG_LD_GNU,
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
ac_cv_prog_gnu_ld=yes
else
ac_cv_prog_gnu_ld=no
fi])
])
# AC_PROG_NM - find the path to a BSD-compatible name lister
AC_DEFUN(AC_PROG_NM,
[AC_MSG_CHECKING([for BSD-compatible nm])
AC_CACHE_VAL(ac_cv_path_NM,
[if test -n "$NM"; then
# Let the user override the test.
ac_cv_path_NM="$NM"
else
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
# Check to see if the nm accepts a BSD-compat flag.
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
# nm: unknown option "B" ignored
if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
ac_cv_path_NM="$ac_dir/nm -B"
break
elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
ac_cv_path_NM="$ac_dir/nm -p"
break
else
ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
continue # so that we can try to find one that supports BSD flags
fi
fi
done
IFS="$ac_save_ifs"
test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
fi])
NM="$ac_cv_path_NM"
AC_MSG_RESULT([$NM])
])
# AC_CHECK_LIBM - check for math library
AC_DEFUN(AC_CHECK_LIBM,
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
LIBM=
case "$lt_target" in
*-*-beos* | *-*-cygwin*)
# These system don't have libm
;;
*-ncr-sysv4.3*)
AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
;;
*)
AC_CHECK_LIB(m, main, LIBM="-lm")
;;
esac
])
# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
# the libltdl convenience library, adds --enable-ltdl-convenience to
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
# to be `${top_builddir}/libltdl'. Make sure you start DIR with
# '${top_builddir}/' (note the single quotes!) if your package is not
# flat, and, if you're not using automake, define top_builddir as
# appropriate in the Makefiles.
AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
case "$enable_ltdl_convenience" in
no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
"") enable_ltdl_convenience=yes
ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
esac
LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
])
# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
# the libltdl installable library, and adds --enable-ltdl-install to
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
# to be `${top_builddir}/libltdl'. Make sure you start DIR with
# '${top_builddir}/' (note the single quotes!) if your package is not
# flat, and, if you're not using automake, define top_builddir as
# appropriate in the Makefiles.
# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
AC_CHECK_LIB(ltdl, main,
[test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
[if test x"$enable_ltdl_install" = xno; then
AC_MSG_WARN([libltdl not installed, but installation disabled])
else
enable_ltdl_install=yes
fi
])
if test x"$enable_ltdl_install" = x"yes"; then
ac_configure_args="$ac_configure_args --enable-ltdl-install"
LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
else
ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
LIBLTDL="-lltdl"
INCLTDL=
fi
])
dnl old names
AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
dnl This is just to silence aclocal about the macro not being used
ifelse([AC_DISABLE_FAST_INSTALL])dnl
# Like AC_CONFIG_HEADER, but automatically create stamp file.
AC_DEFUN(AM_CONFIG_HEADER,
@ -675,348 +302,3 @@ else
$1_FALSE=
fi])
# This file is derived from `gettext.m4'. The difference is that the
# included macros assume Cygnus-style source and build trees.
# Macro to add for using GNU gettext.
# Ulrich Drepper <drepper@cygnus.com>, 1995.
#
# This file file be copied and used freely without restrictions. It can
# be used in projects which are not available under the GNU Public License
# but which still want to provide support for the GNU gettext functionality.
# Please note that the actual code is *not* freely available.
# serial 3
AC_DEFUN(CY_WITH_NLS,
[AC_MSG_CHECKING([whether NLS is requested])
dnl Default is enabled NLS
AC_ARG_ENABLE(nls,
[ --disable-nls do not use Native Language Support],
USE_NLS=$enableval, USE_NLS=yes)
AC_MSG_RESULT($USE_NLS)
AC_SUBST(USE_NLS)
USE_INCLUDED_LIBINTL=no
dnl If we use NLS figure out what method
if test "$USE_NLS" = "yes"; then
AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if NLS is requested])
AC_MSG_CHECKING([whether included gettext is requested])
AC_ARG_WITH(included-gettext,
[ --with-included-gettext use the GNU gettext library included here],
nls_cv_force_use_gnu_gettext=$withval,
nls_cv_force_use_gnu_gettext=no)
AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
dnl User does not insist on using GNU NLS library. Figure out what
dnl to use. If gettext or catgets are available (in this order) we
dnl use this. Else we have to fall back to GNU NLS library.
dnl catgets is only used if permitted by option --with-catgets.
nls_cv_header_intl=
nls_cv_header_libgt=
CATOBJEXT=NONE
AC_CHECK_HEADER(libintl.h,
[AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
[AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
if test "$gt_cv_func_gettext_libc" != "yes"; then
AC_CHECK_LIB(intl, bindtextdomain,
[AC_CACHE_CHECK([for gettext in libintl],
gt_cv_func_gettext_libintl,
[AC_TRY_LINK([], [return (int) gettext ("")],
gt_cv_func_gettext_libintl=yes,
gt_cv_func_gettext_libintl=no)])])
fi
if test "$gt_cv_func_gettext_libc" = "yes" \
|| test "$gt_cv_func_gettext_libintl" = "yes"; then
AC_DEFINE(HAVE_GETTEXT, 1,
[Define as 1 if you have gettext and don't want to use GNU gettext.])
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
if test "$MSGFMT" != "no"; then
AC_CHECK_FUNCS(dcgettext)
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
return _nl_msg_cat_cntr],
[CATOBJEXT=.gmo
DATADIRNAME=share],
[CATOBJEXT=.mo
DATADIRNAME=lib])
INSTOBJEXT=.mo
fi
fi
])
dnl In the standard gettext, we would now check for catgets.
dnl However, we never want to use catgets for our releases.
if test "$CATOBJEXT" = "NONE"; then
dnl Neither gettext nor catgets in included in the C library.
dnl Fall back on GNU gettext library.
nls_cv_use_gnu_gettext=yes
fi
fi
if test "$nls_cv_use_gnu_gettext" = "yes"; then
dnl Mark actions used to generate GNU NLS library.
INTLOBJS="\$(GETTOBJS)"
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
AC_SUBST(MSGFMT)
USE_INCLUDED_LIBINTL=yes
CATOBJEXT=.gmo
INSTOBJEXT=.mo
DATADIRNAME=share
INTLDEPS='$(top_builddir)/../intl/libintl.a'
INTLLIBS=$INTLDEPS
LIBS=`echo $LIBS | sed -e 's/-lintl//'`
nls_cv_header_intl=libintl.h
nls_cv_header_libgt=libgettext.h
fi
dnl Test whether we really found GNU xgettext.
if test "$XGETTEXT" != ":"; then
dnl If it is no GNU xgettext we define it as : so that the
dnl Makefiles still can work.
if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
: ;
else
AC_MSG_RESULT(
[found xgettext programs is not GNU xgettext; ignore it])
XGETTEXT=":"
fi
fi
# We need to process the po/ directory.
POSUB=po
else
DATADIRNAME=share
nls_cv_header_intl=libintl.h
nls_cv_header_libgt=libgettext.h
fi
# If this is used in GNU gettext we have to set USE_NLS to `yes'
# because some of the sources are only built for this goal.
if test "$PACKAGE" = gettext; then
USE_NLS=yes
USE_INCLUDED_LIBINTL=yes
fi
dnl These rules are solely for the distribution goal. While doing this
dnl we only have to keep exactly one list of the available catalogs
dnl in configure.in.
for lang in $ALL_LINGUAS; do
GMOFILES="$GMOFILES $lang.gmo"
POFILES="$POFILES $lang.po"
done
dnl Make all variables we use known to autoconf.
AC_SUBST(USE_INCLUDED_LIBINTL)
AC_SUBST(CATALOGS)
AC_SUBST(CATOBJEXT)
AC_SUBST(DATADIRNAME)
AC_SUBST(GMOFILES)
AC_SUBST(INSTOBJEXT)
AC_SUBST(INTLDEPS)
AC_SUBST(INTLLIBS)
AC_SUBST(INTLOBJS)
AC_SUBST(POFILES)
AC_SUBST(POSUB)
])
AC_DEFUN(CY_GNU_GETTEXT,
[AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_RANLIB])dnl
AC_REQUIRE([AC_ISC_POSIX])dnl
AC_REQUIRE([AC_HEADER_STDC])dnl
AC_REQUIRE([AC_C_CONST])dnl
AC_REQUIRE([AC_C_INLINE])dnl
AC_REQUIRE([AC_TYPE_OFF_T])dnl
AC_REQUIRE([AC_TYPE_SIZE_T])dnl
AC_REQUIRE([AC_FUNC_ALLOCA])dnl
AC_REQUIRE([AC_FUNC_MMAP])dnl
AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
unistd.h values.h sys/param.h])
AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
__argz_count __argz_stringify __argz_next])
if test "${ac_cv_func_stpcpy+set}" != "set"; then
AC_CHECK_FUNCS(stpcpy)
fi
if test "${ac_cv_func_stpcpy}" = "yes"; then
AC_DEFINE(HAVE_STPCPY, 1, [Define if you have the stpcpy function])
fi
AM_LC_MESSAGES
CY_WITH_NLS
if test "x$CATOBJEXT" != "x"; then
if test "x$ALL_LINGUAS" = "x"; then
LINGUAS=
else
AC_MSG_CHECKING(for catalogs to be installed)
NEW_LINGUAS=
for lang in ${LINGUAS=$ALL_LINGUAS}; do
case "$ALL_LINGUAS" in
*$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
esac
done
LINGUAS=$NEW_LINGUAS
AC_MSG_RESULT($LINGUAS)
fi
dnl Construct list of names of catalog files to be constructed.
if test -n "$LINGUAS"; then
for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
fi
fi
dnl The reference to <locale.h> in the installed <libintl.h> file
dnl must be resolved because we cannot expect the users of this
dnl to define HAVE_LOCALE_H.
if test $ac_cv_header_locale_h = yes; then
INCLUDE_LOCALE_H="#include <locale.h>"
else
INCLUDE_LOCALE_H="\
/* The system does not provide the header <locale.h>. Take care yourself. */"
fi
AC_SUBST(INCLUDE_LOCALE_H)
dnl Determine which catalog format we have (if any is needed)
dnl For now we know about two different formats:
dnl Linux libc-5 and the normal X/Open format
if test -f $srcdir/po2tbl.sed.in; then
if test "$CATOBJEXT" = ".cat"; then
AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
dnl Transform the SED scripts while copying because some dumb SEDs
dnl cannot handle comments.
sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed
fi
dnl po2tbl.sed is always needed.
sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
$srcdir/po2tbl.sed.in > po2tbl.sed
fi
dnl In the intl/Makefile.in we have a special dependency which makes
dnl only sense for gettext. We comment this out for non-gettext
dnl packages.
if test "$PACKAGE" = "gettext"; then
GT_NO="#NO#"
GT_YES=
else
GT_NO=
GT_YES="#YES#"
fi
AC_SUBST(GT_NO)
AC_SUBST(GT_YES)
MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs"
AC_SUBST(MKINSTALLDIRS)
dnl *** For now the libtool support in intl/Makefile is not for real.
l=
AC_SUBST(l)
dnl Generate list of files to be processed by xgettext which will
dnl be included in po/Makefile. But only do this if the po directory
dnl exists in srcdir.
if test -d $srcdir/po; then
test -d po || mkdir po
if test "x$srcdir" != "x."; then
if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
posrcprefix="$srcdir/"
else
posrcprefix="../$srcdir/"
fi
else
posrcprefix="../"
fi
rm -f po/POTFILES
sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
< $srcdir/po/POTFILES.in > po/POTFILES
fi
])
# Search path for a program which passes the given test.
# Ulrich Drepper <drepper@cygnus.com>, 1996.
#
# This file file be copied and used freely without restrictions. It can
# be used in projects which are not available under the GNU Public License
# but which still want to provide support for the GNU gettext functionality.
# Please note that the actual code is *not* freely available.
# serial 1
dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
AC_DEFUN(AM_PATH_PROG_WITH_TEST,
[# Extract the first word of "$2", so it can be a program name with args.
set dummy $2; ac_word=[$]2
AC_MSG_CHECKING([for $ac_word])
AC_CACHE_VAL(ac_cv_path_$1,
[case "[$]$1" in
/*)
ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
;;
*)
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
for ac_dir in ifelse([$5], , $PATH, [$5]); do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
if [$3]; then
ac_cv_path_$1="$ac_dir/$ac_word"
break
fi
fi
done
IFS="$ac_save_ifs"
dnl If no 4th arg is given, leave the cache variable unset,
dnl so AC_PATH_PROGS will keep looking.
ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
])dnl
;;
esac])dnl
$1="$ac_cv_path_$1"
if test -n "[$]$1"; then
AC_MSG_RESULT([$]$1)
else
AC_MSG_RESULT(no)
fi
AC_SUBST($1)dnl
])
# Check whether LC_MESSAGES is available in <locale.h>.
# Ulrich Drepper <drepper@cygnus.com>, 1995.
#
# This file file be copied and used freely without restrictions. It can
# be used in projects which are not available under the GNU Public License
# but which still want to provide support for the GNU gettext functionality.
# Please note that the actual code is *not* freely available.
# serial 1
AC_DEFUN(AM_LC_MESSAGES,
[if test $ac_cv_header_locale_h = yes; then
AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
[AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
if test $am_cv_val_LC_MESSAGES = yes; then
AC_DEFINE(HAVE_LC_MESSAGES, 1,
[Define if your locale.h file contains LC_MESSAGES.])
fi
fi])

View File

@ -1,7 +1,7 @@
/* BFD back-end for raw ARM a.out binaries.
Copyright (C) 1994, 95, 96, 97, 98, 1999 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 program is free software; you can redistribute it and/or modify
@ -18,7 +18,6 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define N_TXTADDR(x) \
((N_MAGIC(x) == NMAGIC) ? 0x8000 : \
(N_MAGIC(x) != ZMAGIC) ? 0 : \
@ -44,7 +43,7 @@ reloc_howto_type *MYARM(bfd_reloc_type_lookup)
PARAMS((bfd *, bfd_reloc_code_real_type));
static boolean MYARM(write_object_contents) PARAMS((bfd *));
/* Avoid multiple defininitions from aoutx if supporting standarad a.out
/* Avoid multiple defininitions from aoutx if supporting standarad a.out
as well as our own. */
#define NAME(x,y) CAT3(aoutarm,_32_,y)
@ -63,7 +62,7 @@ MY(fix_pcrel_26) PARAMS ((bfd *, arelent *, asymbol *, PTR,
static void MY(swap_std_reloc_in) PARAMS ((bfd *, struct reloc_std_external *,
arelent *, asymbol **,
bfd_size_type));
void MY(swap_std_reloc_out) PARAMS ((bfd *, arelent *,
void MY(swap_std_reloc_out) PARAMS ((bfd *, arelent *,
struct reloc_std_external *));
reloc_howto_type MY(howto_table)[] =
@ -98,7 +97,7 @@ reloc_howto_type MY(howto_table)[] =
#define RELOC_ARM_BITS_NEG_LITTLE ((unsigned int) 0x10)
reloc_howto_type *
MY(reloc_howto)(abfd, rel, r_index, r_extern, r_pcrel)
MY(reloc_howto) (abfd, rel, r_index, r_extern, r_pcrel)
bfd *abfd;
struct reloc_std_external *rel;
int *r_index;
@ -139,12 +138,12 @@ MY(reloc_howto)(abfd, rel, r_index, r_extern, r_pcrel)
return MY(howto_table) + index;
}
#define 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)
MY(put_reloc) (abfd, r_extern, r_index, value, howto, reloc)
bfd *abfd;
int r_extern;
int r_index;
@ -159,7 +158,7 @@ MY(put_reloc)(abfd, r_extern, r_index, value, howto, reloc)
PUT_WORD (abfd, value, reloc->r_address);
r_length = howto->size ; /* Size as a power of two */
/* Special case for branch relocations. */
/* Special case for branch relocations. */
if (howto->type == 3 || howto->type == 7)
r_length = 3;
@ -188,12 +187,12 @@ MY(put_reloc)(abfd, r_extern, r_index, value, howto, reloc)
| (r_length << RELOC_STD_BITS_LENGTH_SH_LITTLE));
}
}
#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)
MY(relocatable_reloc) (howto, abfd, reloc, amount, r_addr)
reloc_howto_type *howto;
bfd *abfd;
struct reloc_std_external *reloc;
@ -202,11 +201,11 @@ MY(relocatable_reloc)(howto, abfd, reloc, amount, r_addr)
{
if (howto->type == 3)
{
if (reloc->r_type[0]
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. */
/* The reloc is still external, so don't modify anything. */
*amount = 0;
}
else
@ -225,7 +224,7 @@ 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,
@ -257,7 +256,7 @@ MY(fix_pcrel_26) (abfd, reloc_entry, symbol, data, input_section,
bfd_size_type addr = reloc_entry->address;
long target = bfd_get_32 (abfd, (bfd_byte *) data + addr);
bfd_reloc_status_type flag = bfd_reloc_ok;
/* If this is an undefined symbol, return error */
if (symbol->section == &bfd_und_section
&& (symbol->flags & BSF_WEAK) == 0)
@ -297,12 +296,12 @@ 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];
return flag;
}
reloc_howto_type *
MY(bfd_reloc_type_lookup)(abfd,code)
MY(bfd_reloc_type_lookup) (abfd,code)
bfd *abfd;
bfd_reloc_code_real_type code;
{
@ -392,11 +391,10 @@ MY_swap_std_reloc_out (abfd, g, natptr)
r_pcrel = 0;
}
else if (g->howto->type == 7)
{
{
r_length = 3;
r_pcrel = 1;
}
#if 0
/* For a standard reloc, the addend is in the object file. */
@ -506,7 +504,7 @@ const bfd_target aout_arm_little_vec =
BFD_JUMP_TABLE_DYNAMIC (MY),
& aout_arm_big_vec,
(PTR) MY_backend_data,
};
@ -547,6 +545,6 @@ const bfd_target aout_arm_big_vec =
BFD_JUMP_TABLE_DYNAMIC (MY),
& aout_arm_little_vec,
(PTR) MY_backend_data,
};

View File

@ -53,12 +53,12 @@ encap_object_p (abfd)
bfd_set_error (bfd_error_wrong_format);
return 0;
}
coff_magic = bfd_h_get_16 (abfd, magicbuf);
if (coff_magic != COFF_MAGIC)
return 0; /* Not an encap coff file */
__header_offset_temp==COFF_MAGIC ? sizeof(struct coffheader) : 0)
__header_offset_temp==COFF_MAGIC ? sizeof (struct coffheader) : 0)
(fseek ((f), HEADER_OFFSET((f)), 1))
magic = bfd_h_get_32 (abfd, magicbuf);
@ -72,7 +72,7 @@ encap_object_p (abfd)
bfd_set_error (bfd_error_wrong_format);
return 0;
}
NAME(aout,swap_exec_header_in)(abfd, &exec_bytes, &exec);
NAME(aout,swap_exec_header_in) (abfd, &exec_bytes, &exec);
return aout_32_some_aout_object_p (abfd, &exec, encap_realcallback);
}
@ -83,9 +83,9 @@ encap_real_callback (abfd)
bfd *abfd;
{
struct internal_exec *execp = exec_hdr (abfd);
MY(callback)(abfd, execp);
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. */

View File

@ -61,7 +61,7 @@ MY(callback) (abfd)
bfd_vma adjust;
adjust = execp->a_entry - obj_textsec (abfd)->vma;
/* Adjust only by whole pages. */
/* Adjust only by whole pages. */
adjust &= ~(TARGET_PAGE_SIZE - 1);
obj_textsec (abfd)->vma += adjust;
obj_datasec (abfd)->vma += adjust;
@ -84,7 +84,7 @@ MY(callback) (abfd)
/* The file offsets of the string table and symbol table. */
obj_sym_filepos (abfd) = N_SYMOFF (*execp);
obj_str_filepos (abfd) = N_STROFF (*execp);
/* Determine the architecture and machine type of the object file. */
#ifdef SET_ARCH_MACH
SET_ARCH_MACH(abfd, *execp);
@ -164,7 +164,7 @@ MY(object_p) (abfd)
if (!(MACHTYPE_OK (N_MACHTYPE (exec)))) return 0;
#endif
NAME(aout,swap_exec_header_in)(abfd, &exec_bytes, &exec);
NAME(aout,swap_exec_header_in) (abfd, &exec_bytes, &exec);
#ifdef SWAP_MAGIC
/* swap_exec_header_in read in a_info with the wrong byte order */
@ -178,7 +178,7 @@ MY(object_p) (abfd)
* 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. */
* 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)
@ -197,7 +197,6 @@ MY(object_p) (abfd)
#define MY_object_p MY(object_p)
#endif
#ifndef MY_mkobject
static boolean MY(mkobject) PARAMS ((bfd *));
@ -206,7 +205,7 @@ static boolean
MY(mkobject) (abfd)
bfd *abfd;
{
if (NAME(aout,mkobject)(abfd) == false)
if (NAME(aout,mkobject) (abfd) == false)
return false;
#if 0 /* Sizes get set in set_sizes callback, later, after we know
the architecture and machine. */
@ -230,7 +229,6 @@ MY(mkobject) (abfd)
static boolean MY_bfd_copy_private_section_data
PARAMS ((bfd *, asection *, bfd *, asection *));
/*ARGSUSED*/
static boolean
MY_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
bfd *ibfd;
@ -530,7 +528,6 @@ MY_bfd_final_link (abfd, info)
#define MY_bfd_link_split_section _bfd_generic_link_split_section
#endif
#ifndef MY_bfd_copy_private_bfd_data
#define MY_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data
#endif
@ -581,7 +578,7 @@ MY_bfd_final_link (abfd, info)
#endif
/* Aout symbols normally have leading underscores */
#ifndef MY_symbol_leading_char
#ifndef MY_symbol_leading_char
#define MY_symbol_leading_char '_'
#endif
@ -643,7 +640,7 @@ const bfd_target MY(vec) =
/* Alternative_target */
NULL,
(PTR) MY_backend_data
};
#endif /* MY_BFD_TARGET */

View File

@ -128,7 +128,7 @@ static CONST struct aout_backend_data tic30_aout_backend_data =
/* This table lists the relocation types for the TMS320C30. There are
only a few relocations required, and all must be divided by 4 (>>
2) to get the 32-bit addresses in the format the TMS320C30 likes
it. */
it. */
reloc_howto_type tic30_aout_howto_table[] =
{
EMPTY_HOWTO (-1),
@ -210,7 +210,7 @@ tic30_aout_reloc_howto (abfd, relocs, r_index, r_extern, r_pcrel)
requires that any relocations for the data section should point to
the end of the aligned text section, plus an offset. By default,
this does not happen, therefore this function takes care of
that. */
that. */
static bfd_reloc_status_type
tic30_aout_fix_16 (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message)
@ -224,11 +224,11 @@ tic30_aout_fix_16 (abfd, reloc_entry, symbol, data, input_section, output_bfd, e
{
bfd_vma relocation;
/* Make sure that the symbol's section is defined. */
/* Make sure that the symbol's section is defined. */
if (symbol->section == &bfd_und_section && (symbol->flags & BSF_WEAK) == 0)
return output_bfd ? bfd_reloc_ok : bfd_reloc_undefined;
/* Get the size of the input section and turn it into the TMS320C30
32-bit address format. */
32-bit address format. */
relocation = (symbol->section->vma >> 2);
relocation += bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address);
bfd_put_16 (abfd, relocation, (bfd_byte *) data + reloc_entry->address);
@ -236,7 +236,7 @@ tic30_aout_fix_16 (abfd, reloc_entry, symbol, data, input_section, output_bfd, e
}
/* This function does the same thing as tic30_aout_fix_16 except for 32
bit relocations. */
bit relocations. */
static bfd_reloc_status_type
tic30_aout_fix_32 (abfd, reloc_entry, symbol, data, input_section,
@ -251,11 +251,11 @@ tic30_aout_fix_32 (abfd, reloc_entry, symbol, data, input_section,
{
bfd_vma relocation;
/* Make sure that the symbol's section is defined. */
/* Make sure that the symbol's section is defined. */
if (symbol->section == &bfd_und_section && (symbol->flags & BSF_WEAK) == 0)
return output_bfd ? bfd_reloc_ok : bfd_reloc_undefined;
/* Get the size of the input section and turn it into the TMS320C30
32-bit address format. */
32-bit address format. */
relocation = (symbol->section->vma >> 2);
relocation += bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
bfd_put_32 (abfd, relocation, (bfd_byte *) data + reloc_entry->address);
@ -267,7 +267,7 @@ tic30_aout_fix_32 (abfd, reloc_entry, symbol, data, input_section,
useless for a relocation, so we just get the offset value and place
a version of this within the object code.
tic30_aout_final_link_relocate will then calculate the required
relocation to add on to the value in the object code. */
relocation to add on to the value in the object code. */
static bfd_reloc_status_type
tic30_aout_fix_pcrel_16 (abfd, reloc_entry, symbol, data, input_section,
@ -285,7 +285,7 @@ tic30_aout_fix_pcrel_16 (abfd, reloc_entry, symbol, data, input_section,
/* The byte before the location of the fix contains bits 23-16 of
the pcrel instruction. Bit 21 is set for a delayed instruction
which requires on offset of 3 instead of 1. */
which requires on offset of 3 instead of 1. */
if (offset_data & 0x20)
relocation -= 3;
else
@ -295,14 +295,16 @@ tic30_aout_fix_pcrel_16 (abfd, reloc_entry, symbol, data, input_section,
}
/* These macros will get 24-bit values from the bfd definition.
Big-endian only. */
#define bfd_getb_24(BFD,ADDR) (bfd_get_8(BFD,ADDR) << 16) | \
(bfd_get_8(BFD,ADDR+1) << 8) | \
(bfd_get_8(BFD,ADDR+2))
Big-endian only. */
#define bfd_getb_24(BFD,ADDR) \
(bfd_get_8 (BFD, ADDR ) << 16) | \
(bfd_get_8 (BFD, ADDR + 1) << 8) | \
(bfd_get_8 (BFD, ADDR + 2) )
#define bfd_putb_24(BFD,DATA,ADDR) bfd_put_8(BFD,(bfd_byte)((DATA >> 16) & 0xFF),ADDR); \
bfd_put_8(BFD,(bfd_byte)((DATA >> 8) & 0xFF),ADDR+1); \
bfd_put_8(BFD,(bfd_byte)(DATA & 0xFF),ADDR+2)
#define bfd_putb_24(BFD,DATA,ADDR) \
bfd_put_8 (BFD, (bfd_byte) ((DATA >> 16) & 0xFF), ADDR ); \
bfd_put_8 (BFD, (bfd_byte) ((DATA >> 8) & 0xFF), ADDR + 1); \
bfd_put_8 (BFD, (bfd_byte) ( DATA & 0xFF), ADDR + 2)
/* Set parameters about this a.out file that are machine-dependent.
This routine is called from some_aout_object_p just before it returns. */
@ -563,7 +565,7 @@ tic30_aout_object_p (abfd)
* 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. */
* 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)
@ -586,7 +588,6 @@ tic30_aout_object_p (abfd)
section contents, and copy_private_bfd_data is not called until
after the section contents have been set. */
/*ARGSUSED */
static boolean
MY_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
bfd *ibfd;
@ -720,7 +721,7 @@ MY_bfd_final_link (abfd, info)
int pad;
/* Set the executable header size to 0, as we don't want one for an
output. */
output. */
adata (abfd).exec_bytes_size = 0;
pos = adata (abfd).exec_bytes_size;
/* Text. */
@ -765,7 +766,7 @@ MY_bfd_final_link (abfd, info)
obj_bsssec (abfd)->vma = vma;
obj_bsssec (abfd)->user_set_vma = 1;
/* We are fully resized, so don't readjust in final_link. */
/* We are fully resized, so don't readjust in final_link. */
adata (abfd).magic = z_magic;
return NAME (aout, final_link) (abfd, info, MY_final_link_callback);
@ -961,7 +962,6 @@ tic30_aout_set_arch_mach (abfd, arch, machine)
#define MY_bfd_link_split_section _bfd_generic_link_split_section
#endif
#ifndef MY_bfd_copy_private_bfd_data
#define MY_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data
#endif
@ -1058,7 +1058,7 @@ const bfd_target tic30_aout_vec =
BFD_JUMP_TABLE_DYNAMIC (MY),
NULL,
(PTR) MY_backend_data
};
#endif /* MY_BFD_TARGET */

View File

@ -33,7 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* This is needed to reject a NewsOS file, e.g. in
gdb/testsuite/gdb.t10/crossload.exp. <kingdon@cygnus.com>
I needed to add M_UNKNOWN to recognize a 68000 object, so this will
probably no longer reject a NewsOS object. <ian@cygnus.com>. */
probably no longer reject a NewsOS object. <ian@cygnus.com>. */
#ifndef MACHTYPE_OK
#define MACHTYPE_OK(mtype) \
(((mtype) == M_SPARC && bfd_lookup_arch (bfd_arch_sparc, 0) != NULL) \
@ -123,7 +123,7 @@ sunos_set_arch_mach (abfd, machtype)
case M_UNKNOWN:
/* Some Sun3s make magic numbers without cpu types in them, so
we'll default to the 68000. */
we'll default to the 68000. */
arch = bfd_arch_m68k;
machine = bfd_mach_m68000;
break;
@ -180,7 +180,7 @@ sunos_set_arch_mach (abfd, machtype)
}
#define SET_ARCH_MACH(ABFD, EXEC) \
NAME(sunos,set_arch_mach)(ABFD, N_MACHTYPE (EXEC)); \
NAME(sunos,set_arch_mach) (ABFD, N_MACHTYPE (EXEC)); \
choose_reloc_size(ABFD);
/* Determine the size of a relocation entry, based on the architecture */
@ -275,11 +275,11 @@ sunos_write_object_contents (abfd)
Unfortunately, they don't document the FPA structure, or at least I
can't find it easily. Fortunately the core header contains its own
length. So this shouldn't cause problems, except for c_ucode, which
so far we don't use but is easy to find with a little arithmetic. */
so far we don't use but is easy to find with a little arithmetic. */
/* But the reg structure can be gotten from the SPARC processor handbook.
This really should be in a GNU include file though so that gdb can use
the same info. */
the same info. */
struct regs
{
int r_psr;
@ -439,7 +439,7 @@ swapcore_sun3 (abfd, ext, intcore)
intcore->c_ssize = bfd_h_get_32 (abfd, (unsigned char *) &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);
/* FP stuff takes up whole rest of struct, except c_ucode. */
/* 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 */
@ -449,7 +449,6 @@ swapcore_sun3 (abfd, ext, intcore)
intcore->c_stacktop = 0x0E000000; /* By experimentation */
}
/* byte-swap in the Sparc core structure */
static void
swapcore_sparc (abfd, ext, intcore)
@ -476,7 +475,7 @@ swapcore_sparc (abfd, ext, intcore)
intcore->c_ssize = bfd_h_get_32 (abfd, (unsigned char *) &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);
/* FP stuff takes up whole rest of struct, except c_ucode. */
/* 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 */
@ -544,7 +543,7 @@ swapcore_solaris_bcp (abfd, ext, intcore)
memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname));
intcore->fp_stuff_pos =
(long) (((struct external_solaris_bcp_core *) 0)->fp_stuff);
/* FP stuff takes up whole rest of struct, except c_ucode. */
/* 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);
/* Ucode is the last thing in the struct -- just before the end */
@ -764,7 +763,7 @@ sunos4_core_file_matches_executable_p (core_bfd, exec_bfd)
return false;
}
/* Solaris core files do not include an aouthdr. */
/* Solaris core files do not include an aouthdr. */
if ((core_hdr (core_bfd)->hdr)->c_len == SOLARIS_BCP_CORE_LEN)
return true;

View File

@ -23,7 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
SECTION
a.out backends
DESCRIPTION
BFD supports a number of different flavours of a.out format,
@ -165,10 +164,18 @@ DESCRIPTION
#define MY_swap_std_reloc_in NAME(aout,swap_std_reloc_in)
#endif
#ifndef MY_swap_ext_reloc_in
#define MY_swap_ext_reloc_in NAME(aout,swap_ext_reloc_in)
#endif
#ifndef MY_swap_std_reloc_out
#define MY_swap_std_reloc_out NAME(aout,swap_std_reloc_out)
#endif
#ifndef MY_swap_ext_reloc_out
#define MY_swap_ext_reloc_out NAME(aout,swap_ext_reloc_out)
#endif
#ifndef MY_final_link_relocate
#define MY_final_link_relocate _bfd_final_link_relocate
#endif
@ -260,7 +267,7 @@ EMPTY_HOWTO (-1),
HOWTO(40, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"BASEREL", false, 0,0x00000000, false),
};
#define TABLE_SIZE(TABLE) (sizeof(TABLE)/sizeof(TABLE[0]))
#define TABLE_SIZE(TABLE) (sizeof (TABLE)/sizeof (TABLE[0]))
reloc_howto_type *
NAME(aout,reloc_type_lookup) (abfd,code)
@ -283,6 +290,8 @@ NAME(aout,reloc_type_lookup) (abfd,code)
if (ext)
switch (code)
{
EXT (BFD_RELOC_8, 0);
EXT (BFD_RELOC_16, 1);
EXT (BFD_RELOC_32, 2);
EXT (BFD_RELOC_HI22, 8);
EXT (BFD_RELOC_LO10, 11);
@ -353,7 +362,7 @@ NAME(aout,swap_exec_header_in) (abfd, raw_bytes, execp)
/* The internal_exec structure has some fields that are unused in this
configuration (IE for i960), so ensure that all such uninitialized
fields are zero'd out. There are places where two of these structs
are memcmp'd, and thus the contents do matter. */
are memcmp'd, and thus the contents do matter. */
memset ((PTR) execp, 0, sizeof (struct internal_exec));
/* Now fill in fields in the execp, from the bytes in the raw data. */
execp->a_info = bfd_h_get_32 (abfd, bytes->e_info);
@ -390,7 +399,7 @@ NAME(aout,swap_exec_header_out) (abfd, execp, raw_bytes)
{
struct external_exec *bytes = (struct external_exec *)raw_bytes;
/* Now fill in fields in the raw data, from the fields in the exec struct. */
/* Now fill in fields in the raw data, from the fields in the exec struct. */
bfd_h_put_32 (abfd, execp->a_info , bytes->e_info);
PUT_WORD (abfd, execp->a_text , bytes->e_text);
PUT_WORD (abfd, execp->a_data , bytes->e_data);
@ -426,7 +435,7 @@ FUNCTION
SYNOPSIS
const bfd_target *aout_@var{size}_some_aout_object_p
(bfd *abfd,
const bfd_target *(*callback_to_real_object_p)());
const bfd_target *(*callback_to_real_object_p) ());
DESCRIPTION
Some a.out variant thinks that the file open in @var{abfd}
@ -507,7 +516,7 @@ NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p)
/* The default relocation entry size is that of traditional V7 Unix. */
obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
/* The default symbol entry size is that of traditional Unix. */
/* The default symbol entry size is that of traditional Unix. */
obj_symbol_entry_size (abfd) = EXTERNAL_NLIST_SIZE;
#ifdef USE_MMAP
@ -591,7 +600,7 @@ NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p)
header, should cope with them in this callback as well. */
#endif /* DOCUMENTATION */
result = (*callback_to_real_object_p)(abfd);
result = (*callback_to_real_object_p) (abfd);
/* Now that the segment addresses have been worked out, take a better
guess at whether the file is executable. If the entry point
@ -606,7 +615,7 @@ NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p)
To fix this, we now accept any non-zero entry point as an indication of
executability. This will work most of the time, since only the linker
sets the entry point, and that is likely to be non-zero for most systems. */
sets the entry point, and that is likely to be non-zero for most systems. */
if (execp->a_entry != 0
|| (execp->a_entry >= obj_textsec(abfd)->vma
@ -683,7 +692,6 @@ NAME(aout,mkobject) (abfd)
return true;
}
/*
FUNCTION
aout_@var{size}_machine_type
@ -747,7 +755,7 @@ NAME(aout,machine_type) (arch, machine, unknown)
case bfd_arch_arm:
if (machine == 0) arch_flags = M_ARM;
break;
case bfd_arch_mips:
switch (machine) {
case 0:
@ -768,7 +776,12 @@ NAME(aout,machine_type) (arch, machine, unknown)
case bfd_mach_mips8000:
case bfd_mach_mips10000:
case bfd_mach_mips16:
/* FIXME: These should be MIPS3 or MIPS4. */
case bfd_mach_mips32:
case bfd_mach_mips32_4k:
case bfd_mach_mips5:
case bfd_mach_mips64:
case bfd_mach_mips_sb1:
/* FIXME: These should be MIPS3, MIPS4, MIPS16, MIPS32, etc. */
arch_flags = M_MIPS2;
break;
default:
@ -790,6 +803,10 @@ NAME(aout,machine_type) (arch, machine, unknown)
*unknown = false;
break;
case bfd_arch_cris:
if (machine == 0 || machine == 255) arch_flags = M_CRIS;
break;
default:
arch_flags = M_UNKNOWN;
}
@ -800,7 +817,6 @@ NAME(aout,machine_type) (arch, machine, unknown)
return arch_flags;
}
/*
FUNCTION
aout_@var{size}_set_arch_mach
@ -927,7 +943,7 @@ adjust_z_magic (abfd, execp)
file_ptr text_end;
CONST struct aout_backend_data *abdp;
int ztih; /* Nonzero if text includes exec header. */
abdp = aout_backend_info (abfd);
/* Text. */
@ -995,7 +1011,7 @@ adjust_z_magic (abfd, execp)
}
obj_datasec(abfd)->filepos = (obj_textsec(abfd)->filepos
+ obj_textsec(abfd)->_raw_size);
/* Fix up exec header while we're at it. */
execp->a_text = obj_textsec(abfd)->_raw_size;
if (ztih && (!abdp || (abdp && !abdp->exec_header_not_counted)))
@ -1040,7 +1056,7 @@ adjust_n_magic (abfd, execp)
file_ptr pos = adata(abfd).exec_bytes_size;
bfd_vma vma = 0;
int pad;
/* Text. */
obj_textsec(abfd)->filepos = pos;
if (!obj_textsec(abfd)->user_set_vma)
@ -1055,7 +1071,7 @@ adjust_n_magic (abfd, execp)
if (!obj_datasec(abfd)->user_set_vma)
obj_datasec(abfd)->vma = BFD_ALIGN (vma, adata(abfd).segment_size);
vma = obj_datasec(abfd)->vma;
/* Since BSS follows data immediately, see if it needs alignment. */
vma += obj_datasec(abfd)->_raw_size;
pad = align_power (vma, obj_bsssec(abfd)->alignment_power) - vma;
@ -1100,7 +1116,7 @@ NAME(aout,adjust_sizes_and_vmas) (abfd, text_size, text_end)
(TARGET_PAGE_SIZE). However, newer versions of SUNOS start the text
segment right after the exec header; the latter is counted in the
text segment size, and is paged in by the kernel with the rest of
the text. */
the text. */
/* This perhaps isn't the right way to do this, but made it simpler for me
to understand enough to implement it. Better would probably be to go
@ -1187,7 +1203,6 @@ NAME(aout,new_section_hook) (abfd, newsect)
/* align to double at least */
newsect->alignment_power = bfd_get_arch_info(abfd)->section_align_power;
if (bfd_get_format (abfd) == bfd_object)
{
if (obj_textsec(abfd) == NULL && !strcmp(newsect->name, ".text")) {
@ -1297,7 +1312,7 @@ aout_get_external_symbols (abfd)
obj_aout_external_syms (abfd) = syms;
obj_aout_external_sym_count (abfd) = count;
}
if (obj_aout_external_strings (abfd) == NULL
&& exec_hdr (abfd)->a_syms != 0)
{
@ -1626,7 +1641,7 @@ translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer)
file. */
(*_bfd_error_handler)
(_("%s: can not represent section for symbol `%s' in a.out object file format"),
bfd_get_filename (abfd),
bfd_get_filename (abfd),
cache_ptr->name != NULL ? cache_ptr->name : _("*unknown*"));
bfd_set_error (bfd_error_nonrepresentable_section);
return false;
@ -1671,6 +1686,8 @@ translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer)
sym_pointer->e_type[0] = ((aout_symbol_type *) cache_ptr)->type;
else if ((cache_ptr->flags & BSF_GLOBAL) != 0)
sym_pointer->e_type[0] |= N_EXT;
else if ((cache_ptr->flags & BSF_LOCAL) != 0)
sym_pointer->e_type[0] &= ~N_EXT;
if ((cache_ptr->flags & BSF_CONSTRUCTOR) != 0)
{
@ -1706,7 +1723,7 @@ translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer)
return true;
}
/* Native-level interface to symbols. */
/* Native-level interface to symbols. */
asymbol *
NAME(aout,make_empty_symbol) (abfd)
@ -1773,7 +1790,7 @@ NAME(aout,translate_symbol_table) (abfd, in, ext, count, str, strsize, dynamic)
/* We read the symbols into a buffer, which is discarded when this
function exits. We read the strings into a buffer large enough to
hold them all plus all the cached symbol entries. */
hold them all plus all the cached symbol entries. */
boolean
NAME(aout,slurp_symbol_table) (abfd)
@ -1960,7 +1977,6 @@ NAME(aout,write_syms) (abfd)
_bfd_stringtab_free (strtab);
return false;
}
long
NAME(aout,get_symtab) (abfd, location)
@ -1970,18 +1986,17 @@ NAME(aout,get_symtab) (abfd, location)
unsigned int counter = 0;
aout_symbol_type *symbase;
if (!NAME(aout,slurp_symbol_table)(abfd))
if (!NAME(aout,slurp_symbol_table) (abfd))
return -1;
for (symbase = obj_aout_symbols(abfd); counter++ < bfd_get_symcount (abfd);)
*(location++) = (asymbol *)( symbase++);
*(location++) = (asymbol *) ( symbase++);
*location++ =0;
return bfd_get_symcount (abfd);
}
/* Standard reloc stuff */
/* Output standard relocation information to a file in target byte order. */
/* Output standard relocation information to a file in target byte order. */
extern void NAME(aout,swap_std_reloc_out)
PARAMS ((bfd *, arelent *, struct reloc_std_external *));
@ -2024,7 +2039,6 @@ NAME(aout,swap_std_reloc_out) (abfd, g, natptr)
check for that here
*/
if (bfd_is_com_section (output_section)
|| bfd_is_abs_section (output_section)
|| bfd_is_und_section (output_section))
@ -2077,9 +2091,8 @@ NAME(aout,swap_std_reloc_out) (abfd, g, natptr)
}
}
/* Extended stuff */
/* Output extended relocation information to a file in target byte order. */
/* Output extended relocation information to a file in target byte order. */
extern void NAME(aout,swap_ext_reloc_out)
PARAMS ((bfd *, arelent *, struct reloc_ext_external *));
@ -2161,7 +2174,6 @@ NAME(aout,swap_ext_reloc_out) (abfd, g, natptr)
contain 60. This macro subs the base of each section from the value
to give the true offset from the section */
#define MOVE_ADDRESS(ad) \
if (r_extern) { \
/* undefined symbol */ \
@ -2381,8 +2393,8 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols)
(struct reloc_ext_external *) relocs;
for (; counter < count; counter++, rptr++, cache_ptr++)
NAME(aout,swap_ext_reloc_in) (abfd, rptr, cache_ptr, symbols,
bfd_get_symcount (abfd));
MY_swap_ext_reloc_in (abfd, rptr, cache_ptr, symbols,
bfd_get_symcount (abfd));
}
else
{
@ -2432,7 +2444,8 @@ NAME(aout,squirt_out_relocs) (abfd, section)
for (natptr = native;
count != 0;
--count, natptr += each_size, ++generic)
NAME(aout,swap_ext_reloc_out) (abfd, *generic, (struct reloc_ext_external *)natptr);
MY_swap_ext_reloc_out (abfd, *generic,
(struct reloc_ext_external *) natptr);
}
else
{
@ -2468,7 +2481,7 @@ NAME(aout,canonicalize_reloc) (abfd, section, relptr, symbols)
return 0;
}
if (!(tblptr || NAME(aout,slurp_reloc_table)(abfd, section, symbols)))
if (!(tblptr || NAME(aout,slurp_reloc_table) (abfd, section, symbols)))
return -1;
if (section->flags & SEC_CONSTRUCTOR) {
@ -2523,19 +2536,17 @@ NAME(aout,get_reloc_upper_bound) (abfd, asect)
bfd_set_error (bfd_error_invalid_operation);
return -1;
}
long
NAME(aout,get_symtab_upper_bound) (abfd)
bfd *abfd;
{
if (!NAME(aout,slurp_symbol_table)(abfd))
if (!NAME(aout,slurp_symbol_table) (abfd))
return -1;
return (bfd_get_symcount (abfd)+1) * (sizeof (aout_symbol_type *));
}
/*ARGSUSED*/
alent *
NAME(aout,get_lineno) (ignore_abfd, ignore_symbol)
bfd *ignore_abfd ATTRIBUTE_UNUSED;
@ -2544,7 +2555,6 @@ NAME(aout,get_lineno) (ignore_abfd, ignore_symbol)
return (alent *)NULL;
}
/*ARGSUSED*/
void
NAME(aout,get_symbol_info) (ignore_abfd, symbol, ret)
bfd *ignore_abfd ATTRIBUTE_UNUSED;
@ -2561,18 +2571,17 @@ NAME(aout,get_symbol_info) (ignore_abfd, symbol, ret)
if (stab_name == NULL)
{
sprintf(buf, "(%d)", type_code);
sprintf (buf, "(%d)", type_code);
stab_name = buf;
}
ret->type = '-';
ret->stab_type = type_code;
ret->stab_other = (unsigned)(aout_symbol(symbol)->other & 0xff);
ret->stab_desc = (unsigned)(aout_symbol(symbol)->desc & 0xffff);
ret->stab_other = (unsigned) (aout_symbol(symbol)->other & 0xff);
ret->stab_desc = (unsigned) (aout_symbol(symbol)->desc & 0xffff);
ret->stab_name = stab_name;
}
}
/*ARGSUSED*/
void
NAME(aout,print_symbol) (ignore_abfd, afile, symbol, how)
bfd *ignore_abfd ATTRIBUTE_UNUSED;
@ -2585,27 +2594,26 @@ NAME(aout,print_symbol) (ignore_abfd, afile, symbol, how)
switch (how) {
case bfd_print_symbol_name:
if (symbol->name)
fprintf(file,"%s", symbol->name);
fprintf (file,"%s", symbol->name);
break;
case bfd_print_symbol_more:
fprintf(file,"%4x %2x %2x",(unsigned)(aout_symbol(symbol)->desc & 0xffff),
(unsigned)(aout_symbol(symbol)->other & 0xff),
(unsigned)(aout_symbol(symbol)->type));
fprintf (file,"%4x %2x %2x",(unsigned) (aout_symbol(symbol)->desc & 0xffff),
(unsigned) (aout_symbol(symbol)->other & 0xff),
(unsigned) (aout_symbol(symbol)->type));
break;
case bfd_print_symbol_all:
{
CONST char *section_name = symbol->section->name;
bfd_print_symbol_vandf((PTR)file,symbol);
fprintf(file," %-5s %04x %02x %02x",
fprintf (file," %-5s %04x %02x %02x",
section_name,
(unsigned)(aout_symbol(symbol)->desc & 0xffff),
(unsigned)(aout_symbol(symbol)->other & 0xff),
(unsigned)(aout_symbol(symbol)->type & 0xff));
(unsigned) (aout_symbol(symbol)->desc & 0xffff),
(unsigned) (aout_symbol(symbol)->other & 0xff),
(unsigned) (aout_symbol(symbol)->type & 0xff));
if (symbol->name)
fprintf(file," %s", symbol->name);
fprintf (file," %s", symbol->name);
}
break;
}
@ -2705,8 +2713,8 @@ NAME(aout,find_nearest_line)
CONST char *directory_name = NULL;
CONST char *main_file_name = NULL;
CONST char *current_file_name = NULL;
CONST char *line_file_name = NULL; /* Value of current_file_name at line number. */
CONST char *line_directory_name = NULL; /* Value of directory_name at line number. */
CONST char *line_file_name = NULL; /* Value of current_file_name at line number. */
CONST char *line_directory_name = NULL; /* Value of directory_name at line number. */
bfd_vma low_line_vma = 0;
bfd_vma low_func_vma = 0;
asymbol *func = 0;
@ -2718,7 +2726,7 @@ NAME(aout,find_nearest_line)
*line_ptr = 0;
if (symbols != (asymbol **)NULL) {
for (p = symbols; *p; p++) {
aout_symbol_type *q = (aout_symbol_type *)(*p);
aout_symbol_type *q = (aout_symbol_type *) (*p);
next:
switch (q->type){
case N_TEXT:
@ -2765,15 +2773,15 @@ NAME(aout,find_nearest_line)
}
main_file_name = current_file_name = q->symbol.name;
/* Look ahead to next symbol to check if that too is an N_SO. */
/* Look ahead to next symbol to check if that too is an N_SO. */
p++;
if (*p == NULL)
break;
q = (aout_symbol_type *)(*p);
q = (aout_symbol_type *) (*p);
if (q->type != (int)N_SO)
goto next;
/* Found a second N_SO First is directory; second is filename. */
/* Found a second N_SO First is directory; second is filename. */
directory_name = current_file_name;
main_file_name = current_file_name = q->symbol.name;
if (obj_textsec(abfd) != section)
@ -2881,7 +2889,6 @@ NAME(aout,find_nearest_line)
return true;
}
/*ARGSUSED*/
int
NAME(aout,sizeof_headers) (abfd, execable)
bfd *abfd;
@ -4125,7 +4132,7 @@ aout_link_write_symbols (finfo, input_bfd)
/* We have saved the hash table entry for this symbol, if
there is one. Note that we could just look it up again
in the hash table, provided we first check that it is an
external symbol. */
external symbol. */
h = *sym_hash;
/* Use the name from the hash table, in case the symbol was
@ -4789,7 +4796,7 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs,
#ifdef MY_reloc_howto
howto = MY_reloc_howto(input_bfd, rel, r_index, r_extern, r_pcrel);
#else
#else
{
int r_jmptable;
int r_relative;
@ -5671,6 +5678,10 @@ aout_link_reloc_link_order (finfo, o, p)
}
else
{
#ifdef MY_put_ext_reloc
MY_put_ext_reloc (finfo->output_bfd, r_extern, r_index, p->offset,
howto, &erel, pr->addend);
#else
PUT_WORD (finfo->output_bfd, p->offset, erel.r_address);
if (bfd_header_big_endian (finfo->output_bfd))
@ -5693,6 +5704,7 @@ aout_link_reloc_link_order (finfo, o, p)
}
PUT_WORD (finfo->output_bfd, pr->addend, erel.r_addend);
#endif /* MY_put_ext_reloc */
rel_ptr = (PTR) &erel;
}

View File

@ -152,10 +152,8 @@ extern int errno;
the cache when we actually read one. We also don't sort the cache;
it's generally short enough to search linearly.
Note that the pointers here point to the front of the ar_hdr, not
to the front of the contents!
*/
struct ar_cache
{
to the front of the contents! */
struct ar_cache {
file_ptr ptr;
bfd *arelt;
struct ar_cache *next;
@ -164,7 +162,7 @@ struct ar_cache
#define ar_padchar(abfd) ((abfd)->xvec->ar_pad_char)
#define ar_maxnamelen(abfd) ((abfd)->xvec->ar_max_namelen)
#define arch_eltdata(bfd) ((struct areltdata *)((bfd)->arelt_data))
#define arch_eltdata(bfd) ((struct areltdata *) ((bfd)->arelt_data))
#define arch_hdr(bfd) ((struct ar_hdr *)arch_eltdata(bfd)->arch_header)
static char *get_extended_arelt_filename PARAMS ((bfd *arch,
@ -316,7 +314,7 @@ _bfd_add_bfd_to_archive_cache (arch_bfd, filepos, new_elt)
}
/* The name begins with space. Hence the rest of the name is an index into
the string table. */
the string table. */
static char *
get_extended_arelt_filename (arch, name)
@ -326,9 +324,9 @@ get_extended_arelt_filename (arch, name)
unsigned long index = 0;
/* Should extract string so that I can guarantee not to overflow into
the next region, but I'm too lazy. */
the next region, but I'm too lazy. */
errno = 0;
/* Skip first char, which is '/' in SVR4 or ' ' in some other variants. */
/* Skip first char, which is '/' in SVR4 or ' ' in some other variants. */
index = strtol (name + 1, NULL, 10);
if (errno != 0)
{
@ -411,7 +409,7 @@ _bfd_generic_read_ar_hdr_mag (abfd, mag)
}
}
/* BSD4.4-style long filename.
Only implemented for reading, so far! */
Only implemented for reading, so far! */
else if (hdr.ar_name[0] == '#'
&& hdr.ar_name[1] == '1'
&& hdr.ar_name[2] == '/'
@ -440,15 +438,15 @@ _bfd_generic_read_ar_hdr_mag (abfd, mag)
{
/* We judge the end of the name by looking for '/' or ' '.
Note: The SYSV format (terminated by '/') allows embedded
spaces, so only look for ' ' if we don't find '/'. */
spaces, so only look for ' ' if we don't find '/'. */
char *e;
e = memchr (hdr.ar_name, '\0', ar_maxnamelen (abfd));
if (e == NULL)
{
e = memchr (hdr.ar_name, '/', ar_maxnamelen (abfd));
e = memchr (hdr.ar_name, '/', ar_maxnamelen (abfd));
if (e == NULL)
e = memchr (hdr.ar_name, ' ', ar_maxnamelen (abfd));
e = memchr (hdr.ar_name, ' ', ar_maxnamelen (abfd));
}
if (e != NULL)
@ -526,7 +524,7 @@ _bfd_get_elt_at_filepos (archive, filepos)
if (_bfd_add_bfd_to_archive_cache (archive, filepos, n_nfd))
return n_nfd;
/* huh? */
/* Huh? */
bfd_release (archive, (PTR) n_nfd);
bfd_release (archive, (PTR) new_areldata);
return NULL;
@ -560,7 +558,6 @@ DESCRIPTION
the archive and the previous return value to return a created
BFD to the next contained element. NULL is returned when there
are no more.
*/
bfd *
@ -595,7 +592,7 @@ bfd_generic_openr_next_archived_file (archive, last_file)
unsigned int size = arelt_size (last_file);
/* 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. */
BSD-4.4-style element with a long odd size. */
filestart = last_file->origin + size;
filestart += filestart % 2;
}
@ -603,7 +600,6 @@ bfd_generic_openr_next_archived_file (archive, last_file)
return _bfd_get_elt_at_filepos (archive, filestart);
}
const bfd_target *
bfd_generic_archive_p (abfd)
bfd *abfd;
@ -630,7 +626,7 @@ bfd_generic_archive_p (abfd)
#endif
/* We are setting bfd_ardata(abfd) here, but since bfd_ardata
involves a cast, we can't do it as the left operand of assignment. */
involves a cast, we can't do it as the left operand of assignment. */
abfd->tdata.aout_ar_data = ((struct artdata *)
bfd_zalloc (abfd, sizeof (struct artdata)));
@ -737,7 +733,7 @@ do_slurp_bsd_armap (abfd)
if (mapdata == NULL)
return false;
parsed_size = mapdata->parsed_size;
bfd_release (abfd, (PTR) mapdata); /* Don't need it any more. */
bfd_release (abfd, (PTR) mapdata); /* Don't need it any more. */
raw_armap = (bfd_byte *) bfd_zalloc (abfd, parsed_size);
if (raw_armap == (bfd_byte *) NULL)
@ -782,16 +778,17 @@ do_slurp_bsd_armap (abfd)
}
ardata->first_file_filepos = bfd_tell (abfd);
/* Pad to an even boundary if you have to */
/* Pad to an even boundary if you have to. */
ardata->first_file_filepos += (ardata->first_file_filepos) % 2;
/* FIXME, we should provide some way to free raw_ardata when
we are done using the strings from it. For now, it seems
to be allocated on an objalloc anyway... */
to be allocated on an objalloc anyway... */
bfd_has_map (abfd) = true;
return true;
}
/* Returns false on error, true otherwise */
/* Returns false on error, true otherwise. */
static boolean
do_slurp_coff_armap (abfd)
bfd *abfd;
@ -803,7 +800,7 @@ do_slurp_coff_armap (abfd)
unsigned int stringsize;
unsigned int parsed_size;
carsym *carsyms;
unsigned int nsymz; /* Number of symbols in armap. */
unsigned int nsymz; /* Number of symbols in armap. */
bfd_vma (*swap) PARAMS ((const bfd_byte *));
char int_buf[sizeof (long)];
unsigned int carsym_size, ptrsize, i;
@ -812,7 +809,7 @@ do_slurp_coff_armap (abfd)
if (mapdata == NULL)
return false;
parsed_size = mapdata->parsed_size;
bfd_release (abfd, (PTR) mapdata); /* Don't need it any more. */
bfd_release (abfd, (PTR) mapdata); /* Don't need it any more. */
if (bfd_read ((PTR) int_buf, 1, 4, abfd) != 4)
{
@ -821,7 +818,7 @@ do_slurp_coff_armap (abfd)
return false;
}
/* It seems that all numeric information in a coff archive is always
in big endian format, nomatter the host or target. */
in big endian format, nomatter the host or target. */
swap = bfd_getb32;
nsymz = bfd_getb32 ((PTR) int_buf);
stringsize = parsed_size - (4 * nsymz) - 4;
@ -836,7 +833,7 @@ do_slurp_coff_armap (abfd)
&& bfd_get_arch (abfd) == bfd_arch_i960
&& bfd_get_flavour (abfd) == bfd_target_coff_flavour)
{
/* This looks dangerous, let's do it the other way around */
/* This looks dangerous, let's do it the other way around. */
nsymz = bfd_getl32 ((PTR) int_buf);
stringsize = parsed_size - (4 * nsymz) - 4;
swap = bfd_getl32;
@ -844,7 +841,7 @@ do_slurp_coff_armap (abfd)
#endif
/* The coff armap must be read sequentially. So we construct a
bsd-style one in core all at once, for simplicity. */
bsd-style one in core all at once, for simplicity. */
carsym_size = (nsymz * sizeof (carsym));
ptrsize = (4 * nsymz);
@ -855,7 +852,7 @@ do_slurp_coff_armap (abfd)
carsyms = ardata->symdefs;
stringbase = ((char *) ardata->symdefs) + carsym_size;
/* Allocate and read in the raw offsets. */
/* Allocate and read in the raw offsets. */
raw_armap = (int *) bfd_alloc (abfd, ptrsize);
if (raw_armap == NULL)
goto release_symdefs;
@ -867,7 +864,7 @@ do_slurp_coff_armap (abfd)
goto release_raw_armap;
}
/* OK, build the carsyms */
/* OK, build the carsyms. */
for (i = 0; i < nsymz; i++)
{
rawptr = raw_armap + i;
@ -880,27 +877,25 @@ do_slurp_coff_armap (abfd)
ardata->symdef_count = nsymz;
ardata->first_file_filepos = bfd_tell (abfd);
/* Pad to an even boundary if you have to */
/* Pad to an even boundary if you have to. */
ardata->first_file_filepos += (ardata->first_file_filepos) % 2;
bfd_has_map (abfd) = true;
bfd_release (abfd, (PTR) raw_armap);
/* Check for a second archive header (as used by PE) */
/* Check for a second archive header (as used by PE). */
{
struct areltdata *tmp;
bfd_seek (abfd, ardata->first_file_filepos, SEEK_SET);
tmp = (struct areltdata *) _bfd_read_ar_hdr (abfd);
if (tmp != NULL)
if (tmp != NULL)
{
if (tmp->arch_header[0] == '/'
&& tmp->arch_header[1] == ' ')
&& tmp->arch_header[1] == ' ')
{
ardata->first_file_filepos +=
(tmp->parsed_size + sizeof(struct ar_hdr) + 1) & ~1;
(tmp->parsed_size + sizeof (struct ar_hdr) + 1) & ~1;
}
bfd_release (abfd, tmp);
}
@ -952,7 +947,7 @@ bfd_slurp_armap (abfd)
/* 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. */
This flavour is used by hp300hpux. */
#define HPUX_SYMDEF_COUNT_SIZE 2
@ -975,7 +970,7 @@ bfd_slurp_bsd_armap_f2 (abfd)
if (i != 16)
return false;
/* The archive has at least 16 bytes in it */
/* The archive has at least 16 bytes in it. */
if (bfd_seek (abfd, -16L, SEEK_CUR) != 0)
return false;
@ -1024,7 +1019,7 @@ bfd_slurp_bsd_armap_f2 (abfd)
ardata->cache = 0;
stringsize = bfd_h_get_32 (abfd, raw_armap + HPUX_SYMDEF_COUNT_SIZE);
/* skip sym count and string sz */
/* Skip sym count and string sz. */
stringbase = ((char *) raw_armap
+ HPUX_SYMDEF_COUNT_SIZE
+ BSD_STRING_COUNT_SIZE);
@ -1044,11 +1039,11 @@ bfd_slurp_bsd_armap_f2 (abfd)
}
ardata->first_file_filepos = bfd_tell (abfd);
/* Pad to an even boundary if you have to */
/* Pad to an even boundary if you have to. */
ardata->first_file_filepos += (ardata->first_file_filepos) % 2;
/* FIXME, we should provide some way to free raw_ardata when
we are done using the strings from it. For now, it seems
to be allocated on an objalloc anyway... */
to be allocated on an objalloc anyway... */
bfd_has_map (abfd) = true;
return true;
}
@ -1061,9 +1056,10 @@ bfd_slurp_bsd_armap_f2 (abfd)
element (the first in the archive, or second if there is an armap);
the name in the ar_hdr is replaced by <space><index into filename
element>. Index is the P.R. of an int (decimal). Data General have
extended the format by using the prefix // for the special element */
extended the format by using the prefix // for the special element. */
/* Returns false on error, true otherwise. */
/* Returns false on error, true otherwise */
boolean
_bfd_slurp_extended_name_table (abfd)
bfd *abfd;
@ -1117,22 +1113,25 @@ _bfd_slurp_extended_name_table (abfd)
{
char *temp = bfd_ardata (abfd)->extended_names;
char *limit = temp + namedata->parsed_size;
for (; temp < limit; ++temp) {
if (*temp == '\012')
temp[temp[-1] == '/' ? -1 : 0] = '\0';
if (*temp == '\\')
*temp = '/';
}
for (; temp < limit; ++temp)
{
if (*temp == '\012')
temp[temp[-1] == '/' ? -1 : 0] = '\0';
if (*temp == '\\')
*temp = '/';
}
}
/* Pad to an even boundary if you have to */
/* Pad to an even boundary if you have to. */
bfd_ardata (abfd)->first_file_filepos = bfd_tell (abfd);
bfd_ardata (abfd)->first_file_filepos +=
(bfd_ardata (abfd)->first_file_filepos) % 2;
/* FIXME, we can't release namedata here because it was allocated
below extended_names on the objalloc... */
/* bfd_release (abfd, namedata); */
below extended_names on the objalloc... */
#if 0
bfd_release (abfd, namedata);
#endif
}
return true;
}
@ -1140,7 +1139,8 @@ _bfd_slurp_extended_name_table (abfd)
#ifdef VMS
/* Return a copy of the stuff in the filename between any :]> and a
semicolon */
semicolon. */
static const char *
normalize (abfd, file)
bfd *abfd;
@ -1183,12 +1183,11 @@ normalize (abfd, file)
{
const char *filename = strrchr (file, '/');
#ifdef HAVE_DOS_BASED_FILE_SYSTEM
{
/* We could have foo/bar\\baz, or foo\\bar, or d:bar. */
char *bslash = strrchr (file, '\\');
if (bslash > filename)
if (filename == NULL || (bslash != NULL && bslash > filename))
filename = bslash;
if (filename == NULL && file[0] != '\0' && file[1] == ':')
filename = file + 1;
@ -1250,7 +1249,7 @@ _bfd_construct_extended_name_table (abfd, trailing_slash, tabloc, tablen)
*tablen = 0;
/* Figure out how long the table should be */
/* Figure out how long the table should be. */
for (current = abfd->archive_head; current != NULL; current = current->next)
{
const char *normal;
@ -1318,7 +1317,7 @@ _bfd_construct_extended_name_table (abfd, trailing_slash, tabloc, tablen)
{
/* Works for now; may need to be re-engineered if we
encounter an oddball archive format and want to
generalise this hack. */
generalise this hack. */
struct ar_hdr *hdr = arch_hdr (current);
strcpy (strptr, normal);
if (! trailing_slash)
@ -1330,10 +1329,10 @@ _bfd_construct_extended_name_table (abfd, trailing_slash, tabloc, tablen)
}
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). */
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 */
sprintf but not all implementations get this right. */
{
char *temp = hdr->ar_name + 2;
for (; temp < hdr->ar_name + maxname; temp++)
@ -1351,6 +1350,24 @@ _bfd_construct_extended_name_table (abfd, trailing_slash, tabloc, tablen)
/** A couple of functions for creating ar_hdrs */
#ifdef HPUX_LARGE_AR_IDS
/* Function to encode large UID/GID values according to HP. */
static void
hpux_uid_gid_encode (str, id)
char str[6];
long int id;
{
int cnt;
str[5] = '@' + (id & 3);
id >>= 2;
for (cnt = 4; cnt >= 0; ++cnt, id >>= 6)
str[cnt] = ' ' + (id & 0x3f);
}
#endif /* HPUX_LARGE_AR_IDS */
#ifndef HAVE_GETUID
#define getuid() 0
#endif
@ -1362,7 +1379,7 @@ _bfd_construct_extended_name_table (abfd, trailing_slash, tabloc, tablen)
/* Takes a filename, returns an arelt_data for it, or NULL if it can't
make one. The filename must refer to a filename in the filesystem.
The filename field of the ar_hdr will NOT be initialized. If member
is set, and it's an in-memory bfd, we fake it. */
is set, and it's an in-memory bfd, we fake it. */
static struct areltdata *
bfd_ar_hdr_from_filesystem (abfd, filename, member)
@ -1377,11 +1394,11 @@ bfd_ar_hdr_from_filesystem (abfd, filename, member)
if (member && (member->flags & BFD_IN_MEMORY) != 0)
{
/* Assume we just "made" the member, and fake it */
/* Assume we just "made" the member, and fake it. */
struct bfd_in_memory *bim = (struct bfd_in_memory *) member->iostream;
time(&status.st_mtime);
status.st_uid = getuid();
status.st_gid = getgid();
time (&status.st_mtime);
status.st_uid = getuid ();
status.st_gid = getgid ();
status.st_mode = 0644;
status.st_size = bim->size;
}
@ -1397,20 +1414,34 @@ bfd_ar_hdr_from_filesystem (abfd, filename, member)
return NULL;
hdr = (struct ar_hdr *) (((char *) ared) + sizeof (struct areltdata));
/* ar headers are space padded, not null padded! */
/* ar headers are space padded, not null padded! */
memset ((PTR) hdr, ' ', sizeof (struct ar_hdr));
strncpy (hdr->ar_fmag, ARFMAG, 2);
/* Goddamned sprintf doesn't permit MAXIMUM field lengths */
/* Goddamned sprintf doesn't permit MAXIMUM field lengths. */
sprintf ((hdr->ar_date), "%-12ld", (long) status.st_mtime);
sprintf ((hdr->ar_uid), "%ld", (long) 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_uid > 99999)
hpux_uid_gid_encode (hdr->ar_gid, (long) status.st_uid);
else
#endif
sprintf ((hdr->ar_uid), "%ld", (long) 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);
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 */
IO operations. */
temp = (char *) hdr;
temp1 = temp + sizeof (struct ar_hdr) - 2;
for (; temp < temp1; temp++)
@ -1426,9 +1457,9 @@ bfd_ar_hdr_from_filesystem (abfd, filename, member)
}
/* This is magic required by the "ar" program. Since it's
undocumented, it's undocumented. You may think that it would take
a strong stomach to write this, and it does, but it takes even a
stronger stomach to try to code around such a thing! */
undocumented, it's undocumented. You may think that it would take
a strong stomach to write this, and it does, but it takes even a
stronger stomach to try to code around such a thing! */
struct ar_hdr *bfd_special_undocumented_glue PARAMS ((bfd *, const char *));
@ -1443,8 +1474,8 @@ bfd_special_undocumented_glue (abfd, filename)
return (struct ar_hdr *) ar_elt->arch_header;
}
/* Analogous to stat call. */
/* Analogous to stat call */
int
bfd_generic_stat_arch_elt (abfd, buf)
bfd *abfd;
@ -1461,13 +1492,40 @@ bfd_generic_stat_arch_elt (abfd, buf)
hdr = arch_hdr (abfd);
#define foo(arelt, stelt, size) \
buf->stelt = strtol (hdr->arelt, &aloser, size); \
if (aloser == hdr->arelt) return -1;
#define foo(arelt, stelt, size) \
buf->stelt = strtol (hdr->arelt, &aloser, size); \
if (aloser == hdr->arelt) \
return -1;
/* Some platforms support special notations for large IDs. */
#ifdef HPUX_LARGE_AR_IDS
# define foo2(arelt, stelt, size) \
if (hdr->arelt[5] == ' ') \
{ \
foo (arelt, stelt, size); \
} \
else \
{ \
int cnt; \
for (buf->stelt = cnt = 0; cnt < 5; ++cnt) \
{ \
if (hdr->arelt[cnt] < ' ' || hdr->arelt[cnt] > ' ' + 0x3f) \
return -1; \
buf->stelt <<= 6; \
buf->stelt += hdr->arelt[cnt] - ' '; \
} \
if (hdr->arelt[5] < '@' || hdr->arelt[5] > '@' + 3) \
return -1; \
buf->stelt <<= 2; \
buf->stelt += hdr->arelt[5] - '@'; \
}
#else
# define foo2(arelt, stelt, size) foo (arelt, stelt, size)
#endif
foo (ar_date, st_mtime, 10);
foo (ar_uid, st_uid, 10);
foo (ar_gid, st_gid, 10);
foo2 (ar_uid, st_uid, 10);
foo2 (ar_gid, st_gid, 10);
foo (ar_mode, st_mode, 8);
buf->st_size = arch_eltdata (abfd)->parsed_size;
@ -1484,7 +1542,7 @@ bfd_dont_truncate_arname (abfd, pathname, arhdr)
/* FIXME: This interacts unpleasantly with ar's quick-append option.
Fortunately ic960 users will never use that option. Fixing this
is very hard; fortunately I know how to do it and will do so once
intel's release is out the door. */
intel's release is out the door. */
struct ar_hdr *hdr = (struct ar_hdr *) arhdr;
size_t length;
@ -1530,7 +1588,7 @@ bfd_bsd_truncate_arname (abfd, pathname, arhdr)
{
/* We could have foo/bar\\baz, or foo\\bar, or d:bar. */
char *bslash = strrchr (pathname, '\\');
if (bslash > filename)
if (filename == NULL || (bslash != NULL && bslash > filename))
filename = bslash;
if (filename == NULL && pathname[0] != '\0' && pathname[1] == ':')
filename = pathname + 1;
@ -1564,7 +1622,7 @@ bfd_bsd_truncate_arname (abfd, pathname, arhdr)
4> truncate it before the .o, append .o, stuff THAT in. */
/* This is what gnu ar does. It's better but incompatible with the
bsd ar. */
bsd ar. */
void
bfd_gnu_truncate_arname (abfd, pathname, arhdr)
@ -1581,7 +1639,7 @@ bfd_gnu_truncate_arname (abfd, pathname, arhdr)
{
/* We could have foo/bar\\baz, or foo\\bar, or d:bar. */
char *bslash = strrchr (pathname, '\\');
if (bslash > filename)
if (filename == NULL || (bslash != NULL && bslash > filename))
filename = bslash;
if (filename == NULL && pathname[0] != '\0' && pathname[1] == ':')
filename = pathname + 1;
@ -1612,7 +1670,7 @@ bfd_gnu_truncate_arname (abfd, pathname, arhdr)
(hdr->ar_name)[length] = ar_padchar (abfd);
}
/* The BFD is open for write and has its format set to bfd_archive */
/* The BFD is open for write and has its format set to bfd_archive. */
boolean
_bfd_write_archive_contents (arch)
@ -1623,7 +1681,7 @@ _bfd_write_archive_contents (arch)
bfd_size_type elength = 0;
const char *ename = NULL;
boolean makemap = bfd_has_map (arch);
boolean hasobjects = false; /* if no .o's, don't bother to make a map */
boolean hasobjects = false; /* If no .o's, don't bother to make a map. */
bfd_size_type wrote;
unsigned int i;
int tries;
@ -1633,6 +1691,11 @@ _bfd_write_archive_contents (arch)
then construct a fresh ar_hdr for them. */
for (current = arch->archive_head; current; current = current->next)
{
/* This check is checking the bfds for the objects we're reading
from (which are usually either an object file or archive on
disk), not the archive entries we're writing to. We don't
actually create bfds for the archive members, we just copy
them byte-wise when we write out the archive. */
if (bfd_write_p (current))
{
bfd_set_error (bfd_error_invalid_operation);
@ -1645,14 +1708,14 @@ _bfd_write_archive_contents (arch)
if (!current->arelt_data)
return false;
/* Put in the file name */
/* Put in the file name. */
BFD_SEND (arch, _bfd_truncate_arname, (arch,
current->filename,
(char *) arch_hdr (current)));
}
if (makemap && ! hasobjects)
{ /* don't bother if we won't make a map! */
{ /* 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))
@ -1712,7 +1775,7 @@ _bfd_write_archive_contents (arch)
unsigned int remaining = arelt_size (current);
struct ar_hdr *hdr = arch_hdr (current);
/* write ar header */
/* Write ar header. */
if (bfd_write ((char *) hdr, 1, sizeof (*hdr), arch) != sizeof (*hdr))
return false;
if (bfd_seek (current, (file_ptr) 0, SEEK_SET) != 0)
@ -1762,7 +1825,7 @@ _bfd_write_archive_contents (arch)
return true;
}
/* Note that the namidx for the first symbol is 0 */
/* Note that the namidx for the first symbol is 0. */
boolean
_bfd_compute_and_write_armap (arch, elength)
@ -1780,7 +1843,7 @@ _bfd_compute_and_write_armap (arch, elength)
long syms_max = 0;
boolean ret;
/* Dunno if this is the best place for this info... */
/* Dunno if this is the best place for this info... */
if (elength != 0)
elength += sizeof (struct ar_hdr);
elength += elength % 2;
@ -1795,13 +1858,12 @@ _bfd_compute_and_write_armap (arch, elength)
if (first_name == NULL)
goto error_return;
/* Drop all the files called __.SYMDEF, we're going to make our
own */
/* Drop all the files called __.SYMDEF, we're going to make our own. */
while (arch->archive_head &&
strcmp (arch->archive_head->filename, "__.SYMDEF") == 0)
arch->archive_head = arch->archive_head->next;
/* Map over each element */
/* Map over each element. */
for (current = arch->archive_head;
current != (bfd *) NULL;
current = current->next, elt_no++)
@ -1832,7 +1894,8 @@ _bfd_compute_and_write_armap (arch, elength)
if (symcount < 0)
goto error_return;
/* Now map over all the symbols, picking out the ones we want */
/* Now map over all the symbols, picking out the ones we
want. */
for (src_count = 0; src_count < symcount; src_count++)
{
flagword flags = (syms[src_count])->flags;
@ -1847,7 +1910,7 @@ _bfd_compute_and_write_armap (arch, elength)
size_t namelen;
struct orl *new_map;
/* This symbol will go into the archive header */
/* This symbol will go into the archive header. */
if (orl_count == orl_max)
{
orl_max *= 2;
@ -1886,7 +1949,7 @@ _bfd_compute_and_write_armap (arch, elength)
}
}
/* OK, now we have collected all the data, let's write them out */
/* OK, now we have collected all the data, let's write them out. */
ret = BFD_SEND (arch, write_armap,
(arch, elength, map, orl_count, stridx));
@ -1921,7 +1984,7 @@ bsd_write_armap (arch, elength, map, orl_count, stridx)
int padit = stridx & 1;
unsigned int ranlibsize = orl_count * BSD_SYMDEF_SIZE;
unsigned int stringsize = stridx + padit;
/* Include 8 bytes to store ranlibsize and stringsize in output. */
/* Include 8 bytes to store ranlibsize and stringsize in output. */
unsigned int mapsize = ranlibsize + stringsize + 8;
file_ptr firstreal;
bfd *current = arch->archive_head;
@ -1978,7 +2041,7 @@ bsd_write_armap (arch, elength, map, orl_count, stridx)
return false;
}
/* now write the strings themselves */
/* Now write the strings themselves. */
bfd_h_put_32 (arch, stringsize, temp);
if (bfd_write (temp, 1, sizeof (temp), arch) != sizeof (temp))
return false;
@ -1991,7 +2054,7 @@ bsd_write_armap (arch, elength, map, orl_count, stridx)
}
/* The spec sez this should be a newline. But in order to be
bug-compatible for sun's ar we use a null. */
bug-compatible for sun's ar we use a null. */
if (padit)
{
if (bfd_write ("", 1, 1, arch) != 1)
@ -2021,10 +2084,13 @@ _bfd_archive_bsd_update_armap_timestamp (arch)
if (bfd_stat (arch, &archstat) == -1)
{
perror (_("Reading archive file mod timestamp"));
return true; /* Can't read mod time for some reason */
/* Can't read mod time for some reason. */
return true;
}
if (archstat.st_mtime <= bfd_ardata (arch)->armap_timestamp)
return true; /* OK by the linker's rules */
/* OK by the linker's rules. */
return true;
/* Update the timestamp. */
bfd_ardata (arch)->armap_timestamp = archstat.st_mtime + ARMAP_TIME_OFFSET;
@ -2045,10 +2111,13 @@ _bfd_archive_bsd_update_armap_timestamp (arch)
{
/* FIXME: bfd can't call perror. */
perror (_("Writing updated armap timestamp"));
return true; /* Some error while writing */
/* Some error while writing. */
return true;
}
return false; /* We updated the timestamp successfully. */
/* We updated the timestamp successfully. */
return false;
}
/* A coff armap looks like :
@ -2074,7 +2143,7 @@ coff_write_armap (arch, elength, map, symbol_count, stridx)
int stridx;
{
/* The size of the ranlib is the number of exported symbols in the
archive * the number of bytes in a int, + an int for the count */
archive * the number of bytes in a int, + an int for the count. */
unsigned int ranlibsize = (symbol_count * 4) + 4;
unsigned int stringsize = stridx;
unsigned int mapsize = stringsize + ranlibsize;
@ -2088,7 +2157,7 @@ coff_write_armap (arch, elength, map, symbol_count, stridx)
if (padit)
mapsize++;
/* work out where the first object file will go in the archive */
/* Work out where the first object file will go in the archive. */
archive_member_file_ptr = (mapsize
+ elength
+ sizeof (struct ar_hdr)
@ -2098,7 +2167,7 @@ coff_write_armap (arch, elength, map, symbol_count, stridx)
hdr.ar_name[0] = '/';
sprintf (hdr.ar_size, "%-10d", (int) mapsize);
sprintf (hdr.ar_date, "%ld", (long) time (NULL));
/* This, at least, is what Intel coff sets the values to.: */
/* 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);
@ -2108,7 +2177,7 @@ coff_write_armap (arch, elength, map, symbol_count, stridx)
if (((char *) (&hdr))[i] == '\0')
(((char *) (&hdr))[i]) = ' ';
/* Write the ar header for this item and the number of symbols */
/* Write the ar header for this item and the number of symbols. */
if (bfd_write ((PTR) &hdr, 1, sizeof (struct ar_hdr), arch)
!= sizeof (struct ar_hdr))
@ -2126,23 +2195,23 @@ coff_write_armap (arch, elength, map, symbol_count, stridx)
count = 0;
while (current != (bfd *) NULL && count < symbol_count)
{
/* For each symbol which is used defined in this object, write out
the object file's address in the archive */
/* For each symbol which is used defined in this object, write
out the object file's address in the archive. */
while (((bfd *) (map[count]).pos) == current)
while (count < symbol_count && ((bfd *) (map[count]).pos) == current)
{
bfd_write_bigendian_4byte_int (arch, archive_member_file_ptr);
count++;
}
/* Add size of this archive entry */
/* Add size of this archive entry. */
archive_member_file_ptr += (arelt_size (current)
+ sizeof (struct ar_hdr));
/* remember aboout the even alignment */
/* Remember aboout the even alignment. */
archive_member_file_ptr += archive_member_file_ptr % 2;
current = current->next;
}
/* now write the strings themselves */
/* Now write the strings themselves. */
for (count = 0; count < symbol_count; count++)
{
size_t len = strlen (*map[count].name) + 1;
@ -2152,7 +2221,7 @@ coff_write_armap (arch, elength, map, symbol_count, stridx)
}
/* The spec sez this should be a newline. But in order to be
bug-compatible for arc960 we use a null. */
bug-compatible for arc960 we use a null. */
if (padit)
{
if (bfd_write ("", 1, 1, arch) != 1)

View File

@ -31,7 +31,7 @@ SECTION
BFD keeps one atom in a BFD describing the
architecture of the data attached to the BFD: a pointer to a
<<bfd_arch_info_type>>.
<<bfd_arch_info_type>>.
Pointers to structures can be requested independently of a BFD
so that an architecture's information can be interrogated
@ -41,13 +41,13 @@ SECTION
The set of default architectures is selected by the macro
<<SELECT_ARCHITECTURES>>. This is normally set up in the
@file{config/@var{target}.mt} file of your choice. If the name is not
defined, then all the architectures supported are included.
defined, then all the architectures supported are included.
When BFD starts up, all the architectures are called with an
initialize method. It is up to the architecture back end to
insert as many items into the list of architectures as it wants to;
generally this would be one for each machine and one for the
default case (an item with a machine field of 0).
default case (an item with a machine field of 0).
BFD's idea of an architecture is implemented in @file{archures.c}.
*/
@ -64,9 +64,9 @@ DESCRIPTION
the family is in use. The machine gives a number which
distinguishes different versions of the architecture,
containing, for example, 2 and 3 for Intel i960 KA and i960 KB,
and 68020 and 68030 for Motorola 68020 and 68030.
and 68020 and 68030 for Motorola 68020 and 68030.
.enum bfd_architecture
.enum bfd_architecture
.{
. bfd_arch_unknown, {* File arch not known *}
. bfd_arch_obscure, {* Arch known, not one of these *}
@ -79,14 +79,14 @@ DESCRIPTION
.#define bfd_mach_m68040 6
.#define bfd_mach_m68060 7
.#define bfd_mach_cpu32 8
. bfd_arch_vax, {* DEC Vax *}
. bfd_arch_vax, {* DEC Vax *}
. bfd_arch_i960, {* Intel 960 *}
. {* The order of the following is important.
. lower number indicates a machine type that
. lower number indicates a machine type that
. only accepts a subset of the instructions
. available to machines with higher numbers.
. The exception is the "ca", which is
. incompatible with all other machines except
. incompatible with all other machines except
. "core". *}
.
.#define bfd_mach_i960_core 1
@ -109,9 +109,12 @@ DESCRIPTION
.#define bfd_mach_sparc_sparclite_le 6
.#define bfd_mach_sparc_v9 7
.#define bfd_mach_sparc_v9a 8 {* with ultrasparc add'ns *}
.#define bfd_mach_sparc_v8plusb 9 {* with cheetah add'ns *}
.#define bfd_mach_sparc_v9b 10 {* with cheetah add'ns *}
.{* Nonzero if MACH has the v9 instruction set. *}
.#define bfd_mach_sparc_v9_p(mach) \
. ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9a)
. ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \
. && (mach) != bfd_mach_sparc_sparclite_le)
. bfd_arch_mips, {* MIPS Rxxxx *}
.#define bfd_mach_mips3000 3000
.#define bfd_mach_mips3900 3900
@ -128,10 +131,17 @@ DESCRIPTION
.#define bfd_mach_mips8000 8000
.#define bfd_mach_mips10000 10000
.#define bfd_mach_mips16 16
.#define bfd_mach_mips32 32
.#define bfd_mach_mips32_4k 3204113 {* 32, 04, octal 'K' *}
.#define bfd_mach_mips5 5
.#define bfd_mach_mips64 64
.#define bfd_mach_mips_sb1 12310201 {* octal 'SB', 01 *}
. bfd_arch_i386, {* Intel 386 *}
.#define bfd_mach_i386_i386 0
.#define bfd_mach_i386_i8086 1
.#define bfd_mach_i386_i386_intel_syntax 2
.#define bfd_mach_x86_64 3
.#define bfd_mach_x86_64_intel_syntax 4
. bfd_arch_we32k, {* AT&T WE32xxx *}
. bfd_arch_tahoe, {* CCI/Harris Tahoe *}
. bfd_arch_i860, {* Intel 860 *}
@ -146,13 +156,36 @@ DESCRIPTION
.#define bfd_mach_h8300h 2
.#define bfd_mach_h8300s 3
. bfd_arch_powerpc, {* PowerPC *}
.#define bfd_mach_ppc 0
.#define bfd_mach_ppc_403 403
.#define bfd_mach_ppc_403gc 4030
.#define bfd_mach_ppc_505 505
.#define bfd_mach_ppc_601 601
.#define bfd_mach_ppc_602 602
.#define bfd_mach_ppc_603 603
.#define bfd_mach_ppc_ec603e 6031
.#define bfd_mach_ppc_604 604
.#define bfd_mach_ppc_620 620
.#define bfd_mach_ppc_630 630
.#define bfd_mach_ppc_750 750
.#define bfd_mach_ppc_860 860
.#define bfd_mach_ppc_a35 35
.#define bfd_mach_ppc_rs64ii 642
.#define bfd_mach_ppc_rs64iii 643
.#define bfd_mach_ppc_7400 7400
. bfd_arch_rs6000, {* IBM RS/6000 *}
.#define bfd_mach_rs6k 0
.#define bfd_mach_rs6k_rs1 6001
.#define bfd_mach_rs6k_rsc 6003
.#define bfd_mach_rs6k_rs2 6002
. bfd_arch_hppa, {* HP PA RISC *}
. bfd_arch_d10v, {* Mitsubishi D10V *}
.#define bfd_mach_d10v 0
.#define bfd_mach_d10v_ts2 2
.#define bfd_mach_d10v_ts3 3
. bfd_arch_d30v, {* Mitsubishi D30V *}
. bfd_arch_m68hc11, {* Motorola 68HC11 *}
. bfd_arch_m68hc12, {* Motorola 68HC12 *}
. bfd_arch_z8k, {* Zilog Z8000 *}
.#define bfd_mach_z8001 1
.#define bfd_mach_z8002 2
@ -178,16 +211,22 @@ DESCRIPTION
.#define bfd_mach_arm_4T 6
.#define bfd_mach_arm_5 7
.#define bfd_mach_arm_5T 8
.#define bfd_mach_arm_5TE 9
.#define bfd_mach_arm_XScale 10
. bfd_arch_ns32k, {* National Semiconductors ns32000 *}
. bfd_arch_w65, {* WDC 65816 *}
. bfd_arch_tic30, {* Texas Instruments TMS320C30 *}
. bfd_arch_tic54x, {* Texas Instruments TMS320C54X *}
. bfd_arch_tic80, {* TI TMS320c80 (MVP) *}
. bfd_arch_v850, {* NEC V850 *}
.#define bfd_mach_v850 0
.#define bfd_mach_v850e 'E'
.#define bfd_mach_v850ea 'A'
. bfd_arch_arc, {* Argonaut RISC Core *}
.#define bfd_mach_arc_base 0
. bfd_arch_arc, {* ARC Cores *}
.#define bfd_mach_arc_5 0
.#define bfd_mach_arc_6 1
.#define bfd_mach_arc_7 2
.#define bfd_mach_arc_8 3
. bfd_arch_m32r, {* Mitsubishi M32R/D *}
.#define bfd_mach_m32r 0 {* backwards compatibility *}
.#define bfd_mach_m32rx 'x'
@ -198,20 +237,22 @@ DESCRIPTION
. bfd_arch_fr30,
.#define bfd_mach_fr30 0x46523330
. bfd_arch_mcore,
. bfd_arch_ia64, {* HP/Intel ia64 *}
.#define bfd_mach_ia64_elf64 0
.#define bfd_mach_ia64_elf32 1
. bfd_arch_pj,
. bfd_arch_avr, {* Atmel AVR microcontrollers *}
.#define bfd_mach_avr1 1
.#define bfd_mach_avr2 2
.#define bfd_mach_avr3 3
.#define bfd_mach_avr4 4
.#define bfd_mach_avr5 5
. bfd_arch_cris, {* Axis CRIS *}
. bfd_arch_last
. };
*/
/*
SUBSECTION
bfd_arch_info
@ -220,7 +261,7 @@ DESCRIPTION
within BFD.
.
.typedef struct bfd_arch_info
.typedef struct bfd_arch_info
.{
. int bits_per_word;
. int bits_per_address;
@ -230,8 +271,8 @@ DESCRIPTION
. const char *arch_name;
. const char *printable_name;
. unsigned int section_align_power;
. {* true if this is the default machine for the architecture *}
. boolean the_default;
. {* True if this is the default machine for the architecture. *}
. boolean the_default;
. const struct bfd_arch_info * (*compatible)
. PARAMS ((const struct bfd_arch_info *a,
. const struct bfd_arch_info *b));
@ -246,6 +287,7 @@ 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_cris_arch;
extern const bfd_arch_info_type bfd_d10v_arch;
extern const bfd_arch_info_type bfd_d30v_arch;
extern const bfd_arch_info_type bfd_h8300_arch;
@ -256,6 +298,8 @@ extern const bfd_arch_info_type bfd_i386_arch;
extern const bfd_arch_info_type bfd_i860_arch;
extern const bfd_arch_info_type bfd_i960_arch;
extern const bfd_arch_info_type bfd_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_mips_arch;
@ -267,6 +311,7 @@ extern const bfd_arch_info_type bfd_pj_arch;
extern const bfd_arch_info_type bfd_sh_arch;
extern const bfd_arch_info_type bfd_sparc_arch;
extern const bfd_arch_info_type bfd_tic30_arch;
extern const bfd_arch_info_type bfd_tic54x_arch;
extern const bfd_arch_info_type bfd_tic80_arch;
extern const bfd_arch_info_type bfd_vax_arch;
extern const bfd_arch_info_type bfd_we32k_arch;
@ -277,9 +322,9 @@ extern const bfd_arch_info_type bfd_v850_arch;
extern const bfd_arch_info_type bfd_fr30_arch;
extern const bfd_arch_info_type bfd_mcore_arch;
extern const bfd_arch_info_type bfd_avr_arch;
extern const bfd_arch_info_type bfd_ia64_arch;
static const bfd_arch_info_type * const bfd_archures_list[] =
{
static const bfd_arch_info_type * const bfd_archures_list[] = {
#ifdef SELECT_ARCHITECTURES
SELECT_ARCHITECTURES,
#else
@ -287,6 +332,7 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
&bfd_alpha_arch,
&bfd_arc_arch,
&bfd_arm_arch,
&bfd_cris_arch,
&bfd_d10v_arch,
&bfd_d30v_arch,
&bfd_h8300_arch,
@ -297,6 +343,8 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
&bfd_i860_arch,
&bfd_i960_arch,
&bfd_m32r_arch,
&bfd_m68hc11_arch,
&bfd_m68hc12_arch,
&bfd_m68k_arch,
&bfd_m88k_arch,
&bfd_mips_arch,
@ -307,6 +355,7 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
&bfd_sh_arch,
&bfd_sparc_arch,
&bfd_tic30_arch,
&bfd_tic54x_arch,
&bfd_tic80_arch,
&bfd_vax_arch,
&bfd_we32k_arch,
@ -317,6 +366,7 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
&bfd_fr30_arch,
&bfd_mcore_arch,
&bfd_avr_arch,
&bfd_ia64_arch,
#endif
0
};
@ -341,8 +391,6 @@ bfd_printable_name (abfd)
return abfd->arch_info->printable_name;
}
/*
FUNCTION
bfd_scan_arch
@ -354,7 +402,6 @@ DESCRIPTION
Figure out if BFD supports any cpu which could be described with
the name @var{string}. Return a pointer to an <<arch_info>>
structure if a machine is found, otherwise NULL.
*/
const bfd_arch_info_type *
@ -363,7 +410,7 @@ bfd_scan_arch (string)
{
const bfd_arch_info_type * const *app, *ap;
/* Look through all the installed architectures */
/* Look through all the installed architectures. */
for (app = bfd_archures_list; *app != NULL; app++)
{
for (ap = *app; ap != NULL; ap = ap->next)
@ -376,8 +423,6 @@ bfd_scan_arch (string)
return NULL;
}
/*
FUNCTION
bfd_arch_list
@ -388,7 +433,6 @@ SYNOPSIS
DESCRIPTION
Return a freshly malloced NULL-terminated vector of the names
of all the valid BFD architectures. Do not modify the names.
*/
const char **
@ -399,7 +443,7 @@ bfd_arch_list ()
const char **name_list;
const bfd_arch_info_type * const *app;
/* Determine the number of architectures */
/* Determine the number of architectures. */
vec_length = 0;
for (app = bfd_archures_list; *app != NULL; app++)
{
@ -410,12 +454,12 @@ bfd_arch_list ()
}
}
name_list = (CONST char **)
name_list = (const char **)
bfd_malloc ((vec_length + 1) * sizeof (char **));
if (name_list == NULL)
return NULL;
/* Point the list at each of the names */
/* Point the list at each of the names. */
name_ptr = name_list;
for (app = bfd_archures_list; *app != NULL; app++)
{
@ -431,8 +475,6 @@ bfd_arch_list ()
return name_list;
}
/*
FUNCTION
bfd_arch_get_compatible
@ -458,15 +500,14 @@ bfd_arch_get_compatible (abfd, bbfd)
/* If either architecture is unknown, then all we can do is assume
the user knows what he's doing. */
if (abfd->arch_info->arch == bfd_arch_unknown)
return bbfd->arch_info;
return bbfd->arch_info;
if (bbfd->arch_info->arch == bfd_arch_unknown)
return abfd->arch_info;
return abfd->arch_info;
/* Otherwise architecture-specific code has to decide. */
return abfd->arch_info->compatible (abfd->arch_info, bbfd->arch_info);
}
/*
INTERNAL_DEFINITION
bfd_default_arch_struct
@ -479,15 +520,13 @@ DESCRIPTION
architecture of the file.
.extern const bfd_arch_info_type bfd_default_arch_struct;
*/
const bfd_arch_info_type bfd_default_arch_struct =
{
32,32,8,bfd_arch_unknown,0,"unknown","unknown",2,true,
bfd_default_compatible,
bfd_default_scan,
0,
const bfd_arch_info_type bfd_default_arch_struct = {
32, 32, 8, bfd_arch_unknown, 0, "unknown", "unknown", 2, true,
bfd_default_compatible,
bfd_default_scan,
0,
};
/*
@ -522,7 +561,7 @@ DESCRIPTION
Set the architecture and machine type in BFD @var{abfd}
to @var{arch} and @var{mach}. Find the correct
pointer to a structure and insert it into the <<arch_info>>
pointer.
pointer.
*/
boolean
@ -552,7 +591,6 @@ bfd_default_set_arch_mach (abfd, arch, mach)
return false;
}
/*
FUNCTION
bfd_get_arch
@ -563,14 +601,13 @@ SYNOPSIS
DESCRIPTION
Return the enumerated type which describes the BFD @var{abfd}'s
architecture.
*/
enum bfd_architecture
bfd_get_arch (abfd)
bfd *abfd;
{
return abfd->arch_info->arch;
return abfd->arch_info->arch;
}
/*
@ -585,11 +622,11 @@ DESCRIPTION
machine.
*/
unsigned long
unsigned long
bfd_get_mach (abfd)
bfd *abfd;
{
return abfd->arch_info->mach;
return abfd->arch_info->mach;
}
/*
@ -602,7 +639,6 @@ SYNOPSIS
DESCRIPTION
Return the number of bits in one of the BFD @var{abfd}'s
architecture's bytes.
*/
unsigned int
@ -631,9 +667,8 @@ bfd_arch_bits_per_address (abfd)
return abfd->arch_info->bits_per_address;
}
/*
INTERNAL_FUNCTION
INTERNAL_FUNCTION
bfd_default_compatible
SYNOPSIS
@ -646,7 +681,7 @@ DESCRIPTION
*/
const bfd_arch_info_type *
bfd_default_compatible (a,b)
bfd_default_compatible (a, b)
const bfd_arch_info_type *a;
const bfd_arch_info_type *b;
{
@ -662,7 +697,6 @@ bfd_default_compatible (a,b)
return a;
}
/*
INTERNAL_FUNCTION
bfd_default_scan
@ -675,7 +709,7 @@ DESCRIPTION
architecture hit and a machine hit.
*/
boolean
boolean
bfd_default_scan (info, string)
const struct bfd_arch_info *info;
const char *string;
@ -687,17 +721,17 @@ bfd_default_scan (info, string)
const char *printable_name_colon;
/* Exact match of the architecture name (ARCH_NAME) and also the
default architecture? */
default architecture? */
if (strcasecmp (string, info->arch_name) == 0
&& info->the_default)
return true;
/* Exact match of the machine name (PRINTABLE_NAME)? */
/* Exact match of the machine name (PRINTABLE_NAME)? */
if (strcasecmp (string, info->printable_name) == 0)
return true;
/* Given that printable_name contains no colon, attempt to match:
ARCH_NAME [ ":" ] PRINTABLE_NAME? */
ARCH_NAME [ ":" ] PRINTABLE_NAME? */
printable_name_colon = strchr (info->printable_name, ':');
if (printable_name_colon == NULL)
{
@ -720,7 +754,7 @@ bfd_default_scan (info, string)
}
/* Given that PRINTABLE_NAME has the form: <arch> ":" <mach>;
Attempt to match: <arch> <mach>? */
Attempt to match: <arch> <mach>? */
if (printable_name_colon != NULL)
{
int colon_index = printable_name_colon - info->printable_name;
@ -732,48 +766,61 @@ bfd_default_scan (info, string)
/* Given that PRINTABLE_NAME has the form: <arch> ":" <mach>; Do not
attempt to match just <mach>, it could be ambigious. This test
is left until later. */
is left until later. */
/* NOTE: The below is retained for compatibility only. Please do not
add to this code */
/* NOTE: The below is retained for compatibility only. Please do
not add to this code. */
/* See how much of the supplied string matches with the
architecture, eg the string m68k:68020 would match the 68k entry
up to the :, then we get left with the machine number */
up to the :, then we get left with the machine number. */
for (ptr_src = string, ptr_tst = info->arch_name;
for (ptr_src = string, ptr_tst = info->arch_name;
*ptr_src && *ptr_tst;
ptr_src++, ptr_tst++)
ptr_src++, ptr_tst++)
{
if (*ptr_src != *ptr_tst) break;
if (*ptr_src != *ptr_tst)
break;
}
/* Chewed up as much of the architecture as will match, skip any
colons */
colons. */
if (*ptr_src == ':')
ptr_src++;
if (*ptr_src == 0)
{
/* nothing more, then only keep this one if it is the default
machine for this architecture */
/* Nothing more, then only keep this one if it is the default
machine for this architecture. */
return info->the_default;
}
number = 0;
while (isdigit ((unsigned char) *ptr_src))
{
number = number * 10 + *ptr_src - '0';
number = number * 10 + *ptr_src - '0';
ptr_src++;
}
/* NOTE: The below is retained for compatibility only.
PLEASE DO NOT ADD TO THIS CODE. */
PLEASE DO NOT ADD TO THIS CODE. */
switch (number)
switch (number)
{
/* FIXME: These are needed to parse IEEE objects. */
case 68000:
/* The following seven case's are here only for compatibility with
older binutils (at least IEEE objects from binutils 2.9.1 require
them). */
case bfd_mach_m68000:
case bfd_mach_m68010:
case bfd_mach_m68020:
case bfd_mach_m68030:
case bfd_mach_m68040:
case bfd_mach_m68060:
case bfd_mach_cpu32:
arch = bfd_arch_m68k;
break;
case 68000:
arch = bfd_arch_m68k;
number = bfd_mach_m68000;
break;
@ -840,11 +887,11 @@ bfd_default_scan (info, string)
number = bfd_mach_sh4;
break;
default:
default:
return false;
}
if (arch != info->arch)
if (arch != info->arch)
return false;
if (number != info->mach)
@ -853,7 +900,6 @@ bfd_default_scan (info, string)
return true;
}
/*
FUNCTION
bfd_get_arch_info
@ -872,7 +918,6 @@ bfd_get_arch_info (abfd)
return abfd->arch_info;
}
/*
FUNCTION
bfd_lookup_arch
@ -890,7 +935,7 @@ DESCRIPTION
default.
*/
const bfd_arch_info_type *
const bfd_arch_info_type *
bfd_lookup_arch (arch, machine)
enum bfd_architecture arch;
unsigned long machine;
@ -911,7 +956,6 @@ bfd_lookup_arch (arch, machine)
return NULL;
}
/*
FUNCTION
bfd_printable_arch_mach
@ -922,7 +966,7 @@ SYNOPSIS
DESCRIPTION
Return a printable string representing the architecture and
machine type.
machine type.
This routine is depreciated.
*/
@ -932,11 +976,11 @@ bfd_printable_arch_mach (arch, machine)
enum bfd_architecture arch;
unsigned long machine;
{
const bfd_arch_info_type * ap = bfd_lookup_arch (arch, machine);
const bfd_arch_info_type *ap = bfd_lookup_arch (arch, machine);
if (ap)
return ap->printable_name;
return "UNKNOWN!";
if (ap)
return ap->printable_name;
return "UNKNOWN!";
}
/*
@ -950,15 +994,14 @@ DESCRIPTION
Return the number of octets (8-bit quantities) per target byte
(minimum addressable unit). In most cases, this will be one, but some
DSP targets have 16, 32, or even 48 bits per byte.
*/
unsigned int
bfd_octets_per_byte (abfd)
bfd * abfd;
bfd *abfd;
{
return bfd_arch_mach_octets_per_byte (bfd_get_arch (abfd),
bfd_get_mach (abfd));
return bfd_arch_mach_octets_per_byte (bfd_get_arch (abfd),
bfd_get_mach (abfd));
}
/*
@ -971,19 +1014,19 @@ SYNOPSIS
DESCRIPTION
See bfd_octets_per_byte.
This routine is provided for those cases where a bfd * is not
available
*/
unsigned int
bfd_arch_mach_octets_per_byte (arch, mach)
enum bfd_architecture arch;
unsigned long mach;
enum bfd_architecture arch;
unsigned long mach;
{
const bfd_arch_info_type * ap = bfd_lookup_arch (arch, mach);
if (ap)
return ap->bits_per_byte / 8;
return 1;
const bfd_arch_info_type *ap = bfd_lookup_arch (arch, mach);
if (ap)
return ap->bits_per_byte / 8;
return 1;
}

View File

@ -15,7 +15,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define BYTES_IN_WORD 4
#undef TARGET_IS_BIG_ENDIAN_P

View File

@ -23,7 +23,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. */
/* bfd.h -- The only header file required by users of the bfd library
/* bfd.h -- The only header file required by users of the bfd library
The bfd.h file is generated from bfd-in.h and various .c files; if you
change it, your changes will probably be lost.
@ -84,7 +84,7 @@ typedef struct _bfd bfd;
/* General rules: functions which are boolean return true on success
and false on failure (unless they're a predicate). -- bfd.doc */
/* I'm sure this is going to break something and someone is going to
force me to change it. */
force me to change it. */
/* typedef enum boolean {false, true} boolean; */
/* Yup, SVR4 has a "typedef enum boolean" in <sys/types.h> -fnf */
/* It gets worse if the host also defines a true/false enum... -sts */
@ -93,7 +93,7 @@ typedef struct _bfd bfd;
#define TRUE_FALSE_ALREADY_DEFINED
#endif
#ifdef MPW
/* Pre-emptive strike - get the file with the enum. */
/* Pre-emptive strike - get the file with the enum. */
#include <Types.h>
#define TRUE_FALSE_ALREADY_DEFINED
#endif /* MPW */
@ -109,7 +109,7 @@ typedef enum bfd_boolean {bfd_fffalse, bfd_tttrue} boolean;
/* FIXME: This should be using off_t from <sys/types.h>.
For now, try to avoid breaking stuff by not including <sys/types.h> here.
This will break on systems with 64-bit file offsets (e.g. 4.4BSD).
Probably the best long-term answer is to avoid using file_ptr AND off_t
Probably the best long-term answer is to avoid using file_ptr AND off_t
in this header file, and to handle this in the BFD implementation
rather than in its interface. */
/* typedef off_t file_ptr; */
@ -177,8 +177,8 @@ typedef unsigned long symvalue;
typedef unsigned long bfd_size_type;
/* Print a bfd_vma x on stream s. */
#define fprintf_vma(s,x) fprintf(s, "%08lx", x)
#define sprintf_vma(s,x) sprintf(s, "%08lx", x)
#define fprintf_vma(s,x) fprintf (s, "%08lx", x)
#define sprintf_vma(s,x) sprintf (s, "%08lx", x)
#endif /* not BFD64 */
@ -284,19 +284,17 @@ typedef struct carsym {
file_ptr file_offset; /* look here to find the file */
} carsym; /* to make these you call a carsymogen */
/* Used in generating armaps (archive tables of contents).
Perhaps just a forward definition would do? */
struct orl { /* output ranlib */
char **name; /* symbol name */
char **name; /* symbol name */
file_ptr pos; /* bfd* or file position */
int namidx; /* index into string table */
};
/* Linenumber stuff */
typedef struct lineno_cache_entry {
unsigned int line_number; /* Linenumber from start of function*/
unsigned int line_number; /* Linenumber from start of function*/
union {
struct symbol_cache_entry *sym; /* Function name */
unsigned long offset; /* Offset into section */
@ -327,15 +325,15 @@ typedef struct sec *sec_ptr;
#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),true)
#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),true)
typedef struct stat stat_type;
typedef struct stat stat_type;
typedef enum bfd_print_symbol
{
{
bfd_print_symbol_name,
bfd_print_symbol_more,
bfd_print_symbol_all
} bfd_print_symbol_type;
/* Information about a symbol that nm needs. */
typedef struct _symbol_info
@ -344,7 +342,7 @@ typedef struct _symbol_info
char type;
CONST char *name; /* Symbol name. */
unsigned char stab_type; /* Stab type. */
char stab_other; /* Stab other. */
char stab_other; /* Stab other. */
short stab_desc; /* Stab desc. */
CONST char *stab_name; /* String for stab type. */
} symbol_info;
@ -481,7 +479,6 @@ extern long bfd_tell PARAMS ((bfd *abfd));
extern int bfd_flush PARAMS ((bfd *abfd));
extern int bfd_stat PARAMS ((bfd *abfd, struct stat *));
/* Cast from const char * to char * so that caller can assign to
a char * without a warning. */
#define bfd_get_filename(abfd) ((char *) (abfd)->filename)
@ -489,6 +486,9 @@ extern int bfd_stat PARAMS ((bfd *abfd, struct stat *));
#define bfd_get_format(abfd) ((abfd)->format)
#define bfd_get_target(abfd) ((abfd)->xvec->name)
#define bfd_get_flavour(abfd) ((abfd)->xvec->flavour)
#define bfd_family_coff(abfd) \
(bfd_get_flavour (abfd) == bfd_target_coff_flavour || \
bfd_get_flavour (abfd) == bfd_target_xcoff_flavour)
#define bfd_big_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_BIG)
#define bfd_little_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_LITTLE)
#define bfd_header_big_endian(abfd) \
@ -511,7 +511,7 @@ extern int bfd_stat PARAMS ((bfd *abfd, struct stat *));
#define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (boolean)(bool)), true)
#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (boolean) (bool)), true)
extern boolean bfd_record_phdr
PARAMS ((bfd *, unsigned long, boolean, flagword, boolean, bfd_vma,
@ -537,6 +537,11 @@ void bfd_putb32 PARAMS ((bfd_vma, unsigned char *));
void bfd_putl32 PARAMS ((bfd_vma, unsigned char *));
void bfd_putb16 PARAMS ((bfd_vma, unsigned char *));
void bfd_putl16 PARAMS ((bfd_vma, unsigned char *));
/* Byte swapping routines which take size and endiannes as arguments. */
bfd_vma bfd_get_bits PARAMS ((bfd_byte *, int, boolean));
void bfd_put_bits PARAMS ((bfd_vma, bfd_byte *, int, boolean));
/* Externally visible ECOFF routines. */
@ -624,7 +629,10 @@ extern boolean bfd_elf64_size_dynamic_sections
const char * const *, struct bfd_link_info *, struct sec **,
struct bfd_elf_version_tree *));
extern void bfd_elf_set_dt_needed_name PARAMS ((bfd *, const char *));
extern void bfd_elf_set_dt_needed_soname PARAMS ((bfd *, const char *));
extern const char *bfd_elf_get_dt_soname PARAMS ((bfd *));
extern struct bfd_link_needed_list *bfd_elf_get_runpath_list
PARAMS ((bfd *, struct bfd_link_info *));
/* Return an upper bound on the number of bytes required to store a
copy of ABFD's program header table entries. Return -1 if an error
@ -640,6 +648,16 @@ extern long bfd_get_elf_phdr_upper_bound PARAMS ((bfd *abfd));
error occurs; bfd_get_error will return an appropriate code. */
extern int bfd_get_elf_phdrs PARAMS ((bfd *abfd, void *phdrs));
/* Return the arch_size field of an elf bfd, or -1 if not elf. */
extern int bfd_get_arch_size PARAMS ((bfd *));
/* Return true if address "naturally" sign extends, or -1 if not elf. */
extern int bfd_get_sign_extend_vma PARAMS ((bfd *));
extern boolean bfd_m68k_elf32_create_embedded_relocs
PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
char **));
/* SunOS shared library support routines for the linker. */
extern struct bfd_link_needed_list *bfd_sunos_get_needed_list
@ -718,6 +736,10 @@ extern boolean bfd_coff_get_auxent
extern boolean bfd_coff_set_symbol_class
PARAMS ((bfd *, struct symbol_cache_entry *, unsigned int));
extern boolean bfd_m68k_coff_create_embedded_relocs
PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
char **));
/* ARM Interworking support. Called from linker. */
extern boolean bfd_arm_allocate_interworking_sections
PARAMS ((struct bfd_link_info *));
@ -748,4 +770,11 @@ extern boolean bfd_elf32_arm_process_before_allocation
extern boolean bfd_elf32_arm_get_bfd_for_interworking
PARAMS ((bfd *, struct bfd_link_info *));
/* TI COFF load page support. */
extern void bfd_ticoff_set_section_load_page
PARAMS ((struct sec *, int));
extern int bfd_ticoff_get_section_load_page
PARAMS ((struct sec *));
/* And more from the source. */

File diff suppressed because it is too large Load Diff

View File

@ -33,10 +33,10 @@ SECTION
CODE_FRAGMENT
.
.struct _bfd
.struct _bfd
.{
. {* The filename the application opened the BFD with. *}
. CONST char *filename;
. CONST char *filename;
.
. {* A pointer to the target jump table. *}
. const struct bfd_target *xvec;
@ -69,7 +69,7 @@ CODE_FRAGMENT
. {* When a file is closed by the caching routines, BFD retains
. state information on the file here: *}
.
. file_ptr where;
. file_ptr where;
.
. {* and here: (``once'' means at least once) *}
.
@ -82,7 +82,7 @@ CODE_FRAGMENT
.
. {* File modified time, if mtime_set is true: *}
.
. long mtime;
. long mtime;
.
. {* Reserved for an unimplemented file locking extension.*}
.
@ -101,13 +101,13 @@ CODE_FRAGMENT
.
. {* Format_specific flags*}
.
. flagword flags;
. flagword flags;
.
. {* Currently my_archive is tested before adding origin to
. anything. I believe that this can become always an add of
. origin, with origin set to 0 for non archive files. *}
.
. file_ptr origin;
. file_ptr origin;
.
. {* Remember when output has begun, to stop strange things
. from happening. *}
@ -119,7 +119,7 @@ CODE_FRAGMENT
. {* The number of sections *}
. unsigned int section_count;
.
. {* Stuff only useful for object files:
. {* Stuff only useful for object files:
. The start address. *}
. bfd_vma start_address;
.
@ -127,17 +127,17 @@ CODE_FRAGMENT
. unsigned int symcount;
.
. {* Symbol table for output BFD (with symcount entries) *}
. struct symbol_cache_entry **outsymbols;
. struct symbol_cache_entry **outsymbols;
.
. {* Pointer to structure which contains architecture information*}
. const struct bfd_arch_info *arch_info;
.
. {* Stuff only useful for archives:*}
. PTR arelt_data;
. PTR arelt_data;
. struct _bfd *my_archive; {* The containing archive BFD. *}
. struct _bfd *next; {* The next BFD in the archive. *}
. struct _bfd *archive_head; {* The first BFD in the archive. *}
. boolean has_armap;
. boolean has_armap;
.
. {* A chain of BFD structures involved in a link. *}
. struct _bfd *link_next;
@ -148,7 +148,7 @@ CODE_FRAGMENT
.
. {* Used by the back end to hold private data. *}
.
. union
. union
. {
. struct aout_data_struct *aout_data;
. struct artdata *aout_ar_data;
@ -180,7 +180,7 @@ CODE_FRAGMENT
. struct netbsd_core_struct *netbsd_core_data;
. PTR any;
. } tdata;
.
.
. {* Used by the application to hold private data*}
. PTR usrdata;
.
@ -218,8 +218,6 @@ CODE_FRAGMENT
struct which ultimately gets passed in to the bfd. When it arrives, copy
it to the following struct so that the data will be available in coffcode.h
where it is needed. The typedef's used are defined in bfd.h */
/*
SECTION
@ -376,7 +374,7 @@ bfd_perror (message)
CONST char *message;
{
if (bfd_get_error () == bfd_error_system_call)
perror((char *)message); /* must be system error then... */
perror((char *)message); /* must be system error then... */
else {
if (message == NULL || *message == '\0')
fprintf (stderr, "%s\n", bfd_errmsg (bfd_get_error ()));
@ -510,7 +508,6 @@ bfd_set_error_program_name (name)
_bfd_error_program_name = name;
}
/*
FUNCTION
bfd_get_error_handler
@ -547,7 +544,6 @@ DESCRIPTION
*/
long
bfd_get_reloc_upper_bound (abfd, asect)
bfd *abfd;
@ -584,7 +580,6 @@ DESCRIPTION
The @var{syms} table is also needed for horrible internal magic
reasons.
*/
long
bfd_canonicalize_reloc (abfd, asect, location, symbols)
@ -615,7 +610,7 @@ DESCRIPTION
The argument @var{abfd} is ignored.
*/
/*ARGSUSED*/
void
bfd_set_reloc (ignore_abfd, asect, location, count)
bfd *ignore_abfd ATTRIBUTE_UNUSED;
@ -704,6 +699,65 @@ _bfd_abort (file, line, fn)
xexit (EXIT_FAILURE);
}
/*
FUNCTION
bfd_get_arch_size
SYNOPSIS
int bfd_get_arch_size (bfd *abfd);
DESCRIPTION
Returns the architecture address size, in bits, as determined
by the object file's format. For ELF, this information is
included in the header.
RETURNS
Returns the arch size in bits if known, <<-1>> otherwise.
*/
int
bfd_get_arch_size (abfd)
bfd *abfd;
{
if (abfd->xvec->flavour == bfd_target_elf_flavour)
return (get_elf_backend_data (abfd))->s->arch_size;
bfd_set_error (bfd_error_wrong_format);
return -1;
}
/*
FUNCTION
bfd_get_sign_extend_vma
SYNOPSIS
int bfd_get_sign_extend_vma (bfd *abfd);
DESCRIPTION
Indicates if the target architecture "naturally" sign extends
an address. Some architectures implicitly sign extend address
values when they are converted to types larger than the size
of an address. For instance, bfd_get_start_address() will
return an address sign extended to fill a bfd_vma when this is
the case.
RETURNS
Returns <<1>> if the target architecture is known to sign
extend addresses, <<0>> if the target architecture is known to
not sign extend addresses, and <<-1>> otherwise.
*/
int
bfd_get_sign_extend_vma (abfd)
bfd *abfd;
{
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
return (get_elf_backend_data (abfd)->sign_extend_vma);
bfd_set_error (bfd_error_wrong_format);
return -1;
}
/*
FUNCTION
bfd_set_start_address
@ -727,7 +781,6 @@ bfd_vma vma;
return true;
}
/*
FUNCTION
bfd_get_mtime
@ -779,7 +832,7 @@ DESCRIPTION
Instead, we want to ask questions like "is this NNN byte sized
object I'm about to try read from file offset YYY reasonable?"
As as example of where we might do this, some object formats
use string tables for which the first <<sizeof(long)>> bytes of the
use string tables for which the first <<sizeof (long)>> bytes of the
table contain the size of the table itself, including the size bytes.
If an application tries to read what it thinks is one of these
string tables, without some way to validate the size, and for
@ -926,7 +979,7 @@ bfd_scan_vma (string, end, base)
int digit;
/* Let the host do it if possible. */
if (sizeof(bfd_vma) <= sizeof(unsigned long))
if (sizeof (bfd_vma) <= sizeof (unsigned long))
return (bfd_vma) strtoul (string, (char **) end, base);
/* A negative base makes no sense, and we only need to go as high as hex. */
@ -950,7 +1003,7 @@ bfd_scan_vma (string, end, base)
(string[0] == '0') && ((string[1] == 'x') || (string[1] == 'X')))
string += 2;
/* XXX should we also skip over "0b" or "0B" if base is 2? */
/* Speed could be improved with a table like hex_value[] in gas. */
#define HEX_VALUE(c) \
(isxdigit ((unsigned char) c) \
@ -978,7 +1031,7 @@ SYNOPSIS
boolean bfd_copy_private_bfd_data(bfd *ibfd, bfd *obfd);
DESCRIPTION
Copy private BFD information from the BFD @var{ibfd} to the
Copy private BFD information from the BFD @var{ibfd} to the
the BFD @var{obfd}. Return <<true>> on success, <<false>> on error.
Possible error returns are:
@ -999,7 +1052,7 @@ SYNOPSIS
boolean bfd_merge_private_bfd_data(bfd *ibfd, bfd *obfd);
DESCRIPTION
Merge private BFD information from the BFD @var{ibfd} to the
Merge private BFD information from the BFD @var{ibfd} to the
the output file BFD @var{obfd} when linking. Return <<true>>
on success, <<false>> on error. Possible error returns are:

View File

@ -255,6 +255,9 @@ binary_set_section_contents (abfd, sec, data, offset, size)
file_ptr offset;
bfd_size_type size;
{
if (size == 0)
return true;
if (! abfd->output_has_begun)
{
boolean found_low;
@ -270,6 +273,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)
&& (! found_low || s->lma < low))
{
low = s->lma;
@ -281,17 +285,18 @@ binary_set_section_contents (abfd, sec, data, offset, size)
s->filepos = s->lma - low;
/* Skip following warning check for sections that will not
occupy file space. */
occupy file space. */
if ((s->flags
& (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_NEVER_LOAD))
!= (SEC_HAS_CONTENTS | SEC_ALLOC))
!= (SEC_HAS_CONTENTS | SEC_ALLOC)
|| (s->_raw_size == 0))
continue;
/* If attempting to generate a binary file from a bfd with
LMA's all over the place, huge (sparse?) binary files may
result. This condition attempts to detect this situation
and print a warning. Better heuristics would be nice to
have. */
have. */
if (s->filepos < 0)
(*_bfd_error_handler)
@ -383,6 +388,6 @@ const bfd_target binary_vec =
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
NULL
};

View File

@ -1,5 +1,5 @@
/* BFD library -- caching of file descriptors.
Copyright 1990, 91, 92, 93, 94, 95, 1996, 2000
Copyright 1990, 91, 92, 93, 94, 95, 1996, 2000, 2001
Free Software Foundation, Inc.
Hacked by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
@ -32,7 +32,7 @@ SECTION
<<bfd_cache_lookup>>, which runs around and makes sure that
the required BFD is open. If not, then it chooses a file to
close, closes it and opens the one wanted, returning its file
handle.
handle.
*/
@ -79,19 +79,18 @@ 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): \
. (FILE*) (bfd_last_cache->iostream): \
. bfd_cache_lookup_worker(x))
*/
/* Insert a BFD into the cache. */
@ -262,7 +261,7 @@ FILE *
bfd_open_file (abfd)
bfd *abfd;
{
abfd->cacheable = true; /* Allow it to be closed later. */
abfd->cacheable = true; /* Allow it to be closed later. */
if (open_files >= BFD_CACHE_MAX_OPEN)
{
@ -312,7 +311,7 @@ bfd_open_file (abfd)
if (stat (abfd->filename, &s) == 0 && s.st_size != 0)
unlink (abfd->filename);
#endif
abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_WB);
abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_WUB);
abfd->opened_once = true;
}
break;
@ -339,7 +338,7 @@ DESCRIPTION
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.
avoid running out of file descriptors.
*/
FILE *
@ -349,7 +348,7 @@ bfd_cache_lookup_worker (abfd)
if ((abfd->flags & BFD_IN_MEMORY) != 0)
abort ();
if (abfd->my_archive)
if (abfd->my_archive)
abfd = abfd->my_archive;
if (abfd->iostream != NULL)

View File

@ -924,7 +924,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
does not cause anything to happen, itself. */
rel->address += input_section->output_offset;
break;
case ALPHA_R_GPDISP:
/* This marks the ldah of an ldah/lda pair which loads the
gp register with the difference of the gp value and the
@ -980,7 +980,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
rel->address += input_section->output_offset;
}
break;
case ALPHA_R_OP_PUSH:
/* Push a value on the reloc evaluation stack. */
{
@ -1106,7 +1106,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
stack[tos - 1] >>= relocation;
}
break;
case ALPHA_R_GPVALUE:
/* I really don't know if this does the right thing. */
gp = rel->addend;
@ -1126,7 +1126,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
os->reloc_count++;
}
if (r != bfd_reloc_ok)
if (r != bfd_reloc_ok)
{
switch (r)
{
@ -1136,7 +1136,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
input_bfd, input_section, rel->address, true)))
goto error_return;
break;
case bfd_reloc_dangerous:
case bfd_reloc_dangerous:
if (! ((*link_info->callbacks->reloc_dangerous)
(link_info, err, input_bfd, input_section,
rel->address)))
@ -1332,7 +1332,7 @@ alpha_convert_external_reloc (output_bfd, info, input_bfd, ext_rel, h)
r_symndx = RELOC_SECTION_XDATA;
break;
}
if (r_symndx == -1)
abort ();
@ -1437,7 +1437,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
pointer. To support large programs, we need to allow multiple
global pointers. This works as long as each input .lita section
is <64KB big. This implies that when producing relocatable
output, the .lita section is limited to 64KB. . */
output, the .lita section is limited to 64KB. . */
lita_sec = symndx_to_section[RELOC_SECTION_LITA];
gp = _bfd_get_gp_value (output_bfd);
@ -1619,7 +1619,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
/* See ALPHA_R_LITERAL above for the uses of this reloc. It
does not cause anything to happen, itself. */
break;
case ALPHA_R_GPDISP:
/* This marks the ldah of an ldah/lda pair which loads the
gp register with the difference of the gp value and the
@ -1679,7 +1679,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
gp_usedp = true;
}
break;
case ALPHA_R_OP_PUSH:
case ALPHA_R_OP_PSUB:
case ALPHA_R_OP_PRSHIFT:
@ -2008,7 +2008,6 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
/* Do final adjustments to the filehdr and the aouthdr. This routine
sets the dynamic bits in the file header. */
/*ARGSUSED*/
static boolean
alpha_adjust_headers (abfd, fhdr, ahdr)
bfd *abfd;
@ -2136,7 +2135,7 @@ alpha_ecoff_get_elt_at_filepos (archive, filepos)
left = size;
/* I don't know what the next eight bytes are for. */
/* I don't know what the next eight bytes are for. */
if (bfd_read (ab, 1, 8, nbfd) != 8)
goto error_return;
@ -2201,7 +2200,7 @@ alpha_ecoff_get_elt_at_filepos (archive, filepos)
error_return:
if (nbfd != NULL)
bfd_close (nbfd);
return NULL;
return NULL;
}
/* Open the next archived file. */
@ -2229,7 +2228,7 @@ alpha_ecoff_openr_next_archived_file (archive, last_file)
/* 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. */
BSD-4.4-style element with a long odd size. */
filestart = last_file->origin + size;
filestart += filestart % 2;
}
@ -2266,7 +2265,7 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data =
(unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* reloc_out */
alpha_ecoff_swap_filehdr_out, alpha_ecoff_swap_aouthdr_out,
alpha_ecoff_swap_scnhdr_out,
FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, true, false, 4,
FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, true, false, 4, false, 2,
alpha_ecoff_swap_filehdr_in, alpha_ecoff_swap_aouthdr_in,
alpha_ecoff_swap_scnhdr_in, NULL,
alpha_ecoff_bad_format_hook, _bfd_ecoff_set_arch_mach_hook,
@ -2400,6 +2399,6 @@ const bfd_target ecoffalpha_little_vec =
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
(PTR) &alpha_ecoff_backend_data
};

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* 4k pages */
#define COFF_PAGE_SIZE 0x1000
/* On AUX, a STYP_NOLOAD|STYP_BSS section is part of a shared library. */
/* On AUX, a STYP_NOLOAD|STYP_BSS section is part of a shared library. */
#define BSS_NOLOAD_IS_SHARED_LIBRARY
#define STATIC_RELOCS
@ -41,8 +41,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "sysdep.h"
static boolean coff_m68k_aux_link_add_one_symbol
PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword,
asection *, bfd_vma, const char *, boolean, boolean,
PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword,
asection *, bfd_vma, const char *, boolean, boolean,
struct bfd_link_hash_entry **));
#define coff_link_add_one_symbol coff_m68k_aux_link_add_one_symbol
@ -54,7 +54,7 @@ static boolean coff_m68k_aux_link_add_one_symbol
mirrors Apple's "solution" to let a static library symbol override
a shared library symbol. On the whole not a good thing, given how
shared libraries work here, but can work if you are careful with
what you include in the shared object. */
what you include in the shared object. */
static boolean
coff_m68k_aux_link_add_one_symbol (info, abfd, name, flags, section, value,

View File

@ -73,8 +73,10 @@ coff_i386_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
{
symvalue diff;
#ifndef COFF_WITH_PE
if (output_bfd == (bfd *) NULL)
return bfd_reloc_continue;
#endif
if (bfd_is_com_section (symbol->section))
{
@ -102,7 +104,26 @@ coff_i386_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
ignores the addend for a COFF target when producing
relocateable output. This seems to be always wrong for 386
COFF, so we handle the addend here instead. */
diff = reloc_entry->addend;
#ifdef COFF_WITH_PE
if (output_bfd == (bfd *) NULL)
{
reloc_howto_type *howto = reloc_entry->howto;
/* Although PC relative relocations are very similar between
PE and non-PE formats, but they are off by 1 << howto->size
bytes. For the external relocation, PE is very different
from others. See md_apply_fix3 () in gas/config/tc-i386.c.
When we link PE and non-PE object files together to
generate a non-PE executable, we have to compensate it
here. */
if (howto->pc_relative == true && howto->pcrel_offset == true)
diff = -(1 << howto->size);
else
diff = -reloc_entry->addend;
}
else
#endif
diff = reloc_entry->addend;
}
#ifdef COFF_WITH_PE
@ -155,19 +176,17 @@ coff_i386_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
}
#ifdef COFF_WITH_PE
/* Return true if this relocation should appear in the output .reloc
section. */
static boolean in_reloc_p PARAMS ((bfd *, reloc_howto_type *));
static boolean in_reloc_p (abfd, howto)
bfd *abfd ATTRIBUTE_UNUSED;
bfd * abfd ATTRIBUTE_UNUSED;
reloc_howto_type *howto;
{
return ! howto->pc_relative && howto->type != R_IMAGEBASE;
}
#endif /* COFF_WITH_PE */
#ifndef PCRELOFFSET
@ -575,7 +594,7 @@ const bfd_target
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
/* Note that we allow an object file to be treated as a core file as well. */
/* Note that we allow an object file to be treated as a core file as well. */
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
bfd_generic_archive_p, coff_object_p},
{bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */

File diff suppressed because it is too large Load Diff

View File

@ -36,8 +36,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
enum reloc_type
{
R_SPARC_NONE = 0,
R_SPARC_8, R_SPARC_16, R_SPARC_32,
R_SPARC_DISP8, R_SPARC_DISP16, R_SPARC_DISP32,
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,
@ -96,7 +96,7 @@ bfd_coff_generic_reloc (abfd, reloc_entry, symbol, data, input_section,
return bfd_reloc_continue;
}
static reloc_howto_type coff_sparc_howto_table[] =
static reloc_howto_type coff_sparc_howto_table[] =
{
HOWTO(R_SPARC_NONE, 0,0, 0,false,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_NONE", false,0,0x00000000,true),
HOWTO(R_SPARC_8, 0,0, 8,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_8", false,0,0x000000ff,true),
@ -197,7 +197,7 @@ rtype2howto (cache_ptr, dst)
#define __A_MAGIC_SET__
/* Enable Sparc-specific hacks in coffcode.h. */
/* Enable Sparc-specific hacks in coffcode.h. */
#define COFF_SPARC

View File

@ -49,7 +49,7 @@ reloc_howto_type tic30_coff_howto_table[] =
/* For the case statement use the code values used in tc_gen_reloc to
map to the howto table entries that match those in both the aout
and coff implementations. */
and coff implementations. */
reloc_howto_type *
tic30_coff_reloc_type_lookup (abfd, code)
bfd *abfd ATTRIBUTE_UNUSED;
@ -86,7 +86,6 @@ coff_tic30_select_reloc (howto)
#define SELECT_RELOC(x,howto) x.r_type = coff_tic30_select_reloc(howto)
#define BADMAG(x) TIC30BADMAG(x)
#define TIC30 1 /* Customize coffcode.h */
#define __A_MAGIC_SET__
@ -97,7 +96,7 @@ coff_tic30_select_reloc (howto)
#define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) dst->r_stuff[0] = 'S'; \
dst->r_stuff[1] = 'C';
/* Code to turn a r_type into a howto ptr, uses the above howto table. */
/* Code to turn a r_type into a howto ptr, uses the above howto table. */
static void
rtype2howto (internal, dst)
@ -134,7 +133,6 @@ rtype2howto (internal, dst)
#define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \
cache_ptr->addend = ext_reloc.r_offset;
#define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \
reloc_processing(relent, reloc, symbols, abfd, section)
@ -203,6 +201,6 @@ const bfd_target tic30_coff_vec =
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
COFF_SWAP_TABLE
};

View File

@ -54,7 +54,7 @@ HOWTO (R_JR, 0, 1, 8, true, 0, complain_overflow_signed, 0,
/* Turn a howto into a reloc number */
static int
static int
coff_z8k_select_reloc (howto)
reloc_howto_type *howto;
{
@ -63,13 +63,10 @@ coff_z8k_select_reloc (howto)
#define SELECT_RELOC(x,howto) x.r_type = coff_z8k_select_reloc(howto)
#define BADMAG(x) Z8KBADMAG(x)
#define Z8K 1 /* Customize coffcode.h */
#define __A_MAGIC_SET__
/* Code to swap in the reloc */
#define SWAP_IN_RELOC_OFFSET bfd_h_get_32
#define SWAP_OUT_RELOC_OFFSET bfd_h_put_32
@ -110,18 +107,15 @@ rtype2howto (internal, dst)
#define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry)
/* Perform any necessary magic to the addend in a reloc entry */
#define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \
cache_ptr->addend = ext_reloc.r_offset;
#define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \
reloc_processing(relent, reloc, symbols, abfd, section)
static void
static void
reloc_processing (relent, reloc, symbols, abfd, section)
arelent * relent;
struct internal_reloc *reloc;
@ -141,7 +135,6 @@ reloc_processing (relent, reloc, symbols, abfd, section)
relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
}
relent->addend = reloc->r_offset;
relent->address -= section->vma;
}
@ -178,7 +171,7 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)
case R_IMM4L:
bfd_put_8 (in_abfd,
((bfd_get_8 (in_abfd, data + *dst_ptr) & 0xf0)
((bfd_get_8 (in_abfd, data + *dst_ptr) & 0xf0)
| (0x0f
& bfd_coff_reloc16_get_value (reloc, link_info,
input_section))),
@ -230,7 +223,6 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)
#include "coffcode.h"
#undef coff_bfd_get_relocated_section_contents
#undef coff_bfd_relax_section
#define coff_bfd_get_relocated_section_contents \

File diff suppressed because it is too large Load Diff

View File

@ -60,7 +60,7 @@ static void coff_pointerize_aux
static boolean make_a_section_from_file
PARAMS ((bfd *, struct internal_scnhdr *, unsigned int));
static const bfd_target *coff_real_object_p
PARAMS ((bfd *, unsigned, struct internal_filehdr *,
PARAMS ((bfd *, unsigned, struct internal_filehdr *,
struct internal_aouthdr *));
static void fixup_symbol_value
PARAMS ((bfd *, coff_symbol_type *, struct internal_syment *));
@ -212,7 +212,7 @@ coff_real_object_p (abfd, nscns, internal_f, internal_a)
goto fail;
/* Set the arch/mach *before* swapping in sections; section header swapping
may depend on arch/mach info. */
may depend on arch/mach info. */
if (bfd_coff_set_arch_mach_hook (abfd, (PTR) internal_f) == false)
goto fail;
@ -340,7 +340,6 @@ coff_get_symtab_upper_bound (abfd)
return (bfd_get_symcount (abfd) + 1) * (sizeof (coff_symbol_type *));
}
/* Canonicalize a COFF symbol table. */
long
@ -525,7 +524,7 @@ coff_count_linenumbers (abfd)
{
asymbol *q_maybe = *p;
if (bfd_asymbol_flavour (q_maybe) == bfd_target_coff_flavour)
if (bfd_family_coff (bfd_asymbol_bfd (q_maybe)))
{
coff_symbol_type *q = coffsymbol (q_maybe);
@ -558,13 +557,12 @@ coff_count_linenumbers (abfd)
/* Takes a bfd and a symbol, returns a pointer to the coff specific
area of the symbol if there is one. */
/*ARGSUSED*/
coff_symbol_type *
coff_symbol_from (ignore_abfd, symbol)
bfd *ignore_abfd ATTRIBUTE_UNUSED;
asymbol *symbol;
{
if (bfd_asymbol_flavour (symbol) != bfd_target_coff_flavour)
if (!bfd_family_coff (bfd_asymbol_bfd (symbol)))
return (coff_symbol_type *) NULL;
if (bfd_asymbol_bfd (symbol)->tdata.coff_obj_data == (coff_data_type *) NULL)
@ -608,8 +606,11 @@ fixup_symbol_value (abfd, coff_symbol_ptr, syment)
syment->n_value = (coff_symbol_ptr->symbol.value
+ coff_symbol_ptr->symbol.section->output_offset);
if (! obj_pe (abfd))
syment->n_value +=
coff_symbol_ptr->symbol.section->output_section->vma;
{
syment->n_value += (syment->n_sclass == C_STATLAB)
? coff_symbol_ptr->symbol.section->output_section->lma
: coff_symbol_ptr->symbol.section->output_section->vma;
}
}
else
{
@ -689,7 +690,7 @@ coff_renumber_symbols (bfd_ptr, first_undef)
for (symbol_index = 0; symbol_index < symbol_count; symbol_index++)
{
coff_symbol_type *coff_symbol_ptr = coff_symbol_from (bfd_ptr, symbol_ptr_ptr[symbol_index]);
symbol_ptr_ptr[symbol_index]->udata.i = symbol_index;
symbol_ptr_ptr[symbol_index]->udata.i = symbol_index;
if (coff_symbol_ptr && coff_symbol_ptr->native)
{
combined_entry_type *s = coff_symbol_ptr->native;
@ -816,7 +817,16 @@ coff_fix_symbol_name (abfd, symbol, native, string_size_p,
{
unsigned int filnmlen;
strncpy (native->u.syment._n._n_name, ".file", SYMNMLEN);
if (bfd_coff_force_symnames_in_strings (abfd))
{
native->u.syment._n._n_n._n_offset =
(*string_size_p + STRING_SIZE_SIZE);
native->u.syment._n._n_n._n_zeroes = 0;
*string_size_p += 6; /* strlen(".file") + 1 */
}
else
strncpy (native->u.syment._n._n_name, ".file", SYMNMLEN);
auxent = &(native + 1)->u.auxent;
filnmlen = bfd_coff_filnmlen (abfd);
@ -843,7 +853,7 @@ coff_fix_symbol_name (abfd, symbol, native, string_size_p,
}
else
{
if (name_length <= SYMNMLEN)
if (name_length <= SYMNMLEN && !bfd_coff_force_symnames_in_strings (abfd))
{
/* This name will fit into the symbol neatly */
strncpy (native->u.syment._n._n_name, symbol->name, SYMNMLEN);
@ -858,7 +868,8 @@ coff_fix_symbol_name (abfd, symbol, native, string_size_p,
else
{
long filepos;
bfd_byte buf[2];
bfd_byte buf[4];
int prefix_len = bfd_coff_debug_string_prefix_length (abfd);
/* This name should be written into the .debug section. For
some reason each name is preceded by a two byte length
@ -868,24 +879,29 @@ coff_fix_symbol_name (abfd, symbol, native, string_size_p,
if (*debug_string_section_p == (asection *) NULL)
*debug_string_section_p = bfd_get_section_by_name (abfd, ".debug");
filepos = bfd_tell (abfd);
bfd_put_16 (abfd, name_length + 1, buf);
if (prefix_len == 4)
bfd_put_32 (abfd, name_length + 1, buf);
else
bfd_put_16 (abfd, name_length + 1, buf);
if (!bfd_set_section_contents (abfd,
*debug_string_section_p,
(PTR) buf,
(file_ptr) *debug_string_size_p,
(bfd_size_type) 2)
(bfd_size_type) prefix_len)
|| !bfd_set_section_contents (abfd,
*debug_string_section_p,
(PTR) symbol->name,
((file_ptr) *debug_string_size_p
+ 2),
+ prefix_len),
(bfd_size_type) name_length + 1))
abort ();
if (bfd_seek (abfd, filepos, SEEK_SET) != 0)
abort ();
native->u.syment._n._n_n._n_offset = *debug_string_size_p + 2;
native->u.syment._n._n_n._n_offset =
*debug_string_size_p + prefix_len;
native->u.syment._n._n_n._n_zeroes = 0;
*debug_string_size_p += name_length + 3;
*debug_string_size_p += name_length + 1 + prefix_len;
}
}
}
@ -1085,7 +1101,7 @@ coff_write_native_symbol (abfd, symbol, written, string_size_p,
while (lineno[count].line_number != 0)
{
#if 0
/* 13 april 92. sac
/* 13 april 92. sac
I've been told this, but still need proof:
> The second bug is also in `bfd/coffcode.h'. This bug
> causes the linker to screw up the pc-relocations for
@ -1241,7 +1257,7 @@ coff_write_symbols (abfd)
{
/* This is not a COFF symbol, so it certainly is not a
file name, nor does it go in the .debug section. */
maxlen = SYMNMLEN;
maxlen = bfd_coff_force_symnames_in_strings (abfd) ? 0 : SYMNMLEN;
}
else if (bfd_coff_symname_in_debug (abfd,
&c_symbol->native->u.syment))
@ -1252,9 +1268,13 @@ coff_write_symbols (abfd)
}
else if (c_symbol->native->u.syment.n_sclass == C_FILE
&& c_symbol->native->u.syment.n_numaux > 0)
maxlen = bfd_coff_filnmlen (abfd);
{
if (bfd_coff_force_symnames_in_strings (abfd))
bfd_write (".file", 1, 6, abfd);
maxlen = bfd_coff_filnmlen (abfd);
}
else
maxlen = SYMNMLEN;
maxlen = bfd_coff_force_symnames_in_strings (abfd) ? 0 : SYMNMLEN;
if (name_length > maxlen)
{
@ -1354,7 +1374,6 @@ coff_write_linenumbers (abfd)
return true;
}
/*ARGSUSED */
alent *
coff_get_lineno (ignore_abfd, symbol)
bfd *ignore_abfd ATTRIBUTE_UNUSED;
@ -1465,7 +1484,7 @@ coff_pointerize_aux (abfd, table_base, symbol, indaux, auxent)
/* Allocate space for the ".debug" section, and read it.
We did not read the debug section until now, because
we didn't want to go to the trouble until someone needed it. */
we didn't want to go to the trouble until someone needed it. */
static char *
build_debug_section (abfd)
@ -1487,7 +1506,7 @@ build_debug_section (abfd)
if (debug_section == NULL)
return NULL;
/* Seek to the beginning of the `.debug' section and read it.
/* Seek to the beginning of the `.debug' section and read it.
Save the current position first; it is needed by our caller.
Then read debug section and reset the file pointer. */
@ -1501,7 +1520,6 @@ build_debug_section (abfd)
return debug_section;
}
/* Return a pointer to a malloc'd copy of 'name'. 'name' may not be
\0-terminated, but will not exceed 'maxlen' characters. The copy *will*
be \0-terminated. */
@ -1589,7 +1607,7 @@ _bfd_coff_read_string_table (abfd)
+ obj_raw_syment_count (abfd) * bfd_coff_symesz (abfd)),
SEEK_SET) != 0)
return NULL;
if (bfd_read (extstrsize, sizeof extstrsize, 1, abfd) != sizeof extstrsize)
{
if (bfd_get_error () != bfd_error_file_truncated)
@ -1790,7 +1808,7 @@ coff_get_normalized_symtab (abfd)
{
break;
} /* if end of string */
} /* possible lengths of this string. */
} /* possible lengths of this string. */
if ((newstring = (PTR) bfd_alloc (abfd, ++i)) == NULL)
return (NULL);
@ -1888,7 +1906,6 @@ coff_bfd_make_debug_symbol (abfd, ptr, sz)
return &new->symbol;
}
/*ARGSUSED */
void
coff_get_symbol_info (abfd, symbol, ret)
bfd *abfd;
@ -2141,7 +2158,7 @@ _bfd_coff_is_local_label_name (abfd, name)
/* Provided a BFD, a section and an offset (in bytes, not octets) into the
section, calculate and return the name of the source file and the line
nearest to the wanted location. */
/*ARGSUSED*/
boolean
coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
functionname_ptr, line_ptr)
@ -2168,17 +2185,25 @@ coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset,
&found, filename_ptr,
functionname_ptr, line_ptr,
&coff_data (abfd)->line_info))
&coff_data(abfd)->line_info))
return false;
if (found)
return true;
/* Also try examining DWARF2 debugging information. */
if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
filename_ptr, functionname_ptr,
line_ptr, 0,
&coff_data(abfd)->dwarf2_find_line_info))
return true;
*filename_ptr = 0;
*functionname_ptr = 0;
*line_ptr = 0;
/* Don't try and find line numbers in a non coff file */
if (abfd->xvec->flavour != bfd_target_coff_flavour)
if (!bfd_family_coff (abfd))
return false;
if (cof == NULL)
@ -2385,7 +2410,7 @@ bfd_coff_set_symbol_class (abfd, symbol, class)
We cheat here by creating a fake native entry for it and
then filling in the class. This code is based on that in
coff_write_alien_symbol(). */
combined_entry_type * native;
native = (combined_entry_type *) bfd_alloc (abfd, sizeof (* native));
@ -2393,10 +2418,10 @@ bfd_coff_set_symbol_class (abfd, symbol, class)
return false;
memset (native, 0, sizeof (* native));
native->u.syment.n_type = T_NULL;
native->u.syment.n_sclass = class;
if (bfd_is_und_section (symbol->section))
{
native->u.syment.n_scnum = N_UNDEF;
@ -2415,19 +2440,18 @@ bfd_coff_set_symbol_class (abfd, symbol, class)
+ symbol->section->output_offset);
if (! obj_pe (abfd))
native->u.syment.n_value += symbol->section->output_section->vma;
/* Copy the any flags from the the file header into the symbol.
FIXME: Why? */
native->u.syment.n_flags = bfd_asymbol_bfd (& csym->symbol)->flags;
}
csym->native = native;
}
else
{
csym->native->u.syment.n_sclass = class;
}
return true;
}

View File

@ -40,6 +40,15 @@ static int process_embedded_commands
PARAMS ((bfd *, struct bfd_link_info *, bfd *));
static void mark_relocs PARAMS ((struct coff_final_link_info *, bfd *));
/* Return true if SYM is a weak, external symbol. */
#define IS_WEAK_EXTERNAL(abfd, sym) \
((sym).n_sclass == C_WEAKEXT \
|| (obj_pe (abfd) && (sym).n_sclass == C_NT_WEAK))
/* Return true if SYM is an external symbol. */
#define IS_EXTERNAL(abfd, sym) \
((sym).n_sclass == C_EXT || IS_WEAK_EXTERNAL (abfd, sym))
/* Define macros so that the ISFCN, et. al., macros work correctly.
These macros are defined in include/coff/internal.h in terms of
N_TMASK, etc. These definitions require a user to define local
@ -395,8 +404,7 @@ coff_link_add_symbols (abfd, info)
break;
}
if (sym.n_sclass == C_WEAKEXT
|| (obj_pe (abfd) && sym.n_sclass == C_NT_WEAK))
if (IS_WEAK_EXTERNAL (abfd, sym))
flags = BSF_WEAK;
addit = true;
@ -894,8 +902,7 @@ _bfd_coff_final_link (abfd, info)
for (p = o->link_order_head; p != NULL; p = p->next)
{
if (p->type == bfd_indirect_link_order
&& (bfd_get_flavour (p->u.indirect.section->owner)
== bfd_target_coff_flavour))
&& bfd_family_coff (p->u.indirect.section->owner))
{
sub = p->u.indirect.section->owner;
if (! bfd_coff_link_output_has_begun (sub, & finfo))
@ -921,7 +928,7 @@ _bfd_coff_final_link (abfd, info)
if (! bfd_coff_final_link_postscript (abfd, & finfo))
goto error_return;
/* Free up the buffers used by _bfd_coff_link_input_bfd. */
coff_debug_merge_hash_table_free (&finfo.debug_merge);
@ -982,7 +989,7 @@ _bfd_coff_final_link (abfd, info)
/* If doing task linking (ld --task-link) then make a pass through the
global symbols, writing out any that are defined, and making them
static. */
static. */
if (info->task_link)
{
finfo.failed = false;
@ -1095,6 +1102,8 @@ _bfd_coff_final_link (abfd, info)
if (! _bfd_stringtab_emit (abfd, finfo.strtab))
return false;
obj_coff_strings_written (abfd) = true;
}
_bfd_stringtab_free (finfo.strtab);
@ -1152,7 +1161,7 @@ dores_com (ptr, output_bfd, heap)
bfd *output_bfd;
int heap;
{
if (coff_data(output_bfd)->pe)
if (coff_data(output_bfd)->pe)
{
int val = strtoul (ptr, &ptr, 0);
if (heap)
@ -1160,7 +1169,7 @@ dores_com (ptr, output_bfd, heap)
else
pe_data(output_bfd)->pe_opthdr.SizeOfStackReserve =val;
if (ptr[0] == ',')
if (ptr[0] == ',')
{
int val = strtoul (ptr+1, &ptr, 0);
if (heap)
@ -1186,7 +1195,7 @@ char **dst;
}
/* Process any magic embedded commands in a section called .drectve */
static int
process_embedded_commands (output_bfd, info, abfd)
bfd *output_bfd;
@ -1197,19 +1206,19 @@ process_embedded_commands (output_bfd, info, abfd)
char *s;
char *e;
char *copy;
if (!sec)
if (!sec)
return 1;
copy = bfd_malloc ((size_t) sec->_raw_size);
if (!copy)
if (!copy)
return 0;
if (! bfd_get_section_contents(abfd, sec, copy, 0, sec->_raw_size))
if (! bfd_get_section_contents(abfd, sec, copy, 0, sec->_raw_size))
{
free (copy);
return 0;
}
e = copy + sec->_raw_size;
for (s = copy; s < e ; )
for (s = copy; s < e ; )
{
if (s[0]!= '-') {
s++;
@ -1230,7 +1239,7 @@ process_embedded_commands (output_bfd, info, abfd)
s = get_name(s, &name);
s = get_name(s, &attribs);
while (loop) {
switch (*attribs++)
switch (*attribs++)
{
case 'W':
had_write = 1;
@ -1264,7 +1273,7 @@ process_embedded_commands (output_bfd, info, abfd)
{
s = dores_com (s+6, output_bfd, 0);
}
else
else
s++;
}
free (copy);
@ -1274,7 +1283,7 @@ process_embedded_commands (output_bfd, info, abfd)
/* Place a marker against all symbols which are used by relocations.
This marker can be picked up by the 'do we skip this symbol ?'
loop in _bfd_coff_link_input_bfd() and used to prevent skipping
that symbol.
that symbol.
*/
static void
@ -1286,14 +1295,13 @@ mark_relocs (finfo, input_bfd)
if ((bfd_get_file_flags (input_bfd) & HAS_SYMS) == 0)
return;
for (a = input_bfd->sections; a != (asection *) NULL; a = a->next)
{
struct internal_reloc * internal_relocs;
struct internal_reloc * irel;
struct internal_reloc * irelend;
if ((a->flags & SEC_RELOC) == 0 || a->reloc_count < 1)
continue;
@ -1306,7 +1314,7 @@ mark_relocs (finfo, input_bfd)
? (finfo->section_info[ a->output_section->target_index ].relocs + a->output_section->reloc_count)
: finfo->internal_relocs)
);
if (internal_relocs == NULL)
continue;
@ -1317,7 +1325,7 @@ mark_relocs (finfo, input_bfd)
been initialised to 0) for all of the symbols that are used
in the relocation table. This will then be picked up in the
skip/don't pass */
for (; irel < irelend; irel++)
{
finfo->sym_indices[ irel->r_symndx ] = -1;
@ -1400,8 +1408,8 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
&& finfo->info->relocateable)
{
/* mark the symbol array as 'not-used' */
memset (indexp, 0, obj_raw_syment_count (input_bfd) * sizeof * indexp);
memset (indexp, 0, obj_raw_syment_count (input_bfd) * sizeof * indexp);
mark_relocs (finfo, input_bfd);
}
@ -1448,7 +1456,7 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
dont_skip_symbol = *indexp;
else
dont_skip_symbol = false;
*indexp = -1;
skip = false;
@ -1834,12 +1842,8 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
}
/* If doing task linking, convert normal global function symbols to
static functions. */
if (finfo->info->task_link
&& (isym.n_sclass == C_EXT
|| isym.n_sclass == C_WEAKEXT
|| (obj_pe (input_bfd) && isym.n_sclass == C_NT_WEAK)))
static functions. */
if (finfo->info->task_link && IS_EXTERNAL (input_bfd, isym))
isym.n_sclass = C_STAT;
/* Output the symbol. */
@ -2202,7 +2206,7 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
is.n_numaux, auxptr);
}
skipping = false;
skipping = false;
}
iline.l_addr.l_symndx = indx;
@ -2400,8 +2404,8 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
/* This reloc is against a symbol we are
stripping. This should have been handled
by the 'dont_skip_symbol' code in the while
loop at the top of this function. */
loop at the top of this function. */
is = finfo->internal_syms + irel->r_symndx;
name = (_bfd_coff_internal_syment_name
@ -2425,9 +2429,9 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
if (secdata == NULL || secdata->stab_info == NULL)
{
if (! bfd_set_section_contents (output_bfd, o->output_section,
contents,
(file_ptr)
(o->output_offset *
contents,
(file_ptr)
(o->output_offset *
bfd_octets_per_byte (output_bfd)),
(o->_cooked_size != 0
? o->_cooked_size
@ -2549,20 +2553,25 @@ _bfd_coff_write_global_sym (h, data)
/* If doing task linking and this is the pass where we convert
defined globals to statics, then do that conversion now. If the
symbol is not being converted, just ignore it and it will be
output during a later pass. */
output during a later pass. */
if (finfo->global_to_static)
{
if (isym.n_sclass != C_EXT
&& isym.n_sclass != C_WEAKEXT
&& (! obj_pe (output_bfd) || isym.n_sclass != C_NT_WEAK))
{
return true;
}
if (! IS_EXTERNAL (output_bfd, isym))
return true;
isym.n_sclass = C_STAT;
}
/* When a weak symbol is not overriden by a strong one,
turn it into an external symbol when not building a
shared or relocateable object. */
if (! finfo->info->shared
&& ! finfo->info->relocateable
&& IS_WEAK_EXTERNAL (finfo->output_bfd, isym))
isym.n_sclass = C_EXT;
isym.n_numaux = h->numaux;
bfd_coff_swap_sym_out (output_bfd, (PTR) &isym, (PTR) finfo->outsyms);
symesz = bfd_coff_symesz (output_bfd);
@ -2654,7 +2663,7 @@ _bfd_coff_write_global_sym (h, data)
/* Write out task global symbols, converting them to statics. Called
via coff_link_hash_traverse. Calls bfd_coff_write_global_sym to do
the dirty work, if the symbol we are processing needs conversion. */
the dirty work, if the symbol we are processing needs conversion. */
boolean
_bfd_coff_write_task_globals (h, data)
@ -2740,7 +2749,7 @@ _bfd_coff_reloc_link_order (output_bfd, finfo, output_section, link_order)
break;
}
ok = bfd_set_section_contents (output_bfd, output_section, (PTR) buf,
(file_ptr)
(file_ptr)
(link_order->offset *
bfd_octets_per_byte (output_bfd)), size);
free (buf);
@ -2862,7 +2871,7 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
return false;
}
else
{
{
h = obj_coff_sym_hashes (input_bfd)[symndx];
sym = syms + symndx;
}
@ -2877,7 +2886,6 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
else
addend = 0;
howto = bfd_coff_rtype_to_howto (input_bfd, input_section, rel, h,
sym, &addend);
if (howto == NULL)
@ -2929,6 +2937,9 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
+ sec->output_offset);
}
else if (h->root.type == bfd_link_hash_undefweak)
val = 0;
else if (! info->relocateable)
{
if (! ((*info->callbacks->undefined_symbol)
@ -2940,7 +2951,7 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
if (info->base_file)
{
/* Emit a reloc if the backend thinks it needs it. */
/* Emit a reloc if the backend thinks it needs it. */
if (sym && pe_data (output_bfd)->in_reloc_p (output_bfd, howto))
{
/* Relocation to a symbol in a section which isn't
@ -2949,9 +2960,9 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
reloc section. Note that the base file is not
portable between systems. We write out a long here,
and dlltool reads in a long. */
long addr = (rel->r_vaddr
- input_section->vma
+ input_section->output_offset
long addr = (rel->r_vaddr
- input_section->vma
+ input_section->output_offset
+ input_section->output_section->vma);
if (coff_data (output_bfd)->pe)
addr -= pe_data(output_bfd)->pe_opthdr.ImageBase;
@ -2963,7 +2974,7 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
}
}
}
rstat = _bfd_final_link_relocate (howto, input_bfd, input_section,
contents,
rel->r_vaddr - input_section->vma,
@ -3007,4 +3018,3 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
}
return true;
}

View File

@ -168,12 +168,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef GET_SCNHDR_NRELOC
#define GET_SCNHDR_NRELOC bfd_h_get_16
#endif
#ifndef MAX_SCNHDR_NRELOC
#define MAX_SCNHDR_NRELOC 0xffff
#endif
#ifndef PUT_SCNHDR_NRELOC
#define PUT_SCNHDR_NRELOC bfd_h_put_16
#endif
#ifndef GET_SCNHDR_NLNNO
#define GET_SCNHDR_NLNNO bfd_h_get_16
#endif
#ifndef MAX_SCNHDR_NLNNO
#define MAX_SCNHDR_NLNNO 0xffff
#endif
#ifndef PUT_SCNHDR_NLNNO
#define PUT_SCNHDR_NLNNO bfd_h_put_16
#endif
@ -184,6 +190,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define PUT_SCNHDR_FLAGS bfd_h_put_32
#endif
#ifndef GET_RELOC_VADDR
#define GET_RELOC_VADDR bfd_h_get_32
#endif
#ifndef PUT_RELOC_VADDR
#define PUT_RELOC_VADDR bfd_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));
@ -217,7 +229,7 @@ coff_swap_reloc_in (abfd, src, dst)
RELOC *reloc_src = (RELOC *) src;
struct internal_reloc *reloc_dst = (struct internal_reloc *) dst;
reloc_dst->r_vaddr = bfd_h_get_32(abfd, (bfd_byte *)reloc_src->r_vaddr);
reloc_dst->r_vaddr = GET_RELOC_VADDR (abfd, (bfd_byte *)reloc_src->r_vaddr);
reloc_dst->r_symndx = bfd_h_get_signed_32(abfd, (bfd_byte *) reloc_src->r_symndx);
#ifdef RS6000COFF_C
@ -241,7 +253,7 @@ coff_swap_reloc_out (abfd, src, dst)
{
struct internal_reloc *reloc_src = (struct internal_reloc *)src;
struct external_reloc *reloc_dst = (struct external_reloc *)dst;
bfd_h_put_32(abfd, reloc_src->r_vaddr, (bfd_byte *) reloc_dst->r_vaddr);
PUT_RELOC_VADDR (abfd, reloc_src->r_vaddr, (bfd_byte *) reloc_dst->r_vaddr);
bfd_h_put_32(abfd, reloc_src->r_symndx, (bfd_byte *) reloc_dst->r_symndx);
#ifdef RS6000COFF_C
@ -324,7 +336,6 @@ coff_swap_filehdr_out (abfd, in, out)
return bfd_coff_filhsz (abfd);
}
#ifndef NO_COFF_SYMBOLS
static void
@ -347,9 +358,9 @@ coff_swap_sym_in (abfd, ext1, in1)
memcpy(in->_n._n_name, ext->e.e_name, SYMNMLEN);
#endif
}
in->n_value = bfd_h_get_32(abfd, (bfd_byte *) ext->e_value);
in->n_value = bfd_h_get_32(abfd, (bfd_byte *) ext->e_value);
in->n_scnum = bfd_h_get_16(abfd, (bfd_byte *) ext->e_scnum);
if (sizeof(ext->e_type) == 2){
if (sizeof (ext->e_type) == 2){
in->n_type = bfd_h_get_16(abfd, (bfd_byte *) ext->e_type);
}
else {
@ -383,7 +394,7 @@ coff_swap_sym_out (abfd, inp, extp)
}
bfd_h_put_32(abfd, in->n_value , (bfd_byte *) ext->e_value);
bfd_h_put_16(abfd, in->n_scnum , (bfd_byte *) ext->e_scnum);
if (sizeof(ext->e_type) == 2)
if (sizeof (ext->e_type) == 2)
{
bfd_h_put_16(abfd, in->n_type , (bfd_byte *) ext->e_type);
}
@ -419,7 +430,7 @@ coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
case C_FILE:
if (ext->x_file.x_fname[0] == 0) {
in->x_file.x_n.x_zeroes = 0;
in->x_file.x_n.x_offset =
in->x_file.x_n.x_offset =
bfd_h_get_32(abfd, (bfd_byte *) ext->x_file.x_n.x_offset);
} else {
#if FILNMLEN != E_FILNMLEN
@ -439,28 +450,6 @@ coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
}
goto end;
/* RS/6000 "csect" auxents */
#ifdef RS6000COFF_C
case C_EXT:
case C_HIDEXT:
if (indx + 1 == numaux)
{
in->x_csect.x_scnlen.l = bfd_h_get_32 (abfd, ext->x_csect.x_scnlen);
in->x_csect.x_parmhash = bfd_h_get_32 (abfd,
ext->x_csect.x_parmhash);
in->x_csect.x_snhash = bfd_h_get_16 (abfd, ext->x_csect.x_snhash);
/* We don't have to hack bitfields in x_smtyp because it's
defined by shifts-and-ands, which are equivalent on all
byte orders. */
in->x_csect.x_smtyp = bfd_h_get_8 (abfd, ext->x_csect.x_smtyp);
in->x_csect.x_smclas = bfd_h_get_8 (abfd, ext->x_csect.x_smclas);
in->x_csect.x_stab = bfd_h_get_32 (abfd, ext->x_csect.x_stab);
in->x_csect.x_snstab = bfd_h_get_16 (abfd, ext->x_csect.x_snstab);
goto end;
}
break;
#endif
case C_STAT:
#ifdef C_LEAFSTAT
case C_LEAFSTAT:
@ -517,7 +506,7 @@ coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
end: ;
/* the semicolon is because MSVC doesn't like labels at
end of block. */
end of block. */
#ifdef COFF_ADJUST_AUX_IN_POST
COFF_ADJUST_AUX_IN_POST (abfd, ext1, type, class, indx, numaux, in1);
@ -558,27 +547,6 @@ coff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
}
goto end;
#ifdef RS6000COFF_C
/* RS/6000 "csect" auxents */
case C_EXT:
case C_HIDEXT:
if (indx + 1 == numaux)
{
PUTWORD (abfd, in->x_csect.x_scnlen.l, ext->x_csect.x_scnlen);
PUTWORD (abfd, in->x_csect.x_parmhash, ext->x_csect.x_parmhash);
PUTHALF (abfd, in->x_csect.x_snhash, ext->x_csect.x_snhash);
/* We don't have to hack bitfields in x_smtyp because it's
defined by shifts-and-ands, which are equivalent on all
byte orders. */
PUTBYTE (abfd, in->x_csect.x_smtyp, ext->x_csect.x_smtyp);
PUTBYTE (abfd, in->x_csect.x_smclas, ext->x_csect.x_smclas);
PUTWORD (abfd, in->x_csect.x_stab, ext->x_csect.x_stab);
PUTHALF (abfd, in->x_csect.x_snstab, ext->x_csect.x_snstab);
goto end;
}
break;
#endif
case C_STAT:
#ifdef C_LEAFSTAT
case C_LEAFSTAT:
@ -703,9 +671,12 @@ coff_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
bfd_h_put_32(abfd, aouthdr_int->vid[1], (bfd_byte *) aouthdr_ext->vid + 4);
#endif
#ifdef RS6000COFF_C
#ifdef XCOFF64
aouthdr_int->o_toc = bfd_h_get_64(abfd, aouthdr_ext->o_toc);
#else
aouthdr_int->o_toc = bfd_h_get_32(abfd, aouthdr_ext->o_toc);
#endif
aouthdr_int->o_snentry = bfd_h_get_16(abfd, aouthdr_ext->o_snentry);
aouthdr_int->o_sntext = bfd_h_get_16(abfd, aouthdr_ext->o_sntext);
aouthdr_int->o_sndata = bfd_h_get_16(abfd, aouthdr_ext->o_sndata);
@ -716,9 +687,14 @@ coff_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
aouthdr_int->o_algndata = bfd_h_get_16(abfd, aouthdr_ext->o_algndata);
aouthdr_int->o_modtype = bfd_h_get_16(abfd, aouthdr_ext->o_modtype);
aouthdr_int->o_cputype = bfd_h_get_16(abfd, aouthdr_ext->o_cputype);
#ifdef XCOFF64
aouthdr_int->o_maxstack = bfd_h_get_64(abfd, aouthdr_ext->o_maxstack);
aouthdr_int->o_maxdata = bfd_h_get_64(abfd, aouthdr_ext->o_maxdata);
#else
aouthdr_int->o_maxstack = bfd_h_get_32(abfd, aouthdr_ext->o_maxstack);
aouthdr_int->o_maxdata = bfd_h_get_32(abfd, aouthdr_ext->o_maxdata);
#endif
#endif
#ifdef MIPSECOFF
aouthdr_int->bss_start = bfd_h_get_32(abfd, aouthdr_ext->bss_start);
@ -763,7 +739,11 @@ coff_swap_aouthdr_out (abfd, in, out)
#endif
#ifdef RS6000COFF_C
#ifdef XCOFF64
bfd_h_put_64 (abfd, aouthdr_in->o_toc, aouthdr_out->o_toc);
#else
bfd_h_put_32 (abfd, aouthdr_in->o_toc, aouthdr_out->o_toc);
#endif
bfd_h_put_16 (abfd, aouthdr_in->o_snentry, aouthdr_out->o_snentry);
bfd_h_put_16 (abfd, aouthdr_in->o_sntext, aouthdr_out->o_sntext);
bfd_h_put_16 (abfd, aouthdr_in->o_sndata, aouthdr_out->o_sndata);
@ -774,9 +754,18 @@ coff_swap_aouthdr_out (abfd, in, out)
bfd_h_put_16 (abfd, aouthdr_in->o_algndata, aouthdr_out->o_algndata);
bfd_h_put_16 (abfd, aouthdr_in->o_modtype, aouthdr_out->o_modtype);
bfd_h_put_16 (abfd, aouthdr_in->o_cputype, aouthdr_out->o_cputype);
#ifdef XCOFF64
bfd_h_put_64 (abfd, aouthdr_in->o_maxstack, aouthdr_out->o_maxstack);
bfd_h_put_64 (abfd, aouthdr_in->o_maxdata, aouthdr_out->o_maxdata);
#else
bfd_h_put_32 (abfd, aouthdr_in->o_maxstack, aouthdr_out->o_maxstack);
bfd_h_put_32 (abfd, aouthdr_in->o_maxdata, aouthdr_out->o_maxdata);
#endif
memset (aouthdr_out->o_resv2, 0, sizeof aouthdr_out->o_resv2);
#ifdef XCOFF64
memset (aouthdr_out->o_debugger, 0, sizeof aouthdr_out->o_debugger);
memset (aouthdr_out->o_resv3, 0, sizeof aouthdr_out->o_resv3);
#endif
#endif
#ifdef MIPSECOFF
@ -814,7 +803,7 @@ coff_swap_scnhdr_in (abfd, ext, in)
#ifdef COFF_ADJUST_SCNHDR_IN_PRE
COFF_ADJUST_SCNHDR_IN_PRE (abfd, ext, in);
#endif
memcpy(scnhdr_int->s_name, scnhdr_ext->s_name, sizeof(scnhdr_int->s_name));
memcpy(scnhdr_int->s_name, scnhdr_ext->s_name, sizeof (scnhdr_int->s_name));
scnhdr_int->s_vaddr =
GET_SCNHDR_VADDR (abfd, (bfd_byte *) scnhdr_ext->s_vaddr);
scnhdr_int->s_paddr =
@ -856,12 +845,11 @@ coff_swap_scnhdr_out (abfd, in, out)
#ifdef COFF_ADJUST_SCNHDR_OUT_PRE
COFF_ADJUST_SCNHDR_OUT_PRE (abfd, in, out);
#endif
memcpy(scnhdr_ext->s_name, scnhdr_int->s_name, sizeof(scnhdr_int->s_name));
memcpy(scnhdr_ext->s_name, scnhdr_int->s_name, sizeof (scnhdr_int->s_name));
PUT_SCNHDR_VADDR (abfd, scnhdr_int->s_vaddr,
(bfd_byte *) scnhdr_ext->s_vaddr);
PUT_SCNHDR_PADDR (abfd, scnhdr_int->s_paddr,
(bfd_byte *) scnhdr_ext->s_paddr);
PUT_SCNHDR_SIZE (abfd, scnhdr_int->s_size,
@ -879,8 +867,9 @@ coff_swap_scnhdr_out (abfd, in, out)
PUTWORD(abfd, scnhdr_int->s_nlnno, (bfd_byte *) scnhdr_ext->s_nlnno);
PUTWORD(abfd, scnhdr_int->s_nreloc, (bfd_byte *) scnhdr_ext->s_nreloc);
#else
if (scnhdr_int->s_nlnno <= 0xffff)
PUTHALF(abfd, scnhdr_int->s_nlnno, (bfd_byte *) scnhdr_ext->s_nlnno);
if (scnhdr_int->s_nlnno <= MAX_SCNHDR_NLNNO)
PUT_SCNHDR_NLNNO(abfd, scnhdr_int->s_nlnno,
(bfd_byte *) scnhdr_ext->s_nlnno);
else
{
char buf[sizeof (scnhdr_int->s_name) + 1];
@ -891,10 +880,11 @@ coff_swap_scnhdr_out (abfd, in, out)
(_("%s: warning: %s: line number overflow: 0x%lx > 0xffff"),
bfd_get_filename (abfd),
buf, scnhdr_int->s_nlnno);
PUTHALF (abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nlnno);
PUT_SCNHDR_NLNNO(abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nlnno);
}
if (scnhdr_int->s_nreloc <= 0xffff)
PUTHALF(abfd, scnhdr_int->s_nreloc, (bfd_byte *) scnhdr_ext->s_nreloc);
if (scnhdr_int->s_nreloc <= MAX_SCNHDR_NRELOC)
PUT_SCNHDR_NRELOC(abfd, scnhdr_int->s_nreloc,
(bfd_byte *) scnhdr_ext->s_nreloc);
else
{
char buf[sizeof (scnhdr_int->s_name) + 1];
@ -905,7 +895,7 @@ coff_swap_scnhdr_out (abfd, in, out)
bfd_get_filename (abfd),
buf, scnhdr_int->s_nreloc);
bfd_set_error (bfd_error_file_truncated);
PUTHALF (abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nreloc);
PUT_SCNHDR_NRELOC(abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nreloc);
ret = 0;
}
#endif

View File

@ -32,10 +32,15 @@ alpha*) targ_archs=bfd_alpha_arch ;;
arm*) targ_archs=bfd_arm_arch ;;
strongarm*) targ_archs=bfd_arm_arch ;;
thumb*) targ_archs=bfd_arm_arch ;;
xscale*) targ_archs=bfd_arm_arch ;;
c30*) targ_archs=bfd_tic30_arch ;;
c54x*) targ_archs=bfd_tic54x_arch ;;
hppa*) targ_archs=bfd_hppa_arch ;;
x86_64) targ_archs=bfd_i386_arch ;;
i[3456]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 ;;
@ -79,7 +84,15 @@ case "${targ}" in
alpha*-*-*)
targ_defvec=ecoffalpha_little_vec
;;
sparc64-*-netbsd*)
ia64*-*-freebsd* | ia64*-*-linux-gnu* | ia64*-*-elf*)
targ_defvec=bfd_elf64_ia64_little_vec
targ_selvecs="bfd_elf64_ia64_big_vec bfd_efi_app_ia64_vec"
;;
ia64*-*-hpux*)
targ_defvec=bfd_elf64_ia64_big_vec
targ_selvecs="bfd_elf32_ia64_big_vec"
;;
sparc64-*-freebsd* | sparc64-*-netbsd*)
targ_defvec=bfd_elf64_sparc_vec
targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec"
;;
@ -113,7 +126,7 @@ case "${targ}" in
targ_selvecs="armpe_little_vec armpe_big_vec armpei_little_vec armpei_big_vec"
targ_underscore=yes
;;
arm-*-aout | armel-*-aout)
arm-*-aout | armel-*-aout)
targ_defvec=aout_arm_little_vec
targ_selvecs=aout_arm_big_vec
;;
@ -126,11 +139,15 @@ case "${targ}" in
targ_selvecs=armcoff_big_vec
targ_underscore=yes
;;
arm-*-rtems*)
targ_defvec=bfd_elf32_littlearm_vec
targ_selvecs=bfd_elf32_bigarm_vec
;;
armeb-*-elf | arm*b-*-linux-gnu*)
targ_defvec=bfd_elf32_bigarm_vec
targ_selvecs=bfd_elf32_littlearm_vec
;;
arm-*-elf | arm*-*-linux-gnu* | arm*-*-conix* | arm*-*-uclinux*)
arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-conix* | arm*-*-uclinux*)
targ_defvec=bfd_elf32_littlearm_vec
targ_selvecs=bfd_elf32_bigarm_vec
;;
@ -171,9 +188,18 @@ case "${targ}" in
targ_selvecs=armcoff_big_vec
targ_underscore=yes
;;
xscale-*-elf)
targ_defvec=bfd_elf32_littlearm_vec
targ_selvecs=bfd_elf32_bigarm_vec
;;
xscale-*-coff)
targ_defvec=armcoff_little_vec
targ_selvecs=armcoff_big_vec
targ_underscore=yes
;;
a29k-*-ebmon* | a29k-*-udi* | a29k-*-coff* | a29k-*-sym1* | \
a29k-*-vxworks* | a29k-*-sysv*)
a29k-*-vxworks* | a29k-*-sysv* | a29k-*rtems*)
targ_defvec=a29kcoff_big_vec
targ_selvecs=sunos_big_vec
targ_underscore=yes
@ -194,6 +220,18 @@ case "${targ}" in
targ_defvec=tic30_coff_vec
;;
c54x*-*-*coff* | tic54x-*-*coff*)
targ_defvec=tic54x_coff1_vec
targ_selvecs="tic54x_coff1_beh_vec tic54x_coff2_vec tic54x_coff2_beh_vec tic54x_coff0_vec tic54x_coff0_beh_vec"
targ_underscore=yes
;;
cris-*-*)
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.
;;
d10v-*-*)
targ_defvec=bfd_elf32_d10v_vec
;;
@ -217,27 +255,39 @@ case "${targ}" in
targ_underscore=yes
;;
#if 0 /* HPPA ELF does not work currently. */
hppa*-*-*elf* | hppa*-*-linux-gnu* | hppa*-*-lites* | hppa*-*-sysv4* | hppa*-*-rtems*)
targ_defvec=bfd_elf32_hppa_vec
#ifdef BFD64
hppa*64*-*-linux-gnu*)
targ_defvec=bfd_elf64_hppa_linux_vec
targ_selvecs=bfd_elf64_hppa_vec
;;
hppa*64*-*-hpux11*)
targ_defvec=bfd_elf64_hppa_vec
targ_selvecs=bfd_elf64_hppa_linux_vec
targ_cflags=-DHPUX_LARGE_AR_IDS
;;
#endif
hppa*-*-linux-gnu*)
targ_defvec=bfd_elf32_hppa_linux_vec
targ_selvecs=bfd_elf32_hppa_vec
;;
hppa*-*-*elf* | hppa*-*-lites* | hppa*-*-sysv4* | hppa*-*-rtems*)
targ_defvec=bfd_elf32_hppa_vec
targ_selvecs=bfd_elf32_hppa_linux_vec
;;
#if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF) || defined (HOST_HPPAMPEIX)
#if 0 /* HPPA ELF does not work currently. */
hppa*-*-bsd*)
targ_defvec=som_vec
targ_selvecs=bfd_elf32_hppa_vec
;;
#endif
hppa*-*-hpux* | hppa*-*-hiux* | hppa*-*-mpeix*)
targ_defvec=som_vec
;;
#if 0 /* HPPA ELF does not work currently. */
hppa*-*-osf*)
targ_defvec=som_vec
targ_selvecs=bfd_elf32_hppa_vec
;;
#endif
#endif /* defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF) */
i370-*-*)
@ -254,6 +304,13 @@ case "${targ}" in
targ_defvec=bfd_elf32_i386_vec
targ_selvecs=i386coff_vec
;;
i[3456]86-*-rtemself*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs="i386coff_vec i386aout_vec"
;;
i[3456]86-*-chorus*)
targ_defvec=bfd_elf32_i386_vec
;;
i[3456]86-*-msdosdjgpp* | i[3456]*-*-go32* | i[3456]86-go32-rtems* )
targ_defvec=go32coff_vec
targ_selvecs="go32stubbedcoff_vec i386aout_vec"
@ -262,14 +319,10 @@ case "${targ}" in
i[3456]86-*-aix*)
targ_defvec=i386coff_vec
;;
i[3456]86-*-rtemscoff*)
i[3456]86*-*-rtems*)
targ_defvec=i386coff_vec
targ_selvecs="bfd_elf32_i386_vec i386aout_vec"
;;
i[3456]86-*-rtemself* | i[3456]86*-*-rtems*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs="i386coff_vec i386aout_vec"
;;
i[3456]86-sequent-bsd*)
targ_defvec=i386dynix_vec
targ_underscore=yes
@ -288,9 +341,13 @@ case "${targ}" in
targ_defvec=bfd_elf32_i386_vec
targ_selvecs=i386coff_vec
;;
i[3456]86-*-netbsd* | i[3456]86-*-openbsd*)
i[3456]86-*-netbsdelf*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs=i386netbsd_vec
;;
i[3456]86-*-netbsdaout* | i[3456]86-*-netbsd* | i[3456]86-*-openbsd*)
targ_defvec=i386netbsd_vec
targ_selvecs=i386bsd_vec
targ_selvecs="bfd_elf32_i386_vec i386bsd_vec"
targ_underscore=yes
;;
i[3456]86-*-netware*)
@ -304,8 +361,18 @@ case "${targ}" in
;;
i[3456]86-*-linux-gnu*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs=i386linux_vec
targ_selvecs="i386linux_vec bfd_efi_app_ia32_vec"
;;
#ifdef BFD64
x86_64-*-freebsd*)
targ_defvec=bfd_elf64_x86_64_vec
targ_selvecs="bfd_elf32_i386_vec i386coff_vec bfd_efi_app_ia32_vec"
;;
x86_64-*-linux-gnu*)
targ_defvec=bfd_elf64_x86_64_vec
targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec"
;;
#endif
i[3456]86-*-lynxos*)
targ_defvec=i386lynx_coff_vec
targ_selvecs=i386lynx_aout_vec
@ -357,10 +424,18 @@ case "${targ}" in
targ_defvec=i386aout_vec
targ_underscore=yes
;;
i[3456]86-*-chaos)
targ_defvec=bfd_elf32_i386_vec
targ_selfvecs=i386chaos_vec
;;
i860-*-mach3* | i860-*-osf1* | i860-*-coff*)
targ_defvec=i860coff_vec
;;
i860-stardent-sysv4* | i860-stardent-elf*)
targ_defvec=bfd_elf32_i860_little_vec
targ_selvecs="bfd_elf32_i860_vec bfd_elf32_i860_little_vec"
;;
i860-*-sysv4* | i860-*-elf*)
targ_defvec=bfd_elf32_i860_vec
;;
@ -370,12 +445,7 @@ case "${targ}" in
targ_selvecs="b_out_vec_big_host icoff_little_vec icoff_big_vec ieee_vec"
targ_underscore=yes
;;
i960-*-rtemself*)
targ_defvec=bfd_elf32_i960_vec
targ_selvecs="icoff_big_vec b_out_vec_little_host b_out_vec_big_host ieee_vec"
targ_underscore=yes
;;
i960-*-vxworks5.* | i960-*-coff* | i960-*-sysv* | i960-*-rtemscoff* | i960-*-rtems*)
i960-*-vxworks5.* | i960-*-coff* | i960-*-sysv* | i960-*-rtems*)
targ_defvec=icoff_little_vec
targ_selvecs="icoff_big_vec b_out_vec_little_host b_out_vec_big_host ieee_vec"
targ_underscore=yes
@ -394,6 +464,15 @@ case "${targ}" in
targ_defvec=bfd_elf32_m32r_vec
;;
m68hc11-*-* | m6811-*-*)
targ_defvec=bfd_elf32_m68hc11_vec
targ_selvecs="bfd_elf32_m68hc11_vec bfd_elf32_m68hc12_vec"
;;
m68hc12-*-* | m6812-*-*)
targ_defvec=bfd_elf32_m68hc12_vec
targ_selvecs="bfd_elf32_m68hc11_vec bfd_elf32_m68hc12_vec"
;;
m68*-apollo-*)
targ_defvec=apollocoff_vec
;;
@ -420,16 +499,10 @@ case "${targ}" in
targ_defvec=bfd_elf32_m68k_vec
targ_selvecs="m68kcoff_vec ieee_vec"
;;
m68*-*-rtemscoff*)
# same as m68k-coff with some extra targets
m68*-*-rtems*)
targ_defvec=m68kcoff_vec
targ_selvecs="m68kcoff_vec versados_vec ieee_vec aout0_big_vec"
;;
m68*-*-rtems* | m68*-*-rtemself*)
# same as m68k-elf with some extra targets
targ_defvec=bfd_elf32_m68k_vec
targ_selvecs="m68kcoff_vec versados_vec ieee_vec aout0_big_vec"
;;
m68*-*-coff* | m68*-*-sysv*)
targ_defvec=m68kcoff_vec
targ_selvecs="m68kcoff_vec versados_vec ieee_vec"
@ -565,14 +638,14 @@ case "${targ}" in
targ_underscore=yes
;;
mips*-*-sysv4*)
targ_defvec=bfd_elf32_bigmips_vec
targ_selvecs="bfd_elf32_littlemips_vec ecoff_big_vec ecoff_little_vec"
targ_defvec=bfd_elf32_tradbigmips_vec
targ_selvecs="bfd_elf32_tradlittlemips_vec ecoff_big_vec ecoff_little_vec"
;;
mips*-*-sysv* | mips*-*-riscos*)
targ_defvec=ecoff_big_vec
targ_selvecs=ecoff_little_vec
;;
mips*el-*-elf* | mips*el-*-rtems* | mips*el-*-vxworks*)
mips*el-*-elf* | mips*el-*-rtems* | 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"
;;
@ -622,10 +695,11 @@ case "${targ}" in
powerpc-*-aix* | powerpc-*-beos*)
targ_defvec=rs6000coff_vec
targ_selvecs="rs6000coff64_vec"
;;
powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \
powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-rtems* | \
powerpc-*-vxworks*)
powerpc-*-chorus* | powerpc-*-vxworks*)
targ_defvec=bfd_elf32_powerpc_vec
targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec"
;;
@ -652,6 +726,11 @@ case "${targ}" in
targ_defvec=rs6000coff_vec
;;
sh-*-linux*)
targ_defvec=bfd_elf32_shblin_vec
targ_selvecs=bfd_elf32_shlin_vec
;;
sh-*-elf* | sh-*-rtemself*)
targ_defvec=bfd_elf32_sh_vec
targ_selvecs="bfd_elf32_shl_vec shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec"
@ -662,7 +741,7 @@ case "${targ}" in
targ_selvecs="shlpe_vec shlpei_vec"
targ_underscore=yes
;;
sh-*-* | sh-*-rtemscoff* | sh-*-rtems*)
sh-*-* | sh-*-rtems*)
targ_defvec=shcoff_vec
targ_selvecs="shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec"
targ_underscore=yes
@ -680,6 +759,9 @@ case "${targ}" in
sparclite-*-elf* | sparc86x-*-elf*)
targ_defvec=bfd_elf32_sparc_vec
;;
sparc*-*-chorus*)
targ_defvec=bfd_elf32_sparc_vec
;;
sparc-*-linux*aout*)
targ_defvec=sparclinux_vec
targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec"
@ -735,7 +817,7 @@ case "${targ}" in
sparc64-*-elf*)
targ_defvec=bfd_elf64_sparc_vec
targ_selvecs=bfd_elf32_sparc_vec
;;
;;
#endif /* BFD64 */
sparc*-*-coff*)
targ_defvec=sparccoff_vec
@ -749,7 +831,7 @@ case "${targ}" in
targ_defvec=bfd_elf32_sparc_vec
targ_selvecs="sunos_big_vec sparccoff_vec"
;;
sparc*-*-*)
sparc*-*-* | sparc*-*-rtems*)
targ_defvec=sunos_big_vec
targ_underscore=yes
;;

View File

@ -25,9 +25,6 @@
/* Define to `long' if <sys/types.h> doesn't define. */
#undef off_t
/* Define if you need to in order for stat and other things to work. */
#undef _POSIX_SOURCE
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
@ -211,21 +208,42 @@
/* 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 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

File diff suppressed because it is too large Load Diff

View File

@ -27,6 +27,8 @@ hppa*-*-mpeix*) HDEFINES=-DHOST_HPPAMPEIX ;;
hppa*-*-bsd*) HDEFINES=-DHOST_HPPABSD ;;
hppa*-*-osf*) HDEFINES=-DHOST_HPPAOSF ;;
ia64-*-linux*) host64=true; HOST_64BIT_TYPE=long ;;
i[3456]86-sequent-bsd*) HDEFINES=-Dshared=genshared ;;
i[3456]86-sequent-sysv4*) ;;
i[3456]86-sequent-sysv*) HDEFINES=-Dshared=genshared ;;
@ -46,6 +48,10 @@ mips*-*-riscos*) HDEFINES="-G 4" ;;
m68*-hp-hpux*) HDEFINES=-DHOST_HP300HPUX ;;
*-*-aix*) HOST_64BIT_TYPE="long long"
HOST_U_64BIT_TYPE="unsigned long long"
;;
*-*-solaris*) HOST_64BIT_TYPE="long long"
HOST_U_64BIT_TYPE="unsigned long long"
;;

View File

@ -7,7 +7,7 @@ AC_INIT(libbfd.c)
AC_CANONICAL_SYSTEM
AC_ISC_POSIX
AM_INIT_AUTOMAKE(bfd, 2.10.1)
AM_INIT_AUTOMAKE(bfd, 2.11)
dnl These must be called before AM_PROG_LIBTOOL, because it may want
dnl to call AC_CHECK_PROG.
@ -50,6 +50,27 @@ AC_ARG_WITH(mmap,
*) AC_MSG_ERROR(bad value ${withval} for BFD with-mmap option) ;;
esac],[want_mmap=false])dnl
build_warnings="-W -Wall"
AC_ARG_ENABLE(build-warnings,
[ --enable-build-warnings Enable build-time compiler warnings if gcc is used],
[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 -a "x$GCC" = xyes ; then
WARN_CFLAGS="${build_warnings}"
fi
AC_SUBST(WARN_CFLAGS)
AM_CONFIG_HEADER(config.h:config.in)
if test -z "$target" ; then
@ -114,13 +135,16 @@ COREFLAG=
TRAD_HEADER=
if test "${target}" = "${host}"; then
case "${host}" in
alpha*-*-freebsd*)
COREFILE=''
;;
alpha*-*-linux-gnu*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/alphalinux.h"'
;;
alpha*-*-netbsd*) COREFILE=netbsd-core.lo ;;
alpha*-*-freebsd*) ;;
alpha*-*-*) COREFILE=osf-core.lo ;;
arm-*-freebsd*) COREFILE='' ;;
arm-*-riscix) COREFILE=trad-core.lo ;;
hppa*-*-hpux*) COREFILE=hpux-core.lo ;;
hppa*-*-hiux*) COREFILE=hpux-core.lo ;;
@ -146,11 +170,17 @@ changequote([,])dnl
TRAD_HEADER='"hosts/symmetry.h"'
;;
changequote(,)dnl
i[3456]86-*-bsd* | i[3456]86-*-freebsd*)
i[3456]86-*-bsd* | i[34567]86-*-freebsd[1234] | i[34567]86-*-freebsd[1234]\.* | i[34567]86-*-freebsd*aout*)
changequote([,])dnl
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i386bsd.h"'
;;
changequote(,)dnl
i[3456]86-*-freebsd*)
changequote([,])dnl
COREFILE=''
TRAD_HEADER='"hosts/i386bsd.h"'
;;
changequote(,)dnl
i[3456]86-*-netbsd* | i[3456]86-*-openbsd*)
changequote([,])dnl
@ -266,12 +296,19 @@ changequote([,])dnl
COREFILE=netbsd-core.lo
;;
rs6000-*-lynx*) COREFILE=lynx-core.lo ;;
changequote(,)dnl
rs6000-*-aix4.[3-9]* | powerpc-*-aix4.[3-9]*)
changequote([,])dnl
COREFILE=rs6000-core.lo
COREFLAG="$COREFLAG -DAIX_CORE_DUMPX_CORE"
;;
rs6000-*-aix4*) COREFILE=rs6000-core.lo ;;
rs6000-*-*) COREFILE=rs6000-core.lo ;;
powerpc-*-*bsd*) COREFILE=netbsd-core.lo ;;
powerpc-*-aix4*) COREFILE=rs6000-core.lo ;;
powerpc-*-aix*) COREFILE=rs6000-core.lo ;;
powerpc-*-beos*) ;;
powerpc-*-freebsd*) COREFILE='' ;;
powerpc-*-netbsd*) COREFILE=netbsd-core.lo ;;
sparc-*-netbsd* | sparc-*-openbsd*)
COREFILE=netbsd-core.lo
@ -313,11 +350,18 @@ changequote([,])dnl
AC_CHECK_HEADERS(sys/procfs.h)
if test "$ac_cv_header_sys_procfs_h" = yes; then
BFD_HAVE_SYS_PROCFS_TYPE(prstatus_t)
BFD_HAVE_SYS_PROCFS_TYPE(prstatus32_t)
BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(prstatus_t, pr_who)
BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(prstatus32_t, pr_who)
BFD_HAVE_SYS_PROCFS_TYPE(pstatus_t)
BFD_HAVE_SYS_PROCFS_TYPE(pxstatus_t)
BFD_HAVE_SYS_PROCFS_TYPE(pstatus32_t)
BFD_HAVE_SYS_PROCFS_TYPE(prpsinfo_t)
BFD_HAVE_SYS_PROCFS_TYPE(prpsinfo32_t)
BFD_HAVE_SYS_PROCFS_TYPE(psinfo_t)
BFD_HAVE_SYS_PROCFS_TYPE(psinfo32_t)
BFD_HAVE_SYS_PROCFS_TYPE(lwpstatus_t)
BFD_HAVE_SYS_PROCFS_TYPE(lwpxstatus_t)
BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(lwpstatus_t, pr_context)
BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(lwpstatus_t, pr_reg)
BFD_HAVE_SYS_PROCFS_TYPE(win32_pstatus_t)
@ -325,8 +369,10 @@ changequote([,])dnl
fi
AC_SUBST(COREFILE)
AC_SUBST(COREFLAG)
AC_DEFINE_UNQUOTED(TRAD_HEADER, $TRAD_HEADER,
[Name of host specific header file to include in trad-core.c.])
if test -n "$TRAD_HEADER"; then
AC_DEFINE_UNQUOTED(TRAD_HEADER, $TRAD_HEADER,
[Name of host specific header file to include in trad-core.c.])
fi
# Horrible hacks to build DLLs on Windows.
WIN32LDFLAGS=
@ -410,7 +456,7 @@ selarchs="$f"
# Target backend .o files.
tb=
elf="elf.lo elflink.lo dwarf2.lo dwarf1.lo"
elf="elf.lo elflink.lo dwarf1.lo"
for vec in $selvecs
do
@ -438,8 +484,19 @@ do
apollocoff_vec) tb="$tb coff-apollo.lo" ;;
b_out_vec_big_host) tb="$tb bout.lo aout32.lo" ;;
b_out_vec_little_host) tb="$tb bout.lo aout32.lo" ;;
bfd_efi_app_ia32_vec) tb="$tb efi-app-ia32.lo peigen.lo cofflink.lo" ;;
bfd_efi_app_ia64_vec) tb="$tb efi-app-ia64.lo peigen.lo cofflink.lo"
target64=true ;;
bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"
target64=true ;;
bfd_elf64_hppa_vec | bfd_elf64_hppa_linux_vec)
tb="$tb elf64-hppa.lo elf64.lo $elf"
target64=true ;;
bfd_elf64_ia64_little_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"
target64=true ;;
bfd_elf64_ia64_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"
target64=true ;;
bfd_elf32_ia64_big_vec) tb="$tb elf32-ia64.lo elf32.lo $elf" ;;
bfd_elf32_avr_vec) tb="$tb elf32-avr.lo elf32.lo $elf" ;;
bfd_elf32_littlearc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;;
bfd_elf32_littlearm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;;
@ -451,19 +508,27 @@ do
bfd_elf32_bigmips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf64_bigmips_vec) tb="$tb elf64-mips.lo elf64.lo elf32-mips.lo elf32.lo $elf ecofflink.lo"
target64=true ;;
bfd_elf32_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;;
bfd_elf32_us_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;;
bfd_elf32_d10v_vec) tb="$tb elf32-d10v.lo elf32.lo $elf" ;;
bfd_elf32_d30v_vec) tb="$tb elf32-d30v.lo elf32.lo $elf" ;;
bfd_elf32_fr30_vec) tb="$tb elf32-fr30.lo elf32.lo $elf" ;;
bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_hppa_vec | bfd_elf32_hppa_linux_vec)
tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_i370_vec) tb="$tb elf32-i370.lo elf32.lo $elf" ;;
bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;;
bfd_elf64_x86_64_vec) tb="$tb elf64-x86-64.lo elf64.lo $elf"
target64=true ;;
bfd_elf32_i860_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
bfd_elf32_i860_little_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
bfd_elf32_i960_vec) tb="$tb elf32-i960.lo elf32.lo $elf" ;;
bfd_elf32_little_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
bfd_elf32_littlemips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf64_littlemips_vec) tb="$tb elf64-mips.lo elf64.lo elf32-mips.lo elf32.lo $elf ecofflink.lo"
target64=true ;;
bfd_elf32_m32r_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
bfd_elf32_m68hc11_vec) tb="$tb elf32-m68hc11.lo elf32.lo $elf" ;;
bfd_elf32_m68hc12_vec) tb="$tb elf32-m68hc12.lo elf32.lo $elf" ;;
bfd_elf32_m68k_vec) tb="$tb elf32-m68k.lo elf32.lo $elf" ;;
bfd_elf32_m88k_vec) tb="$tb elf32-m88k.lo elf32.lo $elf" ;;
bfd_elf32_mcore_big_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
@ -476,7 +541,11 @@ do
bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.lo elf32.lo $elf" ;;
bfd_elf32_sh_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
bfd_elf32_shl_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
bfd_elf32_shlin_vec) tb="$tb elf32-sh-lin.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
bfd_elf32_shblin_vec) tb="$tb elf32-sh-lin.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elf32.lo $elf" ;;
bfd_elf32_tradbigmips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_v850_vec) tb="$tb elf32-v850.lo elf32.lo $elf" ;;
bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"
target64=true ;;
@ -486,6 +555,7 @@ do
target64=true ;;
cisco_core_big_vec) tb="$tb cisco-core.lo" ;;
cisco_core_little_vec) tb="$tb cisco-core.lo" ;;
cris_aout_vec) tb="$tb aout-cris.lo" ;;
demo_64_vec) tb="$tb demo64.lo aout64.lo"
target64=true ;;
ecoff_big_vec) tb="$tb coff-mips.lo ecoff.lo ecofflink.lo" ;;
@ -528,14 +598,16 @@ do
m68kaux_coff_vec) tb="$tb coff-aux.lo coff-m68k.lo cofflink.lo" ;;
m68ksysvcoff_vec) tb="$tb coff-svm68k.lo cofflink.lo" ;;
m88kbcs_vec) tb="$tb coff-m88k.lo" ;;
mipslpe_vec) tb="$tb pe-mips.lo cofflink.lo" ;;
mipslpei_vec) tb="$tb pei-mips.lo cofflink.lo" ;;
mipslpe_vec) tb="$tb pe-mips.lo peigen.lo cofflink.lo" ;;
mipslpei_vec) tb="$tb pei-mips.lo peigen.lo cofflink.lo" ;;
mcore_pe_big_vec) tb="$tb pe-mcore.lo peigen.lo cofflink.lo" ;;
mcore_pe_little_vec) tb="$tb pe-mcore.lo peigen.lo cofflink.lo" ;;
mcore_pei_big_vec) tb="$tb pei-mcore.lo peigen.lo cofflink.lo" ;;
mcore_pei_little_vec) tb="$tb pei-mcore.lo peigen.lo cofflink.lo" ;;
newsos3_vec) tb="$tb newsos3.lo aout32.lo" ;;
nlm32_i386_vec) tb="$tb nlm32-i386.lo nlm32.lo nlm.lo" ;;
rs6000coff64_vec) tb="$tb coff64-rs6000.lo xcofflink.lo"
target64=true ;;
nlm32_sparc_vec) tb="$tb nlm32-sparc.lo nlm32.lo nlm.lo" ;;
nlm32_alpha_vec) tb="$tb nlm32-alpha.lo nlm32.lo nlm.lo"
target64=true ;;
@ -554,8 +626,8 @@ do
shlcoff_vec) tb="$tb coff-sh.lo cofflink.lo" ;;
shcoff_small_vec) tb="$tb coff-sh.lo cofflink.lo" ;;
shlcoff_small_vec) tb="$tb coff-sh.lo cofflink.lo" ;;
shlpe_vec) tb="$tb pe-sh.lo coff-sh.lo cofflink.lo" ;;
shlpei_vec) tb="$tb pei-sh.lo coff-sh.lo cofflink.lo" ;;
shlpe_vec) tb="$tb pe-sh.lo coff-sh.lo peigen.lo cofflink.lo" ;;
shlpei_vec) tb="$tb pei-sh.lo coff-sh.lo peigen.lo cofflink.lo" ;;
som_vec) tb="$tb som.lo" ;;
sparcle_aout_vec) tb="$tb aout-sparcle.lo aout32.lo" ;;
sparclinux_vec) tb="$tb sparclinux.lo aout32.lo" ;;
@ -569,6 +641,12 @@ do
tekhex_vec) tb="$tb tekhex.lo" ;;
tic30_aout_vec) tb="$tb aout-tic30.lo" ;;
tic30_coff_vec) tb="$tb coff-tic30.lo" ;;
tic54x_coff0_vec) tb="$tb coff-tic54x.lo" ;;
tic54x_coff0_beh_vec) tb="$tb coff-tic54x.lo" ;;
tic54x_coff1_vec) tb="$tb coff-tic54x.lo" ;;
tic54x_coff1_beh_vec) tb="$tb coff-tic54x.lo" ;;
tic54x_coff2_vec) tb="$tb coff-tic54x.lo" ;;
tic54x_coff2_beh_vec) tb="$tb coff-tic54x.lo" ;;
tic80coff_vec) tb="$tb coff-tic80.lo cofflink.lo" ;;
versados_vec) tb="$tb versados.lo" ;;
vms_alpha_vec) tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo"

View File

@ -30,7 +30,6 @@ DESCRIPTION
#include "sysdep.h"
#include "libbfd.h"
/*
FUNCTION
bfd_core_file_failing_command
@ -78,7 +77,6 @@ bfd_core_file_failing_signal (abfd)
return BFD_SEND (abfd, _core_file_failing_signal, (abfd));
}
/*
FUNCTION
core_file_matches_executable_p

View File

@ -40,7 +40,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define NN(index) (&arch_info_struct[index])
/* These exist only so that we can resonably disassemble PALcode. */
static const bfd_arch_info_type arch_info_struct[] =
static const bfd_arch_info_type arch_info_struct[] =
{
N (64, 64, bfd_mach_alpha_ev4, "alpha:ev4", false, NN(1)),
N (64, 64, bfd_mach_alpha_ev5, "alpha:ev5", false, NN(2)),

View File

@ -47,7 +47,7 @@ compatible (a,b)
it can be polymorphed into the other */
if (a->the_default)
return b;
if (b->the_default)
return a;
@ -93,9 +93,10 @@ processors[] =
{ bfd_mach_arm_4, "strongarm"},
{ bfd_mach_arm_4, "strongarm110" },
{ bfd_mach_arm_4, "strongarm1100" },
{ bfd_mach_arm_XScale, "xscale" }
};
static boolean
static boolean
scan (info, string)
const struct bfd_arch_info * info;
const char * string;
@ -119,16 +120,15 @@ scan (info, string)
/* Finally check for the default architecture */
if (strcasecmp (string, "arm") == 0)
return info->the_default;
return false;
}
#define N(number, print, default, next) \
{ 32, 32, 8, bfd_arch_arm, number, "arm", print, 4, default, compatible, scan, next }
static const bfd_arch_info_type arch_info_struct[] =
{
{
N( bfd_mach_arm_2, "armv2", false, & arch_info_struct[1] ),
N( bfd_mach_arm_2a, "armv2a", false, & arch_info_struct[2] ),
N( bfd_mach_arm_3, "armv3", false, & arch_info_struct[3] ),
@ -136,7 +136,9 @@ static const bfd_arch_info_type arch_info_struct[] =
N( bfd_mach_arm_4, "armv4", false, & arch_info_struct[5] ),
N( bfd_mach_arm_4T, "armv4t", false, & arch_info_struct[6] ),
N( bfd_mach_arm_5, "armv5", false, & arch_info_struct[7] ),
N( bfd_mach_arm_5T, "armv5t", false, NULL )
N( bfd_mach_arm_5T, "armv5t", false, & arch_info_struct[8] ),
N( bfd_mach_arm_5TE, "armv5te", false, & arch_info_struct[9] ),
N( bfd_mach_arm_XScale, "xscale", false, NULL )
};
const bfd_arch_info_type bfd_arm_arch =

View File

@ -32,10 +32,25 @@ const bfd_arch_info_type bfd_i386_arch_intel_syntax =
"i386:intel",
3,
true,
bfd_default_compatible,
bfd_default_compatible,
bfd_default_scan ,
0,
};
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,
"x86_64:intel",
"x86_64:intel",
3,
true,
bfd_default_compatible,
bfd_default_scan ,
&bfd_i386_arch_intel_syntax,
};
static const bfd_arch_info_type i8086_arch =
{
32, /* 32 bits in a word */
@ -47,9 +62,25 @@ static const bfd_arch_info_type i8086_arch =
"i8086",
3,
false,
bfd_default_compatible,
bfd_default_compatible,
bfd_default_scan ,
&bfd_i386_arch_intel_syntax,
&bfd_x86_64_arch_intel_syntax,
};
const bfd_arch_info_type bfd_x86_64_arch =
{
64, /* 32 bits in a word */
64, /* 32 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_i386,
bfd_mach_x86_64,
"x86_64",
"x86_64",
3,
true,
bfd_default_compatible,
bfd_default_scan ,
&i8086_arch,
};
const bfd_arch_info_type bfd_i386_arch =
@ -63,8 +94,7 @@ const bfd_arch_info_type bfd_i386_arch =
"i386",
3,
true,
bfd_default_compatible,
bfd_default_compatible,
bfd_default_scan ,
&i8086_arch,
&bfd_x86_64_arch
};

View File

@ -54,12 +54,12 @@ static const bfd_arch_info_type arch_info_struct[] =
32, /* 32 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_powerpc,
603, /* for the mpc603 */
bfd_mach_ppc_603,
"powerpc",
"powerpc:603",
3,
false, /* not the default */
powerpc_compatible,
powerpc_compatible,
bfd_default_scan,
&arch_info_struct[1]
},
@ -68,12 +68,12 @@ static const bfd_arch_info_type arch_info_struct[] =
32, /* 32 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_powerpc,
604, /* for the mpc604 */
bfd_mach_ppc_ec603e,
"powerpc",
"powerpc:604",
"powerpc:EC603e",
3,
false, /* not the default */
powerpc_compatible,
powerpc_compatible,
bfd_default_scan,
&arch_info_struct[2]
},
@ -82,12 +82,12 @@ static const bfd_arch_info_type arch_info_struct[] =
32, /* 32 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_powerpc,
403, /* for the 403 */
bfd_mach_ppc_604,
"powerpc",
"powerpc:403",
"powerpc:604",
3,
false, /* not the default */
powerpc_compatible,
powerpc_compatible,
bfd_default_scan,
&arch_info_struct[3]
},
@ -96,12 +96,124 @@ static const bfd_arch_info_type arch_info_struct[] =
32, /* 32 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_powerpc,
601, /* for the mpc601 */
bfd_mach_ppc_403,
"powerpc",
"powerpc:403",
3,
false, /* not the default */
powerpc_compatible,
bfd_default_scan,
&arch_info_struct[4]
},
{
32, /* 32 bits in a word */
32, /* 32 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_powerpc,
bfd_mach_ppc_601,
"powerpc",
"powerpc:601",
3,
false, /* not the default */
powerpc_compatible,
powerpc_compatible,
bfd_default_scan,
&arch_info_struct[5]
},
{
64, /* 64 bits in a word */
64, /* 64 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_powerpc,
bfd_mach_ppc_620,
"powerpc",
"powerpc:620",
3,
false, /* not the default */
powerpc_compatible,
bfd_default_scan,
&arch_info_struct[6]
},
{
64, /* 64 bits in a word */
64, /* 64 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_powerpc,
bfd_mach_ppc_630,
"powerpc",
"powerpc:630",
3,
false, /* not the default */
powerpc_compatible,
bfd_default_scan,
&arch_info_struct[7]
},
{
64, /* 64 bits in a word */
64, /* 64 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_powerpc,
bfd_mach_ppc_a35,
"powerpc",
"powerpc:a35",
3,
false, /* not the default */
powerpc_compatible,
bfd_default_scan,
&arch_info_struct[8]
},
{
64, /* 64 bits in a word */
64, /* 64 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_powerpc,
bfd_mach_ppc_rs64ii,
"powerpc",
"powerpc:rs64ii",
3,
false, /* not the default */
powerpc_compatible,
bfd_default_scan,
&arch_info_struct[9]
},
{
64, /* 64 bits in a word */
64, /* 64 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_powerpc,
bfd_mach_ppc_rs64iii,
"powerpc",
"powerpc:rs64iii",
3,
false, /* not the default */
powerpc_compatible,
bfd_default_scan,
&arch_info_struct[10]
},
{
32, /* 32 bits in a word */
32, /* 32 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_powerpc,
bfd_mach_ppc_7400,
"powerpc",
"powerpc:7400",
3,
false, /* not the default */
powerpc_compatible,
bfd_default_scan,
&arch_info_struct[11]
},
{
32, /* 32 bits in a word */
32, /* 32 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_powerpc,
bfd_mach_ppc_860,
"powerpc",
"powerpc:MPC8XX",
3,
false, /* not the default */
powerpc_compatible,
bfd_default_scan,
0
}
@ -113,12 +225,12 @@ const bfd_arch_info_type bfd_powerpc_arch =
32, /* 32 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_powerpc,
0, /* for the POWER/PowerPC common architecture */
bfd_mach_ppc, /* for the POWER/PowerPC common architecture */
"powerpc",
"powerpc:common",
3,
true, /* the default */
powerpc_compatible,
powerpc_compatible,
bfd_default_scan,
&arch_info_struct[0]
};

View File

@ -1,5 +1,5 @@
/* BFD support for the SPARC architecture.
Copyright (C) 1992, 94, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 1992, 94, 95, 96, 97, 2000 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@ -49,7 +49,7 @@ static const bfd_arch_info_type arch_info_struct[] =
"sparc:sparclet",
3,
false,
sparc_compatible,
sparc_compatible,
bfd_default_scan,
&arch_info_struct[1],
},
@ -63,7 +63,7 @@ static const bfd_arch_info_type arch_info_struct[] =
"sparc:sparclite",
3,
false,
sparc_compatible,
sparc_compatible,
bfd_default_scan,
&arch_info_struct[2],
},
@ -77,7 +77,7 @@ static const bfd_arch_info_type arch_info_struct[] =
"sparc:v8plus",
3,
false,
sparc_compatible,
sparc_compatible,
bfd_default_scan,
&arch_info_struct[3],
},
@ -91,7 +91,7 @@ static const bfd_arch_info_type arch_info_struct[] =
"sparc:v8plusa",
3,
false,
sparc_compatible,
sparc_compatible,
bfd_default_scan,
&arch_info_struct[4],
},
@ -105,7 +105,7 @@ static const bfd_arch_info_type arch_info_struct[] =
"sparc:sparclite_le",
3,
false,
sparc_compatible,
sparc_compatible,
bfd_default_scan,
&arch_info_struct[5],
},
@ -119,7 +119,7 @@ static const bfd_arch_info_type arch_info_struct[] =
"sparc:v9",
3,
false,
sparc_compatible,
sparc_compatible,
bfd_default_scan,
&arch_info_struct[6],
},
@ -133,7 +133,35 @@ static const bfd_arch_info_type arch_info_struct[] =
"sparc:v9a",
3,
false,
sparc_compatible,
sparc_compatible,
bfd_default_scan,
&arch_info_struct[7],
},
{
32, /* bits in a word */
32, /* bits in an address */
8, /* bits in a byte */
bfd_arch_sparc,
bfd_mach_sparc_v8plusb,
"sparc",
"sparc:v8plusb",
3,
false,
sparc_compatible,
bfd_default_scan,
&arch_info_struct[8],
},
{
64, /* bits in a word */
64, /* bits in an address */
8, /* bits in a byte */
bfd_arch_sparc,
bfd_mach_sparc_v9b,
"sparc",
"sparc:v9b",
3,
false,
sparc_compatible,
bfd_default_scan,
0,
}
@ -150,7 +178,7 @@ const bfd_arch_info_type bfd_sparc_arch =
"sparc",
3,
true, /* the default */
sparc_compatible,
sparc_compatible,
bfd_default_scan,
&arch_info_struct[0],
};

View File

@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <ctype.h>
static boolean
static boolean
scan (info, string)
const struct bfd_arch_info * info;
const char * string;
@ -41,9 +41,9 @@ scan (info, string)
architecture, eg the string m68k:68020 would match the m68k entry
up to the :, then we get left with the machine number */
for (ptr_src = string, ptr_tst = info->arch_name;
for (ptr_src = string, ptr_tst = info->arch_name;
*ptr_src && *ptr_tst;
ptr_src++, ptr_tst++)
ptr_src++, ptr_tst++)
{
if (*ptr_src != *ptr_tst) break;
}
@ -52,7 +52,7 @@ scan (info, string)
colons */
if (*ptr_src == ':')
ptr_src++;
if (*ptr_src == 0)
{
/* nothing more, then only keep this one if it is the default
@ -67,15 +67,15 @@ scan (info, string)
ptr_src++;
}
switch (number)
switch (number)
{
case bfd_mach_v850e: arch = bfd_arch_v850; break;
case bfd_mach_v850ea: arch = bfd_arch_v850; break;
default:
default:
return false;
}
if (arch != info->arch)
if (arch != info->arch)
return false;
if (number != info->mach)
@ -90,7 +90,7 @@ scan (info, string)
#define NEXT NULL
static const bfd_arch_info_type arch_info_struct[] =
static const bfd_arch_info_type arch_info_struct[] =
{
N (bfd_mach_v850e, "v850e", false, &arch_info_struct[1]),
N (bfd_mach_v850ea, "v850ea", false, NULL)

View File

@ -22,7 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "sysdep.h"
#include "libbfd.h"
#if 0 /* not used currently */
/*
Relocations for the Z8K
@ -50,7 +49,6 @@ howto16_callback (abfd, reloc_entry, symbol_in, data,
return bfd_reloc_ok;
}
static bfd_reloc_status_type
howto8_callback (abfd, reloc_entry, symbol_in, data,
ignore_input_section, ignore_bfd)
@ -73,7 +71,6 @@ howto8_callback (abfd, reloc_entry, symbol_in, data,
return bfd_reloc_ok;
}
static bfd_reloc_status_type
howto8_FFnn_callback (abfd, reloc_entry, symbol_in, data,
ignore_input_section, ignore_bfd)
@ -119,8 +116,6 @@ howto8_pcrel_callback (abfd, reloc_entry, symbol_in, data,
return bfd_reloc_ok;
}
static reloc_howto_type howto_16
= NEWHOWTO (howto16_callback, "abs16", 1, false, false);
static reloc_howto_type howto_8
@ -132,7 +127,6 @@ static reloc_howto_type howto_8_FFnn
static reloc_howto_type howto_8_pcrel
= NEWHOWTO (howto8_pcrel_callback, "pcrel8", 0, false, true);
static reloc_howto_type *
local_bfd_reloc_type_lookup (arch, code)
const struct bfd_arch_info *arch;
@ -172,7 +166,6 @@ scan_mach (info, string)
return false;
}
/* This routine is provided two arch_infos and returns whether
they'd be compatible */
@ -186,7 +179,6 @@ compatible (a, b)
return a;
}
static const bfd_arch_info_type arch_info_struct[] =
{
{32, 32, 8, bfd_arch_z8k, bfd_mach_z8001, "z8k", "z8001", 1, false, compatible, scan_mach, 0,},

View File

@ -6,6 +6,7 @@ t loop
s!\.o:!.lo:!
s! @BFD_H@!!g
s!@INCDIR@!$(INCDIR)!g
s!@SRCDIR@/../opcodes!$(srcdir)/../opcodes!g
s!@SRCDIR@/!!g
s! hosts/[^ ]*\.h! !g
s/ sysdep.h//g

View File

@ -1,3 +1,30 @@
2001-01-25 Kazu Hirata <kazu@hxi.com>
* chew.c: Do not output trailing whitespaces in type and
functionname. Update copyright.
2001-01-24 Kazu Hirata <kazu@hxi.com>
* chew.c: Do not output a trailing whitespace.
2000-11-06 Nick Clifton <nickc@redhat.com>
* bfd.texinfo: Add GNU Free Documentation License.
2000-07-09 Alan Modra <alan@linuxcare.com.au>
* Makefile.in: Regenerate.
2000-07-08 Alan Modra <alan@linuxcare.com.au>
* chew.c (outputdots): Don't add a space before `/*'.
(courierize): Likewise.
Wed May 24 12:03:25 2000 Hans-Peter Nilsson <hp@axis.com>
* bfdint.texi (BFD ELF processor required): Add paragraph about
target necessities for readelf.
2000-04-30 Ben Elliston <bje@redhat.com>
* bfdint.texi (BFD generated files): Fix another typo.
@ -6,6 +33,10 @@
* bfdint.texi (BFD_JUMP_TABLE macros): Fix typo.
Fri Apr 7 17:54:38 2000 Andrew Cagney <cagney@b1.cygnus.com>
* Makefile.in: Rebuild with current autoconf/automake.
Thu Feb 4 23:21:36 1999 Ian Lance Taylor <ian@cygnus.com>
* Makefile.in: Rebuild with current autoconf/automake.

View File

@ -75,10 +75,14 @@ CC = @CC@
CC_FOR_BUILD = @CC_FOR_BUILD@
COREFILE = @COREFILE@
COREFLAG = @COREFLAG@
CXX = @CXX@
CXXCPP = @CXXCPP@
DATADIRNAME = @DATADIRNAME@
DLLTOOL = @DLLTOOL@
EXEEXT = @EXEEXT@
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
GCJ = @GCJ@
GCJFLAGS = @GCJFLAGS@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GT_NO = @GT_NO@
@ -96,14 +100,17 @@ MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
POFILES = @POFILES@
POSUB = @POSUB@
RANLIB = @RANLIB@
STRIP = @STRIP@
TDEFINES = @TDEFINES@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
WARN_CFLAGS = @WARN_CFLAGS@
WIN32LDFLAGS = @WIN32LDFLAGS@
WIN32LIBADD = @WIN32LIBADD@
all_backends = @all_backends@
@ -187,7 +194,7 @@ DIST_COMMON = ChangeLog Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
TAR = gtar
GZIP_ENV = --best
all: all-redirect
.SUFFIXES:

View File

@ -148,7 +148,7 @@ 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)());
const bfd_target *(*callback_to_real_object_p) ());
@end example
@strong{Description}@*
Some a.out variant thinks that the file open in @var{abfd}

View File

@ -1,7 +1,7 @@
@section Architectures
BFD keeps one atom in a BFD describing the
architecture of the data attached to the BFD: a pointer to a
@code{bfd_arch_info_type}.
@code{bfd_arch_info_type}.
Pointers to structures can be requested independently of a BFD
so that an architecture's information can be interrogated
@ -11,13 +11,13 @@ The architecture information is provided by each architecture package.
The set of default architectures is selected by the macro
@code{SELECT_ARCHITECTURES}. This is normally set up in the
@file{config/@var{target}.mt} file of your choice. If the name is not
defined, then all the architectures supported are included.
defined, then all the architectures supported are included.
When BFD starts up, all the architectures are called with an
initialize method. It is up to the architecture back end to
insert as many items into the list of architectures as it wants to;
generally this would be one for each machine and one for the
default case (an item with a machine field of 0).
default case (an item with a machine field of 0).
BFD's idea of an architecture is implemented in @file{archures.c}.
@ -31,13 +31,13 @@ Another field indicates which processor within
the family is in use. The machine gives a number which
distinguishes different versions of the architecture,
containing, for example, 2 and 3 for Intel i960 KA and i960 KB,
and 68020 and 68030 for Motorola 68020 and 68030.
and 68020 and 68030 for Motorola 68020 and 68030.
@example
enum bfd_architecture
enum bfd_architecture
@{
bfd_arch_unknown, /* File arch not known */
bfd_arch_obscure, /* Arch known, not one of these */
bfd_arch_m68k, /* Motorola 68xxx */
bfd_arch_unknown, /* File arch not known */
bfd_arch_obscure, /* Arch known, not one of these */
bfd_arch_m68k, /* Motorola 68xxx */
#define bfd_mach_m68000 1
#define bfd_mach_m68008 2
#define bfd_mach_m68010 3
@ -46,14 +46,14 @@ enum bfd_architecture
#define bfd_mach_m68040 6
#define bfd_mach_m68060 7
#define bfd_mach_cpu32 8
bfd_arch_vax, /* DEC Vax */
bfd_arch_i960, /* Intel 960 */
/* The order of the following is important.
lower number indicates a machine type that
bfd_arch_vax, /* DEC Vax */
bfd_arch_i960, /* Intel 960 */
/* The order of the following is important.
lower number indicates a machine type that
only accepts a subset of the instructions
available to machines with higher numbers.
The exception is the "ca", which is
incompatible with all other machines except
incompatible with all other machines except
"core". */
#define bfd_mach_i960_core 1
@ -65,21 +65,24 @@ enum bfd_architecture
#define bfd_mach_i960_jx 7
#define bfd_mach_i960_hx 8
bfd_arch_a29k, /* AMD 29000 */
bfd_arch_sparc, /* SPARC */
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. */
/* The difference between v8plus and v9 is that v9 is a true 64 bit env. */
#define bfd_mach_sparc_sparclet 2
#define bfd_mach_sparc_sparclite 3
#define bfd_mach_sparc_v8plus 4
#define bfd_mach_sparc_v8plusa 5 /* with ultrasparc add'ns */
#define bfd_mach_sparc_v8plusa 5 /* with ultrasparc add'ns */
#define bfd_mach_sparc_sparclite_le 6
#define bfd_mach_sparc_v9 7
#define bfd_mach_sparc_v9a 8 /* with ultrasparc add'ns */
/* Nonzero if MACH has the v9 instruction set. */
#define bfd_mach_sparc_v9a 8 /* with ultrasparc add'ns */
#define bfd_mach_sparc_v8plusb 9 /* with cheetah add'ns */
#define bfd_mach_sparc_v9b 10 /* with cheetah add'ns */
/* Nonzero if MACH has the v9 instruction set. */
#define bfd_mach_sparc_v9_p(mach) \
((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9a)
bfd_arch_mips, /* MIPS Rxxxx */
((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \
&& (mach) != bfd_mach_sparc_sparclite_le)
bfd_arch_mips, /* MIPS Rxxxx */
#define bfd_mach_mips3000 3000
#define bfd_mach_mips3900 3900
#define bfd_mach_mips4000 4000
@ -95,36 +98,66 @@ enum bfd_architecture
#define bfd_mach_mips8000 8000
#define bfd_mach_mips10000 10000
#define bfd_mach_mips16 16
bfd_arch_i386, /* Intel 386 */
#define bfd_mach_mips32 32
#define bfd_mach_mips32_4k 3204113 /* 32, 04, octal 'K' */
#define bfd_mach_mips5 5
#define bfd_mach_mips64 64
#define bfd_mach_mips_sb1 12310201 /* octal 'SB', 01 */
bfd_arch_i386, /* Intel 386 */
#define bfd_mach_i386_i386 0
#define bfd_mach_i386_i8086 1
#define bfd_mach_i386_i386_intel_syntax 2
bfd_arch_we32k, /* AT&T WE32xxx */
bfd_arch_tahoe, /* CCI/Harris Tahoe */
bfd_arch_i860, /* Intel 860 */
bfd_arch_i370, /* IBM 360/370 Mainframes */
bfd_arch_romp, /* IBM ROMP PC/RT */
bfd_arch_alliant, /* Alliant */
bfd_arch_convex, /* Convex */
bfd_arch_m88k, /* Motorola 88xxx */
bfd_arch_pyramid, /* Pyramid Technology */
bfd_arch_h8300, /* Hitachi H8/300 */
#define bfd_mach_x86_64 3
#define bfd_mach_x86_64_intel_syntax 4
bfd_arch_we32k, /* AT&T WE32xxx */
bfd_arch_tahoe, /* CCI/Harris Tahoe */
bfd_arch_i860, /* Intel 860 */
bfd_arch_i370, /* IBM 360/370 Mainframes */
bfd_arch_romp, /* IBM ROMP PC/RT */
bfd_arch_alliant, /* Alliant */
bfd_arch_convex, /* Convex */
bfd_arch_m88k, /* Motorola 88xxx */
bfd_arch_pyramid, /* Pyramid Technology */
bfd_arch_h8300, /* Hitachi H8/300 */
#define bfd_mach_h8300 1
#define bfd_mach_h8300h 2
#define bfd_mach_h8300s 3
bfd_arch_powerpc, /* PowerPC */
bfd_arch_rs6000, /* IBM RS/6000 */
bfd_arch_hppa, /* HP PA RISC */
bfd_arch_d10v, /* Mitsubishi D10V */
bfd_arch_powerpc, /* PowerPC */
#define bfd_mach_ppc 0
#define bfd_mach_ppc_403 403
#define bfd_mach_ppc_403gc 4030
#define bfd_mach_ppc_505 505
#define bfd_mach_ppc_601 601
#define bfd_mach_ppc_602 602
#define bfd_mach_ppc_603 603
#define bfd_mach_ppc_ec603e 6031
#define bfd_mach_ppc_604 604
#define bfd_mach_ppc_620 620
#define bfd_mach_ppc_630 630
#define bfd_mach_ppc_750 750
#define bfd_mach_ppc_860 860
#define bfd_mach_ppc_a35 35
#define bfd_mach_ppc_rs64ii 642
#define bfd_mach_ppc_rs64iii 643
#define bfd_mach_ppc_7400 7400
bfd_arch_rs6000, /* IBM RS/6000 */
#define bfd_mach_rs6k 0
#define bfd_mach_rs6k_rs1 6001
#define bfd_mach_rs6k_rsc 6003
#define bfd_mach_rs6k_rs2 6002
bfd_arch_hppa, /* HP PA RISC */
bfd_arch_d10v, /* Mitsubishi D10V */
#define bfd_mach_d10v 0
#define bfd_mach_d10v_ts2 2
#define bfd_mach_d10v_ts3 3
bfd_arch_d30v, /* Mitsubishi D30V */
bfd_arch_z8k, /* Zilog Z8000 */
bfd_arch_d30v, /* Mitsubishi D30V */
bfd_arch_m68hc11, /* Motorola 68HC11 */
bfd_arch_m68hc12, /* Motorola 68HC12 */
bfd_arch_z8k, /* Zilog Z8000 */
#define bfd_mach_z8001 1
#define bfd_mach_z8002 2
bfd_arch_h8500, /* Hitachi H8/500 */
bfd_arch_sh, /* Hitachi SH */
bfd_arch_h8500, /* Hitachi H8/500 */
bfd_arch_sh, /* Hitachi SH */
#define bfd_mach_sh 0
#define bfd_mach_sh2 0x20
#define bfd_mach_sh_dsp 0x2d
@ -132,11 +165,11 @@ enum bfd_architecture
#define bfd_mach_sh3_dsp 0x3d
#define bfd_mach_sh3e 0x3e
#define bfd_mach_sh4 0x40
bfd_arch_alpha, /* Dec Alpha */
bfd_arch_alpha, /* Dec Alpha */
#define bfd_mach_alpha_ev4 0x10
#define bfd_mach_alpha_ev5 0x20
#define bfd_mach_alpha_ev6 0x30
bfd_arch_arm, /* Advanced Risc Machines ARM */
bfd_arch_arm, /* Advanced Risc Machines ARM */
#define bfd_mach_arm_2 1
#define bfd_mach_arm_2a 2
#define bfd_mach_arm_3 3
@ -145,32 +178,43 @@ enum bfd_architecture
#define bfd_mach_arm_4T 6
#define bfd_mach_arm_5 7
#define bfd_mach_arm_5T 8
bfd_arch_ns32k, /* National Semiconductors ns32000 */
bfd_arch_w65, /* WDC 65816 */
bfd_arch_tic30, /* Texas Instruments TMS320C30 */
bfd_arch_tic80, /* TI TMS320c80 (MVP) */
bfd_arch_v850, /* NEC V850 */
#define bfd_mach_arm_5TE 9
#define bfd_mach_arm_XScale 10
bfd_arch_ns32k, /* National Semiconductors ns32000 */
bfd_arch_w65, /* WDC 65816 */
bfd_arch_tic30, /* Texas Instruments TMS320C30 */
bfd_arch_tic54x, /* Texas Instruments TMS320C54X */
bfd_arch_tic80, /* TI TMS320c80 (MVP) */
bfd_arch_v850, /* NEC V850 */
#define bfd_mach_v850 0
#define bfd_mach_v850e 'E'
#define bfd_mach_v850ea 'A'
bfd_arch_arc, /* Argonaut RISC Core */
#define bfd_mach_arc_base 0
bfd_arch_m32r, /* Mitsubishi M32R/D */
#define bfd_mach_m32r 0 /* backwards compatibility */
bfd_arch_arc, /* ARC Cores */
#define bfd_mach_arc_5 0
#define bfd_mach_arc_6 1
#define bfd_mach_arc_7 2
#define bfd_mach_arc_8 3
bfd_arch_m32r, /* Mitsubishi M32R/D */
#define bfd_mach_m32r 0 /* backwards compatibility */
#define bfd_mach_m32rx 'x'
bfd_arch_mn10200, /* Matsushita MN10200 */
bfd_arch_mn10300, /* Matsushita MN10300 */
bfd_arch_mn10200, /* Matsushita MN10200 */
bfd_arch_mn10300, /* Matsushita MN10300 */
#define bfd_mach_mn10300 300
#define bfd_mach_am33 330
bfd_arch_fr30,
#define bfd_mach_fr30 0x46523330
bfd_arch_mcore,
bfd_arch_ia64, /* HP/Intel ia64 */
#define bfd_mach_ia64_elf64 0
#define bfd_mach_ia64_elf32 1
bfd_arch_pj,
bfd_arch_avr, /* Atmel AVR microcontrollers */
bfd_arch_avr, /* Atmel AVR microcontrollers */
#define bfd_mach_avr1 1
#define bfd_mach_avr2 2
#define bfd_mach_avr3 3
#define bfd_mach_avr4 4
#define bfd_mach_avr5 5
bfd_arch_cris, /* Axis CRIS */
bfd_arch_last
@};
@end example
@ -183,7 +227,7 @@ This structure contains information on architectures for use
within BFD.
@example
typedef struct bfd_arch_info
typedef struct bfd_arch_info
@{
int bits_per_word;
int bits_per_address;
@ -193,8 +237,8 @@ typedef struct bfd_arch_info
const char *arch_name;
const char *printable_name;
unsigned int section_align_power;
/* true if this is the default machine for the architecture */
boolean the_default;
/* True if this is the default machine for the architecture. */
boolean the_default;
const struct bfd_arch_info * (*compatible)
PARAMS ((const struct bfd_arch_info *a,
const struct bfd_arch_info *b));
@ -380,7 +424,7 @@ const char *bfd_printable_arch_mach
@end example
@strong{Description}@*
Return a printable string representing the architecture and
machine type.
machine type.
This routine is depreciated.
@ -404,6 +448,7 @@ unsigned int bfd_arch_mach_octets_per_byte(enum bfd_architecture arch,
@end example
@strong{Description}@*
See bfd_octets_per_byte.
This routine is provided for those cases where a bfd * is not
available

View File

@ -1,6 +1,6 @@
\input texinfo.tex
@setfilename bfd.info
@c $Id: bfd.texinfo,v 1.1.1.1 1999/05/03 07:28:58 rth Exp $
@c $Id: bfd.texinfo,v 1.2 2000/11/15 18:24:49 nickc Exp $
@tex
% NOTE LOCAL KLUGE TO AVOID TOO MUCH WHITESPACE
\global\long\def\example{%
@ -28,11 +28,14 @@ END-INFO-DIR-ENTRY
@ifinfo
This file documents the BFD library.
Copyright (C) 1991 Free Software Foundation, Inc.
Copyright (C) 1991, 2000 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
section entitled "GNU Free Documentation License".
@ignore
Permission is granted to process this file through Tex and print the
@ -41,14 +44,6 @@ notice identical to this one except for the removal of this paragraph
(this paragraph not being relevant to the printed manual).
@end ignore
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, subject to the terms
of the GNU General Public License, which includes the provision that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions.
@end ifinfo
@iftex
@c@finalout
@ -67,7 +62,7 @@ into another language, under the above conditions for modified versions.
@tex
\def\$#1${{#1}} % Kluge: collect RCS revision info without $...$
\xdef\manvers{\$Revision: 1.1.1.1 $} % For use in headers, footers too
\xdef\manvers{\$Revision: 1.2 $} % For use in headers, footers too
{\parskip=0pt
\hfill Cygnus Support\par
\hfill sac\@cygnus.com\par
@ -80,18 +75,13 @@ into another language, under the above conditions for modified versions.
@vskip 0pt plus 1filll
Copyright @copyright{} 1991 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
section entitled "GNU Free Documentation License".
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, subject to the terms
of the GNU General Public License, which includes the provision that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions.
@end titlepage
@end iftex
@ -104,6 +94,7 @@ This file documents the binary file descriptor library libbfd.
* Overview:: Overview of BFD
* BFD front end:: BFD front end
* BFD back ends:: BFD back ends
* GNU Free Documentation License:: GNU Free Documentation License
* Index:: Index
@end menu
@ -298,7 +289,7 @@ structures.
@node Hash Tables, , Linker Functions, BFD front end
@include hash.texi
@node BFD back ends, Index, BFD front end, Top
@node BFD back ends, GNU Free Documentation License, BFD front end, Top
@chapter BFD back ends
@menu
* What to Put Where::
@ -325,7 +316,371 @@ All of BFD lives in one directory.
@c Leave this out until the file has some actual contents...
@c @include elfcode.texi
@node Index, , BFD back ends , Top
@node GNU Free Documentation License, Index, BFD back ends, Top
@chapter GNU Free Documentation License
@cindex GNU Free Documentation License
GNU Free Documentation License
Version 1.1, March 2000
Copyright (C) 2000 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
0. PREAMBLE
The purpose of this License is to make a manual, textbook, or other
written document "free" in the sense of freedom: to assure everyone
the effective freedom to copy and redistribute it, with or without
modifying it, either commercially or noncommercially. Secondarily,
this License preserves for the author and publisher a way to get
credit for their work, while not being considered responsible for
modifications made by others.
This License is a kind of "copyleft", which means that derivative
works of the document must themselves be free in the same sense. It
complements the GNU General Public License, which is a copyleft
license designed for free software.
We have designed this License in order to use it for manuals for free
software, because free software needs free documentation: a free
program should come with manuals providing the same freedoms that the
software does. But this License is not limited to software manuals;
it can be used for any textual work, regardless of subject matter or
whether it is published as a printed book. We recommend this License
principally for works whose purpose is instruction or reference.
1. APPLICABILITY AND DEFINITIONS
This License applies to any manual or other work that contains a
notice placed by the copyright holder saying it can be distributed
under the terms of this License. The "Document", below, refers to any
such manual or work. Any member of the public is a licensee, and is
addressed as "you".
A "Modified Version" of the Document means any work containing the
Document or a portion of it, either copied verbatim, or with
modifications and/or translated into another language.
A "Secondary Section" is a named appendix or a front-matter section of
the Document that deals exclusively with the relationship of the
publishers or authors of the Document to the Document's overall subject
(or to related matters) and contains nothing that could fall directly
within that overall subject. (For example, if the Document is in part a
textbook of mathematics, a Secondary Section may not explain any
mathematics.) The relationship could be a matter of historical
connection with the subject or with related matters, or of legal,
commercial, philosophical, ethical or political position regarding
them.
The "Invariant Sections" are certain Secondary Sections whose titles
are designated, as being those of Invariant Sections, in the notice
that says that the Document is released under this License.
The "Cover Texts" are certain short passages of text that are listed,
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
the Document is released under this License.
A "Transparent" copy of the Document means a machine-readable copy,
represented in a format whose specification is available to the
general public, whose contents can be viewed and edited directly and
straightforwardly with generic text editors or (for images composed of
pixels) generic paint programs or (for drawings) some widely available
drawing editor, and that is suitable for input to text formatters or
for automatic translation to a variety of formats suitable for input
to text formatters. A copy made in an otherwise Transparent file
format whose markup has been designed to thwart or discourage
subsequent modification by readers is not Transparent. A copy that is
not "Transparent" is called "Opaque".
Examples of suitable formats for Transparent copies include plain
ASCII without markup, Texinfo input format, LaTeX input format, SGML
or XML using a publicly available DTD, and standard-conforming simple
HTML designed for human modification. Opaque formats include
PostScript, PDF, proprietary formats that can be read and edited only
by proprietary word processors, SGML or XML for which the DTD and/or
processing tools are not generally available, and the
machine-generated HTML produced by some word processors for output
purposes only.
The "Title Page" means, for a printed book, the title page itself,
plus such following pages as are needed to hold, legibly, the material
this License requires to appear in the title page. For works in
formats which do not have any title page as such, "Title Page" means
the text near the most prominent appearance of the work's title,
preceding the beginning of the body of the text.
2. VERBATIM COPYING
You may copy and distribute the Document in any medium, either
commercially or noncommercially, provided that this License, the
copyright notices, and the license notice saying this License applies
to the Document are reproduced in all copies, and that you add no other
conditions whatsoever to those of this License. You may not use
technical measures to obstruct or control the reading or further
copying of the copies you make or distribute. However, you may accept
compensation in exchange for copies. If you distribute a large enough
number of copies you must also follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and
you may publicly display copies.
3. COPYING IN QUANTITY
If you publish printed copies of the Document numbering more than 100,
and the Document's license notice requires Cover Texts, you must enclose
the copies in covers that carry, clearly and legibly, all these Cover
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
the back cover. Both covers must also clearly and legibly identify
you as the publisher of these copies. The front cover must present
the full title with all words of the title equally prominent and
visible. You may add other material on the covers in addition.
Copying with changes limited to the covers, as long as they preserve
the title of the Document and satisfy these conditions, can be treated
as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit
legibly, you should put the first ones listed (as many as fit
reasonably) on the actual cover, and continue the rest onto adjacent
pages.
If you publish or distribute Opaque copies of the Document numbering
more than 100, you must either include a machine-readable Transparent
copy along with each Opaque copy, or state in or with each Opaque copy
a publicly-accessible computer-network location containing a complete
Transparent copy of the Document, free of added material, which the
general network-using public has access to download anonymously at no
charge using public-standard network protocols. If you use the latter
option, you must take reasonably prudent steps, when you begin
distribution of Opaque copies in quantity, to ensure that this
Transparent copy will remain thus accessible at the stated location
until at least one year after the last time you distribute an Opaque
copy (directly or through your agents or retailers) of that edition to
the public.
It is requested, but not required, that you contact the authors of the
Document well before redistributing any large number of copies, to give
them a chance to provide you with an updated version of the Document.
4. MODIFICATIONS
You may copy and distribute a Modified Version of the Document under
the conditions of sections 2 and 3 above, provided that you release
the Modified Version under precisely this License, with the Modified
Version filling the role of the Document, thus licensing distribution
and modification of the Modified Version to whoever possesses a copy
of it. In addition, you must do these things in the Modified Version:
A. Use in the Title Page (and on the covers, if any) a title distinct
from that of the Document, and from those of previous versions
(which should, if there were any, be listed in the History section
of the Document). You may use the same title as a previous version
if the original publisher of that version gives permission.
B. List on the Title Page, as authors, one or more persons or entities
responsible for authorship of the modifications in the Modified
Version, together with at least five of the principal authors of the
Document (all of its principal authors, if it has less than five).
C. State on the Title page the name of the publisher of the
Modified Version, as the publisher.
D. Preserve all the copyright notices of the Document.
E. Add an appropriate copyright notice for your modifications
adjacent to the other copyright notices.
F. Include, immediately after the copyright notices, a license notice
giving the public permission to use the Modified Version under the
terms of this License, in the form shown in the Addendum below.
G. Preserve in that license notice the full lists of Invariant Sections
and required Cover Texts given in the Document's license notice.
H. Include an unaltered copy of this License.
I. Preserve the section entitled "History", and its title, and add to
it an item stating at least the title, year, new authors, and
publisher of the Modified Version as given on the Title Page. If
there is no section entitled "History" in the Document, create one
stating the title, year, authors, and publisher of the Document as
given on its Title Page, then add an item describing the Modified
Version as stated in the previous sentence.
J. Preserve the network location, if any, given in the Document for
public access to a Transparent copy of the Document, and likewise
the network locations given in the Document for previous versions
it was based on. These may be placed in the "History" section.
You may omit a network location for a work that was published at
least four years before the Document itself, or if the original
publisher of the version it refers to gives permission.
K. In any section entitled "Acknowledgements" or "Dedications",
preserve the section's title, and preserve in the section all the
substance and tone of each of the contributor acknowledgements
and/or dedications given therein.
L. Preserve all the Invariant Sections of the Document,
unaltered in their text and in their titles. Section numbers
or the equivalent are not considered part of the section titles.
M. Delete any section entitled "Endorsements". Such a section
may not be included in the Modified Version.
N. Do not retitle any existing section as "Endorsements"
or to conflict in title with any Invariant Section.
If the Modified Version includes new front-matter sections or
appendices that qualify as Secondary Sections and contain no material
copied from the Document, you may at your option designate some or all
of these sections as invariant. To do this, add their titles to the
list of Invariant Sections in the Modified Version's license notice.
These titles must be distinct from any other section titles.
You may add a section entitled "Endorsements", provided it contains
nothing but endorsements of your Modified Version by various
parties--for example, statements of peer review or that the text has
been approved by an organization as the authoritative definition of a
standard.
You may add a passage of up to five words as a Front-Cover Text, and a
passage of up to 25 words as a Back-Cover Text, to the end of the list
of Cover Texts in the Modified Version. Only one passage of
Front-Cover Text and one of Back-Cover Text may be added by (or
through arrangements made by) any one entity. If the Document already
includes a cover text for the same cover, previously added by you or
by arrangement made by the same entity you are acting on behalf of,
you may not add another; but you may replace the old one, on explicit
permission from the previous publisher that added the old one.
The author(s) and publisher(s) of the Document do not by this License
give permission to use their names for publicity for or to assert or
imply endorsement of any Modified Version.
5. COMBINING DOCUMENTS
You may combine the Document with other documents released under this
License, under the terms defined in section 4 above for modified
versions, provided that you include in the combination all of the
Invariant Sections of all of the original documents, unmodified, and
list them all as Invariant Sections of your combined work in its
license notice.
The combined work need only contain one copy of this License, and
multiple identical Invariant Sections may be replaced with a single
copy. If there are multiple Invariant Sections with the same name but
different contents, make the title of each such section unique by
adding at the end of it, in parentheses, the name of the original
author or publisher of that section if known, or else a unique number.
Make the same adjustment to the section titles in the list of
Invariant Sections in the license notice of the combined work.
In the combination, you must combine any sections entitled "History"
in the various original documents, forming one section entitled
"History"; likewise combine any sections entitled "Acknowledgements",
and any sections entitled "Dedications". You must delete all sections
entitled "Endorsements."
6. COLLECTIONS OF DOCUMENTS
You may make a collection consisting of the Document and other documents
released under this License, and replace the individual copies of this
License in the various documents with a single copy that is included in
the collection, provided that you follow the rules of this License for
verbatim copying of each of the documents in all other respects.
You may extract a single document from such a collection, and distribute
it individually under this License, provided you insert a copy of this
License into the extracted document, and follow this License in all
other respects regarding verbatim copying of that document.
7. AGGREGATION WITH INDEPENDENT WORKS
A compilation of the Document or its derivatives with other separate
and independent documents or works, in or on a volume of a storage or
distribution medium, does not as a whole count as a Modified Version
of the Document, provided no compilation copyright is claimed for the
compilation. Such a compilation is called an "aggregate", and this
License does not apply to the other self-contained works thus compiled
with the Document, on account of their being thus compiled, if they
are not themselves derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these
copies of the Document, then if the Document is less than one quarter
of the entire aggregate, the Document's Cover Texts may be placed on
covers that surround only the Document within the aggregate.
Otherwise they must appear on covers around the whole aggregate.
8. TRANSLATION
Translation is considered a kind of modification, so you may
distribute translations of the Document under the terms of section 4.
Replacing Invariant Sections with translations requires special
permission from their copyright holders, but you may include
translations of some or all Invariant Sections in addition to the
original versions of these Invariant Sections. You may include a
translation of this License provided that you also include the
original English version of this License. In case of a disagreement
between the translation and the original English version of this
License, the original English version will prevail.
9. TERMINATION
You may not copy, modify, sublicense, or distribute the Document except
as expressly provided for under this License. Any other attempt to
copy, modify, sublicense or distribute the Document is void, and will
automatically terminate your rights under this License. However,
parties who have received copies, or rights, from you under this
License will not have their licenses terminated so long as such
parties remain in full compliance.
10. FUTURE REVISIONS OF THIS LICENSE
The Free Software Foundation may publish new, revised versions
of the GNU Free Documentation License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns. See
http://www.gnu.org/copyleft/.
Each version of the License is given a distinguishing version number.
If the Document specifies that a particular numbered version of this
License "or any later version" applies to it, you have the option of
following the terms and conditions either of that specified version or
of any later version that has been published (not as a draft) by the
Free Software Foundation. If the Document does not specify a version
number of this License, you may choose any version ever published (not
as a draft) by the Free Software Foundation.
ADDENDUM: How to use this License for your documents
To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and
license notices just after the title page:
@smallexample
Copyright (c) YEAR YOUR NAME.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1
or any later version published by the Free Software Foundation;
with the Invariant Sections being LIST THEIR TITLES, with the
Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
@end smallexample
If you have no Invariant Sections, write "with no Invariant Sections"
instead of saying which ones are invariant. If you have no
Front-Cover Texts, write "no Front-Cover Texts" instead of
"Front-Cover Texts being LIST"; likewise for Back-Cover Texts.
If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of
free software license, such as the GNU General Public License,
to permit their use in free software.
@node Index, , GNU Free Documentation License , Top
@unnumbered Index
@printindex cp

View File

@ -18,8 +18,7 @@
This document describes some BFD internal information which may be
helpful when working on BFD. It is very incomplete.
This document is not updated regularly, and may be out of date. It was
last modified on $Date: 2000/04/30 15:07:52 $.
This document is not updated regularly, and may be out of date.
The initial version of this document was written by Ian Lance Taylor
@email{ian@@cygnus.com}.
@ -1607,6 +1606,10 @@ it should use the @samp{START_RELOC_NUMBERS}, @samp{RELOC_NUMBER},
macros to create a table mapping the number used to indentify a
relocation to a name describing that relocation.
While not a BFD component, you probably also want to make the binutils
program @samp{readelf} parse your ELF objects. For this, you need to add
code for @code{EM_@var{cpu}} as appropriate in @file{binutils/readelf.c}.
@node BFD ELF processor linker
@subsubsection Processor specific linker support

View File

@ -10,10 +10,10 @@ to the rest of the data.
@example
struct _bfd
struct _bfd
@{
/* The filename the application opened the BFD with. */
CONST char *filename;
CONST char *filename;
/* A pointer to the target jump table. */
const struct bfd_target *xvec;
@ -46,7 +46,7 @@ struct _bfd
/* When a file is closed by the caching routines, BFD retains
state information on the file here: */
file_ptr where;
file_ptr where;
/* and here: (``once'' means at least once) */
@ -59,7 +59,7 @@ struct _bfd
/* File modified time, if mtime_set is true: */
long mtime;
long mtime;
/* Reserved for an unimplemented file locking extension.*/
@ -78,13 +78,13 @@ struct _bfd
/* Format_specific flags*/
flagword flags;
flagword flags;
/* Currently my_archive is tested before adding origin to
anything. I believe that this can become always an add of
origin, with origin set to 0 for non archive files. */
file_ptr origin;
file_ptr origin;
/* Remember when output has begun, to stop strange things
from happening. */
@ -96,7 +96,7 @@ struct _bfd
/* The number of sections */
unsigned int section_count;
/* Stuff only useful for object files:
/* Stuff only useful for object files:
The start address. */
bfd_vma start_address;
@ -104,17 +104,17 @@ struct _bfd
unsigned int symcount;
/* Symbol table for output BFD (with symcount entries) */
struct symbol_cache_entry **outsymbols;
struct symbol_cache_entry **outsymbols;
/* Pointer to structure which contains architecture information*/
const struct bfd_arch_info *arch_info;
/* Stuff only useful for archives:*/
PTR arelt_data;
PTR arelt_data;
struct _bfd *my_archive; /* The containing archive BFD. */
struct _bfd *next; /* The next BFD in the archive. */
struct _bfd *archive_head; /* The first BFD in the archive. */
boolean has_armap;
boolean has_armap;
/* A chain of BFD structures involved in a link. */
struct _bfd *link_next;
@ -125,7 +125,7 @@ struct _bfd
/* Used by the back end to hold private data. */
union
union
@{
struct aout_data_struct *aout_data;
struct artdata *aout_ar_data;
@ -157,7 +157,7 @@ struct _bfd
struct netbsd_core_struct *netbsd_core_data;
PTR any;
@} tdata;
/* Used by the application to hold private data*/
PTR usrdata;
@ -366,6 +366,39 @@ type of file. E.g., an attempt was made to set the @code{D_PAGED} bit
on a BFD format which does not support demand paging.
@end itemize
@findex bfd_get_arch_size
@subsubsection @code{bfd_get_arch_size}
@strong{Synopsis}
@example
int bfd_get_arch_size (bfd *abfd);
@end example
@strong{Description}@*
Returns the architecture address size, in bits, as determined
by the object file's format. For ELF, this information is
included in the header.
@strong{Returns}@*
Returns the arch size in bits if known, @code{-1} otherwise.
@findex bfd_get_sign_extend_vma
@subsubsection @code{bfd_get_sign_extend_vma}
@strong{Synopsis}
@example
int bfd_get_sign_extend_vma (bfd *abfd);
@end example
@strong{Description}@*
Indicates if the target architecture "naturally" sign extends
an address. Some architectures implicitly sign extend address
values when they are converted to types larger than the size
of an address. For instance, bfd_get_start_address() will
return an address sign extended to fill a bfd_vma when this is
the case.
@strong{Returns}@*
Returns @code{1} if the target architecture is known to sign
extend addresses, @code{0} if the target architecture is known to
not sign extend addresses, and @code{-1} otherwise.
@findex bfd_set_start_address
@subsubsection @code{bfd_set_start_address}
@strong{Synopsis}
@ -407,7 +440,7 @@ it so that such results were guaranteed.
Instead, we want to ask questions like "is this NNN byte sized
object I'm about to try read from file offset YYY reasonable?"
As as example of where we might do this, some object formats
use string tables for which the first @code{sizeof(long)} bytes of the
use string tables for which the first @code{sizeof (long)} bytes of the
table contain the size of the table itself, including the size bytes.
If an application tries to read what it thinks is one of these
string tables, without some way to validate the size, and for
@ -466,7 +499,7 @@ Overflow is not detected.
boolean bfd_copy_private_bfd_data(bfd *ibfd, bfd *obfd);
@end example
@strong{Description}@*
Copy private BFD information from the BFD @var{ibfd} to the
Copy private BFD information from the BFD @var{ibfd} to the
the BFD @var{obfd}. Return @code{true} on success, @code{false} on error.
Possible error returns are:
@ -489,7 +522,7 @@ Not enough memory exists to create private data for @var{obfd}.
boolean bfd_merge_private_bfd_data(bfd *ibfd, bfd *obfd);
@end example
@strong{Description}@*
Merge private BFD information from the BFD @var{ibfd} to the
Merge private BFD information from the BFD @var{ibfd} to the
the output file BFD @var{obfd} when linking. Return @code{true}
on success, @code{false} on error. Possible error returns are:
@ -539,7 +572,7 @@ Stuff which should be documented:
#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
BFD_SEND (abfd, _bfd_find_nearest_line, (abfd, sec, syms, off, file, func, line))
/* Do these three do anything useful at all, for any back end? */
/* Do these three do anything useful at all, for any back end? */
#define bfd_debug_info_start(abfd) \
BFD_SEND (abfd, _bfd_debug_info_start, (abfd))

View File

@ -40,7 +40,7 @@ otherwise, it has to perform the complicated lookup function.
@example
#define bfd_cache_lookup(x) \
((x)==bfd_last_cache? \
(FILE*)(bfd_last_cache->iostream): \
(FILE*) (bfd_last_cache->iostream): \
bfd_cache_lookup_worker(x))
@end example

File diff suppressed because it is too large Load Diff

View File

@ -365,6 +365,8 @@ dependent COFF routines:
boolean _bfd_coff_long_filenames;
boolean _bfd_coff_long_section_names;
unsigned int _bfd_coff_default_section_alignment_power;
boolean _bfd_coff_force_symnames_in_strings;
unsigned int _bfd_coff_debug_string_prefix_length;
void (*_bfd_coff_swap_filehdr_in) PARAMS ((
bfd *abfd,
PTR ext,
@ -467,12 +469,12 @@ dependent COFF routines:
struct bfd_link_info *info,
bfd *abfd,
const char *name,
flagword flags,
flagword flags,
asection *section,
bfd_vma value,
const char *string,
boolean copy,
boolean collect,
boolean collect,
struct bfd_link_hash_entry **hashp));
boolean (*_bfd_coff_link_output_has_begun) PARAMS ((
@ -562,6 +564,12 @@ dependent COFF routines:
#define bfd_coff_symname_in_debug(abfd, sym)\
((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym))
#define bfd_coff_force_symnames_in_strings(abfd)\
(coff_backend_info (abfd)->_bfd_coff_force_symnames_in_strings)
#define bfd_coff_debug_string_prefix_length(abfd)\
(coff_backend_info (abfd)->_bfd_coff_debug_string_prefix_length)
#define bfd_coff_print_aux(abfd, file, base, symbol, aux, indaux)\
((coff_backend_info (abfd)->_bfd_coff_print_aux)\
(abfd, file, base, symbol, aux, indaux))

View File

@ -1,6 +1,6 @@
@section File formats
A format is a BFD concept of high level file contents type. The
formats supported by BFD are:
formats supported by BFD are:
@itemize @bullet
@ -43,7 +43,7 @@ matches, it is used. If not, exactly one target must recognize
the file, or an error results.
The function returns @code{true} on success, otherwise @code{false}
with one of the following error codes:
with one of the following error codes:
@itemize @bullet

View File

@ -219,7 +219,7 @@ in a linker hash table entry: @code{type}, @code{written} and
@node Write Other Derived Routines, , Write the Derived Creation Routine, Deriving a New Hash Table Type
@subsubsection Write other derived routines
You will want to write other routines for your new hash table,
as well.
as well.
You will want an initialization routine which calls the
initialization routine of the hash table you are deriving from

View File

@ -40,16 +40,16 @@ To detect calling these with less than a @code{bfd_vma}, use
@code{gcc -Wconversion} on a host with 64 bit @code{bfd_vma}'s.
@example
/* Byte swapping macros for user section data. */
/* Byte swapping macros for user section data. */
#define bfd_put_8(abfd, val, ptr) \
((void) (*((unsigned char *)(ptr)) = (unsigned char)(val)))
((void) (*((unsigned char *) (ptr)) = (unsigned char) (val)))
#define bfd_put_signed_8 \
bfd_put_8
#define bfd_get_8(abfd, ptr) \
(*(unsigned char *)(ptr))
(*(unsigned char *) (ptr))
#define bfd_get_signed_8(abfd, ptr) \
((*(unsigned char *)(ptr) ^ 0x80) - 0x80)
((*(unsigned char *) (ptr) ^ 0x80) - 0x80)
#define bfd_put_16(abfd, val, ptr) \
BFD_SEND(abfd, bfd_putx16, ((val),(ptr)))
@ -104,7 +104,7 @@ some object files keep their header records in big endian
order and their data in little endian order.
@example
/* Byte swapping macros for file header data. */
/* Byte swapping macros for file header data. */
#define bfd_h_put_8(abfd, val, ptr) \
bfd_put_8 (abfd, val, ptr)

View File

@ -30,7 +30,7 @@ ends which have implemented versions of these routines are
a.out (in @code{aoutx.h}) and ECOFF (in @code{ecoff.c}). The a.out
routines are used as examples throughout this section.
@menu
@menu
* Creating a Linker Hash Table::
* Adding Symbols to the Hash Table::
* Performing the Final Link::

View File

@ -764,6 +764,16 @@ MIPS ELF relocations.
@deffnx {} BFD_RELOC_386_GOTPC
i386/elf relocations
@end deffn
@deffn {} BFD_RELOC_X86_64_GOT32
@deffnx {} BFD_RELOC_X86_64_PLT32
@deffnx {} BFD_RELOC_X86_64_COPY
@deffnx {} BFD_RELOC_X86_64_GLOB_DAT
@deffnx {} BFD_RELOC_X86_64_JUMP_SLOT
@deffnx {} BFD_RELOC_X86_64_RELATIVE
@deffnx {} BFD_RELOC_X86_64_GOTPCREL
@deffnx {} BFD_RELOC_X86_64_32S
x86-64/elf relocations
@end deffn
@deffn {} BFD_RELOC_NS32K_IMM_8
@deffnx {} BFD_RELOC_NS32K_IMM_16
@deffnx {} BFD_RELOC_NS32K_IMM_32
@ -830,6 +840,16 @@ It generally does map to one of the other relocation types.
ARM 26 bit pc-relative branch. The lowest two bits must be zero and are
not stored in the instruction.
@end deffn
@deffn {} BFD_RELOC_ARM_PCREL_BLX
ARM 26 bit pc-relative branch. The lowest bit must be zero and is
not stored in the instruction. The 2nd lowest bit comes from a 1 bit
field in the instruction.
@end deffn
@deffn {} BFD_RELOC_THUMB_PCREL_BLX
Thumb 22 bit pc-relative branch. The lowest bit must be zero and is
not stored in the instruction. The 2nd lowest bit comes from a 1 bit
field in the instruction.
@end deffn
@deffn {} BFD_RELOC_ARM_IMMEDIATE
@deffnx {} BFD_RELOC_ARM_ADRL_IMMEDIATE
@deffnx {} BFD_RELOC_ARM_OFFSET_IMM
@ -877,6 +897,13 @@ These relocs are only used within the ARM assembler. They are not
@deffnx {} BFD_RELOC_SH_CODE
@deffnx {} BFD_RELOC_SH_DATA
@deffnx {} BFD_RELOC_SH_LABEL
@deffnx {} BFD_RELOC_SH_LOOP_START
@deffnx {} BFD_RELOC_SH_LOOP_END
@deffnx {} BFD_RELOC_SH_COPY
@deffnx {} BFD_RELOC_SH_GLOB_DAT
@deffnx {} BFD_RELOC_SH_JMP_SLOT
@deffnx {} BFD_RELOC_SH_RELATIVE
@deffnx {} BFD_RELOC_SH_GOTPC
Hitachi SH relocs. Not all of these appear in object files.
@end deffn
@deffn {} BFD_RELOC_THUMB_PCREL_BRANCH9
@ -886,7 +913,7 @@ 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
Argonaut RISC Core (ARC) relocs.
ARC Cores relocs.
ARC 22 bit pc-relative branch. The lowest two bits must be zero and are
not stored in the instruction. The high 20 bits are installed in bits 26
through 7 of the instruction.
@ -1060,6 +1087,29 @@ This is a 8bit DP reloc for the tms320c30, where the most
significant 8 bits of a 24 bit word are placed into the least
significant 8 bits of the opcode.
@end deffn
@deffn {} BFD_RELOC_TIC54X_PARTLS7
This is a 7bit reloc for the tms320c54x, where the least
significant 7 bits of a 16 bit word are placed into the least
significant 7 bits of the opcode.
@end deffn
@deffn {} BFD_RELOC_TIC54X_PARTMS9
This is a 9bit DP reloc for the tms320c54x, where the most
significant 9 bits of a 16 bit word are placed into the least
significant 9 bits of the opcode.
@end deffn
@deffn {} BFD_RELOC_TIC54X_23
This is an extended address 23-bit reloc for the tms320c54x.
@end deffn
@deffn {} BFD_RELOC_TIC54X_16_OF_23
This is a 16-bit reloc for the tms320c54x, where the least
significant 16 bits of a 23-bit extended address are placed into
the opcode.
@end deffn
@deffn {} BFD_RELOC_TIC54X_MS7_OF_23
This is a reloc for the tms320c54x, where the most
significant 7 bits of a 23-bit extended address are placed into
the opcode.
@end deffn
@deffn {} BFD_RELOC_FR30_48
This is a 48 bit reloc for the FR30 that stores 32 bits.
@end deffn
@ -1187,6 +1237,126 @@ describes the entry that is being used. For Rela hosts, this offset
is stored in the reloc's addend. For Rel hosts, we are forced to put
this offset in the reloc's section offset.
@end deffn
@deffn {} BFD_RELOC_IA64_IMM14
@deffnx {} BFD_RELOC_IA64_IMM22
@deffnx {} BFD_RELOC_IA64_IMM64
@deffnx {} BFD_RELOC_IA64_DIR32MSB
@deffnx {} BFD_RELOC_IA64_DIR32LSB
@deffnx {} BFD_RELOC_IA64_DIR64MSB
@deffnx {} BFD_RELOC_IA64_DIR64LSB
@deffnx {} BFD_RELOC_IA64_GPREL22
@deffnx {} BFD_RELOC_IA64_GPREL64I
@deffnx {} BFD_RELOC_IA64_GPREL32MSB
@deffnx {} BFD_RELOC_IA64_GPREL32LSB
@deffnx {} BFD_RELOC_IA64_GPREL64MSB
@deffnx {} BFD_RELOC_IA64_GPREL64LSB
@deffnx {} BFD_RELOC_IA64_LTOFF22
@deffnx {} BFD_RELOC_IA64_LTOFF64I
@deffnx {} BFD_RELOC_IA64_PLTOFF22
@deffnx {} BFD_RELOC_IA64_PLTOFF64I
@deffnx {} BFD_RELOC_IA64_PLTOFF64MSB
@deffnx {} BFD_RELOC_IA64_PLTOFF64LSB
@deffnx {} BFD_RELOC_IA64_FPTR64I
@deffnx {} BFD_RELOC_IA64_FPTR32MSB
@deffnx {} BFD_RELOC_IA64_FPTR32LSB
@deffnx {} BFD_RELOC_IA64_FPTR64MSB
@deffnx {} BFD_RELOC_IA64_FPTR64LSB
@deffnx {} BFD_RELOC_IA64_PCREL21B
@deffnx {} BFD_RELOC_IA64_PCREL21BI
@deffnx {} BFD_RELOC_IA64_PCREL21M
@deffnx {} BFD_RELOC_IA64_PCREL21F
@deffnx {} BFD_RELOC_IA64_PCREL22
@deffnx {} BFD_RELOC_IA64_PCREL60B
@deffnx {} BFD_RELOC_IA64_PCREL64I
@deffnx {} BFD_RELOC_IA64_PCREL32MSB
@deffnx {} BFD_RELOC_IA64_PCREL32LSB
@deffnx {} BFD_RELOC_IA64_PCREL64MSB
@deffnx {} BFD_RELOC_IA64_PCREL64LSB
@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR22
@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR64I
@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR64MSB
@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR64LSB
@deffnx {} BFD_RELOC_IA64_SEGREL32MSB
@deffnx {} BFD_RELOC_IA64_SEGREL32LSB
@deffnx {} BFD_RELOC_IA64_SEGREL64MSB
@deffnx {} BFD_RELOC_IA64_SEGREL64LSB
@deffnx {} BFD_RELOC_IA64_SECREL32MSB
@deffnx {} BFD_RELOC_IA64_SECREL32LSB
@deffnx {} BFD_RELOC_IA64_SECREL64MSB
@deffnx {} BFD_RELOC_IA64_SECREL64LSB
@deffnx {} BFD_RELOC_IA64_REL32MSB
@deffnx {} BFD_RELOC_IA64_REL32LSB
@deffnx {} BFD_RELOC_IA64_REL64MSB
@deffnx {} BFD_RELOC_IA64_REL64LSB
@deffnx {} BFD_RELOC_IA64_LTV32MSB
@deffnx {} BFD_RELOC_IA64_LTV32LSB
@deffnx {} BFD_RELOC_IA64_LTV64MSB
@deffnx {} BFD_RELOC_IA64_LTV64LSB
@deffnx {} BFD_RELOC_IA64_IPLTMSB
@deffnx {} BFD_RELOC_IA64_IPLTLSB
@deffnx {} BFD_RELOC_IA64_COPY
@deffnx {} BFD_RELOC_IA64_TPREL22
@deffnx {} BFD_RELOC_IA64_TPREL64MSB
@deffnx {} BFD_RELOC_IA64_TPREL64LSB
@deffnx {} BFD_RELOC_IA64_LTOFF_TP22
@deffnx {} BFD_RELOC_IA64_LTOFF22X
@deffnx {} BFD_RELOC_IA64_LDXMOV
Intel IA64 Relocations.
@end deffn
@deffn {} BFD_RELOC_M68HC11_HI8
Motorola 68HC11 reloc.
This is the 8 bits high part of an absolute address.
@end deffn
@deffn {} BFD_RELOC_M68HC11_LO8
Motorola 68HC11 reloc.
This is the 8 bits low part of an absolute address.
@end deffn
@deffn {} BFD_RELOC_M68HC11_3B
Motorola 68HC11 reloc.
This is the 3 bits of a value.
@end deffn
@deffn {} BFD_RELOC_CRIS_BDISP8
@deffnx {} BFD_RELOC_CRIS_UNSIGNED_5
@deffnx {} BFD_RELOC_CRIS_SIGNED_6
@deffnx {} BFD_RELOC_CRIS_UNSIGNED_6
@deffnx {} BFD_RELOC_CRIS_UNSIGNED_4
These relocs are only used within the CRIS assembler. They are not
(at present) written to any object files.
@end deffn
@deffn {} BFD_RELOC_860_COPY
@deffnx {} BFD_RELOC_860_GLOB_DAT
@deffnx {} BFD_RELOC_860_JUMP_SLOT
@deffnx {} BFD_RELOC_860_RELATIVE
@deffnx {} BFD_RELOC_860_PC26
@deffnx {} BFD_RELOC_860_PLT26
@deffnx {} BFD_RELOC_860_PC16
@deffnx {} BFD_RELOC_860_LOW0
@deffnx {} BFD_RELOC_860_SPLIT0
@deffnx {} BFD_RELOC_860_LOW1
@deffnx {} BFD_RELOC_860_SPLIT1
@deffnx {} BFD_RELOC_860_LOW2
@deffnx {} BFD_RELOC_860_SPLIT2
@deffnx {} BFD_RELOC_860_LOW3
@deffnx {} BFD_RELOC_860_LOGOT0
@deffnx {} BFD_RELOC_860_SPGOT0
@deffnx {} BFD_RELOC_860_LOGOT1
@deffnx {} BFD_RELOC_860_SPGOT1
@deffnx {} BFD_RELOC_860_LOGOTOFF0
@deffnx {} BFD_RELOC_860_SPGOTOFF0
@deffnx {} BFD_RELOC_860_LOGOTOFF1
@deffnx {} BFD_RELOC_860_SPGOTOFF1
@deffnx {} BFD_RELOC_860_LOGOTOFF2
@deffnx {} BFD_RELOC_860_LOGOTOFF3
@deffnx {} BFD_RELOC_860_LOPC
@deffnx {} BFD_RELOC_860_HIGHADJ
@deffnx {} BFD_RELOC_860_HAGOT
@deffnx {} BFD_RELOC_860_HAGOTOFF
@deffnx {} BFD_RELOC_860_HAPC
@deffnx {} BFD_RELOC_860_HIGH
@deffnx {} BFD_RELOC_860_HIGOT
@deffnx {} BFD_RELOC_860_HIGOTOFF
Intel i860 Relocations.
@end deffn
@example

View File

@ -107,10 +107,10 @@ 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. */
/* 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
@{
@ -122,340 +122,362 @@ struct bfd_comdat_info
specific code; it is not an index into the list returned by
bfd_canonicalize_symtab. */
long symbol;
/* If this section is being discarded, the linker uses this field
to point to the input section which is being kept. */
struct sec *sec;
@};
typedef struct sec
@{
/* The name of the section; the name isn't a copy, the pointer is
the same as that passed to bfd_make_section. */
/* The name of the section; the name isn't a copy, the pointer is
the same as that passed to bfd_make_section. */
CONST char *name;
const char *name;
/* Which section is it; 0..nth. */
/* A unique sequence number. */
int index;
int id;
/* The next section in the list belonging to the BFD, or NULL. */
/* Which section is it; 0..nth. */
struct sec *next;
int index;
/* The field flags contains attributes of the section. Some
flags are read in from the object file, and some are
synthesized from other information. */
/* The next section in the list belonging to the BFD, or NULL. */
flagword flags;
struct sec *next;
/* The field flags contains attributes of the section. Some
flags are read in from the object file, and some are
synthesized from other information. */
flagword flags;
#define SEC_NO_FLAGS 0x000
/* Tells the OS to allocate space for this section when loading.
This is clear for a section containing debug information
only. */
/* Tells the OS to allocate space for this section when loading.
This is clear for a section containing debug information only. */
#define SEC_ALLOC 0x001
/* Tells the OS to load the section from the file when loading.
This is clear for a .bss section. */
/* Tells the OS to load the section from the file when loading.
This is clear for a .bss section. */
#define SEC_LOAD 0x002
/* The section contains data still to be relocated, so there is
some relocation information too. */
/* The section contains data still to be relocated, so there is
some relocation information too. */
#define SEC_RELOC 0x004
#if 0 /* Obsolete ? */
#define SEC_BALIGN 0x008
#endif
/* A signal to the OS that the section contains read only
data. */
/* A signal to the OS that the section contains read only data. */
#define SEC_READONLY 0x010
/* The section contains code only. */
/* The section contains code only. */
#define SEC_CODE 0x020
/* The section contains data only. */
/* The section contains data only. */
#define SEC_DATA 0x040
/* The section will reside in ROM. */
/* The section will reside in ROM. */
#define SEC_ROM 0x080
/* The section contains constructor information. This section
type is used by the linker to create lists of constructors and
destructors used by @code{g++}. When a back end sees a symbol
which should be used in a constructor list, it creates a new
section for the type of name (e.g., @code{__CTOR_LIST__}), attaches
the symbol to it, and builds a relocation. To build the lists
of constructors, all the linker has to do is catenate all the
sections called @code{__CTOR_LIST__} and relocate the data
contained within - exactly the operations it would peform on
standard data. */
/* The section contains constructor information. This section
type is used by the linker to create lists of constructors and
destructors used by @code{g++}. When a back end sees a symbol
which should be used in a constructor list, it creates a new
section for the type of name (e.g., @code{__CTOR_LIST__}), attaches
the symbol to it, and builds a relocation. To build the lists
of constructors, all the linker has to do is catenate all the
sections called @code{__CTOR_LIST__} and relocate the data
contained within - exactly the operations it would peform on
standard data. */
#define SEC_CONSTRUCTOR 0x100
/* The section is a constructor, and should be placed at the
end of the text, data, or bss section(?). */
/* The section is a constructor, and should be placed at the
end of the text, data, or bss section(?). */
#define SEC_CONSTRUCTOR_TEXT 0x1100
#define SEC_CONSTRUCTOR_DATA 0x2100
#define SEC_CONSTRUCTOR_BSS 0x3100
/* The section has contents - a data section could be
@code{SEC_ALLOC} | @code{SEC_HAS_CONTENTS}; a debug section could be
@code{SEC_HAS_CONTENTS} */
/* The section has contents - a data section could be
@code{SEC_ALLOC} | @code{SEC_HAS_CONTENTS}; a debug section could be
@code{SEC_HAS_CONTENTS} */
#define SEC_HAS_CONTENTS 0x200
/* An instruction to the linker to not output the section
even if it has information which would normally be written. */
/* An instruction to the linker to not output the section
even if it has information which would normally be written. */
#define SEC_NEVER_LOAD 0x400
/* The section is a COFF shared library section. This flag is
only for the linker. If this type of section appears in
the input file, the linker must copy it to the output file
without changing the vma or size. FIXME: Although this
was originally intended to be general, it really is COFF
specific (and the flag was renamed to indicate this). It
might be cleaner to have some more general mechanism to
allow the back end to control what the linker does with
sections. */
/* The section is a COFF shared library section. This flag is
only for the linker. If this type of section appears in
the input file, the linker must copy it to the output file
without changing the vma or size. FIXME: Although this
was originally intended to be general, it really is COFF
specific (and the flag was renamed to indicate this). It
might be cleaner to have some more general mechanism to
allow the back end to control what the linker does with
sections. */
#define SEC_COFF_SHARED_LIBRARY 0x800
/* The section contains 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. */
/* 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. */
/* 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. */
/* 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. */
/* 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 by the
based on the address specified in the associated symbol
table. */
/* The contents of this section are to be sorted by the
based on the address specified in the associated symbol
table. */
#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. */
/* 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. */
/* 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. */
/* 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. */
/* 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. */
/* 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. */
/* 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. */
/* 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. */
/* 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. */
/* This section contains "short" data, and should be placed
"near" the GP. */
#define SEC_SMALL_DATA 0x2000000
/* This section contains data which may be shared with other
executables or shared objects. */
/* This section contains data which may be shared with other
executables or shared objects. */
#define SEC_SHARED 0x4000000
/* End of section flags. */
/* 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
/* Some internal packed boolean fields. */
/* Conditionally link this section; do not link if there are no
references found to any symbol in the section. */
#define SEC_CLINK 0x10000000
/* See the vma field. */
unsigned int user_set_vma : 1;
/* End of section flags. */
/* Whether relocations have been processed. */
unsigned int reloc_done : 1;
/* Some internal packed boolean fields. */
/* A mark flag used by some of the linker backends. */
unsigned int linker_mark : 1;
/* See the vma field. */
unsigned int user_set_vma : 1;
/* A mark flag used by some linker backends for garbage collection. */
unsigned int gc_mark : 1;
/* Whether relocations have been processed. */
unsigned int reloc_done : 1;
/* End of internal packed boolean fields. */
/* A mark flag used by some of the linker backends. */
unsigned int linker_mark : 1;
/* The virtual memory address of the section - where it will be
at run time. The symbols are relocated against this. The
user_set_vma flag is maintained by bfd; if it's not set, the
backend can assign addresses (for example, in @code{a.out}, where
the default address for @code{.data} is dependent on the specific
target and various flags). */
/* A mark flag used by some linker backends for garbage collection. */
unsigned int gc_mark : 1;
bfd_vma vma;
/* Used by the ELF code to mark sections which have been allocated to segments. */
unsigned int segment_mark : 1;
/* The load address of the section - where it would be in a
rom image; really only used for writing section header
information. */
/* End of internal packed boolean fields. */
bfd_vma lma;
/* The virtual memory address of the section - where it will be
at run time. The symbols are relocated against this. The
user_set_vma flag is maintained by bfd; if it's not set, the
backend can assign addresses (for example, in @code{a.out}, where
the default address for @code{.data} is dependent on the specific
target and various flags). */
/* 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_vma vma;
bfd_size_type _cooked_size;
/* The load address of the section - where it would be in a
rom image; really only used for writing section header
information. */
/* 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_vma lma;
bfd_size_type _raw_size;
/* 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. */
/* If this section is going to be output, then this value is the
offset in *bytes* into the output section of the first byte in the
input section (byte ==> smallest addressable unit on the
target). In most cases, if this was going to start at the
100th octet (8-bit quantity) in the output section, this value
would be 100. However, if the target byte size is 16 bits
(bfd_octets_per_byte is "2"), this value would be 50. */
bfd_size_type _cooked_size;
bfd_vma output_offset;
/* 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. */
/* The output section through which to map on output. */
bfd_size_type _raw_size;
struct sec *output_section;
/* If this section is going to be output, then this value is the
offset in *bytes* into the output section of the first byte in the
input section (byte ==> smallest addressable unit on the
target). In most cases, if this was going to start at the
100th octet (8-bit quantity) in the output section, this value
would be 100. However, if the target byte size is 16 bits
(bfd_octets_per_byte is "2"), this value would be 50. */
/* The alignment requirement of the section, as an exponent of 2 -
e.g., 3 aligns to 2^3 (or 8). */
bfd_vma output_offset;
unsigned int alignment_power;
/* The output section through which to map on output. */
/* If an input section, a pointer to a vector of relocation
records for the data in this section. */
struct sec *output_section;
struct reloc_cache_entry *relocation;
/* The alignment requirement of the section, as an exponent of 2 -
e.g., 3 aligns to 2^3 (or 8). */
/* If an output section, a pointer to a vector of pointers to
relocation records for the data in this section. */
unsigned int alignment_power;
struct reloc_cache_entry **orelocation;
/* If an input section, a pointer to a vector of relocation
records for the data in this section. */
/* The number of relocation records in one of the above */
struct reloc_cache_entry *relocation;
unsigned reloc_count;
/* If an output section, a pointer to a vector of pointers to
relocation records for the data in this section. */
/* Information below is back end specific - and not always used
or updated. */
struct reloc_cache_entry **orelocation;
/* File position of section data */
/* The number of relocation records in one of the above */
file_ptr filepos;
unsigned reloc_count;
/* File position of relocation info */
/* Information below is back end specific - and not always used
or updated. */
file_ptr rel_filepos;
/* File position of section data. */
/* File position of line data */
file_ptr filepos;
file_ptr line_filepos;
/* File position of relocation info. */
/* Pointer to data for applications */
file_ptr rel_filepos;
PTR userdata;
/* File position of line data. */
/* If the SEC_IN_MEMORY flag is set, this points to the actual
contents. */
unsigned char *contents;
file_ptr line_filepos;
/* Attached line number information */
/* Pointer to data for applications. */
alent *lineno;
PTR userdata;
/* Number of line number records */
/* If the SEC_IN_MEMORY flag is set, this points to the actual
contents. */
unsigned char *contents;
unsigned int lineno_count;
/* Attached line number information. */
/* Optional information about a COMDAT entry; NULL if not COMDAT */
alent *lineno;
struct bfd_comdat_info *comdat;
/* Number of line number records. */
/* When a section is being output, this value changes as more
linenumbers are written out */
unsigned int lineno_count;
file_ptr moving_line_filepos;
/* Optional information about a COMDAT entry; NULL if not COMDAT. */
/* What the section number is in the target world */
struct bfd_comdat_info *comdat;
int target_index;
/* Points to the kept section if this section is a link-once section,
and is discarded. */
struct sec *kept_section;
PTR used_by_bfd;
/* When a section is being output, this value changes as more
linenumbers are written out. */
/* If this is a constructor section then here is a list of the
relocations created to relocate items within it. */
file_ptr moving_line_filepos;
struct relent_chain *constructor_chain;
/* What the section number is in the target world. */
/* The BFD which owns the section. */
int target_index;
bfd *owner;
PTR used_by_bfd;
/* A symbol which points at this section only */
struct symbol_cache_entry *symbol;
struct symbol_cache_entry **symbol_ptr_ptr;
/* If this is a constructor section then here is a list of the
relocations created to relocate items within it. */
struct bfd_link_order *link_order_head;
struct bfd_link_order *link_order_tail;
struct relent_chain *constructor_chain;
/* The BFD which owns the section. */
bfd *owner;
/* A symbol which points at this section only */
struct symbol_cache_entry *symbol;
struct symbol_cache_entry **symbol_ptr_ptr;
struct bfd_link_order *link_order_head;
struct bfd_link_order *link_order_tail;
@} asection ;
/* These sections are global, and are managed by BFD. The application
and target back end are not permitted to change the values in
these sections. New code should use the section_ptr macros rather
than referring directly to the const sections. The const sections
may eventually vanish. */
/* These sections are global, and are managed by BFD. The application
and target back end are not permitted to change the values in
these sections. New code should use the section_ptr macros rather
than referring directly to the const sections. The const sections
may eventually vanish. */
#define BFD_ABS_SECTION_NAME "*ABS*"
#define BFD_UND_SECTION_NAME "*UND*"
#define BFD_COM_SECTION_NAME "*COM*"
#define BFD_IND_SECTION_NAME "*IND*"
/* the absolute section */
/* the absolute section */
extern const asection bfd_abs_section;
#define bfd_abs_section_ptr ((asection *) &bfd_abs_section)
#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
/* Pointer to the undefined section */
/* Pointer to the undefined section */
extern const asection bfd_und_section;
#define bfd_und_section_ptr ((asection *) &bfd_und_section)
#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
/* Pointer to the common section */
/* Pointer to the common section */
extern const asection bfd_com_section;
#define bfd_com_section_ptr ((asection *) &bfd_com_section)
/* Pointer to the indirect section */
/* Pointer to the indirect section */
extern const asection bfd_ind_section;
#define bfd_ind_section_ptr ((asection *) &bfd_ind_section)
#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr)
@ -480,7 +502,7 @@ These are the functions exported by the section handling part of BFD.
@subsubsection @code{bfd_get_section_by_name}
@strong{Synopsis}
@example
asection *bfd_get_section_by_name(bfd *abfd, CONST char *name);
asection *bfd_get_section_by_name(bfd *abfd, const char *name);
@end example
@strong{Description}@*
Run through @var{abfd} and return the one of the
@ -492,11 +514,26 @@ all sections of a given name is to use @code{bfd_map_over_sections} and
@code{strcmp} on the name (or better yet, base it on the section flags
or something else) for each section.
@findex bfd_get_unique_section_name
@subsubsection @code{bfd_get_unique_section_name}
@strong{Synopsis}
@example
char *bfd_get_unique_section_name(bfd *abfd,
const char *templat,
int *count);
@end example
@strong{Description}@*
Invent a section name that is unique in @var{abfd} by tacking
a dot and a digit suffix onto the original @var{templat}. If
@var{count} is non-NULL, then it specifies the first number
tried as a suffix to generate a unique name. The value
pointed to by @var{count} will be incremented in this case.
@findex bfd_make_section_old_way
@subsubsection @code{bfd_make_section_old_way}
@strong{Synopsis}
@example
asection *bfd_make_section_old_way(bfd *abfd, CONST char *name);
asection *bfd_make_section_old_way(bfd *abfd, const char *name);
@end example
@strong{Description}@*
Create a new empty section called @var{name}
@ -523,7 +560,7 @@ If memory allocation fails.
@subsubsection @code{bfd_make_section_anyway}
@strong{Synopsis}
@example
asection *bfd_make_section_anyway(bfd *abfd, CONST char *name);
asection *bfd_make_section_anyway(bfd *abfd, const char *name);
@end example
@strong{Description}@*
Create a new empty section called @var{name} and attach it to the end of
@ -543,7 +580,7 @@ Return @code{NULL} and set @code{bfd_error} on error; possible errors are:
@subsubsection @code{bfd_make_section}
@strong{Synopsis}
@example
asection *bfd_make_section(bfd *, CONST char *name);
asection *bfd_make_section(bfd *, const char *name);
@end example
@strong{Description}@*
Like @code{bfd_make_section_anyway}, but return @code{NULL} (without calling
@ -576,7 +613,7 @@ have the @code{SEC_HAS_CONTENTS} field set.
@strong{Synopsis}
@example
void bfd_map_over_sections(bfd *abfd,
void (*func)(bfd *abfd,
void (*func) (bfd *abfd,
asection *sect,
PTR obj),
PTR obj);

View File

@ -376,8 +376,8 @@ class of @var{symbol}, or '?' for an unknown class.
@example
int bfd_decode_symclass(asymbol *symbol);
@end example
@findex bfd_is_undefined_symclass
@subsubsection @code{bfd_is_undefined_symclass }
@findex bfd_is_undefined_symclass
@subsubsection @code{bfd_is_undefined_symclass}
@strong{Description}@*
Returns non-zero if the class symbol returned by
bfd_decode_symclass represents an undefined symbol.

View File

@ -7,7 +7,7 @@ of a target back end. All the back end provides to the root
part of BFD is a structure containing pointers to functions
which perform certain low level operations on files. BFD
translates the applications's requests through a pointer into
calls to the back end routines.
calls to the back end routines.
When a file is opened with @code{bfd_openr}, its format and
target are unknown. BFD uses various mechanisms to determine
@ -18,12 +18,12 @@ how to interpret the file. The operations performed are:
@item
Create a BFD by calling the internal routine
@code{_bfd_new_bfd}, then call @code{bfd_find_target} with the
target string supplied to @code{bfd_openr} and the new BFD pointer.
target string supplied to @code{bfd_openr} and the new BFD pointer.
@item
If a null target string was provided to @code{bfd_find_target},
look up the environment variable @code{GNUTARGET} and use
that as the target string.
that as the target string.
@item
If the target string is still @code{NULL}, or the target string is
@ -35,7 +35,7 @@ cause @code{bfd_check_format} to loop through all the targets.
@item
Otherwise, inspect the elements in the target vector
one by one, until a match on target name is found. When found,
use it.
use it.
@item
Otherwise return the error @code{bfd_error_invalid_target} to
@ -47,7 +47,7 @@ Otherwise return the error @code{bfd_error_invalid_target} to
@end itemize
Once the BFD has been opened and the target selected, the file
format may be determined. This is done by calling
@code{bfd_check_format} on the BFD with a suggested format.
@code{bfd_check_format} on the BFD with a suggested format.
If @code{target_defaulted} has been set, each possible target
type is tried to see if it recognizes the specified format.
@code{bfd_check_format} returns @code{true} when the caller guesses right.
@ -63,17 +63,17 @@ type is tried to see if it recognizes the specified format.
@strong{Description}@*
This structure contains everything that BFD knows about a
target. It includes things like its byte order, name, and which
routines to call to do various operations.
routines to call to do various operations.
Every BFD points to a target structure with its @code{xvec}
member.
member.
The macros below are used to dispatch to functions through the
@code{bfd_target} vector. They are used in a number of macros further
down in @file{bfd.h}, and are also used when calling various
routines by hand inside the BFD implementation. The @var{arglist}
argument must be parenthesized; it contains all the arguments
to the called function.
to the called function.
They make the documentation (more) unpleasant to read, so if
someone wants to fix this and not break the above, please do.
@ -92,13 +92,13 @@ someone wants to fix this and not break the above, please do.
For operations which index on the BFD format:
@example
#define BFD_SEND_FMT(bfd, message, arglist) \
(((bfd)->xvec->message[(int)((bfd)->format)]) arglist)
(((bfd)->xvec->message[(int) ((bfd)->format)]) arglist)
#ifdef DEBUG_BFD_SEND
#undef BFD_SEND_FMT
#define BFD_SEND_FMT(bfd, message, arglist) \
(((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
(((bfd)->xvec->message[(int)((bfd)->format)]) arglist) : \
(((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) : \
(bfd_assert (__FILE__,__LINE__), NULL))
#endif
@end example
@ -109,13 +109,14 @@ defines one of these.
FIXME, these names should be rationalised with the names of
the entry points which call them. Too bad we can't have one
macro to define them both!
macro to define them both!
@example
enum bfd_flavour @{
bfd_target_unknown_flavour,
bfd_target_aout_flavour,
bfd_target_coff_flavour,
bfd_target_ecoff_flavour,
bfd_target_xcoff_flavour,
bfd_target_elf_flavour,
bfd_target_ieee_flavour,
bfd_target_nlm_flavour,
@ -133,7 +134,7 @@ enum bfd_flavour @{
enum bfd_endian @{ BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN @};
/* Forward declaration. */
/* Forward declaration. */
typedef struct bfd_link_info _bfd_link_info;
typedef struct bfd_target
@ -159,21 +160,21 @@ The order of bytes within the header parts of a file.
A mask of all the flags which an executable may have set -
from the set @code{BFD_NO_FLAGS}, @code{HAS_RELOC}, ...@code{D_PAGED}.
@example
flagword object_flags;
flagword object_flags;
@end example
A mask of all the flags which a section may have set - from
the set @code{SEC_NO_FLAGS}, @code{SEC_ALLOC}, ...@code{SET_NEVER_LOAD}.
@example
flagword section_flags;
@end example
The character normally found at the front of a symbol
The character normally found at the front of a symbol
(if any), perhaps `_'.
@example
char symbol_leading_char;
@end example
The pad character for file names within an archive header.
@example
char ar_pad_char;
char ar_pad_char;
@end example
The maximum number of characters in an archive header.
@example
@ -208,15 +209,15 @@ Byte swapping for the headers
Format dependent routines: these are vectors of entry points
within the target vector structure, one for each format to check.
Check the format of a file being read. Return a @code{bfd_target *} or zero.
Check the format of a file being read. Return a @code{bfd_target *} or zero.
@example
const struct bfd_target *(*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *));
@end example
Set the format of a file being written.
Set the format of a file being written.
@example
boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *));
@end example
Write cached information into a file being written, at @code{bfd_close}.
Write cached information into a file being written, at @code{bfd_close}.
@example
boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *));
@end example
@ -224,7 +225,7 @@ The general target vector. These vectors are initialized using the
BFD_JUMP_TABLE macros.
@example
/* Generic entry points. */
/* Generic entry points. */
#define BFD_JUMP_TABLE_GENERIC(NAME)\
CAT(NAME,_close_and_cleanup),\
CAT(NAME,_bfd_free_cached_info),\
@ -232,20 +233,20 @@ CAT(NAME,_new_section_hook),\
CAT(NAME,_get_section_contents),\
CAT(NAME,_get_section_contents_in_window)
/* Called when the BFD is being closed to do any necessary cleanup. */
/* Called when the BFD is being closed to do any necessary cleanup. */
boolean (*_close_and_cleanup) PARAMS ((bfd *));
/* Ask the BFD to free all cached information. */
/* Ask the BFD to free all cached information. */
boolean (*_bfd_free_cached_info) PARAMS ((bfd *));
/* Called when a new section is created. */
/* Called when a new section is created. */
boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr));
/* Read the contents of a section. */
boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
/* Read the contents of a section. */
boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
file_ptr, bfd_size_type));
boolean (*_bfd_get_section_contents_in_window)
PARAMS ((bfd *, sec_ptr, bfd_window *,
file_ptr, bfd_size_type));
/* Entry points to copy private data. */
/* Entry points to copy private data. */
#define BFD_JUMP_TABLE_COPY(NAME)\
CAT(NAME,_bfd_copy_private_bfd_data),\
CAT(NAME,_bfd_merge_private_bfd_data),\
@ -253,27 +254,27 @@ CAT(NAME,_bfd_copy_private_section_data),\
CAT(NAME,_bfd_copy_private_symbol_data),\
CAT(NAME,_bfd_set_private_flags),\
CAT(NAME,_bfd_print_private_bfd_data)\
/* Called to copy BFD general private data from one object file
/* Called to copy BFD general private data from one object file
to another. */
boolean (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *));
/* Called to merge BFD general private data from one object file
/* Called to merge BFD general private data from one object file
to a common output file when linking. */
boolean (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *));
/* Called to copy BFD private section data from one object file
/* Called to copy BFD private section data from one object file
to another. */
boolean (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr,
bfd *, sec_ptr));
/* Called to copy BFD private symbol data from one symbol
/* Called to copy BFD private symbol data from one symbol
to another. */
boolean (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *,
bfd *, asymbol *));
/* Called to set private backend flags */
/* Called to set private backend flags */
boolean (*_bfd_set_private_flags) PARAMS ((bfd *, flagword));
/* Called to print private BFD data */
/* Called to print private BFD data */
boolean (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR));
/* Core file entry points. */
/* Core file entry points. */
#define BFD_JUMP_TABLE_CORE(NAME)\
CAT(NAME,_core_file_failing_command),\
CAT(NAME,_core_file_failing_signal),\
@ -282,7 +283,7 @@ CAT(NAME,_core_file_matches_executable_p)
int (*_core_file_failing_signal) PARAMS ((bfd *));
boolean (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *));
/* Archive entry points. */
/* Archive entry points. */
#define BFD_JUMP_TABLE_ARCHIVE(NAME)\
CAT(NAME,_slurp_armap),\
CAT(NAME,_slurp_extended_name_table),\
@ -299,10 +300,10 @@ CAT(NAME,_update_armap_timestamp)
boolean (*_bfd_construct_extended_name_table)
PARAMS ((bfd *, char **, bfd_size_type *, const char **));
void (*_bfd_truncate_arname) PARAMS ((bfd *, CONST char *, char *));
boolean (*write_armap) PARAMS ((bfd *arch,
boolean (*write_armap) PARAMS ((bfd *arch,
unsigned int elength,
struct orl *map,
unsigned int orl_count,
unsigned int orl_count,
int stridx));
PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *));
bfd * (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev));
@ -311,7 +312,7 @@ CAT(NAME,_update_armap_timestamp)
int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *));
boolean (*_bfd_update_armap_timestamp) PARAMS ((bfd *));
/* Entry points used for symbols. */
/* Entry points used for symbols. */
#define BFD_JUMP_TABLE_SYMBOLS(NAME)\
CAT(NAME,_get_symtab_upper_bound),\
CAT(NAME,_get_symtab),\
@ -344,7 +345,7 @@ CAT(NAME,_minisymbol_to_symbol)
struct sec *section, struct symbol_cache_entry **symbols,
bfd_vma offset, CONST char **file, CONST char **func,
unsigned int *line));
/* Back-door to allow format-aware applications to create debug symbols
/* Back-door to allow format-aware applications to create debug symbols
while using BFD for everything else. Currently used by the assembler
when creating COFF files. */
asymbol * (*_bfd_make_debug_symbol) PARAMS ((
@ -360,7 +361,7 @@ CAT(NAME,_minisymbol_to_symbol)
asymbol *(*_minisymbol_to_symbol) PARAMS ((bfd *, boolean, const PTR,
asymbol *));
/* Routines for relocs. */
/* Routines for relocs. */
#define BFD_JUMP_TABLE_RELOCS(NAME)\
CAT(NAME,_get_reloc_upper_bound),\
CAT(NAME,_canonicalize_reloc),\
@ -368,12 +369,12 @@ CAT(NAME,_bfd_reloc_type_lookup)
long (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));
long (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,
struct symbol_cache_entry **));
/* See documentation on reloc types. */
/* See documentation on reloc types. */
reloc_howto_type *
(*reloc_type_lookup) PARAMS ((bfd *abfd,
bfd_reloc_code_real_type code));
/* Routines used when writing an object file. */
/* Routines used when writing an object file. */
#define BFD_JUMP_TABLE_WRITE(NAME)\
CAT(NAME,_set_arch_mach),\
CAT(NAME,_set_section_contents)
@ -382,7 +383,7 @@ CAT(NAME,_set_section_contents)
boolean (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
file_ptr, bfd_size_type));
/* Routines used by the linker. */
/* Routines used by the linker. */
#define BFD_JUMP_TABLE_LINK(NAME)\
CAT(NAME,_sizeof_headers),\
CAT(NAME,_bfd_get_relocated_section_contents),\
@ -401,37 +402,37 @@ CAT(NAME,_bfd_gc_sections)
boolean (*_bfd_relax_section) PARAMS ((bfd *, struct sec *,
struct bfd_link_info *, boolean *again));
/* Create a hash table for the linker. Different backends store
/* Create a hash table for the linker. Different backends store
different information in this table. */
struct bfd_link_hash_table *(*_bfd_link_hash_table_create) PARAMS ((bfd *));
/* Add symbols from this object file into the hash table. */
/* Add symbols from this object file into the hash table. */
boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
/* Do a link based on the link_order structures attached to each
/* Do a link based on the link_order structures attached to each
section of the BFD. */
boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *));
/* Should this section be split up into smaller pieces during linking. */
/* Should this section be split up into smaller pieces during linking. */
boolean (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *));
/* Remove sections that are not referenced from the output. */
/* Remove sections that are not referenced from the output. */
boolean (*_bfd_gc_sections) PARAMS ((bfd *, struct bfd_link_info *));
/* Routines to handle dynamic symbols and relocs. */
/* Routines to handle dynamic symbols and relocs. */
#define BFD_JUMP_TABLE_DYNAMIC(NAME)\
CAT(NAME,_get_dynamic_symtab_upper_bound),\
CAT(NAME,_canonicalize_dynamic_symtab),\
CAT(NAME,_get_dynamic_reloc_upper_bound),\
CAT(NAME,_canonicalize_dynamic_reloc)
/* Get the amount of memory required to hold the dynamic symbols. */
/* Get the amount of memory required to hold the dynamic symbols. */
long (*_bfd_get_dynamic_symtab_upper_bound) PARAMS ((bfd *));
/* Read in the dynamic symbols. */
/* Read in the dynamic symbols. */
long (*_bfd_canonicalize_dynamic_symtab)
PARAMS ((bfd *, struct symbol_cache_entry **));
/* Get the amount of memory required to hold the dynamic relocs. */
/* Get the amount of memory required to hold the dynamic relocs. */
long (*_bfd_get_dynamic_reloc_upper_bound) PARAMS ((bfd *));
/* Read in the dynamic relocs. */
/* Read in the dynamic relocs. */
long (*_bfd_canonicalize_dynamic_reloc)
PARAMS ((bfd *, arelent **, struct symbol_cache_entry **));
@ -442,15 +443,15 @@ and little endian code, and target chosen by the linker has the wrong
endianness. The function open_output() in ld/ldlang.c uses this field
to find an alternative output format that is suitable.
@example
/* Opposite endian version of this target. */
/* Opposite endian version of this target. */
const struct bfd_target * alternative_target;
@end example
Data for use by back-end routines, which isn't generic enough to belong
in this structure.
@example
PTR backend_data;
@} bfd_target;
@end example
@ -497,7 +498,7 @@ modify the names.
@subsubsection @code{bfd_seach_for_target}
@strong{Synopsis}
@example
const bfd_target * bfd_search_for_target (int (* search_func)(const bfd_target *, void *), void *);
const bfd_target * bfd_search_for_target (int (* search_func) (const bfd_target *, void *), void *);
@end example
@strong{Description}@*
Return a pointer to the first transfer vector in the list of

View File

@ -1,7 +1,7 @@
/* DWARF 1 find nearest line (_bfd_dwarf1_find_nearest_line).
Copyright 1998, 1999 Free Software Foundation, Inc.
Copyright 1998, 1999, 2000 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.
@ -26,121 +26,115 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "elf-bfd.h"
#include "elf/dwarf.h"
/* dwarf1_debug is the starting point for all dwarf1 info. */
/* dwarf1_debug is the starting point for all dwarf1 info. */
struct dwarf1_debug {
/* The bfd we are working with. */
/* The bfd we are working with. */
bfd* abfd;
/* List of already parsed compilation units. */
/* List of already parsed compilation units. */
struct dwarf1_unit* lastUnit;
/* The buffer for the .debug section.
Zero indicates that the .debug section failed to load. */
/* The buffer for the .debug section.
Zero indicates that the .debug section failed to load. */
char* debug_section;
/* Pointer to the end of the .debug_info section memory buffer. */
/* Pointer to the end of the .debug_info section memory buffer. */
char* debug_section_end;
/* The buffer for the .line section. */
/* The buffer for the .line section. */
char* line_section;
/* End of that buffer. */
/* End of that buffer. */
char* line_section_end;
/* The current or next unread die within the .debug section. */
/* The current or next unread die within the .debug section. */
char* currentDie;
};
/* One dwarf1_unit for each parsed compilation unit die. */
/* One dwarf1_unit for each parsed compilation unit die. */
struct dwarf1_unit {
/* Linked starting from stash->lastUnit. */
/* Linked starting from stash->lastUnit. */
struct dwarf1_unit* prev;
/* Name of the compilation unit. */
/* Name of the compilation unit. */
char* name;
/* The highest and lowest address used in the compilation unit. */
/* The highest and lowest address used in the compilation unit. */
unsigned long low_pc;
unsigned long high_pc;
/* Does this unit have a statement list? */
int has_stmt_list;
/* If any, the offset of the line number table in the .line section. */
/* If any, the offset of the line number table in the .line section. */
unsigned long stmt_list_offset;
/* If non-zero, a pointer to the first child of this unit. */
/* If non-zero, a pointer to the first child of this unit. */
char* first_child;
/* How many line entries? */
unsigned long line_count;
/* The decoded line number table (line_count entries). */
/* The decoded line number table (line_count entries). */
struct linenumber* linenumber_table;
/* The list of functions in this unit. */
/* The list of functions in this unit. */
struct dwarf1_func* func_list;
};
/* One dwarf1_func for each parsed function die. */
struct dwarf1_func {
/* Linked starting from aUnit->func_list. */
/* Linked starting from aUnit->func_list. */
struct dwarf1_func* prev;
/* Name of function. */
/* Name of function. */
char* name;
/* The highest and lowest address used in the compilation unit. */
/* The highest and lowest address used in the compilation unit. */
unsigned long low_pc;
unsigned long high_pc;
};
/* Used to return info about a parsed die. */
/* Used to return info about a parsed die. */
struct die_info {
unsigned long length;
unsigned long sibling;
unsigned long low_pc;
unsigned long high_pc;
unsigned long stmt_list_offset;
char* name;
char* name;
int has_stmt_list;
unsigned short tag;
};
/* Parsed line number information. */
/* Parsed line number information. */
struct linenumber {
/* First address in the line. */
/* First address in the line. */
unsigned long addr;
/* The line number. */
/* The line number. */
unsigned long linenumber;
};
/* Find the form of an attr, from the attr field. */
/* Find the form of an attr, from the attr field. */
#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'. */
then attached into the 'stash' at 'stash->lastUnit'. */
static struct dwarf1_unit*
alloc_dwarf1_unit (stash)
struct dwarf1_debug* stash;
{
struct dwarf1_unit* x =
(struct dwarf1_unit*) bfd_zalloc (stash->abfd,
struct dwarf1_unit* x =
(struct dwarf1_unit*) bfd_zalloc (stash->abfd,
sizeof (struct dwarf1_unit));
x->prev = stash->lastUnit;
stash->lastUnit = x;
@ -149,28 +143,28 @@ alloc_dwarf1_unit (stash)
}
/* Return a newly allocated dwarf1_func. It must be cleared and
attached into 'aUnit' at 'aUnit->func_list'. */
attached into 'aUnit' at 'aUnit->func_list'. */
static struct dwarf1_func*
alloc_dwarf1_func (stash, aUnit)
struct dwarf1_debug* stash;
struct dwarf1_unit* aUnit;
{
struct dwarf1_func* x =
(struct dwarf1_func*) bfd_zalloc (stash->abfd,
struct dwarf1_func* x =
(struct dwarf1_func*) bfd_zalloc (stash->abfd,
sizeof (struct dwarf1_func));
x->prev = aUnit->func_list;
aUnit->func_list = x;
return x;
}
/* parse_die - parse a Dwarf1 die.
Parse the die starting at 'aDiePtr' into 'aDieInfo'.
'abfd' must be the bfd from which the section that 'aDiePtr'
points to was pulled from.
points to was pulled from.
Return false if the die is invalidly formatted; true otherwise. */
Return false if the die is invalidly formatted; true otherwise. */
static boolean
parse_die (abfd, aDieInfo, aDiePtr)
@ -181,36 +175,36 @@ parse_die (abfd, aDieInfo, aDiePtr)
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, xptr);
/* First comes the length. */
aDieInfo->length = bfd_get_32 (abfd, (bfd_byte *) xptr);
xptr += 4;
if (aDieInfo->length == 0)
return false;
if (aDieInfo->length < 6)
{
/* Just padding bytes. */
/* Just padding bytes. */
aDieInfo->tag = TAG_padding;
return true;
}
/* Then the tag. */
aDieInfo->tag = bfd_get_16 (abfd, xptr);
/* Then the tag. */
aDieInfo->tag = bfd_get_16 (abfd, (bfd_byte *) xptr);
xptr += 2;
/* Then the attributes. */
/* Then the attributes. */
while (xptr < (this_die + aDieInfo->length))
{
unsigned short attr;
/* 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, xptr);
/* 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;
switch (FORM_FROM_ATTR (attr))
{
case FORM_DATA2:
@ -219,10 +213,10 @@ parse_die (abfd, aDieInfo, aDiePtr)
case FORM_DATA4:
case FORM_REF:
if (attr == AT_sibling)
aDieInfo->sibling = bfd_get_32 (abfd, xptr);
aDieInfo->sibling = bfd_get_32 (abfd, (bfd_byte *) xptr);
else if (attr == AT_stmt_list)
{
aDieInfo->stmt_list_offset = bfd_get_32 (abfd, xptr);
aDieInfo->stmt_list_offset = bfd_get_32 (abfd, (bfd_byte *) xptr);
aDieInfo->has_stmt_list = 1;
}
xptr += 4;
@ -232,16 +226,16 @@ parse_die (abfd, aDieInfo, aDiePtr)
break;
case FORM_ADDR:
if (attr == AT_low_pc)
aDieInfo->low_pc = bfd_get_32 (abfd, xptr);
aDieInfo->low_pc = bfd_get_32 (abfd, (bfd_byte *) xptr);
else if (attr == AT_high_pc)
aDieInfo->high_pc = bfd_get_32 (abfd, xptr);
aDieInfo->high_pc = bfd_get_32 (abfd, (bfd_byte *) xptr);
xptr += 4;
break;
case FORM_BLOCK2:
xptr += 2 + bfd_get_16 (abfd, xptr);
xptr += 2 + bfd_get_16 (abfd, (bfd_byte *) xptr);
break;
case FORM_BLOCK4:
xptr += 4 + bfd_get_32 (abfd, xptr);
xptr += 4 + bfd_get_32 (abfd, (bfd_byte *) xptr);
break;
case FORM_STRING:
if (attr == AT_name)
@ -255,9 +249,9 @@ parse_die (abfd, aDieInfo, aDiePtr)
}
/* Parse a dwarf1 line number table for 'aUnit->stmt_list_offset'
into 'aUnit->linenumber_table'. Return false if an error
occurs; true otherwise. */
into 'aUnit->linenumber_table'. Return false if an error
occurs; true otherwise. */
static boolean
parse_line_table (stash, aUnit)
struct dwarf1_debug* stash;
@ -265,19 +259,19 @@ parse_line_table (stash, aUnit)
{
char* xptr;
/* Load the ".line" section from the bfd if we haven't already. */
/* Load the ".line" section from the bfd if we haven't already. */
if (stash->line_section == 0)
{
asection *msec;
unsigned long size;
msec = bfd_get_section_by_name (stash->abfd, ".line");
if (! msec)
return false;
size = bfd_get_section_size_before_reloc (msec);
stash->line_section = (unsigned char*) bfd_alloc (stash->abfd, size);
stash->line_section = (char *) bfd_alloc (stash->abfd, size);
if (! stash->line_section)
return false;
@ -298,36 +292,36 @@ parse_line_table (stash, aUnit)
char* tblend;
unsigned long base;
/* First comes the length. */
tblend = bfd_get_32 (stash->abfd, xptr) + xptr;
/* First comes the length. */
tblend = bfd_get_32 (stash->abfd, (bfd_byte *) xptr) + xptr;
xptr += 4;
/* Then the base address for each address in the table. */
base = bfd_get_32 (stash->abfd, xptr);
/* Then the base address for each address in the table. */
base = bfd_get_32 (stash->abfd, (bfd_byte *) xptr);
xptr += 4;
/* How many line entrys?
10 = 4 (line number) + 2 (pos in line) + 4 (address in line) */
aUnit->line_count = (tblend - xptr) / 10;
/* Allocate an array for the entries. */
aUnit->linenumber_table = (struct linenumber*)
bfd_alloc (stash->abfd,
/* Allocate an array for the entries. */
aUnit->linenumber_table = (struct linenumber *)
bfd_alloc (stash->abfd,
sizeof (struct linenumber) * aUnit->line_count);
for (eachLine = 0; eachLine < aUnit->line_count; eachLine++)
{
/* A line number. */
/* A line number. */
aUnit->linenumber_table[eachLine].linenumber
= bfd_get_32 (stash->abfd, xptr);
= bfd_get_32 (stash->abfd, (bfd_byte *) xptr);
xptr += 4;
/* Skip the position within the line. */
/* Skip the position within the line. */
xptr += 2;
/* And finally the address. */
aUnit->linenumber_table[eachLine].addr
= base + bfd_get_32 (stash->abfd, xptr);
/* And finally the address. */
aUnit->linenumber_table[eachLine].addr
= base + bfd_get_32 (stash->abfd, (bfd_byte *) xptr);
xptr += 4;
}
}
@ -338,7 +332,7 @@ parse_line_table (stash, aUnit)
/* Parse each function die in a compilation unit 'aUnit'.
The first child die of 'aUnit' should be in 'aUnit->first_child',
the result is placed in 'aUnit->func_list'.
Return false if error; true otherwise. */
Return false if error; true otherwise. */
static boolean
parse_functions_in_unit (stash, aUnit)
@ -353,37 +347,37 @@ parse_functions_in_unit (stash, aUnit)
)
{
struct die_info eachDieInfo;
if (! parse_die (stash->abfd, &eachDieInfo, eachDie))
return false;
if (eachDieInfo.tag == TAG_global_subroutine
|| eachDieInfo.tag == TAG_subroutine
|| eachDieInfo.tag == TAG_inlined_subroutine
|| eachDieInfo.tag == TAG_entry_point)
{
struct dwarf1_func* aFunc = alloc_dwarf1_func (stash,aUnit);
aFunc->name = eachDieInfo.name;
aFunc->low_pc = eachDieInfo.low_pc;
aFunc->high_pc = eachDieInfo.high_pc;
}
/* Move to next sibling, if none, end loop */
if (eachDieInfo.sibling)
eachDie = stash->debug_section + eachDieInfo.sibling;
else
break;
}
return true;
}
/* Find the nearest line to 'addr' in 'aUnit'.
Return whether we found the line (or a function) without error. */
Return whether we found the line (or a function) without error. */
static boolean
dwarf1_unit_find_nearest_line (stash, aUnit, addr,
dwarf1_unit_find_nearest_line (stash, aUnit, addr,
filename_ptr, functionname_ptr,
linenumber_ptr)
struct dwarf1_debug* stash;
@ -427,8 +421,8 @@ dwarf1_unit_find_nearest_line (stash, aUnit, addr,
}
}
for (eachFunc = aUnit->func_list;
eachFunc;
for (eachFunc = aUnit->func_list;
eachFunc;
eachFunc = eachFunc->prev)
{
if (eachFunc->low_pc <= addr
@ -445,11 +439,8 @@ dwarf1_unit_find_nearest_line (stash, aUnit, addr,
return line_p || func_p;
}
/* The DWARF 1 version of find_nearest line.
Return true if the line is found without error. */
Return true if the line is found without error. */
boolean
_bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
@ -472,31 +463,30 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
*filename_ptr = NULL;
*functionname_ptr = NULL;
*linenumber_ptr = 0;
if (! stash)
{
asection *msec;
unsigned long size;
stash = elf_tdata (abfd)->dwarf1_find_line_info =
(struct dwarf1_debug*) bfd_zalloc (abfd, sizeof (struct dwarf1_debug));
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. */
future calls to this function fail quicker. */
return false;
}
size = bfd_get_section_size_before_reloc (msec);
stash->debug_section = (unsigned char*) bfd_alloc (abfd, size);
stash->debug_section = (char *) bfd_alloc (abfd, size);
if (! stash->debug_section)
return false;
@ -512,20 +502,19 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
}
/* A null debug_section indicates that there was no dwarf1 info
or that an error occured while setting up the stash. */
or that an error occured while setting up the stash. */
if (! stash->debug_section)
return false;
/* Look at the previously parsed units to see if any contain
the addr. */
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,
filename_ptr,
functionname_ptr,
linenumber_ptr);
}
@ -535,36 +524,36 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
if (! parse_die (stash->abfd, &aDieInfo, stash->currentDie))
return false;
if (aDieInfo.tag == TAG_compile_unit)
{
struct dwarf1_unit* aUnit
= alloc_dwarf1_unit (stash);
aUnit->name = aDieInfo.name;
aUnit->low_pc = aDieInfo.low_pc;
aUnit->high_pc = aDieInfo.high_pc;
aUnit->has_stmt_list = aDieInfo.has_stmt_list;
aUnit->stmt_list_offset = aDieInfo.stmt_list_offset;
/* A die has a child if it's followed by a die that is
not it's sibling. */
if (aDieInfo.sibling
&& stash->currentDie + aDieInfo.length
not it's sibling. */
if (aDieInfo.sibling
&& stash->currentDie + aDieInfo.length
< stash->debug_section_end
&& stash->currentDie + aDieInfo.length
&& stash->currentDie + aDieInfo.length
!= stash->debug_section + aDieInfo.sibling)
aUnit->first_child = stash->currentDie + aDieInfo.length;
else
aUnit->first_child = 0;
if (aUnit->low_pc <= addr && addr < aUnit->high_pc)
return dwarf1_unit_find_nearest_line (stash, aUnit, addr,
filename_ptr,
functionname_ptr,
return dwarf1_unit_find_nearest_line (stash, aUnit, addr,
filename_ptr,
functionname_ptr,
linenumber_ptr);
}
if (aDieInfo.sibling != 0)
stash->currentDie = stash->debug_section + aDieInfo.sibling;
else
@ -574,5 +563,4 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
return false;
}
/* EOF */

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/* Generic ECOFF (Extended-COFF) routines.
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
Free Software Foundation, Inc.
Original version by Per Bothner.
Full support added by Ian Lance Taylor, ian@cygnus.com.
@ -344,9 +344,9 @@ ecoff_sec_to_styp_flags (name, flags)
}
else if (strcmp (name, _RCONST) == 0)
styp = STYP_RCONST;
else if (flags & SEC_CODE)
else if (flags & SEC_CODE)
styp = STYP_TEXT;
else if (flags & SEC_DATA)
else if (flags & SEC_DATA)
styp = STYP_DATA;
else if (flags & SEC_READONLY)
styp = STYP_RDATA;
@ -363,7 +363,6 @@ ecoff_sec_to_styp_flags (name, flags)
/* Get the BFD flags to use for a section. */
/*ARGSUSED*/
flagword
_bfd_ecoff_styp_to_sec_flags (abfd, hdr, name, section)
bfd *abfd ATTRIBUTE_UNUSED;
@ -452,7 +451,7 @@ ecoff_slurp_symbolic_header (abfd)
HDRR *internal_symhdr;
/* See if we've already read it in. */
if (ecoff_data (abfd)->debug_info.symbolic_header.magic ==
if (ecoff_data (abfd)->debug_info.symbolic_header.magic ==
backend->debug_swap.sym_magic)
return true;
@ -509,7 +508,6 @@ ecoff_slurp_symbolic_header (abfd)
object file. This is called by gdb via the read_debug_info entry
point in the backend structure. */
/*ARGSUSED*/
boolean
_bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug)
bfd *abfd;
@ -1090,7 +1088,7 @@ ecoff_emit_aggregate (abfd, fdr, string, rndx, isym, which)
unsigned int ifd = rndx->rfd;
unsigned int indx = rndx->index;
const char *name;
if (ifd == 0xfff)
ifd = isym;
@ -1340,7 +1338,6 @@ ecoff_type_to_string (abfd, fdr, indx)
p1 += strlen (buffer1);
}
/*
* Deal with any qualifiers.
*/
@ -1406,7 +1403,7 @@ ecoff_type_to_string (abfd, fdr, indx)
int j;
/* Print array bounds reversed (ie, in the order the C
programmer writes them). C is such a fun language.... */
programmer writes them). C is such a fun language.... */
while (i < 5 && qualifiers[i+1].type == tqArray)
i++;
@ -1447,7 +1444,6 @@ ecoff_type_to_string (abfd, fdr, indx)
/* Return information about ECOFF symbol SYMBOL in RET. */
/*ARGSUSED*/
void
_bfd_ecoff_get_symbol_info (abfd, symbol, ret)
bfd *abfd ATTRIBUTE_UNUSED;
@ -1459,7 +1455,6 @@ _bfd_ecoff_get_symbol_info (abfd, symbol, ret)
/* Return whether this is a local label. */
/*ARGSUSED*/
boolean
_bfd_ecoff_bfd_is_local_label_name (abfd, name)
bfd *abfd ATTRIBUTE_UNUSED;
@ -1490,7 +1485,7 @@ _bfd_ecoff_print_symbol (abfd, filep, symbol, how)
if (ecoffsymbol (symbol)->local)
{
SYMR ecoff_sym;
(*debug_swap->swap_sym_in) (abfd, ecoffsymbol (symbol)->native,
&ecoff_sym);
fprintf (file, "ecoff local ");
@ -1604,7 +1599,7 @@ _bfd_ecoff_print_symbol (abfd, filep, symbol, how)
fprintf (file, _("\n First symbol: %ld"),
(long) (indx + sym_base));
else
fprintf (file, _("\n First symbol: %ld"),
fprintf (file, _("\n First symbol: %ld"),
((long)
(AUX_GET_ISYM (bigendian,
&aux_base[ecoff_ext.asym.index])
@ -1680,7 +1675,7 @@ ecoff_slurp_reloc_table (abfd, section, symbols)
if (_bfd_ecoff_slurp_symbol_table (abfd) == false)
return false;
internal_relocs = (arelent *) bfd_alloc (abfd,
(sizeof (arelent)
* section->reloc_count));
@ -1778,7 +1773,7 @@ _bfd_ecoff_canonicalize_reloc (abfd, section, relptr, symbols)
{
unsigned int count;
if (section->flags & SEC_CONSTRUCTOR)
if (section->flags & SEC_CONSTRUCTOR)
{
arelent_chain *chain;
@ -1791,7 +1786,7 @@ _bfd_ecoff_canonicalize_reloc (abfd, section, relptr, symbols)
*relptr++ = &chain->relent;
}
else
{
{
arelent *tblptr;
if (ecoff_slurp_reloc_table (abfd, section, symbols) == false)
@ -1812,7 +1807,6 @@ _bfd_ecoff_canonicalize_reloc (abfd, section, relptr, symbols)
and return the name of the source file and the line nearest to the
wanted location. */
/*ARGSUSED*/
boolean
_bfd_ecoff_find_nearest_line (abfd, section, ignore_symbols, offset,
filename_ptr, functionname_ptr, retline_ptr)
@ -1984,7 +1978,6 @@ _bfd_ecoff_set_arch_mach (abfd, arch, machine)
/* Get the size of the section headers. */
/*ARGSUSED*/
int
_bfd_ecoff_sizeof_headers (abfd, reloc)
bfd *abfd;
@ -1996,8 +1989,8 @@ _bfd_ecoff_sizeof_headers (abfd, reloc)
c = 0;
for (current = abfd->sections;
current != (asection *)NULL;
current = current->next)
current != (asection *)NULL;
current = current->next)
++c;
ret = (bfd_coff_filhsz (abfd)
@ -2218,13 +2211,13 @@ ecoff_compute_reloc_file_positions (abfd)
abort ();
abfd->output_has_begun = true;
}
reloc_base = ecoff_data (abfd)->reloc_filepos;
reloc_size = 0;
for (current = abfd->sections;
current != (asection *)NULL;
current = current->next)
current != (asection *)NULL;
current = current->next)
{
if (current->reloc_count == 0)
current->rel_filepos = 0;
@ -2312,7 +2305,7 @@ bfd_ecoff_get_gp_value (abfd)
bfd_set_error (bfd_error_invalid_operation);
return 0;
}
return ecoff_data (abfd)->gp;
}
@ -2491,8 +2484,8 @@ _bfd_ecoff_write_object_contents (abfd)
count = 1;
for (current = abfd->sections;
current != (asection *)NULL;
current = current->next)
current != (asection *)NULL;
current = current->next)
{
current->target_index = count;
++count;
@ -2630,7 +2623,7 @@ _bfd_ecoff_write_object_contents (abfd)
/* Do nothing */ ;
else
abort ();
}
}
/* Set up the file header. */
@ -2782,7 +2775,7 @@ _bfd_ecoff_write_object_contents (abfd)
arelent *reloc;
asymbol *sym;
struct internal_reloc in;
memset ((PTR) &in, 0, sizeof in);
reloc = *reloc_ptr_ptr;
@ -2982,7 +2975,7 @@ _bfd_ecoff_slurp_armap (abfd)
char *raw_ptr;
struct symdef *symdef_ptr;
char *stringbase;
/* Get the name of the first element. */
i = bfd_read ((PTR) nextname, 1, 16, abfd);
if (i == 0)
@ -3034,11 +3027,11 @@ _bfd_ecoff_slurp_armap (abfd)
return false;
parsed_size = mapdata->parsed_size;
bfd_release (abfd, (PTR) mapdata);
raw_armap = (char *) bfd_alloc (abfd, parsed_size);
if (raw_armap == (char *) NULL)
return false;
if (bfd_read ((PTR) raw_armap, 1, parsed_size, abfd) != parsed_size)
{
if (bfd_get_error () != bfd_error_system_call)
@ -3046,7 +3039,7 @@ _bfd_ecoff_slurp_armap (abfd)
bfd_release (abfd, (PTR) raw_armap);
return false;
}
ardata->tdata = (PTR) raw_armap;
count = bfd_h_get_32 (abfd, (PTR) raw_armap);
@ -3075,7 +3068,7 @@ _bfd_ecoff_slurp_armap (abfd)
{
unsigned int name_offset, file_offset;
unsigned int hash, rehash, srch;
name_offset = bfd_h_get_32 (abfd, (PTR) raw_ptr);
file_offset = bfd_h_get_32 (abfd, (PTR) (raw_ptr + 4));
if (file_offset == 0)
@ -3167,7 +3160,7 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx)
padit = stridx % 2;
stringsize = stridx + padit;
/* Include 8 bytes to store symdefsize and stringsize in output. */
/* Include 8 bytes to store symdefsize and stringsize in output. */
mapsize = symdefsize + stringsize + 8;
firstreal = SARMAG + sizeof (struct ar_hdr) + mapsize + elength;
@ -3201,7 +3194,7 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx)
#if 0
hdr.ar_mode[0] = '0';
#else
/* Building gcc ends up extracting the armap as a file - twice. */
/* Building gcc ends up extracting the armap as a file - twice. */
hdr.ar_mode[0] = '6';
hdr.ar_mode[1] = '4';
hdr.ar_mode[2] = '4';
@ -3214,8 +3207,8 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx)
/* Turn all null bytes in the header into spaces. */
for (i = 0; i < sizeof (struct ar_hdr); i++)
if (((char *)(&hdr))[i] == '\0')
(((char *)(&hdr))[i]) = ' ';
if (((char *) (&hdr))[i] == '\0')
(((char *) (&hdr))[i]) = ' ';
if (bfd_write ((PTR) &hdr, 1, sizeof (struct ar_hdr), abfd)
!= sizeof (struct ar_hdr))
@ -3224,7 +3217,7 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx)
bfd_h_put_32 (abfd, (bfd_vma) hashsize, temp);
if (bfd_write ((PTR) temp, 1, 4, abfd) != 4)
return false;
hashtable = (bfd_byte *) bfd_zalloc (abfd, symdefsize);
if (!hashtable)
return false;
@ -3266,7 +3259,7 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx)
hash = srch;
}
bfd_h_put_32 (abfd, (bfd_vma) map[i].namidx,
(PTR) (hashtable + hash * 8));
bfd_h_put_32 (abfd, (bfd_vma) firstreal,
@ -3345,7 +3338,7 @@ _bfd_ecoff_archive_p (abfd)
bfd_ardata (abfd)->symdefs = NULL;
bfd_ardata (abfd)->extended_names = NULL;
bfd_ardata (abfd)->tdata = NULL;
if (_bfd_ecoff_slurp_armap (abfd) == false
|| _bfd_ecoff_slurp_extended_name_table (abfd) == false)
{
@ -3353,7 +3346,7 @@ _bfd_ecoff_archive_p (abfd)
abfd->tdata.aout_ar_data = tdata_hold;
return (const bfd_target *) NULL;
}
if (bfd_has_map (abfd))
{
bfd *first;
@ -4391,7 +4384,7 @@ ecoff_link_write_external (h, data)
bfd *output_bfd = einfo->abfd;
boolean strip;
/* We need to check if this symbol is being stripped. */
/* We need to check if this symbol is being stripped. */
if (h->root.type == bfd_link_hash_undefined
|| h->root.type == bfd_link_hash_undefweak)
strip = false;
@ -4427,7 +4420,7 @@ ecoff_link_write_external (h, data)
output_section = h->root.u.def.section->output_section;
name = bfd_section_name (output_section->owner, output_section);
if (strcmp (name, _TEXT) == 0)
h->esym.asym.sc = scText;
else if (strcmp (name, _DATA) == 0)

View File

@ -1,5 +1,5 @@
/* Routines to link ECOFF debugging information.
Copyright 1993, 94, 95, 96, 97, 1999 Free Software Foundation, Inc.
Copyright 1993, 94, 95, 96, 97, 99, 2000 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.
@ -69,8 +69,8 @@ _bfd_ecoff_swap_tir_in (bigend, ext_copy, intern)
struct tir_ext ext[1];
*ext = *ext_copy; /* Make it reasonable to do in-place. */
/* now the fun stuff... */
/* now the fun stuff... */
if (bigend) {
intern->fBitfield = 0 != (ext->t_bits1[0] & TIR_BITS1_FBITFIELD_BIG);
intern->continued = 0 != (ext->t_bits1[0] & TIR_BITS1_CONTINUED_BIG);
@ -109,7 +109,7 @@ _bfd_ecoff_swap_tir_in (bigend, ext_copy, intern)
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
abort();
abort ();
#endif
}
@ -126,8 +126,8 @@ _bfd_ecoff_swap_tir_out (bigend, intern_copy, ext)
TIR intern[1];
*intern = *intern_copy; /* Make it reasonable to do in-place. */
/* now the fun stuff... */
/* now the fun stuff... */
if (bigend) {
ext->t_bits1[0] = ((intern->fBitfield ? TIR_BITS1_FBITFIELD_BIG : 0)
| (intern->continued ? TIR_BITS1_CONTINUED_BIG : 0)
@ -166,7 +166,7 @@ _bfd_ecoff_swap_tir_out (bigend, intern_copy, ext)
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
abort();
abort ();
#endif
}
@ -182,8 +182,8 @@ _bfd_ecoff_swap_rndx_in (bigend, ext_copy, intern)
struct rndx_ext ext[1];
*ext = *ext_copy; /* Make it reasonable to do in-place. */
/* now the fun stuff... */
/* now the fun stuff... */
if (bigend) {
intern->rfd = (ext->r_bits[0] << RNDX_BITS0_RFD_SH_LEFT_BIG)
| ((ext->r_bits[1] & RNDX_BITS1_RFD_BIG)
@ -205,7 +205,7 @@ _bfd_ecoff_swap_rndx_in (bigend, ext_copy, intern)
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
abort();
abort ();
#endif
}
@ -221,8 +221,8 @@ _bfd_ecoff_swap_rndx_out (bigend, intern_copy, ext)
RNDXR intern[1];
*intern = *intern_copy; /* Make it reasonable to do in-place. */
/* now the fun stuff... */
/* now the fun stuff... */
if (bigend) {
ext->r_bits[0] = intern->rfd >> RNDX_BITS0_RFD_SH_LEFT_BIG;
ext->r_bits[1] = (((intern->rfd << RNDX_BITS1_RFD_SH_BIG)
@ -243,7 +243,7 @@ _bfd_ecoff_swap_rndx_out (bigend, intern_copy, ext)
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
abort();
abort ();
#endif
}
@ -465,7 +465,7 @@ add_memory_shuffle (ainfo, head, tail, data, size)
unsigned long size;
{
struct shuffle *n;
n = (struct shuffle *) objalloc_alloc (ainfo->memory,
sizeof (struct shuffle));
if (!n)
@ -488,7 +488,6 @@ add_memory_shuffle (ainfo, head, tail, data, size)
/* Initialize the FDR hash table. This returns a handle which is then
passed in to bfd_ecoff_debug_accumulate, et. al. */
/*ARGSUSED*/
PTR
bfd_ecoff_debug_init (output_bfd, output_debug, output_swap, info)
bfd *output_bfd ATTRIBUTE_UNUSED;
@ -547,7 +546,6 @@ bfd_ecoff_debug_init (output_bfd, output_debug, output_swap, info)
/* Free the accumulated debugging information. */
/*ARGSUSED*/
void
bfd_ecoff_debug_free (handle, output_bfd, output_debug, output_swap, info)
PTR handle;
@ -557,7 +555,7 @@ bfd_ecoff_debug_free (handle, output_bfd, output_debug, output_swap, info)
struct bfd_link_info *info;
{
struct accumulate *ainfo = (struct accumulate *) handle;
bfd_hash_table_free (&ainfo->fdr_hash.table);
if (! info->relocateable)
@ -576,7 +574,6 @@ bfd_ecoff_debug_free (handle, output_bfd, output_debug, output_swap, info)
linker information structure. HANDLE is returned by
bfd_ecoff_debug_init. */
/*ARGSUSED*/
boolean
bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
input_bfd, input_debug, input_swap,
@ -1409,7 +1406,6 @@ bfd_ecoff_debug_one_external (abfd, debug, swap, name, esym)
/* Align the ECOFF debugging information. */
/*ARGSUSED*/
static void
ecoff_align_debug (abfd, debug, swap)
bfd *abfd ATTRIBUTE_UNUSED;
@ -1967,9 +1963,9 @@ lookup_line (abfd, debug_info, debug_swap, line_info)
boolean stabs;
FDR *fdr_ptr;
int i;
offset = line_info->cache.start;
/* Build FDR table (sorted by object file's base-address) if we
don't have it already. */
if (line_info->fdrtab == NULL
@ -1981,7 +1977,7 @@ lookup_line (abfd, debug_info, debug_swap, line_info)
/* find first FDR for address OFFSET */
i = fdrtab_lookup (line_info, offset);
if (i < 0)
return false; /* no FDR, no fun... */
return false; /* no FDR, no fun... */
fdr_ptr = tab[i].fdr;
/* Check whether this file has stabs debugging information. In a
@ -2046,9 +2042,9 @@ lookup_line (abfd, debug_info, debug_swap, line_info)
malloc.c. I'm not sure why this happens, but it could
be due to optimizations that reorder a function's
position within an object-file.
Strategy:
On the first call to this function, we build a table of FDRs
that is sorted by the base-address of the object-file the FDR
is referring to. Notice that each object-file may contain
@ -2079,9 +2075,9 @@ lookup_line (abfd, debug_info, debug_swap, line_info)
bfd_vma dist, min_dist = 0;
char *pdr_hold;
char *pdr_end;
fdr_ptr = tab[i].fdr;
pdr_ptr = ((char *) debug_info->external_pdr
+ fdr_ptr->ipdFirst * external_pdr_size);
pdr_end = pdr_ptr + fdr_ptr->cpd * external_pdr_size;
@ -2106,7 +2102,7 @@ lookup_line (abfd, debug_info, debug_swap, line_info)
}
}
}
if (!best_pdr || min_dist < best_dist)
{
best_dist = min_dist;
@ -2119,7 +2115,7 @@ lookup_line (abfd, debug_info, debug_swap, line_info)
&& tab[i].base_addr == tab[i - 1].base_addr);
if (!best_fdr || !best_pdr)
return false; /* shouldn't happen... */
return false; /* shouldn't happen... */
/* phew, finally we got something that we can hold onto: */
fdr_ptr = best_fdr;

View File

@ -1,5 +1,5 @@
/* Generic ECOFF swapping routines, for BFD.
Copyright 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
Copyright 1992, 1993, 1994, 1995, 1996, 2000 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@ -27,10 +27,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
on them in gdb by naming the including source file; e.g.,
'coff-mips.c':ecoff_swap_hdr_in.
Before including this header file, one of ECOFF_32 or ECOFF_64 must
be defined. These are checked when swapping information that
depends upon the target size. This code works for 32 bit and 64
bit ECOFF, but may need to be generalized in the future.
Before including this header file, one of ECOFF_32, ECOFF_64,
ECOFF_SIGNED_32 or ECOFF_SIGNED_64 must be defined. These are
checked when swapping information that depends upon the target
size. This code works for 32 bit and 64 bit ECOFF, but may need to
be generalized in the future.
Some header file which defines the external forms of these
structures must also be included before including this header file.
@ -50,6 +51,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define ecoff_get_off bfd_h_get_64
#define ecoff_put_off bfd_h_put_64
#endif
#ifdef ECOFF_SIGNED_32
#define ecoff_get_off bfd_h_get_signed_32
#define ecoff_put_off bfd_h_put_signed_32
#endif
#ifdef ECOFF_SIGNED_64
#define ecoff_get_off bfd_h_get_signed_64
#define ecoff_put_off bfd_h_put_signed_64
#endif
/* ECOFF auxiliary information swapping routines. These are the same
for all ECOFF targets, so they are defined in ecofflink.c. */
@ -122,7 +131,7 @@ ecoff_swap_hdr_in (abfd, ext_copy, intern)
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
abort();
abort ();
#endif
}
@ -167,7 +176,7 @@ ecoff_swap_hdr_out (abfd, intern_copy, ext_ptr)
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
abort();
abort ();
#endif
}
@ -182,10 +191,10 @@ ecoff_swap_fdr_in (abfd, ext_copy, intern)
struct fdr_ext ext[1];
*ext = *(struct fdr_ext *) ext_copy;
intern->adr = ecoff_get_off (abfd, (bfd_byte *)ext->f_adr);
intern->rss = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_rss);
#ifdef ECOFF_64
#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
if (intern->rss == 0xffffffff)
intern->rss = -1;
#endif
@ -197,11 +206,11 @@ ecoff_swap_fdr_in (abfd, ext_copy, intern)
intern->cline = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_cline);
intern->ioptBase = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_ioptBase);
intern->copt = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_copt);
#ifdef ECOFF_32
#if defined (ECOFF_32) || defined (ECOFF_SIGNED_32)
intern->ipdFirst = bfd_h_get_16 (abfd, (bfd_byte *)ext->f_ipdFirst);
intern->cpd = bfd_h_get_16 (abfd, (bfd_byte *)ext->f_cpd);
#endif
#ifdef ECOFF_64
#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
intern->ipdFirst = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_ipdFirst);
intern->cpd = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_cpd);
#endif
@ -210,7 +219,7 @@ ecoff_swap_fdr_in (abfd, ext_copy, intern)
intern->rfdBase = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_rfdBase);
intern->crfd = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_crfd);
/* now the fun stuff... */
/* now the fun stuff... */
if (bfd_header_big_endian (abfd)) {
intern->lang = (ext->f_bits1[0] & FDR_BITS1_LANG_BIG)
>> FDR_BITS1_LANG_SH_BIG;
@ -235,7 +244,7 @@ ecoff_swap_fdr_in (abfd, ext_copy, intern)
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
abort();
abort ();
#endif
}
@ -251,7 +260,7 @@ ecoff_swap_fdr_out (abfd, intern_copy, ext_ptr)
FDR intern[1];
*intern = *intern_copy; /* Make it reasonable to do in-place. */
ecoff_put_off (abfd, intern->adr, (bfd_byte *)ext->f_adr);
bfd_h_put_32 (abfd, intern->rss, (bfd_byte *)ext->f_rss);
bfd_h_put_32 (abfd, intern->issBase, (bfd_byte *)ext->f_issBase);
@ -262,11 +271,11 @@ ecoff_swap_fdr_out (abfd, intern_copy, ext_ptr)
bfd_h_put_32 (abfd, intern->cline, (bfd_byte *)ext->f_cline);
bfd_h_put_32 (abfd, intern->ioptBase, (bfd_byte *)ext->f_ioptBase);
bfd_h_put_32 (abfd, intern->copt, (bfd_byte *)ext->f_copt);
#ifdef ECOFF_32
#if defined (ECOFF_32) || defined (ECOFF_SIGNED_32)
bfd_h_put_16 (abfd, intern->ipdFirst, (bfd_byte *)ext->f_ipdFirst);
bfd_h_put_16 (abfd, intern->cpd, (bfd_byte *)ext->f_cpd);
#endif
#ifdef ECOFF_64
#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
bfd_h_put_32 (abfd, intern->ipdFirst, (bfd_byte *)ext->f_ipdFirst);
bfd_h_put_32 (abfd, intern->cpd, (bfd_byte *)ext->f_cpd);
#endif
@ -275,7 +284,7 @@ ecoff_swap_fdr_out (abfd, intern_copy, ext_ptr)
bfd_h_put_32 (abfd, intern->rfdBase, (bfd_byte *)ext->f_rfdBase);
bfd_h_put_32 (abfd, intern->crfd, (bfd_byte *)ext->f_crfd);
/* now the fun stuff... */
/* now the fun stuff... */
if (bfd_header_big_endian (abfd)) {
ext->f_bits1[0] = (((intern->lang << FDR_BITS1_LANG_SH_BIG)
& FDR_BITS1_LANG_BIG)
@ -303,7 +312,7 @@ ecoff_swap_fdr_out (abfd, intern_copy, ext_ptr)
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
abort();
abort ();
#endif
}
@ -341,7 +350,7 @@ ecoff_swap_pdr_in (abfd, ext_copy, intern)
intern->lnHigh = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_lnHigh);
intern->cbLineOffset = ecoff_get_off (abfd, (bfd_byte *)ext->p_cbLineOffset);
#ifdef ECOFF_64
#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
intern->gp_prologue = bfd_h_get_8 (abfd, (bfd_byte *) ext->p_gp_prologue);
if (bfd_header_big_endian (abfd))
{
@ -364,11 +373,11 @@ ecoff_swap_pdr_in (abfd, ext_copy, intern)
<< PDR_BITS2_RESERVED_SH_LEFT_LITTLE));
}
intern->localoff = bfd_h_get_8 (abfd, (bfd_byte *) ext->p_localoff);
#endif
#endif
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
abort();
abort ();
#endif
}
@ -384,7 +393,7 @@ ecoff_swap_pdr_out (abfd, intern_copy, ext_ptr)
PDR intern[1];
*intern = *intern_copy; /* Make it reasonable to do in-place. */
ecoff_put_off (abfd, intern->adr, (bfd_byte *)ext->p_adr);
bfd_h_put_32 (abfd, intern->isym, (bfd_byte *)ext->p_isym);
bfd_h_put_32 (abfd, intern->iline, (bfd_byte *)ext->p_iline);
@ -400,7 +409,7 @@ ecoff_swap_pdr_out (abfd, intern_copy, ext_ptr)
bfd_h_put_32 (abfd, intern->lnHigh, (bfd_byte *)ext->p_lnHigh);
ecoff_put_off (abfd, intern->cbLineOffset, (bfd_byte *)ext->p_cbLineOffset);
#ifdef ECOFF_64
#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
bfd_h_put_8 (abfd, intern->gp_prologue, (bfd_byte *) ext->p_gp_prologue);
if (bfd_header_big_endian (abfd))
{
@ -425,17 +434,17 @@ ecoff_swap_pdr_out (abfd, intern_copy, ext_ptr)
& PDR_BITS2_RESERVED_LITTLE);
}
bfd_h_put_8 (abfd, intern->localoff, (bfd_byte *) ext->p_localoff);
#endif
#endif
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
abort();
abort ();
#endif
}
#else /* MPW_C */
/* Same routines, but with ECOFF_64 code removed, so ^&%$#&! MPW C doesn't
corrupt itself and then freak out. */
corrupt itself and then freak out. */
/* Swap in the procedure descriptor record. */
static void
@ -447,7 +456,7 @@ ecoff_swap_pdr_in (abfd, ext_copy, intern)
struct pdr_ext ext[1];
*ext = *(struct pdr_ext *) ext_copy;
intern->adr = ecoff_get_off (abfd, (bfd_byte *)ext->p_adr);
intern->isym = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_isym);
intern->iline = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_iline);
@ -468,7 +477,7 @@ ecoff_swap_pdr_in (abfd, ext_copy, intern)
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
abort();
abort ();
#endif
}
@ -484,7 +493,7 @@ ecoff_swap_pdr_out (abfd, intern_copy, ext_ptr)
PDR intern[1];
*intern = *intern_copy; /* Make it reasonable to do in-place. */
ecoff_put_off (abfd, intern->adr, (bfd_byte *)ext->p_adr);
bfd_h_put_32 (abfd, intern->isym, (bfd_byte *)ext->p_isym);
bfd_h_put_32 (abfd, intern->iline, (bfd_byte *)ext->p_iline);
@ -502,7 +511,7 @@ ecoff_swap_pdr_out (abfd, intern_copy, ext_ptr)
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
abort();
abort ();
#endif
}
#endif /* MPW_C */
@ -518,11 +527,11 @@ ecoff_swap_sym_in (abfd, ext_copy, intern)
struct sym_ext ext[1];
*ext = *(struct sym_ext *) ext_copy;
intern->iss = bfd_h_get_32 (abfd, (bfd_byte *)ext->s_iss);
intern->value = ecoff_get_off (abfd, (bfd_byte *)ext->s_value);
/* now the fun stuff... */
/* now the fun stuff... */
if (bfd_header_big_endian (abfd)) {
intern->st = (ext->s_bits1[0] & SYM_BITS1_ST_BIG)
>> SYM_BITS1_ST_SH_BIG;
@ -552,7 +561,7 @@ ecoff_swap_sym_in (abfd, ext_copy, intern)
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
abort();
abort ();
#endif
}
@ -568,11 +577,11 @@ ecoff_swap_sym_out (abfd, intern_copy, ext_ptr)
SYMR intern[1];
*intern = *intern_copy; /* Make it reasonable to do in-place. */
bfd_h_put_32 (abfd, intern->iss, (bfd_byte *)ext->s_iss);
ecoff_put_off (abfd, intern->value, (bfd_byte *)ext->s_value);
/* now the fun stuff... */
/* now the fun stuff... */
if (bfd_header_big_endian (abfd)) {
ext->s_bits1[0] = (((intern->st << SYM_BITS1_ST_SH_BIG)
& SYM_BITS1_ST_BIG)
@ -601,7 +610,7 @@ ecoff_swap_sym_out (abfd, intern_copy, ext_ptr)
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
abort();
abort ();
#endif
}
@ -616,8 +625,8 @@ ecoff_swap_ext_in (abfd, ext_copy, intern)
struct ext_ext ext[1];
*ext = *(struct ext_ext *) ext_copy;
/* now the fun stuff... */
/* now the fun stuff... */
if (bfd_header_big_endian (abfd)) {
intern->jmptbl = 0 != (ext->es_bits1[0] & EXT_BITS1_JMPTBL_BIG);
intern->cobol_main = 0 != (ext->es_bits1[0] & EXT_BITS1_COBOL_MAIN_BIG);
@ -629,10 +638,10 @@ ecoff_swap_ext_in (abfd, ext_copy, intern)
}
intern->reserved = 0;
#ifdef ECOFF_32
#if defined (ECOFF_32) || defined (ECOFF_SIGNED_32)
intern->ifd = bfd_h_get_signed_16 (abfd, (bfd_byte *)ext->es_ifd);
#endif
#ifdef ECOFF_64
#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
intern->ifd = bfd_h_get_signed_32 (abfd, (bfd_byte *)ext->es_ifd);
#endif
@ -640,7 +649,7 @@ ecoff_swap_ext_in (abfd, ext_copy, intern)
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
abort();
abort ();
#endif
}
@ -656,14 +665,14 @@ ecoff_swap_ext_out (abfd, intern_copy, ext_ptr)
EXTR intern[1];
*intern = *intern_copy; /* Make it reasonable to do in-place. */
/* now the fun stuff... */
/* now the fun stuff... */
if (bfd_header_big_endian (abfd)) {
ext->es_bits1[0] = ((intern->jmptbl ? EXT_BITS1_JMPTBL_BIG : 0)
| (intern->cobol_main ? EXT_BITS1_COBOL_MAIN_BIG : 0)
| (intern->weakext ? EXT_BITS1_WEAKEXT_BIG : 0));
ext->es_bits2[0] = 0;
#ifdef ECOFF_64
#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
ext->es_bits2[1] = 0;
ext->es_bits2[2] = 0;
#endif
@ -672,16 +681,16 @@ ecoff_swap_ext_out (abfd, intern_copy, ext_ptr)
| (intern->cobol_main ? EXT_BITS1_COBOL_MAIN_LITTLE : 0)
| (intern->weakext ? EXT_BITS1_WEAKEXT_LITTLE : 0));
ext->es_bits2[0] = 0;
#ifdef ECOFF_64
#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
ext->es_bits2[1] = 0;
ext->es_bits2[2] = 0;
#endif
}
#ifdef ECOFF_32
#if defined (ECOFF_32) || defined (ECOFF_SIGNED_32)
bfd_h_put_signed_16 (abfd, intern->ifd, (bfd_byte *)ext->es_ifd);
#endif
#ifdef ECOFF_64
#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
bfd_h_put_signed_32 (abfd, intern->ifd, (bfd_byte *)ext->es_ifd);
#endif
@ -689,7 +698,7 @@ ecoff_swap_ext_out (abfd, intern_copy, ext_ptr)
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
abort();
abort ();
#endif
}
@ -707,7 +716,7 @@ ecoff_swap_rfd_in (abfd, ext_ptr, intern)
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
abort();
abort ();
#endif
}
@ -725,7 +734,7 @@ ecoff_swap_rfd_out (abfd, intern, ext_ptr)
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
abort();
abort ();
#endif
}
@ -766,7 +775,7 @@ ecoff_swap_opt_in (abfd, ext_copy, intern)
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
abort();
abort ();
#endif
}
@ -805,7 +814,7 @@ ecoff_swap_opt_out (abfd, intern_copy, ext_ptr)
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
abort();
abort ();
#endif
}
@ -826,7 +835,7 @@ ecoff_swap_dnr_in (abfd, ext_copy, intern)
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
abort();
abort ();
#endif
}
@ -848,6 +857,6 @@ ecoff_swap_dnr_out (abfd, intern_copy, ext_ptr)
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
abort();
abort ();
#endif
}

View File

@ -208,7 +208,7 @@ struct elf_link_local_dynamic_entry
/* The index in the outgoing dynamic symbol table. */
long dynindx;
/* A copy of the input symbol. */
Elf_Internal_Sym isym;
};
@ -243,6 +243,9 @@ struct elf_link_hash_table
PTR stab_info;
/* A linked list of local symbols to be added to .dynsym. */
struct elf_link_local_dynamic_entry *dynlocal;
/* A linked list of DT_RPATH/DT_RUNPATH names found in dynamic
objects included in the link. */
struct bfd_link_needed_list *runpath;
};
/* Look up an entry in an ELF linker hash table. */
@ -372,9 +375,9 @@ struct elf_backend_data
unsigned int));
/* A function to set the type of the info field. Processor-specific
types should be handled here. */
int (*elf_backend_get_symbol_type) PARAMS (( Elf_Internal_Sym *, int));
types should be handled here. */
int (*elf_backend_get_symbol_type) PARAMS (( Elf_Internal_Sym *, int));
/* A function to do additional processing on the ELF section header
just before writing it out. This is used to set the flags and
type fields for some sections, or to actually write out data for
@ -388,8 +391,13 @@ struct elf_backend_data
Elf32_Internal_Shdr *,
char *));
/* A function to convert machine dependent section header flags to
BFD internal section header flags. */
boolean (*elf_backend_section_flags) PARAMS ((flagword *,
Elf32_Internal_Shdr *));
/* A function to handle unusual program segment types when creating BFD
sections from ELF program segments. */
sections from ELF program segments. */
boolean (*elf_backend_section_from_phdr) PARAMS ((bfd *,
Elf32_Internal_Phdr *,
int));
@ -601,7 +609,7 @@ struct elf_backend_data
/* Modify any information related to dynamic linking such that the
symbol is not exported. */
void (*elf_backend_hide_symbol)
PARAMS ((struct elf_link_hash_entry *));
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
/* The swapping table to use when dealing with ECOFF information.
Used for the MIPS ELF .mdebug section. */
@ -638,7 +646,7 @@ struct elf_backend_data
both REL and RELA relocations, and this flag is set for those
backends.) */
unsigned may_use_rel_p : 1;
/* Whether the backend may use RELA relocations. (Some backends use
both REL and RELA relocations, and this flag is set for those
backends.) */
@ -647,8 +655,8 @@ struct elf_backend_data
/* Whether the default relocation type is RELA. If a backend with
this flag set wants REL relocations for a particular section,
it must note that explicitly. Similarly, if this flag is clear,
and the backend wants RELA relocations for a particular
section. */
and the backend wants RELA relocations for a particular
section. */
unsigned default_use_rela_p : 1;
/* True if addresses "naturally" sign extend. This is used when
@ -788,14 +796,14 @@ struct elf_obj_tdata
file_ptr next_file_pos;
#if 0
/* we don't need these inside bfd anymore, and I think
these weren't used outside bfd. */
these weren't used outside bfd. */
void *prstatus; /* The raw /proc prstatus structure */
void *prpsinfo; /* The raw /proc prpsinfo structure */
#endif
bfd_vma gp; /* The gp value (MIPS only, for now) */
unsigned int gp_size; /* The gp size (MIPS only, for now) */
/* Information grabbed from an elf core file. */
/* Information grabbed from an elf core file. */
int core_signal;
int core_pid;
int core_lwpid;
@ -817,7 +825,7 @@ struct elf_obj_tdata
document the intent of any particular piece of code. The field
should be used as a count until size_dynamic_sections, at which
point the contents of the .got is fixed. Afterward, if an entry
is -1, then the symbol does not require a global offset table entry. */
is -1, then the symbol does not require a global offset table entry. */
union
{
bfd_signed_vma *refcounts;
@ -838,6 +846,14 @@ struct elf_obj_tdata
one. */
const char *dt_name;
/* When a reference in a regular object is resolved by a shared
object is loaded into via the DT_NEEDED entries by the linker
ELF emulation code, we need to add the shared object to the
DT_NEEDED list of the resulting binary to indicate the dependency
as if the -l option is passed to the linker. This field holds the
name of the loaded shared object. */
const char *dt_soname;
/* Irix 5 often screws up the symbol table, sorting local symbols
after global symbols. This flag is set if the symbol table in
this BFD appears to be screwed up. If it is, we ignore the
@ -857,11 +873,11 @@ struct elf_obj_tdata
find_nearest_line. */
struct mips_elf_find_line *find_line_info;
/* A place to stash dwarf1 info for this bfd. */
/* A place to stash dwarf1 info for this bfd. */
struct dwarf1_debug *dwarf1_find_line_info;
/* A place to stash dwarf2 info for this bfd. */
struct dwarf2_debug *dwarf2_find_line_info;
/* A place to stash dwarf2 info for this bfd. */
PTR dwarf2_find_line_info;
/* An array of stub sections indexed by symbol number, used by the
MIPS ELF linker. FIXME: We should figure out some way to only
@ -885,6 +901,13 @@ struct elf_obj_tdata
/* Linker sections that we are interested in. */
struct elf_linker_section *linker_section[ (int)LINKER_SECTION_MAX ];
/* The Irix 5 support uses two virtual sections, which represent
text/data symbols defined in dynamic objects. */
asymbol *elf_data_symbol;
asymbol *elf_text_symbol;
asection *elf_data_section;
asection *elf_text_section;
};
#define elf_tdata(bfd) ((bfd) -> tdata.elf_obj_data)
@ -908,6 +931,7 @@ struct elf_obj_tdata
#define elf_local_got_offsets(bfd) (elf_tdata(bfd) -> local_got.offsets)
#define elf_local_ptr_offsets(bfd) (elf_tdata(bfd) -> linker_section_pointers)
#define elf_dt_name(bfd) (elf_tdata(bfd) -> dt_name)
#define elf_dt_soname(bfd) (elf_tdata(bfd) -> dt_soname)
#define elf_bad_symtab(bfd) (elf_tdata(bfd) -> bad_symtab)
#define elf_flags_init(bfd) (elf_tdata(bfd) -> flags_init)
#define elf_linker_section(bfd,n) (elf_tdata(bfd) -> linker_section[(int)n])
@ -970,7 +994,7 @@ extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create
extern void _bfd_elf_link_hash_copy_indirect
PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
extern void _bfd_elf_link_hash_hide_symbol
PARAMS ((struct elf_link_hash_entry *));
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
extern boolean _bfd_elf_link_hash_table_init
PARAMS ((struct elf_link_hash_table *, bfd *,
struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
@ -1006,14 +1030,14 @@ extern boolean _bfd_elf_set_arch_mach PARAMS ((bfd *, enum bfd_architecture,
unsigned long));
extern boolean _bfd_elf_find_nearest_line PARAMS ((bfd *, asection *,
asymbol **,
bfd_vma, CONST char **,
CONST char **,
bfd_vma, const char **,
const char **,
unsigned int *));
#define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols
#define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
extern int _bfd_elf_sizeof_headers PARAMS ((bfd *, boolean));
extern boolean _bfd_elf_new_section_hook PARAMS ((bfd *, asection *));
extern boolean _bfd_elf_init_reloc_shdr
extern boolean _bfd_elf_init_reloc_shdr
PARAMS ((bfd *, Elf_Internal_Shdr *, asection *, boolean));
/* If the target doesn't have reloc handling written yet: */
@ -1142,6 +1166,10 @@ extern long bfd_elf32_slurp_symbol_table
extern boolean bfd_elf32_write_shdrs_and_ehdr PARAMS ((bfd *));
extern int bfd_elf32_write_out_phdrs
PARAMS ((bfd *, const Elf_Internal_Phdr *, int));
extern void bfd_elf32_write_relocs
PARAMS ((bfd *, asection *, PTR));
extern boolean bfd_elf32_slurp_reloc_table
PARAMS ((bfd *, asection *, asymbol **, boolean));
extern boolean bfd_elf32_add_dynamic_entry
PARAMS ((struct bfd_link_info *, bfd_vma, bfd_vma));
extern boolean bfd_elf32_link_create_dynamic_sections
@ -1185,6 +1213,10 @@ extern long bfd_elf64_slurp_symbol_table
extern boolean bfd_elf64_write_shdrs_and_ehdr PARAMS ((bfd *));
extern int bfd_elf64_write_out_phdrs
PARAMS ((bfd *, const Elf_Internal_Phdr *, int));
extern void bfd_elf64_write_relocs
PARAMS ((bfd *, asection *, PTR));
extern boolean bfd_elf64_slurp_reloc_table
PARAMS ((bfd *, asection *, asymbol **, boolean));
extern boolean bfd_elf64_add_dynamic_entry
PARAMS ((struct bfd_link_info *, bfd_vma, bfd_vma));
extern boolean bfd_elf64_link_create_dynamic_sections
@ -1274,11 +1306,11 @@ extern boolean _bfd_mips_elf_finish_dynamic_symbol
Elf_Internal_Sym *));
extern boolean _bfd_mips_elf_finish_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
extern asection * _bfd_mips_elf_gc_mark_hook
extern asection * _bfd_mips_elf_gc_mark_hook
PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *,
struct elf_link_hash_entry *, Elf_Internal_Sym *));
extern boolean _bfd_mips_elf_gc_sweep_hook
PARAMS ((bfd *, struct bfd_link_info *, asection *,
extern boolean _bfd_mips_elf_gc_sweep_hook
PARAMS ((bfd *, struct bfd_link_info *, asection *,
const Elf_Internal_Rela *));
extern boolean _bfd_mips_elf_always_size_sections
PARAMS ((bfd *, struct bfd_link_info *));
@ -1289,7 +1321,7 @@ extern boolean _bfd_mips_elf_check_relocs
const Elf_Internal_Rela *));
extern struct bfd_link_hash_table *_bfd_mips_elf_link_hash_table_create
PARAMS ((bfd *));
extern boolean _bfd_mips_elf_print_private_bfd_data
extern boolean _bfd_mips_elf_print_private_bfd_data
PARAMS ((bfd *, PTR));
extern boolean _bfd_mips_elf_link_output_symbol_hook
PARAMS ((bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -58,6 +58,37 @@ elf_generic_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
bfd_reloc->howto = &dummy;
}
static boolean
elf32_generic_link_add_symbols (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
{
asection *o;
/* Check if there are any relocations. */
for (o = abfd->sections; o != NULL; o = o->next)
if ((o->flags & SEC_RELOC) != 0)
{
Elf_Internal_Ehdr *ehdrp;
ehdrp = elf_elfheader (abfd);
if (abfd->my_archive)
(*_bfd_error_handler) (_("%s(%s): Relocations in generic ELF (EM: %d)"),
bfd_get_filename (abfd->my_archive),
bfd_get_filename (abfd),
ehdrp->e_machine);
else
(*_bfd_error_handler) (_("%s: Relocations in generic ELF (EM: %d)"),
bfd_get_filename (abfd),
ehdrp->e_machine);
bfd_set_error (bfd_error_wrong_format);
return false;
}
return bfd_elf32_bfd_link_add_symbols (abfd, info);
}
#define TARGET_LITTLE_SYM bfd_elf32_little_generic_vec
#define TARGET_LITTLE_NAME "elf32-little"
#define TARGET_BIG_SYM bfd_elf32_big_generic_vec
@ -66,6 +97,7 @@ elf_generic_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
#define ELF_MACHINE_CODE EM_NONE
#define ELF_MAXPAGESIZE 0x1
#define bfd_elf32_bfd_reloc_type_lookup bfd_default_reloc_type_lookup
#define bfd_elf32_bfd_link_add_symbols elf32_generic_link_add_symbols
#define elf_info_to_howto elf_generic_info_to_howto
#define elf_info_to_howto_rel elf_generic_info_to_howto_rel

View File

@ -1,5 +1,6 @@
/* Intel 80386/80486-specific support for 32-bit ELF
Copyright 1993, 94-98, 1999 Free Software Foundation, Inc.
Copyright 1993, 94, 95, 96, 97, 98, 99, 2000
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@ -56,35 +57,66 @@ static boolean elf_i386_finish_dynamic_sections
static reloc_howto_type elf_howto_table[]=
{
HOWTO(R_386_NONE, 0,0, 0,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_NONE", true,0x00000000,0x00000000,false),
HOWTO(R_386_32, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_32", true,0xffffffff,0xffffffff,false),
HOWTO(R_386_PC32, 0,2,32,true, 0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_PC32", true,0xffffffff,0xffffffff,true),
HOWTO(R_386_GOT32, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_GOT32", true,0xffffffff,0xffffffff,false),
HOWTO(R_386_PLT32, 0,2,32,true,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_PLT32", true,0xffffffff,0xffffffff,true),
HOWTO(R_386_COPY, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_COPY", true,0xffffffff,0xffffffff,false),
HOWTO(R_386_GLOB_DAT, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_GLOB_DAT", true,0xffffffff,0xffffffff,false),
HOWTO(R_386_JUMP_SLOT, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_JUMP_SLOT",true,0xffffffff,0xffffffff,false),
HOWTO(R_386_RELATIVE, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_RELATIVE", true,0xffffffff,0xffffffff,false),
HOWTO(R_386_GOTOFF, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_GOTOFF", true,0xffffffff,0xffffffff,false),
HOWTO(R_386_GOTPC, 0,2,32,true,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_GOTPC", true,0xffffffff,0xffffffff,true),
EMPTY_HOWTO (11),
EMPTY_HOWTO (12),
EMPTY_HOWTO (13),
EMPTY_HOWTO (14),
EMPTY_HOWTO (15),
EMPTY_HOWTO (16),
EMPTY_HOWTO (17),
EMPTY_HOWTO (18),
EMPTY_HOWTO (19),
HOWTO(R_386_NONE, 0, 0, 0, false, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_NONE",
true, 0x00000000, 0x00000000, false),
HOWTO(R_386_32, 0, 2, 32, false, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_32",
true, 0xffffffff, 0xffffffff, false),
HOWTO(R_386_PC32, 0, 2, 32, true, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_PC32",
true, 0xffffffff, 0xffffffff, true),
HOWTO(R_386_GOT32, 0, 2, 32, false, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_GOT32",
true, 0xffffffff, 0xffffffff, false),
HOWTO(R_386_PLT32, 0, 2, 32, true, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_PLT32",
true, 0xffffffff, 0xffffffff, true),
HOWTO(R_386_COPY, 0, 2, 32, false, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_COPY",
true, 0xffffffff, 0xffffffff, false),
HOWTO(R_386_GLOB_DAT, 0, 2, 32, false, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_GLOB_DAT",
true, 0xffffffff, 0xffffffff, false),
HOWTO(R_386_JUMP_SLOT, 0, 2, 32, false, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_JUMP_SLOT",
true, 0xffffffff, 0xffffffff, false),
HOWTO(R_386_RELATIVE, 0, 2, 32, false, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_RELATIVE",
true, 0xffffffff, 0xffffffff, false),
HOWTO(R_386_GOTOFF, 0, 2, 32, false, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_GOTOFF",
true, 0xffffffff, 0xffffffff, false),
HOWTO(R_386_GOTPC, 0, 2, 32, true, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_GOTPC",
true, 0xffffffff, 0xffffffff, true),
/* We have a gap in the reloc numbers here.
R_386_standard counts the number up to this point, and
R_386_ext_offset is the value to subtract from a reloc type of
R_386_16 thru R_386_PC8 to form an index into this table. */
#define R_386_standard ((unsigned int) R_386_GOTPC + 1)
#define R_386_ext_offset ((unsigned int) R_386_16 - R_386_standard)
/* The remaining relocs are a GNU extension. */
HOWTO(R_386_16, 0,1,16,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_16", true,0xffff,0xffff,false),
HOWTO(R_386_PC16, 0,1,16,true, 0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_PC16", true,0xffff,0xffff,true),
HOWTO(R_386_8, 0,0,8,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_8", true,0xff,0xff,false),
HOWTO(R_386_PC8, 0,0,8,true, 0,complain_overflow_signed, bfd_elf_generic_reloc,"R_386_PC8", true,0xff,0xff,true),
};
HOWTO(R_386_16, 0, 1, 16, false, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_16",
true, 0xffff, 0xffff, false),
HOWTO(R_386_PC16, 0, 1, 16, true, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_PC16",
true, 0xffff, 0xffff, true),
HOWTO(R_386_8, 0, 0, 8, false, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_8",
true, 0xff, 0xff, false),
HOWTO(R_386_PC8, 0, 0, 8, true, 0, complain_overflow_signed,
bfd_elf_generic_reloc, "R_386_PC8",
true, 0xff, 0xff, true),
/* Another gap. */
#define R_386_ext ((unsigned int) R_386_PC8 + 1 - R_386_ext_offset)
#define R_386_vt_offset ((unsigned int) R_386_GNU_VTINHERIT - R_386_ext)
/* GNU extension to record C++ vtable hierarchy. */
static reloc_howto_type elf32_i386_vtinherit_howto =
HOWTO (R_386_GNU_VTINHERIT, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@ -97,10 +129,9 @@ static reloc_howto_type elf32_i386_vtinherit_howto =
false, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
false);
false),
/* GNU extension to record C++ vtable member usage. */
static reloc_howto_type elf32_i386_vtentry_howto =
HOWTO (R_386_GNU_VTENTRY, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@ -113,7 +144,11 @@ static reloc_howto_type elf32_i386_vtentry_howto =
false, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
false);
false)
#define R_386_vt ((unsigned int) R_386_GNU_VTENTRY + 1 - R_386_vt_offset)
};
#ifdef DEBUG_GEN_RELOC
#define TRACE(str) fprintf (stderr, "i386 bfd reloc lookup %d (%s)\n", code, str)
@ -130,76 +165,78 @@ elf_i386_reloc_type_lookup (abfd, code)
{
case BFD_RELOC_NONE:
TRACE ("BFD_RELOC_NONE");
return &elf_howto_table[ (int)R_386_NONE ];
return &elf_howto_table[(unsigned int) R_386_NONE ];
case BFD_RELOC_32:
TRACE ("BFD_RELOC_32");
return &elf_howto_table[ (int)R_386_32 ];
return &elf_howto_table[(unsigned int) R_386_32 ];
case BFD_RELOC_CTOR:
TRACE ("BFD_RELOC_CTOR");
return &elf_howto_table[ (int)R_386_32 ];
return &elf_howto_table[(unsigned int) R_386_32 ];
case BFD_RELOC_32_PCREL:
TRACE ("BFD_RELOC_PC32");
return &elf_howto_table[ (int)R_386_PC32 ];
return &elf_howto_table[(unsigned int) R_386_PC32 ];
case BFD_RELOC_386_GOT32:
TRACE ("BFD_RELOC_386_GOT32");
return &elf_howto_table[ (int)R_386_GOT32 ];
return &elf_howto_table[(unsigned int) R_386_GOT32 ];
case BFD_RELOC_386_PLT32:
TRACE ("BFD_RELOC_386_PLT32");
return &elf_howto_table[ (int)R_386_PLT32 ];
return &elf_howto_table[(unsigned int) R_386_PLT32 ];
case BFD_RELOC_386_COPY:
TRACE ("BFD_RELOC_386_COPY");
return &elf_howto_table[ (int)R_386_COPY ];
return &elf_howto_table[(unsigned int) R_386_COPY ];
case BFD_RELOC_386_GLOB_DAT:
TRACE ("BFD_RELOC_386_GLOB_DAT");
return &elf_howto_table[ (int)R_386_GLOB_DAT ];
return &elf_howto_table[(unsigned int) R_386_GLOB_DAT ];
case BFD_RELOC_386_JUMP_SLOT:
TRACE ("BFD_RELOC_386_JUMP_SLOT");
return &elf_howto_table[ (int)R_386_JUMP_SLOT ];
return &elf_howto_table[(unsigned int) R_386_JUMP_SLOT ];
case BFD_RELOC_386_RELATIVE:
TRACE ("BFD_RELOC_386_RELATIVE");
return &elf_howto_table[ (int)R_386_RELATIVE ];
return &elf_howto_table[(unsigned int) R_386_RELATIVE ];
case BFD_RELOC_386_GOTOFF:
TRACE ("BFD_RELOC_386_GOTOFF");
return &elf_howto_table[ (int)R_386_GOTOFF ];
return &elf_howto_table[(unsigned int) R_386_GOTOFF ];
case BFD_RELOC_386_GOTPC:
TRACE ("BFD_RELOC_386_GOTPC");
return &elf_howto_table[ (int)R_386_GOTPC ];
return &elf_howto_table[(unsigned int) R_386_GOTPC ];
/* The remaining relocs are a GNU extension. */
case BFD_RELOC_16:
TRACE ("BFD_RELOC_16");
return &elf_howto_table[(int) R_386_16];
return &elf_howto_table[(unsigned int) R_386_16 - R_386_ext_offset];
case BFD_RELOC_16_PCREL:
TRACE ("BFD_RELOC_16_PCREL");
return &elf_howto_table[(int) R_386_PC16];
return &elf_howto_table[(unsigned int) R_386_PC16 - R_386_ext_offset];
case BFD_RELOC_8:
TRACE ("BFD_RELOC_8");
return &elf_howto_table[(int) R_386_8];
return &elf_howto_table[(unsigned int) R_386_8 - R_386_ext_offset];
case BFD_RELOC_8_PCREL:
TRACE ("BFD_RELOC_8_PCREL");
return &elf_howto_table[(int) R_386_PC8];
return &elf_howto_table[(unsigned int) R_386_PC8 - R_386_ext_offset];
case BFD_RELOC_VTABLE_INHERIT:
TRACE ("BFD_RELOC_VTABLE_INHERIT");
return &elf32_i386_vtinherit_howto;
return &elf_howto_table[(unsigned int) R_386_GNU_VTINHERIT
- R_386_vt_offset];
case BFD_RELOC_VTABLE_ENTRY:
TRACE ("BFD_RELOC_VTABLE_ENTRY");
return &elf32_i386_vtentry_howto;
return &elf_howto_table[(unsigned int) R_386_GNU_VTENTRY
- R_386_vt_offset];
default:
break;
@ -224,22 +261,20 @@ elf_i386_info_to_howto_rel (abfd, cache_ptr, dst)
arelent *cache_ptr;
Elf32_Internal_Rel *dst;
{
enum elf_i386_reloc_type type;
unsigned int r_type = ELF32_R_TYPE (dst->r_info);
unsigned int indx;
type = (enum elf_i386_reloc_type) ELF32_R_TYPE (dst->r_info);
if (type == R_386_GNU_VTINHERIT)
cache_ptr->howto = &elf32_i386_vtinherit_howto;
else if (type == R_386_GNU_VTENTRY)
cache_ptr->howto = &elf32_i386_vtentry_howto;
else if (type < R_386_max
&& (type < FIRST_INVALID_RELOC || type > LAST_INVALID_RELOC))
cache_ptr->howto = &elf_howto_table[(int) type];
else
if ((indx = r_type) >= R_386_standard
&& ((indx = r_type - R_386_ext_offset) - R_386_standard
>= R_386_ext - R_386_standard)
&& ((indx = r_type - R_386_vt_offset) - R_386_ext
>= R_386_vt - R_386_ext))
{
(*_bfd_error_handler) (_("%s: invalid relocation type %d"),
bfd_get_filename (abfd), (int) type);
cache_ptr->howto = &elf_howto_table[(int) R_386_NONE];
bfd_get_filename (abfd), (int) r_type);
indx = (unsigned int) R_386_NONE;
}
cache_ptr->howto = &elf_howto_table[indx];
}
/* Return whether a symbol name implies a local label. The UnixWare
@ -439,7 +474,7 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
bfd *dynobj;
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
bfd_vma *local_got_offsets;
bfd_signed_vma *local_got_refcounts;
const Elf_Internal_Rela *rel;
const Elf_Internal_Rela *rel_end;
asection *sgot;
@ -452,7 +487,7 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
dynobj = elf_hash_table (info)->dynobj;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
local_got_offsets = elf_local_got_offsets (abfd);
local_got_refcounts = elf_local_got_refcounts (abfd);
sgot = NULL;
srelgot = NULL;
@ -522,57 +557,54 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
if (h != NULL)
{
if (h->got.offset != (bfd_vma) -1)
if (h->got.refcount == -1)
{
/* We have already allocated space in the .got. */
break;
}
h->got.offset = sgot->_raw_size;
h->got.refcount = 1;
/* Make sure this symbol is output as a dynamic symbol. */
if (h->dynindx == -1)
{
if (! bfd_elf32_link_record_dynamic_symbol (info, h))
return false;
}
/* Make sure this symbol is output as a dynamic symbol. */
if (h->dynindx == -1)
{
if (! bfd_elf32_link_record_dynamic_symbol (info, h))
return false;
}
srelgot->_raw_size += sizeof (Elf32_External_Rel);
sgot->_raw_size += 4;
srelgot->_raw_size += sizeof (Elf32_External_Rel);
}
else
h->got.refcount += 1;
}
else
{
/* This is a global offset table entry for a local
symbol. */
if (local_got_offsets == NULL)
/* This is a global offset table entry for a local symbol. */
if (local_got_refcounts == NULL)
{
size_t size;
register unsigned int i;
size = symtab_hdr->sh_info * sizeof (bfd_vma);
local_got_offsets = (bfd_vma *) bfd_alloc (abfd, size);
if (local_got_offsets == NULL)
size = symtab_hdr->sh_info * sizeof (bfd_signed_vma);
local_got_refcounts = ((bfd_signed_vma *)
bfd_alloc (abfd, size));
if (local_got_refcounts == NULL)
return false;
elf_local_got_offsets (abfd) = local_got_offsets;
for (i = 0; i < symtab_hdr->sh_info; i++)
local_got_offsets[i] = (bfd_vma) -1;
elf_local_got_refcounts (abfd) = local_got_refcounts;
memset (local_got_refcounts, -1, size);
}
if (local_got_offsets[r_symndx] != (bfd_vma) -1)
if (local_got_refcounts[r_symndx] == -1)
{
/* We have already allocated space in the .got. */
break;
}
local_got_offsets[r_symndx] = sgot->_raw_size;
local_got_refcounts[r_symndx] = 1;
if (info->shared)
{
/* If we are generating a shared object, we need to
output a R_386_RELATIVE reloc so that the dynamic
linker can adjust this GOT entry. */
srelgot->_raw_size += sizeof (Elf32_External_Rel);
sgot->_raw_size += 4;
if (info->shared)
{
/* If we are generating a shared object, we need to
output a R_386_RELATIVE reloc so that the dynamic
linker can adjust this GOT entry. */
srelgot->_raw_size += sizeof (Elf32_External_Rel);
}
}
else
local_got_refcounts[r_symndx] += 1;
}
sgot->_raw_size += 4;
break;
case R_386_PLT32:
@ -588,8 +620,13 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
if (h == NULL)
continue;
h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
if (h->plt.refcount == -1)
{
h->plt.refcount = 1;
h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
}
else
h->plt.refcount += 1;
break;
case R_386_32:
@ -598,28 +635,33 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
/* If we are creating a shared library, and this is a reloc
against a global symbol, or a non PC relative reloc
against a local symbol, then we need to copy the reloc
into the shared library. However, if we are linking with
-Bsymbolic, we do not need to copy a reloc against a
global symbol which is defined in an object we are
including in the link (i.e., DEF_REGULAR is set). At
this point we have not seen all the input files, so it is
possible that DEF_REGULAR is not set now but will be set
later (it is never cleared). We account for that
possibility below by storing information in the
pcrel_relocs_copied field of the hash table entry. */
against a global symbol, or a non PC relative reloc
against a local symbol, then we need to copy the reloc
into the shared library. However, if we are linking with
-Bsymbolic, we do not need to copy a reloc against a
global symbol which is defined in an object we are
including in the link (i.e., DEF_REGULAR is set). At
this point we have not seen all the input files, so it is
possible that DEF_REGULAR is not set now but will be set
later (it is never cleared). In case of a weak definition,
DEF_REGULAR may be cleared later by a strong definition in
a shared library. We account for that possibility below by
storing information in the relocs_copied field of the hash
table entry. A similar situation occurs when creating
shared libraries and symbol visibility changes render the
symbol local. */
if (info->shared
&& (sec->flags & SEC_ALLOC) != 0
&& (ELF32_R_TYPE (rel->r_info) != R_386_PC32
|| (h != NULL
&& (! info->symbolic
|| h->root.type == bfd_link_hash_defweak
|| (h->elf_link_hash_flags
& ELF_LINK_HASH_DEF_REGULAR) == 0))))
{
/* When creating a shared object, we must copy these
reloc types into the output file. We create a reloc
section in dynobj and make room for this reloc. */
reloc types into the output file. We create a reloc
section in dynobj and make room for this reloc. */
if (sreloc == NULL)
{
const char *name;
@ -631,9 +673,20 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
if (name == NULL)
return false;
BFD_ASSERT (strncmp (name, ".rel", 4) == 0
&& strcmp (bfd_get_section_name (abfd, sec),
name + 4) == 0);
if (strncmp (name, ".rel", 4) != 0
|| strcmp (bfd_get_section_name (abfd, sec),
name + 4) != 0)
{
if (abfd->my_archive)
(*_bfd_error_handler) (_("%s(%s): bad relocation section name `%s\'"),
bfd_get_filename (abfd->my_archive),
bfd_get_filename (abfd),
name);
else
(*_bfd_error_handler) (_("%s: bad relocation section name `%s\'"),
bfd_get_filename (abfd),
name);
}
sreloc = bfd_get_section_by_name (dynobj, name);
if (sreloc == NULL)
@ -654,15 +707,13 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
sreloc->_raw_size += sizeof (Elf32_External_Rel);
/* If we are linking with -Bsymbolic, and this is a
global symbol, we count the number of PC relative
relocations we have entered for this symbol, so that
we can discard them again if the symbol is later
defined by a regular object. Note that this function
is only called if we are using an elf_i386 linker
hash table, which means that h is really a pointer to
an elf_i386_link_hash_entry. */
if (h != NULL && info->symbolic
/* If this is a global symbol, we count the number of PC
relative relocations we have entered for this symbol,
so that we can discard them later as necessary. Note
that this function is only called if we are using an
elf_i386 linker hash table, which means that h is
really a pointer to an elf_i386_link_hash_entry. */
if (h != NULL
&& ELF32_R_TYPE (rel->r_info) == R_386_PC32)
{
struct elf_i386_link_hash_entry *eh;
@ -766,14 +817,81 @@ elf_i386_gc_mark_hook (abfd, info, rel, h, sym)
static boolean
elf_i386_gc_sweep_hook (abfd, info, sec, relocs)
bfd *abfd ATTRIBUTE_UNUSED;
bfd *abfd;
struct bfd_link_info *info ATTRIBUTE_UNUSED;
asection *sec ATTRIBUTE_UNUSED;
const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED;
asection *sec;
const Elf_Internal_Rela *relocs;
{
/* ??? It would seem that the existing i386 code does no sort
of reference counting or whatnot on its GOT and PLT entries,
so it is not possible to garbage collect them at this time. */
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
bfd_signed_vma *local_got_refcounts;
const Elf_Internal_Rela *rel, *relend;
unsigned long r_symndx;
struct elf_link_hash_entry *h;
bfd *dynobj;
asection *sgot;
asection *srelgot;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
local_got_refcounts = elf_local_got_refcounts (abfd);
dynobj = elf_hash_table (info)->dynobj;
if (dynobj == NULL)
return true;
sgot = bfd_get_section_by_name (dynobj, ".got");
srelgot = bfd_get_section_by_name (dynobj, ".rel.got");
relend = relocs + sec->reloc_count;
for (rel = relocs; rel < relend; rel++)
switch (ELF32_R_TYPE (rel->r_info))
{
case R_386_GOT32:
case R_386_GOTOFF:
case R_386_GOTPC:
r_symndx = ELF32_R_SYM (rel->r_info);
if (r_symndx >= symtab_hdr->sh_info)
{
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
if (h->got.refcount > 0)
{
h->got.refcount -= 1;
if (h->got.refcount == 0)
{
sgot->_raw_size -= 4;
srelgot->_raw_size -= sizeof (Elf32_External_Rel);
}
}
}
else if (local_got_refcounts != NULL)
{
if (local_got_refcounts[r_symndx] > 0)
{
local_got_refcounts[r_symndx] -= 1;
if (local_got_refcounts[r_symndx] == 0)
{
sgot->_raw_size -= 4;
if (info->shared)
srelgot->_raw_size -= sizeof (Elf32_External_Rel);
}
}
}
break;
case R_386_PLT32:
r_symndx = ELF32_R_SYM (rel->r_info);
if (r_symndx >= symtab_hdr->sh_info)
{
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
if (h->plt.refcount > 0)
h->plt.refcount -= 1;
}
break;
default:
break;
}
return true;
}
@ -812,16 +930,18 @@ elf_i386_adjust_dynamic_symbol (info, h)
if (h->type == STT_FUNC
|| (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
{
if (! info->shared
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
&& (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0)
if ((! info->shared
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
&& (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0)
|| (info->shared && h->plt.refcount <= 0))
{
/* This case can occur if we saw a PLT32 reloc in an input
file, but the symbol was never referred to by a dynamic
object. In such a case, we don't actually need to build
a procedure linkage table, and we can just do a PC32
reloc instead. */
BFD_ASSERT ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0);
file, but the symbol was never referred to by a dynamic
object, or if all references were garbage collected. In
such a case, we don't actually need to build a procedure
linkage table, and we can just do a PC32 reloc instead. */
h->plt.offset = (bfd_vma) -1;
h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
return true;
}
@ -859,13 +979,11 @@ elf_i386_adjust_dynamic_symbol (info, h)
/* We also need to make an entry in the .got.plt section, which
will be placed in the .got section by the linker script. */
s = bfd_get_section_by_name (dynobj, ".got.plt");
BFD_ASSERT (s != NULL);
s->_raw_size += 4;
/* We also need to make an entry in the .rel.plt section. */
s = bfd_get_section_by_name (dynobj, ".rel.plt");
BFD_ASSERT (s != NULL);
s->_raw_size += sizeof (Elf32_External_Rel);
@ -995,10 +1113,10 @@ elf_i386_size_dynamic_sections (output_bfd, info)
PC relative relocs against symbols defined in a regular object.
We allocated space for them in the check_relocs routine, but we
will not fill them in in the relocate_section routine. */
if (info->shared && info->symbolic)
if (info->shared)
elf_i386_link_hash_traverse (elf_i386_hash_table (info),
elf_i386_discard_copies,
(PTR) NULL);
(PTR) info);
/* The check_relocs and adjust_dynamic_symbol entry points have
determined the sizes of the various dynamic sections. Allocate
@ -1092,8 +1210,12 @@ elf_i386_size_dynamic_sections (output_bfd, info)
continue;
}
/* Allocate memory for the section contents. */
s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size);
/* Allocate memory for the section contents. We use bfd_zalloc
here in case unused entries are not reclaimed before the
section's contents are written out. This should not happen,
but this way if it does, we get a R_386_NONE reloc instead
of garbage. */
s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
if (s->contents == NULL && s->_raw_size != 0)
return false;
}
@ -1133,6 +1255,7 @@ elf_i386_size_dynamic_sections (output_bfd, info)
{
if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0))
return false;
info->flags |= DF_TEXTREL;
}
}
@ -1140,26 +1263,32 @@ elf_i386_size_dynamic_sections (output_bfd, info)
}
/* This function is called via elf_i386_link_hash_traverse if we are
creating a shared object with -Bsymbolic. It discards the space
allocated to copy PC relative relocs against symbols which are
defined in regular objects. We allocated space for them in the
creating a shared object. In the -Bsymbolic case, it discards the
space allocated to copy PC relative relocs against symbols which
are defined in regular objects. For the normal non-symbolic case,
we also discard space for relocs that have become local due to
symbol visibility changes. We allocated space for them in the
check_relocs routine, but we won't fill them in in the
relocate_section routine. */
/*ARGSUSED*/
static boolean
elf_i386_discard_copies (h, ignore)
elf_i386_discard_copies (h, inf)
struct elf_i386_link_hash_entry *h;
PTR ignore ATTRIBUTE_UNUSED;
PTR inf;
{
struct elf_i386_pcrel_relocs_copied *s;
struct bfd_link_info *info = (struct bfd_link_info *) inf;
/* We only discard relocs for symbols defined in a regular object. */
if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
return true;
for (s = h->pcrel_relocs_copied; s != NULL; s = s->next)
s->section->_raw_size -= s->count * sizeof (Elf32_External_Rel);
/* If a symbol has been forced local or we have found a regular
definition for the symbolic link case, then we won't be needing
any relocs. */
if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0
&& ((h->root.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0
|| info->symbolic))
{
for (s = h->pcrel_relocs_copied; s != NULL; s = s->next)
s->section->_raw_size -= s->count * sizeof (Elf32_External_Rel);
}
return true;
}
@ -1193,9 +1322,14 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
sym_hashes = elf_sym_hashes (input_bfd);
local_got_offsets = elf_local_got_offsets (input_bfd);
sgot = NULL;
splt = NULL;
sreloc = NULL;
splt = NULL;
sgot = NULL;
if (dynobj != NULL)
{
splt = bfd_get_section_by_name (dynobj, ".plt");
sgot = bfd_get_section_by_name (dynobj, ".got");
}
rel = relocs;
relend = relocs + input_section->reloc_count;
@ -1209,20 +1343,21 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
asection *sec;
bfd_vma relocation;
bfd_reloc_status_type r;
unsigned int indx;
r_type = ELF32_R_TYPE (rel->r_info);
if (r_type == R_386_GNU_VTINHERIT
|| r_type == R_386_GNU_VTENTRY)
if (r_type == (int) R_386_GNU_VTINHERIT
|| r_type == (int) R_386_GNU_VTENTRY)
continue;
if (r_type < 0
|| r_type >= (int) R_386_max
|| (r_type >= (int) FIRST_INVALID_RELOC
&& r_type <= (int) LAST_INVALID_RELOC))
if ((indx = (unsigned) r_type) >= R_386_standard
&& ((indx = (unsigned) r_type - R_386_ext_offset) - R_386_standard
>= R_386_ext - R_386_standard))
{
bfd_set_error (bfd_error_bad_value);
return false;
}
howto = elf_howto_table + r_type;
howto = elf_howto_table + indx;
r_symndx = ELF32_R_SYM (rel->r_info);
@ -1273,6 +1408,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
sec = h->root.u.def.section;
if (r_type == R_386_GOTPC
|| (r_type == R_386_PLT32
&& splt != NULL
&& h->plt.offset != (bfd_vma) -1)
|| (r_type == R_386_GOT32
&& elf_hash_table (info)->dynamic_sections_created
@ -1336,11 +1472,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
case R_386_GOT32:
/* Relocation is to the entry for this symbol in the global
offset table. */
if (sgot == NULL)
{
sgot = bfd_get_section_by_name (dynobj, ".got");
BFD_ASSERT (sgot != NULL);
}
BFD_ASSERT (sgot != NULL);
if (h != NULL)
{
@ -1459,12 +1591,13 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
/* Relocation is to the entry for this symbol in the
procedure linkage table. */
/* Resolve a PLT32 reloc again a local symbol directly,
/* Resolve a PLT32 reloc against a local symbol directly,
without using the procedure linkage table. */
if (h == NULL)
break;
if (h->plt.offset == (bfd_vma) -1)
if (h->plt.offset == (bfd_vma) -1
|| splt == NULL)
{
/* We didn't make a PLT entry for this symbol. This
happens when statically linking PIC code, or when
@ -1472,12 +1605,6 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
break;
}
if (splt == NULL)
{
splt = bfd_get_section_by_name (dynobj, ".plt");
BFD_ASSERT (splt != NULL);
}
relocation = (splt->output_section->vma
+ splt->output_offset
+ h->plt.offset);
@ -1513,10 +1640,22 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
if (name == NULL)
return false;
BFD_ASSERT (strncmp (name, ".rel", 4) == 0
&& strcmp (bfd_get_section_name (input_bfd,
input_section),
name + 4) == 0);
if (strncmp (name, ".rel", 4) != 0
|| strcmp (bfd_get_section_name (input_bfd,
input_section),
name + 4) != 0)
{
if (input_bfd->my_archive)
(*_bfd_error_handler) (_("%s(%s): bad relocation section name `%s\'"),
bfd_get_filename (input_bfd->my_archive),
bfd_get_filename (input_bfd),
name);
else
(*_bfd_error_handler) (_("%s: bad relocation section name `%s\'"),
bfd_get_filename (input_bfd),
name);
return false;
}
sreloc = bfd_get_section_by_name (dynobj, name);
BFD_ASSERT (sreloc != NULL);
@ -1744,17 +1883,21 @@ elf_i386_finish_dynamic_symbol (output_bfd, info, h, sym)
+ sgot->output_offset
+ (h->got.offset &~ 1));
/* If this is a -Bsymbolic link, and the symbol is defined
locally, we just want to emit a RELATIVE reloc. Likewise if
the symbol was forced to be local because of a version file.
/* If this is a static link, or it is a -Bsymbolic link and the
symbol is defined locally or was forced to be local because
of a version file, we just want to emit a RELATIVE reloc.
The entry in the global offset table will already have been
initialized in the relocate_section function. */
if (info->shared
&& (info->symbolic || h->dynindx == -1)
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
rel.r_info = ELF32_R_INFO (0, R_386_RELATIVE);
if (! elf_hash_table (info)->dynamic_sections_created
|| (info->shared
&& (info->symbolic || h->dynindx == -1)
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
{
rel.r_info = ELF32_R_INFO (0, R_386_RELATIVE);
}
else
{
BFD_ASSERT((h->got.offset & 1) == 0);
bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset);
rel.r_info = ELF32_R_INFO (h->dynindx, R_386_GLOB_DAT);
}
@ -1928,27 +2071,6 @@ elf_i386_finish_dynamic_sections (output_bfd, info)
#define ELF_ARCH bfd_arch_i386
#define ELF_MACHINE_CODE EM_386
#define ELF_MAXPAGESIZE 0x1000
#define elf_info_to_howto elf_i386_info_to_howto
#define elf_info_to_howto_rel elf_i386_info_to_howto_rel
#define bfd_elf32_bfd_reloc_type_lookup elf_i386_reloc_type_lookup
#define bfd_elf32_bfd_is_local_label_name \
elf_i386_is_local_label_name
#define elf_backend_create_dynamic_sections \
_bfd_elf_create_dynamic_sections
#define bfd_elf32_bfd_link_hash_table_create \
elf_i386_link_hash_table_create
#define elf_backend_check_relocs elf_i386_check_relocs
#define elf_backend_adjust_dynamic_symbol \
elf_i386_adjust_dynamic_symbol
#define elf_backend_size_dynamic_sections \
elf_i386_size_dynamic_sections
#define elf_backend_relocate_section elf_i386_relocate_section
#define elf_backend_finish_dynamic_symbol \
elf_i386_finish_dynamic_symbol
#define elf_backend_finish_dynamic_sections \
elf_i386_finish_dynamic_sections
#define elf_backend_gc_mark_hook elf_i386_gc_mark_hook
#define elf_backend_gc_sweep_hook elf_i386_gc_sweep_hook
#define elf_backend_can_gc_sections 1
#define elf_backend_want_got_plt 1
@ -1957,4 +2079,22 @@ elf_i386_finish_dynamic_sections (output_bfd, info)
#define elf_backend_got_header_size 12
#define elf_backend_plt_header_size PLT_ENTRY_SIZE
#define elf_info_to_howto elf_i386_info_to_howto
#define elf_info_to_howto_rel elf_i386_info_to_howto_rel
#define bfd_elf32_bfd_final_link _bfd_elf32_gc_common_final_link
#define bfd_elf32_bfd_is_local_label_name elf_i386_is_local_label_name
#define bfd_elf32_bfd_link_hash_table_create elf_i386_link_hash_table_create
#define bfd_elf32_bfd_reloc_type_lookup elf_i386_reloc_type_lookup
#define elf_backend_adjust_dynamic_symbol elf_i386_adjust_dynamic_symbol
#define elf_backend_check_relocs elf_i386_check_relocs
#define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections
#define elf_backend_finish_dynamic_sections elf_i386_finish_dynamic_sections
#define elf_backend_finish_dynamic_symbol elf_i386_finish_dynamic_symbol
#define elf_backend_gc_mark_hook elf_i386_gc_mark_hook
#define elf_backend_gc_sweep_hook elf_i386_gc_sweep_hook
#define elf_backend_relocate_section elf_i386_relocate_section
#define elf_backend_size_dynamic_sections elf_i386_size_dynamic_sections
#include "elf32-target.h"

File diff suppressed because it is too large Load Diff

View File

@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/sparc.h"
#include "opcode/sparc.h"
static reloc_howto_type *elf32_sparc_reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type));
@ -36,6 +37,8 @@ static boolean elf32_sparc_adjust_dynamic_symbol
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
static boolean elf32_sparc_size_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
static boolean elf32_sparc_relax_section
PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *));
static boolean elf32_sparc_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
@ -126,7 +129,6 @@ static reloc_howto_type elf32_sparc_vtinherit_howto =
static reloc_howto_type elf32_sparc_vtentry_howto =
HOWTO (R_SPARC_GNU_VTENTRY, 0,2,0,false,0,complain_overflow_dont, _bfd_elf_rel_vtable_reloc_fn,"R_SPARC_GNU_VTENTRY", false,0,0, false);
struct elf_reloc_map {
bfd_reloc_code_real_type bfd_reloc_val;
unsigned char elf_reloc_val;
@ -185,7 +187,7 @@ elf32_sparc_reloc_type_lookup (abfd, code)
bfd_reloc_code_real_type code;
{
unsigned int i;
switch (code)
{
case BFD_RELOC_VTABLE_INHERIT:
@ -1016,7 +1018,12 @@ elf32_sparc_size_dynamic_sections (output_bfd, info)
}
/* Allocate memory for the section contents. */
s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size);
/* FIXME: This should be a call to bfd_alloc not bfd_zalloc.
Unused entries should be reclaimed before the section's contents
are written out, but at the moment this does not happen. Thus in
order to prevent writing out garbage, we initialise the section's
contents to zero. */
s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
if (s->contents == NULL && s->_raw_size != 0)
return false;
}
@ -1053,12 +1060,28 @@ elf32_sparc_size_dynamic_sections (output_bfd, info)
{
if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0))
return false;
info->flags |= DF_TEXTREL;
}
}
return true;
}
#define SET_SEC_DO_RELAX(section) do { elf_section_data(section)->tdata = (void *)1; } while (0)
#define SEC_DO_RELAX(section) (elf_section_data(section)->tdata == (void *)1)
static boolean
elf32_sparc_relax_section (abfd, section, link_info, again)
bfd *abfd ATTRIBUTE_UNUSED;
asection *section ATTRIBUTE_UNUSED;
struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
boolean *again;
{
*again = false;
SET_SEC_DO_RELAX (section);
return true;
}
/* Relocate a SPARC ELF section. */
static boolean
@ -1113,7 +1136,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
r_type = ELF32_R_TYPE (rel->r_info);
if (r_type == R_SPARC_GNU_VTINHERIT
if (r_type == R_SPARC_GNU_VTINHERIT
|| r_type == R_SPARC_GNU_VTENTRY)
continue;
@ -1518,6 +1541,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
break;
}
r = bfd_reloc_continue;
if (r_type == R_SPARC_WDISP16)
{
bfd_vma x;
@ -1549,12 +1573,101 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_putl32 (/*input_bfd,*/ x, contents + rel->r_offset);
r = bfd_reloc_ok;
}
else
else if ((r_type == R_SPARC_WDISP30 || r_type == R_SPARC_WPLT30)
&& SEC_DO_RELAX (input_section)
&& rel->r_offset + 4 < input_section->_raw_size)
{
#define G0 0
#define O7 15
#define XCC (2 << 20)
#define COND(x) (((x)&0xf)<<25)
#define CONDA COND(0x8)
#define INSN_BPA (F2(0,1) | CONDA | BPRED | XCC)
#define INSN_BA (F2(0,2) | CONDA)
#define INSN_OR F3(2, 0x2, 0)
#define INSN_NOP F2(0,4)
bfd_vma x, y;
/* If the instruction is a call with either:
restore
arithmetic instruction with rd == %o7
where rs1 != %o7 and rs2 if it is register != %o7
then we can optimize if the call destination is near
by changing the call into a branch always. */
x = bfd_get_32 (input_bfd, contents + rel->r_offset);
y = bfd_get_32 (input_bfd, contents + rel->r_offset + 4);
if ((x & OP(~0)) == OP(1) && (y & OP(~0)) == OP(2))
{
if (((y & OP3(~0)) == OP3(0x3d) /* restore */
|| ((y & OP3(0x28)) == 0 /* arithmetic */
&& (y & RD(~0)) == RD(O7)))
&& (y & RS1(~0)) != RS1(O7)
&& ((y & F3I(~0))
|| (y & RS2(~0)) != RS2(O7)))
{
bfd_vma reloc;
reloc = relocation + rel->r_addend - rel->r_offset;
reloc -= (input_section->output_section->vma
+ input_section->output_offset);
/* Ensure the reloc fits into simm22. */
if ((reloc & 3) == 0
&& ((reloc & ~(bfd_vma)0x7fffff) == 0
|| ((reloc | 0x7fffff) == ~(bfd_vma)0)))
{
reloc >>= 2;
/* Check whether it fits into simm19 on v9. */
if (((reloc & 0x3c0000) == 0
|| (reloc & 0x3c0000) == 0x3c0000)
&& (elf_elfheader (output_bfd)->e_flags & EF_SPARC_32PLUS))
x = INSN_BPA | (reloc & 0x7ffff); /* ba,pt %xcc */
else
x = INSN_BA | (reloc & 0x3fffff); /* ba */
bfd_put_32 (input_bfd, x, contents + rel->r_offset);
r = bfd_reloc_ok;
if (rel->r_offset >= 4
&& (y & (0xffffffff ^ RS1(~0)))
== (INSN_OR | RD(O7) | RS2(G0)))
{
bfd_vma z;
unsigned int reg;
z = bfd_get_32 (input_bfd,
contents + rel->r_offset - 4);
if ((z & (0xffffffff ^ RD(~0)))
!= (INSN_OR | RS1(O7) | RS2(G0)))
break;
/* The sequence was
or %o7, %g0, %rN
call foo
or %rN, %g0, %o7
If call foo was replaced with ba, replace
or %rN, %g0, %o7 with nop. */
reg = (y & RS1(~0)) >> 14;
if (reg != ((z & RD(~0)) >> 25)
|| reg == G0 || reg == O7)
break;
bfd_put_32 (input_bfd, INSN_NOP,
contents + rel->r_offset + 4);
}
}
}
}
}
if (r == bfd_reloc_continue)
r = _bfd_final_link_relocate (howto, input_bfd, input_section,
contents, rel->r_offset,
relocation, rel->r_addend);
if (r != bfd_reloc_ok)
{
switch (r)
@ -1842,33 +1955,6 @@ elf32_sparc_merge_private_bfd_data (ibfd, obfd)
error = false;
#if 0
/* ??? The native linker doesn't do this so we can't (otherwise gcc would
have to know which linker is being used). Instead, the native linker
bumps up the architecture level when it has to. However, I still think
warnings like these are good, so it would be nice to have them turned on
by some option. */
/* If the output machine is normal sparc, we can't allow v9 input files. */
if (bfd_get_mach (obfd) == bfd_mach_sparc
&& (bfd_get_mach (ibfd) == bfd_mach_sparc_v8plus
|| bfd_get_mach (ibfd) == bfd_mach_sparc_v8plusa))
{
error = true;
(*_bfd_error_handler)
(_("%s: compiled for a v8plus system and target is v8"),
bfd_get_filename (ibfd));
}
/* If the output machine is v9, we can't allow v9+vis input files. */
if (bfd_get_mach (obfd) == bfd_mach_sparc_v8plus
&& bfd_get_mach (ibfd) == bfd_mach_sparc_v8plusa)
{
error = true;
(*_bfd_error_handler)
(_("%s: compiled for a v8plusa system and target is v8plus"),
bfd_get_filename (ibfd));
}
#else
if (bfd_get_mach (ibfd) >= bfd_mach_sparc_v9)
{
error = true;
@ -1881,7 +1967,6 @@ elf32_sparc_merge_private_bfd_data (ibfd, obfd)
if (bfd_get_mach (obfd) < bfd_get_mach (ibfd))
bfd_set_arch_mach (obfd, bfd_arch_sparc, bfd_get_mach (ibfd));
}
#endif
if (((elf_elfheader (ibfd)->e_flags & EF_SPARC_LEDATA)
!= previous_ibfd_e_flags)
@ -1911,7 +1996,10 @@ elf32_sparc_object_p (abfd)
{
if (elf_elfheader (abfd)->e_machine == EM_SPARC32PLUS)
{
if (elf_elfheader (abfd)->e_flags & EF_SPARC_SUN_US1)
if (elf_elfheader (abfd)->e_flags & EF_SPARC_SUN_US3)
return bfd_default_set_arch_mach (abfd, bfd_arch_sparc,
bfd_mach_sparc_v8plusb);
else if (elf_elfheader (abfd)->e_flags & EF_SPARC_SUN_US1)
return bfd_default_set_arch_mach (abfd, bfd_arch_sparc,
bfd_mach_sparc_v8plusa);
else if (elf_elfheader (abfd)->e_flags & EF_SPARC_32PLUS)
@ -1949,6 +2037,12 @@ elf32_sparc_final_write_processing (abfd, linker)
elf_elfheader (abfd)->e_flags &=~ EF_SPARC_32PLUS_MASK;
elf_elfheader (abfd)->e_flags |= EF_SPARC_32PLUS | EF_SPARC_SUN_US1;
break;
case bfd_mach_sparc_v8plusb :
elf_elfheader (abfd)->e_machine = EM_SPARC32PLUS;
elf_elfheader (abfd)->e_flags &=~ EF_SPARC_32PLUS_MASK;
elf_elfheader (abfd)->e_flags |= EF_SPARC_32PLUS | EF_SPARC_SUN_US1
| EF_SPARC_SUN_US3;
break;
case bfd_mach_sparc_sparclite_le :
elf_elfheader (abfd)->e_machine = EM_SPARC;
elf_elfheader (abfd)->e_flags |= EF_SPARC_LEDATA;
@ -1967,6 +2061,7 @@ elf32_sparc_final_write_processing (abfd, linker)
#define ELF_MAXPAGESIZE 0x10000
#define bfd_elf32_bfd_reloc_type_lookup elf32_sparc_reloc_type_lookup
#define bfd_elf32_bfd_relax_section elf32_sparc_relax_section
#define elf_info_to_howto elf32_sparc_info_to_howto
#define elf_backend_create_dynamic_sections \
_bfd_elf_create_dynamic_sections

View File

@ -17,12 +17,9 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* XXX FIXME: This code is littered with 32bit int, 16bit short, 8bit char
dependencies. As is the gas & simulator code or the v850. */
#include "bfd.h"
#include "sysdep.h"
#include "bfdlink.h"
@ -32,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* sign-extend a 24-bit number */
#define SEXT24(x) ((((x) & 0xffffff) ^ (~ 0x7fffff)) + 0x800000)
static reloc_howto_type *v850_elf_reloc_type_lookup
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
static void v850_elf_info_to_howto_rel
@ -103,7 +100,7 @@ static reloc_howto_type v850_elf_howto_table[] =
0, /* dst_mask */
false), /* pcrel_offset */
/* A PC relative 9 bit branch. */
/* A PC relative 9 bit branch. */
HOWTO (R_V850_9_PCREL, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@ -118,7 +115,7 @@ static reloc_howto_type v850_elf_howto_table[] =
0x00ffffff, /* dst_mask */
true), /* pcrel_offset */
/* A PC relative 22 bit branch. */
/* A PC relative 22 bit branch. */
HOWTO (R_V850_22_PCREL, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@ -312,7 +309,7 @@ static reloc_howto_type v850_elf_howto_table[] =
0x7f, /* src_mask */
0x7f, /* dst_mask */
false), /* pcrel_offset */
/* 7 bit offset from the tiny data area pointer. */
HOWTO (R_V850_TDA_7_7_OFFSET, /* type */
0, /* rightshift */
@ -462,7 +459,7 @@ static reloc_howto_type v850_elf_howto_table[] =
0, /* src_mask */
0, /* dst_mask */
false), /* pcrel_offset */
};
/* Map BFD reloc types to V850 ELF reloc types. */
@ -504,7 +501,6 @@ static const struct v850_elf_reloc_map v850_elf_reloc_map[] =
{ BFD_RELOC_VTABLE_ENTRY, R_V850_GNU_VTENTRY },
};
/* Map a bfd relocation into the appropriate howto structure */
static reloc_howto_type *
@ -521,14 +517,13 @@ v850_elf_reloc_type_lookup (abfd, code)
if (v850_elf_reloc_map[i].bfd_reloc_val == code)
{
BFD_ASSERT (v850_elf_howto_table[v850_elf_reloc_map[i].elf_reloc_val].type == v850_elf_reloc_map[i].elf_reloc_val);
return & v850_elf_howto_table[v850_elf_reloc_map[i].elf_reloc_val];
}
}
return NULL;
}
/* Set the howto pointer for an V850 ELF reloc. */
static void
@ -544,7 +539,7 @@ v850_elf_info_to_howto_rel (abfd, cache_ptr, dst)
cache_ptr->howto = &v850_elf_howto_table[r_type];
}
/* Set the howto pointer for a V850 ELF reloc (type RELA). */
/* Set the howto pointer for a V850 ELF reloc (type RELA). */
static void
v850_elf_info_to_howto_rela (abfd, cache_ptr, dst)
bfd * abfd ATTRIBUTE_UNUSED;
@ -557,7 +552,6 @@ v850_elf_info_to_howto_rela (abfd, cache_ptr, dst)
BFD_ASSERT (r_type < (unsigned int) R_V850_max);
cache_ptr->howto = &v850_elf_howto_table[r_type];
}
/* Look through the relocs for a section during the first phase, and
allocate space in the global offset table or procedure linkage
@ -644,14 +638,14 @@ v850_elf_check_relocs (abfd, info, sec, relocs)
other = V850_OTHER_SDA;
common = ".scommon";
goto small_data_common;
case R_V850_ZDA_16_16_SPLIT_OFFSET:
case R_V850_ZDA_16_16_OFFSET:
case R_V850_ZDA_15_16_OFFSET:
other = V850_OTHER_ZDA;
common = ".zcommon";
goto small_data_common;
case R_V850_TDA_4_5_OFFSET:
case R_V850_TDA_4_4_OFFSET:
case R_V850_TDA_6_8_OFFSET:
@ -760,21 +754,21 @@ remember_hi16s_reloc (abfd, addend, address)
bfd_byte * address;
{
hi16s_location * entry = NULL;
/* Find a free structure. */
if (free_hi16s == NULL)
free_hi16s = (hi16s_location *) bfd_zalloc (abfd, sizeof (* free_hi16s));
entry = free_hi16s;
free_hi16s = free_hi16s->next;
entry->addend = addend;
entry->address = address;
entry->counter = hi16s_counter ++;
entry->found = false;
entry->next = previous_hi16s;
previous_hi16s = entry;
/* Cope with wrap around of our counter. */
if (hi16s_counter == 0)
{
@ -784,7 +778,7 @@ remember_hi16s_reloc (abfd, addend, address)
hi16s_counter = 0x10000;
}
return;
}
@ -798,7 +792,7 @@ find_remembered_hi16s_reloc (addend, already_found)
hi16s_location * previous = NULL;
hi16s_location * prev;
bfd_byte * addr;
/* Search the table. Record the most recent entry that matches. */
for (entry = previous_hi16s; entry; entry = entry->next)
{
@ -808,7 +802,7 @@ find_remembered_hi16s_reloc (addend, already_found)
previous = prev;
match = entry;
}
prev = entry;
}
@ -824,9 +818,9 @@ find_remembered_hi16s_reloc (addend, already_found)
/* Note that this entry has now been used. */
match->found = true;
return addr;
}
}
/* FIXME: The code here probably ought to be removed and the code in reloc.c
allowed to do its stuff instead. At least for most of the relocs, anwyay. */
@ -839,62 +833,62 @@ v850_elf_perform_relocation (abfd, r_type, addend, address)
{
unsigned long insn;
bfd_signed_vma saddend = (bfd_signed_vma) addend;
switch (r_type)
{
default:
/* fprintf (stderr, "reloc type %d not SUPPORTED\n", r_type ); */
return bfd_reloc_notsupported;
case R_V850_32:
bfd_put_32 (abfd, addend, address);
return bfd_reloc_ok;
case R_V850_22_PCREL:
if (saddend > 0x1fffff || saddend < -0x200000)
return bfd_reloc_overflow;
if ((addend % 2) != 0)
return bfd_reloc_dangerous;
insn = bfd_get_32 (abfd, address);
insn &= ~0xfffe003f;
insn |= (((addend & 0xfffe) << 16) | ((addend & 0x3f0000) >> 16));
bfd_put_32 (abfd, insn, address);
return bfd_reloc_ok;
case R_V850_9_PCREL:
if (saddend > 0xff || saddend < -0x100)
return bfd_reloc_overflow;
if ((addend % 2) != 0)
return bfd_reloc_dangerous;
insn = bfd_get_16 (abfd, address);
insn &= ~ 0xf870;
insn |= ((addend & 0x1f0) << 7) | ((addend & 0x0e) << 3);
break;
case R_V850_HI16:
addend += (bfd_get_16 (abfd, address) << 16);
addend = (addend >> 16);
insn = addend;
break;
case R_V850_HI16_S:
/* Remember where this relocation took place. */
remember_hi16s_reloc (abfd, addend, address);
addend += (bfd_get_16 (abfd, address) << 16);
addend = (addend >> 16) + ((addend & 0x8000) != 0);
/* This relocation cannot overflow. */
/* This relocation cannot overflow. */
if (addend > 0x7fff)
addend = 0;
insn = addend;
break;
case R_V850_LO16:
/* Calculate the sum of the value stored in the instruction and the
addend and check for overflow from the low 16 bits into the high
@ -972,7 +966,6 @@ v850_elf_perform_relocation (abfd, r_type, addend, address)
------------
0x00116fff = fred + 0x10ffff = 0x7000 + 0x10ffff
Overflow can also occur if the computation carries into the 16th bit
and it also results in the 15th bit having the same value as the 15th
bit of the original value. What happens is that the HI16S reloc
@ -1007,7 +1000,7 @@ v850_elf_perform_relocation (abfd, r_type, addend, address)
+ 0x00006fff
------------
0x00006fff but 'fred + 0x7000' = 0x00016fff
Note - there is no need to change anything if a carry occurs, and the
15th bit changes its value from being set to being clear, as the HI16S
reloc will have already added in 1 to the high part for us:
@ -1046,7 +1039,7 @@ v850_elf_perform_relocation (abfd, r_type, addend, address)
#define BIT15_SET(x) ((x) & 0x8000)
#define OVERFLOWS(a,i) ((((a) & 0xffff) + (i)) > 0xffff)
if ((BIT15_SET (result) && ! BIT15_SET (addend))
|| (OVERFLOWS (addend, insn)
&& ((! BIT15_SET (insn)) || (BIT15_SET (addend)))))
@ -1054,7 +1047,7 @@ v850_elf_perform_relocation (abfd, r_type, addend, address)
boolean already_updated;
bfd_byte * hi16s_address = find_remembered_hi16s_reloc
(addend, & already_updated);
/* Amend the matching HI16_S relocation. */
if (hi16s_address != NULL)
{
@ -1071,7 +1064,7 @@ v850_elf_perform_relocation (abfd, r_type, addend, address)
return bfd_reloc_overflow;
}
}
/* Do not complain if value has top bit set, as this has been anticipated. */
insn = result & 0xffff;
break;
@ -1081,7 +1074,7 @@ v850_elf_perform_relocation (abfd, r_type, addend, address)
addend += (char) bfd_get_8 (abfd, address);
saddend = (bfd_signed_vma) addend;
if (saddend > 0x7f || saddend < -0x80)
return bfd_reloc_overflow;
@ -1090,150 +1083,150 @@ v850_elf_perform_relocation (abfd, r_type, addend, address)
case R_V850_CALLT_16_16_OFFSET:
addend += bfd_get_16 (abfd, address);
saddend = (bfd_signed_vma) addend;
if (saddend > 0xffff || saddend < 0)
return bfd_reloc_overflow;
insn = addend;
break;
case R_V850_16:
/* drop through */
/* drop through */
case R_V850_SDA_16_16_OFFSET:
case R_V850_ZDA_16_16_OFFSET:
case R_V850_TDA_16_16_OFFSET:
addend += bfd_get_16 (abfd, address);
saddend = (bfd_signed_vma) addend;
if (saddend > 0x7fff || saddend < -0x8000)
return bfd_reloc_overflow;
insn = addend;
break;
case R_V850_SDA_15_16_OFFSET:
case R_V850_ZDA_15_16_OFFSET:
insn = bfd_get_16 (abfd, address);
addend += (insn & 0xfffe);
saddend = (bfd_signed_vma) addend;
if (saddend > 0x7ffe || saddend < -0x8000)
return bfd_reloc_overflow;
if (addend & 1)
return bfd_reloc_dangerous;
insn = (addend & ~1) | (insn & 1);
break;
case R_V850_TDA_6_8_OFFSET:
insn = bfd_get_16 (abfd, address);
addend += ((insn & 0x7e) << 1);
saddend = (bfd_signed_vma) addend;
if (saddend > 0xfc || saddend < 0)
return bfd_reloc_overflow;
if (addend & 3)
return bfd_reloc_dangerous;
insn &= 0xff81;
insn |= (addend >> 1);
break;
case R_V850_TDA_7_8_OFFSET:
insn = bfd_get_16 (abfd, address);
addend += ((insn & 0x7f) << 1);
saddend = (bfd_signed_vma) addend;
if (saddend > 0xfe || saddend < 0)
return bfd_reloc_overflow;
if (addend & 1)
return bfd_reloc_dangerous;
insn &= 0xff80;
insn |= (addend >> 1);
break;
case R_V850_TDA_7_7_OFFSET:
insn = bfd_get_16 (abfd, address);
addend += insn & 0x7f;
saddend = (bfd_signed_vma) addend;
if (saddend > 0x7f || saddend < 0)
return bfd_reloc_overflow;
insn &= 0xff80;
insn |= addend;
break;
case R_V850_TDA_4_5_OFFSET:
insn = bfd_get_16 (abfd, address);
addend += ((insn & 0xf) << 1);
saddend = (bfd_signed_vma) addend;
if (saddend > 0x1e || saddend < 0)
return bfd_reloc_overflow;
if (addend & 1)
return bfd_reloc_dangerous;
insn &= 0xfff0;
insn |= (addend >> 1);
break;
case R_V850_TDA_4_4_OFFSET:
insn = bfd_get_16 (abfd, address);
addend += insn & 0xf;
saddend = (bfd_signed_vma) addend;
if (saddend > 0xf || saddend < 0)
return bfd_reloc_overflow;
insn &= 0xfff0;
insn |= addend;
break;
case R_V850_ZDA_16_16_SPLIT_OFFSET:
case R_V850_SDA_16_16_SPLIT_OFFSET:
insn = bfd_get_32 (abfd, address);
addend += ((insn & 0xfffe0000) >> 16) + ((insn & 0x20) >> 5);
saddend = (bfd_signed_vma) addend;
if (saddend > 0x7fff || saddend < -0x8000)
return bfd_reloc_overflow;
insn &= 0x0001ffdf;
insn |= (addend & 1) << 5;
insn |= (addend & ~1) << 16;
bfd_put_32 (abfd, insn, address);
return bfd_reloc_ok;
case R_V850_CALLT_6_7_OFFSET:
insn = bfd_get_16 (abfd, address);
addend += ((insn & 0x3f) << 1);
saddend = (bfd_signed_vma) addend;
if (saddend > 0x7e || saddend < 0)
return bfd_reloc_overflow;
if (addend & 1)
return bfd_reloc_dangerous;
insn &= 0xff80;
insn |= (addend >> 1);
break;
@ -1247,7 +1240,6 @@ v850_elf_perform_relocation (abfd, r_type, addend, address)
bfd_put_16 (abfd, insn, address);
return bfd_reloc_ok;
}
/* Insert the addend into the instruction. */
static bfd_reloc_status_type
@ -1261,7 +1253,7 @@ v850_elf_reloc (abfd, reloc, symbol, data, isection, obfd, err)
char ** err ATTRIBUTE_UNUSED;
{
long relocation;
/* If there is an output BFD,
and the symbol is not a section name (which is only defined at final link time),
and either we are not putting the addend into the instruction
@ -1275,13 +1267,13 @@ v850_elf_reloc (abfd, reloc, symbol, data, isection, obfd, err)
reloc->address += isection->output_offset;
return bfd_reloc_ok;
}
#if 0
#if 0
else if (obfd != NULL)
{
return bfd_reloc_continue;
}
#endif
/* Catch relocs involving undefined symbols. */
if (bfd_is_und_section (symbol->section)
&& (symbol->flags & BSF_WEAK) == 0
@ -1293,37 +1285,51 @@ v850_elf_reloc (abfd, reloc, symbol, data, isection, obfd, err)
/* Is the address of the relocation really within the section? */
if (reloc->address > isection->_cooked_size)
return bfd_reloc_outofrange;
/* Work out which section the relocation is targetted at and the
initial relocation command value. */
/* Get symbol value. (Common symbols are special.) */
if (bfd_is_com_section (symbol->section))
relocation = 0;
else
relocation = symbol->value;
/* Convert input-section-relative symbol value to absolute + addend. */
relocation += symbol->section->output_section->vma;
relocation += symbol->section->output_offset;
relocation += reloc->addend;
#if 0 /* Since this reloc is going to be processed later on, we should
not make it pc-relative here. To test this, try assembling and
linking this program:
.text
.globl _start
nop
_start:
jr foo
.section ".foo","ax"
nop
foo:
nop
*/
if (reloc->howto->pc_relative == true)
{
/* Here the variable relocation holds the final address of the
symbol we are relocating against, plus any addend. */
relocation -= isection->output_section->vma + isection->output_offset;
/* Deal with pcrel_offset */
relocation -= reloc->address;
}
#endif
reloc->addend = relocation;
reloc->addend = relocation;
return bfd_reloc_ok;
}
/*ARGSUSED*/
static boolean
v850_elf_is_local_label_name (abfd, name)
bfd * abfd ATTRIBUTE_UNUSED;
@ -1332,7 +1338,6 @@ v850_elf_is_local_label_name (abfd, name)
return ( (name[0] == '.' && (name[1] == 'L' || name[1] == '.'))
|| (name[0] == '_' && name[1] == '.' && name[2] == 'L' && name[3] == '_'));
}
/* Perform a relocation as part of a final link. */
static bfd_reloc_status_type
@ -1362,7 +1367,7 @@ v850_elf_final_link_relocate (howto, input_bfd, output_bfd,
+ input_section->output_offset);
value -= offset;
break;
case R_V850_22_PCREL:
value -= (input_section->output_section->vma
+ input_section->output_offset
@ -1371,10 +1376,10 @@ v850_elf_final_link_relocate (howto, input_bfd, output_bfd,
/* If the sign extension will corrupt the value then we have overflowed. */
if (((value & 0xff000000) != 0x0) && ((value & 0xff000000) != 0xff000000))
return bfd_reloc_overflow;
value = SEXT24 (value); /* Only the bottom 24 bits of the PC are valid */
break;
case R_V850_HI16_S:
case R_V850_HI16:
case R_V850_LO16:
@ -1383,12 +1388,12 @@ v850_elf_final_link_relocate (howto, input_bfd, output_bfd,
case R_V850_8:
break;
case R_V850_ZDA_15_16_OFFSET:
case R_V850_ZDA_15_16_OFFSET:
case R_V850_ZDA_16_16_OFFSET:
case R_V850_ZDA_16_16_SPLIT_OFFSET:
if (sym_sec == NULL)
return bfd_reloc_undefined;
value -= sym_sec->output_section->vma;
break;
@ -1401,7 +1406,7 @@ v850_elf_final_link_relocate (howto, input_bfd, output_bfd,
if (sym_sec == NULL)
return bfd_reloc_undefined;
/* Get the value of __gp. */
h = bfd_link_hash_lookup (info->hash, "__gp", false, false, true);
if (h == (struct bfd_link_hash_entry *) NULL
@ -1426,12 +1431,12 @@ v850_elf_final_link_relocate (howto, input_bfd, output_bfd,
{
unsigned long ep;
struct bfd_link_hash_entry * h;
/* Get the value of __ep. */
h = bfd_link_hash_lookup (info->hash, "__ep", false, false, true);
if (h == (struct bfd_link_hash_entry *) NULL
|| h->type != bfd_link_hash_defined)
return bfd_reloc_continue; /* Actually this indicates that __ep could not be found. */
return bfd_reloc_continue; /* Actually this indicates that __ep could not be found. */
ep = (h->u.def.value
+ h->u.def.section->output_section->vma
@ -1440,17 +1445,17 @@ v850_elf_final_link_relocate (howto, input_bfd, output_bfd,
value -= ep;
}
break;
case R_V850_CALLT_6_7_OFFSET:
{
unsigned long ctbp;
struct bfd_link_hash_entry * h;
/* Get the value of __ctbp. */
h = bfd_link_hash_lookup (info->hash, "__ctbp", false, false, true);
if (h == (struct bfd_link_hash_entry *) NULL
|| h->type != bfd_link_hash_defined)
return (bfd_reloc_dangerous + 1); /* Actually this indicates that __ctbp could not be found. */
return (bfd_reloc_dangerous + 1); /* Actually this indicates that __ctbp could not be found. */
ctbp = (h->u.def.value
+ h->u.def.section->output_section->vma
@ -1458,7 +1463,7 @@ v850_elf_final_link_relocate (howto, input_bfd, output_bfd,
value -= ctbp;
}
break;
case R_V850_CALLT_16_16_OFFSET:
{
unsigned long ctbp;
@ -1466,7 +1471,7 @@ v850_elf_final_link_relocate (howto, input_bfd, output_bfd,
if (sym_sec == NULL)
return bfd_reloc_undefined;
/* Get the value of __ctbp. */
h = bfd_link_hash_lookup (info->hash, "__ctbp", false, false, true);
if (h == (struct bfd_link_hash_entry *) NULL
@ -1481,7 +1486,7 @@ v850_elf_final_link_relocate (howto, input_bfd, output_bfd,
value -= (ctbp - sym_sec->output_section->vma);
}
break;
case R_V850_NONE:
case R_V850_GNU_VTINHERIT:
case R_V850_GNU_VTENTRY:
@ -1492,9 +1497,8 @@ v850_elf_final_link_relocate (howto, input_bfd, output_bfd,
}
/* Perform the relocation. */
return v850_elf_perform_relocation (input_bfd, r_type, value + addend, hit_data);
return v850_elf_perform_relocation (input_bfd, r_type, value + addend, hit_data);
}
/* Relocate an V850 ELF section. */
static boolean
@ -1524,12 +1528,12 @@ v850_elf_relocate_section (output_bfd, info, input_bfd, input_section,
return false;
}
/* Reset the list of remembered HI16S relocs to empty. */
free_hi16s = previous_hi16s;
previous_hi16s = NULL;
hi16s_counter = 0;
rel = relocs;
relend = relocs + input_section->reloc_count;
for (; rel < relend; rel++)
@ -1596,11 +1600,11 @@ fprintf (stderr, "local: sec: %s, sym: %s (%d), value: %x + %x + %x addend %x\n"
else
{
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
if (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
{
@ -1696,7 +1700,7 @@ fprintf (stderr, "unknown: name: %s\n", h->root.root.string);
case (bfd_reloc_dangerous + 1):
msg = _("could not locate special linker symbol __ctbp");
goto common_error;
default:
msg = _("internal error: unknown error");
/* fall through */
@ -1803,7 +1807,7 @@ v850_elf_final_write_processing (abfd, linker)
elf_elfheader (abfd)->e_flags |= val;
}
/* Function to keep V850 specific file flags. */
/* Function to keep V850 specific file flags. */
static boolean
v850_elf_set_private_flags (abfd, flags)
bfd * abfd;
@ -1864,7 +1868,7 @@ v850_elf_merge_private_bfd_data (ibfd, obfd)
to the default values. */
if (bfd_get_arch_info (ibfd)->the_default)
return true;
elf_flags_init (obfd) = true;
elf_elfheader (obfd)->e_flags = in_flags;
@ -1896,14 +1900,14 @@ v850_elf_print_private_bfd_data (abfd, ptr)
PTR ptr;
{
FILE * file = (FILE *) ptr;
BFD_ASSERT (abfd != NULL && ptr != NULL);
_bfd_elf_print_private_bfd_data (abfd, ptr);
/* xgettext:c-format */
fprintf (file, _("private flags = %lx: "), elf_elfheader (abfd)->e_flags);
switch (elf_elfheader (abfd)->e_flags & EF_V850_ARCH)
{
default:
@ -1911,9 +1915,9 @@ v850_elf_print_private_bfd_data (abfd, ptr)
case E_V850E_ARCH: fprintf (file, _("v850e architecture")); break;
case E_V850EA_ARCH: fprintf (file, _("v850ea architecture")); break;
}
fputc ('\n', file);
return true;
}
@ -1934,7 +1938,6 @@ static asection v850_elf_zcom_section;
static asymbol v850_elf_zcom_symbol;
static asymbol * v850_elf_zcom_symbol_ptr;
/* Given a BFD section, try to locate the corresponding ELF section
index. */
@ -1953,7 +1956,7 @@ v850_elf_section_from_bfd_section (abfd, hdr, sec, retval)
*retval = SHN_V850_ZCOMMON;
else
return false;
return true;
}
@ -1966,34 +1969,34 @@ v850_elf_symbol_processing (abfd, asym)
{
elf_symbol_type * elfsym = (elf_symbol_type *) asym;
unsigned short index;
index = elfsym->internal_elf_sym.st_shndx;
/* If the section index is an "ordinary" index, then it may
refer to a v850 specific section created by the assembler.
Check the section's type and change the index it matches.
FIXME: Should we alter the st_shndx field as well ? */
if (index < elf_elfheader(abfd)[0].e_shnum)
switch (elf_elfsections(abfd)[index]->sh_type)
{
case SHT_V850_SCOMMON:
index = SHN_V850_SCOMMON;
break;
case SHT_V850_TCOMMON:
index = SHN_V850_TCOMMON;
break;
case SHT_V850_ZCOMMON:
index = SHN_V850_ZCOMMON;
break;
default:
break;
}
switch (index)
{
case SHN_V850_SCOMMON:
@ -2013,7 +2016,7 @@ v850_elf_symbol_processing (abfd, asym)
asym->section = & v850_elf_scom_section;
asym->value = elfsym->internal_elf_sym.st_size;
break;
case SHN_V850_TCOMMON:
if (v850_elf_tcom_section.name == NULL)
{
@ -2055,7 +2058,6 @@ v850_elf_symbol_processing (abfd, asym)
/* Hook called by the linker routine which adds symbols from an object
file. We must handle the special v850 section numbers here. */
/*ARGSUSED*/
static boolean
v850_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
bfd * abfd;
@ -2067,32 +2069,32 @@ v850_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
bfd_vma * valp;
{
int index = sym->st_shndx;
/* If the section index is an "ordinary" index, then it may
refer to a v850 specific section created by the assembler.
Check the section's type and change the index it matches.
FIXME: Should we alter the st_shndx field as well ? */
if (index < elf_elfheader(abfd)[0].e_shnum)
switch (elf_elfsections(abfd)[index]->sh_type)
{
case SHT_V850_SCOMMON:
index = SHN_V850_SCOMMON;
break;
case SHT_V850_TCOMMON:
index = SHN_V850_TCOMMON;
break;
case SHT_V850_ZCOMMON:
index = SHN_V850_ZCOMMON;
break;
default:
break;
}
switch (index)
{
case SHN_V850_SCOMMON:
@ -2100,13 +2102,13 @@ v850_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
(*secp)->flags |= SEC_IS_COMMON;
*valp = sym->st_size;
break;
case SHN_V850_TCOMMON:
*secp = bfd_make_section_old_way (abfd, ".tcommon");
(*secp)->flags |= SEC_IS_COMMON;
*valp = sym->st_size;
break;
case SHN_V850_ZCOMMON:
*secp = bfd_make_section_old_way (abfd, ".zcommon");
(*secp)->flags |= SEC_IS_COMMON;
@ -2129,7 +2131,7 @@ v850_elf_link_output_symbol_hook (abfd, info, name, sym, input_sec)
/* If we see a common symbol, which implies a relocatable link, then
if a symbol was in a special common section in an input file, mark
it as a special common in the output file. */
if (sym->st_shndx == SHN_COMMON)
{
if (strcmp (input_sec->name, ".scommon") == 0)
@ -2193,18 +2195,16 @@ v850_elf_fake_sections (abfd, hdr, sec)
}
else if (strcmp (name, ".zcommon") == 0)
hdr->sh_type = SHT_V850_ZCOMMON;
return true;
}
#define TARGET_LITTLE_SYM bfd_elf32_v850_vec
#define TARGET_LITTLE_NAME "elf32-v850"
#define ELF_ARCH bfd_arch_v850
#define ELF_MACHINE_CODE EM_CYGNUS_V850
#define ELF_MAXPAGESIZE 0x1000
#define elf_info_to_howto v850_elf_info_to_howto_rela
#define elf_info_to_howto_rel v850_elf_info_to_howto_rel
@ -2223,7 +2223,6 @@ v850_elf_fake_sections (abfd, hdr, sec)
#define elf_backend_can_gc_sections 1
#define bfd_elf32_bfd_is_local_label_name v850_elf_is_local_label_name
#define bfd_elf32_bfd_reloc_type_lookup v850_elf_reloc_type_lookup
#define bfd_elf32_bfd_copy_private_bfd_data v850_elf_copy_private_bfd_data

View File

@ -19,5 +19,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define ARCH_SIZE 32
#include "elfcode.h"

View File

@ -34,7 +34,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define NO_COFF_SYMBOLS
#define NO_COFF_LINENOS
/* Get the ECOFF swapping routines. Needed for the debug information. */
/* Get the ECOFF swapping routines. Needed for the debug information. */
#include "coff/internal.h"
#include "coff/sym.h"
#include "coff/symconst.h"
@ -46,7 +46,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define ECOFF_64
#include "ecoffswap.h"
static boolean elf64_alpha_mkobject PARAMS ((bfd *));
static int alpha_elf_dynamic_symbol_p
PARAMS((struct elf_link_hash_entry *, struct bfd_link_info *));
static struct bfd_hash_entry * elf64_alpha_link_hash_newfunc
PARAMS((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
static struct bfd_link_hash_table * elf64_alpha_bfd_link_hash_table_create
@ -66,6 +67,8 @@ static reloc_howto_type * elf64_alpha_bfd_reloc_type_lookup
static void elf64_alpha_info_to_howto
PARAMS((bfd *, arelent *, Elf64_Internal_Rela *));
static boolean elf64_alpha_mkobject
PARAMS((bfd *));
static boolean elf64_alpha_object_p
PARAMS((bfd *));
static boolean elf64_alpha_section_from_shdr
@ -129,7 +132,6 @@ static boolean elf64_alpha_merge_ind_symbols
PARAMS((struct alpha_elf_link_hash_entry *, PTR));
static Elf_Internal_Rela * elf64_alpha_find_reloc_at_ofs
PARAMS ((Elf_Internal_Rela *, Elf_Internal_Rela *, bfd_vma, int));
struct alpha_elf_link_hash_entry
{
@ -224,14 +226,35 @@ struct alpha_elf_link_hash_table
/* Should we do dynamic things to this symbol? */
#define alpha_elf_dynamic_symbol_p(h, info) \
((((info)->shared && !(info)->symbolic) \
|| (((h)->elf_link_hash_flags \
& (ELF_LINK_HASH_DEF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR)) \
== (ELF_LINK_HASH_DEF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR)) \
|| (h)->root.type == bfd_link_hash_undefweak \
|| (h)->root.type == bfd_link_hash_defweak) \
&& (h)->dynindx != -1)
static int
alpha_elf_dynamic_symbol_p (h, info)
struct elf_link_hash_entry *h;
struct bfd_link_info *info;
{
if (h == NULL)
return false;
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
if (h->dynindx == -1)
return false;
if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
return false;
if (h->root.type == bfd_link_hash_undefweak
|| h->root.type == bfd_link_hash_defweak)
return true;
if ((info->shared && !info->symbolic)
|| ((h->elf_link_hash_flags
& (ELF_LINK_HASH_DEF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR))
== (ELF_LINK_HASH_DEF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR)))
return true;
return false;
}
/* Create an entry in a Alpha ELF linker hash table. */
@ -711,7 +734,7 @@ static reloc_howto_type elf64_alpha_howto_table[] =
false), /* pcrel_offset */
/* The high bits of a 32-bit displacement to the starting address of the
current section (the relocation target is ignored); the low bits are
current section (the relocation target is ignored); the low bits are
supplied in the subsequent R_ALPHA_IMMED_LO32 relocs. */
/* XXX: Not implemented. */
HOWTO (R_ALPHA_IMMED_SCN_HI32,
@ -762,7 +785,7 @@ static reloc_howto_type elf64_alpha_howto_table[] =
0, /* dst_mask */
false), /* pcrel_offset */
/* Misc ELF relocations. */
/* Misc ELF relocations. */
/* A dynamic relocation to copy the target into our .dynbss section. */
/* Not generated, as all Alpha objects use PIC, so it is not needed. It
@ -979,7 +1002,7 @@ static const struct elf_reloc_map elf64_alpha_reloc_map[] =
/* The BFD_RELOC_ALPHA_USER_* relocations are used by the assembler to process
the explicit !<reloc>!sequence relocations, and are mapped into the normal
relocations at the end of processing. */
relocations at the end of processing. */
{BFD_RELOC_ALPHA_USER_LITERAL, R_ALPHA_LITERAL},
{BFD_RELOC_ALPHA_USER_LITUSE_BASE, R_ALPHA_LITUSE},
{BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF, R_ALPHA_LITUSE},
@ -1022,7 +1045,7 @@ elf64_alpha_info_to_howto (abfd, cache_ptr, dst)
cache_ptr->howto = &elf64_alpha_howto_table[r_type];
}
/* These functions do relaxation for Alpha ELF.
/* These functions do relaxation for Alpha ELF.
Currently I'm only handling what I can do with existing compiler
and assembler support, which means no instructions are removed,
@ -1062,11 +1085,11 @@ struct alpha_relax_info
};
static Elf_Internal_Rela * elf64_alpha_relax_with_lituse
PARAMS((struct alpha_relax_info *info, bfd_vma symval,
PARAMS((struct alpha_relax_info *info, bfd_vma symval,
Elf_Internal_Rela *irel, Elf_Internal_Rela *irelend));
static boolean elf64_alpha_relax_without_lituse
PARAMS((struct alpha_relax_info *info, bfd_vma symval,
PARAMS((struct alpha_relax_info *info, bfd_vma symval,
Elf_Internal_Rela *irel));
static bfd_vma elf64_alpha_relax_opt_call
@ -1125,14 +1148,15 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend)
flags |= 1 << urel->r_addend;
}
/* A little preparation for the loop... */
/* A little preparation for the loop... */
disp = symval - info->gp;
fits16 = (disp >= -(bfd_signed_vma)0x8000 && disp < 0x8000);
fits32 = (disp >= -(bfd_signed_vma)0x80000000 && disp < 0x7fff8000);
for (urel = irel+1, i = 0; i < count; ++i, ++urel)
{
unsigned int insn;
int insn_disp;
bfd_signed_vma xdisp;
insn = bfd_get_32 (info->abfd, info->contents + urel->r_offset);
switch (urel->r_addend)
@ -1145,14 +1169,23 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend)
case 1: /* MEM FORMAT */
/* We can always optimize 16-bit displacements. */
/* Extract the displacement from the instruction, sign-extending
it if necessary, then test whether it is within 16 or 32 bits
displacement from GP. */
insn_disp = insn & 0x0000ffff;
if (insn_disp & 0x00008000)
insn_disp |= 0xffff0000; /* Negative: sign-extend. */
xdisp = disp + insn_disp;
fits16 = (xdisp >= - (bfd_signed_vma) 0x00008000 && xdisp < 0x00008000);
fits32 = (xdisp >= - (bfd_signed_vma) 0x80000000 && xdisp < 0x7fff8000);
if (fits16)
{
/* FIXME: sanity check the insn for mem format with
zero addend. */
/* Take the op code and dest from this insn, take the base
/* Take the op code and dest from this insn, take the base
register from the literal insn. Leave the offset alone. */
insn = (insn & 0xffe00000) | (lit_insn & 0x001f0000);
insn = (insn & 0xffe0ffff) | (lit_insn & 0x001f0000);
urel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
R_ALPHA_GPRELLOW);
urel->r_addend = irel->r_addend;
@ -1165,8 +1198,7 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend)
/* If all mem+byte, we can optimize 32-bit mem displacements. */
else if (fits32 && !(flags & ~6))
{
/* FIXME: sanity check that lit insn Ra is mem insn Rb, and
that mem_insn disp is zero. */
/* FIXME: sanity check that lit insn Ra is mem insn Rb. */
irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
R_ALPHA_GPRELHIGH);
@ -1215,12 +1247,12 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend)
{
Elf_Internal_Rela *xrel;
/* Preserve branch prediction call stack when possible. */
/* Preserve branch prediction call stack when possible. */
if ((insn & INSN_JSR_MASK) == INSN_JSR)
insn = (OP_BSR << 26) | (insn & 0x03e00000);
else
insn = (OP_BR << 26) | (insn & 0x03e00000);
urel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
R_ALPHA_BRADDR);
urel->r_addend = irel->r_addend;
@ -1234,7 +1266,7 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend)
/* Kill any HINT reloc that might exist for this insn. */
xrel = (elf64_alpha_find_reloc_at_ofs
(info->relocs, info->relend, urel->r_offset,
(info->relocs, info->relend, urel->r_offset,
R_ALPHA_HINT));
if (xrel)
xrel->r_info = ELF64_R_INFO (0, R_ALPHA_NONE);
@ -1249,7 +1281,7 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend)
This does depend on every place a gp could be reloaded will
be, which currently happens for all code produced by gcc, but
not necessarily by hand-coded assembly, or if sibling calls
are enabled in gcc.
are enabled in gcc.
Perhaps conditionalize this on a flag being set in the target
object file's header, and have gcc set it? */
@ -1295,22 +1327,22 @@ elf64_alpha_relax_opt_call (info, symval)
/* If the symbol is marked NOPV, we are being told the function never
needs its procedure value. */
if (info->other == STO_ALPHA_NOPV)
if ((info->other & STO_ALPHA_STD_GPLOAD) == STO_ALPHA_NOPV)
return symval;
/* If the symbol is marked STD_GP, we are being told the function does
a normal ldgp in the first two words. */
else if (info->other == STO_ALPHA_STD_GPLOAD)
a normal ldgp in the first two words. */
else if ((info->other & STO_ALPHA_STD_GPLOAD) == STO_ALPHA_STD_GPLOAD)
;
/* Otherwise, we may be able to identify a GP load in the first two
words, which we can then skip. */
else
else
{
Elf_Internal_Rela *tsec_relocs, *tsec_relend, *tsec_free, *gpdisp;
bfd_vma ofs;
/* Load the relocations from the section that the target symbol is in. */
/* Load the relocations from the section that the target symbol is in. */
if (info->sec == info->tsec)
{
tsec_relocs = info->relocs;
@ -1332,7 +1364,7 @@ elf64_alpha_relax_opt_call (info, symval)
/* Recover the symbol's offset within the section. */
ofs = (symval - info->tsec->output_section->vma
- info->tsec->output_offset);
/* Look for a GPDISP reloc. */
gpdisp = (elf64_alpha_find_reloc_at_ofs
(tsec_relocs, tsec_relend, ofs, R_ALPHA_GPDISP));
@ -1347,7 +1379,7 @@ elf64_alpha_relax_opt_call (info, symval)
free (tsec_free);
}
/* We've now determined that we can skip an initial gp load. Verify
/* We've now determined that we can skip an initial gp load. Verify
that the call and the target use the same gp. */
if (info->link_info->hash->creator != info->tsec->owner->xvec
|| info->gotobj != alpha_elf_tdata (info->tsec->owner)->gotobj)
@ -1408,7 +1440,7 @@ elf64_alpha_relax_without_lituse (info, symval, irel)
Any such memory load insn may be substituted by a load directly
off the GP. This allows the memory load insn to be issued before
the calculated GP register would otherwise be ready.
the calculated GP register would otherwise be ready.
Any such jsr insn can be replaced by a bsr if it is in range.
@ -1460,7 +1492,7 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
if (! link_info->keep_memory)
free_relocs = internal_relocs;
memset(&info, 0, sizeof(info));
memset(&info, 0, sizeof (info));
info.abfd = abfd;
info.sec = sec;
info.link_info = link_info;
@ -1543,8 +1575,8 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
info.tsec = bfd_abs_section_ptr;
else if (isym.st_shndx == SHN_COMMON)
info.tsec = bfd_com_section_ptr;
else
continue; /* who knows. */
else
continue; /* who knows. */
info.h = NULL;
info.other = isym.st_other;
@ -1962,7 +1994,7 @@ elf64_alpha_read_ecoff_info (abfd, section, debug)
char *ext_hdr = NULL;
swap = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap;
memset (debug, 0, sizeof(*debug));
memset (debug, 0, sizeof (*debug));
ext_hdr = (char *) bfd_malloc ((size_t) swap->external_hdr_size);
if (ext_hdr == NULL && swap->external_hdr_size != 0)
@ -2073,6 +2105,12 @@ elf64_alpha_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
{
asection *msec;
if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
filename_ptr, functionname_ptr,
line_ptr, 0,
&elf_tdata (abfd)->dwarf2_find_line_info))
return true;
msec = bfd_get_section_by_name (abfd, ".mdebug");
if (msec != NULL)
{
@ -2539,7 +2577,8 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
sreloc = bfd_make_section (dynobj, rel_sec_name);
if (sreloc == NULL
|| !bfd_set_section_flags (dynobj, sreloc,
(SEC_ALLOC|SEC_LOAD
((sec->flags & (SEC_ALLOC
| SEC_LOAD))
| SEC_HAS_CONTENTS
| SEC_IN_MEMORY
| SEC_LINKER_CREATED
@ -2555,7 +2594,7 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
don't know whether we'll actually need a dynamic relocation
entry for this reloc. So make a record of it. Once we
find out if this thing needs dynamic relocation we'll
expand the relocation sections by the appropriate amount. */
expand the relocation sections by the appropriate amount. */
struct alpha_elf_reloc_entry *rent;
@ -3127,7 +3166,7 @@ elf64_alpha_calc_dynrel_sizes (h, info)
|| relent->rtype == R_ALPHA_REFQUAD)
{
relent->srel->_raw_size +=
sizeof(Elf64_External_Rela) * relent->count;
sizeof (Elf64_External_Rela) * relent->count;
}
dynobj = elf_hash_table(info)->dynobj;
@ -3202,7 +3241,7 @@ elf64_alpha_size_dynamic_sections (output_bfd, info)
i = alpha_elf_tdata(i)->got_link_next)
count += alpha_elf_tdata(i)->n_local_got_entries;
srel->_raw_size += count * sizeof(Elf64_External_Rela);
srel->_raw_size += count * sizeof (Elf64_External_Rela);
}
}
/* else we're not dynamic and by definition we don't need such things. */
@ -3305,13 +3344,14 @@ elf64_alpha_size_dynamic_sections (output_bfd, info)
if (! bfd_elf64_add_dynamic_entry (info, DT_RELA, 0)
|| ! bfd_elf64_add_dynamic_entry (info, DT_RELASZ, 0)
|| ! bfd_elf64_add_dynamic_entry (info, DT_RELAENT,
sizeof(Elf64_External_Rela)))
sizeof (Elf64_External_Rela)))
return false;
if (reltext)
{
if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0))
return false;
info->flags |= DF_TEXTREL;
}
}
@ -3394,7 +3434,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
in which case we have to adjust according to where the
section symbol winds up in the output section. */
/* The symbol associated with GPDISP and LITUSE is
/* The symbol associated with GPDISP and LITUSE is
immaterial. Only the addend is significant. */
if (r_type == R_ALPHA_GPDISP || r_type == R_ALPHA_LITUSE)
continue;
@ -3517,7 +3557,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
case R_ALPHA_OP_PSUB:
case R_ALPHA_OP_PRSHIFT:
/* We hate these silly beasts. */
abort();
abort ();
case R_ALPHA_LITERAL:
{
@ -3571,7 +3611,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
((Elf64_External_Rela *)
srelgot->contents)
+ srelgot->reloc_count++);
BFD_ASSERT (sizeof(Elf64_External_Rela)
BFD_ASSERT (sizeof (Elf64_External_Rela)
* srelgot->reloc_count
<= srelgot->_cooked_size);
}
@ -3676,7 +3716,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
((Elf64_External_Rela *)
srel->contents)
+ srel->reloc_count++);
BFD_ASSERT (sizeof(Elf64_External_Rela) * srel->reloc_count
BFD_ASSERT (sizeof (Elf64_External_Rela) * srel->reloc_count
<= srel->_cooked_size);
}
goto default_reloc;
@ -3829,7 +3869,7 @@ elf64_alpha_finish_dynamic_symbol (output_bfd, info, h, sym)
((Elf64_External_Rela *)
srel->contents)
+ srel->reloc_count++);
BFD_ASSERT (sizeof(Elf64_External_Rela) * srel->reloc_count
BFD_ASSERT (sizeof (Elf64_External_Rela) * srel->reloc_count
<= srel->_cooked_size);
}
@ -3862,7 +3902,7 @@ elf64_alpha_finish_dynamic_symbol (output_bfd, info, h, sym)
bfd_elf64_swap_reloca_out (output_bfd, &outrel,
((Elf64_External_Rela *)srel->contents
+ srel->reloc_count++));
BFD_ASSERT (sizeof(Elf64_External_Rela) * srel->reloc_count
BFD_ASSERT (sizeof (Elf64_External_Rela) * srel->reloc_count
<= srel->_cooked_size);
}
}
@ -4280,7 +4320,6 @@ elf64_alpha_final_link (abfd, info)
}
#endif
/* Build the external symbol information. */
einfo.abfd = abfd;
einfo.info = info;
@ -4600,7 +4639,7 @@ elf64_alpha_final_link (abfd, info)
/* ECOFF swapping routines. These are used when dealing with the
.mdebug section, which is in the ECOFF debugging format. Copied
from elf32-mips.c. */
from elf32-mips.c. */
static const struct ecoff_debug_swap
elf64_alpha_ecoff_debug_swap =
{
@ -4643,6 +4682,36 @@ elf64_alpha_ecoff_debug_swap =
elf64_alpha_read_ecoff_info
};
/* Use a non-standard hash bucket size of 8. */
const struct elf_size_info alpha_elf_size_info =
{
sizeof (Elf64_External_Ehdr),
sizeof (Elf64_External_Phdr),
sizeof (Elf64_External_Shdr),
sizeof (Elf64_External_Rel),
sizeof (Elf64_External_Rela),
sizeof (Elf64_External_Sym),
sizeof (Elf64_External_Dyn),
sizeof (Elf_External_Note),
8,
1,
64, 8,
ELFCLASS64, EV_CURRENT,
bfd_elf64_write_out_phdrs,
bfd_elf64_write_shdrs_and_ehdr,
bfd_elf64_write_relocs,
bfd_elf64_swap_symbol_out,
bfd_elf64_slurp_reloc_table,
bfd_elf64_slurp_symbol_table,
bfd_elf64_swap_dyn_in,
bfd_elf64_swap_dyn_out,
NULL,
NULL,
NULL,
NULL
};
#define TARGET_LITTLE_SYM bfd_elf64_alpha_vec
#define TARGET_LITTLE_NAME "elf64-alpha"
#define ELF_ARCH bfd_arch_alpha
@ -4698,9 +4767,10 @@ elf64_alpha_ecoff_debug_swap =
#define elf_backend_ecoff_debug_swap \
&elf64_alpha_ecoff_debug_swap
/*
* A few constants that determine how the .plt section is set up.
*/
#define elf_backend_size_info \
alpha_elf_size_info
/* A few constants that determine how the .plt section is set up. */
#define elf_backend_want_got_plt 0
#define elf_backend_plt_readonly 0
#define elf_backend_want_plt_sym 1

View File

@ -58,6 +58,37 @@ elf_generic_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
bfd_reloc->howto = &dummy;
}
static boolean
elf64_generic_link_add_symbols (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
{
asection *o;
/* Check if there are any relocations. */
for (o = abfd->sections; o != NULL; o = o->next)
if ((o->flags & SEC_RELOC) != 0)
{
Elf_Internal_Ehdr *ehdrp;
ehdrp = elf_elfheader (abfd);
if (abfd->my_archive)
(*_bfd_error_handler) (_("%s(%s): Relocations in generic ELF (EM: %d)"),
bfd_get_filename (abfd->my_archive),
bfd_get_filename (abfd),
ehdrp->e_machine);
else
(*_bfd_error_handler) (_("%s: Relocations in generic ELF (EM: %d)"),
bfd_get_filename (abfd),
ehdrp->e_machine);
bfd_set_error (bfd_error_wrong_format);
return false;
}
return bfd_elf64_bfd_link_add_symbols (abfd, info);
}
#define TARGET_LITTLE_SYM bfd_elf64_little_generic_vec
#define TARGET_LITTLE_NAME "elf64-little"
#define TARGET_BIG_SYM bfd_elf64_big_generic_vec
@ -66,6 +97,7 @@ elf_generic_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
#define ELF_MACHINE_CODE EM_NONE
#define ELF_MAXPAGESIZE 0x1
#define bfd_elf64_bfd_reloc_type_lookup bfd_default_reloc_type_lookup
#define bfd_elf64_bfd_link_add_symbols elf64_generic_link_add_symbols
#define elf_info_to_howto elf_generic_info_to_howto
#define elf_info_to_howto_rel elf_generic_info_to_howto_rel

View File

@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "sysdep.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "opcode/sparc.h"
/* This is defined if one wants to build upward compatible binaries
with the original sparc64-elf toolchain. The support is kept in for
@ -65,6 +66,8 @@ static void sparc64_elf_symbol_processing
static boolean sparc64_elf_merge_private_bfd_data
PARAMS ((bfd *, bfd *));
static boolean sparc64_elf_relax_section
PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *));
static boolean sparc64_elf_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
@ -212,7 +215,7 @@ static CONST struct elf_reloc_map sparc_reloc_map[] =
static reloc_howto_type *
sparc64_elf_reloc_type_lookup (abfd, code)
bfd *abfd;
bfd *abfd ATTRIBUTE_UNUSED;
bfd_reloc_code_real_type code;
{
unsigned int i;
@ -226,7 +229,7 @@ sparc64_elf_reloc_type_lookup (abfd, code)
static void
sparc64_elf_info_to_howto (abfd, cache_ptr, dst)
bfd *abfd;
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
Elf64_Internal_Rela *dst;
{
@ -237,10 +240,10 @@ sparc64_elf_info_to_howto (abfd, cache_ptr, dst)
/* Due to the way how we handle R_SPARC_OLO10, each entry in a SHT_RELA
section can represent up to two relocs, we must tell the user to allocate
more space. */
static long
sparc64_elf_get_reloc_upper_bound (abfd, sec)
bfd *abfd;
bfd *abfd ATTRIBUTE_UNUSED;
asection *sec;
{
return (sec->reloc_count * 2 + 1) * sizeof (arelent *);
@ -253,7 +256,7 @@ sparc64_elf_get_dynamic_reloc_upper_bound (abfd)
return _bfd_elf_get_dynamic_reloc_upper_bound (abfd) * 2;
}
/* Read relocations for ASECT from REL_HDR. There are RELOC_COUNT of
/* Read relocations for ASECT from REL_HDR. There are RELOC_COUNT of
them. We cannot use generic elf routines for this, because R_SPARC_OLO10
has secondary addend in ELF64_R_TYPE_DATA. We handle it as two relocations
for the same location, R_SPARC_LO10 and R_SPARC_13. */
@ -266,7 +269,6 @@ sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr, symbols, dynamic)
asymbol **symbols;
boolean dynamic;
{
struct elf_backend_data * const ebd = get_elf_backend_data (abfd);
PTR allocated = NULL;
bfd_byte *native_relocs;
arelent *relent;
@ -290,7 +292,7 @@ sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr, symbols, dynamic)
entsize = rel_hdr->sh_entsize;
BFD_ASSERT (entsize == sizeof (Elf64_External_Rela));
count = rel_hdr->sh_size / entsize;
for (i = 0, relent = relents; i < count;
@ -396,20 +398,20 @@ sparc64_elf_slurp_reloc_table (abfd, asect, symbols, dynamic)
rel_hdr2 = NULL;
}
asect->relocation = ((arelent *)
bfd_alloc (abfd,
asect->relocation = ((arelent *)
bfd_alloc (abfd,
asect->reloc_count * 2 * sizeof (arelent)));
if (asect->relocation == NULL)
return false;
/* The sparc64_elf_slurp_one_reloc_table routine increments reloc_count. */
asect->reloc_count = 0;
if (!sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr, symbols,
dynamic))
return false;
if (rel_hdr2
if (rel_hdr2
&& !sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr2, symbols,
dynamic))
return false;
@ -501,7 +503,6 @@ sparc64_elf_write_relocs (abfd, sec, data)
for (idx = 0; idx < sec->reloc_count; idx++)
{
bfd_vma addr;
unsigned int i;
++count;
@ -533,7 +534,7 @@ sparc64_elf_write_relocs (abfd, sec, data)
if (rela_hdr->sh_type != SHT_RELA)
abort ();
/* orelocation has the data, reloc_count has the count... */
/* orelocation has the data, reloc_count has the count... */
outbound_relocas = (Elf64_External_Rela *) rela_hdr->contents;
src_rela = outbound_relocas;
@ -627,7 +628,7 @@ struct sparc64_elf_link_hash_table
#define sparc64_elf_hash_table(p) \
((struct sparc64_elf_link_hash_table *) ((p)->hash))
/* Create a Sparc64 ELF linker hash table. */
static struct bfd_link_hash_table *
@ -650,7 +651,6 @@ sparc64_elf_bfd_link_hash_table_create (abfd)
return &ret->root.root;
}
/* Utility for performing the standard initial work of an instruction
relocation.
@ -723,13 +723,13 @@ sparc_elf_notsup_reloc (abfd,
input_section,
output_bfd,
error_message)
bfd *abfd;
arelent *reloc_entry;
asymbol *symbol;
PTR data;
asection *input_section;
bfd *output_bfd;
char **error_message;
bfd *abfd ATTRIBUTE_UNUSED;
arelent *reloc_entry ATTRIBUTE_UNUSED;
asymbol *symbol ATTRIBUTE_UNUSED;
PTR data ATTRIBUTE_UNUSED;
asection *input_section ATTRIBUTE_UNUSED;
bfd *output_bfd ATTRIBUTE_UNUSED;
char **error_message ATTRIBUTE_UNUSED;
{
return bfd_reloc_notsupported;
}
@ -745,7 +745,7 @@ sparc_elf_wdisp16_reloc (abfd, reloc_entry, symbol, data, input_section,
PTR data;
asection *input_section;
bfd *output_bfd;
char **error_message;
char **error_message ATTRIBUTE_UNUSED;
{
bfd_vma relocation;
bfd_vma insn;
@ -783,7 +783,7 @@ sparc_elf_hix22_reloc (abfd,
PTR data;
asection *input_section;
bfd *output_bfd;
char **error_message;
char **error_message ATTRIBUTE_UNUSED;
{
bfd_vma relocation;
bfd_vma insn;
@ -820,7 +820,7 @@ sparc_elf_lox10_reloc (abfd,
PTR data;
asection *input_section;
bfd *output_bfd;
char **error_message;
char **error_message ATTRIBUTE_UNUSED;
{
bfd_vma relocation;
bfd_vma insn;
@ -847,7 +847,6 @@ sparc_elf_lox10_reloc (abfd,
#define ELF_DYNAMIC_INTERPRETER "/usr/lib/sparcv9/ld.so.1"
/* Fill in the .plt section. */
static void
@ -858,7 +857,7 @@ sparc64_elf_build_plt (output_bfd, contents, nentries)
{
const unsigned int nop = 0x01000000;
int i, j;
/* The first four entries are reserved, and are initially undefined.
We fill them with `illtrap 0' to force ld.so to do something. */
@ -892,7 +891,7 @@ sparc64_elf_build_plt (output_bfd, contents, nentries)
/* Now the tricky bit. Entries 32768 and higher are grouped in blocks of
160: 160 entries and 160 pointers. This is to separate code from data,
which is much friendlier on the cache. */
for (; i < nentries; i += 160)
{
int block = (i + 160 <= nentries ? 160 : nentries - i);
@ -935,7 +934,7 @@ sparc64_elf_plt_entry_offset (index)
block = (index - LARGE_PLT_THRESHOLD) / 160;
ofs = (index - LARGE_PLT_THRESHOLD) % 160;
return ((bfd_vma)(LARGE_PLT_THRESHOLD + block*160) * PLT_ENTRY_SIZE
return ((bfd_vma) (LARGE_PLT_THRESHOLD + block*160) * PLT_ENTRY_SIZE
+ ofs * 6*4);
}
@ -961,8 +960,6 @@ sparc64_elf_plt_ptr_offset (index, max)
+ last * 6*4
+ ofs * 8);
}
/* Look through the relocs for a section during the first phase, and
allocate space in the global offset table or procedure linkage
@ -1197,7 +1194,7 @@ sparc64_elf_check_relocs (abfd, info, sec, relocs)
case R_SPARC_UA16:
/* When creating a shared object, we must copy these relocs
into the output file. We create a reloc section in
dynobj and make room for the reloc.
dynobj and make room for the reloc.
But don't do this for debugging sections -- this shows up
with DWARF2 -- first because they are not loaded, and
@ -1246,7 +1243,7 @@ sparc64_elf_check_relocs (abfd, info, sec, relocs)
break;
default:
(*_bfd_error_handler)(_("%s: check_relocs: unhandled reloc type %d"),
(*_bfd_error_handler) (_("%s: check_relocs: unhandled reloc type %d"),
bfd_get_filename(abfd),
ELF64_R_TYPE_ID (rel->r_info));
return false;
@ -1265,9 +1262,9 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
struct bfd_link_info *info;
const Elf_Internal_Sym *sym;
const char **namep;
flagword *flagsp;
asection **secp;
bfd_vma *valp;
flagword *flagsp ATTRIBUTE_UNUSED;
asection **secp ATTRIBUTE_UNUSED;
bfd_vma *valp ATTRIBUTE_UNUSED;
{
static char *stt_types[] = { "NOTYPE", "OBJECT", "FUNCTION" };
@ -1275,7 +1272,7 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
{
int reg;
struct sparc64_elf_app_reg *p;
reg = (int)sym->st_value;
switch (reg & ~1)
{
@ -1316,7 +1313,7 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
if (**namep)
{
struct elf_link_hash_entry *h;
h = (struct elf_link_hash_entry *)
bfd_link_hash_lookup (info->hash, *namep, false, false, false);
@ -1387,7 +1384,7 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
static boolean
sparc64_elf_output_arch_syms (output_bfd, info, finfo, func)
bfd *output_bfd;
bfd *output_bfd ATTRIBUTE_UNUSED;
struct bfd_link_info *info;
PTR finfo;
boolean (*func) PARAMS ((PTR, const char *,
@ -1460,7 +1457,7 @@ sparc64_elf_get_symbol_type (elf_sym, type)
static void
sparc64_elf_symbol_processing (abfd, asym)
bfd *abfd;
bfd *abfd ATTRIBUTE_UNUSED;
asymbol *asym;
{
elf_symbol_type *elfsym;
@ -1556,12 +1553,6 @@ sparc64_elf_adjust_dynamic_symbol (info, h)
s = bfd_get_section_by_name (dynobj, ".rela.plt");
BFD_ASSERT (s != NULL);
/* The first plt entries are reserved, and the relocations must
pair up exactly. */
if (s->_raw_size == 0)
s->_raw_size += (PLT_HEADER_SIZE/PLT_ENTRY_SIZE
* sizeof (Elf64_External_Rela));
s->_raw_size += sizeof (Elf64_External_Rela);
/* The procedure linkage table size is bounded by the magnitude
@ -1802,6 +1793,7 @@ sparc64_elf_size_dynamic_sections (output_bfd, info)
{
if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0))
return false;
info->flags |= DF_TEXTREL;
}
/* Add dynamic STT_REGISTER symbols and corresponding DT_SPARC_REGISTER
@ -1813,7 +1805,7 @@ sparc64_elf_size_dynamic_sections (output_bfd, info)
if (app_regs [reg].name != NULL)
{
struct elf_link_local_dynamic_entry *entry, *e;
if (! bfd_elf64_add_dynamic_entry (info, DT_SPARC_REGISTER, 0))
return false;
@ -1855,6 +1847,21 @@ sparc64_elf_size_dynamic_sections (output_bfd, info)
return true;
}
#define SET_SEC_DO_RELAX(section) do { elf_section_data(section)->tdata = (void *)1; } while (0)
#define SEC_DO_RELAX(section) (elf_section_data(section)->tdata == (void *)1)
static boolean
sparc64_elf_relax_section (abfd, section, link_info, again)
bfd *abfd ATTRIBUTE_UNUSED;
asection *section ATTRIBUTE_UNUSED;
struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
boolean *again;
{
*again = false;
SET_SEC_DO_RELAX (section);
return true;
}
/* Relocate a SPARC64 ELF section. */
static boolean
@ -1898,7 +1905,7 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
{
int r_type;
reloc_howto_type *howto;
long r_symndx;
unsigned long r_symndx;
struct elf_link_hash_entry *h;
Elf_Internal_Sym *sym;
asection *sec;
@ -2061,7 +2068,15 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
(!info->shared || info->no_undefined
|| ELF_ST_VISIBILITY (h->other)))))
return false;
relocation = 0;
/* To avoid generating warning messages about truncated
relocations, set the relocation's address to be the same as
the start of this section. */
if (input_section->output_section != NULL)
relocation = input_section->output_section->vma;
else
relocation = 0;
}
}
@ -2338,7 +2353,6 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
off &= ~1;
else
{
bfd_put_64 (output_bfd, relocation, sgot->contents + off);
local_got_offsets[r_symndx] |= 1;
if (info->shared)
@ -2346,6 +2360,13 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
asection *srelgot;
Elf_Internal_Rela outrel;
/* The Solaris 2.7 64-bit linker adds the contents
of the location to the value of the reloc.
Note this is different behaviour to the
32-bit linker, which both adds the contents
and ignores the addend. So clear the location. */
bfd_put_64 (output_bfd, 0, sgot->contents + off);
/* We need to generate a R_SPARC_RELATIVE reloc
for the dynamic linker. */
srelgot = bfd_get_section_by_name(dynobj, ".rela.got");
@ -2362,6 +2383,8 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
+ srelgot->reloc_count));
++srelgot->reloc_count;
}
else
bfd_put_64 (output_bfd, relocation, sgot->contents + off);
}
relocation = sgot->output_offset + off - got_base;
}
@ -2396,6 +2419,8 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
relocation = (splt->output_section->vma
+ splt->output_offset
+ sparc64_elf_plt_entry_offset (h->plt.offset));
if (r_type == R_SPARC_WPLT30)
goto do_wplt30;
goto do_default;
case R_SPARC_OLO10:
@ -2471,6 +2496,97 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
}
break;
case R_SPARC_WDISP30:
do_wplt30:
if (SEC_DO_RELAX (input_section)
&& rel->r_offset + 4 < input_section->_raw_size)
{
#define G0 0
#define O7 15
#define XCC (2 << 20)
#define COND(x) (((x)&0xf)<<25)
#define CONDA COND(0x8)
#define INSN_BPA (F2(0,1) | CONDA | BPRED | XCC)
#define INSN_BA (F2(0,2) | CONDA)
#define INSN_OR F3(2, 0x2, 0)
#define INSN_NOP F2(0,4)
bfd_vma x, y;
/* If the instruction is a call with either:
restore
arithmetic instruction with rd == %o7
where rs1 != %o7 and rs2 if it is register != %o7
then we can optimize if the call destination is near
by changing the call into a branch always. */
x = bfd_get_32 (input_bfd, contents + rel->r_offset);
y = bfd_get_32 (input_bfd, contents + rel->r_offset + 4);
if ((x & OP(~0)) == OP(1) && (y & OP(~0)) == OP(2))
{
if (((y & OP3(~0)) == OP3(0x3d) /* restore */
|| ((y & OP3(0x28)) == 0 /* arithmetic */
&& (y & RD(~0)) == RD(O7)))
&& (y & RS1(~0)) != RS1(O7)
&& ((y & F3I(~0))
|| (y & RS2(~0)) != RS2(O7)))
{
bfd_vma reloc;
reloc = relocation + rel->r_addend - rel->r_offset;
reloc -= (input_section->output_section->vma
+ input_section->output_offset);
if (reloc & 3)
goto do_default;
/* Ensure the branch fits into simm22. */
if ((reloc & ~(bfd_vma)0x7fffff)
&& ((reloc | 0x7fffff) != MINUS_ONE))
goto do_default;
reloc >>= 2;
/* Check whether it fits into simm19. */
if ((reloc & 0x3c0000) == 0
|| (reloc & 0x3c0000) == 0x3c0000)
x = INSN_BPA | (reloc & 0x7ffff); /* ba,pt %xcc */
else
x = INSN_BA | (reloc & 0x3fffff); /* ba */
bfd_put_32 (input_bfd, x, contents + rel->r_offset);
r = bfd_reloc_ok;
if (rel->r_offset >= 4
&& (y & (0xffffffff ^ RS1(~0)))
== (INSN_OR | RD(O7) | RS2(G0)))
{
bfd_vma z;
unsigned int reg;
z = bfd_get_32 (input_bfd,
contents + rel->r_offset - 4);
if ((z & (0xffffffff ^ RD(~0)))
!= (INSN_OR | RS1(O7) | RS2(G0)))
break;
/* The sequence was
or %o7, %g0, %rN
call foo
or %rN, %g0, %o7
If call foo was replaced with ba, replace
or %rN, %g0, %o7 with nop. */
reg = (y & RS1(~0)) >> 14;
if (reg != ((z & RD(~0)) >> 25)
|| reg == G0 || reg == O7)
break;
bfd_put_32 (input_bfd, INSN_NOP,
contents + rel->r_offset + 4);
}
break;
}
}
}
/* FALLTHROUGH */
default:
do_default:
r = _bfd_final_link_relocate (howto, input_bfd, input_section,
@ -2499,12 +2615,12 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
{
/* Assume this is a call protected by other code that
detect the symbol is undefined. If this is the case,
we can safely ignore the overflow. If not, the
we can safely ignore the overflow. If not, the
program is hosed anyway, and a little warning isn't
going to help. */
break;
}
name = h->root.root.string;
}
else
@ -2550,7 +2666,7 @@ sparc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
asection *srela;
Elf_Internal_Rela rela;
/* This symbol has an entry in the PLT. Set it up. */
/* This symbol has an entry in the PLT. Set it up. */
BFD_ASSERT (h->dynindx != -1);
@ -2575,9 +2691,14 @@ sparc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
rela.r_offset += (splt->output_section->vma + splt->output_offset);
rela.r_info = ELF64_R_INFO (h->dynindx, R_SPARC_JMP_SLOT);
/* Adjust for the first 4 reserved elements in the .plt section
when setting the offset in the .rela.plt section.
Sun forgot to read their own ABI and copied elf32-sparc behaviour,
thus .plt[4] has corresponding .rela.plt[0] and so on. */
bfd_elf64_swap_reloca_out (output_bfd, &rela,
((Elf64_External_Rela *) srela->contents
+ h->plt.offset));
+ (h->plt.offset - 4)));
if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
{
@ -2770,7 +2891,7 @@ sparc64_elf_finish_dynamic_sections (output_bfd, info)
return true;
}
/* Functions for dealing with the e_flags field. */
/* Functions for dealing with the e_flags field. */
/* Merge backend specific data from an object file to the output
object file when linking. */
@ -2796,32 +2917,33 @@ sparc64_elf_merge_private_bfd_data (ibfd, obfd)
elf_flags_init (obfd) = true;
elf_elfheader (obfd)->e_flags = new_flags;
}
else if (new_flags == old_flags) /* Compatible flags are ok */
;
else /* Incompatible flags */
{
error = false;
#define EF_SPARC_ISA_EXTENSIONS \
(EF_SPARC_SUN_US1 | EF_SPARC_SUN_US3 | EF_SPARC_HAL_R1)
if ((ibfd->flags & DYNAMIC) != 0)
{
/* We don't want dynamic objects memory ordering and
architecture to have any role. That's what dynamic linker
should do. */
old_flags &= ~(EF_SPARCV9_MM | EF_SPARC_SUN_US1 | EF_SPARC_HAL_R1);
old_flags |= (new_flags
& (EF_SPARCV9_MM
| EF_SPARC_SUN_US1
| EF_SPARC_HAL_R1));
new_flags &= ~(EF_SPARCV9_MM | EF_SPARC_ISA_EXTENSIONS);
new_flags |= (old_flags
& (EF_SPARCV9_MM | EF_SPARC_ISA_EXTENSIONS));
}
else
{
/* Choose the highest architecture requirements. */
old_flags |= (new_flags & (EF_SPARC_SUN_US1 | EF_SPARC_HAL_R1));
new_flags |= (old_flags & (EF_SPARC_SUN_US1 | EF_SPARC_HAL_R1));
if ((old_flags & (EF_SPARC_SUN_US1 | EF_SPARC_HAL_R1))
== (EF_SPARC_SUN_US1 | EF_SPARC_HAL_R1))
old_flags |= (new_flags & EF_SPARC_ISA_EXTENSIONS);
new_flags |= (old_flags & EF_SPARC_ISA_EXTENSIONS);
if ((old_flags & (EF_SPARC_SUN_US1 | EF_SPARC_SUN_US3))
&& (old_flags & EF_SPARC_HAL_R1))
{
error = true;
(*_bfd_error_handler)
@ -2863,13 +2985,13 @@ sparc64_elf_merge_private_bfd_data (ibfd, obfd)
static const char *
sparc64_elf_print_symbol_all (abfd, filep, symbol)
bfd *abfd;
bfd *abfd ATTRIBUTE_UNUSED;
PTR filep;
asymbol *symbol;
{
FILE *file = (FILE *) filep;
int reg, type;
if (ELF_ST_TYPE (((elf_symbol_type *) symbol)->internal_elf_sym.st_info)
!= STT_REGISTER)
return NULL;
@ -2894,8 +3016,10 @@ sparc64_elf_object_p (abfd)
bfd *abfd;
{
unsigned long mach = bfd_mach_sparc_v9;
if (elf_elfheader (abfd)->e_flags & EF_SPARC_SUN_US1)
if (elf_elfheader (abfd)->e_flags & EF_SPARC_SUN_US3)
mach = bfd_mach_sparc_v9b;
else if (elf_elfheader (abfd)->e_flags & EF_SPARC_SUN_US1)
mach = bfd_mach_sparc_v9a;
return bfd_default_set_arch_mach (abfd, bfd_arch_sparc, mach);
}
@ -2919,7 +3043,7 @@ const struct elf_size_info sparc64_elf_size_info =
/* internal relocations per external relocations.
For link purposes we use just 1 internal per
1 external, for assembly and slurp symbol table
we use 2. */
we use 2. */
1,
64, /* arch_size */
8, /* file_align */
@ -2952,7 +3076,7 @@ const struct elf_size_info sparc64_elf_size_info =
#define bfd_elf64_bfd_link_hash_table_create \
sparc64_elf_bfd_link_hash_table_create
#define elf_info_to_howto \
sparc64_elf_info_to_howto
#define bfd_elf64_get_reloc_upper_bound \
@ -2963,6 +3087,8 @@ const struct elf_size_info sparc64_elf_size_info =
sparc64_elf_canonicalize_dynamic_reloc
#define bfd_elf64_bfd_reloc_type_lookup \
sparc64_elf_reloc_type_lookup
#define bfd_elf64_bfd_relax_section \
sparc64_elf_relax_section
#define elf_backend_create_dynamic_sections \
_bfd_elf_create_dynamic_sections

View File

@ -43,6 +43,10 @@
static reloc_howto_type * elf32_arm_reloc_type_lookup
PARAMS ((bfd * abfd, bfd_reloc_code_real_type code));
/* Note: code such as elf32_arm_reloc_type_lookup expect to use e.g.
R_ARM_PC24 as an index into this, and find the R_ARM_PC24 HOWTO
in that slot. */
static reloc_howto_type elf32_arm_howto_table[] =
{
/* No relocation */
@ -262,36 +266,36 @@ static reloc_howto_type elf32_arm_howto_table[] =
0x00000000, /* dst_mask */
false), /* pcrel_offset */
/* These next two relocs are defined, but I do not know what they do. */
/* BLX instruction for the ARM. */
HOWTO (R_ARM_XPC25, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
false, /* pc_relative */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
25, /* bitsize */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_XPC25", /* name */
false, /* partial_inplace */
0x00000000, /* src_mask */
0x00000000, /* dst_mask */
false), /* pcrel_offset */
0x00ffffff, /* src_mask */
0x00ffffff, /* dst_mask */
true), /* pcrel_offset */
/* BLX instruction for the Thumb. */
HOWTO (R_ARM_THM_XPC22, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
false, /* pc_relative */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
22, /* bitsize */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed,/* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARM_THM_XPC22", /* name */
false, /* partial_inplace */
0x00000000, /* src_mask */
0x00000000, /* dst_mask */
false), /* pcrel_offset */
0x07ff07ff, /* src_mask */
0x07ff07ff, /* dst_mask */
true), /* pcrel_offset */
/* These next three relocs are not defined, but we need to fill the space. */
HOWTO (R_ARM_NONE, /* type */
@ -337,7 +341,7 @@ static reloc_howto_type elf32_arm_howto_table[] =
false), /* pcrel_offset */
/* Relocs used in ARM Linux */
HOWTO (R_ARM_COPY, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@ -365,7 +369,7 @@ static reloc_howto_type elf32_arm_howto_table[] =
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
HOWTO (R_ARM_JUMP_SLOT, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@ -379,7 +383,7 @@ static reloc_howto_type elf32_arm_howto_table[] =
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
HOWTO (R_ARM_RELATIVE, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@ -393,7 +397,7 @@ static reloc_howto_type elf32_arm_howto_table[] =
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
HOWTO (R_ARM_GOTOFF, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@ -407,7 +411,7 @@ static reloc_howto_type elf32_arm_howto_table[] =
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
HOWTO (R_ARM_GOTPC, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@ -421,7 +425,7 @@ static reloc_howto_type elf32_arm_howto_table[] =
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
true), /* pcrel_offset */
HOWTO (R_ARM_GOT32, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@ -435,7 +439,7 @@ static reloc_howto_type elf32_arm_howto_table[] =
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
HOWTO (R_ARM_PLT32, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@ -449,8 +453,8 @@ static reloc_howto_type elf32_arm_howto_table[] =
0x00ffffff, /* src_mask */
0x00ffffff, /* dst_mask */
true), /* pcrel_offset */
/* End of relocs used in ARM Linux */
/* End of relocs used in ARM Linux */
HOWTO (R_ARM_RREL32, /* type */
0, /* rightshift */
@ -574,7 +578,6 @@ static reloc_howto_type elf32_arm_thm_pc9_howto =
0x000000ff, /* dst_mask */
true); /* pcrel_offset */
static void
elf32_arm_info_to_howto (abfd, bfd_reloc, elf_reloc)
bfd * abfd ATTRIBUTE_UNUSED;
@ -582,7 +585,7 @@ elf32_arm_info_to_howto (abfd, bfd_reloc, elf_reloc)
Elf32_Internal_Rel * elf_reloc;
{
unsigned int r_type;
r_type = ELF32_R_TYPE (elf_reloc->r_info);
switch (r_type)
@ -590,19 +593,19 @@ elf32_arm_info_to_howto (abfd, bfd_reloc, elf_reloc)
case R_ARM_GNU_VTINHERIT:
bfd_reloc->howto = & elf32_arm_vtinherit_howto;
break;
case R_ARM_GNU_VTENTRY:
bfd_reloc->howto = & elf32_arm_vtentry_howto;
break;
case R_ARM_THM_PC11:
bfd_reloc->howto = & elf32_arm_thm_pc11_howto;
break;
case R_ARM_THM_PC9:
bfd_reloc->howto = & elf32_arm_thm_pc9_howto;
break;
default:
if (r_type >= NUM_ELEM (elf32_arm_howto_table))
bfd_reloc->howto = NULL;
@ -611,7 +614,7 @@ elf32_arm_info_to_howto (abfd, bfd_reloc, elf_reloc)
break;
}
}
struct elf32_arm_reloc_map
{
bfd_reloc_code_real_type bfd_reloc_val;
@ -622,6 +625,8 @@ static const struct elf32_arm_reloc_map elf32_arm_reloc_map[] =
{
{BFD_RELOC_NONE, R_ARM_NONE},
{BFD_RELOC_ARM_PCREL_BRANCH, R_ARM_PC24},
{BFD_RELOC_ARM_PCREL_BLX, R_ARM_XPC25},
{BFD_RELOC_THUMB_PCREL_BLX, R_ARM_THM_XPC22},
{BFD_RELOC_32, R_ARM_ABS32},
{BFD_RELOC_32_PCREL, R_ARM_REL32},
{BFD_RELOC_8, R_ARM_ABS8},
@ -664,7 +669,7 @@ elf32_arm_reloc_type_lookup (abfd, code)
for (i = 0; i < NUM_ELEM (elf32_arm_reloc_map); i ++)
if (elf32_arm_reloc_map[i].bfd_reloc_val == code)
return & elf32_arm_howto_table[elf32_arm_reloc_map[i].elf_reloc_val];
return NULL;
}
}

View File

@ -1,5 +1,5 @@
/* 32-bit ELF support for ARM old abi option.
Copyright 1999 Free Software Foundation, Inc.
Copyright 1999, 2000 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@ -17,7 +17,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "elf/arm-oabi.h"
#define OLD_ARM_ABI
#include "elf/arm.h"
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
@ -263,7 +265,7 @@ static reloc_howto_type elf32_arm_howto_table[] =
false), /* pcrel_offset */
/* XXX - gap in index numbering here. */
HOWTO (R_ARM_PLT32, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@ -277,7 +279,7 @@ static reloc_howto_type elf32_arm_howto_table[] =
0x00ffffff, /* src_mask */
0x00ffffff, /* dst_mask */
true), /* pcrel_offset */
/* XXX - gap in index numbering here. */
HOWTO (R_ARM_RREL32, /* type */
@ -344,7 +346,7 @@ find_howto (r_type)
unsigned int r_type;
{
int i;
for (i = NUM_ELEM (elf32_arm_howto_table); i--;)
if (elf32_arm_howto_table [i].type == r_type)
return elf32_arm_howto_table + i;
@ -388,7 +390,7 @@ static const struct elf32_arm_reloc_map elf32_arm_reloc_map[] =
{BFD_RELOC_NONE, R_ARM_SBREL32 },
{BFD_RELOC_NONE, R_ARM_AMP_VCALL9 },
{BFD_RELOC_THUMB_PCREL_BRANCH12, R_ARM_THM_PC11 },
{BFD_RELOC_THUMB_PCREL_BRANCH9, R_ARM_THM_PC9 },
{BFD_RELOC_THUMB_PCREL_BRANCH9, R_ARM_THM_PC9 },
{BFD_RELOC_VTABLE_INHERIT, R_ARM_GNU_VTINHERIT },
{BFD_RELOC_VTABLE_ENTRY, R_ARM_GNU_VTENTRY }
};
@ -406,7 +408,7 @@ elf32_arm_reloc_type_lookup (abfd, code)
if (code == BFD_RELOC_ARM_PLT32)
return find_howto (R_ARM_PLT32);
return NULL;
}

View File

@ -1,6 +1,6 @@
/* ELF executable support for BFD.
Copyright 1991, 92, 93, 94, 95, 96, 97, 98, 1999 Free Software
Foundation, Inc.
Copyright 1991, 92, 93, 94, 95, 96, 97, 98, 1999, 2000 Free
Software Foundation, Inc.
Written by Fred Fish @ Cygnus Support, from information published
in "UNIX System V Release 4, Programmers Guide: ANSI C and
@ -118,6 +118,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define elf_add_dynamic_entry NAME(bfd_elf,add_dynamic_entry)
#define elf_write_shdrs_and_ehdr NAME(bfd_elf,write_shdrs_and_ehdr)
#define elf_write_out_phdrs NAME(bfd_elf,write_out_phdrs)
#define elf_write_relocs NAME(bfd_elf,write_relocs)
#define elf_slurp_reloc_table NAME(bfd_elf,slurp_reloc_table)
#define elf_link_create_dynamic_sections \
NAME(bfd_elf,link_create_dynamic_sections)
#define elf_link_record_dynamic_symbol _bfd_elf_link_record_dynamic_symbol
@ -165,13 +167,9 @@ static void elf_swap_shdr_out
#define section_from_elf_index bfd_section_from_elf_index
static boolean elf_slurp_reloc_table_from_section
static boolean elf_slurp_reloc_table_from_section
PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, bfd_size_type,
arelent *, asymbol **, boolean));
static boolean elf_slurp_reloc_table
PARAMS ((bfd *, asection *, asymbol **, boolean));
static void write_relocs PARAMS ((bfd *, asection *, PTR));
static boolean elf_file_p PARAMS ((Elf_External_Ehdr *));
@ -199,7 +197,7 @@ static char *elf_symbol_flags PARAMS ((flagword));
#endif
/* Translate an ELF symbol in external format into an ELF symbol in internal
format. */
format. */
void
elf_swap_symbol_in (abfd, src, dst)
@ -221,7 +219,7 @@ elf_swap_symbol_in (abfd, src, dst)
}
/* Translate an ELF symbol in internal format into an ELF symbol in external
format. */
format. */
void
elf_swap_symbol_out (abfd, src, cdst)
@ -238,9 +236,8 @@ elf_swap_symbol_out (abfd, src, cdst)
bfd_h_put_16 (abfd, src->st_shndx, dst->st_shndx);
}
/* Translate an ELF file header in external format into an ELF file header in
internal format. */
internal format. */
static void
elf_swap_ehdr_in (abfd, src, dst)
@ -248,11 +245,15 @@ elf_swap_ehdr_in (abfd, src, dst)
const Elf_External_Ehdr *src;
Elf_Internal_Ehdr *dst;
{
int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
memcpy (dst->e_ident, src->e_ident, EI_NIDENT);
dst->e_type = bfd_h_get_16 (abfd, (bfd_byte *) src->e_type);
dst->e_machine = bfd_h_get_16 (abfd, (bfd_byte *) src->e_machine);
dst->e_version = bfd_h_get_32 (abfd, (bfd_byte *) src->e_version);
dst->e_entry = get_word (abfd, (bfd_byte *) src->e_entry);
if (signed_vma)
dst->e_entry = get_signed_word (abfd, (bfd_byte *) src->e_entry);
else
dst->e_entry = get_word (abfd, (bfd_byte *) src->e_entry);
dst->e_phoff = get_word (abfd, (bfd_byte *) src->e_phoff);
dst->e_shoff = get_word (abfd, (bfd_byte *) src->e_shoff);
dst->e_flags = bfd_h_get_32 (abfd, (bfd_byte *) src->e_flags);
@ -265,7 +266,7 @@ elf_swap_ehdr_in (abfd, src, dst)
}
/* Translate an ELF file header in internal format into an ELF file header in
external format. */
external format. */
static void
elf_swap_ehdr_out (abfd, src, dst)
@ -273,12 +274,16 @@ elf_swap_ehdr_out (abfd, src, dst)
const Elf_Internal_Ehdr *src;
Elf_External_Ehdr *dst;
{
int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
memcpy (dst->e_ident, src->e_ident, EI_NIDENT);
/* note that all elements of dst are *arrays of unsigned char* already... */
/* note that all elements of dst are *arrays of unsigned char* already... */
bfd_h_put_16 (abfd, src->e_type, dst->e_type);
bfd_h_put_16 (abfd, src->e_machine, dst->e_machine);
bfd_h_put_32 (abfd, src->e_version, dst->e_version);
put_word (abfd, src->e_entry, dst->e_entry);
if (signed_vma)
put_signed_word (abfd, src->e_entry, dst->e_entry);
else
put_word (abfd, src->e_entry, dst->e_entry);
put_word (abfd, src->e_phoff, dst->e_phoff);
put_word (abfd, src->e_shoff, dst->e_shoff);
bfd_h_put_32 (abfd, src->e_flags, dst->e_flags);
@ -290,9 +295,8 @@ elf_swap_ehdr_out (abfd, src, dst)
bfd_h_put_16 (abfd, src->e_shstrndx, dst->e_shstrndx);
}
/* Translate an ELF section header table entry in external format into an
ELF section header table entry in internal format. */
ELF section header table entry in internal format. */
static void
elf_swap_shdr_in (abfd, src, dst)
@ -320,7 +324,7 @@ elf_swap_shdr_in (abfd, src, dst)
}
/* Translate an ELF section header table entry in internal format into an
ELF section header table entry in external format. */
ELF section header table entry in external format. */
static void
elf_swap_shdr_out (abfd, src, dst)
@ -328,7 +332,7 @@ elf_swap_shdr_out (abfd, src, dst)
const Elf_Internal_Shdr *src;
Elf_External_Shdr *dst;
{
/* note that all elements of dst are *arrays of unsigned char* already... */
/* note that all elements of dst are *arrays of unsigned char* already... */
bfd_h_put_32 (abfd, src->sh_name, dst->sh_name);
bfd_h_put_32 (abfd, src->sh_type, dst->sh_type);
put_word (abfd, src->sh_flags, dst->sh_flags);
@ -341,9 +345,8 @@ elf_swap_shdr_out (abfd, src, dst)
put_word (abfd, src->sh_entsize, dst->sh_entsize);
}
/* Translate an ELF program header table entry in external format into an
ELF program header table entry in internal format. */
ELF program header table entry in internal format. */
void
elf_swap_phdr_in (abfd, src, dst)
@ -377,7 +380,7 @@ elf_swap_phdr_out (abfd, src, dst)
const Elf_Internal_Phdr *src;
Elf_External_Phdr *dst;
{
/* note that all elements of dst are *arrays of unsigned char* already... */
/* note that all elements of dst are *arrays of unsigned char* already... */
bfd_h_put_32 (abfd, src->p_type, dst->p_type);
put_word (abfd, src->p_offset, dst->p_offset);
put_word (abfd, src->p_vaddr, dst->p_vaddr);
@ -388,7 +391,7 @@ elf_swap_phdr_out (abfd, src, dst)
put_word (abfd, src->p_align, dst->p_align);
}
/* Translate an ELF reloc from external format to internal format. */
/* Translate an ELF reloc from external format to internal format. */
INLINE void
elf_swap_reloc_in (abfd, src, dst)
bfd *abfd;
@ -410,7 +413,7 @@ elf_swap_reloca_in (abfd, src, dst)
dst->r_addend = get_signed_word (abfd, (bfd_byte *) src->r_addend);
}
/* Translate an ELF reloc from internal format to external format. */
/* Translate an ELF reloc from internal format to external format. */
INLINE void
elf_swap_reloc_out (abfd, src, dst)
bfd *abfd;
@ -458,7 +461,6 @@ elf_swap_dyn_out (abfd, src, p)
/* ELF .o/exec file reading */
/* Begin processing a given object.
First we validate the file by reading in the ELF header and checking
@ -494,9 +496,18 @@ elf_object_p (abfd)
char *shstrtab; /* Internal copy of section header stringtab */
struct elf_backend_data *ebd;
struct elf_obj_tdata *preserved_tdata = elf_tdata (abfd);
struct sec *preserved_sections = abfd->sections;
unsigned int preserved_section_count = abfd->section_count;
enum bfd_architecture previous_arch = bfd_get_arch (abfd);
unsigned long previous_mach = bfd_get_mach (abfd);
struct elf_obj_tdata *new_tdata = NULL;
asection *s;
/* Clear section information, since there might be a recognized bfd that
we now check if we can replace, and we don't want to append to it. */
abfd->sections = NULL;
abfd->section_count = 0;
/* Read in the ELF header in external format. */
if (bfd_read ((PTR) & x_ehdr, sizeof (x_ehdr), 1, abfd) != sizeof (x_ehdr))
@ -511,7 +522,7 @@ elf_object_p (abfd)
make use of. The magic number must match, the address size ('class')
and byte-swapping must match our XVEC entry, and it must have a
section header table (FIXME: See comments re sections at top of this
file). */
file). */
if ((elf_file_p (&x_ehdr) == false) ||
(x_ehdr.e_ident[EI_VERSION] != EV_CURRENT) ||
@ -554,13 +565,13 @@ elf_object_p (abfd)
if (i_ehdrp->e_type == ET_CORE)
goto got_wrong_format_error;
/* If there is no section header table, we're hosed. */
/* If there is no section header table, we're hosed. */
if (i_ehdrp->e_shoff == 0)
goto got_wrong_format_error;
/* As a simple sanity check, verify that the what BFD thinks is the
size of each section header table entry actually matches the size
recorded in the file. */
recorded in the file. */
if (i_ehdrp->e_shentsize != sizeof (x_shdr))
goto got_wrong_format_error;
@ -614,8 +625,8 @@ elf_object_p (abfd)
goto got_no_match;
}
/* Remember the entry point specified in the ELF file header. */
bfd_get_start_address (abfd) = i_ehdrp->e_entry;
/* Remember the entry point specified in the ELF file header. */
bfd_set_start_address (abfd, i_ehdrp->e_entry);
/* Allocate space for a copy of the section header table in
internal form, seek to the section header table in the file,
@ -680,7 +691,7 @@ elf_object_p (abfd)
}
/* Read in the string table containing the names of the sections. We
will need the base pointer to this table later. */
will need the base pointer to this table later. */
/* We read this inline now, so that we don't have to go through
bfd_section_from_shdr with it (since this particular strtab is
used to find all of the ELF section names.) */
@ -729,6 +740,16 @@ elf_object_p (abfd)
return (abfd->xvec);
got_wrong_format_error:
/* There is way too much undoing of half-known state here. The caller,
bfd_check_format_matches, really shouldn't iterate on live bfd's to
check match/no-match like it does. We have to rely on that a call to
bfd_default_set_arch_mach with the previously known mach, undoes what
was done by the first bfd_default_set_arch_mach (with mach 0) here.
For this to work, only elf-data and the mach may be changed by the
target-specific elf_backend_object_p function. Note that saving the
whole bfd here and restoring it would be even worse; the first thing
you notice is that the cached bfd file position gets out of sync. */
bfd_default_set_arch_mach (abfd, previous_arch, previous_mach);
bfd_set_error (bfd_error_wrong_format);
got_no_match:
if (new_tdata != NULL
@ -739,6 +760,8 @@ elf_object_p (abfd)
if (new_tdata != NULL)
bfd_release (abfd, new_tdata);
elf_tdata (abfd) = preserved_tdata;
abfd->sections = preserved_sections;
abfd->section_count = preserved_section_count;
return (NULL);
}
@ -746,8 +769,8 @@ elf_object_p (abfd)
/* Write out the relocs. */
static void
write_relocs (abfd, sec, data)
void
elf_write_relocs (abfd, sec, data)
bfd *abfd;
asection *sec;
PTR data;
@ -795,7 +818,7 @@ write_relocs (abfd, sec, data)
SHT_REL section. */
abort ();
/* orelocation has the data, reloc_count has the count... */
/* orelocation has the data, reloc_count has the count... */
if (use_rela_p)
{
outbound_relocas = (Elf_External_Rela *) rela_hdr->contents;
@ -941,7 +964,7 @@ elf_write_shdrs_and_ehdr (abfd)
i_ehdrp = elf_elfheader (abfd);
i_shdrp = elf_elfsections (abfd);
/* swap the header before spitting it out... */
/* swap the header before spitting it out... */
#if DEBUG & 1
elf_debug_file (i_ehdrp);
@ -952,7 +975,7 @@ elf_write_shdrs_and_ehdr (abfd)
!= sizeof (x_ehdr)))
return false;
/* at this point we've concocted all the ELF sections... */
/* at this point we've concocted all the ELF sections... */
x_shdrp = (Elf_External_Shdr *)
bfd_alloc (abfd, sizeof (*x_shdrp) * (i_ehdrp->e_shnum));
if (!x_shdrp)
@ -970,7 +993,7 @@ elf_write_shdrs_and_ehdr (abfd)
!= sizeof (*x_shdrp) * i_ehdrp->e_shnum))
return false;
/* need to dump the string table too... */
/* need to dump the string table too... */
return true;
}
@ -998,7 +1021,7 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
based on a one-to-one mapping of the ELF symbols to canonical
symbols. We actually use all the ELF symbols, so there will be no
space left over at the end. When we have all the symbols, we
build the caller's pointer vector. */
build the caller's pointer vector. */
if (! dynamic)
{
@ -1226,7 +1249,7 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
return -1;
}
/* Read relocations for ASECT from REL_HDR. There are RELOC_COUNT of
/* Read relocations for ASECT from REL_HDR. There are RELOC_COUNT of
them. */
static boolean
@ -1325,7 +1348,7 @@ elf_slurp_reloc_table_from_section (abfd, asect, rel_hdr, reloc_count,
/* Read in and swap the external relocs. */
static boolean
boolean
elf_slurp_reloc_table (abfd, asect, symbols, dynamic)
bfd *abfd;
asection *asect;
@ -1351,7 +1374,7 @@ elf_slurp_reloc_table (abfd, asect, symbols, dynamic)
rel_hdr = &d->rel_hdr;
reloc_count = rel_hdr->sh_size / rel_hdr->sh_entsize;
rel_hdr2 = d->rel_hdr2;
reloc_count2 = (rel_hdr2
reloc_count2 = (rel_hdr2
? (rel_hdr2->sh_size / rel_hdr2->sh_entsize)
: 0);
@ -1375,8 +1398,8 @@ elf_slurp_reloc_table (abfd, asect, symbols, dynamic)
reloc_count2 = 0;
}
relents = ((arelent *)
bfd_alloc (abfd,
relents = ((arelent *)
bfd_alloc (abfd,
(reloc_count + reloc_count2) * sizeof (arelent)));
if (relents == NULL)
return false;
@ -1386,15 +1409,14 @@ elf_slurp_reloc_table (abfd, asect, symbols, dynamic)
relents,
symbols, dynamic))
return false;
if (rel_hdr2
if (rel_hdr2
&& !elf_slurp_reloc_table_from_section (abfd, asect,
rel_hdr2, reloc_count2,
relents + reloc_count,
symbols, dynamic))
return false;
asect->relocation = relents;
return true;
}
@ -1527,13 +1549,13 @@ const struct elf_size_info NAME(_bfd_elf,size_info) = {
sizeof (Elf_External_Sym),
sizeof (Elf_External_Dyn),
sizeof (Elf_External_Note),
ARCH_SIZE / 8,
4,
1,
ARCH_SIZE, FILE_ALIGN,
ELFCLASS, EV_CURRENT,
elf_write_out_phdrs,
elf_write_shdrs_and_ehdr,
write_relocs,
elf_write_relocs,
elf_swap_symbol_out,
elf_slurp_reloc_table,
elf_slurp_symbol_table,

View File

@ -17,7 +17,6 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
char*
elf_core_file_failing_command (abfd)
bfd *abfd;
@ -32,7 +31,6 @@ elf_core_file_failing_signal (abfd)
return elf_tdata (abfd)->core_signal;
}
boolean
elf_core_file_matches_executable_p (core_bfd, exec_bfd)
bfd *core_bfd;
@ -40,7 +38,7 @@ elf_core_file_matches_executable_p (core_bfd, exec_bfd)
{
char* corename;
/* xvecs must match if both are ELF files for the same target. */
/* xvecs must match if both are ELF files for the same target. */
if (core_bfd->xvec != exec_bfd->xvec)
{
@ -48,7 +46,7 @@ elf_core_file_matches_executable_p (core_bfd, exec_bfd)
return false;
}
/* See if the name in the corefile matches the executable name. */
/* See if the name in the corefile matches the executable name. */
corename = elf_tdata (core_bfd)->core_program;
if (corename != NULL)
@ -63,7 +61,6 @@ elf_core_file_matches_executable_p (core_bfd, exec_bfd)
return true;
}
/* Core files are simply standard ELF formatted files that partition
the file using the execution view of the file (program header table)
rather than the linking view. In fact, there is no section header
@ -83,9 +80,11 @@ elf_core_file_p (abfd)
{
Elf_External_Ehdr x_ehdr; /* Elf file header, external form */
Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */
Elf_Internal_Phdr *i_phdrp; /* Elf program header, internal form */
Elf_Internal_Phdr *i_phdrp = NULL; /* Elf program header, internal form */
unsigned int phindex;
struct elf_backend_data *ebd;
struct elf_obj_tdata *preserved_tdata = elf_tdata (abfd);
struct elf_obj_tdata *new_tdata = NULL;
/* Read in the ELF header in external format. */
if (bfd_read ((PTR) & x_ehdr, sizeof (x_ehdr), 1, abfd) != sizeof (x_ehdr))
@ -95,21 +94,17 @@ elf_core_file_p (abfd)
return NULL;
}
/* Check the magic number. */
/* Check the magic number. */
if (elf_file_p (&x_ehdr) == false)
{
wrong:
bfd_set_error (bfd_error_wrong_format);
return NULL;
}
goto wrong;
/* FIXME: Check EI_VERSION here ! */
/* Check the address size ("class"). */
/* Check the address size ("class"). */
if (x_ehdr.e_ident[EI_CLASS] != ELFCLASS)
goto wrong;
/* Check the byteorder. */
/* Check the byteorder. */
switch (x_ehdr.e_ident[EI_DATA])
{
case ELFDATA2MSB: /* Big-endian */
@ -124,15 +119,14 @@ elf_core_file_p (abfd)
goto wrong;
}
/* Give abfd an elf_obj_tdata. */
elf_tdata (abfd) =
/* Give abfd an elf_obj_tdata. */
new_tdata =
(struct elf_obj_tdata *) bfd_zalloc (abfd, sizeof (struct elf_obj_tdata));
if (elf_tdata (abfd) == NULL)
if (new_tdata == NULL)
return NULL;
elf_tdata (abfd) = new_tdata;
/* FIXME: from here on down, "goto wrong" will leak memory. */
/* Swap in the rest of the header, now that we have the byte order. */
/* Swap in the rest of the header, now that we have the byte order. */
i_ehdrp = elf_elfheader (abfd);
elf_swap_ehdr_in (abfd, &x_ehdr, i_ehdrp);
@ -176,7 +170,7 @@ elf_core_file_p (abfd)
}
/* If there is no program header, or the type is not a core file, then
we are hosed. */
we are hosed. */
if (i_ehdrp->e_phoff == 0 || i_ehdrp->e_type != ET_CORE)
goto wrong;
@ -185,42 +179,64 @@ elf_core_file_p (abfd)
if (i_ehdrp->e_phentsize != sizeof (Elf_External_Phdr))
goto wrong;
/* Allocate space for the program headers. */
/* Move to the start of the program headers. */
if (bfd_seek (abfd, i_ehdrp->e_phoff, SEEK_SET) != 0)
goto wrong;
/* Allocate space for the program headers. */
i_phdrp = (Elf_Internal_Phdr *)
bfd_alloc (abfd, sizeof (*i_phdrp) * i_ehdrp->e_phnum);
if (!i_phdrp)
return NULL;
goto fail;
elf_tdata (abfd)->phdr = i_phdrp;
/* Read and convert to internal form. */
/* Read and convert to internal form. */
for (phindex = 0; phindex < i_ehdrp->e_phnum; ++phindex)
{
Elf_External_Phdr x_phdr;
if (bfd_read ((PTR) &x_phdr, sizeof (x_phdr), 1, abfd)
!= sizeof (x_phdr))
return NULL;
goto fail;
elf_swap_phdr_in (abfd, &x_phdr, i_phdrp + phindex);
}
/* Process each program header. */
/* Process each program header. */
for (phindex = 0; phindex < i_ehdrp->e_phnum; ++phindex)
{
if (!_bfd_elfcore_section_from_phdr (abfd, i_phdrp + phindex, phindex))
return NULL;
goto fail;
}
/* Set the machine architecture. */
/* Set the machine architecture. */
if (! bfd_default_set_arch_mach (abfd, ebd->arch, 0))
{
/* It's OK if this fails for the generic target. */
if (ebd->elf_machine_code != EM_NONE)
return NULL;
goto fail;
}
/* Save the entry point from the ELF header. */
/* Save the entry point from the ELF header. */
bfd_get_start_address (abfd) = i_ehdrp->e_entry;
/* Let the backend double check the format and override global
information. */
if (ebd->elf_backend_object_p)
{
if ((*ebd->elf_backend_object_p) (abfd) == false)
goto wrong;
}
return abfd->xvec;
wrong:
bfd_set_error (bfd_error_wrong_format);
fail:
if (i_phdrp != NULL)
bfd_release (abfd, i_phdrp);
if (new_tdata != NULL)
bfd_release (abfd, new_tdata);
elf_tdata (abfd) = preserved_tdata;
return NULL;
}

View File

@ -41,9 +41,17 @@ _bfd_elf_create_got_section (abfd, info)
switch (bed->s->arch_size)
{
case 32: ptralign = 2; break;
case 64: ptralign = 3; break;
default: abort();
case 32:
ptralign = 2;
break;
case 64:
ptralign = 3;
break;
default:
bfd_set_error (bfd_error_bad_value);
return false;
}
flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
@ -89,7 +97,6 @@ _bfd_elf_create_got_section (abfd, info)
return true;
}
/* Create dynamic sections when linking against a dynamic object. */
boolean
@ -104,9 +111,17 @@ _bfd_elf_create_dynamic_sections (abfd, info)
switch (bed->s->arch_size)
{
case 32: ptralign = 2; break;
case 64: ptralign = 3; break;
default: abort();
case 32:
ptralign = 2;
break;
case 64:
ptralign = 3;
break;
default:
bfd_set_error (bfd_error_bad_value);
return false;
}
/* We need to create .plt, .rel[a].plt, .got, .got.plt, .dynbss, and
@ -147,7 +162,7 @@ _bfd_elf_create_dynamic_sections (abfd, info)
return false;
}
s = bfd_make_section (abfd,
s = bfd_make_section (abfd,
bed->default_use_rela_p ? ".rela.plt" : ".rel.plt");
if (s == NULL
|| ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
@ -183,9 +198,9 @@ _bfd_elf_create_dynamic_sections (abfd, info)
copy relocs. */
if (! info->shared)
{
s = bfd_make_section (abfd,
(bed->default_use_rela_p
? ".rela.bss" : ".rel.bss"));
s = bfd_make_section (abfd,
(bed->default_use_rela_p
? ".rela.bss" : ".rel.bss"));
if (s == NULL
|| ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
|| ! bfd_set_section_alignment (abfd, s, ptralign))
@ -196,7 +211,6 @@ _bfd_elf_create_dynamic_sections (abfd, info)
return true;
}
/* Record a new dynamic symbol. We record the dynamic symbols as we
read the input files, since we need to have a list of all of them
before we can determine the final sizes of the output sections.
@ -482,7 +496,6 @@ _bfd_elf_create_linker_section (abfd, info, which, defaults)
return lsect;
}
/* Find a linker generated pointer with a given addend and type. */
@ -500,7 +513,6 @@ _bfd_elf_find_pointer_linker_section (linker_pointers, addend, which)
return (elf_linker_section_pointers_t *)0;
}
/* Make the .rela section corresponding to the generated linker section. */

File diff suppressed because it is too large Load Diff

View File

@ -237,6 +237,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef elf_backend_section_from_shdr
#define elf_backend_section_from_shdr 0
#endif
#ifndef elf_backend_section_flags
#define elf_backend_section_flags 0
#endif
#ifndef elf_backend_section_from_phdr
#define elf_backend_section_from_phdr 0
#endif
@ -313,7 +316,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define elf_backend_hide_symbol _bfd_elf_link_hash_hide_symbol
#endif
/* Previously, backends could only use SHT_REL or SHT_RELA relocation
sections, but not both. They defined USE_REL to indicate SHT_REL
sections, and left it undefined to indicated SHT_RELA sections.
@ -323,16 +325,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#else
#undef USE_REL
#define USE_REL 1
#endif
#endif
/* Use these in new code. */
#ifndef elf_backend_may_use_rel_p
#ifndef elf_backend_may_use_rel_p
#define elf_backend_may_use_rel_p USE_REL
#endif
#endif
#ifndef elf_backend_may_use_rela_p
#define elf_backend_may_use_rela_p !USE_REL
#endif
#ifndef elf_backend_default_use_rela_p
#ifndef elf_backend_default_use_rela_p
#define elf_backend_default_use_rela_p !USE_REL
#endif
@ -354,6 +356,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
extern const struct elf_size_info _bfd_elfNN_size_info;
#ifndef INCLUDED_TARGET_FILE
static CONST struct elf_backend_data elfNN_bed =
{
ELF_ARCH, /* arch */
@ -368,6 +371,7 @@ static CONST struct elf_backend_data elfNN_bed =
elf_backend_get_symbol_type,
elf_backend_section_processing,
elf_backend_section_from_shdr,
elf_backend_section_flags,
elf_backend_section_from_phdr,
elf_backend_fake_sections,
elf_backend_section_from_bfd_section,
@ -413,6 +417,7 @@ static CONST struct elf_backend_data elfNN_bed =
elf_backend_can_gc_sections,
elf_backend_want_dynbss
};
#endif
/* Forward declaration for use when initialising alternative_target field. */
#ifdef TARGET_LITTLE_SYM
@ -603,7 +608,7 @@ const bfd_target TARGET_LITTLE_SYM =
#else
NULL,
#endif
/* backend_data: */
(PTR) &elfNN_bed
};

View File

@ -23,7 +23,7 @@ SECTION
File formats
A format is a BFD concept of high level file contents type. The
formats supported by BFD are:
formats supported by BFD are:
o <<bfd_object>>
@ -37,7 +37,6 @@ SECTION
The BFD contains the result of an executable core dump.
*/
#include "bfd.h"
@ -68,7 +67,7 @@ DESCRIPTION
the file, or an error results.
The function returns <<true>> on success, otherwise <<false>>
with one of the following error codes:
with one of the following error codes:
o <<bfd_error_invalid_operation>> -
if <<format>> is not one of <<bfd_object>>, <<bfd_archive>> or
@ -109,7 +108,7 @@ DESCRIPTION
Then the user may choose a format and try again.
When done with the list that @var{matching} points to, the caller
should free it.
should free it.
*/
boolean
@ -125,20 +124,20 @@ bfd_check_format_matches (abfd, format, matching)
if (!bfd_read_p (abfd) ||
((int)(abfd->format) < (int)bfd_unknown) ||
((int)(abfd->format) >= (int)bfd_type_end)) {
bfd_set_error (bfd_error_invalid_operation);
return false;
}
((int)(abfd->format) >= (int)bfd_type_end))
{
bfd_set_error (bfd_error_invalid_operation);
return false;
}
if (abfd->format != bfd_unknown)
return (abfd->format == format)? true: false;
/* Since the target type was defaulted, check them
/* Since the target type was defaulted, check them
all in the hope that one will be uniquely recognized. */
save_targ = abfd->xvec;
match_count = 0;
if (matching)
{
matching_vector =
@ -149,119 +148,147 @@ bfd_check_format_matches (abfd, format, matching)
matching_vector[0] = NULL;
*matching = matching_vector;
}
right_targ = 0;
/* presume the answer is yes */
/* Presume the answer is yes. */
abfd->format = format;
/* If the target type was explicitly specified, just check that target. */
if (!abfd->target_defaulted)
{
if (bfd_seek (abfd, (file_ptr)0, SEEK_SET) != 0) /* rewind! */
return false;
if (!abfd->target_defaulted) {
if (bfd_seek (abfd, (file_ptr)0, SEEK_SET) != 0) /* rewind! */
return false;
right_targ = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
if (right_targ) {
abfd->xvec = right_targ; /* Set the target as returned */
if (matching)
free (matching_vector);
return true; /* File position has moved, BTW */
right_targ = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
if (right_targ)
{
abfd->xvec = right_targ; /* Set the target as returned. */
if (matching)
free (matching_vector);
return true; /* File position has moved, BTW. */
}
/* For a long time the code has dropped through to check all
targets if the specified target was wrong. I don't know why,
and I'm reluctant to change it. However, in the case of an
archive, it can cause problems. If the specified target does
not permit archives (e.g., the binary target), then we should
not allow some other target to recognize it as an archive, but
should instead allow the specified target to recognize it as an
object. When I first made this change, it broke the PE target,
because the specified pei-i386 target did not recognize the
actual pe-i386 archive. Since there may be other problems of
this sort, I changed this test to check only for the binary
target. */
if (format == bfd_archive && save_targ == &binary_vec)
{
abfd->xvec = save_targ;
abfd->format = bfd_unknown;
if (matching)
free (matching_vector);
bfd_set_error (bfd_error_file_not_recognized);
return false;
}
}
/* For a long time the code has dropped through to check all
targets if the specified target was wrong. I don't know why,
and I'm reluctant to change it. However, in the case of an
archive, it can cause problems. If the specified target does
not permit archives (e.g., the binary target), then we should
not allow some other target to recognize it as an archive, but
should instead allow the specified target to recognize it as an
object. When I first made this change, it broke the PE target,
because the specified pei-i386 target did not recognize the
actual pe-i386 archive. Since there may be other problems of
this sort, I changed this test to check only for the binary
target. */
for (target = bfd_target_vector; *target != NULL; target++)
{
const bfd_target *temp;
if (format == bfd_archive && save_targ == &binary_vec)
{
abfd->xvec = save_targ;
abfd->format = bfd_unknown;
if (matching)
free (matching_vector);
bfd_set_error (bfd_error_file_not_recognized);
if (*target == &binary_vec)
continue;
abfd->xvec = *target; /* Change BFD's target temporarily */
if (bfd_seek (abfd, (file_ptr)0, SEEK_SET) != 0)
return false;
}
}
for (target = bfd_target_vector; *target != NULL; target++) {
const bfd_target *temp;
/* If _bfd_check_format neglects to set bfd_error, assume
bfd_error_wrong_format. We didn't used to even pay any
attention to bfd_error, so I suspect that some
_bfd_check_format might have this problem. */
bfd_set_error (bfd_error_wrong_format);
if (*target == &binary_vec)
continue;
temp = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
if (temp)
{ /* This format checks out as ok! */
right_targ = temp;
abfd->xvec = *target; /* Change BFD's target temporarily */
if (bfd_seek (abfd, (file_ptr)0, SEEK_SET) != 0)
return false;
/* If _bfd_check_format neglects to set bfd_error, assume bfd_error_wrong_format.
We didn't used to even pay any attention to bfd_error, so I suspect
that some _bfd_check_format might have this problem. */
bfd_set_error (bfd_error_wrong_format);
temp = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
if (temp) { /* This format checks out as ok! */
right_targ = temp;
if (matching)
{
matching_vector[match_count] = temp->name;
matching_vector[match_count + 1] = NULL;
}
match_count++;
/* If this is the default target, accept it, even if other targets
might match. People who want those other targets have to set
the GNUTARGET variable. */
if (temp == bfd_default_vector[0])
{
if (matching)
{
matching_vector[0] = temp->name;
matching_vector[1] = NULL;
matching_vector[match_count] = temp->name;
matching_vector[match_count + 1] = NULL;
}
match_count++;
/* If this is the default target, accept it, even if other
targets might match. People who want those other targets
have to set the GNUTARGET variable. */
if (temp == bfd_default_vector[0])
{
if (matching)
{
matching_vector[0] = temp->name;
matching_vector[1] = NULL;
}
match_count = 1;
break;
}
match_count = 1;
break;
}
#ifdef GNU960
/* Big- and little-endian b.out archives look the same, but it doesn't
* matter: there is no difference in their headers, and member file byte
* orders will (I hope) be handled appropriately by bfd. Ditto for big
* and little coff archives. And the 4 coff/b.out object formats are
* unambiguous. So accept the first match we find.
*/
break;
/* Big- and little-endian b.out archives look the same, but it
doesn't matter: there is no difference in their headers, and
member file byte orders will (I hope) be handled appropriately
by bfd. Ditto for big and little coff archives. And the 4
coff/b.out object formats are unambiguous. So accept the
first match we find. */
break;
#endif
} else if (bfd_get_error () != bfd_error_wrong_format) {
abfd->xvec = save_targ;
abfd->format = bfd_unknown;
if (matching && bfd_get_error () != bfd_error_file_ambiguously_recognized)
free (matching_vector);
return false;
}
else if (bfd_get_error () != bfd_error_wrong_format)
{
abfd->xvec = save_targ;
abfd->format = bfd_unknown;
if (matching && bfd_get_error ()
!= bfd_error_file_ambiguously_recognized)
free (matching_vector);
return false;
}
}
}
if (match_count == 1) {
abfd->xvec = right_targ; /* Change BFD's target permanently */
if (matching)
free (matching_vector);
return true; /* File position has moved, BTW */
}
if (match_count == 1)
{
abfd->xvec = right_targ; /* Change BFD's target permanently. */
if (matching)
free (matching_vector);
return true; /* File position has moved, BTW. */
}
abfd->xvec = save_targ; /* Restore original target type. */
abfd->format = bfd_unknown; /* Restore original format. */
abfd->xvec = save_targ; /* Restore original target type */
abfd->format = bfd_unknown; /* Restore original format */
if (match_count == 0)
{
bfd_set_error (bfd_error_file_not_recognized);
if (matching)
free (matching_vector);
}
else
bfd_set_error (bfd_error_file_ambiguously_recognized);
return false;
}
@ -277,7 +304,6 @@ DESCRIPTION
format @var{format}. If the target set in the BFD does not
support the format requested, the format is invalid, or the BFD
is not open for writing, then an error occurs.
*/
boolean
@ -285,29 +311,29 @@ bfd_set_format (abfd, format)
bfd *abfd;
bfd_format format;
{
if (bfd_read_p (abfd) ||
((int)abfd->format < (int)bfd_unknown) ||
((int)abfd->format >= (int)bfd_type_end)) {
bfd_set_error (bfd_error_invalid_operation);
return false;
}
((int)abfd->format >= (int)bfd_type_end))
{
bfd_set_error (bfd_error_invalid_operation);
return false;
}
if (abfd->format != bfd_unknown)
return (abfd->format == format) ? true:false;
return (abfd->format == format) ? true : false;
/* presume the answer is yes */
/* Presume the answer is yes. */
abfd->format = format;
if (!BFD_SEND_FMT (abfd, _bfd_set_format, (abfd))) {
abfd->format = bfd_unknown;
return false;
}
if (!BFD_SEND_FMT (abfd, _bfd_set_format, (abfd)))
{
abfd->format = bfd_unknown;
return false;
}
return true;
}
/*
FUNCTION
bfd_format_string
@ -325,18 +351,19 @@ CONST char *
bfd_format_string (format)
bfd_format format;
{
if (((int)format <(int) bfd_unknown)
|| ((int)format >=(int) bfd_type_end))
if (((int)format <(int) bfd_unknown)
|| ((int)format >=(int) bfd_type_end))
return "invalid";
switch (format) {
case bfd_object:
return "object"; /* linker/assember/compiler output */
case bfd_archive:
return "archive"; /* object archive file */
case bfd_core:
return "core"; /* core dump */
default:
return "unknown";
}
switch (format)
{
case bfd_object:
return "object"; /* Linker/assember/compiler output. */
case bfd_archive:
return "archive"; /* Object archive file. */
case bfd_core:
return "core"; /* Core dump. */
default:
return "unknown";
}
}

View File

@ -59,7 +59,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
format. I think. */
#define SWAP_MAGIC(ext) bfd_getl32 (ext)
#define MY_write_object_contents MY(write_object_contents)
static boolean MY(write_object_contents) PARAMS ((bfd *abfd));

View File

@ -268,7 +268,7 @@ SUBSUBSECTION
Write other derived routines
You will want to write other routines for your new hash table,
as well.
as well.
You will want an initialization routine which calls the
initialization routine of the hash table you are deriving from
@ -366,7 +366,7 @@ bfd_hash_lookup (table, string, create, copy)
struct bfd_hash_entry *hashp;
unsigned int len;
unsigned int index;
hash = 0;
len = 0;
s = (const unsigned char *) string;

View File

@ -1343,27 +1343,21 @@ ieee_archive_p (abfd)
ieee->h.abfd = abfd;
if (this_byte (&(ieee->h)) != Module_Beginning)
{
abfd->tdata.ieee_ar_data = save;
goto got_wrong_format_error;
}
goto got_wrong_format_error;
next_byte (&(ieee->h));
library = read_id (&(ieee->h));
if (strcmp (library, "LIBRARY") != 0)
{
bfd_release (abfd, ieee);
abfd->tdata.ieee_ar_data = save;
goto got_wrong_format_error;
}
/* Throw away the filename */
goto got_wrong_format_error;
/* Throw away the filename. */
read_id (&(ieee->h));
ieee->element_count = 0;
ieee->element_index = 0;
next_byte (&(ieee->h)); /* Drop the ad part */
must_parse_int (&(ieee->h)); /* And the two dummy numbers */
next_byte (&(ieee->h)); /* Drop the ad part. */
must_parse_int (&(ieee->h)); /* And the two dummy numbers. */
must_parse_int (&(ieee->h));
alc_elts = 10;
@ -1371,7 +1365,7 @@ ieee_archive_p (abfd)
if (elts == NULL)
goto error_return;
/* Read the index of the BB table */
/* Read the index of the BB table. */
while (1)
{
int rec;
@ -1400,14 +1394,14 @@ ieee_archive_p (abfd)
t->file_offset = must_parse_int (&(ieee->h));
t->abfd = (bfd *) NULL;
/* Make sure that we don't go over the end of the buffer */
/* Make sure that we don't go over the end of the buffer. */
if ((size_t) ieee_pos (abfd) > sizeof (buffer) / 2)
{
/* Past half way, reseek and reprime */
/* Past half way, reseek and reprime. */
buffer_offset += ieee_pos (abfd);
if (bfd_seek (abfd, buffer_offset, SEEK_SET) != 0)
goto error_return;
/* FIXME: Check return value. I'm not sure whether it needs
to read the entire buffer or not. */
bfd_read ((PTR) buffer, 1, sizeof (buffer), abfd);
@ -1421,36 +1415,33 @@ ieee_archive_p (abfd)
ieee->element_count * sizeof *ieee->elements));
if (ieee->elements == NULL)
goto error_return;
memcpy (ieee->elements, elts,
ieee->element_count * sizeof *ieee->elements);
free (elts);
elts = NULL;
/* Now scan the area again, and replace BB offsets with file */
/* offsets */
/* Now scan the area again, and replace BB offsets with file offsets. */
for (i = 2; i < ieee->element_count; i++)
{
if (bfd_seek (abfd, ieee->elements[i].file_offset, SEEK_SET) != 0)
goto error_return;
/* FIXME: Check return value. I'm not sure whether it needs to
read the entire buffer or not. */
bfd_read ((PTR) buffer, 1, sizeof (buffer), abfd);
ieee->h.first_byte = buffer;
ieee->h.input_p = buffer;
next_byte (&(ieee->h)); /* Drop F8 */
next_byte (&(ieee->h)); /* Drop 14 */
must_parse_int (&(ieee->h)); /* Drop size of block */
next_byte (&(ieee->h)); /* Drop F8. */
next_byte (&(ieee->h)); /* Drop 14. */
must_parse_int (&(ieee->h)); /* Drop size of block. */
if (must_parse_int (&(ieee->h)) != 0)
{
/* This object has been deleted */
ieee->elements[i].file_offset = 0;
}
/* This object has been deleted. */
ieee->elements[i].file_offset = 0;
else
{
ieee->elements[i].file_offset = must_parse_int (&(ieee->h));
}
ieee->elements[i].file_offset = must_parse_int (&(ieee->h));
}
/* abfd->has_armap = ;*/
@ -1458,10 +1449,14 @@ ieee_archive_p (abfd)
return abfd->xvec;
got_wrong_format_error:
bfd_release (abfd, ieee);
abfd->tdata.ieee_ar_data = save;
bfd_set_error (bfd_error_wrong_format);
error_return:
if (elts != NULL)
free (elts);
return NULL;
}
@ -3197,11 +3192,8 @@ relocate_debug (output, input)
block ();
}
/*
During linking, we we told about the bfds which made up our
contents, we have a list of them. They will still be open, so go to
the debug info in each, and copy it out, relocating it as we go.
*/
/* Gather together all the debug information from each input BFD into
one place, relocating it and emitting it as we go. */
static boolean
ieee_write_debug_part (abfd)
@ -3728,7 +3720,7 @@ ieee_make_empty_symbol (abfd)
bfd *abfd;
{
ieee_symbol_type *new =
(ieee_symbol_type *) bfd_zmalloc (sizeof (ieee_symbol_type));
(ieee_symbol_type *) bfd_zalloc (abfd, sizeof (ieee_symbol_type));
if (!new)
return NULL;
new->symbol.the_bfd = abfd;

View File

@ -245,7 +245,8 @@ enum machine_type {
M_SPARCLET_5 = 211, /* 0xd3, reserved */
M_SPARCLET_6 = 227, /* 0xe3, reserved */
/* M_SPARCLET_7 = 243 / * 0xf3, reserved */
M_SPARCLITE_LE = 243
M_SPARCLITE_LE = 243,
M_CRIS = 255 /* Axis CRIS binary. */
};
#define N_DYNAMIC(exec) ((exec).a_info & 0x80000000)

View File

@ -59,9 +59,9 @@ struct artdata {
file_ptr first_file_filepos;
/* Speed up searching the armap */
struct ar_cache *cache;
bfd *archive_head; /* Only interesting in output routines */
bfd *archive_head; /* Only interesting in output routines */
carsym *symdefs; /* the symdef entries */
symindex symdef_count; /* how many there are */
symindex symdef_count; /* how many there are */
char *extended_names; /* clever intel extension */
/* when more compilers are standard C, this can be a time_t */
long armap_timestamp; /* Timestamp value written into armap.
@ -79,9 +79,9 @@ struct artdata {
/* Goes in bfd's arelt_data slot */
struct areltdata {
char * arch_header; /* it's actually a string */
unsigned int parsed_size; /* octets of filesize not including ar_hdr */
char *filename; /* null-terminated */
char * arch_header; /* it's actually a string */
unsigned int parsed_size; /* octets of filesize not including ar_hdr */
char *filename; /* null-terminated */
};
#define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size)
@ -128,11 +128,11 @@ void bfd_void PARAMS ((bfd *ignore));
bfd *_bfd_new_bfd_contained_in PARAMS ((bfd *));
const bfd_target *_bfd_dummy_target PARAMS ((bfd *abfd));
void bfd_dont_truncate_arname PARAMS ((bfd *abfd, CONST char *filename,
void bfd_dont_truncate_arname PARAMS ((bfd *abfd, const char *filename,
char *hdr));
void bfd_bsd_truncate_arname PARAMS ((bfd *abfd, CONST char *filename,
void bfd_bsd_truncate_arname PARAMS ((bfd *abfd, const char *filename,
char *hdr));
void bfd_gnu_truncate_arname PARAMS ((bfd *abfd, CONST char *filename,
void bfd_gnu_truncate_arname PARAMS ((bfd *abfd, const char *filename,
char *hdr));
boolean bsd_write_armap PARAMS ((bfd *arch, unsigned int elength,
@ -365,7 +365,8 @@ extern boolean _bfd_dwarf1_find_nearest_line
/* Find the nearest line using DWARF 2 debugging information. */
extern boolean _bfd_dwarf2_find_nearest_line
PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
const char **, unsigned int *, unsigned int));
const char **, unsigned int *, unsigned int,
PTR *));
/* A routine to create entries for a bfd_link_hash_table. */
extern struct bfd_hash_entry *_bfd_link_hash_newfunc

View File

@ -42,7 +42,6 @@ DESCRIPTION
/* A routine which is used in target vectors for unsupported
operations. */
/*ARGSUSED*/
boolean
bfd_false (ignore)
bfd *ignore ATTRIBUTE_UNUSED;
@ -54,7 +53,6 @@ bfd_false (ignore)
/* A routine which is used in target vectors for supported operations
which do not actually do anything. */
/*ARGSUSED*/
boolean
bfd_true (ignore)
bfd *ignore ATTRIBUTE_UNUSED;
@ -65,7 +63,6 @@ bfd_true (ignore)
/* A routine which is used in target vectors for unsupported
operations which return a pointer value. */
/*ARGSUSED*/
PTR
bfd_nullvoidptr (ignore)
bfd *ignore ATTRIBUTE_UNUSED;
@ -74,23 +71,20 @@ bfd_nullvoidptr (ignore)
return NULL;
}
/*ARGSUSED*/
int
int
bfd_0 (ignore)
bfd *ignore ATTRIBUTE_UNUSED;
{
return 0;
}
/*ARGSUSED*/
unsigned int
unsigned int
bfd_0u (ignore)
bfd *ignore ATTRIBUTE_UNUSED;
{
return 0;
}
/*ARGUSED*/
long
bfd_0l (ignore)
bfd *ignore ATTRIBUTE_UNUSED;
@ -101,7 +95,6 @@ bfd_0l (ignore)
/* A routine which is used in target vectors for unsupported
operations which return -1 on error. */
/*ARGSUSED*/
long
_bfd_n1 (ignore_abfd)
bfd *ignore_abfd ATTRIBUTE_UNUSED;
@ -110,14 +103,12 @@ _bfd_n1 (ignore_abfd)
return -1;
}
/*ARGSUSED*/
void
void
bfd_void (ignore)
bfd *ignore ATTRIBUTE_UNUSED;
{
}
/*ARGSUSED*/
boolean
_bfd_nocore_core_file_matches_executable_p (ignore_core_bfd, ignore_exec_bfd)
bfd *ignore_core_bfd ATTRIBUTE_UNUSED;
@ -130,7 +121,6 @@ _bfd_nocore_core_file_matches_executable_p (ignore_core_bfd, ignore_exec_bfd)
/* Routine to handle core_file_failing_command entry point for targets
without core file support. */
/*ARGSUSED*/
char *
_bfd_nocore_core_file_failing_command (ignore_abfd)
bfd *ignore_abfd ATTRIBUTE_UNUSED;
@ -142,7 +132,6 @@ _bfd_nocore_core_file_failing_command (ignore_abfd)
/* Routine to handle core_file_failing_signal entry point for targets
without core file support. */
/*ARGSUSED*/
int
_bfd_nocore_core_file_failing_signal (ignore_abfd)
bfd *ignore_abfd ATTRIBUTE_UNUSED;
@ -151,7 +140,6 @@ _bfd_nocore_core_file_failing_signal (ignore_abfd)
return 0;
}
/*ARGSUSED*/
const bfd_target *
_bfd_dummy_target (ignore_abfd)
bfd *ignore_abfd ATTRIBUTE_UNUSED;
@ -217,13 +205,12 @@ bfd_zmalloc (size)
/* Some IO code */
/* Note that archive entries don't have streams; they share their parent's.
This allows someone to play with the iostream behind BFD's back.
Also, note that the origin pointer points to the beginning of a file's
contents (0 for non-archive elements). For archive entries this is the
first octet in the file, NOT the beginning of the archive header. */
first octet in the file, NOT the beginning of the archive header. */
static int
real_read (where, a,b, file)
@ -285,7 +272,7 @@ bfd_read (ptr, size, nitems, abfd)
return get;
}
nread = real_read (ptr, 1, (size_t)(size*nitems), bfd_cache_lookup(abfd));
nread = real_read (ptr, 1, (size_t) (size*nitems), bfd_cache_lookup(abfd));
if (nread > 0)
abfd->where += nread;
@ -317,7 +304,7 @@ struct _bfd_window_internal {
struct _bfd_window_internal *next;
PTR data;
bfd_size_type size;
int refcount : 31; /* should be enough... */
int refcount : 31; /* should be enough... */
unsigned mapped : 1; /* 1 = mmap, 0 = malloc */
};
@ -671,7 +658,7 @@ bfd_seek (abfd, position, direction)
file_ptr file_position;
/* For the time being, a BFD may not seek to it's end. The problem
is that we don't easily have a way to recognize the end of an
element in an archive. */
element in an archive. */
BFD_ASSERT (direction == SEEK_SET || direction == SEEK_CUR);
@ -683,19 +670,39 @@ bfd_seek (abfd, position, direction)
struct bfd_in_memory *bim;
bim = (struct bfd_in_memory *) abfd->iostream;
if (direction == SEEK_SET)
abfd->where = position;
else
abfd->where += position;
if ((bfd_size_type) abfd->where > bim->size)
{
abfd->where = bim->size;
bfd_set_error (bfd_error_file_truncated);
return -1;
if ((abfd->direction == write_direction) ||
(abfd->direction == both_direction))
{
long newsize, oldsize = (bim->size + 127) & ~127;
bim->size = abfd->where;
/* Round up to cut down on memory fragmentation */
newsize = (bim->size + 127) & ~127;
if (newsize > oldsize)
{
bim->buffer = bfd_realloc (bim->buffer, newsize);
if (bim->buffer == 0)
{
bim->size = 0;
bfd_set_error (bfd_error_no_memory);
return -1;
}
}
}
else
{
abfd->where = bim->size;
bfd_set_error (bfd_error_file_truncated);
return -1;
}
}
return 0;
}
@ -776,7 +783,7 @@ bfd_seek (abfd, position, direction)
/* FIXME: Should these take a count argument?
Answer (gnu@cygnus.com): No, but perhaps they should be inline
functions in swap.h #ifdef __GNUC__.
functions in swap.h #ifdef __GNUC__.
Gprof them later and find out. */
/*
@ -807,13 +814,13 @@ DESCRIPTION
.{* Byte swapping macros for user section data. *}
.
.#define bfd_put_8(abfd, val, ptr) \
. ((void) (*((unsigned char *)(ptr)) = (unsigned char)(val)))
. ((void) (*((unsigned char *) (ptr)) = (unsigned char) (val)))
.#define bfd_put_signed_8 \
. bfd_put_8
.#define bfd_get_8(abfd, ptr) \
. (*(unsigned char *)(ptr))
. (*(unsigned char *) (ptr))
.#define bfd_get_signed_8(abfd, ptr) \
. ((*(unsigned char *)(ptr) ^ 0x80) - 0x80)
. ((*(unsigned char *) (ptr) ^ 0x80) - 0x80)
.
.#define bfd_put_16(abfd, val, ptr) \
. BFD_SEND(abfd, bfd_putx16, ((val),(ptr)))
@ -856,7 +863,7 @@ DESCRIPTION
. : (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \
. : (abort (), (void) 0))
.
*/
*/
/*
FUNCTION
@ -908,7 +915,7 @@ DESCRIPTION
.#define bfd_h_get_signed_64(abfd, ptr) \
. BFD_SEND(abfd, bfd_h_getx_signed_64, (ptr))
.
*/
*/
/* Sign extension to bfd_signed_vma. */
#define COERCE16(x) (((bfd_signed_vma) (x) ^ 0x8000) - 0x8000)
@ -951,17 +958,17 @@ bfd_putb16 (data, addr)
bfd_vma data;
register bfd_byte *addr;
{
addr[0] = (bfd_byte)(data >> 8);
addr[0] = (bfd_byte) (data >> 8);
addr[1] = (bfd_byte )data;
}
void
bfd_putl16 (data, addr)
bfd_vma data;
bfd_vma data;
register bfd_byte *addr;
{
addr[0] = (bfd_byte )data;
addr[1] = (bfd_byte)(data >> 8);
addr[1] = (bfd_byte) (data >> 8);
}
bfd_vma
@ -1116,9 +1123,9 @@ bfd_putb32 (data, addr)
bfd_vma data;
register bfd_byte *addr;
{
addr[0] = (bfd_byte)(data >> 24);
addr[1] = (bfd_byte)(data >> 16);
addr[2] = (bfd_byte)(data >> 8);
addr[0] = (bfd_byte) (data >> 24);
addr[1] = (bfd_byte) (data >> 16);
addr[2] = (bfd_byte) (data >> 8);
addr[3] = (bfd_byte)data;
}
@ -1128,9 +1135,9 @@ bfd_putl32 (data, addr)
register bfd_byte *addr;
{
addr[0] = (bfd_byte)data;
addr[1] = (bfd_byte)(data >> 8);
addr[2] = (bfd_byte)(data >> 16);
addr[3] = (bfd_byte)(data >> 24);
addr[1] = (bfd_byte) (data >> 8);
addr[2] = (bfd_byte) (data >> 16);
addr[3] = (bfd_byte) (data >> 24);
}
void
@ -1139,14 +1146,14 @@ bfd_putb64 (data, addr)
register bfd_byte *addr ATTRIBUTE_UNUSED;
{
#ifdef BFD64
addr[0] = (bfd_byte)(data >> (7*8));
addr[1] = (bfd_byte)(data >> (6*8));
addr[2] = (bfd_byte)(data >> (5*8));
addr[3] = (bfd_byte)(data >> (4*8));
addr[4] = (bfd_byte)(data >> (3*8));
addr[5] = (bfd_byte)(data >> (2*8));
addr[6] = (bfd_byte)(data >> (1*8));
addr[7] = (bfd_byte)(data >> (0*8));
addr[0] = (bfd_byte) (data >> (7*8));
addr[1] = (bfd_byte) (data >> (6*8));
addr[2] = (bfd_byte) (data >> (5*8));
addr[3] = (bfd_byte) (data >> (4*8));
addr[4] = (bfd_byte) (data >> (3*8));
addr[5] = (bfd_byte) (data >> (2*8));
addr[6] = (bfd_byte) (data >> (1*8));
addr[7] = (bfd_byte) (data >> (0*8));
#else
BFD_FAIL();
#endif
@ -1158,18 +1165,66 @@ bfd_putl64 (data, addr)
register bfd_byte *addr ATTRIBUTE_UNUSED;
{
#ifdef BFD64
addr[7] = (bfd_byte)(data >> (7*8));
addr[6] = (bfd_byte)(data >> (6*8));
addr[5] = (bfd_byte)(data >> (5*8));
addr[4] = (bfd_byte)(data >> (4*8));
addr[3] = (bfd_byte)(data >> (3*8));
addr[2] = (bfd_byte)(data >> (2*8));
addr[1] = (bfd_byte)(data >> (1*8));
addr[0] = (bfd_byte)(data >> (0*8));
addr[7] = (bfd_byte) (data >> (7*8));
addr[6] = (bfd_byte) (data >> (6*8));
addr[5] = (bfd_byte) (data >> (5*8));
addr[4] = (bfd_byte) (data >> (4*8));
addr[3] = (bfd_byte) (data >> (3*8));
addr[2] = (bfd_byte) (data >> (2*8));
addr[1] = (bfd_byte) (data >> (1*8));
addr[0] = (bfd_byte) (data >> (0*8));
#else
BFD_FAIL();
#endif
}
void
bfd_put_bits (data, addr, bits, big_p)
bfd_vma data;
bfd_byte *addr;
int bits;
boolean big_p;
{
int i;
int bytes;
if (bits % 8 != 0)
abort ();
bytes = bits / 8;
for (i = 0; i < bytes; i++)
{
int index = big_p ? bytes - i - 1 : i;
addr[index] = (bfd_byte) data;
data >>= 8;
}
}
bfd_vma
bfd_get_bits (addr, bits, big_p)
bfd_byte *addr;
int bits;
boolean big_p;
{
bfd_vma data;
int i;
int bytes;
if (bits % 8 != 0)
abort ();
data = 0;
bytes = bits / 8;
for (i = 0; i < bytes; i++)
{
int index = big_p ? i : bytes - i - 1;
data = (data << 8) | addr[index];
}
return data;
}
/* Default implementation */
@ -1306,13 +1361,17 @@ _bfd_generic_verify_endian_match (ibfd, obfd)
bfd *obfd;
{
if (ibfd->xvec->byteorder != obfd->xvec->byteorder
&& ibfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN
&& obfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN)
{
(*_bfd_error_handler)
("%s: compiled for a %s endian system and target is %s endian",
bfd_get_filename (ibfd),
bfd_big_endian (ibfd) ? "big" : "little",
bfd_big_endian (obfd) ? "big" : "little");
const char *msg;
if (bfd_big_endian (ibfd))
msg = _("%s: compiled for a big endian system and target is little endian");
else
msg = _("%s: compiled for a little endian system and target is big endian");
(*_bfd_error_handler) (msg, bfd_get_filename (ibfd));
bfd_set_error (bfd_error_wrong_format);
return false;

View File

@ -59,9 +59,9 @@ struct artdata {
file_ptr first_file_filepos;
/* Speed up searching the armap */
struct ar_cache *cache;
bfd *archive_head; /* Only interesting in output routines */
bfd *archive_head; /* Only interesting in output routines */
carsym *symdefs; /* the symdef entries */
symindex symdef_count; /* how many there are */
symindex symdef_count; /* how many there are */
char *extended_names; /* clever intel extension */
/* when more compilers are standard C, this can be a time_t */
long armap_timestamp; /* Timestamp value written into armap.
@ -79,9 +79,9 @@ struct artdata {
/* Goes in bfd's arelt_data slot */
struct areltdata {
char * arch_header; /* it's actually a string */
unsigned int parsed_size; /* octets of filesize not including ar_hdr */
char *filename; /* null-terminated */
char * arch_header; /* it's actually a string */
unsigned int parsed_size; /* octets of filesize not including ar_hdr */
char *filename; /* null-terminated */
};
#define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size)
@ -128,11 +128,11 @@ void bfd_void PARAMS ((bfd *ignore));
bfd *_bfd_new_bfd_contained_in PARAMS ((bfd *));
const bfd_target *_bfd_dummy_target PARAMS ((bfd *abfd));
void bfd_dont_truncate_arname PARAMS ((bfd *abfd, CONST char *filename,
void bfd_dont_truncate_arname PARAMS ((bfd *abfd, const char *filename,
char *hdr));
void bfd_bsd_truncate_arname PARAMS ((bfd *abfd, CONST char *filename,
void bfd_bsd_truncate_arname PARAMS ((bfd *abfd, const char *filename,
char *hdr));
void bfd_gnu_truncate_arname PARAMS ((bfd *abfd, CONST char *filename,
void bfd_gnu_truncate_arname PARAMS ((bfd *abfd, const char *filename,
char *hdr));
boolean bsd_write_armap PARAMS ((bfd *arch, unsigned int elength,
@ -365,7 +365,8 @@ extern boolean _bfd_dwarf1_find_nearest_line
/* Find the nearest line using DWARF 2 debugging information. */
extern boolean _bfd_dwarf2_find_nearest_line
PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
const char **, unsigned int *, unsigned int));
const char **, unsigned int *, unsigned int,
PTR *));
/* A routine to create entries for a bfd_link_hash_table. */
extern struct bfd_hash_entry *_bfd_link_hash_newfunc
@ -551,10 +552,10 @@ extern boolean _bfd_sh_align_load_span
/* And more follows */
void
void
bfd_write_bigendian_4byte_int PARAMS ((bfd *abfd, int i));
unsigned int
unsigned int
bfd_log2 PARAMS ((bfd_vma x));
#define BFD_CACHE_MAX_OPEN 10
@ -562,15 +563,15 @@ extern bfd *bfd_last_cache;
#define bfd_cache_lookup(x) \
((x)==bfd_last_cache? \
(FILE*)(bfd_last_cache->iostream): \
(FILE*) (bfd_last_cache->iostream): \
bfd_cache_lookup_worker(x))
boolean
bfd_cache_init PARAMS ((bfd *abfd));
boolean
bfd_cache_init PARAMS ((bfd *abfd));
boolean
bfd_cache_close PARAMS ((bfd *abfd));
boolean
bfd_cache_close PARAMS ((bfd *abfd));
FILE*
FILE*
bfd_open_file PARAMS ((bfd *abfd));
FILE *
@ -714,6 +715,14 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_386_RELATIVE",
"BFD_RELOC_386_GOTOFF",
"BFD_RELOC_386_GOTPC",
"BFD_RELOC_X86_64_GOT32",
"BFD_RELOC_X86_64_PLT32",
"BFD_RELOC_X86_64_COPY",
"BFD_RELOC_X86_64_GLOB_DAT",
"BFD_RELOC_X86_64_JUMP_SLOT",
"BFD_RELOC_X86_64_RELATIVE",
"BFD_RELOC_X86_64_GOTPCREL",
"BFD_RELOC_X86_64_32S",
"BFD_RELOC_NS32K_IMM_8",
"BFD_RELOC_NS32K_IMM_16",
"BFD_RELOC_NS32K_IMM_32",
@ -765,6 +774,8 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_I370_D12",
"BFD_RELOC_CTOR",
"BFD_RELOC_ARM_PCREL_BRANCH",
"BFD_RELOC_ARM_PCREL_BLX",
"BFD_RELOC_THUMB_PCREL_BLX",
"BFD_RELOC_ARM_IMMEDIATE",
"BFD_RELOC_ARM_ADRL_IMMEDIATE",
"BFD_RELOC_ARM_OFFSET_IMM",
@ -809,6 +820,13 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_SH_CODE",
"BFD_RELOC_SH_DATA",
"BFD_RELOC_SH_LABEL",
"BFD_RELOC_SH_LOOP_START",
"BFD_RELOC_SH_LOOP_END",
"BFD_RELOC_SH_COPY",
"BFD_RELOC_SH_GLOB_DAT",
"BFD_RELOC_SH_JMP_SLOT",
"BFD_RELOC_SH_RELATIVE",
"BFD_RELOC_SH_GOTPC",
"BFD_RELOC_THUMB_PCREL_BRANCH9",
"BFD_RELOC_THUMB_PCREL_BRANCH12",
"BFD_RELOC_THUMB_PCREL_BRANCH23",
@ -857,6 +875,11 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_MN10300_32_PCREL",
"BFD_RELOC_MN10300_16_PCREL",
"BFD_RELOC_TIC30_LDP",
"BFD_RELOC_TIC54X_PARTLS7",
"BFD_RELOC_TIC54X_PARTMS9",
"BFD_RELOC_TIC54X_23",
"BFD_RELOC_TIC54X_16_OF_23",
"BFD_RELOC_TIC54X_MS7_OF_23",
"BFD_RELOC_FR30_48",
"BFD_RELOC_FR30_20",
"BFD_RELOC_FR30_6_IN_4",
@ -889,28 +912,128 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_AVR_CALL",
"BFD_RELOC_VTABLE_INHERIT",
"BFD_RELOC_VTABLE_ENTRY",
"BFD_RELOC_IA64_IMM14",
"BFD_RELOC_IA64_IMM22",
"BFD_RELOC_IA64_IMM64",
"BFD_RELOC_IA64_DIR32MSB",
"BFD_RELOC_IA64_DIR32LSB",
"BFD_RELOC_IA64_DIR64MSB",
"BFD_RELOC_IA64_DIR64LSB",
"BFD_RELOC_IA64_GPREL22",
"BFD_RELOC_IA64_GPREL64I",
"BFD_RELOC_IA64_GPREL32MSB",
"BFD_RELOC_IA64_GPREL32LSB",
"BFD_RELOC_IA64_GPREL64MSB",
"BFD_RELOC_IA64_GPREL64LSB",
"BFD_RELOC_IA64_LTOFF22",
"BFD_RELOC_IA64_LTOFF64I",
"BFD_RELOC_IA64_PLTOFF22",
"BFD_RELOC_IA64_PLTOFF64I",
"BFD_RELOC_IA64_PLTOFF64MSB",
"BFD_RELOC_IA64_PLTOFF64LSB",
"BFD_RELOC_IA64_FPTR64I",
"BFD_RELOC_IA64_FPTR32MSB",
"BFD_RELOC_IA64_FPTR32LSB",
"BFD_RELOC_IA64_FPTR64MSB",
"BFD_RELOC_IA64_FPTR64LSB",
"BFD_RELOC_IA64_PCREL21B",
"BFD_RELOC_IA64_PCREL21BI",
"BFD_RELOC_IA64_PCREL21M",
"BFD_RELOC_IA64_PCREL21F",
"BFD_RELOC_IA64_PCREL22",
"BFD_RELOC_IA64_PCREL60B",
"BFD_RELOC_IA64_PCREL64I",
"BFD_RELOC_IA64_PCREL32MSB",
"BFD_RELOC_IA64_PCREL32LSB",
"BFD_RELOC_IA64_PCREL64MSB",
"BFD_RELOC_IA64_PCREL64LSB",
"BFD_RELOC_IA64_LTOFF_FPTR22",
"BFD_RELOC_IA64_LTOFF_FPTR64I",
"BFD_RELOC_IA64_LTOFF_FPTR64MSB",
"BFD_RELOC_IA64_LTOFF_FPTR64LSB",
"BFD_RELOC_IA64_SEGREL32MSB",
"BFD_RELOC_IA64_SEGREL32LSB",
"BFD_RELOC_IA64_SEGREL64MSB",
"BFD_RELOC_IA64_SEGREL64LSB",
"BFD_RELOC_IA64_SECREL32MSB",
"BFD_RELOC_IA64_SECREL32LSB",
"BFD_RELOC_IA64_SECREL64MSB",
"BFD_RELOC_IA64_SECREL64LSB",
"BFD_RELOC_IA64_REL32MSB",
"BFD_RELOC_IA64_REL32LSB",
"BFD_RELOC_IA64_REL64MSB",
"BFD_RELOC_IA64_REL64LSB",
"BFD_RELOC_IA64_LTV32MSB",
"BFD_RELOC_IA64_LTV32LSB",
"BFD_RELOC_IA64_LTV64MSB",
"BFD_RELOC_IA64_LTV64LSB",
"BFD_RELOC_IA64_IPLTMSB",
"BFD_RELOC_IA64_IPLTLSB",
"BFD_RELOC_IA64_COPY",
"BFD_RELOC_IA64_TPREL22",
"BFD_RELOC_IA64_TPREL64MSB",
"BFD_RELOC_IA64_TPREL64LSB",
"BFD_RELOC_IA64_LTOFF_TP22",
"BFD_RELOC_IA64_LTOFF22X",
"BFD_RELOC_IA64_LDXMOV",
"BFD_RELOC_M68HC11_HI8",
"BFD_RELOC_M68HC11_LO8",
"BFD_RELOC_M68HC11_3B",
"BFD_RELOC_CRIS_BDISP8",
"BFD_RELOC_CRIS_UNSIGNED_5",
"BFD_RELOC_CRIS_SIGNED_6",
"BFD_RELOC_CRIS_UNSIGNED_6",
"BFD_RELOC_CRIS_UNSIGNED_4",
"BFD_RELOC_860_COPY",
"BFD_RELOC_860_GLOB_DAT",
"BFD_RELOC_860_JUMP_SLOT",
"BFD_RELOC_860_RELATIVE",
"BFD_RELOC_860_PC26",
"BFD_RELOC_860_PLT26",
"BFD_RELOC_860_PC16",
"BFD_RELOC_860_LOW0",
"BFD_RELOC_860_SPLIT0",
"BFD_RELOC_860_LOW1",
"BFD_RELOC_860_SPLIT1",
"BFD_RELOC_860_LOW2",
"BFD_RELOC_860_SPLIT2",
"BFD_RELOC_860_LOW3",
"BFD_RELOC_860_LOGOT0",
"BFD_RELOC_860_SPGOT0",
"BFD_RELOC_860_LOGOT1",
"BFD_RELOC_860_SPGOT1",
"BFD_RELOC_860_LOGOTOFF0",
"BFD_RELOC_860_SPGOTOFF0",
"BFD_RELOC_860_LOGOTOFF1",
"BFD_RELOC_860_SPGOTOFF1",
"BFD_RELOC_860_LOGOTOFF2",
"BFD_RELOC_860_LOGOTOFF3",
"BFD_RELOC_860_LOPC",
"BFD_RELOC_860_HIGHADJ",
"BFD_RELOC_860_HAGOT",
"BFD_RELOC_860_HAGOTOFF",
"BFD_RELOC_860_HAPC",
"BFD_RELOC_860_HIGH",
"BFD_RELOC_860_HIGOT",
"BFD_RELOC_860_HIGOTOFF",
"@@overflow: BFD_RELOC_UNUSED@@",
};
#endif
reloc_howto_type *
bfd_default_reloc_type_lookup
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
bfd_default_reloc_type_lookup PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
boolean
bfd_generic_relax_section
PARAMS ((bfd *abfd,
boolean
bfd_generic_relax_section PARAMS ((bfd *abfd,
asection *section,
struct bfd_link_info *,
boolean *));
boolean
bfd_generic_gc_sections
PARAMS ((bfd *, struct bfd_link_info *));
boolean
bfd_generic_gc_sections PARAMS ((bfd *, struct bfd_link_info *));
bfd_byte *
bfd_generic_get_relocated_section_contents PARAMS ((bfd *abfd,
bfd_generic_get_relocated_section_contents PARAMS ((bfd *abfd,
struct bfd_link_info *link_info,
struct bfd_link_order *link_order,
bfd_byte *data,
@ -918,19 +1041,18 @@ bfd_generic_get_relocated_section_contents PARAMS ((bfd *abfd,
asymbol **symbols));
extern const bfd_arch_info_type bfd_default_arch_struct;
boolean
boolean
bfd_default_set_arch_mach PARAMS ((bfd *abfd,
enum bfd_architecture arch,
unsigned long mach));
const bfd_arch_info_type *
bfd_default_compatible
PARAMS ((const bfd_arch_info_type *a,
bfd_default_compatible PARAMS ((const bfd_arch_info_type *a,
const bfd_arch_info_type *b));
boolean
boolean
bfd_default_scan PARAMS ((const struct bfd_arch_info *info, const char *string));
struct elf_internal_shdr *
bfd_elf_find_section PARAMS ((bfd *abfd, char *name));
bfd_elf_find_section PARAMS ((bfd *abfd, char *name));

View File

@ -43,6 +43,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define obj_coff_strings(bfd) (coff_data (bfd)->strings)
#define obj_coff_keep_strings(bfd) (coff_data (bfd)->keep_strings)
#define obj_coff_sym_hashes(bfd) (coff_data (bfd)->sym_hashes)
#define obj_coff_strings_written(bfd) (coff_data (bfd)->strings_written)
#define obj_coff_local_toc_table(bfd) (coff_data(bfd)->local_toc_sym_map)
@ -83,6 +84,8 @@ typedef struct coff_tdata
char *strings;
/* If this is true, the strings may not be freed. */
boolean keep_strings;
/* If this is true, the strings have been written out already. */
boolean strings_written;
/* is this a PE format coff file */
int pe;
@ -97,6 +100,9 @@ typedef struct coff_tdata
/* Used by coff_find_nearest_line. */
PTR line_info;
/* A place to stash dwarf2 info for this bfd. */
PTR dwarf2_find_line_info;
/* The timestamp from the COFF file header. */
long timestamp;
@ -126,6 +132,9 @@ struct xcoff_tdata
/* Basic COFF information. */
coff_data_type coff;
/* True if this is an XCOFF64 file. */
boolean xcoff64;
/* True if a large a.out header should be generated. */
boolean full_aouthdr;

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