Import binutils 2.11.

This commit is contained in:
tv 2001-04-23 12:24:25 +00:00
parent dbfa9a0b9b
commit 35f354e86d
710 changed files with 143403 additions and 60126 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,7 +1722,8 @@ 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
@ -1686,13 +1732,57 @@ ETC_SUPPORT= Makefile.in configure configure.in standards.texi \
make-stds.texi standards.info* configure.texi configure.info* \
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

5595
gnu/dist/toolchain/bfd/ChangeLog-9899 vendored Normal file

File diff suppressed because it is too large Load Diff

1
gnu/dist/toolchain/bfd/MAINTAINERS vendored Normal file
View File

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

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 AIX on PS/2 core files.
This was based on trad-core.c, which was written by John Gilmore of
Cygnus Support.
Copyright 1988, 89, 91, 92, 93, 94, 95, 96, 97, 1998
Copyright 1988, 89, 91, 92, 93, 94, 95, 96, 97, 98, 2000
Free Software Foundation, Inc.
Written by Minh Tran-Le <TRANLE@INTELLICORP.COM>.
Converted to back end form by Ian Lance Taylor <ian@cygnus.com>.
@ -32,13 +32,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <signal.h>
#if defined (_AIX) && defined (_I386)
#define NOCHECKS /* this is for coredump.h */
#define _h_USER /* avoid including user.h from coredump.h */
#define NOCHECKS /* This is for coredump.h. */
#define _h_USER /* Avoid including user.h from coredump.h. */
#include <uinfo.h>
#include <sys/i386/coredump.h>
#endif /* _AIX && _I386 */
/* maybe this could work on some other i386 but I have not tried it
/* Maybe this could work on some other i386 but I have not tried it
* mtranle@paris - Tue Sep 24 12:49:35 1991
*/
@ -46,7 +46,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
# define COR_MAGIC "core"
#endif
/* need this cast because ptr is really void * */
/* Need this cast because ptr is really void *. */
#define core_hdr(bfd) \
(((bfd->tdata.trad_core_data))->hdr)
#define core_section(bfd,n) \
@ -56,7 +56,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define core_reg2sec(bfd) \
(((bfd)->tdata.trad_core_data)->reg2_section)
/* These are stored in the bfd's tdata */
/* These are stored in the bfd's tdata. */
struct trad_core_struct {
struct corehdr *hdr; /* core file header */
asection *reg_section;
@ -70,7 +70,7 @@ static const bfd_target *
aix386_core_file_p (abfd)
bfd *abfd;
{
int i,n;
int i, n;
unsigned char longbuf[4]; /* Raw bytes of various header fields */
int core_size = sizeof (struct corehdr);
struct corehdr *core;
@ -79,18 +79,20 @@ aix386_core_file_p (abfd)
struct corehdr internal_core;
} *mergem;
if (bfd_read ((PTR)longbuf, 1, sizeof (longbuf), abfd) != sizeof (longbuf))
if (bfd_read ((PTR) longbuf, 1, sizeof (longbuf), abfd) != sizeof (longbuf))
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
return 0;
}
if (strncmp(longbuf,COR_MAGIC,4)) return 0;
if (strncmp (longbuf, COR_MAGIC, 4))
return 0;
if (bfd_seek (abfd, 0L, false) < 0) return 0;
if (bfd_seek (abfd, 0L, false) < 0)
return 0;
mergem = (struct mergem *)bfd_zalloc (abfd, sizeof (struct mergem));
mergem = (struct mergem *) bfd_zalloc (abfd, sizeof (struct mergem));
if (mergem == NULL)
return 0;
@ -100,20 +102,20 @@ aix386_core_file_p (abfd)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
bfd_release (abfd, (char *)mergem);
bfd_release (abfd, (char *) mergem);
return 0;
}
set_tdata (abfd, &mergem->coredata);
core_hdr (abfd) = core;
/* create the sections. This is raunchy, but bfd_close wants to reclaim
them */
/* Create the sections. This is raunchy, but bfd_close wants to
reclaim them. */
core_regsec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
if (core_regsec (abfd) == NULL)
{
loser:
bfd_release (abfd, (char *)mergem);
bfd_release (abfd, (char *) mergem);
return 0;
}
core_reg2sec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
@ -124,21 +126,21 @@ aix386_core_file_p (abfd)
goto loser;
}
for (i=0, n=0 ; (i < MAX_CORE_SEGS) && (core->cd_segs[i].cs_type) ; i++)
for (i = 0, n = 0; (i < MAX_CORE_SEGS) && (core->cd_segs[i].cs_type); i++)
{
if (core->cd_segs[i].cs_offset == 0)
continue;
core_section (abfd,n) =
core_section (abfd, n) =
(asection *) bfd_zalloc (abfd, sizeof (asection));
if (core_section (abfd,n) == NULL)
if (core_section (abfd, n) == NULL)
{
int j;
if (n > 0)
{
for (j=0; j < n; j++)
bfd_release (abfd, core_section(abfd, j));
for (j = 0; j < n; j++)
bfd_release (abfd, core_section (abfd, j));
}
bfd_release (abfd, (char *)mergem);
bfd_release (abfd, (char *) mergem);
goto loser1;
}
@ -177,7 +179,7 @@ aix386_core_file_p (abfd)
core_section (abfd, n)->alignment_power = 2;
core_section (abfd, n)->next = NULL;
if (n > 0)
core_section (abfd, (n-1))->next = core_section (abfd, n);
core_section (abfd, (n - 1))->next = core_section (abfd, n);
abfd->section_count = ++n;
}
@ -188,18 +190,19 @@ aix386_core_file_p (abfd)
core_regsec (abfd)->flags = SEC_HAS_CONTENTS;
core_reg2sec (abfd)->flags = SEC_HAS_CONTENTS;
core_regsec (abfd)->_raw_size = sizeof(core->cd_regs);
core_reg2sec (abfd)->_raw_size = sizeof(core->cd_fpregs);
core_regsec (abfd)->_raw_size = sizeof (core->cd_regs);
core_reg2sec (abfd)->_raw_size = sizeof (core->cd_fpregs);
core_regsec (abfd)->vma = -1;
core_reg2sec (abfd)->vma = -1;
/* We'll access the regs afresh in the core file, like any section: */
core_regsec (abfd)->filepos = (file_ptr)offsetof(struct corehdr,cd_regs[0]);
core_reg2sec (abfd)->filepos = (file_ptr)offsetof(struct corehdr,
cd_fpregs);
/* We'll access the regs afresh in the core file, like any section. */
core_regsec (abfd)->filepos =
(file_ptr) offsetof (struct corehdr, cd_regs[0]);
core_reg2sec (abfd)->filepos =
(file_ptr) offsetof (struct corehdr, cd_fpregs);
/* add the 2 reg fake sections to abfd */
/* Add the 2 reg fake sections to abfd. */
abfd->section_count += 2;
abfd->sections = core_regsec (abfd);
core_regsec (abfd)->next = core_reg2sec (abfd);
@ -227,22 +230,24 @@ aix386_core_file_matches_executable_p (core_bfd, exec_bfd)
bfd *core_bfd;
bfd *exec_bfd;
{
return true; /* FIXME, We have no way of telling at this
point */
/* FIXME: We have no way of telling at this point. */
return true;
}
/* If somebody calls any byte-swapping routines, shoot them. */
static void
swap_abort()
swap_abort ()
{
abort(); /* This way doesn't require any declaration for ANSI to fuck up */
/* This way doesn't require any declaration for ANSI to fuck up. */
abort ();
}
#define NO_GET ((PROTO(bfd_vma, (*), ( const bfd_byte *))) swap_abort )
#define NO_GETS ((PROTO(bfd_signed_vma, (*), (const bfd_byte *))) swap_abort )
#define NO_PUT ((PROTO(void, (*), (bfd_vma, bfd_byte *))) swap_abort )
const bfd_target aix386_core_vec =
{
const bfd_target aix386_core_vec = {
"aix386-core",
bfd_target_unknown_flavour,
BFD_ENDIAN_BIG, /* target byte order */

View File

@ -1,5 +1,5 @@
/* BFD back-end for a.out.adobe binaries.
Copyright 1990, 91, 92, 93, 94, 95, 96, 98, 1999
Copyright 1990, 91, 92, 93, 94, 95, 96, 98, 99, 2000
Free Software Foundation, Inc.
Written by Cygnus Support. Based on bout.c.
@ -28,7 +28,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "aout/stab_gnu.h"
#include "libaout.h" /* BFD a.out internal data structures */
extern const bfd_target a_out_adobe_vec; /* Forward decl */
/* Forward decl. */
extern const bfd_target a_out_adobe_vec;
static const bfd_target *aout_adobe_callback PARAMS ((bfd *));
@ -49,7 +50,7 @@ aout_adobe_swap_exec_header_in (abfd, raw_bytes, execp)
struct external_exec *raw_bytes;
struct internal_exec *execp;
{
struct external_exec *bytes = (struct external_exec *)raw_bytes;
struct external_exec *bytes = (struct external_exec *) raw_bytes;
/* Now fill in fields in the execp, from the bytes in the raw data. */
execp->a_info = bfd_h_get_32 (abfd, bytes->e_info);
@ -75,9 +76,10 @@ aout_adobe_swap_exec_header_out (abfd, execp, raw_bytes)
struct internal_exec *execp;
struct external_exec *raw_bytes;
{
struct external_exec *bytes = (struct external_exec *)raw_bytes;
struct external_exec *bytes = (struct external_exec *) raw_bytes;
/* Now fill in fields in the raw data, from the fields in the exec struct. */
/* 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);
@ -88,7 +90,6 @@ aout_adobe_swap_exec_header_out (abfd, execp, raw_bytes)
PUT_WORD (abfd, execp->a_drsize, bytes->e_drsize);
}
static const bfd_target *
aout_adobe_object_p (abfd)
bfd *abfd;
@ -98,7 +99,8 @@ aout_adobe_object_p (abfd)
char *targ;
if (bfd_read ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd)
!= EXEC_BYTES_SIZE) {
!= EXEC_BYTES_SIZE)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
return 0;
@ -112,10 +114,12 @@ aout_adobe_object_p (abfd)
If the environment variable GNUTARGET is set to "a.out.adobe", we will
take just about any a.out file as an Adobe a.out file. FIXME! */
if (N_BADMAG (anexec)) {
if (N_BADMAG (anexec))
{
targ = getenv ("GNUTARGET");
if (targ && !strcmp (targ, a_out_adobe_vec.name))
; /* Just continue anyway, if specifically set to this format */
/* Just continue anyway, if specifically set to this format. */
;
else
{
bfd_set_error (bfd_error_wrong_format);
@ -127,7 +131,6 @@ aout_adobe_object_p (abfd)
return aout_32_some_aout_object_p (abfd, &anexec, aout_adobe_callback);
}
/* Finish up the opening of a b.out file for reading. Fill in all the
fields that are not handled by common code. */
@ -145,7 +148,7 @@ aout_adobe_callback (abfd)
flagword flags;
/* Architecture and machine type -- unknown in this format. */
bfd_set_arch_mach(abfd, bfd_arch_unknown, 0);
bfd_set_arch_mach (abfd, bfd_arch_unknown, 0);
/* The positions of the string table and symbol table. */
obj_str_filepos (abfd) = N_STROFF (*execp);
@ -153,13 +156,16 @@ aout_adobe_callback (abfd)
/* Suck up the section information from the file, one section at a time. */
for (;;) {
if (bfd_read ((PTR) ext, 1, sizeof (*ext), abfd) != sizeof (*ext)) {
for (;;)
{
if (bfd_read ((PTR) ext, 1, sizeof (*ext), abfd) != sizeof (*ext))
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
return 0;
}
switch (ext->e_type[0]) {
switch (ext->e_type[0])
{
case N_TEXT:
section_name = ".text";
flags = SEC_CODE | SEC_LOAD | SEC_ALLOC | SEC_HAS_CONTENTS;
@ -191,16 +197,19 @@ aout_adobe_callback (abfd)
bfd_set_error (bfd_error_no_error);
sect = bfd_make_section (abfd, section_name);
trynum = 0;
while (!sect) {
while (!sect)
{
if (bfd_get_error () != bfd_error_no_error)
return 0; /* Some other error -- slide into the sunset */
/* Some other error -- slide into the sunset. */
return 0;
sprintf (try_again, "%s%d", section_name, ++trynum);
sect = bfd_make_section (abfd, try_again);
}
/* Fix the name, if it is a sprintf'd name. */
if (sect->name == try_again) {
newname = (char *) bfd_zalloc(abfd, strlen (sect->name));
if (sect->name == try_again)
{
newname = (char *) bfd_zalloc (abfd, strlen (sect->name));
if (newname == NULL)
return 0;
strcpy (newname, sect->name);
@ -209,7 +218,8 @@ aout_adobe_callback (abfd)
/* Now set the section's attributes. */
bfd_set_section_flags (abfd, sect, flags);
sect->_raw_size = ((ext->e_size[0] << 8) /* Assumed big-endian */
/* Assumed big-endian. */
sect->_raw_size = ((ext->e_size[0] << 8)
| ext->e_size[1] << 8)
| ext->e_size[2];
sect->_cooked_size = sect->_raw_size;
@ -218,7 +228,9 @@ aout_adobe_callback (abfd)
/* FIXME XXX alignment? */
/* Set relocation information for first section of each type. */
if (trynum == 0) switch (ext->e_type[0]) {
if (trynum == 0)
switch (ext->e_type[0])
{
case N_TEXT:
sect->rel_filepos = N_TRELOFF (*execp);
sect->reloc_count = execp->a_trsize;
@ -230,13 +242,13 @@ aout_adobe_callback (abfd)
break;
}
}
no_more_sections:
no_more_sections:
adata(abfd).reloc_entry_size = sizeof (struct reloc_std_external);
adata(abfd).symbol_entry_size = sizeof (struct external_nlist);
adata(abfd).page_size = 1; /* Not applicable. */
adata(abfd).segment_size = 1; /* Not applicable. */
adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
adata (abfd).reloc_entry_size = sizeof (struct reloc_std_external);
adata (abfd).symbol_entry_size = sizeof (struct external_nlist);
adata (abfd).page_size = 1; /* Not applicable. */
adata (abfd).segment_size = 1; /* Not applicable. */
adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE;
return abfd->xvec;
}
@ -259,22 +271,21 @@ aout_adobe_mkobject (abfd)
abfd->tdata.bout_data = rawptr;
exec_hdr (abfd) = &rawptr->e;
adata(abfd).reloc_entry_size = sizeof (struct reloc_std_external);
adata(abfd).symbol_entry_size = sizeof (struct external_nlist);
adata(abfd).page_size = 1; /* Not applicable. */
adata(abfd).segment_size = 1; /* Not applicable. */
adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
adata (abfd).reloc_entry_size = sizeof (struct reloc_std_external);
adata (abfd).symbol_entry_size = sizeof (struct external_nlist);
adata (abfd).page_size = 1; /* Not applicable. */
adata (abfd).segment_size = 1; /* Not applicable. */
adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE;
return true;
}
static boolean
aout_adobe_write_object_contents (abfd)
bfd *abfd;
{
struct external_exec swapped_hdr;
static struct external_segdesc sentinel[1]; /* Initialized to zero */
static struct external_segdesc sentinel[1]; /* Initialized to zero. */
asection *sect;
exec_hdr (abfd)->a_info = ZMAGIC;
@ -287,16 +298,22 @@ aout_adobe_write_object_contents (abfd)
exec_hdr (abfd)->a_trsize = 0;
exec_hdr (abfd)->a_drsize = 0;
for (sect = abfd->sections; sect; sect = sect->next) {
if (sect->flags & SEC_CODE) {
for (sect = abfd->sections; sect; sect = sect->next)
{
if (sect->flags & SEC_CODE)
{
exec_hdr (abfd)->a_text += sect->_raw_size;
exec_hdr (abfd)->a_trsize += sect->reloc_count *
sizeof (struct reloc_std_external);
} else if (sect->flags & SEC_DATA) {
}
else if (sect->flags & SEC_DATA)
{
exec_hdr (abfd)->a_data += sect->_raw_size;
exec_hdr (abfd)->a_drsize += sect->reloc_count *
sizeof (struct reloc_std_external);
} else if (sect->flags & SEC_ALLOC && !(sect->flags & SEC_LOAD)) {
}
else if (sect->flags & SEC_ALLOC && !(sect->flags & SEC_LOAD))
{
exec_hdr (abfd)->a_bss += sect->_raw_size;
}
}
@ -315,18 +332,24 @@ aout_adobe_write_object_contents (abfd)
/* Now write out the section information. Text first, data next, rest
afterward. */
for (sect = abfd->sections; sect; sect = sect->next) {
if (sect->flags & SEC_CODE) {
for (sect = abfd->sections; sect; sect = sect->next)
{
if (sect->flags & SEC_CODE)
{
aout_adobe_write_section (abfd, sect);
}
}
for (sect = abfd->sections; sect; sect = sect->next) {
if (sect->flags & SEC_DATA) {
for (sect = abfd->sections; sect; sect = sect->next)
{
if (sect->flags & SEC_DATA)
{
aout_adobe_write_section (abfd, sect);
}
}
for (sect = abfd->sections; sect; sect = sect->next) {
if (!(sect->flags & (SEC_CODE|SEC_DATA))) {
for (sect = abfd->sections; sect; sect = sect->next)
{
if (!(sect->flags & (SEC_CODE | SEC_DATA)))
{
aout_adobe_write_section (abfd, sect);
}
}
@ -336,33 +359,37 @@ aout_adobe_write_object_contents (abfd)
!= sizeof (*sentinel))
return false;
/* Now write out reloc info, followed by syms and strings */
/* Now write out reloc info, followed by syms and strings. */
if (bfd_get_symcount (abfd) != 0)
{
if (bfd_seek (abfd, (file_ptr)(N_SYMOFF(*exec_hdr(abfd))), SEEK_SET)
if (bfd_seek (abfd, (file_ptr) (N_SYMOFF (*exec_hdr (abfd))), SEEK_SET)
!= 0)
return false;
if (! aout_32_write_syms (abfd))
return false;
if (bfd_seek (abfd, (file_ptr)(N_TRELOFF(*exec_hdr(abfd))), SEEK_SET)
if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (*exec_hdr (abfd))), SEEK_SET)
!= 0)
return false;
for (sect = abfd->sections; sect; sect = sect->next) {
if (sect->flags & SEC_CODE) {
for (sect = abfd->sections; sect; sect = sect->next)
{
if (sect->flags & SEC_CODE)
{
if (!aout_32_squirt_out_relocs (abfd, sect))
return false;
}
}
if (bfd_seek (abfd, (file_ptr)(N_DRELOFF(*exec_hdr(abfd))), SEEK_SET)
if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (*exec_hdr (abfd))), SEEK_SET)
!= 0)
return false;
for (sect = abfd->sections; sect; sect = sect->next) {
if (sect->flags & SEC_DATA) {
for (sect = abfd->sections; sect; sect = sect->next)
{
if (sect->flags & SEC_DATA)
{
if (!aout_32_squirt_out_relocs (abfd, sect))
return false;
}
@ -390,45 +417,54 @@ aout_adobe_set_section_contents (abfd, section, location, offset, count)
file_ptr section_start;
sec_ptr sect;
if (abfd->output_has_begun == false) { /* set by bfd.c handler */
/* Set by bfd.c handler. */
if (abfd->output_has_begun == false)
{
/* Assign file offsets to sections. Text sections are first, and
are contiguous. Then data sections. Everything else at the end. */
section_start = N_TXTOFF (ignore<-->me);
for (sect = abfd->sections; sect; sect = sect->next) {
if (sect->flags & SEC_CODE) {
for (sect = abfd->sections; sect; sect = sect->next)
{
if (sect->flags & SEC_CODE)
{
sect->filepos = section_start;
/* FIXME: Round to alignment */
/* FIXME: Round to alignment. */
section_start += sect->_raw_size;
}
}
for (sect = abfd->sections; sect; sect = sect->next) {
if (sect->flags & SEC_DATA) {
for (sect = abfd->sections; sect; sect = sect->next)
{
if (sect->flags & SEC_DATA)
{
sect->filepos = section_start;
/* FIXME: Round to alignment */
/* FIXME: Round to alignment. */
section_start += sect->_raw_size;
}
}
for (sect = abfd->sections; sect; sect = sect->next) {
for (sect = abfd->sections; sect; sect = sect->next)
{
if (sect->flags & SEC_HAS_CONTENTS &&
!(sect->flags & (SEC_CODE|SEC_DATA))) {
!(sect->flags & (SEC_CODE | SEC_DATA)))
{
sect->filepos = section_start;
/* FIXME: Round to alignment */
/* FIXME: Round to alignment. */
section_start += sect->_raw_size;
}
}
}
/* regardless, once we know what we're doing, we might as well get going */
/* Regardless, once we know what we're doing, we might as well get
going. */
if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0)
return false;
if (count != 0) {
return (bfd_write ((PTR)location, 1, count, abfd) == count) ?true:false;
if (count != 0)
{
return (bfd_write ((PTR) location, 1, count, abfd) == count) ? true : false;
}
return true;
}
@ -454,12 +490,9 @@ aout_adobe_sizeof_headers (ignore_abfd, ignore)
bfd *ignore_abfd ATTRIBUTE_UNUSED;
boolean ignore ATTRIBUTE_UNUSED;
{
return sizeof(struct internal_exec);
return sizeof (struct internal_exec);
}
/* Build the transfer vector for Adobe A.Out files. */
#define aout_32_close_and_cleanup aout_32_bfd_free_cached_info
@ -486,8 +519,7 @@ aout_adobe_sizeof_headers (ignore_abfd, ignore)
#define aout_32_bfd_final_link _bfd_generic_final_link
#define aout_32_bfd_link_split_section _bfd_generic_link_split_section
const bfd_target a_out_adobe_vec =
{
const bfd_target a_out_adobe_vec = {
"a.out.adobe", /* name */
bfd_target_aout_flavour,
BFD_ENDIAN_BIG, /* data byte order is unknown (big assumed) */

View File

@ -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 : \
@ -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;
@ -144,7 +143,7 @@ MY(reloc_howto)(abfd, rel, r_index, r_extern, r_pcrel)
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;
@ -190,10 +189,10 @@ MY(put_reloc)(abfd, r_extern, r_index, value, howto, reloc)
}
#define MY_put_reloc(BFD, EXT, IDX, VAL, HOWTO, RELOC) \
MY(put_reloc)(BFD, EXT, IDX, VAL, HOWTO, RELOC)
MY(put_reloc) (BFD, EXT, IDX, VAL, HOWTO, RELOC)
void
MY(relocatable_reloc)(howto, abfd, reloc, amount, r_addr)
MY(relocatable_reloc) (howto, abfd, reloc, amount, r_addr)
reloc_howto_type *howto;
bfd *abfd;
struct reloc_std_external *reloc;
@ -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,
@ -302,7 +301,7 @@ MY(fix_pcrel_26) (abfd, reloc_entry, symbol, data, input_section,
}
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;
{
@ -397,7 +396,6 @@ MY_swap_std_reloc_out (abfd, g, natptr)
r_pcrel = 1;
}
#if 0
/* For a standard reloc, the addend is in the object file. */
r_addend = g->addend + (*(g->sym_ptr_ptr))->section->output_section->vma;

305
gnu/dist/toolchain/bfd/aout-cris.c vendored Normal file
View File

@ -0,0 +1,305 @@
/* BFD backend for CRIS a.out binaries.
Copyright (C) 2000 Free Software Foundation, Inc.
Contributed by Axis Communications AB.
Written by Hans-Peter Nilsson.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* See info in the file PORTING for documentation of these macros and
functions. Beware; some of the information there is outdated. */
#define N_HEADER_IN_TEXT(x) 0
#define BYTES_IN_WORD 4
#define N_TXTOFF(x) 32
#define ENTRY_CAN_BE_ZERO
#define TEXT_START_ADDR 0
/* Without reading symbols to get the text start symbol, there is no way
to know where the text segment starts in an a.out file. Defaulting to
anything as constant as TEXT_START_ADDR is bad. But we can guess from
the entry point, which is usually within the first 64k of the text
segment. We also assume here that the text segment is 64k-aligned.
FIXME: It is also wrong to assume that data and bss follow immediately
after text, but with those, we don't have any choice besides reading
symbol info, and luckily there's no pressing need for correctness for
those vma:s at this time. */
#define N_TXTADDR(x) ((x).a_entry & ~0xffff)
/* If you change this to 4, you can not link to an address N*4+2. */
#define SEGMENT_SIZE 2
/* For some reason, if the a.out file has Z_MAGIC, then
adata(abfd).exec_bytes_size is not used, but rather
adata(abfd).zmagic_disk_block_size, even though the exec_header is
*not* included in the text segment. A simple workaround is to
#define ZMAGIC_DISK_BLOCK_SIZE, which is used if defined; otherwise
TARGET_PAGE_SIZE is used. */
#define ZMAGIC_DISK_BLOCK_SIZE N_TXTOFF (0)
/* It seems odd at first to set a page-size this low, but gives greater
freedom in where things can be linked. The drawback is that you have
to set alignment and padding in linker scripts. */
#define TARGET_PAGE_SIZE SEGMENT_SIZE
#define TARGETNAME "a.out-cris"
/* N_SHARED_LIB gets this reasonable default as of 1999-07-12, but we
have to work with 2.9.1. Note that N_SHARED_LIB is used in a
SUN-specific context, not applicable to CRIS. */
#define N_SHARED_LIB(x) 0
/* The definition here seems not used; just provided as a convention. */
#define DEFAULT_ARCH bfd_arch_cris
/* ??? Spacing might be essential for the parameters in this macro.
Do Not Change. */
#define MY(OP) CAT (cris_aout_,OP)
#define NAME(x,y) CAT3(cris_aout,_32_,y)
#include "bfd.h"
/* Version 1 of the header. */
#define MY_exec_hdr_flags 1
#define MY_write_object_contents MY(write_object_contents)
static boolean MY(write_object_contents) PARAMS ((bfd *));
/* Forward this, so we can use a pointer to it in PARAMS. */
struct reloc_ext_external;
#define MY_swap_ext_reloc_out MY(swap_ext_reloc_out)
static void MY(swap_ext_reloc_out) PARAMS ((bfd *, arelent *,
struct reloc_ext_external *));
#define MY_swap_ext_reloc_in MY(swap_ext_reloc_in)
static void MY(swap_ext_reloc_in) PARAMS ((bfd *, struct
reloc_ext_external *,
arelent *, asymbol **,
bfd_size_type));
#define MY_set_sizes MY(set_sizes)
static boolean MY(set_sizes) PARAMS ((bfd *));
/* To set back reloc_size to ext, we make MY(set_sizes) be called
through this construct. Note that MY_set_arch_mach is only called
through SET_ARCH_MACH. The default bfd_default_set_arch_mach will
not call set_sizes. */
#define MY_set_arch_mach NAME (aout, set_arch_mach)
#define SET_ARCH_MACH(BFD, EXEC) \
MY_set_arch_mach (BFD, DEFAULT_ARCH, N_MACHTYPE (EXEC))
/* These macros describe the binary layout of the reloc information we
use in a file. */
#define RELOC_EXT_BITS_EXTERN_LITTLE 0x80
#define RELOC_EXT_BITS_TYPE_LITTLE 3
#define RELOC_EXT_BITS_TYPE_SH_LITTLE 0
#ifndef MY_get_section_contents
#define MY_get_section_contents aout_32_get_section_contents
#endif
/* Include generic functions (some are overridden above). */
#include "aout32.c"
#include "aout-target.h"
/* We need our own version to set header flags. */
static boolean
MY(write_object_contents) (abfd)
bfd *abfd;
{
struct external_exec exec_bytes;
struct internal_exec *execp = exec_hdr (abfd);
/* We set the reloc type to RELOC_EXT_SIZE, although setting it at all
seems unnecessary when inspecting as and ld behavior (not an
exhaustive inspection). The default write_object_contents
definition sets RELOC_EXT_SIZE, so we follow suite and set it too. */
obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;
/* Setting N_SET_MACHTYPE and using N_SET_FLAGS is not performed by
the default definition. */
if (bfd_get_arch(abfd) == bfd_arch_cris)
N_SET_MACHTYPE(*execp, M_CRIS);
N_SET_FLAGS (*execp, aout_backend_info (abfd)->exec_hdr_flags);
WRITE_HEADERS (abfd, execp);
return true;
}
/* We need our own for these reasons:
- Assert that a normal 8, 16 or 32 reloc is output.
- Fix what seems to be a weak-bug (perhaps there for valid reasons). */
static void
MY(swap_ext_reloc_out) (abfd, g, natptr)
bfd *abfd;
arelent *g;
struct reloc_ext_external *natptr;
{
int r_index;
int r_extern;
unsigned int r_type;
unsigned int r_addend;
asymbol *sym = *(g->sym_ptr_ptr);
asection *output_section = sym->section->output_section;
PUT_WORD (abfd, g->address, natptr->r_address);
r_type = (unsigned int) g->howto->type;
r_addend = g->addend;
if ((sym->flags & BSF_SECTION_SYM) != 0)
r_addend += (*(g->sym_ptr_ptr))->section->output_section->vma;
/* If this relocation is relative to a symbol then set the
r_index to the symbols index, and the r_extern bit.
Absolute symbols can come in in two ways, either as an offset
from the abs section, or as a symbol which has an abs value.
check for that here. */
if (bfd_is_abs_section (bfd_get_section (sym)))
{
r_extern = 0;
r_index = N_ABS;
}
else if ((sym->flags & BSF_SECTION_SYM) == 0)
{
if (bfd_is_und_section (bfd_get_section (sym))
/* Remember to check for weak symbols; they count as global. */
|| (sym->flags & (BSF_GLOBAL | BSF_WEAK)) != 0)
r_extern = 1;
else
r_extern = 0;
r_index = (*(g->sym_ptr_ptr))->KEEPIT;
}
else
{
/* Just an ordinary section. */
r_extern = 0;
r_index = output_section->target_index;
}
/* The relocation type is the same as the canonical ones, but only
the first 3 are used: RELOC_8, RELOC_16, RELOC_32.
We may change this later, but assert this for the moment. */
if (r_type > 2)
{
(*_bfd_error_handler) (_("%s: Invalid relocation type exported: %d"),
bfd_get_filename (abfd), r_type);
bfd_set_error (bfd_error_wrong_format);
}
/* Now the fun stuff. */
natptr->r_index[2] = r_index >> 16;
natptr->r_index[1] = r_index >> 8;
natptr->r_index[0] = r_index;
natptr->r_type[0] =
(r_extern ? RELOC_EXT_BITS_EXTERN_LITTLE : 0)
| (r_type << RELOC_EXT_BITS_TYPE_SH_LITTLE);
PUT_WORD (abfd, r_addend, natptr->r_addend);
}
/* We need our own to assert that a normal 8, 16 or 32 reloc is input. */
static void
MY(swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount)
bfd *abfd;
struct reloc_ext_external *bytes;
arelent *cache_ptr;
asymbol **symbols;
bfd_size_type symcount;
{
unsigned int r_index;
int r_extern;
unsigned int r_type;
struct aoutdata *su = &(abfd->tdata.aout_data->a);
cache_ptr->address = (GET_SWORD (abfd, bytes->r_address));
/* Now the fun stuff. */
r_index = (bytes->r_index[2] << 16)
| (bytes->r_index[1] << 8)
| bytes->r_index[0];
r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_LITTLE));
r_type = ((bytes->r_type[0]) >> RELOC_EXT_BITS_TYPE_SH_LITTLE)
& RELOC_EXT_BITS_TYPE_LITTLE;
if (r_type > 2)
{
(*_bfd_error_handler) (_("%s: Invalid relocation type imported: %d"),
bfd_get_filename (abfd), r_type);
bfd_set_error(bfd_error_wrong_format);
}
cache_ptr->howto = howto_table_ext + r_type;
if (r_extern && r_index > symcount)
{
(*_bfd_error_handler)
(_("%s: Bad relocation record imported: %d"),
bfd_get_filename (abfd), r_index);
bfd_set_error (bfd_error_wrong_format);
/* We continue, so we can catch further errors. */
r_extern = 0;
r_index = N_ABS;
}
/* Magically uses r_extern, symbols etc. Ugly, but it's what's in the
default. */
MOVE_ADDRESS (GET_SWORD (abfd, bytes->r_addend));
}
/* We use the same as the default, except that we also set
"obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;", to avoid changing
NAME (aout, set_arch_mach) in aoutx. */
static boolean
MY(set_sizes) (abfd)
bfd *abfd;
{
/* Just as the default in aout-target.h (with some #ifdefs folded)... */
adata(abfd).page_size = TARGET_PAGE_SIZE;
adata(abfd).segment_size = SEGMENT_SIZE;
adata(abfd).zmagic_disk_block_size = ZMAGIC_DISK_BLOCK_SIZE;
adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
/* ... except for that we have the extended reloc. The alternative
would be to add a check on bfd_arch_cris in NAME (aout,
set_arch_mach) in aoutx.h, but I don't want to do that since
target-specific things should not be added there. */
obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;
return true;
}
/*
* Local variables:
* eval: (c-set-style "gnu")
* indent-tabs-mode: t
* End:
*/

View File

@ -58,7 +58,7 @@ encap_object_p (abfd)
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);
}
@ -84,7 +84,7 @@ encap_real_callback (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

View File

@ -146,7 +146,6 @@ reloc_howto_type MY(howto_table)[] =
"PCREL_32", true, 0xffffffff,0xffffffff, false),
};
#define CTOR_TABLE_RELOC_HOWTO(BFD) (MY(howto_table) + 14)
#define RELOC_STD_BITS_NS32K_TYPE_BIG 0x06
@ -155,7 +154,7 @@ reloc_howto_type MY(howto_table)[] =
#define RELOC_STD_BITS_NS32K_TYPE_SH_LITTLE 5
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 ATTRIBUTE_UNUSED;
struct reloc_std_external *rel;
int *r_index;
@ -177,10 +176,10 @@ MY(reloc_howto)(abfd, rel, r_index, r_extern, r_pcrel)
return (MY(howto_table) + r_length + 3 * (*r_pcrel) + 6 * r_ns32k_type);
}
#define MY_reloc_howto(BFD,REL,IN,EX,PC) MY(reloc_howto)(BFD, REL, &IN, &EX, &PC)
#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;
@ -207,7 +206,7 @@ MY(put_reloc)(abfd, r_extern, r_index, value, howto, reloc)
}
#define MY_put_reloc(BFD, EXT, IDX, VAL, HOWTO, RELOC) \
MY(put_reloc)(BFD, EXT, IDX, VAL, HOWTO, RELOC)
MY(put_reloc) (BFD, EXT, IDX, VAL, HOWTO, RELOC)
#define STAT_FOR_EXEC
@ -217,7 +216,7 @@ MY(put_reloc)(abfd, r_extern, r_index, value, howto, reloc)
#include <aoutx.h>
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;
{
@ -259,7 +258,6 @@ MY(bfd_reloc_type_lookup)(abfd,code)
#undef ENTRY
}
static void
MY_swap_std_reloc_in (abfd, bytes, cache_ptr, symbols, symcount)
bfd *abfd;

View File

@ -296,13 +296,15 @@ 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))
#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. */
@ -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;
@ -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

View File

@ -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 */
@ -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)

View File

@ -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
@ -230,7 +271,7 @@ DESCRIPTION
. const char *arch_name;
. const char *printable_name;
. unsigned int section_align_power;
. {* true if this is the default machine for the architecture *}
. {* True if this is the default machine for the architecture. *}
. boolean the_default;
. const struct bfd_arch_info * (*compatible)
. PARAMS ((const struct bfd_arch_info *a,
@ -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
@ -466,7 +508,6 @@ bfd_arch_get_compatible (abfd, bbfd)
return abfd->arch_info->compatible (abfd->arch_info, bbfd->arch_info);
}
/*
INTERNAL_DEFINITION
bfd_default_arch_struct
@ -479,12 +520,10 @@ 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,
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,
@ -552,7 +591,6 @@ bfd_default_set_arch_mach (abfd, arch, mach)
return false;
}
/*
FUNCTION
bfd_get_arch
@ -563,7 +601,6 @@ SYNOPSIS
DESCRIPTION
Return the enumerated type which describes the BFD @var{abfd}'s
architecture.
*/
enum bfd_architecture
@ -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,7 +667,6 @@ bfd_arch_bits_per_address (abfd)
return abfd->arch_info->bits_per_address;
}
/*
INTERNAL_FUNCTION
bfd_default_compatible
@ -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
@ -734,29 +768,30 @@ bfd_default_scan (info, string)
attempt to match just <mach>, it could be ambigious. This test
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;
*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;
}
@ -773,6 +808,18 @@ bfd_default_scan (info, string)
switch (number)
{
/* FIXME: These are needed to parse IEEE objects. */
/* 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;
@ -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
@ -911,7 +956,6 @@ bfd_lookup_arch (arch, machine)
return NULL;
}
/*
FUNCTION
bfd_printable_arch_mach
@ -932,7 +976,7 @@ 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;
@ -950,12 +994,11 @@ 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));
@ -981,7 +1024,7 @@ bfd_arch_mach_octets_per_byte (arch, mach)
enum bfd_architecture arch;
unsigned long mach;
{
const bfd_arch_info_type * ap = bfd_lookup_arch (arch, mach);
const bfd_arch_info_type *ap = bfd_lookup_arch (arch, mach);
if (ap)
return ap->bits_per_byte / 8;

View File

@ -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
@ -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. */

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;
@ -284,7 +288,8 @@ binary_set_section_contents (abfd, sec, data, offset, size)
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

View File

@ -19,7 +19,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. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
@ -30,7 +29,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "aout/stab_gnu.h"
#include "libaout.h" /* BFD a.out internal data structures */
static int aligncode PARAMS ((bfd *abfd, asection *input_section,
arelent *r, unsigned int shrink));
static void perform_slip PARAMS ((bfd *abfd, unsigned int slip,
@ -114,7 +112,6 @@ bout_swap_exec_header_out (abfd, execp, raw_bytes)
bytes->e_relaxable[0] = execp->a_relaxable;
}
static const bfd_target *
b_out_object_p (abfd)
bfd *abfd;
@ -140,7 +137,6 @@ b_out_object_p (abfd)
return aout_32_some_aout_object_p (abfd, &anexec, b_out_callback);
}
/* Finish up the opening of a b.out file for reading. Fill in all the
fields that are not handled by common code. */
@ -310,22 +306,22 @@ b_out_write_object_contents (abfd)
}
if (q > outsyms)
qsort (outsyms, q - outsyms, sizeof(asymbol*), b_out_symbol_cmp);
qsort (outsyms, q - outsyms, sizeof (asymbol*), b_out_symbol_cmp);
/* Back to your regularly scheduled program. */
if (bfd_seek (abfd, (file_ptr)(N_SYMOFF(*exec_hdr(abfd))), SEEK_SET)
if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*exec_hdr(abfd))), SEEK_SET)
!= 0)
return false;
if (! aout_32_write_syms (abfd))
return false;
if (bfd_seek (abfd, (file_ptr)(N_TROFF(*exec_hdr(abfd))), SEEK_SET) != 0)
if (bfd_seek (abfd, (file_ptr) (N_TROFF(*exec_hdr(abfd))), SEEK_SET) != 0)
return false;
if (!b_out_squirt_out_relocs (abfd, obj_textsec (abfd))) return false;
if (bfd_seek (abfd, (file_ptr)(N_DROFF(*exec_hdr(abfd))), SEEK_SET)
if (bfd_seek (abfd, (file_ptr) (N_DROFF(*exec_hdr(abfd))), SEEK_SET)
!= 0)
return false;
@ -344,7 +340,6 @@ b_out_write_object_contents (abfd)
#define CALL 0x09000000
#define PCREL13_MASK 0x1fff
#define output_addr(sec) ((sec)->output_offset+(sec)->output_section->vma)
/* Magic to turn callx into calljx */
@ -380,11 +375,10 @@ calljx_callback (abfd, link_info, reloc_entry, src, dst, input_section)
word += value + reloc_entry->addend;
bfd_put_32(abfd, word, dst);
bfd_put_32 (abfd, word, dst);
return bfd_reloc_ok;
}
/* Magic to turn call into callj */
static bfd_reloc_status_type
callj_callback (abfd, link_info, reloc_entry, data, srcidx, dstidx,
@ -445,7 +439,7 @@ callj_callback (abfd, link_info, reloc_entry, data, srcidx, dstidx,
- output_addr (input_section))
& BAL_MASK);
}
bfd_put_32(abfd, word, (bfd_byte *) data + dstidx);
bfd_put_32 (abfd, word, (bfd_byte *) data + dstidx);
return bfd_reloc_ok;
}
@ -472,7 +466,6 @@ HOWTO(PCREL24, 0, 2, 24, true, 0, complain_overflow_signed,0,"pcrel24", true, 0x
static reloc_howto_type howto_reloc_pcrel13 =
HOWTO(PCREL13, 0, 2, 13, true, 0, complain_overflow_signed,0,"pcrel13", true, 0x00001fff,0x00001fff,false);
static reloc_howto_type howto_reloc_abs32codeshrunk =
HOWTO(ABS32CODE_SHRUNK, 0, 2, 24, true, 0, complain_overflow_signed, 0,"callx->callj", true, 0x00ffffff, 0x00ffffff,false);
@ -556,7 +549,7 @@ b_out_slurp_reloc_table (abfd, asect, symbols)
return false;
doit:
if (bfd_seek (abfd, (file_ptr)(asect->rel_filepos), SEEK_SET) != 0)
if (bfd_seek (abfd, (file_ptr) (asect->rel_filepos), SEEK_SET) != 0)
return false;
count = reloc_size / sizeof (struct relocation_info);
@ -577,8 +570,6 @@ b_out_slurp_reloc_table (abfd, asect, symbols)
return false;
}
if (bfd_header_big_endian (abfd)) {
/* big-endian bit field allocation order */
pcrel_mask = 0x80;
@ -728,17 +719,14 @@ b_out_slurp_reloc_table (abfd, asect, symbols)
}
}
if (relocs != NULL)
free (relocs);
asect->relocation = reloc_cache;
asect->reloc_count = count;
return true;
}
static boolean
b_out_squirt_out_relocs (abfd, section)
bfd *abfd;
@ -956,7 +944,7 @@ b_out_set_section_contents (abfd, section, location, offset, count)
if (! aout_32_make_sections (abfd))
return false;
obj_textsec (abfd)->filepos = sizeof(struct internal_exec);
obj_textsec (abfd)->filepos = sizeof (struct internal_exec);
obj_datasec(abfd)->filepos = obj_textsec(abfd)->filepos
+ obj_textsec (abfd)->_raw_size;
@ -1005,11 +993,9 @@ b_out_sizeof_headers (ignore_abfd, ignore)
bfd *ignore_abfd ATTRIBUTE_UNUSED;
boolean ignore ATTRIBUTE_UNUSED;
{
return sizeof(struct internal_exec);
return sizeof (struct internal_exec);
}
/************************************************************************/
static bfd_vma
get_value (reloc, link_info, input_section)
@ -1125,7 +1111,6 @@ abs32code (abfd, input_section, r, shrink, link_info)
gap = value - (dot - shrink);
if (-1<<23 < (long)gap && (long)gap < 1<<23 )
{
/* Change the reloc type from 32bitcode possible 24, to 24bit
@ -1425,7 +1410,7 @@ b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order,
break;
default:
abort();
abort ();
}
}
}
@ -1498,7 +1483,6 @@ const bfd_target b_out_vec_big_host =
(PTR) 0,
};
const bfd_target b_out_vec_little_host =
{
"b.out.little", /* name */

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).
@ -88,10 +88,9 @@ 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))
*/
/* Insert a BFD into the cache. */
@ -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;

View File

@ -1,5 +1,5 @@
/* BFD back-end for AMD 29000 COFF binaries.
Copyright 1990, 91, 92, 93, 94, 95, 97, 98, 1999
Copyright 1990, 91, 92, 93, 94, 95, 97, 98, 99, 2000
Free Software Foundation, Inc.
Contributed by David Wood at New York University 7/8/91.
@ -43,9 +43,9 @@ static boolean coff_a29k_adjust_symndx
#define INSERT_HWORD(WORD,HWORD) \
(((WORD) & 0xff00ff00) | (((HWORD) & 0xff00) << 8) | ((HWORD)& 0xff))
#define EXTRACT_HWORD(WORD) \
((((WORD) & 0x00ff0000) >> 8) | ((WORD)& 0xff))
((((WORD) & 0x00ff0000) >> 8) | ((WORD) & 0xff))
#define SIGN_EXTEND_HWORD(HWORD) \
((HWORD) & 0x8000 ? (HWORD)|(~0xffffL) : (HWORD))
(((HWORD) ^ 0x8000) - 0x8000)
/* Provided the symbol, returns the value reffed */
static long
@ -93,11 +93,12 @@ a29k_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
long signed_value;
unsigned long addr = reloc_entry->address ; /*+ input_section->vma*/
bfd_byte *hit_data =addr + (bfd_byte *)(data);
bfd_byte *hit_data =addr + (bfd_byte *) (data);
r_type = reloc_entry->howto->type;
if (output_bfd) {
if (output_bfd)
{
/* Partial linking - do nothing */
reloc_entry->address += input_section->output_offset;
return bfd_reloc_ok;
@ -123,13 +124,12 @@ a29k_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
return(bfd_reloc_dangerous);
}
sym_value = get_symbol_value(symbol_in);
switch (r_type)
{
case R_IREL:
insn = bfd_get_32(abfd, hit_data);
insn = bfd_get_32 (abfd, hit_data);
/* Take the value in the field and sign extend it */
signed_value = EXTRACT_HWORD(insn);
signed_value = SIGN_EXTEND_HWORD(signed_value);
@ -157,17 +157,17 @@ a29k_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
}
signed_value >>= 2;
insn = INSERT_HWORD(insn, signed_value);
bfd_put_32(abfd, insn ,hit_data);
bfd_put_32 (abfd, insn ,hit_data);
break;
case R_ILOHALF:
insn = bfd_get_32(abfd, hit_data);
insn = bfd_get_32 (abfd, hit_data);
unsigned_value = EXTRACT_HWORD(insn);
unsigned_value += sym_value + reloc_entry->addend;
insn = INSERT_HWORD(insn, unsigned_value);
bfd_put_32(abfd, insn, hit_data);
bfd_put_32 (abfd, insn, hit_data);
break;
case R_IHIHALF:
insn = bfd_get_32(abfd, hit_data);
insn = bfd_get_32 (abfd, hit_data);
/* consth, part 1
Just get the symbol value that is referenced */
part1_consth_active = true;
@ -175,10 +175,11 @@ a29k_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
/* Don't modify insn until R_IHCONST */
break;
case R_IHCONST:
insn = bfd_get_32(abfd, hit_data);
insn = bfd_get_32 (abfd, hit_data);
/* consth, part 2
Now relocate the reference */
if (part1_consth_active == false) {
if (part1_consth_active == false)
{
*error_message = (char *) _("Missing IHIHALF");
return(bfd_reloc_dangerous);
}
@ -189,33 +190,32 @@ a29k_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
unsigned_value = unsigned_value >> 16;
insn = INSERT_HWORD(insn, unsigned_value);
part1_consth_active = false;
bfd_put_32(abfd, insn, hit_data);
bfd_put_32 (abfd, insn, hit_data);
break;
case R_BYTE:
insn = bfd_get_8(abfd, hit_data);
insn = bfd_get_8 (abfd, hit_data);
unsigned_value = insn + sym_value + reloc_entry->addend;
if (unsigned_value & 0xffffff00)
return(bfd_reloc_overflow);
bfd_put_8(abfd, unsigned_value, hit_data);
bfd_put_8 (abfd, unsigned_value, hit_data);
break;
case R_HWORD:
insn = bfd_get_16(abfd, hit_data);
insn = bfd_get_16 (abfd, hit_data);
unsigned_value = insn + sym_value + reloc_entry->addend;
if (unsigned_value & 0xffff0000)
return(bfd_reloc_overflow);
bfd_put_16(abfd, insn, hit_data);
bfd_put_16 (abfd, insn, hit_data);
break;
case R_WORD:
insn = bfd_get_32(abfd, hit_data);
insn = bfd_get_32 (abfd, hit_data);
insn += sym_value + reloc_entry->addend;
bfd_put_32(abfd, insn, hit_data);
bfd_put_32 (abfd, insn, hit_data);
break;
default:
*error_message = _("Unrecognized reloc");
return (bfd_reloc_dangerous);
}
return(bfd_reloc_ok);
}
@ -580,7 +580,6 @@ coff_a29k_relocate_section (output_bfd, info, input_bfd, input_section,
/* We don't want to change the symndx of a R_IHCONST reloc, since it
is actually an addend, not a symbol index at all. */
/*ARGSUSED*/
static boolean
coff_a29k_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp)
bfd *obfd ATTRIBUTE_UNUSED;

View File

@ -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;
@ -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,

View File

@ -57,7 +57,6 @@ typedef enum {bunknown, b9, b12, b23} thumb_pcrel_branchtype;
typedef unsigned long int insn32;
typedef unsigned short int insn16;
/* Forward declarations for stupid compilers. */
static boolean coff_arm_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
@ -818,7 +817,6 @@ coff_thumb_pcrel_9 (abfd, reloc_entry, symbol, data, input_section,
input_section, output_bfd, error_message, b9);
}
static CONST struct reloc_howto_struct *
coff_arm_reloc_type_lookup (abfd, code)
bfd * abfd;
@ -847,6 +845,7 @@ coff_arm_reloc_type_lookup (abfd, code)
ASTD (BFD_RELOC_16, ARM_16);
ASTD (BFD_RELOC_32, ARM_32);
ASTD (BFD_RELOC_ARM_PCREL_BRANCH, ARM_26);
ASTD (BFD_RELOC_ARM_PCREL_BLX, ARM_26);
ASTD (BFD_RELOC_8_PCREL, ARM_DISP8);
ASTD (BFD_RELOC_16_PCREL, ARM_DISP16);
ASTD (BFD_RELOC_32_PCREL, ARM_DISP32);
@ -976,7 +975,6 @@ insert_thumb_branch (br_insn, rel_off)
unsigned int low_bits;
unsigned int high_bits;
BFD_ASSERT((rel_off & 1) != 1);
rel_off >>= 1; /* half word aligned address */
@ -988,13 +986,12 @@ insert_thumb_branch (br_insn, rel_off)
else if ((br_insn & HI_LOW_ORDER) == HI_LOW_ORDER)
br_insn = HI_LOW_ORDER | (high_bits << 16) | low_bits;
else
abort(); /* error - not a valid branch instruction form */
abort (); /* error - not a valid branch instruction form */
/* FIXME: abort is probably not the right call. krk@cygnus.com */
return br_insn;
}
static struct coff_link_hash_entry *
find_thumb_glue (info, name, input_bfd)
@ -1194,7 +1191,6 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
else
addend = 0;
howto = coff_rtype_to_howto (input_bfd, input_section, rel, h,
sym, &addend);
if (howto == NULL)
@ -1246,8 +1242,15 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
{
if (info->relocateable)
continue;
#if 0 /* We must not ignore the symbol value. If the symbol is
within the same section, the relocation should have already
been fixed, but if it is not, we'll be handed a reloc into
the beginning of the symbol's section, so we must not cancel
out the symbol's value, otherwise we'll be adding it in
twice. */
if (sym != NULL && sym->n_scnum != 0)
addend += sym->n_value;
#endif
}
val = 0;
@ -1874,7 +1877,6 @@ record_thumb_to_arm_glue (info, h)
struct coff_link_hash_entry * myh;
struct coff_arm_link_hash_table * globals;
globals = coff_arm_hash_table (info);
BFD_ASSERT (globals != NULL);
@ -2126,7 +2128,6 @@ bfd_arm_process_before_allocation (abfd, info, support_old_code)
#define coff_bfd_copy_private_bfd_data coff_arm_copy_private_bfd_data
#define coff_bfd_link_hash_table_create coff_arm_link_hash_table_create
/* When doing a relocateable link, we want to convert ARM26 relocs
into ARM26D relocs. */
@ -2269,7 +2270,6 @@ coff_arm_merge_private_bfd_data (ibfd, obfd)
return true;
}
/* Display the flags field. */
static boolean
@ -2312,7 +2312,6 @@ coff_arm_print_private_bfd_data (abfd, ptr)
return true;
}
/* Copies the given flags into the coff_tdata.flags field.
Typically these flags come from the f_flags[] field of
the COFF filehdr structure, which contains important,
@ -2368,7 +2367,6 @@ _bfd_coff_arm_set_private_flags (abfd, flags)
return true;
}
/* Copy the important parts of the target specific data
from one instance of a BFD to another. */
@ -2436,8 +2434,8 @@ coff_arm_copy_private_bfd_data (src, dest)
}
/* Note: the definitions here of LOCAL_LABEL_PREFIX and USER_LABEL_PREIFX
*must* match the definitions in gcc/config/arm/coff.h and semi.h */
#define LOCAL_LABEL_PREFIX "."
*must* match the definitions in gcc/config/arm/{coff|semi|aout}.h. */
#define LOCAL_LABEL_PREFIX ""
#ifndef USER_LABEL_PREFIX
#define USER_LABEL_PREFIX "_"
#endif
@ -2537,11 +2535,13 @@ coff_arm_final_link_postscript (abfd, pfinfo)
#define TARGET_UNDERSCORE 0
#endif
#ifndef EXTRA_S_FLAGS
#ifdef COFF_WITH_PE
#define EXTRA_S_FLAGS (SEC_LINK_ONCE | SEC_LINK_DUPLICATES)
#else
#define EXTRA_S_FLAGS 0
#endif
#endif
/* Forward declaration for use initialising alternative_target field. */
extern const bfd_target TARGET_BIG_SYM ;
@ -2549,4 +2549,3 @@ extern const bfd_target TARGET_BIG_SYM ;
/* Target vectors. */
CREATE_LITTLE_COFF_TARGET_VEC (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME, D_PAGED, EXTRA_S_FLAGS, TARGET_UNDERSCORE, & TARGET_BIG_SYM)
CREATE_BIG_COFF_TARGET_VEC (TARGET_BIG_SYM, TARGET_BIG_NAME, D_PAGED, EXTRA_S_FLAGS, TARGET_UNDERSCORE, & TARGET_LITTLE_SYM)

View File

@ -1,5 +1,6 @@
/* BFD back-end for Intel 386 COFF files (DJGPP variant).
Copyright 1990, 91, 92, 93, 94, 1999, 2000 Free Software Foundation, Inc.
Copyright 1990, 91, 92, 93, 94, 1999, 2000,
2001 Free Software Foundation, Inc.
Written by DJ Delorie.
This file is part of BFD, the Binary File Descriptor library.
@ -23,14 +24,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define TARGET_UNDERSCORE '_'
#define COFF_LONG_SECTION_NAMES
#define COFF_SUPPORT_GNU_LINKONCE
#define COFF_LONG_FILENAMES
#define COFF_SECTION_ALIGNMENT_ENTRIES \
{ COFF_SECTION_NAME_EXACT_MATCH (".data"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
{ COFF_SECTION_NAME_EXACT_MATCH (".text"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
{ COFF_SECTION_NAME_EXACT_MATCH (".bss"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.d"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.t"), \

View File

@ -255,8 +255,7 @@ static reloc_howto_type howto_table[] =
HOWTO (R_JMP_DEL, 0, 0, 8, true, 0, complain_overflow_signed, special, "Deleted jump", false, 0x000000ff, 0x000000ff, true),
};
/* Turn a howto into a reloc number */
/* Turn a howto into a reloc number. */
#define SELECT_RELOC(x,howto) \
{ x.r_type = select_reloc(howto); }
@ -265,16 +264,13 @@ static reloc_howto_type howto_table[] =
#define H8300 1 /* Customize coffcode.h */
#define __A_MAGIC_SET__
/* Code to swap in the reloc */
/* Code to swap in the reloc. */
#define SWAP_IN_RELOC_OFFSET bfd_h_get_32
#define SWAP_OUT_RELOC_OFFSET bfd_h_put_32
#define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) \
dst->r_stuff[0] = 'S'; \
dst->r_stuff[1] = 'C';
static int
select_reloc (howto)
reloc_howto_type *howto;
@ -282,8 +278,7 @@ select_reloc (howto)
return howto->type;
}
/* 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)
@ -360,24 +355,21 @@ rtype2howto (internal, dst)
#define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry)
/* Perform any necessary magic to the addend in a reloc entry */
/* 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
reloc_processing (relent, reloc, symbols, abfd, section)
arelent * relent;
arelent *relent;
struct internal_reloc *reloc;
asymbol ** symbols;
bfd * abfd;
asection * section;
asymbol **symbols;
bfd *abfd;
asection *section;
{
relent->address = reloc->r_vaddr;
rtype2howto (relent, reloc);
@ -391,12 +383,12 @@ 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;
/* relent->section = 0;*/
#if 0
relent->section = 0;
#endif
}
static boolean
@ -425,7 +417,6 @@ h8300_symbol_address_p (abfd, input_section, address)
return false;
}
/* If RELOC represents a relaxable instruction/reloc, change it into
the relaxed reloc, notify the linker that symbol addresses
have changed (bfd_perform_slip) and return how much the current
@ -435,7 +426,7 @@ h8300_symbol_address_p (abfd, input_section, address)
in the howto table. This needs to be fixed. */
static int
h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info)
h8300_reloc16_estimate (abfd, input_section, reloc, shrink, link_info)
bfd *abfd;
asection *input_section;
arelent *reloc;
@ -460,13 +451,12 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info)
/* Only examine the relocs which might be relaxable. */
switch (reloc->howto->type)
{
/* This is the 16/24 bit absolute branch which could become an 8 bit
pc-relative branch. */
case R_JMP1:
case R_JMPL1:
/* Get the address of the target of this branch. */
value = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
/* Get the address of the next instruction (not the reloc). */
dot = (input_section->output_section->vma
@ -483,7 +473,6 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info)
closer if we do relax this branch. */
if ((int)gap >= -128 && (int)gap <= 128 )
{
/* It's possible we may be able to eliminate this branch entirely;
if the previous instruction is a branch around this instruction,
and there's no label at this instruction, then we can reverse
@ -507,7 +496,7 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info)
if (last_value == dot + 2
&& last_reloc->address + 1 == reloc->address
&& ! h8300_symbol_address_p (abfd, input_section, dot - 2))
&& !h8300_symbol_address_p (abfd, input_section, dot - 2))
{
reloc->howto = howto_table + 19;
last_reloc->howto = howto_table + 18;
@ -524,7 +513,7 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info)
/* This shrinks this section by two bytes. */
shrink += 2;
bfd_perform_slip(abfd, 2, input_section, address);
bfd_perform_slip (abfd, 2, input_section, address);
}
break;
@ -533,7 +522,7 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info)
case R_PCRWORD:
/* Get the address of the target of this branch, add one to the value
because the addend field in PCrel jumps is off by -1. */
value = bfd_coff_reloc16_get_value(reloc, link_info, input_section) + 1;
value = bfd_coff_reloc16_get_value (reloc, link_info, input_section) + 1;
/* Get the address of the next instruction if we were to relax. */
dot = input_section->output_section->vma +
@ -552,7 +541,7 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info)
/* This shrinks this section by two bytes. */
shrink += 2;
bfd_perform_slip(abfd, 2, input_section, address);
bfd_perform_slip (abfd, 2, input_section, address);
}
break;
@ -560,7 +549,7 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info)
become an 8 bit absolute address if it's in the right range. */
case R_MOV16B1:
/* Get the address of the data referenced by this mov.b insn. */
value = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
/* The address is in 0xff00..0xffff inclusive on the h8300 or
0xffff00..0xffffff inclusive on the h8300h, then we can
@ -578,7 +567,7 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info)
/* This shrinks this section by two bytes. */
shrink += 2;
bfd_perform_slip(abfd, 2, input_section, address);
bfd_perform_slip (abfd, 2, input_section, address);
}
break;
@ -587,7 +576,7 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info)
and try to relax it into a 16bit absolute. */
case R_MOV24B1:
/* Get the address of the data referenced by this mov.b insn. */
value = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
/* The address is in 0xffff00..0xffffff inclusive on the h8300h,
then we can relax this mov.b */
@ -601,7 +590,7 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info)
/* This shrinks this section by four bytes. */
shrink += 4;
bfd_perform_slip(abfd, 4, input_section, address);
bfd_perform_slip (abfd, 4, input_section, address);
/* Done with this reloc. */
break;
@ -614,7 +603,7 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info)
become an 16 bit absolute address if it's in the right range. */
case R_MOVL1:
/* Get the address of the data referenced by this mov insn. */
value = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
/* If this address is in 0x0000..0x7fff inclusive or
0xff8000..0xffffff inclusive, then it can be relaxed. */
@ -625,7 +614,7 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info)
/* This shrinks this section by two bytes. */
shrink += 2;
bfd_perform_slip(abfd, 2, input_section, address);
bfd_perform_slip (abfd, 2, input_section, address);
}
break;
@ -639,7 +628,6 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info)
return shrink;
}
/* Handle relocations for the H8/300, including relocs for relaxed
instructions.
@ -661,15 +649,14 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
asection *input_section = link_order->u.indirect.section;
bfd_vma value;
bfd_vma dot;
int gap,tmp;
int gap, tmp;
switch (reloc->howto->type)
{
/* Generic 8bit pc-relative relocation. */
case R_PCRBYTE:
/* Get the address of the target of this branch. */
value = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
dot = (link_order->offset
+ dst_address
@ -700,7 +687,7 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
/* Generic 16bit pc-relative relocation. */
case R_PCRWORD:
/* Get the address of the target of this branch. */
value = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
/* Get the address of the instruction (not the reloc). */
dot = (link_order->offset
@ -763,7 +750,7 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
case R_MOV16B1:
case R_JMP1:
case R_RELWORD:
value = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
bfd_put_16 (abfd, value, data + dst_address);
dst_address += 2;
src_address += 2;
@ -774,7 +761,7 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
case R_MOVL1:
case R_RELLONG:
/* Get the address of the target of this branch. */
value = bfd_coff_reloc16_get_value (reloc, link_info, input_section),
value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
bfd_put_32 (abfd, value, data + dst_address);
dst_address += 4;
src_address += 4;
@ -964,13 +951,13 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
abort ();
/* Fix up the opcode. */
switch (data[src_address-1] & 0xf0)
switch (data[src_address - 1] & 0xf0)
{
case 0x00:
data[dst_address - 2] = (data[src_address-1] & 0xf) | 0x20;
data[dst_address - 2] = (data[src_address - 1] & 0xf) | 0x20;
break;
case 0x80:
data[dst_address - 2] = (data[src_address-1] & 0xf) | 0x30;
data[dst_address - 2] = (data[src_address - 1] & 0xf) | 0x30;
break;
default:
abort ();
@ -989,13 +976,13 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
abort ();
/* Fix up the opcode. */
switch (data[src_address-1] & 0xf0)
switch (data[src_address - 1] & 0xf0)
{
case 0x20:
data[dst_address - 2] = (data[src_address-1] & 0xf) | 0x20;
data[dst_address - 2] = (data[src_address - 1] & 0xf) | 0x20;
break;
case 0xa0:
data[dst_address - 2] = (data[src_address-1] & 0xf) | 0x30;
data[dst_address - 2] = (data[src_address - 1] & 0xf) | 0x30;
break;
default:
abort ();
@ -1007,7 +994,7 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
case R_BCC_INV:
/* Get the address of the target of this branch. */
value = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
dot = (link_order->offset
+ dst_address
@ -1106,7 +1093,7 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
strcpy (new_name, name);
sprintf (new_name + strlen (name), "_%08x",
(int)symbol->section);
(int) symbol->section);
name = new_name;
}
@ -1165,7 +1152,6 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
*dst_ptr = dst_address;
}
/* Routine for the h8300 linker.
This routine is necessary to handle the special R_MEM_INDIRECT
@ -1178,7 +1164,7 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
selected static symbols to the bfd linker hash table. */
static boolean
h8300_bfd_link_add_symbols(abfd, info)
h8300_bfd_link_add_symbols (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
{
@ -1242,7 +1228,7 @@ h8300_bfd_link_add_symbols(abfd, info)
if (reloc_size <= 0)
continue;
relocs = (arelent **)bfd_malloc ((size_t)reloc_size);
relocs = (arelent **) bfd_malloc ((size_t) reloc_size);
if (!relocs)
return false;
@ -1285,7 +1271,7 @@ h8300_bfd_link_add_symbols(abfd, info)
strcpy (new_name, name);
sprintf (new_name + strlen (name), "_%08x",
(int)symbol->section);
(int) symbol->section);
name = new_name;
}
@ -1293,7 +1279,6 @@ h8300_bfd_link_add_symbols(abfd, info)
h = funcvec_hash_lookup (h8300_coff_hash_table (info)->funcvec_hash_table,
name, false, false);
/* If this symbol isn't already in the hash table, add
it and bump up the size of the hash table. */
if (h == NULL)
@ -1345,12 +1330,10 @@ h8300_bfd_link_add_symbols(abfd, info)
#define COFF_LONG_FILENAMES
#include "coffcode.h"
#undef coff_bfd_get_relocated_section_contents
#undef coff_bfd_relax_section
#define coff_bfd_get_relocated_section_contents \
bfd_coff_reloc16_get_relocated_section_contents
#define coff_bfd_relax_section bfd_coff_reloc16_relax_section
CREATE_BIG_COFF_TARGET_VEC (h8300coff_vec, "coff-h8300", BFD_IS_RELAXABLE, 0, '_', NULL)

View File

@ -45,7 +45,6 @@ static reloc_howto_type r_imm32 =
HOWTO (R_H8500_IMM32, 0, 1, 32, false, 0,
complain_overflow_bitfield, 0, "r_imm32", true, 0xffffffff, 0xffffffff, false);
static reloc_howto_type r_high8 =
HOWTO (R_H8500_HIGH8, 0, 1, 8, false, 0,
complain_overflow_dont, 0, "r_high8", true, 0x000000ff, 0x000000ff, false);
@ -57,7 +56,6 @@ HOWTO (R_H8500_LOW16, 0, 1, 16, false, 0,
static reloc_howto_type r_pcrel8 =
HOWTO (R_H8500_PCREL8, 0, 1, 8, true, 0, complain_overflow_signed, 0, "r_pcrel8", true, 0, 0, true);
static reloc_howto_type r_pcrel16 =
HOWTO (R_H8500_PCREL16, 0, 1, 16, true, 0, complain_overflow_signed, 0, "r_pcrel16", true, 0, 0, true);
@ -65,7 +63,6 @@ static reloc_howto_type r_high16 =
HOWTO (R_H8500_HIGH16, 0, 1, 8, false, 0,
complain_overflow_dont, 0, "r_high16", true, 0x000ffff, 0x0000ffff, false);
/* Turn a howto into a reloc number */
static int
@ -77,7 +74,6 @@ coff_h8500_select_reloc (howto)
#define SELECT_RELOC(x,howto) x.r_type = coff_h8500_select_reloc(howto)
#define BADMAG(x) H8500BADMAG(x)
#define H8500 1 /* Customize coffcode.h */
@ -135,14 +131,11 @@ 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)
@ -165,7 +158,6 @@ static void 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;
}
@ -231,7 +223,7 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)
case R_H8500_IMM24:
{
int v = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
int o = bfd_get_32(in_abfd, data+ *dst_ptr -1);
int o = bfd_get_32 (in_abfd, data+ *dst_ptr -1);
v = (v & 0x00ffffff) | (o & 0xff00000);
bfd_put_32 (in_abfd, v, data + *dst_ptr -1);
(*dst_ptr) +=3;
@ -247,7 +239,6 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)
}
break;
case R_H8500_PCREL8:
{
bfd_vma dst = bfd_coff_reloc16_get_value (reloc, link_info,
@ -304,7 +295,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 \

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,6 +104,25 @@ 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. */
#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;
}
@ -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

View File

@ -66,7 +66,6 @@ coff_i860_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
if (output_bfd == (bfd *) NULL)
return bfd_reloc_continue;
if (bfd_is_com_section (symbol->section))
{
/* We are relocating a common symbol. The current value in the
@ -91,7 +90,6 @@ coff_i860_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
diff = reloc_entry->addend;
}
#define DOIT(x) \
x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + diff) & howto->dst_mask))
@ -338,7 +336,6 @@ coff_i860_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
BFD_ASSERT (h != NULL);
/* I think we *do* want to bypass this. If we don't, I have seen some data
parameters get the wrong relcation address. If I link two versions
with and without this section bypassed and then do a binary comparison,

View File

@ -146,7 +146,7 @@ optcall_callback (abfd, reloc_entry, symbol_in, data,
to the correct location. */
{
union internal_auxent *aux = &((cs->native+2)->u.auxent);
int word = bfd_get_32(abfd, (bfd_byte *)data + reloc_entry->address);
int word = bfd_get_32 (abfd, (bfd_byte *)data + reloc_entry->address);
int olf = (aux->x_bal.x_balntry - cs->native->u.syment.n_value);
BFD_ASSERT(cs->native->u.syment.n_numaux==2);
@ -156,7 +156,7 @@ optcall_callback (abfd, reloc_entry, symbol_in, data,
sym and auxents untouched, so the delta between the two
is the offset of the bal entry point. */
word = ((word + olf) & BAL_MASK) | BAL;
bfd_put_32(abfd, word, (bfd_byte *) data + reloc_entry->address);
bfd_put_32 (abfd, word, (bfd_byte *) data + reloc_entry->address);
}
result = bfd_reloc_ok;
break;
@ -578,7 +578,6 @@ coff_i960_relocate_section (output_bfd, info, input_bfd, input_section,
instead be a reloc against the internal symbol we created specially
for the section. */
/*ARGSUSED*/
static boolean
coff_i960_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp)
bfd *obfd ATTRIBUTE_UNUSED;

198
gnu/dist/toolchain/bfd/coff-ia64.c vendored Normal file
View File

@ -0,0 +1,198 @@
/* BFD back-end for HP/Intel IA-64 COFF files.
Copyright 1999 Free Software Foundation, Inc.
Contributed by David Mosberger <davidm@hpl.hp.com>
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
#include "coff/ia64.h"
#include "coff/internal.h"
#include "coff/pe.h"
#include "libcoff.h"
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
/* The page size is a guess based on ELF. */
#define COFF_PAGE_SIZE 0x1000
static reloc_howto_type howto_table[] =
{
EMPTY_HOWTO (0),
};
#define BADMAG(x) IA64BADMAG(x)
#define IA64 1 /* Customize coffcode.h */
#ifdef COFF_WITH_PEP64
# undef AOUTSZ
# define AOUTSZ PEP64AOUTSZ
# define PEAOUTHDR PEP64AOUTHDR
#endif
#define RTYPE2HOWTO(cache_ptr, dst) \
(cache_ptr)->howto = howto_table + (dst)->r_type;
#ifdef COFF_WITH_PE
/* Return true if this relocation should
appear in the output .reloc section. */
static boolean
in_reloc_p(abfd, howto)
bfd * abfd ATTRIBUTE_UNUSED;
reloc_howto_type *howto ATTRIBUTE_UNUSED;
{
return 0; /* We don't do relocs for now... */
}
#endif
#include "coffcode.h"
static const bfd_target *
ia64coff_object_p (abfd)
bfd *abfd;
{
#ifdef COFF_IMAGE_WITH_PE
/* We need to hack badly to handle a PE image correctly. In PE
images created by the GNU linker, the offset to the COFF header
is always the size. However, this is not the case in images
generated by other PE linkers. The PE format stores a four byte
offset to the PE signature just before the COFF header at
location 0x3c of the file. We pick up that offset, verify that
the PE signature is there, and then set ourselves up to read in
the COFF header. */
{
bfd_byte ext_offset[4];
file_ptr offset;
bfd_byte ext_signature[4];
unsigned long signature;
if (bfd_seek (abfd, 0x3c, SEEK_SET) != 0
|| bfd_read (ext_offset, 1, 4, abfd) != 4)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
return NULL;
}
offset = bfd_h_get_32 (abfd, ext_offset);
if (bfd_seek (abfd, offset, SEEK_SET) != 0
|| bfd_read (ext_signature, 1, 4, abfd) != 4)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
return NULL;
}
signature = bfd_h_get_32 (abfd, ext_signature);
if (signature != 0x4550)
{
bfd_set_error (bfd_error_wrong_format);
return NULL;
}
/* Here is the hack. coff_object_p wants to read filhsz bytes to
pick up the COFF header. We adjust so that that will work. 20
is the size of the COFF filehdr. */
if (bfd_seek (abfd,
(bfd_tell (abfd)
- bfd_coff_filhsz (abfd)
+ 20),
SEEK_SET)
!= 0)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
return NULL;
}
}
#endif
return coff_object_p (abfd);
}
const bfd_target
#ifdef TARGET_SYM
TARGET_SYM =
#else
ia64coff_vec =
#endif
{
#ifdef TARGET_NAME
TARGET_NAME,
#else
"coff-ia64", /* name */
#endif
bfd_target_coff_flavour,
BFD_ENDIAN_LITTLE, /* data byte order is little */
BFD_ENDIAN_LITTLE, /* header byte order is little */
(HAS_RELOC | EXEC_P | /* object flags */
HAS_LINENO | HAS_DEBUG |
HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
#ifndef COFF_WITH_PE
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
| SEC_CODE | SEC_DATA),
#else
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
| SEC_CODE | SEC_DATA
| SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
#endif
#ifdef TARGET_UNDERSCORE
TARGET_UNDERSCORE, /* leading underscore */
#else
0, /* leading underscore */
#endif
'/', /* ar_pad_char */
15, /* ar_max_namelen */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
/* Note that we allow an object file to be treated as a core file as well. */
{_bfd_dummy_target, ia64coff_object_p, /* bfd_check_format */
bfd_generic_archive_p, ia64coff_object_p},
{bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
bfd_false},
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
_bfd_write_archive_contents, bfd_false},
BFD_JUMP_TABLE_GENERIC (coff),
BFD_JUMP_TABLE_COPY (coff),
BFD_JUMP_TABLE_CORE (_bfd_nocore),
BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
BFD_JUMP_TABLE_SYMBOLS (coff),
BFD_JUMP_TABLE_RELOCS (coff),
BFD_JUMP_TABLE_WRITE (coff),
BFD_JUMP_TABLE_LINK (coff),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
COFF_SWAP_TABLE
};

View File

@ -1,5 +1,5 @@
/* BFD back-end for Motorola 68000 COFF binaries.
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1999
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 99, 2000
Free Software Foundation, Inc.
Written by Cygnus Support.
@ -213,7 +213,6 @@ static reloc_howto_type *m68kcoff_rtype_to_howto
struct coff_link_hash_entry *, struct internal_syment *,
bfd_vma *));
/*ARGSUSED*/
static reloc_howto_type *
m68kcoff_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
bfd *abfd ATTRIBUTE_UNUSED;
@ -374,7 +373,6 @@ m68kcoff_common_addend_special_fn (abfd, reloc_entry, symbol, data,
/* coff-m68k.c uses the special COFF backend linker. We need to
adjust common symbols. */
/*ARGSUSED*/
static reloc_howto_type *
m68kcoff_common_addend_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
bfd *abfd ATTRIBUTE_UNUSED;
@ -419,6 +417,98 @@ m68kcoff_common_addend_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
#endif /* ! defined (coff_rtype_to_howto) */
#endif /* COFF_COMMON_ADDEND */
#if !defined ONLY_DECLARE_RELOCS && ! defined STATIC_RELOCS
/* Given a .data section and a .emreloc in-memory section, store
relocation information into the .emreloc section which can be
used at runtime to relocate the section. This is called by the
linker when the --embedded-relocs switch is used. This is called
after the add_symbols entry point has been called for all the
objects, and before the final_link entry point is called. */
boolean
bfd_m68k_coff_create_embedded_relocs (abfd, info, datasec, relsec, errmsg)
bfd *abfd;
struct bfd_link_info *info;
asection *datasec;
asection *relsec;
char **errmsg;
{
char *extsyms;
bfd_size_type symesz;
struct internal_reloc *irel, *irelend;
bfd_byte *p;
BFD_ASSERT (! info->relocateable);
*errmsg = NULL;
if (datasec->reloc_count == 0)
return true;
extsyms = obj_coff_external_syms (abfd);
symesz = bfd_coff_symesz (abfd);
irel = _bfd_coff_read_internal_relocs (abfd, datasec, true, NULL, false,
NULL);
irelend = irel + datasec->reloc_count;
relsec->contents = (bfd_byte *) bfd_alloc (abfd, datasec->reloc_count * 12);
if (relsec->contents == NULL)
return false;
p = relsec->contents;
for (; irel < irelend; irel++, p += 12)
{
asection *targetsec;
/* We are going to write a four byte longword into the runtime
reloc section. The longword will be the address in the data
section which must be relocated. It is followed by the name
of the target section NUL-padded or truncated to 8
characters. */
/* We can only relocate absolute longword relocs at run time. */
if (irel->r_type != R_RELLONG)
{
*errmsg = _("unsupported reloc type");
bfd_set_error (bfd_error_bad_value);
return false;
}
if (irel->r_symndx == -1)
targetsec = bfd_abs_section_ptr;
else
{
struct coff_link_hash_entry *h;
h = obj_coff_sym_hashes (abfd)[irel->r_symndx];
if (h == NULL)
{
struct internal_syment isym;
bfd_coff_swap_sym_in (abfd, extsyms + symesz * irel->r_symndx,
&isym);
targetsec = coff_section_from_bfd_index (abfd, isym.n_scnum);
}
else if (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
targetsec = h->root.u.def.section;
else
targetsec = NULL;
}
bfd_put_32 (abfd,
(irel->r_vaddr - datasec->vma + datasec->output_offset), p);
memset (p + 4, 0, 8);
if (targetsec != NULL)
strncpy (p + 4, targetsec->output_section->name, 8);
}
return true;
}
#endif /* neither ONLY_DECLARE_RELOCS not STATIC_RELOCS */
#define coff_bfd_is_local_label_name m68k_coff_is_local_label_name

View File

@ -250,12 +250,10 @@ rtype2howto (cache_ptr, dst)
#define RTYPE2HOWTO(cache_ptr, dst) rtype2howto (cache_ptr, dst)
/* Code to swap in the reloc offset */
#define SWAP_IN_RELOC_OFFSET bfd_h_get_16
#define SWAP_OUT_RELOC_OFFSET bfd_h_put_16
#define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \
reloc_processing(relent, reloc, symbols, abfd, section)

View File

@ -65,7 +65,6 @@ static reloc_howto_type * coff_mcore_rtype_to_howto
/* In case we're on a 32-bit machine, construct a 64-bit "-1" value
from smaller values. Start with zero, widen, *then* decrement. */
#define MINUS_ONE (((bfd_vma)0) - 1)
static reloc_howto_type mcore_coff_howto_table[] =
{
@ -263,7 +262,6 @@ mcore_emit_base_file_entry (info, output_bfd, input_section, reloc_offset)
fwrite (&addr, 1, sizeof (addr), (FILE *) info->base_file);
}
/*ARGSUSED*/
static bfd_reloc_status_type
mcore_coff_unsupported_reloc (abfd, reloc_entry, symbol, data, input_section,
output_bfd, error_message)
@ -284,7 +282,6 @@ mcore_coff_unsupported_reloc (abfd, reloc_entry, symbol, data, input_section,
return bfd_reloc_notsupported;
}
/* A cheesy little macro to make the code a little more readable. */
#define HOW2MAP(bfd_rtype, mcore_rtype) \
@ -326,7 +323,6 @@ coff_mcore_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
{
reloc_howto_type * howto;
if (rel->r_type >= NUM_ELEM (mcore_coff_howto_table))
return NULL;
@ -363,7 +359,6 @@ in_reloc_p (abfd, howto)
{
return ! howto->pc_relative && howto->type != IMAGE_REL_MCORE_RVA;
}
/* The reloc processing routine for the optimized COFF linker. */
static boolean
@ -562,7 +557,6 @@ coff_mcore_relocate_section (output_bfd, info, input_bfd, input_section,
return true;
}
/* Tailor coffcode.h -- macro heaven. */
@ -582,5 +576,9 @@ coff_mcore_relocate_section (output_bfd, info, input_bfd, input_section,
extern const bfd_target TARGET_LITTLE_SYM;
/* The transfer vectors that lead the outside world to all of the above. */
CREATE_BIG_COFF_TARGET_VEC (TARGET_BIG_SYM, TARGET_BIG_NAME, D_PAGED, (SEC_LINK_ONCE | SEC_LINK_DUPLICATES), 0, & TARGET_LITTLE_SYM)
CREATE_LITTLE_COFF_TARGET_VEC (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME, D_PAGED, (SEC_LINK_ONCE | SEC_LINK_DUPLICATES), 0, & TARGET_BIG_SYM)
CREATE_BIG_COFF_TARGET_VEC (TARGET_BIG_SYM, TARGET_BIG_NAME, D_PAGED,
(SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_READONLY | SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
0, & TARGET_LITTLE_SYM)
CREATE_LITTLE_COFF_TARGET_VEC (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME, D_PAGED,
(SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_READONLY | SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
0, & TARGET_BIG_SYM)

View File

@ -1,5 +1,5 @@
/* BFD back-end for MIPS Extended-Coff files.
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.
@ -115,7 +115,6 @@ static boolean mips_relax_pcrel16 PARAMS ((struct bfd_link_info *, bfd *,
bfd_byte *, bfd_vma));
static reloc_howto_type *mips_bfd_reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type));
/* ECOFF has COFF sections, but the debugging information is stored in
a completely different format. ECOFF targets use some of the
@ -910,7 +909,7 @@ mips_gprel_reloc (abfd,
reloc_entry->address += input_section->output_offset;
/* Make sure it fit in 16 bits. */
if (val >= 0x8000 && val < 0xffff8000)
if ((long) val >= 0x8000 || (long) val < -0x8000)
return bfd_reloc_overflow;
return bfd_reloc_ok;
@ -1100,7 +1099,6 @@ mips_rello_reloc (abfd,
requires special handling when relaxing. We don't want
bfd_perform_relocation to tamper with it at all. */
/*ARGSUSED*/
static bfd_reloc_status_type
mips_switch_reloc (abfd,
reloc_entry,
@ -2505,7 +2503,7 @@ static const struct ecoff_backend_data mips_ecoff_backend_data =
(unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* reloc_out */
mips_ecoff_swap_filehdr_out, mips_ecoff_swap_aouthdr_out,
mips_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,
mips_ecoff_swap_filehdr_in, mips_ecoff_swap_aouthdr_in,
mips_ecoff_swap_scnhdr_in, NULL,
mips_ecoff_bad_format_hook, _bfd_ecoff_set_arch_mach_hook,

View File

@ -17,11 +17,17 @@ 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 TARGET_SYM pmac_xcoff_vec
#define TARGET_NAME "xcoff-powermac"
/* Tweak coffcode.h based on this being a PowerMac instead of RS/6000. */
#define POWERMAC
#include "coff-rs6000.c"
#define TARGET_SYM pmac_xcoff_vec
#define TARGET_NAME "xcoff-powermac"
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
#include "coff/internal.h"
#include "coff/rs6000.h"
#include "libcoff.h"
#include "xcoff-target.h"

View File

@ -33,7 +33,6 @@ Boston, MA 02111-1307, USA. */
not produce the right glue code for dll function calls.
*/
#include "bfd.h"
#include "sysdep.h"
@ -75,7 +74,6 @@ extern void dump_toc PARAMS ((PTR));
#define MARK_AS_WRITTEN(x) ((x) |= 1)
#define MAKE_ADDR_AGAIN(x) ((x) &= ~1)
/* Turn on this check if you suspect something amiss in the hash tables */
#ifdef DEBUG_HASH
@ -87,13 +85,12 @@ extern void dump_toc PARAMS ((PTR));
#define HASH_CHECK(addr) \
if (strcmp(addr->eye_catcher, EYE) != 0) \
{ \
fprintf(stderr,\
fprintf (stderr,\
_("File %s, line %d, Hash check failure, bad eye %8s\n"), \
__FILE__, __LINE__, addr->eye_catcher); \
abort(); \
abort (); \
}
#else
#define HASH_CHECK_DCL
@ -120,7 +117,6 @@ struct ppc_coff_link_hash_entry
HASH_CHECK_DCL
};
/* PE linker hash table. */
struct ppc_coff_link_hash_table
@ -222,7 +218,6 @@ ppc_coff_link_hash_table_create (abfd)
/* Now, tailor coffcode.h to use our hash stuff */
#define coff_bfd_link_hash_table_create ppc_coff_link_hash_table_create
/* The nt loader points the toc register to &toc + 32768, in order to */
/* use the complete range of a 16-bit displacement. We have to adjust */
@ -320,7 +315,6 @@ ppc_coff_link_hash_table_create (abfd)
#define EXTRACT_FLAGS(x) ((x) & IMAGE_REL_PPC_FLAGMASK)
#define EXTRACT_JUNK(x) \
((x) & ~(IMAGE_REL_PPC_TYPEMASK | IMAGE_REL_PPC_FLAGMASK))
/* static helper functions to make relocation work */
/* (Work In Progress) */
@ -348,7 +342,6 @@ static bfd_reloc_status_type ppc_pair_reloc PARAMS ((bfd *abfd,
asection *section,
bfd *output_bfd,
char **error));
static bfd_reloc_status_type ppc_toc16_reloc PARAMS ((bfd *abfd,
arelent *reloc,
@ -391,10 +384,7 @@ static bfd_reloc_status_type ppc_imglue_reloc PARAMS ((bfd *abfd,
bfd *output_bfd,
char **error));
static boolean in_reloc_p PARAMS((bfd *abfd, reloc_howto_type *howto));
/* FIXME: It'll take a while to get through all of these. I only need a few to
get us started, so those I'll make sure work. Those marked FIXME are either
@ -775,10 +765,7 @@ static reloc_howto_type ppc_coff_howto_table[] =
false), /* pcrel_offset */
};
/* Some really cheezy macros that can be turned on to test stderr :-) */
#ifdef DEBUG_RELOC
@ -788,13 +775,13 @@ static reloc_howto_type ppc_coff_howto_table[] =
if (i == 0) \
{ \
i = 1; \
fprintf(stderr,_("Unimplemented Relocation -- %s\n"),x); \
fprintf (stderr,_("Unimplemented Relocation -- %s\n"),x); \
} \
}
#define DUMP_RELOC(n,r) \
{ \
fprintf(stderr,"%s sym %d, addr %d, addend %d\n", \
fprintf (stderr,"%s sym %d, addr %d, addend %d\n", \
n, (*(r->sym_ptr_ptr))->name, \
r->address, r->addend); \
}
@ -810,7 +797,7 @@ static reloc_howto_type ppc_coff_howto_table[] =
#define DUMP_RELOC2(n,r) \
{ \
fprintf(stderr,"%s sym %d, r_vaddr %d %s\n", \
fprintf (stderr,"%s sym %d, r_vaddr %d %s\n", \
n, r->r_symndx, r->r_vaddr,\
(((r->r_type) & IMAGE_REL_PPC_TOCDEFN) == 0) \
?" ":" TOCDEFN" ); \
@ -821,8 +808,6 @@ static reloc_howto_type ppc_coff_howto_table[] =
#define DUMP_RELOC(n,r)
#define DUMP_RELOC2(n,r)
#endif
/* toc construction and management routines */
@ -933,7 +918,7 @@ ppc_record_toc_entry(abfd, info, sec, sym, toc_kind)
/* allocate a table */
local_syms =
(int *) bfd_zalloc (abfd,
obj_raw_syment_count(abfd) * sizeof(int));
obj_raw_syment_count(abfd) * sizeof (int));
if (local_syms == 0)
return false;
obj_coff_local_toc_table(abfd) = local_syms;
@ -1002,7 +987,6 @@ ppc_mark_symbol_as_glue(abfd, sym, rel)
#endif /* COFF_IMAGE_WITH_PE */
/* Return true if this relocation should
appear in the output .reloc section. */
@ -1079,7 +1063,6 @@ pe_ppc_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
return(bfd_reloc_dangerous);
}
sym_value = get_symbol_value(symbol_in);
return(bfd_reloc_ok);
@ -1160,7 +1143,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
if (r_type == IMAGE_REL_PPC_IMGLUE && h == 0)
{
/* An IMGLUE reloc must have a name. Something is very wrong. */
abort();
abort ();
}
sec = NULL;
@ -1228,7 +1211,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
if ( toc_section == NULL )
{
/* There is no toc section. Something is very wrong. */
abort();
abort ();
}
}
@ -1267,7 +1250,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
priv,
strdup(name));
bfd_put_32(output_bfd,
bfd_put_32 (output_bfd,
val,
toc_section->contents + our_toc_offset);
@ -1327,7 +1310,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
record_toc(toc_section, our_toc_offset, pub, strdup(name));
/* write out the toc entry */
bfd_put_32(output_bfd,
bfd_put_32 (output_bfd,
val,
toc_section->contents + our_toc_offset);
@ -1356,7 +1339,6 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
fwrite (&addr, 1,4, (FILE *) info->base_file);
}
/* FIXME: this test is conservative */
if ( (r_flags & IMAGE_REL_PPC_TOCDEFN) != IMAGE_REL_PPC_TOCDEFN &&
our_toc_offset > toc_section->_raw_size)
@ -1393,8 +1375,8 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
my_name = h->root.root.root.string;
if (h->symbol_is_glue == 1)
{
x = bfd_get_32(input_bfd, loc);
bfd_put_32(input_bfd, h->glue_insn, loc);
x = bfd_get_32 (input_bfd, loc);
bfd_put_32 (input_bfd, h->glue_insn, loc);
}
}
}
@ -1420,13 +1402,13 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
my_name = h->root.root.root.string;
}
fprintf(stderr,
fprintf (stderr,
_("Warning: unsupported reloc %s <file %s, section %s>\n"),
howto->name,
bfd_get_filename(input_bfd),
input_section->name);
fprintf(stderr,"sym %ld (%s), r_vaddr %ld (%lx)\n",
fprintf (stderr,"sym %ld (%s), r_vaddr %ld (%lx)\n",
rel->r_symndx, my_name, (long) rel->r_vaddr,
(unsigned long) rel->r_vaddr);
}
@ -1505,7 +1487,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
if (myh == 0)
{
/* Missing magic cookies. Something is very wrong. */
abort();
abort ();
}
val = myh->root.u.def.value +
@ -1659,11 +1641,11 @@ dump_toc (vfile)
FILE *file = (FILE *) vfile;
struct list_ele *t;
fprintf(file, _(h1));
fprintf(file, _(h2));
fprintf(file, _(h3));
fprintf (file, _(h1));
fprintf (file, _(h2));
fprintf (file, _(h3));
for(t = head; t != 0; t=t->next)
for (t = head; t != 0; t=t->next)
{
const char *cat = "";
@ -1680,22 +1662,22 @@ dump_toc (vfile)
cat = _("IAT reference ");
else
{
fprintf(file,
fprintf (file,
_("**** global_toc_size %ld(%lx), thunk_size %ld(%lx)\n"),
global_toc_size, global_toc_size, thunk_size, thunk_size);
cat = _("Out of bounds!");
}
}
fprintf(file,
fprintf (file,
" %04lx (%d)", (unsigned long) t->offset, t->offset - 32768);
fprintf(file,
fprintf (file,
" %s %s\n",
cat, t->name);
}
fprintf(file, "\n");
fprintf (file, "\n");
}
boolean
@ -1712,14 +1694,14 @@ ppc_allocate_toc_section (info)
if (bfd_of_toc_owner == 0)
{
/* No toc owner? Something is very wrong. */
abort();
abort ();
}
s = bfd_get_section_by_name ( bfd_of_toc_owner , TOC_SECTION_NAME);
if (s == NULL)
{
/* No toc section? Something is very wrong. */
abort();
abort ();
}
foo = (bfd_byte *) bfd_alloc(bfd_of_toc_owner, global_toc_size);
@ -1762,7 +1744,7 @@ ppc_process_before_allocation (abfd, info)
i=_bfd_coff_read_internal_relocs(abfd,sec,1,0,0,0);
if (i == 0)
abort();
abort ();
for (rel=i;rel<i+sec->reloc_count;++rel)
{
@ -1797,7 +1779,6 @@ ppc_process_before_allocation (abfd, info)
#endif
static bfd_reloc_status_type
ppc_refhi_reloc (abfd,
reloc_entry,
@ -1876,7 +1857,6 @@ ppc_pair_reloc (abfd,
return bfd_reloc_undefined;
}
static bfd_reloc_status_type
ppc_toc16_reloc (abfd,
@ -2011,12 +1991,9 @@ ppc_imglue_reloc (abfd,
return bfd_reloc_ok;
}
#define MAX_RELOC_INDEX \
(sizeof(ppc_coff_howto_table) / sizeof(ppc_coff_howto_table[0]) - 1)
(sizeof (ppc_coff_howto_table) / sizeof (ppc_coff_howto_table[0]) - 1)
/* FIXME: There is a possiblity that when we read in a reloc from a file,
that there are some bits encoded in the upper portion of the
@ -2048,11 +2025,11 @@ ppc_coff_rtype2howto (relent, internal)
/* the masking process only slices off the bottom byte for r_type. */
if ( r_type > MAX_RELOC_INDEX )
abort();
abort ();
/* check for absolute crap */
if ( junk != 0 )
abort();
abort ();
switch(r_type)
{
@ -2079,7 +2056,7 @@ ppc_coff_rtype2howto (relent, internal)
howto = ppc_coff_howto_table + IMAGE_REL_PPC_TOCREL16;
break;
default:
fprintf(stderr,
fprintf (stderr,
_("Warning: Unsupported reloc %s [%d] used -- it may not work.\n"),
ppc_coff_howto_table[r_type].name,
r_type);
@ -2119,11 +2096,11 @@ coff_ppc_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
/* the masking process only slices off the bottom byte for r_type. */
if ( r_type > MAX_RELOC_INDEX )
abort();
abort ();
/* check for absolute crap */
if ( junk != 0 )
abort();
abort ();
switch(r_type)
{
@ -2154,7 +2131,7 @@ coff_ppc_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
howto = ppc_coff_howto_table + r_type;
break;
default:
fprintf(stderr,
fprintf (stderr,
_("Warning: Unsupported reloc %s [%d] used -- it may not work.\n"),
ppc_coff_howto_table[r_type].name,
r_type);
@ -2165,7 +2142,6 @@ coff_ppc_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
return howto;
}
/* a cheesy little macro to make the code a little more readable */
#define HOW2MAP(bfd_rtype,ppc_rtype) \
case bfd_rtype: return &ppc_coff_howto_table[ppc_rtype]
@ -2196,7 +2172,6 @@ ppc_coff_reloc_type_lookup (abfd, code)
}
#undef HOW2MAP
/* Tailor coffcode.h -- macro heaven. */
@ -2242,9 +2217,7 @@ static void ppc_coff_swap_sym_in_hook PARAMS ((bfd *, PTR, PTR));
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 1 }
#include "coffcode.h"
#ifndef COFF_IMAGE_WITH_PE
/* FIXME:
What we're trying to do here is allocate a toc section (early), and attach
@ -2291,7 +2264,7 @@ ppc_coff_swap_sym_in_hook (abfd, ext1, in1)
|| !bfd_set_section_alignment (abfd, s, 2))
{
/* FIXME: set appropriate bfd error */
abort();
abort ();
}
/* save the bfd for later allocation */
@ -2335,7 +2308,6 @@ ppc_get_last()
precise form of comment. krk@cygnus.com
*/
/* Do the final link step. */
boolean
@ -2840,7 +2812,6 @@ ppc_bfd_coff_final_link (abfd, info)
}
#endif
/* Forward declaration for use by alternative_target field. */
#ifdef TARGET_BIG_SYM
extern const bfd_target TARGET_BIG_SYM;
@ -2955,7 +2926,6 @@ const bfd_target TARGET_BIG_SYM =
BFD_JUMP_TABLE_LINK (coff),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
/* Alternative_target. */
#ifdef TARGET_LITTLE_SYM
& TARGET_LITTLE_SYM,

View File

@ -26,41 +26,25 @@ 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. */
/* Internalcoff.h and coffcode.h modify themselves based on this flag. */
#define RS6000COFF_C 1
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
#include "coff/internal.h"
#include "coff/rs6000.h"
#include "libcoff.h"
#define TARGET_NAME "aixcoff-rs6000"
#define TARGET_SYM rs6000coff_vec
#include "xcoff-target.h"
/* The main body of code is in coffcode.h. */
static boolean xcoff_mkobject PARAMS ((bfd *));
static boolean xcoff_copy_private_bfd_data PARAMS ((bfd *, bfd *));
static boolean xcoff_is_local_label_name PARAMS ((bfd *, const char *));
static void xcoff_rtype2howto
PARAMS ((arelent *, struct internal_reloc *));
static reloc_howto_type *xcoff_reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type));
static boolean xcoff_slurp_armap PARAMS ((bfd *));
static const bfd_target *xcoff_archive_p PARAMS ((bfd *));
static PTR xcoff_read_ar_hdr PARAMS ((bfd *));
static bfd *xcoff_openr_next_archived_file PARAMS ((bfd *, bfd *));
static int xcoff_generic_stat_arch_elt PARAMS ((bfd *, struct stat *));
static const char *normalize_filename PARAMS ((bfd *));
static boolean xcoff_write_armap
PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
static boolean xcoff_write_archive_contents PARAMS ((bfd *));
static int _bfd_xcoff_sizeof_headers PARAMS ((bfd *, boolean));
/* We use our own tdata type. Its first field is the COFF tdata type,
so the COFF routines are compatible. */
static boolean
xcoff_mkobject (abfd)
boolean
_bfd_xcoff_mkobject (abfd)
bfd *abfd;
{
coff_data_type *coff;
@ -90,8 +74,8 @@ xcoff_mkobject (abfd)
/* Copy XCOFF data from one BFD to another. */
static boolean
xcoff_copy_private_bfd_data (ibfd, obfd)
boolean
_bfd_xcoff_copy_private_bfd_data (ibfd, obfd)
bfd *ibfd;
bfd *obfd;
{
@ -138,21 +122,297 @@ xcoff_copy_private_bfd_data (ibfd, obfd)
The AIX native linker does not have a -X option, and it ignores the
-x option. */
static boolean
xcoff_is_local_label_name (abfd, name)
boolean
_bfd_xcoff_is_local_label_name (abfd, name)
bfd *abfd ATTRIBUTE_UNUSED;
const char *name ATTRIBUTE_UNUSED;
{
return false;
}
void
_bfd_xcoff_swap_sym_in (abfd, ext1, in1)
bfd *abfd;
PTR ext1;
PTR in1;
{
SYMENT *ext = (SYMENT *)ext1;
struct internal_syment *in = (struct internal_syment *)in1;
if (ext->e.e_name[0] != 0)
{
memcpy(in->_n._n_name, ext->e.e_name, SYMNMLEN);
}
else
{
in->_n._n_n._n_zeroes = 0;
in->_n._n_n._n_offset =
bfd_h_get_32(abfd, (bfd_byte *) ext->e.e.e_offset);
}
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);
in->n_type = bfd_h_get_16(abfd, (bfd_byte *) ext->e_type);
in->n_sclass = bfd_h_get_8(abfd, ext->e_sclass);
in->n_numaux = bfd_h_get_8(abfd, ext->e_numaux);
}
unsigned int
_bfd_xcoff_swap_sym_out (abfd, inp, extp)
bfd *abfd;
PTR inp;
PTR extp;
{
struct internal_syment *in = (struct internal_syment *)inp;
SYMENT *ext =(SYMENT *)extp;
if (in->_n._n_name[0] != 0)
{
memcpy(ext->e.e_name, in->_n._n_name, SYMNMLEN);
}
else
{
bfd_h_put_32(abfd, 0, (bfd_byte *) ext->e.e.e_zeroes);
bfd_h_put_32(abfd, in->_n._n_n._n_offset,
(bfd_byte *) ext->e.e.e_offset);
}
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);
bfd_h_put_16(abfd, in->n_type , (bfd_byte *) ext->e_type);
bfd_h_put_8(abfd, in->n_sclass , ext->e_sclass);
bfd_h_put_8(abfd, in->n_numaux , ext->e_numaux);
return bfd_coff_symesz (abfd);
}
#define PUTWORD bfd_h_put_32
#define PUTHALF bfd_h_put_16
#define PUTBYTE bfd_h_put_8
#define GETWORD bfd_h_get_32
#define GETHALF bfd_h_get_16
#define GETBYTE bfd_h_get_8
void
_bfd_xcoff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
bfd *abfd;
PTR ext1;
int type;
int class;
int indx;
int numaux;
PTR in1;
{
AUXENT *ext = (AUXENT *)ext1;
union internal_auxent *in = (union internal_auxent *)in1;
switch (class) {
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 =
bfd_h_get_32(abfd, (bfd_byte *) ext->x_file.x_n.x_offset);
} else {
if (numaux > 1)
{
if (indx == 0)
memcpy (in->x_file.x_fname, ext->x_file.x_fname,
numaux * sizeof (AUXENT));
}
else
{
memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
}
}
goto end;
/* RS/6000 "csect" auxents */
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;
case C_STAT:
case C_LEAFSTAT:
case C_HIDDEN:
if (type == T_NULL) {
in->x_scn.x_scnlen = bfd_h_get_32(abfd,
(bfd_byte *) ext->x_scn.x_scnlen);
in->x_scn.x_nreloc = bfd_h_get_16(abfd,
(bfd_byte *) ext->x_scn.x_nreloc);
in->x_scn.x_nlinno = bfd_h_get_16(abfd,
(bfd_byte *) ext->x_scn.x_nlinno);
/* PE defines some extra fields; we zero them out for
safety. */
in->x_scn.x_checksum = 0;
in->x_scn.x_associated = 0;
in->x_scn.x_comdat = 0;
goto end;
}
break;
}
in->x_sym.x_tagndx.l = bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_tagndx);
in->x_sym.x_tvndx = bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_tvndx);
if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
{
in->x_sym.x_fcnary.x_fcn.x_lnnoptr = bfd_h_get_32(abfd, (bfd_byte *)
ext->x_sym.x_fcnary.x_fcn.x_lnnoptr);
in->x_sym.x_fcnary.x_fcn.x_endndx.l = bfd_h_get_32(abfd, (bfd_byte *)
ext->x_sym.x_fcnary.x_fcn.x_endndx);
}
else
{
in->x_sym.x_fcnary.x_ary.x_dimen[0] =
bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
in->x_sym.x_fcnary.x_ary.x_dimen[1] =
bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
in->x_sym.x_fcnary.x_ary.x_dimen[2] =
bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
in->x_sym.x_fcnary.x_ary.x_dimen[3] =
bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
}
if (ISFCN(type)) {
in->x_sym.x_misc.x_fsize = bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_misc.x_fsize);
}
else {
in->x_sym.x_misc.x_lnsz.x_lnno = bfd_h_get_16(abfd, (bfd_byte *)
ext->x_sym.x_misc.x_lnsz.x_lnno);
in->x_sym.x_misc.x_lnsz.x_size = bfd_h_get_16(abfd, (bfd_byte *)
ext->x_sym.x_misc.x_lnsz.x_size);
}
end: ;
/* the semicolon is because MSVC doesn't like labels at
end of block. */
}
unsigned int
_bfd_xcoff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
bfd *abfd;
PTR inp;
int type;
int class;
int indx ATTRIBUTE_UNUSED;
int numaux ATTRIBUTE_UNUSED;
PTR extp;
{
union internal_auxent *in = (union internal_auxent *)inp;
AUXENT *ext = (AUXENT *)extp;
memset((PTR)ext, 0, bfd_coff_auxesz (abfd));
switch (class)
{
case C_FILE:
if (in->x_file.x_fname[0] == 0)
{
PUTWORD(abfd, 0, (bfd_byte *) ext->x_file.x_n.x_zeroes);
PUTWORD(abfd,
in->x_file.x_n.x_offset,
(bfd_byte *) ext->x_file.x_n.x_offset);
}
else
{
memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
}
goto end;
/* 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;
case C_STAT:
case C_LEAFSTAT:
case C_HIDDEN:
if (type == T_NULL) {
bfd_h_put_32(abfd, in->x_scn.x_scnlen, (bfd_byte *) ext->x_scn.x_scnlen);
bfd_h_put_16(abfd, in->x_scn.x_nreloc, (bfd_byte *) ext->x_scn.x_nreloc);
bfd_h_put_16(abfd, in->x_scn.x_nlinno, (bfd_byte *) ext->x_scn.x_nlinno);
goto end;
}
break;
}
PUTWORD(abfd, in->x_sym.x_tagndx.l, (bfd_byte *) ext->x_sym.x_tagndx);
bfd_h_put_16 (abfd, in->x_sym.x_tvndx , (bfd_byte *) ext->x_sym.x_tvndx);
if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
{
bfd_h_put_32(abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr,
(bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr);
PUTWORD(abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l,
(bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx);
}
else
{
bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[0],
(bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[1],
(bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[2],
(bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[3],
(bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
}
if (ISFCN (type))
PUTWORD (abfd, in->x_sym.x_misc.x_fsize,
(bfd_byte *) ext->x_sym.x_misc.x_fsize);
else
{
bfd_h_put_16(abfd, in->x_sym.x_misc.x_lnsz.x_lnno,
(bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_lnno);
bfd_h_put_16(abfd, in->x_sym.x_misc.x_lnsz.x_size,
(bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_size);
}
end:
return bfd_coff_auxesz (abfd);
}
/* The XCOFF reloc table. Actually, XCOFF relocations specify the
bitsize and whether they are signed or not, along with a
conventional type. This table is for the types, which are used for
different algorithms for putting in the reloc. Many of these
relocs need special_function entries, which I have not written. */
static reloc_howto_type xcoff_howto_table[] =
/* In case we're on a 32-bit machine, construct a 64-bit "-1" value
from smaller values. Start with zero, widen, *then* decrement. */
#define MINUS_ONE (((bfd_vma)0) - 1)
reloc_howto_type xcoff_howto_table[] =
{
/* Standard 32 bit relocation. */
HOWTO (0, /* type */
@ -439,7 +699,7 @@ static reloc_howto_type xcoff_howto_table[] =
HOWTO (0x18, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
26, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
@ -454,7 +714,7 @@ static reloc_howto_type xcoff_howto_table[] =
HOWTO (0x19, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
@ -493,7 +753,21 @@ static reloc_howto_type xcoff_howto_table[] =
true, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
false), /* pcrel_offset */
HOWTO (0, /* type */
0, /* rightshift */
4, /* size (0 = byte, 1 = short, 2 = long) */
64, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"R_POS", /* name */
true, /* partial_inplace */
MINUS_ONE, /* src_mask */
MINUS_ONE, /* dst_mask */
false) /* pcrel_offset */
};
/* These are the first two like the above but for 16-bit relocs. */
@ -542,11 +816,11 @@ static reloc_howto_type xcoff_howto_table_16[] =
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
};
false) /* pcrel_offset */
};
static void
xcoff_rtype2howto (relent, internal)
void
_bfd_xcoff_rtype2howto (relent, internal)
arelent *relent;
struct internal_reloc *internal;
{
@ -554,14 +828,17 @@ xcoff_rtype2howto (relent, internal)
if (relent->howto->bitsize != ((unsigned int) internal->r_size & 0x1f) + 1
&& (internal->r_type
< sizeof(xcoff_howto_table_16)/sizeof(xcoff_howto_table_16[0])))
< sizeof (xcoff_howto_table_16)/sizeof (xcoff_howto_table_16[0])))
relent->howto = xcoff_howto_table_16 + internal->r_type;
/* The r_size field of an XCOFF reloc encodes the bitsize of the
relocation, as well as indicating whether it is signed or not.
Doublecheck that the relocation information gathered from the
type matches this information. */
if (relent->howto->bitsize != ((unsigned int) internal->r_size & 0x1f) + 1)
type matches this information. The bitsize is not significant
for R_REF relocs. */
if (relent->howto->dst_mask != 0
&& (relent->howto->bitsize
!= ((unsigned int) internal->r_size & 0x3f) + 1))
abort ();
#if 0
if ((internal->r_size & 0x80) != 0
@ -571,8 +848,8 @@ xcoff_rtype2howto (relent, internal)
#endif
}
static reloc_howto_type *
xcoff_reloc_type_lookup (abfd, code)
reloc_howto_type *
_bfd_xcoff_reloc_type_lookup (abfd, code)
bfd *abfd ATTRIBUTE_UNUSED;
bfd_reloc_code_real_type code;
{
@ -587,34 +864,12 @@ xcoff_reloc_type_lookup (abfd, code)
case BFD_RELOC_32:
case BFD_RELOC_CTOR:
return &xcoff_howto_table[0];
case BFD_RELOC_64:
return &xcoff_howto_table[0x1c];
default:
return NULL;
}
}
#define SELECT_RELOC(internal, howto) \
{ \
internal.r_type = howto->type; \
internal.r_size = \
((howto->complain_on_overflow == complain_overflow_signed \
? 0x80 \
: 0) \
| (howto->bitsize - 1)); \
}
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
#define COFF_LONG_FILENAMES
#define RTYPE2HOWTO(cache_ptr, dst) xcoff_rtype2howto (cache_ptr, dst)
#define coff_mkobject xcoff_mkobject
#define coff_bfd_copy_private_bfd_data xcoff_copy_private_bfd_data
#define coff_bfd_is_local_label_name xcoff_is_local_label_name
#define coff_bfd_reloc_type_lookup xcoff_reloc_type_lookup
#define coff_relocate_section _bfd_ppc_xcoff_relocate_section
#include "coffcode.h"
/* XCOFF archive support. The original version of this code was by
Damon A. Permezel. It was enhanced to permit cross support, and
@ -727,7 +982,6 @@ struct xcoff_ar_file_hdr_big
#define SIZEOF_AR_FILE_HDR_BIG (6 * 20 + SXCOFFARMAG)
/* Each XCOFF archive member starts with this (printable) structure. */
struct xcoff_ar_hdr
@ -804,7 +1058,6 @@ struct xcoff_ar_hdr_big
#define SIZEOF_AR_HDR_BIG (3 * 20 + 4 * 12 + 4)
/* We often have to distinguish between the old and big file format.
Make it a bit cleaner. We can use `xcoff_ardata' here because the
`hdr' member has the same size and position in both formats. */
@ -826,34 +1079,17 @@ struct xcoff_ar_hdr_big
#define arch_xhdr_big(bfd) \
((struct xcoff_ar_hdr_big *) arch_eltdata (bfd)->arch_header)
/* XCOFF archives do not have anything which corresponds to an
extended name table. */
#define xcoff_slurp_extended_name_table bfd_false
#define xcoff_construct_extended_name_table \
((boolean (*) PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \
bfd_false)
#define xcoff_truncate_arname bfd_dont_truncate_arname
/* We can use the standard get_elt_at_index routine. */
#define xcoff_get_elt_at_index _bfd_generic_get_elt_at_index
/* XCOFF archives do not have a timestamp. */
#define xcoff_update_armap_timestamp bfd_true
/* Read in the armap of an XCOFF archive. */
static boolean
xcoff_slurp_armap (abfd)
boolean
_bfd_xcoff_slurp_armap (abfd)
bfd *abfd;
{
file_ptr off;
size_t namlen;
bfd_size_type sz;
bfd_byte *contents, *cend;
unsigned int c, i;
bfd_vma c, i;
carsym *arsym;
bfd_byte *p;
@ -888,6 +1124,33 @@ xcoff_slurp_armap (abfd)
return false;
sz = strtol (hdr.size, (char **) NULL, 10);
/* Read in the entire symbol table. */
contents = (bfd_byte *) bfd_alloc (abfd, sz);
if (contents == NULL)
return false;
if (bfd_read ((PTR) contents, 1, sz, abfd) != sz)
return false;
/* The symbol table starts with a four byte count. */
c = bfd_h_get_32 (abfd, contents);
if (c * 4 >= sz)
{
bfd_set_error (bfd_error_bad_value);
return false;
}
bfd_ardata (abfd)->symdefs = ((carsym *)
bfd_alloc (abfd, c * sizeof (carsym)));
if (bfd_ardata (abfd)->symdefs == NULL)
return false;
/* After the count comes a list of four byte file offsets. */
for (i = 0, arsym = bfd_ardata (abfd)->symdefs, p = contents + 4;
i < c;
++i, ++arsym, p += 4)
arsym->file_offset = bfd_h_get_32 (abfd, p);
}
else
{
@ -918,7 +1181,6 @@ xcoff_slurp_armap (abfd)
machines) since the field width is 20 and there numbers with more
than 32 bits can be represented. */
sz = strtol (hdr.size, (char **) NULL, 10);
}
/* Read in the entire symbol table. */
contents = (bfd_byte *) bfd_alloc (abfd, sz);
@ -927,10 +1189,10 @@ xcoff_slurp_armap (abfd)
if (bfd_read ((PTR) contents, 1, sz, abfd) != sz)
return false;
/* The symbol table starts with a four byte count. */
c = bfd_h_get_32 (abfd, contents);
/* The symbol table starts with an eight byte count. */
c = bfd_h_get_64 (abfd, contents);
if (c * 4 >= sz)
if (c * 8 >= sz)
{
bfd_set_error (bfd_error_bad_value);
return false;
@ -941,11 +1203,12 @@ xcoff_slurp_armap (abfd)
if (bfd_ardata (abfd)->symdefs == NULL)
return false;
/* After the count comes a list of four byte file offsets. */
for (i = 0, arsym = bfd_ardata (abfd)->symdefs, p = contents + 4;
/* After the count comes a list of eight byte file offsets. */
for (i = 0, arsym = bfd_ardata (abfd)->symdefs, p = contents + 8;
i < c;
++i, ++arsym, p += 4)
arsym->file_offset = bfd_h_get_32 (abfd, p);
++i, ++arsym, p += 8)
arsym->file_offset = bfd_h_get_64 (abfd, p);
}
/* After the file offsets come null terminated symbol names. */
cend = contents + sz;
@ -969,8 +1232,8 @@ xcoff_slurp_armap (abfd)
/* See if this is an XCOFF archive. */
static const bfd_target *
xcoff_archive_p (abfd)
const bfd_target *
_bfd_xcoff_archive_p (abfd)
bfd *abfd;
{
char magic[SXCOFFARMAG];
@ -1060,7 +1323,7 @@ xcoff_archive_p (abfd)
memcpy (bfd_ardata (abfd)->tdata, &hdr, SIZEOF_AR_FILE_HDR_BIG);
}
if (! xcoff_slurp_armap (abfd))
if (! _bfd_xcoff_slurp_armap (abfd))
{
bfd_release (abfd, bfd_ardata (abfd));
abfd->tdata.aout_ar_data = (struct artdata *) NULL;
@ -1072,8 +1335,8 @@ xcoff_archive_p (abfd)
/* Read the archive header in an XCOFF archive. */
static PTR
xcoff_read_ar_hdr (abfd)
PTR
_bfd_xcoff_read_ar_hdr (abfd)
bfd *abfd;
{
size_t namlen;
@ -1160,8 +1423,8 @@ xcoff_read_ar_hdr (abfd)
/* Open the next element in an XCOFF archive. */
static bfd *
xcoff_openr_next_archived_file (archive, last_file)
bfd *
_bfd_xcoff_openr_next_archived_file (archive, last_file)
bfd *archive;
bfd *last_file;
{
@ -1221,8 +1484,8 @@ xcoff_openr_next_archived_file (archive, last_file)
/* Stat an element in an XCOFF archive. */
static int
xcoff_generic_stat_arch_elt (abfd, s)
int
_bfd_xcoff_generic_stat_arch_elt (abfd, s)
bfd *abfd;
struct stat *s;
{
@ -1276,7 +1539,6 @@ normalize_filename (abfd)
/* Write out an XCOFF armap. */
/*ARGSUSED*/
static boolean
xcoff_write_armap_old (abfd, elength, map, orl_count, stridx)
bfd *abfd;
@ -1362,29 +1624,39 @@ xcoff_write_armap_old (abfd, elength, map, orl_count, stridx)
return true;
}
/*ARGSUSED*/
/* Write a single armap in the big format. */
static boolean
xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
xcoff_write_one_armap_big (abfd, map, orl_count, orl_ccount, stridx, bits64,
prevoff, nextoff)
bfd *abfd;
unsigned int elength ATTRIBUTE_UNUSED;
struct orl *map;
unsigned int orl_count;
int stridx;
unsigned int orl_ccount;
unsigned int stridx;
int bits64;
const char *prevoff;
char *nextoff;
{
struct xcoff_ar_hdr_big hdr;
char *p;
unsigned char buf[4];
const bfd_arch_info_type *arch_info = NULL;
bfd *sub;
file_ptr fileoff;
bfd *object_bfd;
unsigned int i;
memset (&hdr, 0, sizeof hdr);
/* XXX This call actually should use %lld (at least on 32-bit
machines) since the fields's width is 20 and there numbers with
more than 32 bits can be represented. */
sprintf (hdr.size, "%ld", (long) (4 + orl_count * 4 + stridx));
sprintf (hdr.size, "%ld", (long) (4 + orl_ccount * 4 + stridx));
if (bits64)
sprintf (hdr.nextoff, "%d", 0);
memcpy (hdr.prevoff, xcoff_ardata (abfd)->memoff, 12);
else
sprintf (hdr.nextoff, "%ld", (strtol (prevoff, (char **) NULL, 10)
+ 4 + orl_ccount * 4 + stridx));
memcpy (hdr.prevoff, prevoff, sizeof (hdr.prevoff));
sprintf (hdr.date, "%d", 0);
sprintf (hdr.uid, "%d", 0);
sprintf (hdr.gid, "%d", 0);
@ -1396,11 +1668,13 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
if (*p == '\0')
*p = ' ';
memcpy (nextoff, hdr.nextoff, sizeof (hdr.nextoff));
if (bfd_write ((PTR) &hdr, SIZEOF_AR_HDR_BIG, 1, abfd) != SIZEOF_AR_HDR_BIG
|| bfd_write (XCOFFARFMAG, 1, SXCOFFARFMAG, abfd) != SXCOFFARFMAG)
return false;
bfd_h_put_32 (abfd, orl_count, buf);
bfd_h_put_32 (abfd, orl_ccount, buf);
if (bfd_write (buf, 1, 4, abfd) != 4)
return false;
@ -1411,13 +1685,18 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
{
size_t namlen;
if ((bfd_arch_bits_per_address ((bfd *) map[i].pos) == 64) == bits64)
while (((bfd *) (map[i]).pos) == sub)
{
bfd_h_put_32 (abfd, fileoff, buf);
if (bfd_write (buf, 1, 4, abfd) != 4)
return false;
++i;
i++;
}
else
while (((bfd *) (map[i]).pos) == sub)
i++;
namlen = strlen (normalize_filename (sub));
namlen = (namlen + 1) &~ 1;
fileoff += (SIZEOF_AR_HDR_BIG
@ -1428,10 +1707,18 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
sub = sub->next;
}
object_bfd = NULL;
for (i = 0; i < orl_count; i++)
{
const char *name;
size_t namlen;
bfd *ob = (bfd *)map[i].pos;
if (ob != object_bfd)
arch_info = bfd_get_arch_info (ob);
if (arch_info && (arch_info->bits_per_address == 64) != bits64)
continue;
name = *map[i].name;
namlen = strlen (name);
@ -1451,9 +1738,67 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
return true;
}
/*ARGSUSED*/
static boolean
xcoff_write_armap (abfd, elength, map, orl_count, stridx)
xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
bfd *abfd;
unsigned int elength ATTRIBUTE_UNUSED;
struct orl *map;
unsigned int orl_count;
int stridx;
{
unsigned int i;
unsigned int orl_count_32, orl_count_64;
unsigned int stridx_32, stridx_64;
const bfd_arch_info_type *arch_info = NULL;
bfd *object_bfd;
/* First, we look through the symbols and work out which are
from 32-bit objects and which from 64-bit ones. */
orl_count_32 = 0;
orl_count_64 = 0;
stridx_32 = 0;
stridx_64 = 0;
object_bfd = NULL;
for (i = 0; i < orl_count; i++)
{
bfd *ob = (bfd *)map[i].pos;
unsigned int len;
if (ob != object_bfd)
arch_info = bfd_get_arch_info (ob);
len = strlen (*map[i].name) + 1;
if (arch_info && arch_info->bits_per_address == 64)
{
orl_count_64++;
stridx_64 += len;
}
else
{
orl_count_32++;
stridx_32 += len;
}
object_bfd = ob;
}
/* A quick sanity check... */
BFD_ASSERT (orl_count_64 + orl_count_32 == orl_count);
BFD_ASSERT (stridx_64 + stridx_32 == stridx);
/* Now write out each map. */
if (! xcoff_write_one_armap_big (abfd, map, orl_count, orl_count_32,
stridx_32, false,
xcoff_ardata_big (abfd)->memoff,
xcoff_ardata_big (abfd)->symoff))
return false;
if (! xcoff_write_one_armap_big (abfd, map, orl_count, orl_count_64,
stridx_64, true,
xcoff_ardata_big (abfd)->symoff,
xcoff_ardata_big (abfd)->symoff64))
return false;
return true;
}
boolean
_bfd_xcoff_write_armap (abfd, elength, map, orl_count, stridx)
bfd *abfd;
unsigned int elength ATTRIBUTE_UNUSED;
struct orl *map;
@ -1962,7 +2307,6 @@ xcoff_write_archive_contents_big (abfd)
/* XXX This call actually should use %lld (at least on 32-bit
machines) since the fields's width is 20 and there numbers with
more than 32 bits can be represented. */
sprintf (fhdr.symoff, "%ld", (long) nextoff);
bfd_ardata (abfd)->tdata = (PTR) &fhdr;
if (! _bfd_compute_and_write_armap (abfd, 0))
return false;
@ -1983,8 +2327,8 @@ xcoff_write_archive_contents_big (abfd)
return true;
}
static boolean
xcoff_write_archive_contents (abfd)
boolean
_bfd_xcoff_write_archive_contents (abfd)
bfd *abfd;
{
if (! xcoff_big_format_p (abfd))
@ -1996,8 +2340,7 @@ xcoff_write_archive_contents (abfd)
/* We can't use the usual coff_sizeof_headers routine, because AIX
always uses an a.out header. */
/*ARGSUSED*/
static int
int
_bfd_xcoff_sizeof_headers (abfd, reloc)
bfd *abfd;
boolean reloc ATTRIBUTE_UNUSED;
@ -2012,116 +2355,3 @@ _bfd_xcoff_sizeof_headers (abfd, reloc)
size += abfd->section_count * SCNHSZ;
return size;
}
#define CORE_FILE_P _bfd_dummy_target
#define coff_core_file_failing_command _bfd_nocore_core_file_failing_command
#define coff_core_file_failing_signal _bfd_nocore_core_file_failing_signal
#define coff_core_file_matches_executable_p \
_bfd_nocore_core_file_matches_executable_p
#ifdef AIX_CORE
#undef CORE_FILE_P
#define CORE_FILE_P rs6000coff_core_p
extern const bfd_target * rs6000coff_core_p ();
extern boolean rs6000coff_get_section_contents ();
extern boolean rs6000coff_core_file_matches_executable_p ();
#undef coff_core_file_matches_executable_p
#define coff_core_file_matches_executable_p \
rs6000coff_core_file_matches_executable_p
extern char *rs6000coff_core_file_failing_command PARAMS ((bfd *abfd));
#undef coff_core_file_failing_command
#define coff_core_file_failing_command rs6000coff_core_file_failing_command
extern int rs6000coff_core_file_failing_signal PARAMS ((bfd *abfd));
#undef coff_core_file_failing_signal
#define coff_core_file_failing_signal rs6000coff_core_file_failing_signal
#undef coff_get_section_contents
#define coff_get_section_contents rs6000coff_get_section_contents
#endif /* AIX_CORE */
#ifdef LYNX_CORE
#undef CORE_FILE_P
#define CORE_FILE_P lynx_core_file_p
extern const bfd_target *lynx_core_file_p PARAMS ((bfd *abfd));
extern boolean lynx_core_file_matches_executable_p PARAMS ((bfd *core_bfd,
bfd *exec_bfd));
#undef coff_core_file_matches_executable_p
#define coff_core_file_matches_executable_p lynx_core_file_matches_executable_p
extern char *lynx_core_file_failing_command PARAMS ((bfd *abfd));
#undef coff_core_file_failing_command
#define coff_core_file_failing_command lynx_core_file_failing_command
extern int lynx_core_file_failing_signal PARAMS ((bfd *abfd));
#undef coff_core_file_failing_signal
#define coff_core_file_failing_signal lynx_core_file_failing_signal
#endif /* LYNX_CORE */
#define _bfd_xcoff_bfd_get_relocated_section_contents \
coff_bfd_get_relocated_section_contents
#define _bfd_xcoff_bfd_relax_section coff_bfd_relax_section
#define _bfd_xcoff_bfd_gc_sections coff_bfd_gc_sections
#define _bfd_xcoff_bfd_link_split_section coff_bfd_link_split_section
/* The transfer vector that leads the outside world to all of the above. */
const bfd_target
#ifdef TARGET_SYM
TARGET_SYM =
#else
rs6000coff_vec =
#endif
{
#ifdef TARGET_NAME
TARGET_NAME,
#else
"aixcoff-rs6000", /* name */
#endif
bfd_target_coff_flavour,
BFD_ENDIAN_BIG, /* data byte order is big */
BFD_ENDIAN_BIG, /* header byte order is big */
(HAS_RELOC | EXEC_P | /* object flags */
HAS_LINENO | HAS_DEBUG | DYNAMIC |
HAS_SYMS | HAS_LOCALS | WP_TEXT),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
0, /* leading char */
'/', /* ar_pad_char */
15, /* ar_max_namelen??? FIXMEmgo */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
xcoff_archive_p, CORE_FILE_P},
{bfd_false, coff_mkobject, /* bfd_set_format */
_bfd_generic_mkarchive, bfd_false},
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
xcoff_write_archive_contents, bfd_false},
BFD_JUMP_TABLE_GENERIC (coff),
BFD_JUMP_TABLE_COPY (coff),
BFD_JUMP_TABLE_CORE (coff),
BFD_JUMP_TABLE_ARCHIVE (xcoff),
BFD_JUMP_TABLE_SYMBOLS (coff),
BFD_JUMP_TABLE_RELOCS (coff),
BFD_JUMP_TABLE_WRITE (coff),
BFD_JUMP_TABLE_LINK (_bfd_xcoff),
BFD_JUMP_TABLE_DYNAMIC (_bfd_xcoff),
NULL,
COFF_SWAP_TABLE
};

View File

@ -3198,6 +3198,16 @@ static const bfd_coff_backend_data bfd_coff_small_swap_table =
false,
#endif
2,
#ifdef COFF_FORCE_SYMBOLS_IN_STRINGS
true,
#else
false,
#endif
#ifdef COFF_DEBUG_STRING_WIDE_PREFIX
4,
#else
2,
#endif
coff_swap_filehdr_in, coff_swap_aouthdr_in, coff_swap_scnhdr_in,
coff_swap_reloc_in, coff_bad_format_hook, coff_set_arch_mach_hook,
coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook,

View File

@ -1,5 +1,5 @@
/* BFD back-end for Intel 386 COFF files (go32 variant with a stub).
Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
/* BFD back-end for Intel 386 COFF files (DJGPP variant with a stub).
Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Written by Robert Hoehne.
This file is part of BFD, the Binary File Descriptor library.
@ -41,13 +41,12 @@
#define COFF_GO32_EXE
#define COFF_LONG_SECTION_NAMES
#define COFF_SUPPORT_GNU_LINKONCE
#define COFF_LONG_FILENAMES
#define COFF_SECTION_ALIGNMENT_ENTRIES \
{ COFF_SECTION_NAME_EXACT_MATCH (".data"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
{ COFF_SECTION_NAME_EXACT_MATCH (".text"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
{ COFF_SECTION_NAME_EXACT_MATCH (".bss"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }
#include "bfd.h"
@ -111,7 +110,7 @@ static boolean
/* This macro is used, because I cannot assume the endianess of the
host system */
#define _H(index) (bfd_h_get_16(abfd, (bfd_byte *)(header+index*2)))
#define _H(index) (bfd_h_get_16(abfd, (bfd_byte *) (header+index*2)))
/* These bytes are a 2048-byte DOS executable, which loads the COFF
image into memory and then runs it. It is called 'stub' */

View File

@ -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__
@ -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)

760
gnu/dist/toolchain/bfd/coff-tic54x.c vendored Normal file
View File

@ -0,0 +1,760 @@
/* BFD back-end for TMS320C54X coff binaries.
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
Contributed by Timothy Wall (twall@cygnus.com)
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
#include "bfdlink.h"
#include "coff/tic54x.h"
#include "coff/internal.h"
#include "libcoff.h"
#undef F_LSYMS
#define F_LSYMS F_LSYMS_TICOFF
/*
32-bit operations
The octet order is screwy. words are LSB first (LS octet, actually), but
longwords are MSW first. For example, 0x12345678 is encoded 0x5678 in the
first word and 0x1234 in the second. When looking at the data as stored in
the COFF file, you would see the octets ordered as 0x78, 0x56, 0x34, 0x12.
Don't bother with 64-bits, as there aren't any.
*/
static bfd_vma
tic54x_getl32(addr)
register const bfd_byte *addr;
{
unsigned long v;
v = (unsigned long) addr[2];
v |= (unsigned long) addr[3] << 8;
v |= (unsigned long) addr[0] << 16;
v |= (unsigned long) addr[1] << 24;
return (bfd_vma) v;
}
static void
tic54x_putl32 (data, addr)
bfd_vma data;
register bfd_byte *addr;
{
addr[2] = (bfd_byte)data;
addr[3] = (bfd_byte) (data >> 8);
addr[0] = (bfd_byte) (data >> 16);
addr[1] = (bfd_byte) (data >> 24);
}
bfd_signed_vma
tic54x_getl_signed_32 (addr)
register const bfd_byte *addr;
{
unsigned long v;
v = (unsigned long) addr[2];
v |= (unsigned long) addr[3] << 8;
v |= (unsigned long) addr[0] << 16;
v |= (unsigned long) addr[1] << 24;
#define COERCE32(x) \
((bfd_signed_vma) (long) (((unsigned long) (x) ^ 0x80000000) - 0x80000000))
return COERCE32 (v);
}
#define coff_get_section_load_page bfd_ticoff_get_section_load_page
#define coff_set_section_load_page bfd_ticoff_set_section_load_page
void
bfd_ticoff_set_section_load_page (sect, page)
asection *sect;
int page;
{
sect->lma = (sect->lma & ADDR_MASK) | PG_TO_FLAG(page);
}
int
bfd_ticoff_get_section_load_page (sect)
asection *sect;
{
int page;
/* Provide meaningful defaults for predefined sections. */
if (sect == &bfd_com_section)
page = PG_DATA;
else if (sect == &bfd_und_section
|| sect == &bfd_abs_section
|| sect == &bfd_ind_section)
page = PG_PROG;
else
page = FLAG_TO_PG (sect->lma);
return page;
}
/* Set the architecture appropriately. Allow unkown architectures
(e.g. binary). */
static boolean
tic54x_set_arch_mach (abfd, arch, machine)
bfd *abfd;
enum bfd_architecture arch;
unsigned long machine;
{
if (arch == bfd_arch_unknown)
arch = bfd_arch_tic54x;
else if (arch != bfd_arch_tic54x)
return false;
return bfd_default_set_arch_mach (abfd, arch, machine);
}
static bfd_reloc_status_type
tic54x_relocation (abfd, reloc_entry, symbol, data, input_section,
output_bfd, error_message)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *reloc_entry;
asymbol *symbol ATTRIBUTE_UNUSED;
PTR data ATTRIBUTE_UNUSED;
asection *input_section;
bfd *output_bfd;
char **error_message ATTRIBUTE_UNUSED;
{
if (output_bfd != (bfd *) NULL)
{
/* This is a partial relocation, and we want to apply the
relocation to the reloc entry rather than the raw data.
Modify the reloc inplace to reflect what we now know. */
reloc_entry->address += input_section->output_offset;
return bfd_reloc_ok;
}
return bfd_reloc_continue;
}
reloc_howto_type tic54x_howto_table[] =
{
/* type,rightshift,size (0=byte, 1=short, 2=long),
bit size, pc_relative, bitpos, dont complain_on_overflow,
special_function, name, partial_inplace, src_mask, dst_mask, pcrel_offset */
/* NORMAL BANK */
/* 16-bit direct reference to symbol's address */
HOWTO (R_RELWORD,0,1,16,false,0,complain_overflow_dont,
tic54x_relocation,"REL16",false,0xFFFF,0xFFFF,false),
/* 7 LSBs of an address */
HOWTO (R_PARTLS7,0,1,7,false,0,complain_overflow_dont,
tic54x_relocation,"LS7",false,0x007F,0x007F,false),
/* 9 MSBs of an address */
/* TI assembler doesn't shift its encoding, and is thus incompatible */
HOWTO (R_PARTMS9,7,1,9,false,0,complain_overflow_dont,
tic54x_relocation,"MS9",false,0x01FF,0x01FF,false),
/* 23-bit relocation */
HOWTO (R_EXTWORD,0,2,23,false,0,complain_overflow_dont,
tic54x_relocation,"RELEXT",false,0x7FFFFF,0x7FFFFF,false),
/* 16 bits of 23-bit extended address */
HOWTO (R_EXTWORD16,0,1,16,false,0,complain_overflow_dont,
tic54x_relocation,"RELEXT16",false,0x7FFFFF,0x7FFFFF,false),
/* upper 7 bits of 23-bit extended address */
HOWTO (R_EXTWORDMS7,16,1,7,false,0,complain_overflow_dont,
tic54x_relocation,"RELEXTMS7",false,0x7F,0x7F,false),
/* ABSOLUTE BANK */
/* 16-bit direct reference to symbol's address, absolute */
HOWTO (R_RELWORD,0,1,16,false,0,complain_overflow_dont,
tic54x_relocation,"AREL16",false,0xFFFF,0xFFFF,false),
/* 7 LSBs of an address, absolute */
HOWTO (R_PARTLS7,0,1,7,false,0,complain_overflow_dont,
tic54x_relocation,"ALS7",false,0x007F,0x007F,false),
/* 9 MSBs of an address, absolute */
/* TI assembler doesn't shift its encoding, and is thus incompatible */
HOWTO (R_PARTMS9,7,1,9,false,0,complain_overflow_dont,
tic54x_relocation,"AMS9",false,0x01FF,0x01FF,false),
/* 23-bit direct reference, absolute */
HOWTO (R_EXTWORD,0,2,23,false,0,complain_overflow_dont,
tic54x_relocation,"ARELEXT",false,0x7FFFFF,0x7FFFFF,false),
/* 16 bits of 23-bit extended address, absolute */
HOWTO (R_EXTWORD16,0,1,16,false,0,complain_overflow_dont,
tic54x_relocation,"ARELEXT16",false,0x7FFFFF,0x7FFFFF,false),
/* upper 7 bits of 23-bit extended address, absolute */
HOWTO (R_EXTWORDMS7,16,1,7,false,0,complain_overflow_dont,
tic54x_relocation,"ARELEXTMS7",false,0x7F,0x7F,false),
/* 32-bit relocation exclusively for stabs */
HOWTO (R_RELLONG,0,2,32,false,0,complain_overflow_dont,
tic54x_relocation,"STAB",false,0xFFFFFFFF,0xFFFFFFFF,false),
};
#define coff_bfd_reloc_type_lookup tic54x_coff_reloc_type_lookup
/* For the case statement use the code values used tc_gen_reloc (defined in
bfd/reloc.c) to map to the howto table entries */
reloc_howto_type *
tic54x_coff_reloc_type_lookup (abfd, code)
bfd *abfd ATTRIBUTE_UNUSED;
bfd_reloc_code_real_type code;
{
switch (code)
{
case BFD_RELOC_16:
return &tic54x_howto_table[0];
case BFD_RELOC_TIC54X_PARTLS7:
return &tic54x_howto_table[1];
case BFD_RELOC_TIC54X_PARTMS9:
return &tic54x_howto_table[2];
case BFD_RELOC_TIC54X_23:
return &tic54x_howto_table[3];
case BFD_RELOC_TIC54X_16_OF_23:
return &tic54x_howto_table[4];
case BFD_RELOC_TIC54X_MS7_OF_23:
return &tic54x_howto_table[5];
case BFD_RELOC_32:
return &tic54x_howto_table[12];
default:
return (reloc_howto_type *) NULL;
}
}
/* Code to turn a r_type into a howto ptr, uses the above howto table.
Called after some initial checking by the tic54x_rtype_to_howto fn below */
static void
tic54x_lookup_howto (internal, dst)
arelent *internal;
struct internal_reloc *dst;
{
unsigned i;
int bank = (dst->r_symndx == -1) ? HOWTO_BANK : 0;
for (i = 0; i < sizeof tic54x_howto_table/sizeof tic54x_howto_table[0]; i++)
{
if (tic54x_howto_table[i].type == dst->r_type)
{
internal->howto = tic54x_howto_table + i + bank;
return;
}
}
(*_bfd_error_handler) (_("Unrecognized reloc type 0x%x"),
(unsigned int) dst->r_type);
abort ();
}
#define RELOC_PROCESSING(RELENT,RELOC,SYMS,ABFD,SECT)\
tic54x_reloc_processing(RELENT,RELOC,SYMS,ABFD,SECT)
static void tic54x_reloc_processing();
#define coff_rtype_to_howto coff_tic54x_rtype_to_howto
static reloc_howto_type *
coff_tic54x_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
bfd *abfd ATTRIBUTE_UNUSED;
asection *sec;
struct internal_reloc *rel;
struct coff_link_hash_entry *h ATTRIBUTE_UNUSED;
struct internal_syment *sym ATTRIBUTE_UNUSED;
bfd_vma *addendp;
{
arelent genrel;
if (rel->r_symndx == -1 && addendp != NULL)
{
/* This is a TI "internal relocation", which means that the relocation
amount is the amount by which the current section is being relocated
in the output section. */
*addendp = (sec->output_section->vma + sec->output_offset) - sec->vma;
}
tic54x_lookup_howto (&genrel, rel);
return genrel.howto;
}
static boolean
ticoff0_bad_format_hook (abfd, filehdr)
bfd * abfd ATTRIBUTE_UNUSED;
PTR filehdr;
{
struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
if (COFF0_BADMAG (*internal_f))
return false;
return true;
}
static boolean
ticoff1_bad_format_hook (abfd, filehdr)
bfd * abfd ATTRIBUTE_UNUSED;
PTR filehdr;
{
struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
if (COFF1_BADMAG (*internal_f))
return false;
return true;
}
/* replace the stock _bfd_coff_is_local_label_name to recognize TI COFF local
labels */
static boolean
ticoff_bfd_is_local_label_name (abfd, name)
bfd *abfd ATTRIBUTE_UNUSED;
const char *name;
{
if (TICOFF_LOCAL_LABEL_P(name))
return true;
return false;
}
#define coff_bfd_is_local_label_name ticoff_bfd_is_local_label_name
/* Customize coffcode.h; the default coff_ functions are set up to use COFF2;
coff_bad_format_hook uses BADMAG, so set that for COFF2. The COFF1
and COFF0 vectors use custom _bad_format_hook procs instead of setting
BADMAG.
*/
#define BADMAG(x) COFF2_BADMAG(x)
#include "coffcode.h"
static boolean
tic54x_set_section_contents (abfd, section, location, offset, bytes_to_do)
bfd *abfd;
sec_ptr section;
PTR location;
file_ptr offset;
bfd_size_type bytes_to_do;
{
return coff_set_section_contents (abfd, section, location,
offset, bytes_to_do);
}
static void
tic54x_reloc_processing (relent, reloc, symbols, abfd, section)
arelent *relent;
struct internal_reloc *reloc;
asymbol **symbols;
bfd *abfd;
asection *section;
{
asymbol *ptr;
relent->address = reloc->r_vaddr;
if (reloc->r_symndx != -1)
{
if (reloc->r_symndx < 0 || reloc->r_symndx >= obj_conv_table_size (abfd))
{
(*_bfd_error_handler)
(_("%s: warning: illegal symbol index %ld in relocs"),
bfd_get_filename (abfd), reloc->r_symndx);
relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
ptr = NULL;
}
else
{
relent->sym_ptr_ptr = (symbols
+ obj_convert (abfd)[reloc->r_symndx]);
ptr = *(relent->sym_ptr_ptr);
}
}
else
{
relent->sym_ptr_ptr = section->symbol_ptr_ptr;
ptr = *(relent->sym_ptr_ptr);
}
/* The symbols definitions that we have read in have been
relocated as if their sections started at 0. But the offsets
refering to the symbols in the raw data have not been
modified, so we have to have a negative addend to compensate.
Note that symbols which used to be common must be left alone */
/* Calculate any reloc addend by looking at the symbol */
CALC_ADDEND (abfd, ptr, *reloc, relent);
relent->address -= section->vma;
/* !! relent->section = (asection *) NULL;*/
/* Fill in the relent->howto field from reloc->r_type */
tic54x_lookup_howto (relent, reloc);
}
/* COFF0 differs in file/section header size and relocation entry size */
static CONST bfd_coff_backend_data ticoff0_swap_table =
{
coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in,
coff_SWAP_aux_out, coff_SWAP_sym_out,
coff_SWAP_lineno_out, coff_SWAP_reloc_out,
coff_SWAP_filehdr_out, coff_SWAP_aouthdr_out,
coff_SWAP_scnhdr_out,
FILHSZ_V0, AOUTSZ, SCNHSZ_V01, SYMESZ, AUXESZ, RELSZ_V0, LINESZ, FILNMLEN,
#ifdef COFF_LONG_FILENAMES
true,
#else
false,
#endif
#ifdef COFF_LONG_SECTION_NAMES
true,
#else
false,
#endif
#ifdef COFF_FORCE_SYMBOLS_IN_STRINGS
true,
#else
false,
#endif
#ifdef COFF_DEBUG_STRING_WIDE_PREFIX
4,
#else
2,
#endif
COFF_DEFAULT_SECTION_ALIGNMENT_POWER,
coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in,
coff_SWAP_reloc_in, ticoff0_bad_format_hook, coff_set_arch_mach_hook,
coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook,
coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook,
coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate,
coff_classify_symbol, coff_compute_section_file_positions,
coff_start_final_link, coff_relocate_section, coff_rtype_to_howto,
coff_adjust_symndx, coff_link_add_one_symbol,
coff_link_output_has_begun, coff_final_link_postscript
};
/* COFF1 differs in section header size */
static CONST bfd_coff_backend_data ticoff1_swap_table =
{
coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in,
coff_SWAP_aux_out, coff_SWAP_sym_out,
coff_SWAP_lineno_out, coff_SWAP_reloc_out,
coff_SWAP_filehdr_out, coff_SWAP_aouthdr_out,
coff_SWAP_scnhdr_out,
FILHSZ, AOUTSZ, SCNHSZ_V01, SYMESZ, AUXESZ, RELSZ, LINESZ, FILNMLEN,
#ifdef COFF_LONG_FILENAMES
true,
#else
false,
#endif
#ifdef COFF_LONG_SECTION_NAMES
true,
#else
false,
#endif
COFF_DEFAULT_SECTION_ALIGNMENT_POWER,
#ifdef COFF_FORCE_SYMBOLS_IN_STRINGS
true,
#else
false,
#endif
#ifdef COFF_DEBUG_STRING_WIDE_PREFIX
4,
#else
2,
#endif
coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in,
coff_SWAP_reloc_in, ticoff1_bad_format_hook, coff_set_arch_mach_hook,
coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook,
coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook,
coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate,
coff_classify_symbol, coff_compute_section_file_positions,
coff_start_final_link, coff_relocate_section, coff_rtype_to_howto,
coff_adjust_symndx, coff_link_add_one_symbol,
coff_link_output_has_begun, coff_final_link_postscript
};
/* TI COFF v0, DOS tools (little-endian headers) */
const bfd_target tic54x_coff0_vec =
{
"coff0-c54x", /* name */
bfd_target_coff_flavour,
BFD_ENDIAN_LITTLE, /* data byte order is little */
BFD_ENDIAN_LITTLE, /* header byte order is little (DOS tools) */
(HAS_RELOC | EXEC_P | /* object flags */
HAS_LINENO | HAS_DEBUG |
HAS_SYMS | HAS_LOCALS | WP_TEXT ),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
'_', /* leading symbol underscore */
'/', /* ar_pad_char */
15, /* ar_max_namelen */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
bfd_generic_archive_p, _bfd_dummy_target},
{bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
bfd_false},
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
_bfd_write_archive_contents, bfd_false},
BFD_JUMP_TABLE_GENERIC (coff),
BFD_JUMP_TABLE_COPY (coff),
BFD_JUMP_TABLE_CORE (_bfd_nocore),
BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
BFD_JUMP_TABLE_SYMBOLS (coff),
BFD_JUMP_TABLE_RELOCS (coff),
BFD_JUMP_TABLE_WRITE (tic54x),
BFD_JUMP_TABLE_LINK (coff),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
(PTR)&ticoff0_swap_table
};
/* TI COFF v0, SPARC tools (big-endian headers) */
const bfd_target tic54x_coff0_beh_vec =
{
"coff0-beh-c54x", /* name */
bfd_target_coff_flavour,
BFD_ENDIAN_LITTLE, /* data byte order is little */
BFD_ENDIAN_BIG, /* header byte order is big */
(HAS_RELOC | EXEC_P | /* object flags */
HAS_LINENO | HAS_DEBUG |
HAS_SYMS | HAS_LOCALS | WP_TEXT ),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
'_', /* leading symbol underscore */
'/', /* ar_pad_char */
15, /* ar_max_namelen */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
bfd_generic_archive_p, _bfd_dummy_target},
{bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
bfd_false},
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
_bfd_write_archive_contents, bfd_false},
BFD_JUMP_TABLE_GENERIC (coff),
BFD_JUMP_TABLE_COPY (coff),
BFD_JUMP_TABLE_CORE (_bfd_nocore),
BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
BFD_JUMP_TABLE_SYMBOLS (coff),
BFD_JUMP_TABLE_RELOCS (coff),
BFD_JUMP_TABLE_WRITE (tic54x),
BFD_JUMP_TABLE_LINK (coff),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
&tic54x_coff0_vec,
(PTR)&ticoff0_swap_table
};
/* TI COFF v1, DOS tools (little-endian headers) */
const bfd_target tic54x_coff1_vec =
{
"coff1-c54x", /* name */
bfd_target_coff_flavour,
BFD_ENDIAN_LITTLE, /* data byte order is little */
BFD_ENDIAN_LITTLE, /* header byte order is little (DOS tools) */
(HAS_RELOC | EXEC_P | /* object flags */
HAS_LINENO | HAS_DEBUG |
HAS_SYMS | HAS_LOCALS | WP_TEXT ),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
'_', /* leading symbol underscore */
'/', /* ar_pad_char */
15, /* ar_max_namelen */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
bfd_generic_archive_p, _bfd_dummy_target},
{bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
bfd_false},
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
_bfd_write_archive_contents, bfd_false},
BFD_JUMP_TABLE_GENERIC (coff),
BFD_JUMP_TABLE_COPY (coff),
BFD_JUMP_TABLE_CORE (_bfd_nocore),
BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
BFD_JUMP_TABLE_SYMBOLS (coff),
BFD_JUMP_TABLE_RELOCS (coff),
BFD_JUMP_TABLE_WRITE (tic54x),
BFD_JUMP_TABLE_LINK (coff),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
&tic54x_coff0_beh_vec,
(PTR)&ticoff1_swap_table
};
/* TI COFF v1, SPARC tools (big-endian headers) */
const bfd_target tic54x_coff1_beh_vec =
{
"coff1-beh-c54x", /* name */
bfd_target_coff_flavour,
BFD_ENDIAN_LITTLE, /* data byte order is little */
BFD_ENDIAN_BIG, /* header byte order is big */
(HAS_RELOC | EXEC_P | /* object flags */
HAS_LINENO | HAS_DEBUG |
HAS_SYMS | HAS_LOCALS | WP_TEXT ),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
'_', /* leading symbol underscore */
'/', /* ar_pad_char */
15, /* ar_max_namelen */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
bfd_generic_archive_p, _bfd_dummy_target},
{bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
bfd_false},
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
_bfd_write_archive_contents, bfd_false},
BFD_JUMP_TABLE_GENERIC (coff),
BFD_JUMP_TABLE_COPY (coff),
BFD_JUMP_TABLE_CORE (_bfd_nocore),
BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
BFD_JUMP_TABLE_SYMBOLS (coff),
BFD_JUMP_TABLE_RELOCS (coff),
BFD_JUMP_TABLE_WRITE (tic54x),
BFD_JUMP_TABLE_LINK (coff),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
&tic54x_coff1_vec,
(PTR)&ticoff1_swap_table
};
/* TI COFF v2, TI DOS tools output (little-endian headers) */
const bfd_target tic54x_coff2_vec =
{
"coff2-c54x", /* name */
bfd_target_coff_flavour,
BFD_ENDIAN_LITTLE, /* data byte order is little */
BFD_ENDIAN_LITTLE, /* header byte order is little (DOS tools) */
(HAS_RELOC | EXEC_P | /* object flags */
HAS_LINENO | HAS_DEBUG |
HAS_SYMS | HAS_LOCALS | WP_TEXT ),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
'_', /* leading symbol underscore */
'/', /* ar_pad_char */
15, /* ar_max_namelen */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
bfd_generic_archive_p, _bfd_dummy_target},
{bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
bfd_false},
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
_bfd_write_archive_contents, bfd_false},
BFD_JUMP_TABLE_GENERIC (coff),
BFD_JUMP_TABLE_COPY (coff),
BFD_JUMP_TABLE_CORE (_bfd_nocore),
BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
BFD_JUMP_TABLE_SYMBOLS (coff),
BFD_JUMP_TABLE_RELOCS (coff),
BFD_JUMP_TABLE_WRITE (tic54x),
BFD_JUMP_TABLE_LINK (coff),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
&tic54x_coff1_beh_vec,
COFF_SWAP_TABLE
};
/* TI COFF v2, TI SPARC tools output (big-endian headers) */
const bfd_target tic54x_coff2_beh_vec =
{
"coff2-beh-c54x", /* name */
bfd_target_coff_flavour,
BFD_ENDIAN_LITTLE, /* data byte order is little */
BFD_ENDIAN_BIG, /* header byte order is big */
(HAS_RELOC | EXEC_P | /* object flags */
HAS_LINENO | HAS_DEBUG |
HAS_SYMS | HAS_LOCALS | WP_TEXT ),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
'_', /* leading symbol underscore */
'/', /* ar_pad_char */
15, /* ar_max_namelen */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
bfd_generic_archive_p, _bfd_dummy_target},
{bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
bfd_false},
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
_bfd_write_archive_contents, bfd_false},
BFD_JUMP_TABLE_GENERIC (coff),
BFD_JUMP_TABLE_COPY (coff),
BFD_JUMP_TABLE_CORE (_bfd_nocore),
BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
BFD_JUMP_TABLE_SYMBOLS (coff),
BFD_JUMP_TABLE_RELOCS (coff),
BFD_JUMP_TABLE_WRITE (tic54x),
BFD_JUMP_TABLE_LINK (coff),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
&tic54x_coff2_vec,
COFF_SWAP_TABLE
};

View File

@ -42,7 +42,6 @@ static reloc_howto_type howto_table[] =
};
/* Turn a howto into a reloc number */
#define SELECT_RELOC(x,howto) \
@ -52,7 +51,6 @@ static reloc_howto_type howto_table[] =
#define W65 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
@ -60,7 +58,6 @@ static reloc_howto_type howto_table[] =
dst->r_stuff[0] = 'S'; \
dst->r_stuff[1] = 'C';
static int
select_reloc (howto)
reloc_howto_type *howto;
@ -81,14 +78,11 @@ 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)
@ -112,15 +106,12 @@ reloc_processing (relent, reloc, symbols, abfd, section)
relent->sym_ptr_ptr = (asymbol **)&(bfd_abs_symbol);
}
relent->addend = reloc->r_offset;
relent->address -= section->vma;
/* relent->section = 0;*/
}
static int
h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info)
bfd *abfd;
@ -142,7 +133,6 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info)
bfd_vma address = reloc->address - shrink;
switch (reloc->howto->type)
{
case R_MOV16B2:
@ -208,7 +198,6 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info)
gap = value - (dot - shrink);
if (-120 < (long)gap && (long)gap < 120 )
{
@ -224,11 +213,9 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info)
break;
}
return shrink;
}
/* First phase of a relaxing link */
/* Reloc types
@ -346,7 +333,7 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
(link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr),
reloc->howto->name, reloc->addend, input_section->owner,
input_section, reloc->address)))
abort();
abort ();
}
bfd_put_8 (abfd, gap, data + dst_address);
dst_address += 1;
@ -362,7 +349,6 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
+ dst_address
+ link_order->u.indirect.section->output_section->vma;
/* This wraps within the page, so ignore the relativeness, look at the
high part */
if ((gap & 0xf0000) != (dot & 0xf0000)) {
@ -370,7 +356,7 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
(link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr),
reloc->howto->name, reloc->addend, input_section->owner,
input_section, reloc->address)))
abort();
abort ();
}
gap -= dot + 2;
@ -380,7 +366,7 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
}
break;
default:
printf(_("ignoring reloc %s\n"), reloc->howto->name);
printf (_("ignoring reloc %s\n"), reloc->howto->name);
break;
}
@ -394,7 +380,6 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
#include "coffcode.h"
#undef coff_bfd_get_relocated_section_contents
#undef coff_bfd_relax_section
#define coff_bfd_get_relocated_section_contents \

View File

@ -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,14 +107,11 @@ 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)
@ -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;
}
@ -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 \

351
gnu/dist/toolchain/bfd/coff64-rs6000.c vendored Normal file
View File

@ -0,0 +1,351 @@
/* BFD back-end for IBM RS/6000 "XCOFF64" files.
Copyright 2000
Free Software Foundation, Inc.
Written Clinton Popetz.
Contributed by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Internalcoff.h and coffcode.h modify themselves based on these flags. */
#define XCOFF64
#define RS6000COFF_C 1
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
#include "coff/internal.h"
#include "coff/rs6k64.h"
#include "libcoff.h"
#define GET_FILEHDR_SYMPTR bfd_h_get_64
#define PUT_FILEHDR_SYMPTR bfd_h_put_64
#define GET_AOUTHDR_DATA_START bfd_h_get_64
#define PUT_AOUTHDR_DATA_START bfd_h_put_64
#define GET_AOUTHDR_TEXT_START bfd_h_get_64
#define PUT_AOUTHDR_TEXT_START bfd_h_put_64
#define GET_AOUTHDR_TSIZE bfd_h_get_64
#define PUT_AOUTHDR_TSIZE bfd_h_put_64
#define GET_AOUTHDR_DSIZE bfd_h_get_64
#define PUT_AOUTHDR_DSIZE bfd_h_put_64
#define GET_AOUTHDR_BSIZE bfd_h_get_64
#define PUT_AOUTHDR_BSIZE bfd_h_put_64
#define GET_AOUTHDR_ENTRY bfd_h_get_64
#define PUT_AOUTHDR_ENTRY bfd_h_put_64
#define GET_SCNHDR_PADDR bfd_h_get_64
#define PUT_SCNHDR_PADDR bfd_h_put_64
#define GET_SCNHDR_VADDR bfd_h_get_64
#define PUT_SCNHDR_VADDR bfd_h_put_64
#define GET_SCNHDR_SIZE bfd_h_get_64
#define PUT_SCNHDR_SIZE bfd_h_put_64
#define GET_SCNHDR_SCNPTR bfd_h_get_64
#define PUT_SCNHDR_SCNPTR bfd_h_put_64
#define GET_SCNHDR_RELPTR bfd_h_get_64
#define PUT_SCNHDR_RELPTR bfd_h_put_64
#define GET_SCNHDR_LNNOPTR bfd_h_get_64
#define PUT_SCNHDR_LNNOPTR bfd_h_put_64
#define GET_SCNHDR_NRELOC bfd_h_get_32
#define MAX_SCNHDR_NRELOC 0xffffffff
#define PUT_SCNHDR_NRELOC bfd_h_put_32
#define GET_SCNHDR_NLNNO bfd_h_get_32
#define MAX_SCNHDR_NLNNO 0xffffffff
#define PUT_SCNHDR_NLNNO bfd_h_put_32
#define GET_RELOC_VADDR bfd_h_get_64
#define PUT_RELOC_VADDR bfd_h_put_64
#define COFF_FORCE_SYMBOLS_IN_STRINGS
#define COFF_DEBUG_STRING_WIDE_PREFIX
#define COFF_ADJUST_SCNHDR_OUT_POST(ABFD,INT,EXT) \
do { \
memset (((SCNHDR *)EXT)->s_pad, 0, sizeof (((SCNHDR *)EXT)->s_pad));\
} while (0)
#define NO_COFF_LINENOS
#define coff_SWAP_lineno_in xcoff64_swap_lineno_in
#define coff_SWAP_lineno_out xcoff64_swap_lineno_out
#define PUTWORD bfd_h_put_32
#define PUTHALF bfd_h_put_16
#define PUTBYTE bfd_h_put_8
#define GETWORD bfd_h_get_32
#define GETHALF bfd_h_get_16
#define GETBYTE bfd_h_get_8
/* For XCOFF64, the effective width of symndx changes depending on
whether we are the first entry. Sigh. */
static void
xcoff64_swap_lineno_in (abfd, ext1, in1)
bfd *abfd;
PTR ext1;
PTR in1;
{
LINENO *ext = (LINENO *)ext1;
struct internal_lineno *in = (struct internal_lineno *)in1;
in->l_lnno = bfd_h_get_32(abfd, (bfd_byte *) (ext->l_lnno));
if (in->l_lnno == 0)
in->l_addr.l_symndx =
bfd_h_get_32(abfd, (bfd_byte *) ext->l_addr.l_symndx);
else
in->l_addr.l_symndx =
bfd_h_get_64(abfd, (bfd_byte *) ext->l_addr.l_symndx);
}
static unsigned int
xcoff64_swap_lineno_out (abfd, inp, outp)
bfd *abfd;
PTR inp;
PTR outp;
{
struct internal_lineno *in = (struct internal_lineno *)inp;
struct external_lineno *ext = (struct external_lineno *)outp;
PUTWORD(abfd, in->l_addr.l_symndx, (bfd_byte *)
ext->l_addr.l_symndx);
bfd_h_put_32 (abfd, in->l_lnno, (bfd_byte *) (ext->l_lnno));
if (in->l_lnno == 0)
bfd_h_put_32 (abfd, in->l_addr.l_symndx, (bfd_byte *)ext->l_addr.l_symndx);
else
bfd_h_put_64 (abfd, in->l_addr.l_symndx, (bfd_byte *)ext->l_addr.l_symndx);
return bfd_coff_linesz (abfd);
}
static void xcoff64_swap_sym_in PARAMS ((bfd *, PTR, PTR));
static unsigned int xcoff64_swap_sym_out PARAMS ((bfd *, PTR, PTR));
static void xcoff64_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR));
static unsigned int xcoff64_swap_aux_out PARAMS ((bfd *, PTR, int, int, int, int, PTR));
static void
xcoff64_swap_sym_in (abfd, ext1, in1)
bfd *abfd;
PTR ext1;
PTR in1;
{
SYMENT *ext = (SYMENT *)ext1;
struct internal_syment *in = (struct internal_syment *)in1;
in->_n._n_n._n_zeroes = 0;
in->_n._n_n._n_offset = bfd_h_get_32(abfd, (bfd_byte *) ext->e_offset);
in->n_value = bfd_h_get_64(abfd, (bfd_byte *) ext->e.e_value);
in->n_scnum = bfd_h_get_16(abfd, (bfd_byte *) ext->e_scnum);
in->n_type = bfd_h_get_16(abfd, (bfd_byte *) ext->e_type);
in->n_sclass = bfd_h_get_8(abfd, ext->e_sclass);
in->n_numaux = bfd_h_get_8(abfd, ext->e_numaux);
}
static unsigned int
xcoff64_swap_sym_out (abfd, inp, extp)
bfd *abfd;
PTR inp;
PTR extp;
{
struct internal_syment *in = (struct internal_syment *)inp;
SYMENT *ext =(SYMENT *)extp;
bfd_h_put_32(abfd, in->_n._n_n._n_offset, (bfd_byte *) ext->e_offset);
bfd_h_put_64(abfd, in->n_value , (bfd_byte *) ext->e.e_value);
bfd_h_put_16(abfd, in->n_scnum , (bfd_byte *) ext->e_scnum);
bfd_h_put_16(abfd, in->n_type , (bfd_byte *) ext->e_type);
bfd_h_put_8(abfd, in->n_sclass , ext->e_sclass);
bfd_h_put_8(abfd, in->n_numaux , ext->e_numaux);
return bfd_coff_symesz (abfd);
}
static void
xcoff64_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
bfd *abfd;
PTR ext1;
int type;
int class;
int indx;
int numaux;
PTR in1;
{
AUXENT *ext = (AUXENT *)ext1;
union internal_auxent *in = (union internal_auxent *)in1;
switch (class) {
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 =
bfd_h_get_32(abfd, (bfd_byte *) ext->x_file.x_n.x_offset);
} else {
if (numaux > 1)
{
if (indx == 0)
memcpy (in->x_file.x_fname, ext->x_file.x_fname,
numaux * sizeof (AUXENT));
}
else
{
memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
}
}
goto end;
/* RS/6000 "csect" auxents */
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_lo);
/* FIXME: If we want section lengths larger than 32 bits, we need
to modify the internal coff structures to support it. */
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);
goto end;
}
break;
case C_STAT:
case C_LEAFSTAT:
case C_HIDDEN:
if (type == T_NULL) {
/* PE defines some extra fields; we zero them out for
safety. */
in->x_scn.x_checksum = 0;
in->x_scn.x_associated = 0;
in->x_scn.x_comdat = 0;
goto end;
}
break;
}
if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
{
in->x_sym.x_fcnary.x_fcn.x_lnnoptr = bfd_h_get_64(abfd, (bfd_byte *)
ext->x_sym.x_fcnary.x_fcn.x_lnnoptr);
in->x_sym.x_fcnary.x_fcn.x_endndx.l = bfd_h_get_32(abfd, (bfd_byte *)
ext->x_sym.x_fcnary.x_fcn.x_endndx);
}
if (ISFCN(type)) {
in->x_sym.x_misc.x_fsize = bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_fsize);
}
else {
in->x_sym.x_misc.x_lnsz.x_lnno = bfd_h_get_32(abfd, (bfd_byte *)
ext->x_sym.x_fcnary.x_lnsz.x_lnno);
in->x_sym.x_misc.x_lnsz.x_size = bfd_h_get_16(abfd, (bfd_byte *)
ext->x_sym.x_fcnary.x_lnsz.x_size);
}
end: ;
/* the semicolon is because MSVC doesn't like labels at
end of block. */
}
static unsigned int
xcoff64_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
bfd *abfd;
PTR inp;
int type;
int class;
int indx ATTRIBUTE_UNUSED;
int numaux ATTRIBUTE_UNUSED;
PTR extp;
{
union internal_auxent *in = (union internal_auxent *)inp;
AUXENT *ext = (AUXENT *)extp;
memset((PTR)ext, 0, bfd_coff_auxesz (abfd));
switch (class)
{
case C_FILE:
if (in->x_file.x_fname[0] == 0)
{
PUTWORD(abfd, 0, (bfd_byte *) ext->x_file.x_n.x_zeroes);
PUTWORD(abfd,
in->x_file.x_n.x_offset,
(bfd_byte *) ext->x_file.x_n.x_offset);
}
else
{
memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
}
PUTBYTE (abfd, _AUX_FILE, (bfd_byte *) ext->x_auxtype.x_auxtype);
goto end;
/* 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_lo);
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);
PUTBYTE (abfd, _AUX_CSECT, (bfd_byte *) ext->x_auxtype.x_auxtype);
goto end;
}
break;
case C_STAT:
case C_LEAFSTAT:
case C_HIDDEN:
if (type == T_NULL) {
goto end;
}
break;
}
if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
{
bfd_h_put_64(abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr,
(bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr);
PUTBYTE (abfd, _AUX_FCN, (bfd_byte *) ext->x_auxtype.x_auxtype);
PUTWORD(abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l,
(bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx);
}
if (ISFCN (type))
PUTWORD (abfd, in->x_sym.x_misc.x_fsize,
(bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_fsize);
else
{
bfd_h_put_32(abfd, in->x_sym.x_misc.x_lnsz.x_lnno,
(bfd_byte *)ext->x_sym.x_fcnary.x_lnsz.x_lnno);
bfd_h_put_16(abfd, in->x_sym.x_misc.x_lnsz.x_size,
(bfd_byte *)ext->x_sym.x_fcnary.x_lnsz.x_size);
}
end:
return bfd_coff_auxesz (abfd);
}
#define coff_SWAP_sym_in xcoff64_swap_sym_in
#define coff_SWAP_sym_out xcoff64_swap_sym_out
#define coff_SWAP_aux_in xcoff64_swap_aux_in
#define coff_SWAP_aux_out xcoff64_swap_aux_out
#define TARGET_NAME "aixcoff64-rs6000"
#define TARGET_SYM rs6000coff64_vec
#include "xcoff-target.h"

View File

@ -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
{
@ -816,7 +817,16 @@ coff_fix_symbol_name (abfd, symbol, native, string_size_p,
{
unsigned int filnmlen;
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);
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;
}
}
}
@ -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)
{
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;
@ -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. */
@ -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)
@ -2430,4 +2455,3 @@ bfd_coff_set_symbol_class (abfd, symbol, 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))
@ -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);
@ -1293,7 +1302,6 @@ mark_relocs (finfo, input_bfd)
struct internal_reloc * irel;
struct internal_reloc * irelend;
if ((a->flags & SEC_RELOC) == 0 || a->reloc_count < 1)
continue;
@ -1835,11 +1843,7 @@ _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)))
if (finfo->info->task_link && IS_EXTERNAL (input_bfd, isym))
isym.n_sclass = C_STAT;
/* Output the symbol. */
@ -2552,15 +2556,20 @@ _bfd_coff_write_global_sym (h, data)
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))
{
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);
@ -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)
@ -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
@ -349,7 +360,7 @@ coff_swap_sym_in (abfd, ext1, in1)
}
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);
}
@ -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:
@ -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

@ -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

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

@ -38,17 +38,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
next, \
}
#if 0 /* ??? Not currently needed, but keep in for future reference. */
static const bfd_arch_info_type arch_info_struct[] =
{
ARC (bfd_mach_arc_foo, "arc-foo", false, &arch_info_struct[1]),
ARC (bfd_mach_arc_bar, "arc-bar", false, 0),
ARC ( bfd_mach_arc_5, "arc5", false, &arch_info_struct[1] ),
ARC ( bfd_mach_arc_6, "arc6", false, &arch_info_struct[2] ),
ARC ( bfd_mach_arc_7, "arc7", false, &arch_info_struct[3] ),
ARC ( bfd_mach_arc_8, "arc8", false, NULL ),
};
#endif
const bfd_arch_info_type bfd_arc_arch =
ARC (bfd_mach_arc_base, "arc-base", true, 0 /*&arch_info_struct[0]*/);
ARC ( bfd_mach_arc_5, "arc", true, &arch_info_struct[0] );
/* Utility routines. */
/* Given cpu type NAME, return its bfd_mach_arc_xxx value.
@ -61,10 +61,7 @@ arc_get_mach (name)
const bfd_arch_info_type *p;
for (p = &bfd_arc_arch; p != NULL; p = p->next)
{
/* +4: skip over "arc-" */
if (strcmp (name, p->printable_name + 4) == 0)
if (strcmp (name, p->printable_name) == 0)
return p->mach;
}
return -1;
}

View File

@ -93,6 +93,7 @@ processors[] =
{ bfd_mach_arm_4, "strongarm"},
{ bfd_mach_arm_4, "strongarm110" },
{ bfd_mach_arm_4, "strongarm1100" },
{ bfd_mach_arm_XScale, "xscale" }
};
static boolean
@ -123,7 +124,6 @@ scan (info, string)
return false;
}
#define N(number, print, default, next) \
{ 32, 32, 8, bfd_arch_arm, number, "arm", print, 4, default, compatible, scan, next }
@ -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

@ -22,11 +22,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "sysdep.h"
#include "libbfd.h"
static const bfd_arch_info_type *compatible
PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
#define N(addr_bits, machine, print, default, next) \
{ \
8, /* 8 bits in a word */ \
@ -45,17 +43,20 @@ static const bfd_arch_info_type *compatible
static const bfd_arch_info_type arch_info_struct[] =
{
/* AT90S1200 */
/* AT90S1200, ATtiny1x, ATtiny28 */
N (16, bfd_mach_avr1, "avr:1", false, & arch_info_struct[1]),
/* AT90S2xxx, AT90S4xxx, AT90S81xx, ATtiny22 */
/* AT90S2xxx, AT90S4xxx, AT90S8xxx, ATtiny22 */
N (16, bfd_mach_avr2, "avr:2", false, & arch_info_struct[2]),
/* ATmega103, ATmega603 */
N (22, bfd_mach_avr3, "avr:3", false, & arch_info_struct[3]),
/* ATmega161 */
N (16, bfd_mach_avr4, "avr:4", false, NULL)
/* ATmega83, ATmega85 */
N (16, bfd_mach_avr4, "avr:4", false, & arch_info_struct[4]),
/* ATmega161, ATmega163, ATmega32, AT94K */
N (22, bfd_mach_avr5, "avr:5", false, NULL)
};
const bfd_arch_info_type bfd_avr_arch =
@ -74,7 +75,7 @@ compatible (a,b)
if (a->arch != b->arch)
return NULL;
/* Special case for ATmega[16]03 (avr:3) and ATmega161 (avr:4). */
/* Special case for ATmega[16]03 (avr:3) and ATmega83 (avr:4). */
if ((a->mach == 3 && b->mach == 4)
|| (a->mach == 4 && b->mach == 3))
return NULL;
@ -84,6 +85,9 @@ compatible (a,b)
if (a->mach <= b->mach)
return b;
if (a->mach >= b->mach)
return a;
/* Never reached! */
return NULL;
}

57
gnu/dist/toolchain/bfd/cpu-cris.c vendored Normal file
View File

@ -0,0 +1,57 @@
/* BFD support for the Axis CRIS architecture.
Copyright (C) 2000 Free Software Foundation, Inc.
Contributed by Axis Communications AB.
Written by Hans-Peter Nilsson.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
const bfd_arch_info_type
bfd_cris_arch =
{
32, /* There's 32 bits_per_word. */
32, /* There's 32 bits_per_address. */
8, /* There's 8 bits_per_byte. */
bfd_arch_cris, /* One of enum bfd_architecture, defined
in archures.c and provided in
generated header files. */
0xff, /* Only 1 machine, but #255 for
historical reasons. */
"cris", /* The arch_name. */
"cris", /* The printable name is the same. */
1, /* Section alignment power; each section
is aligned to (only) 2^1 bytes. */
true, /* This is the default "machine", since
there's only one. */
bfd_default_compatible, /* A default function for testing
"machine" compatibility of two
bfd_arch_info_type. */
bfd_default_scan, /* Check if an bfd_arch_info_type is a
match. */
NULL /* Pointer to next bfd_arch_info_type in
the same family. */
};
/*
* Local variables:
* eval: (c-set-style "gnu")
* indent-tabs-mode: t
* End:
*/

View File

@ -65,15 +65,14 @@ h8300_scan (info, string)
}
}
/* This routine is provided two arch_infos and works out the
machine which would be compatible with both and returns a pointer
to its info structure */
/* This routine is provided two arch_infos and works out the machine
which would be compatible with both and returns a pointer to its
info structure. */
static const bfd_arch_info_type *
compatible (in, out)
const bfd_arch_info_type * in;
const bfd_arch_info_type * out;
const bfd_arch_info_type *in;
const bfd_arch_info_type *out;
{
/* It's really not a good idea to mix and match modes. */
if (in->mach != out->mach)
@ -95,7 +94,9 @@ static const bfd_arch_info_type h8300_info_struct =
true, /* the default machine */
compatible,
h8300_scan,
/* local_bfd_reloc_type_lookup, */
#if 0
local_bfd_reloc_type_lookup,
#endif
0,
};
@ -112,7 +113,9 @@ static const bfd_arch_info_type h8300h_info_struct =
false, /* the default machine */
compatible,
h8300_scan,
/* local_bfd_reloc_type_lookup, */
#if 0
local_bfd_reloc_type_lookup,
#endif
&h8300_info_struct,
};
@ -129,6 +132,8 @@ const bfd_arch_info_type bfd_h8300_arch =
false, /* the default machine */
compatible,
h8300_scan,
/* local_bfd_reloc_type_lookup, */
#if 0
local_bfd_reloc_type_lookup,
#endif
&h8300h_info_struct,
};

View File

@ -40,17 +40,16 @@ howto16_callback (abfd, reloc_entry, symbol_in, data,
{
long relocation = 0;
bfd_vma addr = reloc_entry->address;
long x = bfd_get_16(abfd, (bfd_byte *)data + addr);
long x = bfd_get_16 (abfd, (bfd_byte *)data + addr);
HOWTO_PREPARE(relocation, symbol_in);
x = (x + relocation + reloc_entry->addend);
bfd_put_16(abfd, x, (bfd_byte *)data + addr);
bfd_put_16 (abfd, x, (bfd_byte *)data + addr);
return bfd_reloc_ok;
}
static bfd_reloc_status_type
howto8_callback (abfd, reloc_entry, symbol_in, data,
ignore_input_section, ignore_bfd)
@ -63,17 +62,16 @@ howto8_callback (abfd, reloc_entry, symbol_in, data,
{
long relocation = 0;
bfd_vma addr = reloc_entry->address;
long x = bfd_get_8(abfd, (bfd_byte *)data + addr);
long x = bfd_get_8 (abfd, (bfd_byte *)data + addr);
HOWTO_PREPARE(relocation, symbol_in);
x = (x + relocation + reloc_entry->addend);
bfd_put_8(abfd, x, (bfd_byte *)data + addr);
bfd_put_8 (abfd, x, (bfd_byte *)data + addr);
return bfd_reloc_ok;
}
static bfd_reloc_status_type
howto8_FFnn_callback (abfd, reloc_entry, symbol_in, data,
ignore_input_section, ignore_bfd)
@ -87,13 +85,13 @@ howto8_FFnn_callback (abfd, reloc_entry, symbol_in, data,
long relocation = 0;
bfd_vma addr = reloc_entry->address;
long x = bfd_get_8(abfd, (bfd_byte *)data + addr);
abort();
long x = bfd_get_8 (abfd, (bfd_byte *)data + addr);
abort ();
HOWTO_PREPARE(relocation, symbol_in);
x = (x + relocation + reloc_entry->addend);
bfd_put_8(abfd, x, (bfd_byte *)data + addr);
bfd_put_8 (abfd, x, (bfd_byte *)data + addr);
return bfd_reloc_ok;
}
@ -109,18 +107,16 @@ howto8_pcrel_callback (abfd, reloc_entry, symbol_in, data,
{
long relocation = 0;
bfd_vma addr = reloc_entry->address;
long x = bfd_get_8(abfd, (bfd_byte *)data + addr);
abort();
long x = bfd_get_8 (abfd, (bfd_byte *)data + addr);
abort ();
HOWTO_PREPARE(relocation, symbol_in);
x = (x + relocation + reloc_entry->addend);
bfd_put_8(abfd, x, (bfd_byte *)data + addr);
bfd_put_8 (abfd, x, (bfd_byte *)data + addr);
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 +128,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;
@ -166,7 +161,6 @@ scan_mach (info, string)
return false;
}
#if 0 /* not used currently */
/* This routine is provided two arch_infos and returns whether
they'd be compatible */

View File

@ -36,6 +36,21 @@ const bfd_arch_info_type bfd_i386_arch_intel_syntax =
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 */
@ -49,7 +64,23 @@ static const bfd_arch_info_type i8086_arch =
false,
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 =
@ -65,6 +96,5 @@ const bfd_arch_info_type bfd_i386_arch =
true,
bfd_default_compatible,
bfd_default_scan ,
&i8086_arch,
&bfd_x86_64_arch
};

View File

@ -1,5 +1,5 @@
/* BFD support for the Intel 860 architecture.
Copyright 1992, 1995 Free Software Foundation, Inc.
Copyright 1992, 1995, 2000 Free Software Foundation, Inc.
Created mostly by substituting "860" for "386" in cpu-i386.c
Harry Dolan <dolan@ssd.intel.com>, October 1995
@ -28,13 +28,13 @@ const bfd_arch_info_type bfd_i860_arch =
32, /* 32 bits in a word */
32, /* 32 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_i860,
0, /* only 1 machine */
"i860",
"i860",
3,
true, /* the one and only */
bfd_arch_i860, /* Architecture */
0, /* Only one machine */
"i860", /* Architecture name */
"i860", /* Printable name */
3, /* Section alignment exponent */
true, /* Is this the default architecture? */
bfd_default_compatible,
bfd_default_scan ,
0,
bfd_default_scan,
0, /* Next in list */
};

View File

@ -18,12 +18,10 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
/* This routine is provided a string, and tries to work out if it
could possibly refer to the i960 machine pointed at in the
info_struct pointer */
@ -34,28 +32,44 @@ scan_960_mach (ap, string)
const char *string;
{
unsigned long machine;
int i;
int fail_because_not_80960 = false;
/* Look for the string i960, or somesuch at the front of the string */
for (i = 0; i < strlen (string); i ++)
string[i] = tolower (string[i]);
if (strncmp("i960",string,4) == 0) {
string+=4;
}
else {
/* no match, can be us */
return false;
}
if (string[0] == 0) {
/* i960 on it's own means core to us*/
if (ap->mach == bfd_mach_i960_core) return true;
return false;
}
/* Look for the string i960 at the front of the string. */
if (strncmp ("i960", string, 4) == 0)
{
string += 4;
if (string[0] != ':') {
/* i960 on it's own means core to us. */
if (* string == 0)
return ap->mach == bfd_mach_i960_core;
/* "i960:*" is valid, anything else is not. */
if (* string != ':')
return false;
string ++;
}
string++;
if (string[0] == '\0')
/* In some bfds the cpu-id is written as "80960KA", "80960KB",
"80960CA" or "80960MC". */
else if (strncmp ("80960", string, 5) == 0)
{
string += 5;
/* Sett his to true here. If a correct matching postfix
is detected below it will be reset to false. */
fail_because_not_80960 = true;
}
/* No match, can't be us. */
else
return false;
if (* string == '\0')
return false;
if (string[0] == 'c' && string[1] == 'o' && string[2] == 'r' &&
string[3] == 'e' && string[4] == '\0')
machine = bfd_mach_i960_core;
@ -63,20 +77,20 @@ scan_960_mach (ap, string)
machine = bfd_mach_i960_ka_sa;
else if (strcmp (string, "kb_sb") == 0)
machine = bfd_mach_i960_kb_sb;
else if (string[1] == '\0' || string[2] != '\0') /* rest are 2-char */
else if (string[1] == '\0' || string[2] != '\0') /* rest are 2-char. */
return false;
else if (string[0] == 'k' && string[1] == 'b')
machine = bfd_mach_i960_kb_sb;
{ machine = bfd_mach_i960_kb_sb; fail_because_not_80960 = false; }
else if (string[0] == 's' && string[1] == 'b')
machine = bfd_mach_i960_kb_sb;
else if (string[0] == 'm' && string[1] == 'c')
machine = bfd_mach_i960_mc;
{ machine = bfd_mach_i960_mc; fail_because_not_80960 = false; }
else if (string[0] == 'x' && string[1] == 'a')
machine = bfd_mach_i960_xa;
else if (string[0] == 'c' && string[1] == 'a')
machine = bfd_mach_i960_ca;
{ machine = bfd_mach_i960_ca; fail_because_not_80960 = false; }
else if (string[0] == 'k' && string[1] == 'a')
machine = bfd_mach_i960_ka_sa;
{ machine = bfd_mach_i960_ka_sa; fail_because_not_80960 = false; }
else if (string[0] == 's' && string[1] == 'a')
machine = bfd_mach_i960_ka_sa;
else if (string[0] == 'j' && string[1] == 'x')
@ -85,12 +99,16 @@ scan_960_mach (ap, string)
machine = bfd_mach_i960_hx;
else
return false;
if (machine == ap->mach) return true;
if (fail_because_not_80960)
return false;
if (machine == ap->mach)
return true;
return false;
}
/* This routine is provided two arch_infos and works out the i960
machine which would be compatible with both and returns a pointer
to its info structure */
@ -134,7 +152,6 @@ compatible (a,b)
{ HX, HX, ERROR, ERROR, ERROR, ERROR, ERROR, HX, HX },
};
if (a->arch != b->arch || matrix[a->mach][b->mach] == ERROR)
{
return NULL;
@ -145,8 +162,6 @@ compatible (a,b)
}
}
int bfd_default_scan_num_mach();
#define N(a,b,d,n) \
{ 32, 32, 8,bfd_arch_i960,a,"i960",b,3,d,compatible,scan_960_mach,n,}

589
gnu/dist/toolchain/bfd/cpu-ia64-opc.c vendored Normal file
View File

@ -0,0 +1,589 @@
/* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Logically, this code should be part of libopcode but since some of
the operand insertion/extraction functions help bfd to implement
relocations, this code is included as part of elf64-ia64.c. This
avoids circular dependencies between libopcode and libbfd and also
obviates the need for applications to link in libopcode when all
they really want is libbfd.
--davidm Mon Apr 13 22:14:02 1998 */
#include "../opcodes/ia64-opc.h"
#define NELEMS(a) ((int) (sizeof (a) / sizeof ((a)[0])))
static const char*
ins_rsvd (const struct ia64_operand *self ATTRIBUTE_UNUSED,
ia64_insn value ATTRIBUTE_UNUSED, ia64_insn *code ATTRIBUTE_UNUSED)
{
return "internal error---this shouldn't happen";
}
static const char*
ext_rsvd (const struct ia64_operand *self ATTRIBUTE_UNUSED,
ia64_insn code ATTRIBUTE_UNUSED, ia64_insn *valuep ATTRIBUTE_UNUSED)
{
return "internal error---this shouldn't happen";
}
static const char*
ins_const (const struct ia64_operand *self ATTRIBUTE_UNUSED,
ia64_insn value ATTRIBUTE_UNUSED, ia64_insn *code ATTRIBUTE_UNUSED)
{
return 0;
}
static const char*
ext_const (const struct ia64_operand *self ATTRIBUTE_UNUSED,
ia64_insn code ATTRIBUTE_UNUSED, ia64_insn *valuep ATTRIBUTE_UNUSED)
{
return 0;
}
static const char*
ins_reg (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
{
if (value >= 1u << self->field[0].bits)
return "register number out of range";
*code |= value << self->field[0].shift;
return 0;
}
static const char*
ext_reg (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
{
*valuep = ((code >> self->field[0].shift)
& ((1u << self->field[0].bits) - 1));
return 0;
}
static const char*
ins_immu (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
{
ia64_insn new = 0;
int i;
for (i = 0; i < NELEMS (self->field) && self->field[i].bits; ++i)
{
new |= ((value & ((((ia64_insn) 1) << self->field[i].bits) - 1))
<< self->field[i].shift);
value >>= self->field[i].bits;
}
if (value)
return "integer operand out of range";
*code |= new;
return 0;
}
static const char*
ext_immu (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
{
BFD_HOST_U_64_BIT value = 0;
int i, bits = 0, total = 0;
for (i = 0; i < NELEMS (self->field) && self->field[i].bits; ++i)
{
bits = self->field[i].bits;
value |= ((code >> self->field[i].shift)
& ((((BFD_HOST_U_64_BIT) 1) << bits) - 1)) << total;
total += bits;
}
*valuep = value;
return 0;
}
static const char*
ins_immus8 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
{
if (value & 0x7)
return "value not an integer multiple of 8";
return ins_immu (self, value >> 3, code);
}
static const char*
ext_immus8 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
{
const char *result;
result = ext_immu (self, code, valuep);
if (result)
return result;
*valuep = *valuep << 3;
return 0;
}
static const char*
ins_imms_scaled (const struct ia64_operand *self, ia64_insn value,
ia64_insn *code, int scale)
{
BFD_HOST_64_BIT svalue = value, sign_bit = 0;
ia64_insn new = 0;
int i;
svalue >>= scale;
for (i = 0; i < NELEMS (self->field) && self->field[i].bits; ++i)
{
new |= ((svalue & ((((ia64_insn) 1) << self->field[i].bits) - 1))
<< self->field[i].shift);
sign_bit = (svalue >> (self->field[i].bits - 1)) & 1;
svalue >>= self->field[i].bits;
}
if ((!sign_bit && svalue != 0) || (sign_bit && svalue != -1))
return "integer operand out of range";
*code |= new;
return 0;
}
static const char*
ext_imms_scaled (const struct ia64_operand *self, ia64_insn code,
ia64_insn *valuep, int scale)
{
int i, bits = 0, total = 0, shift;
BFD_HOST_64_BIT val = 0;
for (i = 0; i < NELEMS (self->field) && self->field[i].bits; ++i)
{
bits = self->field[i].bits;
val |= ((code >> self->field[i].shift)
& ((((BFD_HOST_U_64_BIT) 1) << bits) - 1)) << total;
total += bits;
}
/* sign extend: */
shift = 8*sizeof (val) - total;
val = (val << shift) >> shift;
*valuep = (val << scale);
return 0;
}
static const char*
ins_imms (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
{
return ins_imms_scaled (self, value, code, 0);
}
static const char*
ins_immsu4 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
{
if (value == (BFD_HOST_U_64_BIT) 0x100000000)
value = 0;
else
value = (((BFD_HOST_64_BIT)value << 32) >> 32);
return ins_imms_scaled (self, value, code, 0);
}
static const char*
ext_imms (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
{
return ext_imms_scaled (self, code, valuep, 0);
}
static const char*
ins_immsm1 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
{
--value;
return ins_imms_scaled (self, value, code, 0);
}
static const char*
ins_immsm1u4 (const struct ia64_operand *self, ia64_insn value,
ia64_insn *code)
{
if (value == (BFD_HOST_U_64_BIT) 0x100000000)
value = 0;
else
value = (((BFD_HOST_64_BIT)value << 32) >> 32);
--value;
return ins_imms_scaled (self, value, code, 0);
}
static const char*
ext_immsm1 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
{
const char *res = ext_imms_scaled (self, code, valuep, 0);
++*valuep;
return res;
}
static const char*
ins_imms1 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
{
return ins_imms_scaled (self, value, code, 1);
}
static const char*
ext_imms1 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
{
return ext_imms_scaled (self, code, valuep, 1);
}
static const char*
ins_imms4 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
{
return ins_imms_scaled (self, value, code, 4);
}
static const char*
ext_imms4 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
{
return ext_imms_scaled (self, code, valuep, 4);
}
static const char*
ins_imms16 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
{
return ins_imms_scaled (self, value, code, 16);
}
static const char*
ext_imms16 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
{
return ext_imms_scaled (self, code, valuep, 16);
}
static const char*
ins_cimmu (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
{
ia64_insn mask = (((ia64_insn) 1) << self->field[0].bits) - 1;
return ins_immu (self, value ^ mask, code);
}
static const char*
ext_cimmu (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
{
const char *result;
ia64_insn mask;
mask = (((ia64_insn) 1) << self->field[0].bits) - 1;
result = ext_immu (self, code, valuep);
if (!result)
{
mask = (((ia64_insn) 1) << self->field[0].bits) - 1;
*valuep ^= mask;
}
return result;
}
static const char*
ins_cnt (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
{
--value;
if (value >= ((BFD_HOST_U_64_BIT) 1) << self->field[0].bits)
return "count out of range";
*code |= value << self->field[0].shift;
return 0;
}
static const char*
ext_cnt (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
{
*valuep = ((code >> self->field[0].shift)
& ((((BFD_HOST_U_64_BIT) 1) << self->field[0].bits) - 1)) + 1;
return 0;
}
static const char*
ins_cnt2b (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
{
--value;
if (value > 2)
return "count must be in range 1..3";
*code |= value << self->field[0].shift;
return 0;
}
static const char*
ext_cnt2b (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
{
*valuep = ((code >> self->field[0].shift) & 0x3) + 1;
return 0;
}
static const char*
ins_cnt2c (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
{
switch (value)
{
case 0: value = 0; break;
case 7: value = 1; break;
case 15: value = 2; break;
case 16: value = 3; break;
default: return "count must be 0, 7, 15, or 16";
}
*code |= value << self->field[0].shift;
return 0;
}
static const char*
ext_cnt2c (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
{
ia64_insn value;
value = (code >> self->field[0].shift) & 0x3;
switch (value)
{
case 0: value = 0; break;
case 1: value = 7; break;
case 2: value = 15; break;
case 3: value = 16; break;
}
*valuep = value;
return 0;
}
static const char*
ins_inc3 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
{
BFD_HOST_64_BIT val = value;
BFD_HOST_U_64_BIT sign = 0;
if (val < 0)
{
sign = 0x4;
value = -value;
}
switch (value)
{
case 1: value = 3; break;
case 4: value = 2; break;
case 8: value = 1; break;
case 16: value = 0; break;
default: return "count must be +/- 1, 4, 8, or 16";
}
*code |= (sign | value) << self->field[0].shift;
return 0;
}
static const char*
ext_inc3 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
{
BFD_HOST_64_BIT val;
int negate;
val = (code >> self->field[0].shift) & 0x7;
negate = val & 0x4;
switch (val & 0x3)
{
case 0: val = 16; break;
case 1: val = 8; break;
case 2: val = 4; break;
case 3: val = 1; break;
}
if (negate)
val = -val;
*valuep = val;
return 0;
}
#define CST IA64_OPND_CLASS_CST
#define REG IA64_OPND_CLASS_REG
#define IND IA64_OPND_CLASS_IND
#define ABS IA64_OPND_CLASS_ABS
#define REL IA64_OPND_CLASS_REL
#define SDEC IA64_OPND_FLAG_DECIMAL_SIGNED
#define UDEC IA64_OPND_FLAG_DECIMAL_UNSIGNED
const struct ia64_operand elf64_ia64_operands[IA64_OPND_COUNT] =
{
/* constants: */
{ CST, ins_const, ext_const, "NIL", {{ 0, 0}}, 0, "<none>" },
{ CST, ins_const, ext_const, "ar.ccv", {{ 0, 0}}, 0, "ar.ccv" },
{ CST, ins_const, ext_const, "ar.pfs", {{ 0, 0}}, 0, "ar.pfs" },
{ CST, ins_const, ext_const, "1", {{ 0, 0}}, 0, "1" },
{ CST, ins_const, ext_const, "8", {{ 0, 0}}, 0, "8" },
{ CST, ins_const, ext_const, "16", {{ 0, 0}}, 0, "16" },
{ CST, ins_const, ext_const, "r0", {{ 0, 0}}, 0, "r0" },
{ CST, ins_const, ext_const, "ip", {{ 0, 0}}, 0, "ip" },
{ CST, ins_const, ext_const, "pr", {{ 0, 0}}, 0, "pr" },
{ CST, ins_const, ext_const, "pr.rot", {{ 0, 0}}, 0, "pr.rot" },
{ CST, ins_const, ext_const, "psr", {{ 0, 0}}, 0, "psr" },
{ CST, ins_const, ext_const, "psr.l", {{ 0, 0}}, 0, "psr.l" },
{ CST, ins_const, ext_const, "psr.um", {{ 0, 0}}, 0, "psr.um" },
/* register operands: */
{ REG, ins_reg, ext_reg, "ar", {{ 7, 20}}, 0, /* AR3 */
"an application register" },
{ REG, ins_reg, ext_reg, "b", {{ 3, 6}}, 0, /* B1 */
"a branch register" },
{ REG, ins_reg, ext_reg, "b", {{ 3, 13}}, 0, /* B2 */
"a branch register"},
{ REG, ins_reg, ext_reg, "cr", {{ 7, 20}}, 0, /* CR */
"a control register"},
{ REG, ins_reg, ext_reg, "f", {{ 7, 6}}, 0, /* F1 */
"a floating-point register" },
{ REG, ins_reg, ext_reg, "f", {{ 7, 13}}, 0, /* F2 */
"a floating-point register" },
{ REG, ins_reg, ext_reg, "f", {{ 7, 20}}, 0, /* F3 */
"a floating-point register" },
{ REG, ins_reg, ext_reg, "f", {{ 7, 27}}, 0, /* F4 */
"a floating-point register" },
{ REG, ins_reg, ext_reg, "p", {{ 6, 6}}, 0, /* P1 */
"a predicate register" },
{ REG, ins_reg, ext_reg, "p", {{ 6, 27}}, 0, /* P2 */
"a predicate register" },
{ REG, ins_reg, ext_reg, "r", {{ 7, 6}}, 0, /* R1 */
"a general register" },
{ REG, ins_reg, ext_reg, "r", {{ 7, 13}}, 0, /* R2 */
"a general register" },
{ REG, ins_reg, ext_reg, "r", {{ 7, 20}}, 0, /* R3 */
"a general register" },
{ REG, ins_reg, ext_reg, "r", {{ 2, 20}}, 0, /* R3_2 */
"a general register r0-r3" },
/* indirect operands: */
{ IND, ins_reg, ext_reg, "cpuid", {{7, 20}}, 0, /* CPUID_R3 */
"a cpuid register" },
{ IND, ins_reg, ext_reg, "dbr", {{7, 20}}, 0, /* DBR_R3 */
"a dbr register" },
{ IND, ins_reg, ext_reg, "dtr", {{7, 20}}, 0, /* DTR_R3 */
"a dtr register" },
{ IND, ins_reg, ext_reg, "itr", {{7, 20}}, 0, /* ITR_R3 */
"an itr register" },
{ IND, ins_reg, ext_reg, "ibr", {{7, 20}}, 0, /* IBR_R3 */
"an ibr register" },
{ IND, ins_reg, ext_reg, "", {{7, 20}}, 0, /* MR3 */
"an indirect memory address" },
{ IND, ins_reg, ext_reg, "msr", {{7, 20}}, 0, /* MSR_R3 */
"an msr register" },
{ IND, ins_reg, ext_reg, "pkr", {{7, 20}}, 0, /* PKR_R3 */
"a pkr register" },
{ IND, ins_reg, ext_reg, "pmc", {{7, 20}}, 0, /* PMC_R3 */
"a pmc register" },
{ IND, ins_reg, ext_reg, "pmd", {{7, 20}}, 0, /* PMD_R3 */
"a pmd register" },
{ IND, ins_reg, ext_reg, "rr", {{7, 20}}, 0, /* RR_R3 */
"an rr register" },
/* immediate operands: */
{ ABS, ins_cimmu, ext_cimmu, 0, {{ 5, 20 }}, UDEC, /* CCNT5 */
"a 5-bit count (0-31)" },
{ ABS, ins_cnt, ext_cnt, 0, {{ 2, 27 }}, UDEC, /* CNT2a */
"a 2-bit count (1-4)" },
{ ABS, ins_cnt2b, ext_cnt2b, 0, {{ 2, 27 }}, UDEC, /* CNT2b */
"a 2-bit count (1-3)" },
{ ABS, ins_cnt2c, ext_cnt2c, 0, {{ 2, 30 }}, UDEC, /* CNT2c */
"a count (0, 7, 15, or 16)" },
{ ABS, ins_immu, ext_immu, 0, {{ 5, 14}}, UDEC, /* CNT5 */
"a 5-bit count (0-31)" },
{ ABS, ins_immu, ext_immu, 0, {{ 6, 27}}, UDEC, /* CNT6 */
"a 6-bit count (0-63)" },
{ ABS, ins_cimmu, ext_cimmu, 0, {{ 6, 20}}, UDEC, /* CPOS6a */
"a 6-bit bit pos (0-63)" },
{ ABS, ins_cimmu, ext_cimmu, 0, {{ 6, 14}}, UDEC, /* CPOS6b */
"a 6-bit bit pos (0-63)" },
{ ABS, ins_cimmu, ext_cimmu, 0, {{ 6, 31}}, UDEC, /* CPOS6c */
"a 6-bit bit pos (0-63)" },
{ ABS, ins_imms, ext_imms, 0, {{ 1, 36}}, SDEC, /* IMM1 */
"a 1-bit integer (-1, 0)" },
{ ABS, ins_immu, ext_immu, 0, {{ 2, 13}}, UDEC, /* IMMU2 */
"a 2-bit unsigned (0-3)" },
{ ABS, ins_immu, ext_immu, 0, {{ 7, 13}}, 0, /* IMMU7a */
"a 7-bit unsigned (0-127)" },
{ ABS, ins_immu, ext_immu, 0, {{ 7, 20}}, 0, /* IMMU7b */
"a 7-bit unsigned (0-127)" },
{ ABS, ins_immu, ext_immu, 0, {{ 7, 13}}, UDEC, /* SOF */
"a frame size (register count)" },
{ ABS, ins_immu, ext_immu, 0, {{ 7, 20}}, UDEC, /* SOL */
"a local register count" },
{ ABS, ins_immus8,ext_immus8,0, {{ 4, 27}}, UDEC, /* SOR */
"a rotating register count (integer multiple of 8)" },
{ ABS, ins_imms, ext_imms, 0, /* IMM8 */
{{ 7, 13}, { 1, 36}}, SDEC,
"an 8-bit integer (-128-127)" },
{ ABS, ins_immsu4, ext_imms, 0, /* IMM8U4 */
{{ 7, 13}, { 1, 36}}, SDEC,
"an 8-bit signed integer for 32-bit unsigned compare (-128-127)" },
{ ABS, ins_immsm1, ext_immsm1, 0, /* IMM8M1 */
{{ 7, 13}, { 1, 36}}, SDEC,
"an 8-bit integer (-127-128)" },
{ ABS, ins_immsm1u4, ext_immsm1, 0, /* IMM8M1U4 */
{{ 7, 13}, { 1, 36}}, SDEC,
"an 8-bit integer for 32-bit unsigned compare (-127-(-1),1-128,0x100000000)" },
{ ABS, ins_immsm1, ext_immsm1, 0, /* IMM8M1U8 */
{{ 7, 13}, { 1, 36}}, SDEC,
"an 8-bit integer for 64-bit unsigned compare (-127-(-1),1-128,0x10000000000000000)" },
{ ABS, ins_immu, ext_immu, 0, {{ 2, 33}, { 7, 20}}, 0, /* IMMU9 */
"a 9-bit unsigned (0-511)" },
{ ABS, ins_imms, ext_imms, 0, /* IMM9a */
{{ 7, 6}, { 1, 27}, { 1, 36}}, SDEC,
"a 9-bit integer (-256-255)" },
{ ABS, ins_imms, ext_imms, 0, /* IMM9b */
{{ 7, 13}, { 1, 27}, { 1, 36}}, SDEC,
"a 9-bit integer (-256-255)" },
{ ABS, ins_imms, ext_imms, 0, /* IMM14 */
{{ 7, 13}, { 6, 27}, { 1, 36}}, SDEC,
"a 14-bit integer (-8192-8191)" },
{ ABS, ins_imms1, ext_imms1, 0, /* IMM17 */
{{ 7, 6}, { 8, 24}, { 1, 36}}, 0,
"a 17-bit integer (-65536-65535)" },
{ ABS, ins_immu, ext_immu, 0, {{20, 6}, { 1, 36}}, 0, /* IMMU21 */
"a 21-bit unsigned" },
{ ABS, ins_imms, ext_imms, 0, /* IMM22 */
{{ 7, 13}, { 9, 27}, { 5, 22}, { 1, 36}}, SDEC,
"a 22-bit signed integer" },
{ ABS, ins_immu, ext_immu, 0, /* IMMU24 */
{{21, 6}, { 2, 31}, { 1, 36}}, 0,
"a 24-bit unsigned" },
{ ABS, ins_imms16,ext_imms16,0, {{27, 6}, { 1, 36}}, 0, /* IMM44 */
"a 44-bit unsigned (least 16 bits ignored/zeroes)" },
{ ABS, ins_rsvd, ext_rsvd, 0, {{0, 0}}, 0, /* IMMU62 */
"a 62-bit unsigned" },
{ ABS, ins_rsvd, ext_rsvd, 0, {{0, 0}}, 0, /* IMMU64 */
"a 64-bit unsigned" },
{ ABS, ins_inc3, ext_inc3, 0, {{ 3, 13}}, SDEC, /* INC3 */
"an increment (+/- 1, 4, 8, or 16)" },
{ ABS, ins_cnt, ext_cnt, 0, {{ 4, 27}}, UDEC, /* LEN4 */
"a 4-bit length (1-16)" },
{ ABS, ins_cnt, ext_cnt, 0, {{ 6, 27}}, UDEC, /* LEN6 */
"a 6-bit length (1-64)" },
{ ABS, ins_immu, ext_immu, 0, {{ 4, 20}}, 0, /* MBTYPE4 */
"a mix type (@rev, @mix, @shuf, @alt, or @brcst)" },
{ ABS, ins_immu, ext_immu, 0, {{ 8, 20}}, 0, /* MBTYPE8 */
"an 8-bit mix type" },
{ ABS, ins_immu, ext_immu, 0, {{ 6, 14}}, UDEC, /* POS6 */
"a 6-bit bit pos (0-63)" },
{ REL, ins_imms4, ext_imms4, 0, {{ 7, 6}, { 2, 33}}, 0, /* TAG13 */
"a branch tag" },
{ REL, ins_imms4, ext_imms4, 0, {{ 9, 24}}, 0, /* TAG13b */
"a branch tag" },
{ REL, ins_imms4, ext_imms4, 0, {{20, 6}, { 1, 36}}, 0, /* TGT25 */
"a branch target" },
{ REL, ins_imms4, ext_imms4, 0, /* TGT25b */
{{ 7, 6}, {13, 20}, { 1, 36}}, 0,
"a branch target" },
{ REL, ins_imms4, ext_imms4, 0, {{20, 13}, { 1, 36}}, 0, /* TGT25c */
"a branch target" },
{ REL, ins_rsvd, ext_rsvd, 0, {{0, 0}}, 0, /* TGT64 */
"a branch target" },
};

57
gnu/dist/toolchain/bfd/cpu-ia64.c vendored Normal file
View File

@ -0,0 +1,57 @@
/* BFD support for the ia64 architecture.
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_ia64_elf32_arch =
{
64, /* 64 bits in a word */
32, /* 32 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_ia64,
bfd_mach_ia64_elf32,
"ia64",
"ia64-elf32",
3, /* log2 of section alignment */
true, /* the one and only */
bfd_default_compatible,
bfd_default_scan ,
0,
};
const bfd_arch_info_type bfd_ia64_arch =
{
64, /* 64 bits in a word */
64, /* 64 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_ia64,
bfd_mach_ia64_elf64,
"ia64",
"ia64-elf64",
3, /* log2 of section alignment */
true, /* the one and only */
bfd_default_compatible,
bfd_default_scan ,
&bfd_ia64_elf32_arch,
};
#include "cpu-ia64-opc.c"

38
gnu/dist/toolchain/bfd/cpu-m68hc11.c vendored Normal file
View File

@ -0,0 +1,38 @@
/* BFD support for the Motorola 68HC11 processor
Copyright 1999, 2000 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_m68hc11_arch =
{
16, /* 16 bits in a word */
16, /* 16 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_m68hc11,
0,
"m68hc11",
"m68hc11",
4, /* section alignment power */
true,
bfd_default_compatible,
bfd_default_scan,
0,
};

38
gnu/dist/toolchain/bfd/cpu-m68hc12.c vendored Normal file
View File

@ -0,0 +1,38 @@
/* BFD support for the Motorola 68HC12 processor
Copyright 1999, 2000 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_m68hc12_arch =
{
16, /* 16 bits in a word */
16, /* 16 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_m68hc12,
0,
"m68hc12",
"m68hc12",
4, /* section alignment power */
true,
bfd_default_compatible,
bfd_default_scan,
0,
};

View File

@ -22,9 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "sysdep.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_m88k_arch =
{
32, /* 32 bits in a word */

View File

@ -1,5 +1,5 @@
/* bfd back-end for mips support
Copyright (C) 1990, 91-97, 1998 Free Software Foundation, Inc.
Copyright (C) 1990, 91-97, 1998, 2000 Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@ -38,26 +38,31 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
NEXT, \
}
enum {
I_mips3000,
I_mips3900,
I_mips4000,
I_mips4010,
I_mips4100,
I_mips4111,
I_mips4300,
I_mips4400,
I_mips4600,
I_mips4650,
I_mips5000,
I_mips6000,
I_mips8000,
I_mips10000,
I_mips16
enum
{
I_mips3000,
I_mips3900,
I_mips4000,
I_mips4010,
I_mips4100,
I_mips4111,
I_mips4300,
I_mips4400,
I_mips4600,
I_mips4650,
I_mips5000,
I_mips6000,
I_mips8000,
I_mips10000,
I_mips16,
I_mips32,
I_mips32_4k,
I_mips5,
I_mips64,
I_sb1,
};
#define NN(index) (&arch_info_struct[(index)+1])
#define NN(index) (&arch_info_struct[(index) + 1])
static const bfd_arch_info_type arch_info_struct[] =
{
@ -74,10 +79,13 @@ static const bfd_arch_info_type arch_info_struct[] =
N (64, 64, bfd_mach_mips5000, "mips:5000", false, NN(I_mips5000)),
N (32, 32, bfd_mach_mips6000, "mips:6000", false, NN(I_mips6000)),
N (64, 64, bfd_mach_mips8000, "mips:8000", false, NN(I_mips8000)),
N (64, 64, bfd_mach_mips10000, "mips:10000", false, NN(I_mips10000)),
N (64, 64, bfd_mach_mips16, "mips:16", false, 0),
N (64, 64, bfd_mach_mips10000,"mips:10000", false, NN(I_mips10000)),
N (64, 64, bfd_mach_mips16, "mips:16", false, NN(I_mips16)),
N (32, 32, bfd_mach_mips32, "mips:mips32", false, NN(I_mips32)),
N (32, 32, bfd_mach_mips32_4k,"mips:mips32-4k", false, NN(I_mips32_4k)),
N (64, 64, bfd_mach_mips5, "mips:mips5", false, NN(I_mips5)),
N (64, 64, bfd_mach_mips64, "mips:mips64", false, NN(I_mips64)),
N (64, 64, bfd_mach_mips_sb1, "mips:sb1", false, 0),
};
/* The default architecture is mips:3000, but with a machine number of

View File

@ -174,8 +174,8 @@ do_ns32k_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
asection *input_section;
bfd *output_bfd;
char **error_message ATTRIBUTE_UNUSED;
long (*get_data)();
int (*put_data)();
long (*get_data) ();
int (*put_data) ();
{
int overflow = 0;
bfd_vma relocation;
@ -200,7 +200,6 @@ do_ns32k_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
&& output_bfd == (bfd *) NULL)
flag = bfd_reloc_undefined;
/* Is the address of the relocation really within the section? */
if (reloc_entry->address > input_section->_cooked_size)
return bfd_reloc_outofrange;
@ -214,7 +213,6 @@ do_ns32k_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
else
relocation = symbol->value;
reloc_target_output_section = symbol->section->output_section;
/* Convert input-section-relative symbol value to absolute. */
@ -290,8 +288,7 @@ do_ns32k_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
reloc_entry->address += input_section->output_offset;
/* WTF?? */
if (abfd->xvec->flavour == bfd_target_coff_flavour
&& strcmp (abfd->xvec->name, "aixcoff-rs6000") != 0)
if (abfd->xvec->flavour == bfd_target_coff_flavour)
{
#if 1
/* For m68k-coff, the addend was being subtracted twice during
@ -599,8 +596,8 @@ _bfd_do_ns32k_reloc_contents ( howto, input_bfd, relocation, location,
bfd *input_bfd ATTRIBUTE_UNUSED;
bfd_vma relocation;
bfd_byte *location;
long (*get_data)();
int (*put_data)();
long (*get_data) ();
int (*put_data) ();
{
int size;
bfd_vma x;

View File

@ -22,7 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "sysdep.h"
#include "libbfd.h"
static boolean
scan_mach (info, string)
const struct bfd_arch_info *info;
@ -33,7 +32,6 @@ scan_mach (info, string)
return false;
}
#if 0
/* This routine is provided two arch_infos and returns whether
they'd be compatible */
@ -49,7 +47,6 @@ compatible (a,b)
}
#endif
static const bfd_arch_info_type arch_info_struct[] =
{
{

View File

@ -54,7 +54,7 @@ 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,
@ -68,9 +68,9 @@ 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,
@ -82,9 +82,9 @@ 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,
@ -96,13 +96,125 @@ 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,
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,7 +225,7 @@ 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,

View File

@ -53,18 +53,64 @@ rs6000_compatible (a,b)
/*NOTREACHED*/
}
static const bfd_arch_info_type arch_info_struct[] =
{
{
32, /* 32 bits in a word */
32, /* 32 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_rs6000,
bfd_mach_rs6k_rs1,
"rs6000",
"rs6000:rs1",
3,
false, /* not the default */
rs6000_compatible,
bfd_default_scan,
&arch_info_struct[1]
},
{
32, /* 32 bits in a word */
32, /* 32 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_rs6000,
bfd_mach_rs6k_rsc,
"rs6000",
"rs6000:rsc",
3,
false, /* not the default */
rs6000_compatible,
bfd_default_scan,
&arch_info_struct[2]
},
{
32, /* 32 bits in a word */
32, /* 32 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_rs6000,
bfd_mach_rs6k_rs2,
"rs6000",
"rs6000:rs2",
3,
false, /* not the default */
rs6000_compatible,
bfd_default_scan,
0
}
};
const bfd_arch_info_type bfd_rs6000_arch =
{
32, /* 32 bits in a word */
32, /* 32 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_rs6000,
6000, /* only 1 machine */
bfd_mach_rs6k, /* POWER common architecture */
"rs6000",
"rs6000:6000",
3,
true, /* the one and only */
true, /* the default */
rs6000_compatible,
bfd_default_scan,
0,
&arch_info_struct[0]
};

View File

@ -22,7 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "sysdep.h"
#include "libbfd.h"
static boolean
scan_mach (info, string)
const struct bfd_arch_info *info;
@ -33,7 +32,6 @@ scan_mach (info, string)
return false;
}
#if 0
/* This routine is provided two arch_infos and returns whether
they'd be compatible */

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.
@ -135,6 +135,34 @@ static const bfd_arch_info_type arch_info_struct[] =
false,
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,
}
};

39
gnu/dist/toolchain/bfd/cpu-tic54x.c vendored Normal file
View File

@ -0,0 +1,39 @@
/* BFD support for the Texas Instruments TMS320C54X architecture.
Copyright 1999,2000 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_tic54x_arch =
{
16, /* 16 bits in a word */
16, /* 16 bits in an address (except '548) */
16, /* 16 bits in a byte */
bfd_arch_tic54x,
0, /* only 1 machine */
"tic54x",
"tms320c54x",
1,
true, /* the one and only */
bfd_default_compatible,
bfd_default_scan,
0,
};

View File

@ -22,7 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "sysdep.h"
#include "libbfd.h"
int bfd_default_scan_num_mach();
static boolean
@ -35,8 +34,6 @@ scan_mach (info, string)
return false;
}
const bfd_arch_info_type bfd_w65_arch =
{
16, /* 16 bits in a word */

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

@ -68,7 +68,7 @@ enum bfd_architecture
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
@ -76,9 +76,12 @@ enum bfd_architecture
#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_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
@ -95,10 +98,17 @@ enum bfd_architecture
#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 */
@ -113,13 +123,36 @@ enum bfd_architecture
#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
@ -145,16 +178,22 @@ enum bfd_architecture
#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'
@ -165,12 +204,17 @@ enum bfd_architecture
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
@};
@end example
@ -193,7 +237,7 @@ typedef struct bfd_arch_info
const char *arch_name;
const char *printable_name;
unsigned int section_align_power;
/* true if this is the default machine for the architecture */
/* True if this is the default machine for the architecture. */
boolean the_default;
const struct bfd_arch_info * (*compatible)
PARAMS ((const struct bfd_arch_info *a,
@ -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

@ -6,90 +6,84 @@ END-INFO-DIR-ENTRY
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 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.
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".

Indirect:
bfd.info-1: 916
bfd.info-2: 37727
bfd.info-3: 81566
bfd.info-4: 126215
bfd.info-5: 175891
bfd.info-6: 205826
bfd.info-7: 233431
bfd.info-1: 680
bfd.info-2: 38513
bfd.info-3: 83014
bfd.info-4: 132756
bfd.info-5: 181734
bfd.info-6: 214313
bfd.info-7: 260724

Tag Table:
(Indirect)
Node: Top916
Node: Overview1181
Node: History2231
Node: How It Works3172
Node: What BFD Version 2 Can Do4710
Node: BFD information loss6024
Node: Canonical format8547
Node: BFD front end12908
Node: Memory Usage31825
Node: Initialization33048
Node: Sections33425
Node: Section Input33903
Node: Section Output35259
Node: typedef asection37727
Node: section prototypes53227
Node: Symbols59441
Node: Reading Symbols61031
Node: Writing Symbols62205
Node: Mini Symbols63895
Node: typedef asymbol64860
Node: symbol handling functions70089
Node: Archives74418
Node: Formats78036
Node: Relocations80846
Node: typedef arelent81566
Node: howto manager97725
Node: Core Files123231
Node: Targets124252
Node: bfd_target126215
Node: Architectures145125
Node: Opening and Closing158434
Node: Internal162831
Node: File Caching168829
Node: Linker Functions171607
Node: Creating a Linker Hash Table173273
Node: Adding Symbols to the Hash Table175001
Node: Differing file formats175891
Node: Adding symbols from an object file177624
Node: Adding symbols from an archive179760
Node: Performing the Final Link182159
Node: Information provided by the linker183390
Node: Relocating the section contents184526
Node: Writing the symbol table186263
Node: Hash Tables188857
Node: Creating and Freeing a Hash Table190048
Node: Looking Up or Entering a String191205
Node: Traversing a Hash Table192447
Node: Deriving a New Hash Table Type193225
Node: Define the Derived Structures194280
Node: Write the Derived Creation Routine195346
Node: Write Other Derived Routines198045
Node: BFD back ends199345
Node: What to Put Where199564
Node: aout199702
Node: coff205826
Node: elf232598
Node: Index233431
Node: Top680
Node: Overview1012
Node: History2062
Node: How It Works3003
Node: What BFD Version 2 Can Do4541
Node: BFD information loss5855
Node: Canonical format8378
Node: BFD front end12739
Node: Memory Usage32611
Node: Initialization33834
Node: Sections34211
Node: Section Input34689
Node: Section Output36045
Node: typedef asection38513
Node: section prototypes54206
Node: Symbols60891
Node: Reading Symbols62481
Node: Writing Symbols63655
Node: Mini Symbols65345
Node: typedef asymbol66310
Node: symbol handling functions71539
Node: Archives75866
Node: Formats79484
Node: Relocations82294
Node: typedef arelent83014
Node: howto manager99173
Node: Core Files129772
Node: Targets130793
Node: bfd_target132756
Node: Architectures151670
Node: Opening and Closing166892
Node: Internal171289
Node: File Caching177289
Node: Linker Functions180068
Node: Creating a Linker Hash Table181734
Node: Adding Symbols to the Hash Table183462
Node: Differing file formats184352
Node: Adding symbols from an object file186085
Node: Adding symbols from an archive188221
Node: Performing the Final Link190620
Node: Information provided by the linker191851
Node: Relocating the section contents192987
Node: Writing the symbol table194724
Node: Hash Tables197318
Node: Creating and Freeing a Hash Table198509
Node: Looking Up or Entering a String199666
Node: Traversing a Hash Table200908
Node: Deriving a New Hash Table Type201686
Node: Define the Derived Structures202741
Node: Write the Derived Creation Routine203807
Node: Write Other Derived Routines206506
Node: BFD back ends207806
Node: What to Put Where208050
Node: aout208188
Node: coff214313
Node: elf241469
Node: GNU Free Documentation License242302
Node: Index260724

End Tag Table

View File

@ -6,21 +6,14 @@ END-INFO-DIR-ENTRY
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 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.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
section entitled "GNU Free Documentation License".

File: bfd.info, Node: Top, Next: Overview, Prev: (dir), Up: (dir)
@ -32,6 +25,7 @@ File: bfd.info, Node: Top, Next: Overview, Prev: (dir), Up: (dir)
* 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

@ -641,6 +635,36 @@ Set the flag word in the BFD ABFD to the value FLAGS.
was made to set the `D_PAGED' bit on a BFD format which does not
support demand paging.
`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.
`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.
`bfd_set_start_address'
.......................
@ -679,7 +703,7 @@ results were guaranteed.
Instead, we want to ask questions like "is this NNN byte sized
object I'm about to try read from file offset YYY reasonable?" As as
example of where we might do this, some object formats use string
tables for which the first `sizeof(long)' bytes of the table contain
tables for which the first `sizeof (long)' bytes of the table contain
the size of the table itself, including the size bytes. If an
application tries to read what it thinks is one of these string tables,
without some way to validate the size, and for some reason the size is

View File

@ -6,21 +6,14 @@ END-INFO-DIR-ENTRY
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 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.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
section entitled "GNU Free Documentation License".

File: bfd.info, Node: typedef asection, Next: section prototypes, Prev: Section Output, Up: Sections
@ -46,10 +39,6 @@ typedef asection
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
@ -57,7 +46,11 @@ typedef asection
/* 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;
/* A unique sequence number. */
int id;
/* Which section is it; 0..nth. */
@ -76,8 +69,7 @@ typedef asection
#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. */
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.
@ -92,8 +84,7 @@ typedef asection
#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. */
@ -143,6 +134,14 @@ typedef asection
sections. */
#define SEC_COFF_SHARED_LIBRARY 0x800
/* 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
@ -157,9 +156,8 @@ typedef asection
#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. */
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
@ -217,6 +215,16 @@ typedef asection
executables or shared objects. */
#define SEC_SHARED 0x4000000
/* 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
/* Conditionally link this section; do not link if there are no
references found to any symbol in the section. */
#define SEC_CLINK 0x10000000
/* End of section flags. */
/* Some internal packed boolean fields. */
@ -233,6 +241,9 @@ typedef asection
/* A mark flag used by some linker backends for garbage collection. */
unsigned int gc_mark : 1;
/* Used by the ELF code to mark sections which have been allocated to segments. */
unsigned int segment_mark : 1;
/* End of internal packed boolean fields. */
/* The virtual memory address of the section - where it will be
@ -298,19 +309,19 @@ typedef asection
/* Information below is back end specific - and not always used
or updated. */
/* File position of section data */
/* File position of section data. */
file_ptr filepos;
/* File position of relocation info */
/* File position of relocation info. */
file_ptr rel_filepos;
/* File position of line data */
/* File position of line data. */
file_ptr line_filepos;
/* Pointer to data for applications */
/* Pointer to data for applications. */
PTR userdata;
@ -318,24 +329,28 @@ typedef asection
contents. */
unsigned char *contents;
/* Attached line number information */
/* Attached line number information. */
alent *lineno;
/* Number of line number records */
/* Number of line number records. */
unsigned int lineno_count;
/* Optional information about a COMDAT entry; NULL if not COMDAT */
/* Optional information about a COMDAT entry; NULL if not COMDAT. */
struct bfd_comdat_info *comdat;
/* Points to the kept section if this section is a link-once section,
and is discarded. */
struct sec *kept_section;
/* When a section is being output, this value changes as more
linenumbers are written out */
linenumbers are written out. */
file_ptr moving_line_filepos;
/* What the section number is in the target world */
/* What the section number is in the target world. */
int target_index;
@ -407,7 +422,7 @@ Section prototypes
.........................
*Synopsis*
asection *bfd_get_section_by_name(bfd *abfd, CONST char *name);
asection *bfd_get_section_by_name(bfd *abfd, const char *name);
*Description*
Run through ABFD and return the one of the `asection's whose name
matches NAME, otherwise `NULL'. *Note Sections::, for more information.
@ -417,11 +432,24 @@ all sections of a given name is to use `bfd_map_over_sections' and
`strcmp' on the name (or better yet, base it on the section flags or
something else) for each section.
`bfd_get_unique_section_name'
.............................
*Synopsis*
char *bfd_get_unique_section_name(bfd *abfd,
const char *templat,
int *count);
*Description*
Invent a section name that is unique in ABFD by tacking a dot and a
digit suffix onto the original TEMPLAT. If COUNT is non-NULL, then it
specifies the first number tried as a suffix to generate a unique name.
The value pointed to by COUNT will be incremented in this case.
`bfd_make_section_old_way'
..........................
*Synopsis*
asection *bfd_make_section_old_way(bfd *abfd, CONST char *name);
asection *bfd_make_section_old_way(bfd *abfd, const char *name);
*Description*
Create a new empty section called NAME and attach it to the end of the
chain of sections for the BFD ABFD. An attempt to create a section with
@ -441,7 +469,7 @@ was rewritten....
.........................
*Synopsis*
asection *bfd_make_section_anyway(bfd *abfd, CONST char *name);
asection *bfd_make_section_anyway(bfd *abfd, const char *name);
*Description*
Create a new empty section called NAME and attach it to the end of the
chain of sections for ABFD. Create a new section even if there is
@ -457,7 +485,7 @@ already a section with that name.
..................
*Synopsis*
asection *bfd_make_section(bfd *, CONST char *name);
asection *bfd_make_section(bfd *, const char *name);
*Description*
Like `bfd_make_section_anyway', but return `NULL' (without calling
bfd_set_error ()) without changing the section chain if there is
@ -483,7 +511,7 @@ returns are:
*Synopsis*
void bfd_map_over_sections(bfd *abfd,
void (*func)(bfd *abfd,
void (*func) (bfd *abfd,
asection *sect,
PTR obj),
PTR obj);
@ -955,8 +983,8 @@ for an unknown class.
*Synopsis*
int bfd_decode_symclass(asymbol *symbol);
`bfd_is_undefined_symclass '
............................
`bfd_is_undefined_symclass'
...........................
*Description*
Returns non-zero if the class symbol returned by bfd_decode_symclass

View File

@ -6,21 +6,14 @@ END-INFO-DIR-ENTRY
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 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.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
section entitled "GNU Free Documentation License".

File: bfd.info, Node: typedef arelent, Next: howto manager, Prev: Relocations, Up: Relocations
@ -721,6 +714,16 @@ attributes.
- : BFD_RELOC_386_GOTPC
i386/elf relocations
- : BFD_RELOC_X86_64_GOT32
- : BFD_RELOC_X86_64_PLT32
- : BFD_RELOC_X86_64_COPY
- : BFD_RELOC_X86_64_GLOB_DAT
- : BFD_RELOC_X86_64_JUMP_SLOT
- : BFD_RELOC_X86_64_RELATIVE
- : BFD_RELOC_X86_64_GOTPCREL
- : BFD_RELOC_X86_64_32S
x86-64/elf relocations
- : BFD_RELOC_NS32K_IMM_8
- : BFD_RELOC_NS32K_IMM_16
- : BFD_RELOC_NS32K_IMM_32
@ -788,6 +791,16 @@ attributes.
ARM 26 bit pc-relative branch. The lowest two bits must be zero
and are not stored in the instruction.
- : BFD_RELOC_ARM_PCREL_BLX
ARM 26 bit pc-relative branch. The lowest bit must be zero and is
not stored in the instruction. The 2nd lowest bit comes from a 1
bit field in the instruction.
- : BFD_RELOC_THUMB_PCREL_BLX
Thumb 22 bit pc-relative branch. The lowest bit must be zero and
is not stored in the instruction. The 2nd lowest bit comes from a
1 bit field in the instruction.
- : BFD_RELOC_ARM_IMMEDIATE
- : BFD_RELOC_ARM_ADRL_IMMEDIATE
- : BFD_RELOC_ARM_OFFSET_IMM
@ -835,6 +848,13 @@ attributes.
- : 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
Hitachi SH relocs. Not all of these appear in object files.
- : BFD_RELOC_THUMB_PCREL_BRANCH9
@ -844,10 +864,9 @@ attributes.
be zero and is not stored in the instruction.
- : BFD_RELOC_ARC_B22_PCREL
Argonaut RISC Core (ARC) 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.
ARC Cores relocs. ARC 22 bit pc-relative branch. The lowest two
bits must be zero and are not stored in the instruction. The high
20 bits are installed in bits 26 through 7 of the instruction.
- : BFD_RELOC_ARC_B26
ARC 26 bit absolute branch. The lowest two bits must be zero and
@ -1009,6 +1028,28 @@ attributes.
significant 8 bits of a 24 bit word are placed into the least
significant 8 bits of the opcode.
- : BFD_RELOC_TIC54X_PARTLS7
This is a 7bit reloc for the tms320c54x, where the least
significant 7 bits of a 16 bit word are placed into the least
significant 7 bits of the opcode.
- : BFD_RELOC_TIC54X_PARTMS9
This is a 9bit DP reloc for the tms320c54x, where the most
significant 9 bits of a 16 bit word are placed into the least
significant 9 bits of the opcode.
- : BFD_RELOC_TIC54X_23
This is an extended address 23-bit reloc for the tms320c54x.
- : BFD_RELOC_TIC54X_16_OF_23
This is a 16-bit reloc for the tms320c54x, where the least
significant 16 bits of a 23-bit extended address are placed into
the opcode.
- : BFD_RELOC_TIC54X_MS7_OF_23
This is a reloc for the tms320c54x, where the most significant 7
bits of a 23-bit extended address are placed into the opcode.
- : BFD_RELOC_FR30_48
This is a 48 bit reloc for the FR30 that stores 32 bits.
@ -1139,6 +1180,125 @@ attributes.
this offset is stored in the reloc's addend. For Rel hosts, we
are forced to put this offset in the reloc's section offset.
- : BFD_RELOC_IA64_IMM14
- : BFD_RELOC_IA64_IMM22
- : BFD_RELOC_IA64_IMM64
- : BFD_RELOC_IA64_DIR32MSB
- : BFD_RELOC_IA64_DIR32LSB
- : BFD_RELOC_IA64_DIR64MSB
- : BFD_RELOC_IA64_DIR64LSB
- : BFD_RELOC_IA64_GPREL22
- : BFD_RELOC_IA64_GPREL64I
- : BFD_RELOC_IA64_GPREL32MSB
- : BFD_RELOC_IA64_GPREL32LSB
- : BFD_RELOC_IA64_GPREL64MSB
- : BFD_RELOC_IA64_GPREL64LSB
- : BFD_RELOC_IA64_LTOFF22
- : BFD_RELOC_IA64_LTOFF64I
- : BFD_RELOC_IA64_PLTOFF22
- : BFD_RELOC_IA64_PLTOFF64I
- : BFD_RELOC_IA64_PLTOFF64MSB
- : BFD_RELOC_IA64_PLTOFF64LSB
- : BFD_RELOC_IA64_FPTR64I
- : BFD_RELOC_IA64_FPTR32MSB
- : BFD_RELOC_IA64_FPTR32LSB
- : BFD_RELOC_IA64_FPTR64MSB
- : BFD_RELOC_IA64_FPTR64LSB
- : BFD_RELOC_IA64_PCREL21B
- : BFD_RELOC_IA64_PCREL21BI
- : BFD_RELOC_IA64_PCREL21M
- : BFD_RELOC_IA64_PCREL21F
- : BFD_RELOC_IA64_PCREL22
- : BFD_RELOC_IA64_PCREL60B
- : BFD_RELOC_IA64_PCREL64I
- : BFD_RELOC_IA64_PCREL32MSB
- : BFD_RELOC_IA64_PCREL32LSB
- : BFD_RELOC_IA64_PCREL64MSB
- : BFD_RELOC_IA64_PCREL64LSB
- : BFD_RELOC_IA64_LTOFF_FPTR22
- : BFD_RELOC_IA64_LTOFF_FPTR64I
- : BFD_RELOC_IA64_LTOFF_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
Intel IA64 Relocations.
- : BFD_RELOC_M68HC11_HI8
Motorola 68HC11 reloc. This is the 8 bits high part of an
absolute address.
- : BFD_RELOC_M68HC11_LO8
Motorola 68HC11 reloc. This is the 8 bits low part of an absolute
address.
- : BFD_RELOC_M68HC11_3B
Motorola 68HC11 reloc. This is the 3 bits of a value.
- : BFD_RELOC_CRIS_BDISP8
- : BFD_RELOC_CRIS_UNSIGNED_5
- : BFD_RELOC_CRIS_SIGNED_6
- : BFD_RELOC_CRIS_UNSIGNED_6
- : BFD_RELOC_CRIS_UNSIGNED_4
These relocs are only used within the CRIS assembler. They are not
(at present) written to any object files.
- : BFD_RELOC_860_COPY
- : BFD_RELOC_860_GLOB_DAT
- : BFD_RELOC_860_JUMP_SLOT
- : BFD_RELOC_860_RELATIVE
- : BFD_RELOC_860_PC26
- : BFD_RELOC_860_PLT26
- : BFD_RELOC_860_PC16
- : BFD_RELOC_860_LOW0
- : BFD_RELOC_860_SPLIT0
- : BFD_RELOC_860_LOW1
- : BFD_RELOC_860_SPLIT1
- : BFD_RELOC_860_LOW2
- : BFD_RELOC_860_SPLIT2
- : BFD_RELOC_860_LOW3
- : BFD_RELOC_860_LOGOT0
- : BFD_RELOC_860_SPGOT0
- : BFD_RELOC_860_LOGOT1
- : BFD_RELOC_860_SPGOT1
- : BFD_RELOC_860_LOGOTOFF0
- : BFD_RELOC_860_SPGOTOFF0
- : BFD_RELOC_860_LOGOTOFF1
- : BFD_RELOC_860_SPGOTOFF1
- : BFD_RELOC_860_LOGOTOFF2
- : BFD_RELOC_860_LOGOTOFF3
- : BFD_RELOC_860_LOPC
- : BFD_RELOC_860_HIGHADJ
- : BFD_RELOC_860_HAGOT
- : BFD_RELOC_860_HAGOTOFF
- : BFD_RELOC_860_HAPC
- : BFD_RELOC_860_HIGH
- : BFD_RELOC_860_HIGOT
- : BFD_RELOC_860_HIGOTOFF
Intel i860 Relocations.
typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;

View File

@ -6,21 +6,14 @@ END-INFO-DIR-ENTRY
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 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.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
section entitled "GNU Free Documentation License".

File: bfd.info, Node: bfd_target, Prev: Targets, Up: Targets
@ -55,13 +48,13 @@ wants to fix this and not break the above, please do.
#endif
For operations which index on the BFD format:
#define BFD_SEND_FMT(bfd, message, arglist) \
(((bfd)->xvec->message[(int)((bfd)->format)]) arglist)
(((bfd)->xvec->message[(int) ((bfd)->format)]) arglist)
#ifdef DEBUG_BFD_SEND
#undef BFD_SEND_FMT
#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
This is the structure which defines the type of BFD this is. The
@ -76,6 +69,7 @@ them both!
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,
@ -417,7 +411,7 @@ the valid BFD targets. Do not modify the names.
......................
*Synopsis*
const bfd_target * bfd_search_for_target (int (* search_func)(const bfd_target *, void *), void *);
const bfd_target * bfd_search_for_target (int (* search_func) (const bfd_target *, void *), void *);
*Description*
Return a pointer to the first transfer vector in the list of transfer
vectors maintained by BFD that produces a non-zero result when passed
@ -504,9 +498,12 @@ i960 KB, and 68020 and 68030 for Motorola 68020 and 68030.
#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
@ -523,10 +520,17 @@ i960 KB, and 68020 and 68030 for Motorola 68020 and 68030.
#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 */
@ -541,13 +545,36 @@ i960 KB, and 68020 and 68030 for Motorola 68020 and 68030.
#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
@ -573,16 +600,22 @@ i960 KB, and 68020 and 68030 for Motorola 68020 and 68030.
#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'
@ -593,12 +626,17 @@ i960 KB, and 68020 and 68030 for Motorola 68020 and 68030.
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
};
@ -618,7 +656,7 @@ This structure contains information on architectures for use within BFD.
const char *arch_name;
const char *printable_name;
unsigned int section_align_power;
/* true if this is the default machine for the architecture */
/* True if this is the default machine for the architecture. */
boolean the_default;
const struct bfd_arch_info * (*compatible)
PARAMS ((const struct bfd_arch_info *a,
@ -802,8 +840,10 @@ targets have 16, 32, or even 48 bits per byte.
unsigned int bfd_arch_mach_octets_per_byte(enum bfd_architecture arch,
unsigned long machine);
*Description*
See bfd_octets_per_byte. This routine is provided for those cases
where a bfd * is not available
See bfd_octets_per_byte.
This routine is provided for those cases where a bfd * is not
available

File: bfd.info, Node: Opening and Closing, Next: Internal, Prev: Architectures, Up: BFD front end
@ -1000,13 +1040,13 @@ less than a `bfd_vma', use `gcc -Wconversion' on a host with 64 bit
/* 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)))
@ -1148,7 +1188,7 @@ 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))
`bfd_cache_init'
@ -1234,59 +1274,3 @@ throughout this section.
* Adding Symbols to the Hash Table::
* Performing the Final Link::

File: bfd.info, Node: Creating a Linker Hash Table, Next: Adding Symbols to the Hash Table, Prev: Linker Functions, Up: Linker Functions
Creating a linker hash table
----------------------------
The linker routines must create a hash table, which must be derived
from `struct bfd_link_hash_table' described in `bfdlink.c'. *Note Hash
Tables::, for information on how to create a derived hash table. This
entry point is called using the target vector of the linker output file.
The `_bfd_link_hash_table_create' entry point must allocate and
initialize an instance of the desired hash table. If the back end does
not require any additional information to be stored with the entries in
the hash table, the entry point may simply create a `struct
bfd_link_hash_table'. Most likely, however, some additional
information will be needed.
For example, with each entry in the hash table the a.out linker
keeps the index the symbol has in the final output file (this index
number is used so that when doing a relocateable link the symbol index
used in the output file can be quickly filled in when copying over a
reloc). The a.out linker code defines the required structures and
functions for a hash table derived from `struct bfd_link_hash_table'.
The a.out linker hash table is created by the function
`NAME(aout,link_hash_table_create)'; it simply allocates space for the
hash table, initializes it, and returns a pointer to it.
When writing the linker routines for a new back end, you will
generally not know exactly which fields will be required until you have
finished. You should simply create a new hash table which defines no
additional fields, and then simply add fields as they become necessary.

File: bfd.info, Node: Adding Symbols to the Hash Table, Next: Performing the Final Link, Prev: Creating a Linker Hash Table, Up: Linker Functions
Adding symbols to the hash table
--------------------------------
The linker proper will call the `_bfd_link_add_symbols' entry point
for each object file or archive which is to be linked (typically these
are the files named on the command line, but some may also come from
the linker script). The entry point is responsible for examining the
file. For an object file, BFD must add any relevant symbol information
to the hash table. For an archive, BFD must determine which elements
of the archive should be used and adding them to the link.
The a.out version of this entry point is
`NAME(aout,link_add_symbols)'.
* Menu:
* Differing file formats::
* Adding symbols from an object file::
* Adding symbols from an archive::

View File

@ -6,21 +6,70 @@ END-INFO-DIR-ENTRY
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".
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.

File: bfd.info, Node: Creating a Linker Hash Table, Next: Adding Symbols to the Hash Table, Prev: Linker Functions, Up: Linker Functions
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions.
Creating a linker hash table
----------------------------
The linker routines must create a hash table, which must be derived
from `struct bfd_link_hash_table' described in `bfdlink.c'. *Note Hash
Tables::, for information on how to create a derived hash table. This
entry point is called using the target vector of the linker output file.
The `_bfd_link_hash_table_create' entry point must allocate and
initialize an instance of the desired hash table. If the back end does
not require any additional information to be stored with the entries in
the hash table, the entry point may simply create a `struct
bfd_link_hash_table'. Most likely, however, some additional
information will be needed.
For example, with each entry in the hash table the a.out linker
keeps the index the symbol has in the final output file (this index
number is used so that when doing a relocateable link the symbol index
used in the output file can be quickly filled in when copying over a
reloc). The a.out linker code defines the required structures and
functions for a hash table derived from `struct bfd_link_hash_table'.
The a.out linker hash table is created by the function
`NAME(aout,link_hash_table_create)'; it simply allocates space for the
hash table, initializes it, and returns a pointer to it.
When writing the linker routines for a new back end, you will
generally not know exactly which fields will be required until you have
finished. You should simply create a new hash table which defines no
additional fields, and then simply add fields as they become necessary.

File: bfd.info, Node: Adding Symbols to the Hash Table, Next: Performing the Final Link, Prev: Creating a Linker Hash Table, Up: Linker Functions
Adding symbols to the hash table
--------------------------------
The linker proper will call the `_bfd_link_add_symbols' entry point
for each object file or archive which is to be linked (typically these
are the files named on the command line, but some may also come from
the linker script). The entry point is responsible for examining the
file. For an object file, BFD must add any relevant symbol information
to the hash table. For an archive, BFD must determine which elements
of the archive should be used and adding them to the link.
The a.out version of this entry point is
`NAME(aout,link_add_symbols)'.
* Menu:
* Differing file formats::
* Adding symbols from an object file::
* Adding symbols from an archive::

File: bfd.info, Node: Differing file formats, Next: Adding symbols from an object file, Prev: Adding Symbols to the Hash Table, Up: Adding Symbols to the Hash Table
@ -532,7 +581,7 @@ table, uses macros for the lookup and traversal routines. These are
`aout_link_hash_lookup' and `aout_link_hash_traverse' in aoutx.h.

File: bfd.info, Node: BFD back ends, Next: Index, Prev: BFD front end, Up: Top
File: bfd.info, Node: BFD back ends, Next: GNU Free Documentation License, Prev: BFD front end, Up: Top
BFD back ends
*************
@ -680,7 +729,7 @@ the buffer RAW_BYTES ready for writing to disk.
*Synopsis*
const bfd_target *aout_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 ABFD checking is an
a.out file. Do some more checking, and set up for access if it really

View File

@ -6,21 +6,14 @@ END-INFO-DIR-ENTRY
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 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.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
section entitled "GNU Free Documentation License".

File: bfd.info, Node: coff, Next: elf, Prev: aout, Up: BFD back ends
@ -362,6 +355,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,
@ -559,6 +554,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))
@ -681,3 +682,353 @@ them. Sun's .stabstr, in particular, isn't even pointed to by the
.stab section, so ordinary mechanisms wouldn't work to find it, even if
we had some.

File: bfd.info, Node: GNU Free Documentation License, Next: Index, Prev: BFD back ends, Up: Top
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:
Copyright (c) YEAR YOUR NAME.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1
or any later version published by the Free Software Foundation;
with the Invariant Sections being LIST THEIR TITLES, with the
Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
If you have no Invariant Sections, write "with no Invariant Sections"
instead of saying which ones are invariant. If you have no Front-Cover
Texts, write "no Front-Cover Texts" instead of "Front-Cover Texts being
LIST"; likewise for Back-Cover Texts.
If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of
free software license, such as the GNU General Public License, to
permit their use in free software.

View File

@ -6,24 +6,17 @@ END-INFO-DIR-ENTRY
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 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.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
section entitled "GNU Free Documentation License".

File: bfd.info, Node: Index, Prev: BFD back ends, Up: Top
File: bfd.info, Node: Index, Prev: GNU Free Documentation License, Up: Top
Index
*****
@ -89,6 +82,7 @@ Index
* bfd_generic_relax_section: howto manager.
* bfd_get_arch: Architectures.
* bfd_get_arch_info: Architectures.
* bfd_get_arch_size: BFD front end.
* bfd_get_error: BFD front end.
* bfd_get_error_handler: BFD front end.
* bfd_get_gp_size: BFD front end.
@ -100,9 +94,11 @@ Index
* bfd_get_reloc_upper_bound: BFD front end.
* bfd_get_section_by_name: section prototypes.
* bfd_get_section_contents: section prototypes.
* bfd_get_sign_extend_vma: BFD front end.
* bfd_get_size <1>: Internal.
* bfd_get_size: BFD front end.
* bfd_get_symtab_upper_bound: symbol handling functions.
* bfd_get_unique_section_name: section prototypes.
* bfd_h_put_size: Internal.
* bfd_hash_allocate: Creating and Freeing a Hash Table.
* bfd_hash_lookup: Looking Up or Entering a String.
@ -178,6 +174,38 @@ Index
* BFD_RELOC_68K_JMP_SLOT: howto manager.
* BFD_RELOC_68K_RELATIVE: howto manager.
* BFD_RELOC_8: howto manager.
* BFD_RELOC_860_COPY: howto manager.
* BFD_RELOC_860_GLOB_DAT: howto manager.
* BFD_RELOC_860_HAGOT: howto manager.
* BFD_RELOC_860_HAGOTOFF: howto manager.
* BFD_RELOC_860_HAPC: howto manager.
* BFD_RELOC_860_HIGH: howto manager.
* BFD_RELOC_860_HIGHADJ: howto manager.
* BFD_RELOC_860_HIGOT: howto manager.
* BFD_RELOC_860_HIGOTOFF: howto manager.
* BFD_RELOC_860_JUMP_SLOT: howto manager.
* BFD_RELOC_860_LOGOT0: howto manager.
* BFD_RELOC_860_LOGOT1: howto manager.
* BFD_RELOC_860_LOGOTOFF0: howto manager.
* BFD_RELOC_860_LOGOTOFF1: howto manager.
* BFD_RELOC_860_LOGOTOFF2: howto manager.
* BFD_RELOC_860_LOGOTOFF3: howto manager.
* BFD_RELOC_860_LOPC: howto manager.
* BFD_RELOC_860_LOW0: howto manager.
* BFD_RELOC_860_LOW1: howto manager.
* BFD_RELOC_860_LOW2: howto manager.
* BFD_RELOC_860_LOW3: howto manager.
* BFD_RELOC_860_PC16: howto manager.
* BFD_RELOC_860_PC26: howto manager.
* BFD_RELOC_860_PLT26: howto manager.
* BFD_RELOC_860_RELATIVE: howto manager.
* BFD_RELOC_860_SPGOT0: howto manager.
* BFD_RELOC_860_SPGOT1: howto manager.
* BFD_RELOC_860_SPGOTOFF0: howto manager.
* BFD_RELOC_860_SPGOTOFF1: howto manager.
* BFD_RELOC_860_SPLIT0: howto manager.
* BFD_RELOC_860_SPLIT1: howto manager.
* BFD_RELOC_860_SPLIT2: howto manager.
* BFD_RELOC_8_BASEREL: howto manager.
* BFD_RELOC_8_FFnn: howto manager.
* BFD_RELOC_8_GOT_PCREL: howto manager.
@ -221,6 +249,7 @@ Index
* BFD_RELOC_ARM_MULTI: howto manager.
* BFD_RELOC_ARM_OFFSET_IMM: howto manager.
* BFD_RELOC_ARM_OFFSET_IMM8: howto manager.
* BFD_RELOC_ARM_PCREL_BLX: howto manager.
* BFD_RELOC_ARM_PCREL_BRANCH: howto manager.
* BFD_RELOC_ARM_PLT32: howto manager.
* BFD_RELOC_ARM_RELATIVE: howto manager.
@ -247,6 +276,11 @@ Index
* BFD_RELOC_AVR_LO8_LDI_PM: howto manager.
* BFD_RELOC_AVR_LO8_LDI_PM_NEG: howto manager.
* bfd_reloc_code_type: howto manager.
* BFD_RELOC_CRIS_BDISP8: howto manager.
* BFD_RELOC_CRIS_SIGNED_6: howto manager.
* BFD_RELOC_CRIS_UNSIGNED_4: howto manager.
* BFD_RELOC_CRIS_UNSIGNED_5: howto manager.
* BFD_RELOC_CRIS_UNSIGNED_6: howto manager.
* BFD_RELOC_CTOR: howto manager.
* BFD_RELOC_D10V_10_PCREL_L: howto manager.
* BFD_RELOC_D10V_10_PCREL_R: howto manager.
@ -284,6 +318,70 @@ Index
* BFD_RELOC_HI22: howto manager.
* BFD_RELOC_I370_D12: howto manager.
* BFD_RELOC_I960_CALLJ: howto manager.
* BFD_RELOC_IA64_COPY: howto manager.
* BFD_RELOC_IA64_DIR32LSB: howto manager.
* BFD_RELOC_IA64_DIR32MSB: howto manager.
* BFD_RELOC_IA64_DIR64LSB: howto manager.
* BFD_RELOC_IA64_DIR64MSB: howto manager.
* BFD_RELOC_IA64_FPTR32LSB: howto manager.
* BFD_RELOC_IA64_FPTR32MSB: howto manager.
* BFD_RELOC_IA64_FPTR64I: howto manager.
* BFD_RELOC_IA64_FPTR64LSB: howto manager.
* BFD_RELOC_IA64_FPTR64MSB: howto manager.
* BFD_RELOC_IA64_GPREL22: howto manager.
* BFD_RELOC_IA64_GPREL32LSB: howto manager.
* BFD_RELOC_IA64_GPREL32MSB: howto manager.
* BFD_RELOC_IA64_GPREL64I: howto manager.
* BFD_RELOC_IA64_GPREL64LSB: howto manager.
* BFD_RELOC_IA64_GPREL64MSB: howto manager.
* BFD_RELOC_IA64_IMM14: howto manager.
* BFD_RELOC_IA64_IMM22: howto manager.
* BFD_RELOC_IA64_IMM64: howto manager.
* BFD_RELOC_IA64_IPLTLSB: howto manager.
* BFD_RELOC_IA64_IPLTMSB: howto manager.
* BFD_RELOC_IA64_LDXMOV: howto manager.
* BFD_RELOC_IA64_LTOFF22: howto manager.
* BFD_RELOC_IA64_LTOFF22X: howto manager.
* BFD_RELOC_IA64_LTOFF64I: howto manager.
* BFD_RELOC_IA64_LTOFF_FPTR22: howto manager.
* BFD_RELOC_IA64_LTOFF_FPTR64I: howto manager.
* BFD_RELOC_IA64_LTOFF_FPTR64LSB: howto manager.
* BFD_RELOC_IA64_LTOFF_FPTR64MSB: howto manager.
* BFD_RELOC_IA64_LTOFF_TP22: howto manager.
* BFD_RELOC_IA64_LTV32LSB: howto manager.
* BFD_RELOC_IA64_LTV32MSB: howto manager.
* BFD_RELOC_IA64_LTV64LSB: howto manager.
* BFD_RELOC_IA64_LTV64MSB: howto manager.
* BFD_RELOC_IA64_PCREL21B: howto manager.
* BFD_RELOC_IA64_PCREL21BI: howto manager.
* BFD_RELOC_IA64_PCREL21F: howto manager.
* BFD_RELOC_IA64_PCREL21M: howto manager.
* BFD_RELOC_IA64_PCREL22: howto manager.
* BFD_RELOC_IA64_PCREL32LSB: howto manager.
* BFD_RELOC_IA64_PCREL32MSB: howto manager.
* BFD_RELOC_IA64_PCREL60B: howto manager.
* BFD_RELOC_IA64_PCREL64I: howto manager.
* BFD_RELOC_IA64_PCREL64LSB: howto manager.
* BFD_RELOC_IA64_PCREL64MSB: howto manager.
* BFD_RELOC_IA64_PLTOFF22: howto manager.
* BFD_RELOC_IA64_PLTOFF64I: howto manager.
* BFD_RELOC_IA64_PLTOFF64LSB: howto manager.
* BFD_RELOC_IA64_PLTOFF64MSB: howto manager.
* BFD_RELOC_IA64_REL32LSB: howto manager.
* BFD_RELOC_IA64_REL32MSB: howto manager.
* BFD_RELOC_IA64_REL64LSB: howto manager.
* BFD_RELOC_IA64_REL64MSB: howto manager.
* BFD_RELOC_IA64_SECREL32LSB: howto manager.
* BFD_RELOC_IA64_SECREL32MSB: howto manager.
* BFD_RELOC_IA64_SECREL64LSB: howto manager.
* BFD_RELOC_IA64_SECREL64MSB: howto manager.
* BFD_RELOC_IA64_SEGREL32LSB: howto manager.
* BFD_RELOC_IA64_SEGREL32MSB: howto manager.
* BFD_RELOC_IA64_SEGREL64LSB: howto manager.
* BFD_RELOC_IA64_SEGREL64MSB: howto manager.
* BFD_RELOC_IA64_TPREL22: howto manager.
* BFD_RELOC_IA64_TPREL64LSB: howto manager.
* BFD_RELOC_IA64_TPREL64MSB: howto manager.
* BFD_RELOC_LO10: howto manager.
* BFD_RELOC_LO16: howto manager.
* BFD_RELOC_LO16_BASEREL: howto manager.
@ -297,6 +395,9 @@ Index
* BFD_RELOC_M32R_HI16_ULO: howto manager.
* BFD_RELOC_M32R_LO16: howto manager.
* BFD_RELOC_M32R_SDA16: howto manager.
* BFD_RELOC_M68HC11_3B: howto manager.
* BFD_RELOC_M68HC11_HI8: howto manager.
* BFD_RELOC_M68HC11_LO8: howto manager.
* BFD_RELOC_MCORE_PCREL_32: howto manager.
* BFD_RELOC_MCORE_PCREL_IMM11BY2: howto manager.
* BFD_RELOC_MCORE_PCREL_IMM4BY2: howto manager.
@ -375,19 +476,26 @@ Index
* BFD_RELOC_RVA: howto manager.
* BFD_RELOC_SH_ALIGN: howto manager.
* BFD_RELOC_SH_CODE: howto manager.
* BFD_RELOC_SH_COPY: howto manager.
* BFD_RELOC_SH_COUNT: howto manager.
* BFD_RELOC_SH_DATA: howto manager.
* BFD_RELOC_SH_GLOB_DAT: howto manager.
* BFD_RELOC_SH_GOTPC: howto manager.
* BFD_RELOC_SH_IMM4: howto manager.
* BFD_RELOC_SH_IMM4BY2: howto manager.
* BFD_RELOC_SH_IMM4BY4: howto manager.
* BFD_RELOC_SH_IMM8: howto manager.
* BFD_RELOC_SH_IMM8BY2: howto manager.
* BFD_RELOC_SH_IMM8BY4: howto manager.
* BFD_RELOC_SH_JMP_SLOT: howto manager.
* BFD_RELOC_SH_LABEL: howto manager.
* BFD_RELOC_SH_LOOP_END: howto manager.
* BFD_RELOC_SH_LOOP_START: howto manager.
* BFD_RELOC_SH_PCDISP12BY2: howto manager.
* BFD_RELOC_SH_PCDISP8BY2: howto manager.
* BFD_RELOC_SH_PCRELIMM8BY2: howto manager.
* BFD_RELOC_SH_PCRELIMM8BY4: howto manager.
* BFD_RELOC_SH_RELATIVE: howto manager.
* BFD_RELOC_SH_SWITCH16: howto manager.
* BFD_RELOC_SH_SWITCH32: howto manager.
* BFD_RELOC_SH_USES: howto manager.
@ -431,10 +539,16 @@ Index
* BFD_RELOC_SPARC_WDISP19: howto manager.
* BFD_RELOC_SPARC_WDISP22: howto manager.
* BFD_RELOC_SPARC_WPLT30: howto manager.
* BFD_RELOC_THUMB_PCREL_BLX: howto manager.
* BFD_RELOC_THUMB_PCREL_BRANCH12: howto manager.
* BFD_RELOC_THUMB_PCREL_BRANCH23: howto manager.
* BFD_RELOC_THUMB_PCREL_BRANCH9: howto manager.
* BFD_RELOC_TIC30_LDP: howto manager.
* BFD_RELOC_TIC54X_16_OF_23: howto manager.
* BFD_RELOC_TIC54X_23: howto manager.
* BFD_RELOC_TIC54X_MS7_OF_23: howto manager.
* BFD_RELOC_TIC54X_PARTLS7: howto manager.
* BFD_RELOC_TIC54X_PARTMS9: howto manager.
* bfd_reloc_type_lookup: howto manager.
* BFD_RELOC_V850_22_PCREL: howto manager.
* BFD_RELOC_V850_9_PCREL: howto manager.
@ -454,6 +568,14 @@ Index
* BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET: howto manager.
* BFD_RELOC_VTABLE_ENTRY: howto manager.
* BFD_RELOC_VTABLE_INHERIT: howto manager.
* BFD_RELOC_X86_64_32S: howto manager.
* BFD_RELOC_X86_64_COPY: howto manager.
* BFD_RELOC_X86_64_GLOB_DAT: howto manager.
* BFD_RELOC_X86_64_GOT32: howto manager.
* BFD_RELOC_X86_64_GOTPCREL: howto manager.
* BFD_RELOC_X86_64_JUMP_SLOT: howto manager.
* BFD_RELOC_X86_64_PLT32: howto manager.
* BFD_RELOC_X86_64_RELATIVE: howto manager.
* bfd_scan_arch: Architectures.
* bfd_scan_vma: BFD front end.
* bfd_seach_for_target: bfd_target.
@ -478,6 +600,7 @@ Index
* bfd_write_bigendian_4byte_int: Internal.
* coff_symbol_type: coff.
* core_file_matches_executable_p: Core Files.
* GNU Free Documentation License: GNU Free Documentation License.
* Hash tables: Hash Tables.
* internal object-file format: Canonical format.
* Linker: Linker Functions.

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

@ -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

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,
@ -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

@ -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

@ -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,7 +107,7 @@ Here is the section structure:
@example
/* This structure is used for a comdat section, as in PE. A comdat
/* 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. */
@ -122,10 +122,6 @@ 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
@ -133,7 +129,11 @@ 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. */
CONST char *name;
const char *name;
/* A unique sequence number. */
int id;
/* Which section is it; 0..nth. */
@ -152,8 +152,7 @@ typedef struct sec
#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. */
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.
@ -168,8 +167,7 @@ typedef struct sec
#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. */
@ -219,6 +217,14 @@ typedef struct sec
sections. */
#define SEC_COFF_SHARED_LIBRARY 0x800
/* 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
@ -233,9 +239,8 @@ typedef struct sec
#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. */
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
@ -293,6 +298,16 @@ typedef struct sec
executables or shared objects. */
#define SEC_SHARED 0x4000000
/* 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
/* Conditionally link this section; do not link if there are no
references found to any symbol in the section. */
#define SEC_CLINK 0x10000000
/* End of section flags. */
/* Some internal packed boolean fields. */
@ -309,6 +324,9 @@ typedef struct sec
/* A mark flag used by some linker backends for garbage collection. */
unsigned int gc_mark : 1;
/* Used by the ELF code to mark sections which have been allocated to segments. */
unsigned int segment_mark : 1;
/* End of internal packed boolean fields. */
/* The virtual memory address of the section - where it will be
@ -374,19 +392,19 @@ typedef struct sec
/* Information below is back end specific - and not always used
or updated. */
/* File position of section data */
/* File position of section data. */
file_ptr filepos;
/* File position of relocation info */
/* File position of relocation info. */
file_ptr rel_filepos;
/* File position of line data */
/* File position of line data. */
file_ptr line_filepos;
/* Pointer to data for applications */
/* Pointer to data for applications. */
PTR userdata;
@ -394,24 +412,28 @@ typedef struct sec
contents. */
unsigned char *contents;
/* Attached line number information */
/* Attached line number information. */
alent *lineno;
/* Number of line number records */
/* Number of line number records. */
unsigned int lineno_count;
/* Optional information about a COMDAT entry; NULL if not COMDAT */
/* Optional information about a COMDAT entry; NULL if not COMDAT. */
struct bfd_comdat_info *comdat;
/* Points to the kept section if this section is a link-once section,
and is discarded. */
struct sec *kept_section;
/* When a section is being output, this value changes as more
linenumbers are written out */
linenumbers are written out. */
file_ptr moving_line_filepos;
/* What the section number is in the target world */
/* What the section number is in the target world. */
int target_index;
@ -434,7 +456,7 @@ typedef struct sec
struct bfd_link_order *link_order_tail;
@} asection ;
/* These sections are global, and are managed by BFD. The application
/* 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
@ -444,18 +466,18 @@ typedef struct sec
#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

@ -377,7 +377,7 @@ class of @var{symbol}, or '?' for an unknown class.
int bfd_decode_symclass(asymbol *symbol);
@end example
@findex bfd_is_undefined_symclass
@subsubsection @code{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

@ -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
@ -116,6 +116,7 @@ enum bfd_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
@ -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,5 +1,5 @@
/* 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).
@ -85,8 +85,6 @@ struct dwarf1_unit {
struct dwarf1_func* func_list;
};
/* One dwarf1_func for each parsed function die. */
struct dwarf1_func {
@ -101,7 +99,6 @@ struct dwarf1_func {
unsigned long high_pc;
};
/* Used to return info about a parsed die. */
struct die_info {
unsigned long length;
@ -117,7 +114,6 @@ struct die_info {
unsigned short tag;
};
/* Parsed line number information. */
struct linenumber {
/* First address in the line. */
@ -127,11 +123,9 @@ struct linenumber {
unsigned long linenumber;
};
/* 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'. */
@ -181,10 +175,10 @@ 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);
aDieInfo->length = bfd_get_32 (abfd, (bfd_byte *) xptr);
xptr += 4;
if (aDieInfo->length == 0)
return false;
@ -196,7 +190,7 @@ parse_die (abfd, aDieInfo, aDiePtr)
}
/* Then the tag. */
aDieInfo->tag = bfd_get_16 (abfd, xptr);
aDieInfo->tag = bfd_get_16 (abfd, (bfd_byte *) xptr);
xptr += 2;
/* Then the attributes. */
@ -208,7 +202,7 @@ parse_die (abfd, aDieInfo, aDiePtr)
must handle all dwarf1 forms, but need only handle the
actual attributes that we care about. */
attr = bfd_get_16 (abfd, xptr);
attr = bfd_get_16 (abfd, (bfd_byte *) xptr);
xptr += 2;
switch (FORM_FROM_ATTR (attr))
@ -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)
@ -276,7 +270,7 @@ parse_line_table (stash, aUnit)
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;
@ -299,11 +293,11 @@ parse_line_table (stash, aUnit)
unsigned long base;
/* First comes the length. */
tblend = bfd_get_32 (stash->abfd, xptr) + xptr;
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);
base = bfd_get_32 (stash->abfd, (bfd_byte *) xptr);
xptr += 4;
/* How many line entrys?
@ -311,7 +305,7 @@ parse_line_table (stash, aUnit)
aUnit->line_count = (tblend - xptr) / 10;
/* Allocate an array for the entries. */
aUnit->linenumber_table = (struct linenumber*)
aUnit->linenumber_table = (struct linenumber *)
bfd_alloc (stash->abfd,
sizeof (struct linenumber) * aUnit->line_count);
@ -319,7 +313,7 @@ parse_line_table (stash, aUnit)
{
/* 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. */
@ -327,7 +321,7 @@ parse_line_table (stash, aUnit)
/* And finally the address. */
aUnit->linenumber_table[eachLine].addr
= base + bfd_get_32 (stash->abfd, xptr);
= base + bfd_get_32 (stash->abfd, (bfd_byte *) xptr);
xptr += 4;
}
}
@ -445,9 +439,6 @@ 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. */
@ -473,7 +464,6 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
*functionname_ptr = NULL;
*linenumber_ptr = 0;
if (! stash)
{
asection *msec;
@ -495,7 +485,7 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
}
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;
@ -517,7 +507,6 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
if (! stash->debug_section)
return false;
/* Look at the previously parsed units to see if any contain
the addr. */
for (eachUnit = stash->lastUnit; eachUnit; eachUnit = eachUnit->prev)
@ -574,5 +563,4 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
return false;
}
/* EOF */

View File

@ -36,8 +36,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "elf/dwarf2.h"
/* The data in the .debug_line statement prologue looks like this. */
struct line_head
{
{
unsigned int total_length;
unsigned short version;
unsigned int prologue_length;
@ -47,11 +48,12 @@ struct line_head
unsigned char line_range;
unsigned char opcode_base;
unsigned char *standard_opcode_lengths;
};
};
/* Attributes have a name and a value. */
/* Attributes have a name and a value */
struct attribute
{
{
enum dwarf_attribute name;
enum dwarf_form form;
union
@ -63,9 +65,9 @@ struct attribute
bfd_vma addr;
}
u;
};
};
/* Get at parts of an attribute structure */
/* Get at parts of an attribute structure. */
#define DW_STRING(attr) ((attr)->u.str)
#define DW_UNSND(attr) ((attr)->u.unsnd)
@ -75,20 +77,19 @@ struct attribute
/* Blocks are a bunch of untyped bytes. */
struct dwarf_block
{
{
unsigned int size;
char *data;
};
struct dwarf2_debug {
};
struct dwarf2_debug
{
/* A list of all previously read comp_units. */
struct comp_unit* all_comp_units;
/* The next unread compilation unit within the .debug_info section.
Zero indicates that the .debug_info section has not been loaded
into a buffer yet.*/
into a buffer yet. */
char* info_ptr;
/* Pointer to the end of the .debug_info section memory buffer. */
@ -102,20 +103,23 @@ struct dwarf2_debug {
/* Buffer for decode_line_info. */
char *dwarf_line_buffer;
/* Length of the loaded .debug_line section. */
unsigned long dwarf_line_size;
};
struct arange {
struct arange
{
struct arange *next;
bfd_vma low;
bfd_vma high;
};
/* A minimal decoding of DWARF2 compilation units. We only decode
what's needed to get to the line number information. */
struct comp_unit {
struct comp_unit
{
/* Chain the previously read compilation units. */
struct comp_unit* next_unit;
@ -135,7 +139,7 @@ struct comp_unit {
/* Note that an error was found by comp_unit_find_nearest_line. */
int error;
/* The DW_AT_comp_dir attribute */
/* The DW_AT_comp_dir attribute. */
char* comp_dir;
/* True if there is a line number table associated with this comp. unit. */
@ -156,17 +160,15 @@ struct comp_unit {
/* A list of the functions found in this comp. unit. */
struct funcinfo* function_table;
/* Address size for this unit - from unit header */
/* Address size for this unit - from unit header. */
unsigned char addr_size;
};
/* VERBATIM
The following function up to the END VERBATIM mark are
copied directly from dwarf2read.c. */
/* read dwarf information from a buffer */
/* Read dwarf information from a buffer. */
static unsigned int
read_1_byte (abfd, buf)
@ -192,9 +194,7 @@ read_2_bytes (abfd, buf)
return bfd_get_16 (abfd, (bfd_byte *) buf);
}
#if 0
/* This is not used. */
#if 0 /* This is not used. */
static int
read_2_signed_bytes (abfd, buf)
@ -214,9 +214,7 @@ read_4_bytes (abfd, buf)
return bfd_get_32 (abfd, (bfd_byte *) buf);
}
#if 0
/* This is not used. */
#if 0 /* This is not used. */
static int
read_4_signed_bytes (abfd, buf)
@ -262,6 +260,7 @@ read_string (abfd, buf, bytes_read_ptr)
*bytes_read_ptr = 1;
return NULL;
}
*bytes_read_ptr = strlen (buf) + 1;
return buf;
}
@ -349,26 +348,22 @@ read_address (unit, buf)
}
}
/* This data structure holds the information of an abbrev. */
struct abbrev_info
{
unsigned int number; /* number identifying abbrev */
enum dwarf_tag tag; /* dwarf tag */
int has_children; /* boolean */
unsigned int num_attrs; /* number of attributes */
struct attr_abbrev *attrs; /* an array of attribute descriptions */
struct abbrev_info *next; /* next in chain */
};
{
unsigned int number; /* Number identifying abbrev. */
enum dwarf_tag tag; /* DWARF tag. */
int has_children; /* Boolean. */
unsigned int num_attrs; /* Number of attributes. */
struct attr_abbrev *attrs; /* An array of attribute descriptions. */
struct abbrev_info *next; /* Next in chain. */
};
struct attr_abbrev
{
{
enum dwarf_attribute name;
enum dwarf_form form;
};
};
#ifndef ABBREV_HASH_SIZE
#define ABBREV_HASH_SIZE 121
@ -397,6 +392,7 @@ lookup_abbrev (number,abbrevs)
else
abbrev = abbrev->next;
}
return NULL;
}
@ -406,18 +402,16 @@ lookup_abbrev (number,abbrevs)
in a hash table. */
static struct abbrev_info**
read_abbrevs (abfd, offset)
read_abbrevs (abfd, offset, stash)
bfd * abfd;
unsigned int offset;
struct dwarf2_debug *stash;
{
struct abbrev_info **abbrevs;
char *abbrev_ptr;
struct abbrev_info *cur_abbrev;
unsigned int abbrev_number, bytes_read, abbrev_name;
unsigned int abbrev_form, hash_number;
struct dwarf2_debug *stash;
stash = elf_tdata(abfd)->dwarf2_find_line_info;
if (! stash->dwarf_abbrev_buffer)
{
@ -450,29 +444,30 @@ read_abbrevs (abfd, offset)
return 0;
}
abbrevs = (struct abbrev_info**) bfd_zalloc (abfd, sizeof(struct abbrev_info*) * ABBREV_HASH_SIZE);
abbrevs = (struct abbrev_info**) bfd_zalloc (abfd, sizeof (struct abbrev_info*) * ABBREV_HASH_SIZE);
abbrev_ptr = stash->dwarf_abbrev_buffer + offset;
abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
abbrev_ptr += bytes_read;
/* loop until we reach an abbrev number of 0 */
/* Loop until we reach an abbrev number of 0. */
while (abbrev_number)
{
cur_abbrev = (struct abbrev_info*)bfd_zalloc (abfd, sizeof (struct abbrev_info));
/* read in abbrev header */
/* Read in abbrev header. */
cur_abbrev->number = abbrev_number;
cur_abbrev->tag = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
abbrev_ptr += bytes_read;
cur_abbrev->has_children = read_1_byte (abfd, abbrev_ptr);
abbrev_ptr += 1;
/* now read in declarations */
/* Now read in declarations. */
abbrev_name = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
abbrev_ptr += bytes_read;
abbrev_form = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
abbrev_ptr += bytes_read;
while (abbrev_name)
{
if ((cur_abbrev->num_attrs % ATTR_ALLOC_CHUNK) == 0)
@ -484,6 +479,7 @@ read_abbrevs (abfd, offset)
if (! cur_abbrev->attrs)
return 0;
}
cur_abbrev->attrs[cur_abbrev->num_attrs].name = abbrev_name;
cur_abbrev->attrs[cur_abbrev->num_attrs++].form = abbrev_form;
abbrev_name = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
@ -530,6 +526,7 @@ read_attribute (attr, abbrev, unit, info_ptr)
attr->name = abbrev->name;
attr->form = abbrev->form;
switch (abbrev->form)
{
case DW_FORM_addr:
@ -631,35 +628,34 @@ read_attribute (attr, abbrev, unit, info_ptr)
return info_ptr;
}
/* Source line information table routines. */
#define FILE_ALLOC_CHUNK 5
#define DIR_ALLOC_CHUNK 5
struct line_info {
struct line_info
{
struct line_info* prev_line;
bfd_vma address;
char* filename;
unsigned int line;
unsigned int column;
int end_sequence; /* end of (sequential) code sequence */
int end_sequence; /* End of (sequential) code sequence. */
};
struct fileinfo {
struct fileinfo
{
char *name;
unsigned int dir;
unsigned int time;
unsigned int size;
};
struct line_info_table {
struct line_info_table
{
bfd* abfd;
unsigned int num_files;
unsigned int num_dirs;
char* comp_dir;
char** dirs;
struct fileinfo* files;
@ -688,7 +684,7 @@ add_line_info (table, address, filename, line, column, end_sequence)
info->end_sequence = end_sequence;
}
static char*
static char *
concat_filename (table, file)
struct line_info_table* table;
unsigned int file;
@ -703,7 +699,7 @@ concat_filename (table, file)
}
filename = table->files[file - 1].name;
if (*filename == '/')
if (IS_ABSOLUTE_PATH(filename))
return filename;
else
@ -723,8 +719,9 @@ arange_add (unit, low_pc, high_pc)
{
struct arange *arange;
/* first see if we can cheaply extend an existing range: */
/* First see if we can cheaply extend an existing range. */
arange = &unit->arange;
do
{
if (low_pc == arange->high)
@ -743,14 +740,14 @@ arange_add (unit, low_pc, high_pc)
if (unit->arange.high == 0)
{
/* this is the first address range: store it in unit->arange: */
/* This is the first address range: store it in unit->arange. */
unit->arange.next = 0;
unit->arange.low = low_pc;
unit->arange.high = high_pc;
return;
}
/* need to allocate a new arange and insert it into the arange list: */
/* Need to allocate a new arange and insert it into the arange list. */
arange = bfd_zalloc (unit->abfd, sizeof (*arange));
arange->low = low_pc;
arange->high = high_pc;
@ -762,15 +759,12 @@ arange_add (unit, low_pc, high_pc)
/* Decode the line number information for UNIT. */
static struct line_info_table*
decode_line_info (unit)
decode_line_info (unit, stash)
struct comp_unit *unit;
struct dwarf2_debug *stash;
{
bfd *abfd = unit->abfd;
struct dwarf2_debug *stash;
struct line_info_table* table;
char *line_ptr;
char *line_end;
struct line_head lh;
@ -778,12 +772,9 @@ decode_line_info (unit)
char *cur_file, *cur_dir;
unsigned char op_code, extended_op, adj_opcode;
stash = elf_tdata (abfd)->dwarf2_find_line_info;
if (! stash->dwarf_line_buffer)
{
asection *msec;
unsigned long size;
msec = bfd_get_section_by_name (abfd, ".debug_line");
if (! msec)
@ -793,18 +784,29 @@ decode_line_info (unit)
return 0;
}
size = msec->_raw_size;
stash->dwarf_line_buffer = (char *) bfd_alloc (abfd, size);
stash->dwarf_line_size = msec->_raw_size;
stash->dwarf_line_buffer = (char *) bfd_alloc (abfd, stash->dwarf_line_size);
if (! stash->dwarf_line_buffer)
return 0;
if (! bfd_get_section_contents (abfd, msec,
stash->dwarf_line_buffer, 0,
size))
stash->dwarf_line_size))
return 0;
/* FIXME: We ought to apply the relocs against this section before
we process it.... */
we process it... */
}
/* Since we are using un-relocated data, it is possible to get a bad value
for the line_offset. Validate it here so that we won't get a segfault
below. */
if (unit->line_offset >= stash->dwarf_line_size)
{
(*_bfd_error_handler) (_("Dwarf Error: Line offset (%u) bigger than line size (%u)."),
unit->line_offset, stash->dwarf_line_size);
bfd_set_error (bfd_error_bad_value);
return 0;
}
table = (struct line_info_table*) bfd_alloc (abfd,
@ -823,7 +825,7 @@ decode_line_info (unit)
line_ptr = stash->dwarf_line_buffer + unit->line_offset;
/* read in the prologue */
/* Read in the prologue. */
lh.total_length = read_4_bytes (abfd, line_ptr);
line_ptr += 4;
line_end = line_ptr + lh.total_length;
@ -845,16 +847,18 @@ decode_line_info (unit)
bfd_alloc (abfd, lh.opcode_base * sizeof (unsigned char));
lh.standard_opcode_lengths[0] = 1;
for (i = 1; i < lh.opcode_base; ++i)
{
lh.standard_opcode_lengths[i] = read_1_byte (abfd, line_ptr);
line_ptr += 1;
}
/* Read directory table */
/* Read directory table. */
while ((cur_dir = read_string (abfd, line_ptr, &bytes_read)) != NULL)
{
line_ptr += bytes_read;
if ((table->num_dirs % DIR_ALLOC_CHUNK) == 0)
{
table->dirs = (char **)
@ -863,14 +867,17 @@ decode_line_info (unit)
if (! table->dirs)
return 0;
}
table->dirs[table->num_dirs++] = cur_dir;
}
line_ptr += bytes_read;
/* Read file name table */
/* Read file name table. */
while ((cur_file = read_string (abfd, line_ptr, &bytes_read)) != NULL)
{
line_ptr += bytes_read;
if ((table->num_files % FILE_ALLOC_CHUNK) == 0)
{
table->files = (struct fileinfo *)
@ -880,6 +887,7 @@ decode_line_info (unit)
if (! table->files)
return 0;
}
table->files[table->num_files].name = cur_file;
table->files[table->num_files].dir =
read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
@ -892,12 +900,13 @@ decode_line_info (unit)
line_ptr += bytes_read;
table->num_files++;
}
line_ptr += bytes_read;
/* Read the statement sequences until there's nothing left. */
while (line_ptr < line_end)
{
/* state machine registers */
/* State machine registers. */
bfd_vma address = 0;
char* filename = concat_filename (table, 1);
unsigned int line = 1;
@ -912,10 +921,11 @@ decode_line_info (unit)
{
op_code = read_1_byte (abfd, line_ptr);
line_ptr += 1;
switch (op_code)
{
case DW_LNS_extended_op:
line_ptr += 1; /* ignore length */
line_ptr += 1; /* Ignore length. */
extended_op = read_1_byte (abfd, line_ptr);
line_ptr += 1;
switch (extended_op)
@ -1012,12 +1022,12 @@ decode_line_info (unit)
address += read_2_bytes (abfd, line_ptr);
line_ptr += 2;
break;
default: /* special operand */
default: /* Special operand. */
adj_opcode = op_code - lh.opcode_base;
address += (adj_opcode / lh.line_range)
* lh.minimum_instruction_length;
line += lh.line_base + (adj_opcode % lh.line_range);
/* append row to matrix using current values */
/* Append row to matrix using current values. */
add_line_info (table, address, filename, line, column, 0);
basic_block = 1;
if (need_low_pc)
@ -1032,7 +1042,6 @@ decode_line_info (unit)
return table;
}
/* If ADDR is within TABLE set the output parameters and return true,
otherwise return false. The output parameters, FILENAME_PTR and
LINENUMBER_PTR, are pointers to the objects to be filled in. */
@ -1071,20 +1080,16 @@ lookup_address_in_line_info_table (table,
return false;
}
/* Function table functions. */
struct funcinfo {
struct funcinfo
{
struct funcinfo *prev_func;
char* name;
bfd_vma low;
bfd_vma high;
};
/* If ADDR is within TABLE, set FUNCTIONNAME_PTR, and return true. */
static boolean
@ -1111,12 +1116,8 @@ lookup_address_in_function_table (table,
return false;
}
/* DWARF2 Compilation unit functions. */
/* Scan over each die in a comp. unit looking for functions to add
to the function table. */
@ -1217,11 +1218,6 @@ scan_unit_for_functions (unit)
return true;
}
/* Parse a DWARF2 compilation unit starting at INFO_PTR. This
includes the compilation unit header that proceeds the DIE's, but
does not include the length field that preceeds each compilation
@ -1233,10 +1229,10 @@ scan_unit_for_functions (unit)
to get to the line number information for the compilation unit. */
static struct comp_unit *
parse_comp_unit (abfd, info_ptr, end_ptr, abbrev_length)
parse_comp_unit (abfd, stash, unit_length, abbrev_length)
bfd* abfd;
char* info_ptr;
char* end_ptr;
struct dwarf2_debug *stash;
bfd_vma unit_length;
unsigned int abbrev_length;
{
struct comp_unit* unit;
@ -1250,6 +1246,9 @@ parse_comp_unit (abfd, info_ptr, end_ptr, abbrev_length)
struct abbrev_info *abbrev;
struct attribute attr;
char *info_ptr = stash->info_ptr;
char *end_ptr = info_ptr + unit_length;
version = read_2_bytes (abfd, info_ptr);
info_ptr += 2;
BFD_ASSERT (abbrev_length == 0
@ -1286,8 +1285,8 @@ parse_comp_unit (abfd, info_ptr, end_ptr, abbrev_length)
return 0;
}
/* Read the abbrevs for this compilation unit into a table */
abbrevs = read_abbrevs (abfd, abbrev_offset);
/* Read the abbrevs for this compilation unit into a table. */
abbrevs = read_abbrevs (abfd, abbrev_offset, stash);
if (! abbrevs)
return 0;
@ -1366,10 +1365,6 @@ parse_comp_unit (abfd, info_ptr, end_ptr, abbrev_length)
return unit;
}
/* Return true if UNIT contains the address given by ADDR. */
static boolean
@ -1390,10 +1385,10 @@ comp_unit_contains_address (unit, addr)
arange = arange->next;
}
while (arange);
return 0;
}
/* If UNIT contains ADDR, set the output parameters to the values for
the line containing ADDR. The output parameters, FILENAME_PTR,
FUNCTIONNAME_PTR, and LINENUMBER_PTR, are pointers to the objects
@ -1404,12 +1399,14 @@ comp_unit_contains_address (unit, addr)
static boolean
comp_unit_find_nearest_line (unit, addr,
filename_ptr, functionname_ptr, linenumber_ptr)
filename_ptr, functionname_ptr, linenumber_ptr,
stash)
struct comp_unit* unit;
bfd_vma addr;
const char **filename_ptr;
const char **functionname_ptr;
unsigned int *linenumber_ptr;
struct dwarf2_debug *stash;
{
boolean line_p;
boolean func_p;
@ -1425,7 +1422,7 @@ comp_unit_find_nearest_line (unit, addr,
return false;
}
unit->line_table = decode_line_info (unit);
unit->line_table = decode_line_info (unit, stash);
if (! unit->line_table)
{
@ -1450,6 +1447,43 @@ comp_unit_find_nearest_line (unit, addr,
return line_p || func_p;
}
/* Locate a section in a BFD containing debugging info. The search starts from the
section after AFTER_SEC, or from the first section in the BFD if AFTER_SEC is
NULL. The search works by examining the names of the sections. There are two
permissiable names. The first is .debug_info. This is the standard DWARF2 name.
The second is a prefix .gnu.linkonce.wi. This is a variation on the .debug_info
section which has a checksum describing the contents appended onto the name. This
allows the linker to identify and discard duplicate debugging sections for
different compilation units. */
#define DWARF2_DEBUG_INFO ".debug_info"
#define GNU_LINKONCE_INFO ".gnu.linkonce.wi."
static asection *
find_debug_info (abfd, after_sec)
bfd * abfd;
asection * after_sec;
{
asection * msec;
if (after_sec)
msec = after_sec->next;
else
msec = abfd->sections;
while (msec)
{
if (strcmp (msec->name, DWARF2_DEBUG_INFO) == 0)
return msec;
if (strncmp (msec->name, GNU_LINKONCE_INFO, strlen (GNU_LINKONCE_INFO)) == 0)
return msec;
msec = msec->next;
}
return NULL;
}
/* The DWARF2 version of find_nearest line. Return true if the line
is found without error. ADDR_SIZE is the number of bytes in the
initial .debug_info length field and in the abbreviation offset.
@ -1460,7 +1494,7 @@ boolean
_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
filename_ptr, functionname_ptr,
linenumber_ptr,
addr_size)
addr_size, pinfo)
bfd *abfd;
asection *section;
asymbol **symbols ATTRIBUTE_UNUSED;
@ -1469,6 +1503,7 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
const char **functionname_ptr;
unsigned int *linenumber_ptr;
unsigned int addr_size;
PTR *pinfo;
{
/* Read each compilation unit from the section .debug_info, and check
to see if it contains the address we are searching for. If yes,
@ -1477,10 +1512,8 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
We keep a list of all the previously read compilation units, and
a pointer to the next un-read compilation unit. Check the
previously read units before reading more.
*/
struct dwarf2_debug *stash = elf_tdata (abfd)->dwarf2_find_line_info;
previously read units before reading more. */
struct dwarf2_debug *stash = (struct dwarf2_debug *) *pinfo;
/* What address are we looking for? */
bfd_vma addr = offset + section->vma;
@ -1500,40 +1533,58 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
if (! stash)
{
unsigned long total_size;
asection *msec;
unsigned long size;
stash = elf_tdata (abfd)->dwarf2_find_line_info =
stash =
(struct dwarf2_debug*) bfd_zalloc (abfd, sizeof (struct dwarf2_debug));
if (! stash)
return false;
msec = bfd_get_section_by_name (abfd, ".debug_info");
*pinfo = (PTR) stash;
msec = find_debug_info (abfd, NULL);
if (! msec)
{
/* No dwarf2 info. Note that at this point the stash
has been allocated, but contains zeros, this lets
future calls to this function fail quicker. */
return false;
}
/* There can be more than one DWARF2 info section in a BFD these days.
Read them all in and produce one large stash. We do this in two
passes - in the first pass we just accumulate the section sizes.
In the second pass we read in the section's contents. The allows
us to avoid reallocing the data as we add sections to the stash. */
for (total_size = 0; msec; msec = find_debug_info (abfd, msec))
total_size += msec->_raw_size;
stash->info_ptr = (char *) bfd_alloc (abfd, total_size);
if (stash->info_ptr == NULL)
return false;
stash->info_ptr_end = stash->info_ptr;
for (msec = find_debug_info (abfd, NULL);
msec;
msec = find_debug_info (abfd, msec))
{
unsigned long size;
unsigned long start;
size = msec->_raw_size;
if (size == 0)
return false;
continue;
stash->info_ptr = (char *) bfd_alloc (abfd, size);
start = stash->info_ptr_end - stash->info_ptr;
if (! stash->info_ptr)
return false;
if (! bfd_get_section_contents (abfd, msec, stash->info_ptr + start, 0, size))
continue;
if (! bfd_get_section_contents (abfd, msec, stash->info_ptr, 0, size))
{
stash->info_ptr = 0;
return false;
stash->info_ptr_end = stash->info_ptr + start + size;
}
stash->info_ptr_end = stash->info_ptr + size;
BFD_ASSERT (stash->info_ptr_end = stash->info_ptr + total_size);
}
/* FIXME: There is a problem with the contents of the
.debug_info section. The 'low' and 'high' addresses of the
@ -1549,20 +1600,18 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
For now, this means that disassembling object files (as
opposed to fully executables) does not always work as well as
we would like. */
}
/* A null info_ptr indicates that there is no dwarf2 info
(or that an error occured while setting up the stash). */
if (! stash->info_ptr)
return false;
/* Check the previously read comp. units first. */
for (each = stash->all_comp_units; each; each = each->next_unit)
if (comp_unit_contains_address (each, addr))
return comp_unit_find_nearest_line (each, addr, filename_ptr,
functionname_ptr, linenumber_ptr);
functionname_ptr, linenumber_ptr,
stash);
/* Read each remaining comp. units checking each as they are read. */
while (stash->info_ptr < stash->info_ptr_end)
@ -1579,9 +1628,7 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
if (length > 0)
{
each = parse_comp_unit (abfd, stash->info_ptr,
stash->info_ptr + length,
addr_size);
each = parse_comp_unit (abfd, stash, length, addr_size);
stash->info_ptr += length;
if (each)
@ -1600,14 +1647,16 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
return comp_unit_find_nearest_line (each, addr,
filename_ptr,
functionname_ptr,
linenumber_ptr);
linenumber_ptr,
stash);
}
else
{
found = comp_unit_find_nearest_line (each, addr,
filename_ptr,
functionname_ptr,
linenumber_ptr);
linenumber_ptr,
stash);
if (found)
return true;
}
@ -1617,5 +1666,3 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
return false;
}
/* end of file */

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.
@ -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;
@ -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;
@ -1340,7 +1338,6 @@ ecoff_type_to_string (abfd, fdr, indx)
p1 += strlen (buffer1);
}
/*
* Deal with any qualifiers.
*/
@ -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;
@ -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;
@ -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))

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