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,22 +1722,67 @@ DEVO_SUPPORT= README Makefile.in configure configure.in \
config.guess config.if config.sub config move-if-change \
mpw-README mpw-build.in mpw-config.in mpw-configure mpw-install \
COPYING COPYING.LIB install-sh config-ml.in symlink-tree \
mkinstalldirs ltconfig ltmain.sh missing ylwrap
mkinstalldirs ltconfig ltmain.sh missing ylwrap \
libtool.m4 gettext.m4 ltcf-c.sh ltcf-cxx.sh ltcf-gcj.sh
# Files in devo/etc used in any net release.
# ChangeLog omitted because it may refer to files which are not in this
# distribution (perhaps it would be better to include it anyway).
ETC_SUPPORT= Makefile.in configure configure.in standards.texi \
make-stds.texi standards.info* configure.texi configure.info* \
configbuild.* configdev.*
configbuild.* configdev.*
# When you use `make setup-dirs' or `make taz' you should always redefine
# this macro.
SUPPORT_FILES = list-of-support-files-for-tool-in-question
.PHONY: taz
# NOTE: No double quotes in the below. It is used within shell script
# as VER="$(VER)"
VER = ` if grep AM_INIT_AUTOMAKE $(TOOL)/configure.in >/dev/null 2>&1; then \
sed < $(TOOL)/configure.in -n 's/AM_INIT_AUTOMAKE[^,]*, *\([^)]*\))/\1/p'; \
else \
sed < $(TOOL)/Makefile.in -n 's/^VERSION *= *//p'; \
fi`
PACKAGE = $(TOOL)
.PHONY: taz
taz: $(DEVO_SUPPORT) $(SUPPORT_FILES) texinfo/texinfo.tex
$(MAKE) -f Makefile.in do-proto-toplev \
TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(SUPPORT_FILES)"
$(MAKE) -f Makefile.in do-md5sum \
TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(SUPPORT_FILES)"
$(MAKE) -f Makefile.in do-tar-bz2 \
TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(SUPPORT_FILES)"
.PHONY: gdb-taz
gdb-taz: $(DEVO_SUPPORT) $(SUPPORT_FILES) texinfo/texinfo.tex
$(MAKE) -f Makefile.in do-proto-toplev \
TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(SUPPORT_FILES)"
$(MAKE) -f Makefile.in do-md5sum \
TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(SUPPORT_FILES)"
$(MAKE) -f Makefile.in do-djunpack \
TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(SUPPORT_FILES)"
$(MAKE) -f Makefile.in do-tar-bz2 \
TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(SUPPORT_FILES)"
.PHONY: do-proto-toplev
do-proto-toplev: $(DEVO_SUPPORT) $(SUPPORT_FILES) texinfo/texinfo.tex
echo "==> Making $(PACKAGE)-$(VER)/"
# Take out texinfo from a few places.
sed -e '/^all\.normal: /s/\all-texinfo //' \
-e '/^ install-texinfo /d' \
@ -1701,7 +1791,8 @@ taz: $(DEVO_SUPPORT) $(SUPPORT_FILES) texinfo/texinfo.tex
#
./configure sun4
[ -z "$(CONFIGURE_TARGET_MODULES)" ] \
|| $(MAKE) $(CONFIGURE_TARGET_MODULES) ALL_GCC="" \
|| $(MAKE) $(CONFIGURE_TARGET_MODULES) \
ALL_GCC="" ALL_GCC_C="" ALL_GCC_CXX="" \
CC_FOR_TARGET="$(CC)" CXX_FOR_TARGET="$(CXX)"
# Make links, and run "make diststuff" or "make info" when needed.
rm -rf proto-toplev ; mkdir proto-toplev
@ -1721,7 +1812,7 @@ taz: $(DEVO_SUPPORT) $(SUPPORT_FILES) texinfo/texinfo.tex
fi ; \
else ln -s ../$$d proto-toplev/$$d ; fi ; \
done
cd etc ; $(MAKE) info
cd etc && $(MAKE) info
$(MAKE) distclean
#
mkdir proto-toplev/etc
@ -1742,25 +1833,35 @@ taz: $(DEVO_SUPPORT) $(SUPPORT_FILES) texinfo/texinfo.tex
ln -s ../../../texinfo/util/tex3patch proto-toplev/texinfo/util ; \
else true; fi
chmod -R og=u . || chmod og=u `find . -print`
if grep AM_INIT_AUTOMAKE $(TOOL)/configure.in >/dev/null 2>&1; then \
ver=`sed < $(TOOL)/configure.in -n 's/AM_INIT_AUTOMAKE[^,]*, *\([^)]*\))/\1/p'`; \
else \
ver=`sed <$(TOOL)/Makefile.in -n 's/^VERSION *= *//p'`; \
fi; \
if test x"$(PACKAGE)" = x; then \
package="$(TOOL)"; \
else \
package="$(PACKAGE)"; \
fi; \
$(MAKE) -f Makefile.in do-tar-bz2 TOOL=$(TOOL) VER=$$ver PACKAGE=$$package
do-tar-bz2:
echo "==> Making $(PACKAGE)-$(VER).tar.bz2"
#
-rm -f $(PACKAGE)-$(VER)
ln -s proto-toplev $(PACKAGE)-$(VER)
tar cfh $(PACKAGE)-$(VER).tar $(PACKAGE)-$(VER)
.PHONY: do-tar-bz2
do-tar-bz2:
echo "==> Making $(PACKAGE)-$(VER).tar.bz2"
-rm -f $(PACKAGE)-$(VER).tar.bz2
find $(PACKAGE)-$(VER) -follow -name CVS -prune -o -type f -print \
| tar cTfh - $(PACKAGE)-$(VER).tar
$(BZIPPROG) -v -9 $(PACKAGE)-$(VER).tar
.PHONY: do-md5sum
do-md5sum:
echo "==> Adding md5 checksum to top-level directory"
cd proto-toplev && find * -follow -name CVS -prune -o -type f -print \
| xargs $(MD5PROG) > ../md5.sum
mv md5.sum proto-toplev
.PHONY: do-djunpack
do-djunpack:
echo "==> Adding updated djunpack.bat to top-level directory"
echo - 's /gdb-[0-9\.]*/gdb-'"$(VER)"'/'
sed < djunpack.bat > djunpack.new \
-e 's/gdb-[0-9][0-9\.]*/gdb-'"$(VER)"'/'
mv djunpack.new djunpack.bat
-rm -f proto-toplev/djunpack.bat
ln -s ../djunpack.bat proto-toplev/djunpack.bat
TEXINFO_SUPPORT= texinfo/texinfo.tex
DIST_SUPPORT= $(DEVO_SUPPORT) $(TEXINFO_SUPPORT)
@ -1768,6 +1869,7 @@ DIST_SUPPORT= $(DEVO_SUPPORT) $(TEXINFO_SUPPORT)
GAS_SUPPORT_DIRS= bfd include libiberty opcodes intl setup.com makefile.vms mkdep
gas.tar.bz2: $(DIST_SUPPORT) $(GAS_SUPPORT_DIRS) gas
$(MAKE) -f Makefile.in taz TOOL=gas \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(GAS_SUPPORT_DIRS)"
# The FSF "binutils" release includes gprof and ld.
@ -1775,53 +1877,62 @@ gas.tar.bz2: $(DIST_SUPPORT) $(GAS_SUPPORT_DIRS) gas
BINUTILS_SUPPORT_DIRS= bfd gas include libiberty opcodes ld gprof intl setup.com makefile.vms mkdep
binutils.tar.bz2: $(DIST_SUPPORT) $(BINUTILS_SUPPORT_DIRS) binutils
$(MAKE) -f Makefile.in taz TOOL=binutils \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(BINUTILS_SUPPORT_DIRS)"
.PHONY: gas+binutils.tar.bz2
GASB_SUPPORT_DIRS= $(GAS_SUPPORT_DIRS) binutils ld gprof
gas+binutils.tar.bz2: $(DIST_SUPPORT) $(GASB_SUPPORT_DIRS) gas
$(MAKE) -f Makefile.in taz TOOL=gas \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(GASB_SUPPORT_DIRS)"
.PHONY: libg++.tar.bz2
LIBGXX_SUPPORT_DIRS=include libstdc++ libio librx libiberty
libg++.tar.bz2: $(DIST_SUPPORT) libg++
$(MAKE) -f Makefile.in taz TOOL=libg++ \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(LIBGXX_SUPPORT_DIRS)"
GNATS_SUPPORT_DIRS=include libiberty send-pr
gnats.tar.bz2: $(DIST_SUPPORT) $(GNATS_SUPPORT_DIRS) gnats
$(MAKE) -f Makefile.in taz TOOL=gnats \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(GNATS_SUPPORT_DIRS)"
.PHONY: gdb.tar.bz2
GDB_SUPPORT_DIRS= bfd include libiberty mmalloc opcodes readline sim utils intl
gdb.tar.bz2: $(DIST_SUPPORT) $(GDB_SUPPORT_DIRS) gdb
$(MAKE) -f Makefile.in taz TOOL=gdb \
$(MAKE) -f Makefile.in gdb-taz TOOL=gdb \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(GDB_SUPPORT_DIRS)"
.PHONY: dejagnu.tar.bz2
DEJAGNU_SUPPORT_DIRS= tcl expect libiberty
dejagnu.tar.bz2: $(DIST_SUPPORT) $(DEJAGNU_SUPPORT_DIRS) dejagnu
$(MAKE) -f Makefile.in taz TOOL=dejagnu \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(DEJAGNU_SUPPORT_DIRS)"
.PHONY: gdb+dejagnu.tar.bz2
GDBD_SUPPORT_DIRS= $(GDB_SUPPORT_DIRS) tcl expect dejagnu
gdb+dejagnu.tar.bz2: $(DIST_SUPPORT) $(GDBD_SUPPORT_DIRS) gdb
$(MAKE) -f Makefile.in taz TOOL=gdb PACKAGE=gdb+dejagnu \
$(MAKE) -f Makefile.in gdb-taz TOOL=gdb PACKAGE=gdb+dejagnu \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(GDBD_SUPPORT_DIRS)"
.PHONY: insight.tar.bz2
INSIGHT_SUPPORT_DIRS= $(GDB_SUPPORT_DIRS) tcl tk itcl tix libgui
insight.tar.bz2: $(DIST_SUPPORT) $(GDB_SUPPORT_DIRS) gdb
$(MAKE) -f Makefile.in taz TOOL=gdb PACKAGE=insight \
$(MAKE) -f Makefile.in gdb-taz TOOL=gdb PACKAGE=insight \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(INSIGHT_SUPPORT_DIRS)"
.PHONY: insight+dejagnu.tar.bz2
INSIGHTD_SUPPORT_DIRS= $(INSIGHT_SUPPORT_DIRS) expect dejagnu
insight+dejagnu.tar.bz2: $(DIST_SUPPORT) $(INSIGHTD_SUPPORT_DIRS) gdb
$(MAKE) -f Makefile.in taz TOOL=gdb PACKAGE="insight+dejagnu" \
$(MAKE) -f Makefile.in gdb-taz TOOL=gdb PACKAGE="insight+dejagnu" \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(INSIGHTD_SUPPORT_DIRS)"
.PHONY: newlib.tar.bz2
@ -1839,6 +1950,7 @@ NEWLIB_SUPPORT_DIRS=libgloss
# supports newlib (if only minimally).
newlib.tar.bz2: $(DIST_SUPPORT) $(NEWLIB_SUPPORT_DIRS) newlib
$(MAKE) -f Makefile.in taz TOOL=newlib \
MD5PROG="$(MD5PROG)" \
SUPPORT_FILES="$(NEWLIB_SUPPORT_DIRS)" \
DEVO_SUPPORT="$(DEVO_SUPPORT) COPYING.NEWLIB" newlib

File diff suppressed because it is too large Load Diff

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,45 +102,45 @@ 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));
if (core_reg2sec (abfd) == NULL)
{
loser1:
bfd_release (abfd, core_regsec (abfd));
bfd_release (abfd, core_regsec (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,59 +230,61 @@ 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 =
{
"aix386-core",
bfd_target_unknown_flavour,
BFD_ENDIAN_BIG, /* target byte order */
BFD_ENDIANG_BIG, /* target headers byte order */
const bfd_target aix386_core_vec = {
"aix386-core",
bfd_target_unknown_flavour,
BFD_ENDIAN_BIG, /* target byte order */
BFD_ENDIANG_BIG, /* target headers byte order */
(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 */
0, /* leading underscore */
' ', /* ar_pad_char */
16, /* ar_max_namelen */
NO_GET, NO_GETS, NO_PUT,
NO_GET, NO_GETS, NO_PUT,
NO_GET, NO_GETS, NO_PUT, /* data */
NO_GET, NO_GETS, NO_PUT,
NO_GET, NO_GETS, NO_PUT,
NO_GET, NO_GETS, NO_PUT, /* hdrs */
0, /* leading underscore */
' ', /* ar_pad_char */
16, /* ar_max_namelen */
NO_GET, NO_GETS, NO_PUT,
NO_GET, NO_GETS, NO_PUT,
NO_GET, NO_GETS, NO_PUT, /* data */
NO_GET, NO_GETS, NO_PUT,
NO_GET, NO_GETS, NO_PUT,
NO_GET, NO_GETS, NO_PUT, /* hdrs */
{_bfd_dummy_target, _bfd_dummy_target,
_bfd_dummy_target, aix386_core_file_p},
{bfd_false, bfd_false, /* bfd_create_object */
bfd_false, bfd_false},
{bfd_false, bfd_false, /* bfd_write_contents */
bfd_false, bfd_false},
{_bfd_dummy_target, _bfd_dummy_target,
_bfd_dummy_target, aix386_core_file_p},
{bfd_false, bfd_false, /* bfd_create_object */
bfd_false, bfd_false},
{bfd_false, bfd_false, /* bfd_write_contents */
bfd_false, bfd_false},
BFD_JUMP_TABLE_GENERIC (_bfd_generic),
BFD_JUMP_TABLE_COPY (_bfd_generic),
BFD_JUMP_TABLE_CORE (aix386),
BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols),
BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
BFD_JUMP_TABLE_WRITE (_bfd_generic),
BFD_JUMP_TABLE_LINK (_bfd_nolink),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
BFD_JUMP_TABLE_GENERIC (_bfd_generic),
BFD_JUMP_TABLE_COPY (_bfd_generic),
BFD_JUMP_TABLE_CORE (aix386),
BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols),
BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
BFD_JUMP_TABLE_WRITE (_bfd_generic),
BFD_JUMP_TABLE_LINK (_bfd_nolink),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
(PTR) 0
NULL,
(PTR) 0
};

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 *));
@ -42,14 +43,14 @@ static void aout_adobe_write_section PARAMS ((bfd *abfd, sec_ptr sect));
void aout_adobe_swap_exec_header_in
PARAMS ((bfd *abfd, struct external_exec *raw_bytes,
struct internal_exec *execp));
void
aout_adobe_swap_exec_header_in (abfd, raw_bytes, execp)
bfd *abfd;
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,11 +99,12 @@ aout_adobe_object_p (abfd)
char *targ;
if (bfd_read ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd)
!= EXEC_BYTES_SIZE) {
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
return 0;
}
!= EXEC_BYTES_SIZE)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
return 0;
}
anexec.a_info = bfd_h_get_32 (abfd, exec_bytes.e_info);
@ -112,22 +114,23 @@ 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)) {
targ = getenv ("GNUTARGET");
if (targ && !strcmp (targ, a_out_adobe_vec.name))
; /* Just continue anyway, if specifically set to this format */
else
{
bfd_set_error (bfd_error_wrong_format);
return 0;
}
}
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. */
;
else
{
bfd_set_error (bfd_error_wrong_format);
return 0;
}
}
aout_adobe_swap_exec_header_in (abfd, &exec_bytes, &anexec);
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,97 +156,106 @@ 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)) {
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
return 0;
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])
{
case N_TEXT:
section_name = ".text";
flags = SEC_CODE | SEC_LOAD | SEC_ALLOC | SEC_HAS_CONTENTS;
break;
case N_DATA:
section_name = ".data";
flags = SEC_DATA | SEC_LOAD | SEC_ALLOC | SEC_HAS_CONTENTS;
break;
case N_BSS:
section_name = ".bss";
flags = SEC_DATA | SEC_HAS_CONTENTS;
break;
case 0:
goto no_more_sections;
default:
(*_bfd_error_handler)
(_("%s: Unknown section type in a.out.adobe file: %x\n"),
bfd_get_filename (abfd), ext->e_type[0]);
goto no_more_sections;
}
/* First one is called ".text" or whatever; subsequent ones are
".text1", ".text2", ... */
bfd_set_error (bfd_error_no_error);
sect = bfd_make_section (abfd, section_name);
trynum = 0;
while (!sect)
{
if (bfd_get_error () != bfd_error_no_error)
/* 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 (newname == NULL)
return 0;
strcpy (newname, sect->name);
sect->name = newname;
}
/* Now set the section's attributes. */
bfd_set_section_flags (abfd, sect, flags);
/* 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;
sect->vma = bfd_h_get_32 (abfd, ext->e_virtbase);
sect->filepos = bfd_h_get_32 (abfd, ext->e_filebase);
/* FIXME XXX alignment? */
/* Set relocation information for first section of each type. */
if (trynum == 0)
switch (ext->e_type[0])
{
case N_TEXT:
sect->rel_filepos = N_TRELOFF (*execp);
sect->reloc_count = execp->a_trsize;
break;
case N_DATA:
sect->rel_filepos = N_DRELOFF (*execp);
sect->reloc_count = execp->a_drsize;
break;
}
}
switch (ext->e_type[0]) {
case N_TEXT:
section_name = ".text";
flags = SEC_CODE | SEC_LOAD | SEC_ALLOC | SEC_HAS_CONTENTS;
break;
no_more_sections:
case N_DATA:
section_name = ".data";
flags = SEC_DATA | SEC_LOAD | SEC_ALLOC | SEC_HAS_CONTENTS;
break;
case N_BSS:
section_name = ".bss";
flags = SEC_DATA | SEC_HAS_CONTENTS;
break;
case 0:
goto no_more_sections;
default:
(*_bfd_error_handler)
(_("%s: Unknown section type in a.out.adobe file: %x\n"),
bfd_get_filename (abfd), ext->e_type[0]);
goto no_more_sections;
}
/* First one is called ".text" or whatever; subsequent ones are
".text1", ".text2", ... */
bfd_set_error (bfd_error_no_error);
sect = bfd_make_section (abfd, section_name);
trynum = 0;
while (!sect) {
if (bfd_get_error () != bfd_error_no_error)
return 0; /* Some other error -- slide into the sunset */
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 (newname == NULL)
return 0;
strcpy (newname, sect->name);
sect->name = newname;
}
/* Now set the section's attributes. */
bfd_set_section_flags (abfd, sect, flags);
sect->_raw_size = ((ext->e_size[0] << 8) /* Assumed big-endian */
| ext->e_size[1] << 8)
| ext->e_size[2];
sect->_cooked_size = sect->_raw_size;
sect->vma = bfd_h_get_32 (abfd, ext->e_virtbase);
sect->filepos = bfd_h_get_32 (abfd, ext->e_filebase);
/* FIXME XXX alignment? */
/* Set relocation information for first section of each type. */
if (trynum == 0) switch (ext->e_type[0]) {
case N_TEXT:
sect->rel_filepos = N_TRELOFF (*execp);
sect->reloc_count = execp->a_trsize;
break;
case N_DATA:
sect->rel_filepos = N_DRELOFF (*execp);
sect->reloc_count = execp->a_drsize;
break;
}
}
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;
}
struct bout_data_struct {
struct aoutdata a;
struct internal_exec e;
struct aoutdata a;
struct internal_exec e;
};
static boolean
@ -254,32 +266,31 @@ aout_adobe_mkobject (abfd)
rawptr = (struct bout_data_struct *) bfd_zalloc (abfd, sizeof (struct bout_data_struct));
if (rawptr == NULL)
return false;
return false;
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;
/* Calculate text size as total of text sections, etc. */
/* Calculate text size as total of text sections, etc. */
exec_hdr (abfd)->a_text = 0;
exec_hdr (abfd)->a_data = 0;
@ -287,22 +298,28 @@ 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) {
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) {
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)) {
exec_hdr (abfd)->a_bss += sect->_raw_size;
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)
{
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))
{
exec_hdr (abfd)->a_bss += sect->_raw_size;
}
}
}
exec_hdr (abfd)->a_syms = bfd_get_symcount (abfd)
* sizeof (struct external_nlist);
* sizeof (struct external_nlist);
exec_hdr (abfd)->a_entry = bfd_get_start_address (abfd);
aout_adobe_swap_exec_header_out (abfd, exec_hdr (abfd), &swapped_hdr);
@ -315,58 +332,68 @@ 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) {
aout_adobe_write_section (abfd, sect);
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) {
aout_adobe_write_section (abfd, sect);
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))) {
aout_adobe_write_section (abfd, sect);
for (sect = abfd->sections; sect; sect = sect->next)
{
if (!(sect->flags & (SEC_CODE | SEC_DATA)))
{
aout_adobe_write_section (abfd, sect);
}
}
}
/* Write final `sentinel` section header (with type of 0). */
if (bfd_write ((PTR) sentinel, 1, sizeof (*sentinel), abfd)
!= sizeof (*sentinel))
return false;
/* Now write out reloc info, followed by syms and strings */
if (bfd_get_symcount (abfd) != 0)
/* 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) {
if (!aout_32_squirt_out_relocs (abfd, sect))
return false;
}
}
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) {
if (!aout_32_squirt_out_relocs (abfd, sect))
return false;
}
}
for (sect = abfd->sections; sect; sect = sect->next)
{
if (sect->flags & SEC_DATA)
{
if (!aout_32_squirt_out_relocs (abfd, sect))
return false;
}
}
}
return true;
}
@ -390,46 +417,55 @@ 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. */
/* 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);
section_start = N_TXTOFF (ignore<-->me);
for (sect = abfd->sections; sect; sect = sect->next)
{
if (sect->flags & SEC_CODE)
{
sect->filepos = section_start;
/* FIXME: Round to alignment. */
section_start += sect->_raw_size;
}
}
for (sect = abfd->sections; sect; sect = sect->next) {
if (sect->flags & SEC_CODE) {
sect->filepos = section_start;
/* FIXME: Round to alignment */
section_start += sect->_raw_size;
}
for (sect = abfd->sections; sect; sect = sect->next)
{
if (sect->flags & SEC_DATA)
{
sect->filepos = section_start;
/* FIXME: Round to alignment. */
section_start += sect->_raw_size;
}
}
for (sect = abfd->sections; sect; sect = sect->next)
{
if (sect->flags & SEC_HAS_CONTENTS &&
!(sect->flags & (SEC_CODE | SEC_DATA)))
{
sect->filepos = section_start;
/* FIXME: Round to alignment. */
section_start += sect->_raw_size;
}
}
}
for (sect = abfd->sections; sect; sect = sect->next) {
if (sect->flags & SEC_DATA) {
sect->filepos = section_start;
/* FIXME: Round to alignment */
section_start += sect->_raw_size;
}
}
for (sect = abfd->sections; sect; sect = sect->next) {
if (sect->flags & SEC_HAS_CONTENTS &&
!(sect->flags & (SEC_CODE|SEC_DATA))) {
sect->filepos = section_start;
/* 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;
}
@ -449,17 +485,14 @@ aout_adobe_set_arch_mach (abfd, arch, machine)
return false;
}
static int
static int
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) */
@ -502,29 +534,29 @@ const bfd_target a_out_adobe_vec =
16, /* ar_max_namelen */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
bfd_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, aout_adobe_object_p, /* bfd_check_format */
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
{_bfd_dummy_target, aout_adobe_object_p, /* bfd_check_format */
bfd_generic_archive_p, _bfd_dummy_target},
{bfd_false, aout_adobe_mkobject, /* bfd_set_format */
{bfd_false, aout_adobe_mkobject, /* bfd_set_format */
_bfd_generic_mkarchive, bfd_false},
{bfd_false, aout_adobe_write_object_contents, /* bfd_write_contents */
{bfd_false, aout_adobe_write_object_contents, /* bfd_write_contents */
_bfd_write_archive_contents, bfd_false},
BFD_JUMP_TABLE_GENERIC (aout_32),
BFD_JUMP_TABLE_COPY (_bfd_generic),
BFD_JUMP_TABLE_CORE (_bfd_nocore),
BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd),
BFD_JUMP_TABLE_SYMBOLS (aout_32),
BFD_JUMP_TABLE_RELOCS (aout_32),
BFD_JUMP_TABLE_WRITE (aout_32),
BFD_JUMP_TABLE_LINK (aout_32),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
BFD_JUMP_TABLE_GENERIC (aout_32),
BFD_JUMP_TABLE_COPY (_bfd_generic),
BFD_JUMP_TABLE_CORE (_bfd_nocore),
BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd),
BFD_JUMP_TABLE_SYMBOLS (aout_32),
BFD_JUMP_TABLE_RELOCS (aout_32),
BFD_JUMP_TABLE_WRITE (aout_32),
BFD_JUMP_TABLE_LINK (aout_32),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
(PTR) 0
};

View File

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

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

@ -53,12 +53,12 @@ encap_object_p (abfd)
bfd_set_error (bfd_error_wrong_format);
return 0;
}
coff_magic = bfd_h_get_16 (abfd, magicbuf);
if (coff_magic != COFF_MAGIC)
return 0; /* Not an encap coff file */
__header_offset_temp==COFF_MAGIC ? sizeof(struct coffheader) : 0)
__header_offset_temp==COFF_MAGIC ? sizeof (struct coffheader) : 0)
(fseek ((f), HEADER_OFFSET((f)), 1))
magic = bfd_h_get_32 (abfd, magicbuf);
@ -72,7 +72,7 @@ encap_object_p (abfd)
bfd_set_error (bfd_error_wrong_format);
return 0;
}
NAME(aout,swap_exec_header_in)(abfd, &exec_bytes, &exec);
NAME(aout,swap_exec_header_in) (abfd, &exec_bytes, &exec);
return aout_32_some_aout_object_p (abfd, &exec, encap_realcallback);
}
@ -83,9 +83,9 @@ encap_real_callback (abfd)
bfd *abfd;
{
struct internal_exec *execp = exec_hdr (abfd);
MY(callback)(abfd, execp);
MY(callback) (abfd, execp);
/* If we have a coff header, it can give us better values for
text_start and exec_data_start. This is particularly useful
for remote debugging of embedded systems. */

View File

@ -89,7 +89,7 @@ MY_swap_std_reloc_out PARAMS ((bfd *abfd, arelent *g,
*
*/
reloc_howto_type MY(howto_table)[] =
reloc_howto_type MY(howto_table)[] =
{
/* ns32k immediate operands */
HOWTO (BFD_RELOC_NS32K_IMM_8, 0, 0, 8, false, 0, true,
@ -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;
@ -295,10 +293,10 @@ MY_swap_std_reloc_out (abfd, g, natptr)
asection *output_section = sym->section->output_section;
r_addend = g->addend + (*(g->sym_ptr_ptr))->section->output_section->vma;
/* name was clobbered by aout_write_syms to be symbol index */
/* If this relocation is relative to a symbol then set the
/* 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
@ -307,7 +305,7 @@ MY_swap_std_reloc_out (abfd, g, natptr)
if (bfd_is_com_section (output_section)
|| output_section == &bfd_abs_section
|| output_section == &bfd_und_section)
|| output_section == &bfd_und_section)
{
if (bfd_abs_section.symbol == sym)
{
@ -316,21 +314,21 @@ MY_swap_std_reloc_out (abfd, g, natptr)
r_index = 0;
r_extern = 0;
}
else
else
{
/* Fill in symbol */
r_extern = 1;
#undef KEEPIT
#define KEEPIT udata.i
r_index = (*(g->sym_ptr_ptr))->KEEPIT;
#undef KEEPIT
#undef KEEPIT
}
}
else
else
{
/* Just an ordinary section */
r_extern = 0;
r_index = output_section->target_index;
r_index = output_section->target_index;
}
MY_put_reloc (abfd, r_extern, r_index, g->address, g->howto, natptr);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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,
@ -97,7 +95,7 @@ bout_swap_exec_header_out (abfd, execp, raw_bytes)
{
struct external_exec *bytes = (struct external_exec *)raw_bytes;
/* Now fill in fields in the raw data, from the fields in the exec struct. */
/* Now fill in fields in the raw data, from the fields in the exec struct. */
bfd_h_put_32 (abfd, execp->a_info , bytes->e_info);
PUT_WORD (abfd, execp->a_text , bytes->e_text);
PUT_WORD (abfd, execp->a_data , bytes->e_data);
@ -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. */
@ -189,8 +185,8 @@ b_out_callback (abfd)
obj_textsec (abfd)->rel_filepos = N_TROFF(*execp);
obj_datasec (abfd)->rel_filepos = N_DROFF(*execp);
adata(abfd).page_size = 1; /* Not applicable. */
adata(abfd).segment_size = 1; /* Not applicable. */
adata(abfd).page_size = 1; /* Not applicable. */
adata(abfd).segment_size = 1; /* Not applicable. */
adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
if (execp->a_relaxable)
@ -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,
@ -417,7 +411,7 @@ callj_callback (abfd, link_info, reloc_entry, data, srcidx, dstidx,
/* The next symbol should be an N_BALNAME. */
BFD_ASSERT(IS_BALNAME(balsym->other));
/* We are calling a leaf, so replace the call instruction with a
bal. */
word = BAL | ((word
@ -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 ();
}
}
}
@ -1494,11 +1479,10 @@ const bfd_target b_out_vec_big_host =
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
& b_out_vec_little_host,
(PTR) 0,
};
const bfd_target b_out_vec_little_host =
{
"b.out.little", /* name */
@ -1537,6 +1521,6 @@ const bfd_target b_out_vec_little_host =
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
& b_out_vec_big_host,
(PTR) 0
};

View File

@ -1,5 +1,5 @@
/* BFD library -- caching of file descriptors.
Copyright 1990, 91, 92, 93, 94, 95, 1996, 2000
Copyright 1990, 91, 92, 93, 94, 95, 1996, 2000, 2001
Free Software Foundation, Inc.
Hacked by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
@ -32,7 +32,7 @@ SECTION
<<bfd_cache_lookup>>, which runs around and makes sure that
the required BFD is open. If not, then it chooses a file to
close, closes it and opens the one wanted, returning its file
handle.
handle.
*/
@ -79,19 +79,18 @@ bfd *bfd_last_cache;
/*
INTERNAL_FUNCTION
bfd_cache_lookup
DESCRIPTION
Check to see if the required BFD is the same as the last one
looked up. If so, then it can use the stream in the BFD with
impunity, since it can't have changed since the last lookup;
otherwise, it has to perform the complicated lookup function.
.#define bfd_cache_lookup(x) \
. ((x)==bfd_last_cache? \
. (FILE*)(bfd_last_cache->iostream): \
. (FILE*) (bfd_last_cache->iostream): \
. bfd_cache_lookup_worker(x))
*/
/* Insert a BFD into the cache. */
@ -262,7 +261,7 @@ FILE *
bfd_open_file (abfd)
bfd *abfd;
{
abfd->cacheable = true; /* Allow it to be closed later. */
abfd->cacheable = true; /* Allow it to be closed later. */
if (open_files >= BFD_CACHE_MAX_OPEN)
{
@ -312,7 +311,7 @@ bfd_open_file (abfd)
if (stat (abfd->filename, &s) == 0 && s.st_size != 0)
unlink (abfd->filename);
#endif
abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_WB);
abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_WUB);
abfd->opened_once = true;
}
break;
@ -339,7 +338,7 @@ DESCRIPTION
quick answer. Find a file descriptor for @var{abfd}. If
necessary, it open it. If there are already more than
<<BFD_CACHE_MAX_OPEN>> files open, it tries to close one first, to
avoid running out of file descriptors.
avoid running out of file descriptors.
*/
FILE *
@ -349,7 +348,7 @@ bfd_cache_lookup_worker (abfd)
if ((abfd->flags & BFD_IN_MEMORY) != 0)
abort ();
if (abfd->my_archive)
if (abfd->my_archive)
abfd = abfd->my_archive;
if (abfd->iostream != NULL)

View File

@ -72,7 +72,7 @@ struct cisco_core_struct
};
/* Examine the file for a crash info struct at the offset given by
CRASH_INFO_LOC. */
CRASH_INFO_LOC. */
static const bfd_target *
cisco_core_file_validate (abfd, crash_info_loc)
@ -236,7 +236,7 @@ cisco_core_file_validate (abfd, crash_info_loc)
abfd->section_count = 0;
/* Create a ".reg" section to allow access to the saved
registers. */
registers. */
asect = (asection *) bfd_zmalloc (sizeof (asection));
if (asect == NULL)
@ -247,7 +247,7 @@ cisco_core_file_validate (abfd, crash_info_loc)
asect->filepos = bfd_get_32 (abfd, crashinfo.registers) - rambase;
/* Since we don't know the exact size of the saved register info,
choose a register section size that is either the remaining part
of the file, or 1024, whichever is smaller. */
of the file, or 1024, whichever is smaller. */
nread = statbuf.st_size - asect->filepos;
asect->_raw_size = (nread < 1024) ? nread : 1024;
asect->next = abfd->sections;
@ -255,7 +255,7 @@ cisco_core_file_validate (abfd, crash_info_loc)
++abfd->section_count;
/* Create a ".crash" section to allow access to the saved
crash information. */
crash information. */
asect = (asection *) bfd_zmalloc (sizeof (asection));
if (asect == NULL)
@ -270,7 +270,7 @@ cisco_core_file_validate (abfd, crash_info_loc)
++abfd->section_count;
/* Create a ".data" section that maps the entire file, which is
essentially a dump of the target system's RAM. */
essentially a dump of the target system's RAM. */
asect = (asection *) bfd_zmalloc (sizeof (asection));
if (asect == NULL)
@ -288,7 +288,7 @@ cisco_core_file_validate (abfd, crash_info_loc)
return abfd->xvec;
/* Get here if we have already started filling out the BFD
and there is an error of some kind. */
and there is an error of some kind. */
error_return:
{
@ -378,7 +378,7 @@ const bfd_target cisco_core_big_vec =
bfd_false, bfd_false,
bfd_false, bfd_false
},
BFD_JUMP_TABLE_GENERIC (_bfd_generic),
BFD_JUMP_TABLE_COPY (_bfd_generic),
BFD_JUMP_TABLE_CORE (cisco),
@ -390,7 +390,7 @@ const bfd_target cisco_core_big_vec =
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
& cisco_core_little_vec,
(PTR) 0 /* backend_data */
};
@ -428,7 +428,7 @@ const bfd_target cisco_core_little_vec =
bfd_false, bfd_false,
bfd_false, bfd_false
},
BFD_JUMP_TABLE_GENERIC (_bfd_generic),
BFD_JUMP_TABLE_COPY (_bfd_generic),
BFD_JUMP_TABLE_CORE (cisco),
@ -440,6 +440,6 @@ const bfd_target cisco_core_little_vec =
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
&cisco_core_big_vec,
(PTR) 0 /* backend_data */
};

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,27 +43,27 @@ 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
get_symbol_value (symbol)
get_symbol_value (symbol)
asymbol *symbol;
{
{
long relocation = 0;
if (bfd_is_com_section (symbol->section))
{
relocation = 0;
}
else
{
relocation = symbol->value +
symbol->section->output_section->vma +
symbol->section->output_offset;
}
{
relocation = 0;
}
else
{
relocation = symbol->value +
symbol->section->output_section->vma +
symbol->section->output_offset;
}
return(relocation);
}
@ -93,130 +93,130 @@ 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) {
/* Partial linking - do nothing */
reloc_entry->address += input_section->output_offset;
return bfd_reloc_ok;
if (output_bfd)
{
/* Partial linking - do nothing */
reloc_entry->address += input_section->output_offset;
return bfd_reloc_ok;
}
}
if (symbol_in != NULL
&& bfd_is_und_section (symbol_in->section))
{
/* Keep the state machine happy in case we're called again */
if (r_type == R_IHIHALF)
{
part1_consth_active = true;
part1_consth_value = 0;
/* Keep the state machine happy in case we're called again */
if (r_type == R_IHIHALF)
{
part1_consth_active = true;
part1_consth_value = 0;
}
return(bfd_reloc_undefined);
}
return(bfd_reloc_undefined);
}
if ((part1_consth_active) && (r_type != R_IHCONST))
{
part1_consth_active = false;
*error_message = (char *) _("Missing IHCONST");
return(bfd_reloc_dangerous);
}
if ((part1_consth_active) && (r_type != R_IHCONST))
{
part1_consth_active = false;
*error_message = (char *) _("Missing IHCONST");
return(bfd_reloc_dangerous);
}
sym_value = get_symbol_value(symbol_in);
switch (r_type)
{
case R_IREL:
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);
signed_value <<= 2;
/* See the note on the R_IREL reloc in coff_a29k_relocate_section. */
if (signed_value == - (long) reloc_entry->address)
signed_value = 0;
signed_value += sym_value + reloc_entry->addend;
if ((signed_value & ~0x3ffff) == 0)
{ /* Absolute jmp/call */
insn |= (1<<24); /* Make it absolute */
/* FIXME: Should we change r_type to R_IABS */
}
else
switch (r_type)
{
/* Relative jmp/call, so subtract from the value the
address of the place we're coming from */
signed_value -= (reloc_entry->address
+ input_section->output_section->vma
+ input_section->output_offset);
if (signed_value>0x1ffff || signed_value<-0x20000)
return(bfd_reloc_overflow);
}
signed_value >>= 2;
insn = INSERT_HWORD(insn, signed_value);
bfd_put_32(abfd, insn ,hit_data);
break;
case R_ILOHALF:
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);
break;
case R_IHIHALF:
insn = bfd_get_32(abfd, hit_data);
/* consth, part 1
Just get the symbol value that is referenced */
part1_consth_active = true;
part1_consth_value = sym_value + reloc_entry->addend;
/* Don't modify insn until R_IHCONST */
break;
case R_IHCONST:
insn = bfd_get_32(abfd, hit_data);
/* consth, part 2
Now relocate the reference */
if (part1_consth_active == false) {
*error_message = (char *) _("Missing IHIHALF");
return(bfd_reloc_dangerous);
}
/* sym_ptr_ptr = r_symndx, in coff_slurp_reloc_table() */
unsigned_value = 0; /*EXTRACT_HWORD(insn) << 16;*/
unsigned_value += reloc_entry->addend; /* r_symndx */
unsigned_value += part1_consth_value;
unsigned_value = unsigned_value >> 16;
insn = INSERT_HWORD(insn, unsigned_value);
part1_consth_active = false;
bfd_put_32(abfd, insn, hit_data);
break;
case R_BYTE:
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);
break;
case R_HWORD:
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);
break;
case R_WORD:
insn = bfd_get_32(abfd, hit_data);
insn += sym_value + reloc_entry->addend;
bfd_put_32(abfd, insn, hit_data);
break;
default:
*error_message = _("Unrecognized reloc");
return (bfd_reloc_dangerous);
}
case R_IREL:
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);
signed_value <<= 2;
/* See the note on the R_IREL reloc in coff_a29k_relocate_section. */
if (signed_value == - (long) reloc_entry->address)
signed_value = 0;
return(bfd_reloc_ok);
signed_value += sym_value + reloc_entry->addend;
if ((signed_value & ~0x3ffff) == 0)
{ /* Absolute jmp/call */
insn |= (1<<24); /* Make it absolute */
/* FIXME: Should we change r_type to R_IABS */
}
else
{
/* Relative jmp/call, so subtract from the value the
address of the place we're coming from */
signed_value -= (reloc_entry->address
+ input_section->output_section->vma
+ input_section->output_offset);
if (signed_value>0x1ffff || signed_value<-0x20000)
return(bfd_reloc_overflow);
}
signed_value >>= 2;
insn = INSERT_HWORD(insn, signed_value);
bfd_put_32 (abfd, insn ,hit_data);
break;
case R_ILOHALF:
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);
break;
case R_IHIHALF:
insn = bfd_get_32 (abfd, hit_data);
/* consth, part 1
Just get the symbol value that is referenced */
part1_consth_active = true;
part1_consth_value = sym_value + reloc_entry->addend;
/* Don't modify insn until R_IHCONST */
break;
case R_IHCONST:
insn = bfd_get_32 (abfd, hit_data);
/* consth, part 2
Now relocate the reference */
if (part1_consth_active == false)
{
*error_message = (char *) _("Missing IHIHALF");
return(bfd_reloc_dangerous);
}
/* sym_ptr_ptr = r_symndx, in coff_slurp_reloc_table() */
unsigned_value = 0; /*EXTRACT_HWORD(insn) << 16;*/
unsigned_value += reloc_entry->addend; /* r_symndx */
unsigned_value += part1_consth_value;
unsigned_value = unsigned_value >> 16;
insn = INSERT_HWORD(insn, unsigned_value);
part1_consth_active = false;
bfd_put_32 (abfd, insn, hit_data);
break;
case R_BYTE:
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);
break;
case R_HWORD:
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);
break;
case R_WORD:
insn = bfd_get_32 (abfd, hit_data);
insn += sym_value + reloc_entry->addend;
bfd_put_32 (abfd, insn, hit_data);
break;
default:
*error_message = _("Unrecognized reloc");
return (bfd_reloc_dangerous);
}
return(bfd_reloc_ok);
}
/* type rightshift
@ -228,12 +228,12 @@ a29k_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
complain_on_overflow
special_function
relocation name
partial_inplace
partial_inplace
src_mask
*/
/*FIXME: I'm not real sure about this table */
static reloc_howto_type howto_table[] =
static reloc_howto_type howto_table[] =
{
{R_ABS, 0, 3, 32, false, 0, complain_overflow_bitfield,a29k_reloc,"ABS", true, 0xffffffff,0xffffffff, false},
EMPTY_HOWTO (1),
@ -282,49 +282,49 @@ reloc_processing (relent,reloc, symbols, abfd, section)
bfd *abfd;
asection *section;
{
static bfd_vma ihihalf_vaddr = (bfd_vma) -1;
static bfd_vma ihihalf_vaddr = (bfd_vma) -1;
relent->address = reloc->r_vaddr;
relent->howto = howto_table + reloc->r_type;
if (reloc->r_type == R_IHCONST)
{
relent->address = reloc->r_vaddr;
relent->howto = howto_table + reloc->r_type;
if (reloc->r_type == R_IHCONST)
{
/* The address of an R_IHCONST should always be the address of
the immediately preceding R_IHIHALF. relocs generated by gas
are correct, but relocs generated by High C are different (I
can't figure out what the address means for High C). We can
handle both gas and High C by ignoring the address here, and
simply reusing the address saved for R_IHIHALF. */
if (ihihalf_vaddr == (bfd_vma) -1)
abort ();
relent->address = ihihalf_vaddr;
ihihalf_vaddr = (bfd_vma) -1;
relent->addend = reloc->r_symndx;
relent->sym_ptr_ptr= bfd_abs_section_ptr->symbol_ptr_ptr;
if (ihihalf_vaddr == (bfd_vma) -1)
abort ();
relent->address = ihihalf_vaddr;
ihihalf_vaddr = (bfd_vma) -1;
relent->addend = reloc->r_symndx;
relent->sym_ptr_ptr= bfd_abs_section_ptr->symbol_ptr_ptr;
}
else
else
{
asymbol *ptr;
relent->sym_ptr_ptr = symbols + obj_convert(abfd)[reloc->r_symndx];
ptr = *(relent->sym_ptr_ptr);
if (ptr
&& bfd_asymbol_bfd(ptr) == abfd
if (ptr
&& bfd_asymbol_bfd(ptr) == abfd
&& ((ptr->flags & BSF_OLD_COMMON)== 0))
{
&& ((ptr->flags & BSF_OLD_COMMON)== 0))
{
relent->addend = 0;
}
}
else
{
relent->addend = 0;
}
{
relent->addend = 0;
}
relent->address-= section->vma;
if (reloc->r_type == R_IHIHALF)
ihihalf_vaddr = relent->address;
else if (ihihalf_vaddr != (bfd_vma) -1)
abort ();
}
}
}
/* The reloc processing routine for the optimized COFF linker. */
@ -570,7 +570,7 @@ coff_a29k_relocate_section (output_bfd, info, input_bfd, input_section,
rel->r_vaddr - input_section->vma)))
return false;
}
}
}
return true;
}
@ -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

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

View File

@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifdef ONLY_DECLARE_RELOCS
extern reloc_howto_type apollocoff_howto_table[];
#else
reloc_howto_type apollocoff_howto_table[] =
reloc_howto_type apollocoff_howto_table[] =
{
HOWTO(R_RELBYTE, 0, 0, 8, false, 0, complain_overflow_bitfield, 0, "8", true, 0x000000ff,0x000000ff, false),
HOWTO(R_RELWORD, 0, 1, 16, false, 0, complain_overflow_bitfield, 0, "16", true, 0x0000ffff,0x0000ffff, false),
@ -59,7 +59,7 @@ apollo_rtype2howto(internal, relocentry)
arelent *internal;
int relocentry;
{
switch (relocentry)
switch (relocentry)
{
case R_RELBYTE: internal->howto = apollocoff_howto_table + 0; break;
case R_RELWORD: internal->howto = apollocoff_howto_table + 1; break;
@ -71,13 +71,13 @@ apollo_rtype2howto(internal, relocentry)
}
}
int
int
apollo_howto2rtype (internal)
reloc_howto_type *internal;
{
if (internal->pc_relative)
if (internal->pc_relative)
{
switch (internal->bitsize)
switch (internal->bitsize)
{
case 32: return R_PCRLONG;
case 16: return R_PCRWORD;
@ -93,7 +93,7 @@ apollo_howto2rtype (internal)
case 8: return R_RELBYTE;
}
}
return R_RELLONG;
return R_RELLONG;
}
#endif /* not ONLY_DECLARE_RELOCS */

File diff suppressed because it is too large Load Diff

View File

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

View File

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

@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (1)
/* We derive a hash table from the basic BFD hash table to
hold entries in the function vector. Aside from the
hold entries in the function vector. Aside from the
info stored by the basic hash table, we need the offset
of a particular entry within the hash table as well as
the offset where we'll add the next entry. */
@ -196,7 +196,7 @@ h8300_coff_link_hash_table_create (abfd)
We only come here for pcrel stuff and return normally if not an -r link.
When doing -r, we can't do any arithmetic for the pcrel stuff, because
the code in reloc.c assumes that we can manipulate the targets of
the pcrel branches. This isn't so, since the H8/300 can do relaxing,
the pcrel branches. This isn't so, since the H8/300 can do relaxing,
which means that the gap after the instruction may not be enough to
contain the offset required for the branch, so we have to use only
the addend until the final link. */
@ -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
@ -412,7 +404,7 @@ h8300_symbol_address_p (abfd, input_section, address)
/* Search all the symbols for one in INPUT_SECTION with
address ADDRESS. */
while (*s)
while (*s)
{
asymbol *p = *s;
if (p->section == input_section
@ -421,11 +413,10 @@ h8300_symbol_address_p (abfd, input_section, address)
+ p->value) == address)
return true;
s++;
}
}
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,20 +426,20 @@ 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;
unsigned int shrink;
struct bfd_link_info *link_info;
{
bfd_vma value;
bfd_vma value;
bfd_vma dot;
bfd_vma gap;
static asection *last_input_section = NULL;
static arelent *last_reloc = NULL;
/* The address of the thing to be relocated will have moved back by
/* The address of the thing to be relocated will have moved back by
the size of the shrink - but we don't change reloc->address here,
since we need it to know where the relocation lives in the source
uncooked section. */
@ -459,14 +450,13 @@ 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
@ -477,13 +467,12 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info)
/* Compute the distance from this insn to the branch target. */
gap = value - dot;
/* If the distance is within -128..+128 inclusive, then we can relax
this jump. +128 is valid since the target will move two bytes
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
@ -493,7 +482,7 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info)
bCC lab1 bCC' lab2
jmp lab2
lab1: lab1:
This saves 4 bytes instead of two, and should be relatively
common. */
@ -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;
@ -520,11 +509,11 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info)
}
/* Change the reloc type. */
reloc->howto = reloc->howto + 1;
reloc->howto = reloc->howto + 1;
/* 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,12 +522,12 @@ 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 +
input_section->output_offset + address;
/* Compute the distance from this insn to the branch target. */
gap = value - dot;
@ -546,13 +535,13 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info)
this jump. +128 is valid since the target will move two bytes
closer if we do relax this branch. */
if ((int)gap >= -128 && (int)gap <= 128 )
{
{
/* Change the reloc type. */
reloc->howto = howto_table + 15;
/* 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,13 +614,13 @@ 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;
/* No other reloc types represent relaxing opportunities. */
default:
break;
default:
break;
}
last_reloc = reloc;
@ -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,18 +649,17 @@ 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
dot = (link_order->offset
+ dst_address
+ link_order->u.indirect.section->output_section->vma);
gap = value - dot;
@ -700,11 +687,11 @@ 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
+ dst_address
dot = (link_order->offset
+ dst_address
+ link_order->u.indirect.section->output_section->vma + 1);
gap = value - dot;
@ -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;
@ -921,7 +908,7 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
src_address += 2;
break;
/* Similarly for a 24bit absolute that is now 8 bits. */
case R_JMPL2:
/* Get the address of the target of this branch. */
@ -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,10 +994,10 @@ 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
dot = (link_order->offset
+ dst_address
+ link_order->u.indirect.section->output_section->vma) + 1;
gap = value - dot;
@ -1092,7 +1079,7 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
}
/* This is a jump/call through a function vector, and we're
expected to create the function vector ourselves.
expected to create the function vector ourselves.
First look up this symbol in the linker hash table -- we need
the derived linker symbol which holds this symbol's index
@ -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,10 +63,9 @@ 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
static int
coff_h8500_select_reloc (howto)
reloc_howto_type *howto;
{
@ -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;
}
@ -217,7 +209,7 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)
(*dst_ptr) += 2;
(*src_ptr) += 2;
break;
case R_H8500_HIGH16:
bfd_put_16 (in_abfd,
(bfd_coff_reloc16_get_value (reloc, link_info, input_section)
@ -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,7 +104,26 @@ coff_i386_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
ignores the addend for a COFF target when producing
relocateable output. This seems to be always wrong for 386
COFF, so we handle the addend here instead. */
diff = reloc_entry->addend;
#ifdef COFF_WITH_PE
if (output_bfd == (bfd *) NULL)
{
reloc_howto_type *howto = reloc_entry->howto;
/* Although PC relative relocations are very similar between
PE and non-PE formats, but they are off by 1 << howto->size
bytes. For the external relocation, PE is very different
from others. See md_apply_fix3 () in gas/config/tc-i386.c.
When we link PE and non-PE object files together to
generate a non-PE executable, we have to compensate it
here. */
if (howto->pc_relative == true && howto->pcrel_offset == true)
diff = -(1 << howto->size);
else
diff = -reloc_entry->addend;
}
else
#endif
diff = reloc_entry->addend;
}
#ifdef COFF_WITH_PE
@ -155,19 +176,17 @@ coff_i386_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
}
#ifdef COFF_WITH_PE
/* Return true if this relocation should appear in the output .reloc
section. */
static boolean in_reloc_p PARAMS ((bfd *, reloc_howto_type *));
static boolean in_reloc_p (abfd, howto)
bfd *abfd ATTRIBUTE_UNUSED;
bfd * abfd ATTRIBUTE_UNUSED;
reloc_howto_type *howto;
{
return ! howto->pc_relative && howto->type != R_IMAGEBASE;
}
#endif /* COFF_WITH_PE */
#ifndef PCRELOFFSET
@ -575,7 +594,7 @@ const bfd_target
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
/* Note that we allow an object file to be treated as a core file as well. */
/* Note that we allow an object file to be treated as a core file as well. */
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
bfd_generic_archive_p, coff_object_p},
{bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */

View File

@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "libcoff.h"
static bfd_reloc_status_type coff_i860_reloc
static bfd_reloc_status_type coff_i860_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
static reloc_howto_type *coff_i860_rtype_to_howto
PARAMS ((bfd *, asection *, struct internal_reloc *,
@ -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))
@ -139,7 +137,7 @@ coff_i860_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
#define PCRELOFFSET false
#endif
static reloc_howto_type howto_table[] =
static reloc_howto_type howto_table[] =
{
EMPTY_HOWTO (0),
EMPTY_HOWTO (1),
@ -147,32 +145,32 @@ static reloc_howto_type howto_table[] =
EMPTY_HOWTO (3),
EMPTY_HOWTO (4),
EMPTY_HOWTO (5),
HOWTO (R_DIR32, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
HOWTO (R_DIR32, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
coff_i860_reloc, /* special_function */
"dir32", /* name */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
coff_i860_reloc, /* special_function */
"dir32", /* name */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
true), /* pcrel_offset */
/* {7}, */
HOWTO (R_IMAGEBASE, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
HOWTO (R_IMAGEBASE, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
coff_i860_reloc, /* special_function */
"rva32", /* name */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
coff_i860_reloc, /* special_function */
"rva32", /* name */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
EMPTY_HOWTO (010),
EMPTY_HOWTO (011),
@ -181,83 +179,83 @@ static reloc_howto_type howto_table[] =
EMPTY_HOWTO (014),
EMPTY_HOWTO (015),
EMPTY_HOWTO (016),
HOWTO (R_RELBYTE, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
8, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
HOWTO (R_RELBYTE, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
8, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
coff_i860_reloc, /* special_function */
"8", /* name */
true, /* partial_inplace */
0x000000ff, /* src_mask */
0x000000ff, /* dst_mask */
coff_i860_reloc, /* special_function */
"8", /* name */
true, /* partial_inplace */
0x000000ff, /* src_mask */
0x000000ff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
HOWTO (R_RELWORD, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
HOWTO (R_RELWORD, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
coff_i860_reloc, /* special_function */
"16", /* name */
true, /* partial_inplace */
0x0000ffff, /* src_mask */
0x0000ffff, /* dst_mask */
coff_i860_reloc, /* special_function */
"16", /* name */
true, /* partial_inplace */
0x0000ffff, /* src_mask */
0x0000ffff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
HOWTO (R_RELLONG, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
HOWTO (R_RELLONG, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
coff_i860_reloc, /* special_function */
"32", /* name */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
coff_i860_reloc, /* special_function */
"32", /* name */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
HOWTO (R_PCRBYTE, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
8, /* bitsize */
true, /* pc_relative */
0, /* bitpos */
HOWTO (R_PCRBYTE, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
8, /* bitsize */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
coff_i860_reloc, /* special_function */
"DISP8", /* name */
true, /* partial_inplace */
0x000000ff, /* src_mask */
0x000000ff, /* dst_mask */
coff_i860_reloc, /* special_function */
"DISP8", /* name */
true, /* partial_inplace */
0x000000ff, /* src_mask */
0x000000ff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
HOWTO (R_PCRWORD, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
true, /* pc_relative */
0, /* bitpos */
HOWTO (R_PCRWORD, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
coff_i860_reloc, /* special_function */
"DISP16", /* name */
true, /* partial_inplace */
0x0000ffff, /* src_mask */
0x0000ffff, /* dst_mask */
coff_i860_reloc, /* special_function */
"DISP16", /* name */
true, /* partial_inplace */
0x0000ffff, /* src_mask */
0x0000ffff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
HOWTO (R_PCRLONG, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
true, /* pc_relative */
0, /* bitpos */
HOWTO (R_PCRLONG, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
coff_i860_reloc, /* special_function */
"DISP32", /* name */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
coff_i860_reloc, /* special_function */
"DISP32", /* name */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
PCRELOFFSET) /* pcrel_offset */
};
@ -335,14 +333,13 @@ coff_i860_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
function will be adding in the final value of the symbol. We
need to subtract out the current size in order to get the
correct result. */
BFD_ASSERT (h != NULL);
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,
the addresses which are different can be looked up in the map. The
the addresses which are different can be looked up in the map. The
case in which this section has been bypassed has addresses which correspond
to values I can find in the map */
*addendp -= sym->n_value;
@ -351,7 +348,7 @@ coff_i860_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
/* If the output symbol is common (in which case this must be a
relocateable link), we need to add in the final size of the
common symbol. */
if (h != NULL && h->root.type == bfd_link_hash_common)
if (h != NULL && h->root.type == bfd_link_hash_common)
*addendp += h->root.u.c.size;
return howto;
@ -400,7 +397,7 @@ const bfd_target
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
/* Note that we allow an object file to be treated as a core file as well. */
/* Note that we allow an object file to be treated as a core file as well. */
{_bfd_dummy_target, i3coff_object_p, /* bfd_check_format */
bfd_generic_archive_p, i3coff_object_p},
{bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
@ -419,6 +416,6 @@ const bfd_target
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
COFF_SWAP_TABLE
};

View File

@ -99,7 +99,7 @@ coff_i960_is_local_label_name (abfd, name)
#define BAL 0x0b000000 /* Template for 'bal' instruction */
#define BAL_MASK 0x00ffffff
static bfd_reloc_status_type
static bfd_reloc_status_type
optcall_callback (abfd, reloc_entry, symbol_in, data,
input_section, ignore_bfd, error_message)
bfd *abfd;
@ -117,13 +117,13 @@ optcall_callback (abfd, reloc_entry, symbol_in, data,
coff_symbol_type *cs = coffsymbol(symbol_in);
/* Don't do anything with symbols which aren't tied up yet,
except move the reloc. */
except move the reloc. */
if (bfd_is_und_section (cs->symbol.section)) {
reloc_entry->address += input_section->output_offset;
return bfd_reloc_ok;
}
/* So the target symbol has to be of coff type, and the symbol
/* So the target symbol has to be of coff type, and the symbol
has to have the correct native information within it */
if ((bfd_asymbol_flavour(&cs->symbol) != bfd_target_coff_flavour)
|| (cs->native == (combined_entry_type *)NULL))
@ -138,7 +138,7 @@ optcall_callback (abfd, reloc_entry, symbol_in, data,
}
else
{
switch (cs->native->u.syment.n_sclass)
switch (cs->native->u.syment.n_sclass)
{
case C_LEAFSTAT:
case C_LEAFEXT:
@ -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;
@ -188,7 +188,7 @@ optcall_callback (abfd, reloc_entry, symbol_in, data,
useful. It was used before this target was converted to use the
COFF specific backend linker. */
static bfd_reloc_status_type
static bfd_reloc_status_type
coff_i960_relocate (abfd, reloc_entry, symbol, data, input_section,
output_bfd, error_message)
bfd *abfd;
@ -402,7 +402,7 @@ coff_i960_relocate_section (output_bfd, info, input_bfd, input_section,
sym = NULL;
}
else
{
{
h = obj_coff_sym_hashes (input_bfd)[symndx];
sym = syms + symndx;
}
@ -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;
@ -661,6 +660,6 @@ bfd_getb64, bfd_getb_signed_64, bfd_putb64,
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
& icoff_little_vec,
COFF_SWAP_TABLE
};

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.
@ -97,7 +97,7 @@ extern reloc_howto_type m68kcoff_howto_table[];
#ifdef STATIC_RELOCS
static
#endif
reloc_howto_type m68kcoff_howto_table[] =
reloc_howto_type m68kcoff_howto_table[] =
{
HOWTO(R_RELBYTE, 0, 0, 8, false, 0, complain_overflow_bitfield, RELOC_SPECIAL_FN, "8", true, 0x000000ff,0x000000ff, false),
HOWTO(R_RELWORD, 0, 1, 16, false, 0, complain_overflow_bitfield, RELOC_SPECIAL_FN, "16", true, 0x0000ffff,0x0000ffff, false),
@ -130,7 +130,7 @@ m68k_rtype2howto(internal, relocentry)
arelent *internal;
int relocentry;
{
switch (relocentry)
switch (relocentry)
{
case R_RELBYTE: internal->howto = m68kcoff_howto_table + 0; break;
case R_RELWORD: internal->howto = m68kcoff_howto_table + 1; break;
@ -145,29 +145,29 @@ m68k_rtype2howto(internal, relocentry)
#ifdef STATIC_RELOCS
static
#endif
int
int
m68k_howto2rtype (internal)
reloc_howto_type *internal;
{
if (internal->pc_relative)
if (internal->pc_relative)
{
switch (internal->bitsize)
switch (internal->bitsize)
{
case 32: return R_PCRLONG;
case 16: return R_PCRWORD;
case 8: return R_PCRBYTE;
}
}
else
else
{
switch (internal->bitsize)
switch (internal->bitsize)
{
case 32: return R_RELLONG;
case 16: return R_RELWORD;
case 8: return R_RELBYTE;
}
}
return R_RELLONG;
return R_RELLONG;
}
#ifdef STATIC_RELOCS
@ -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

@ -51,7 +51,7 @@ m88k_is_local_label_name (abfd, name)
return name[0] == '@';
}
static bfd_reloc_status_type
static bfd_reloc_status_type
m88k_special_reloc (abfd, reloc_entry, symbol, data,
input_section, output_bfd, error_message)
bfd *abfd;
@ -144,7 +144,7 @@ m88k_special_reloc (abfd, reloc_entry, symbol, data,
return bfd_reloc_ok;
}
static reloc_howto_type howto_table[] =
static reloc_howto_type howto_table[] =
{
HOWTO (R_PCR16L, /* type */
02, /* rightshift */
@ -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

@ -42,7 +42,7 @@ extern boolean mcore_bfd_coff_final_link
static struct bfd_link_hash_table * coff_mcore_link_hash_table_create
PARAMS ((bfd *));
static bfd_reloc_status_type mcore_coff_unsupported_reloc
static bfd_reloc_status_type mcore_coff_unsupported_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
static boolean coff_mcore_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
@ -65,41 +65,40 @@ 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[] =
{
/* Unused: */
HOWTO (IMAGE_REL_MCORE_ABSOLUTE,/* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
HOWTO (IMAGE_REL_MCORE_ABSOLUTE,/* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* dont complain_on_overflow */
NULL, /* special_function */
NULL, /* special_function */
"ABSOLUTE", /* name */
false, /* partial_inplace */
0x00, /* src_mask */
0x00, /* dst_mask */
false, /* partial_inplace */
0x00, /* src_mask */
0x00, /* dst_mask */
false), /* pcrel_offset */
HOWTO (IMAGE_REL_MCORE_ADDR32,/* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
NULL, /* special_function */
NULL, /* special_function */
"ADDR32", /* name */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
/* 8 bits + 2 zero bits; jmpi/jsri/lrw instructions.
Should not appear in object files. */
Should not appear in object files. */
HOWTO (IMAGE_REL_MCORE_PCREL_IMM8BY4, /* type */
2, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
@ -114,7 +113,7 @@ static reloc_howto_type mcore_coff_howto_table[] =
0, /* dst_mask */
true), /* pcrel_offset */
/* bsr/bt/bf/br instructions; 11 bits + 1 zero bit
/* bsr/bt/bf/br instructions; 11 bits + 1 zero bit
Span 2k instructions == 4k bytes.
Only useful pieces at the relocated address are the opcode (5 bits) */
HOWTO (IMAGE_REL_MCORE_PCREL_IMM11BY2,/* type */
@ -131,7 +130,7 @@ static reloc_howto_type mcore_coff_howto_table[] =
0x7ff, /* dst_mask */
true), /* pcrel_offset */
/* 4 bits + 1 zero bit; 'loopt' instruction only; unsupported. */
/* 4 bits + 1 zero bit; 'loopt' instruction only; unsupported. */
HOWTO (IMAGE_REL_MCORE_PCREL_IMM4BY2, /* type */
1, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
@ -146,7 +145,7 @@ static reloc_howto_type mcore_coff_howto_table[] =
0, /* dst_mask */
true), /* pcrel_offset */
/* 32-bit pc-relative. Eventually this will help support PIC code. */
/* 32-bit pc-relative. Eventually this will help support PIC code. */
HOWTO (IMAGE_REL_MCORE_PCREL_32,/* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@ -163,11 +162,11 @@ static reloc_howto_type mcore_coff_howto_table[] =
/* Like PCREL_IMM11BY2, this relocation indicates that there is a
'jsri' at the specified address. There is a separate relocation
entry for the literal pool entry that it references, but we
entry for the literal pool entry that it references, but we
might be able to change the jsri to a bsr if the target turns out
to be close enough [even though we won't reclaim the literal pool
entry, we'll get some runtime efficiency back]. Note that this
is a relocation that we are allowed to safely ignore. */
is a relocation that we are allowed to safely ignore. */
HOWTO (IMAGE_REL_MCORE_PCREL_JSR_IMM11BY2,/* type */
1, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
@ -181,7 +180,7 @@ static reloc_howto_type mcore_coff_howto_table[] =
0x0, /* src_mask */
0x7ff, /* dst_mask */
true), /* pcrel_offset */
HOWTO (IMAGE_REL_MCORE_RVA, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@ -259,11 +258,10 @@ mcore_emit_base_file_entry (info, output_bfd, input_section, reloc_offset)
if (coff_data (output_bfd)->pe)
addr -= pe_data (output_bfd)->pe_opthdr.ImageBase;
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)
@ -276,17 +274,16 @@ mcore_coff_unsupported_reloc (abfd, reloc_entry, symbol, data, input_section,
char ** error_message ATTRIBUTE_UNUSED;
{
BFD_ASSERT (reloc_entry->howto != (reloc_howto_type *)0);
_bfd_error_handler (_("%s: Relocation %s (%d) is not currently supported.\n"),
bfd_get_filename (abfd),
reloc_entry->howto->name,
reloc_entry->howto->type);
return bfd_reloc_notsupported;
}
/* A cheesy little macro to make the code a little more readable. */
/* A cheesy little macro to make the code a little more readable. */
#define HOW2MAP(bfd_rtype, mcore_rtype) \
case bfd_rtype: return & mcore_coff_howto_table [mcore_rtype]
@ -296,7 +293,7 @@ mcore_coff_reloc_type_lookup (abfd, code)
bfd_reloc_code_real_type code;
{
switch (code)
{
{
HOW2MAP (BFD_RELOC_32, IMAGE_REL_MCORE_ADDR32);
HOW2MAP (BFD_RELOC_MCORE_PCREL_IMM8BY4, IMAGE_REL_MCORE_PCREL_IMM8BY4);
HOW2MAP (BFD_RELOC_MCORE_PCREL_IMM11BY2, IMAGE_REL_MCORE_PCREL_IMM11BY2);
@ -304,7 +301,7 @@ mcore_coff_reloc_type_lookup (abfd, code)
HOW2MAP (BFD_RELOC_32_PCREL, IMAGE_REL_MCORE_PCREL_32);
HOW2MAP (BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2, IMAGE_REL_MCORE_PCREL_JSR_IMM11BY2);
HOW2MAP (BFD_RELOC_RVA, IMAGE_REL_MCORE_RVA);
default:
default:
return NULL;
}
/*NOTREACHED*/
@ -326,19 +323,18 @@ 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;
howto = mcore_coff_howto_table + rel->r_type;
if (rel->r_type == IMAGE_REL_MCORE_RVA)
* addendp -= pe_data (sec->output_section->owner)->pe_opthdr.ImageBase;
else if (howto->pc_relative)
{
* addendp = sec->vma - 2; /* XXX guess - is this right ? */
/* If the symbol is defined, then the generic code is going to
add back the symbol value in order to cancel out an
adjustment it made to the addend. However, we set the addend
@ -350,7 +346,7 @@ coff_mcore_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
}
else
* addendp = 0;
return howto;
}
@ -362,8 +358,7 @@ in_reloc_p (abfd, howto)
reloc_howto_type * howto;
{
return ! howto->pc_relative && howto->type != IMAGE_REL_MCORE_RVA;
}
}
/* The reloc processing routine for the optimized COFF linker. */
static boolean
@ -382,13 +377,13 @@ coff_mcore_relocate_section (output_bfd, info, input_bfd, input_section,
struct internal_reloc * relend;
boolean hihalf;
bfd_vma hihalf_val;
/* If we are performing a relocateable link, we don't need to do a
thing. The caller will take care of adjusting the reloc
addresses and symbol indices. */
if (info->relocateable)
return true;
/* Check if we have the same endianess */
if ( input_bfd->xvec->byteorder != output_bfd->xvec->byteorder
&& output_bfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN)
@ -408,7 +403,7 @@ coff_mcore_relocate_section (output_bfd, info, input_bfd, input_section,
rel = relocs;
relend = rel + input_section->reloc_count;
for (; rel < relend; rel++)
{
long symndx;
@ -421,7 +416,7 @@ coff_mcore_relocate_section (output_bfd, info, input_bfd, input_section,
reloc_howto_type * howto = NULL;
struct coff_link_hash_entry * h;
const char * my_name;
symndx = rel->r_symndx;
loc = contents + rel->r_vaddr - input_section->vma;
@ -437,7 +432,7 @@ coff_mcore_relocate_section (output_bfd, info, input_bfd, input_section,
}
addend = 0;
/* Get the howto and initialise the addend. */
howto = bfd_coff_rtype_to_howto (input_bfd, input_section, rel, h,
sym, & addend);
@ -445,7 +440,7 @@ coff_mcore_relocate_section (output_bfd, info, input_bfd, input_section,
return false;
val = 0;
if (h == NULL)
{
if (symndx == -1)
@ -453,8 +448,8 @@ coff_mcore_relocate_section (output_bfd, info, input_bfd, input_section,
else
{
asection * sec = sections[symndx];
val = (sym->n_value
val = (sym->n_value
+ sec->output_section->vma
+ sec->output_offset);
@ -463,10 +458,10 @@ coff_mcore_relocate_section (output_bfd, info, input_bfd, input_section,
else if ( sym->_n._n_n._n_zeroes == 0
&& sym->_n._n_n._n_offset != 0)
my_name = obj_coff_strings (input_bfd) + sym->_n._n_n._n_offset;
else
else
{
static char buf [SYMNMLEN + 1];
strncpy (buf, sym->_n._n_name, SYMNMLEN);
buf[SYMNMLEN] = '\0';
my_name = buf;
@ -479,7 +474,7 @@ coff_mcore_relocate_section (output_bfd, info, input_bfd, input_section,
|| h->root.type == bfd_link_hash_defweak)
{
asection * sec = h->root.u.def.section;
val = (h->root.u.def.value
+ sec->output_section->vma
+ sec->output_offset);
@ -491,12 +486,12 @@ coff_mcore_relocate_section (output_bfd, info, input_bfd, input_section,
rel->r_vaddr - input_section->vma, true)))
return false;
}
my_name = h->root.root.string;
}
}
rstat = bfd_reloc_ok;
/* Each case must do its own relocation, setting rstat appropriately. */
switch (r_type)
{
@ -505,19 +500,19 @@ coff_mcore_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_get_filename (input_bfd), r_type);
bfd_set_error (bfd_error_bad_value);
return false;
case IMAGE_REL_MCORE_ABSOLUTE:
fprintf (stderr,
_("Warning: unsupported reloc %s <file %s, section %s>\n"),
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);
(unsigned long) rel->r_vaddr);
break;
case IMAGE_REL_MCORE_PCREL_IMM8BY4:
case IMAGE_REL_MCORE_PCREL_IMM11BY2:
case IMAGE_REL_MCORE_PCREL_IMM4BY2:
@ -527,7 +522,7 @@ coff_mcore_relocate_section (output_bfd, info, input_bfd, input_section,
/* XXX fixme - shouldn't this be like the code for the RVA reloc ? */
rstat = _bfd_relocate_contents (howto, input_bfd, val, loc);
break;
case IMAGE_REL_MCORE_RVA:
rstat = _bfd_final_link_relocate
(howto, input_bfd,
@ -535,36 +530,35 @@ coff_mcore_relocate_section (output_bfd, info, input_bfd, input_section,
val, addend);
break;
}
if (info->base_file)
{
/* Emit a reloc if the backend thinks it needs it. */
if (sym && pe_data (output_bfd)->in_reloc_p (output_bfd, howto))
mcore_emit_base_file_entry (info, output_bfd, input_section, rel->r_vaddr);
}
switch (rstat)
{
default:
abort ();
case bfd_reloc_ok:
break;
case bfd_reloc_overflow:
if (! ((*info->callbacks->reloc_overflow)
(info, my_name, howto->name,
(info, my_name, howto->name,
(bfd_vma) 0, input_bfd,
input_section, rel->r_vaddr - input_section->vma)))
return false;
}
}
}
return true;
}
/* Tailor coffcode.h -- macro heaven. */
/* Tailor coffcode.h -- macro heaven. */
/* We use the special COFF backend linker, with our own special touch. */
@ -581,6 +575,10 @@ coff_mcore_relocate_section (output_bfd, info, input_bfd, input_section,
/* Forward declaration to initialise alterbative_target field. */
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)
/* 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_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,
@ -1195,7 +1193,7 @@ mips_relocate_hi (refhi, reflo, input_bfd, input_section, contents, adjust,
if (refhi == NULL)
return;
insn = bfd_get_32 (input_bfd,
contents + adjust + refhi->r_vaddr - input_section->vma);
if (reflo == NULL)
@ -1204,7 +1202,7 @@ mips_relocate_hi (refhi, reflo, input_bfd, input_section, contents, adjust,
vallo = (bfd_get_32 (input_bfd,
contents + adjust + reflo->r_vaddr - input_section->vma)
& 0xffff);
val = ((insn & 0xffff) << 16) + vallo;
val += relocation;
@ -1505,7 +1503,7 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section,
memmove (here + PCREL16_EXPANSION_ADJUSTMENT, here,
(size_t) (input_section->_raw_size
- (int_rel.r_vaddr - input_section->vma)));
/* Generate the new instructions. */
if (! mips_relax_pcrel16 (info, input_bfd, input_section,
h, here,
@ -1626,7 +1624,7 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section,
int_rel.r_symndx = RELOC_SECTION_TEXT;
break;
}
if (int_rel.r_symndx == -1)
abort ();
@ -2104,7 +2102,7 @@ mips_relax_section (abfd, sec, info, again)
somebody felt it were important. Ignoring this reloc will
presumably cause a reloc overflow error later on. */
if (bfd_get_32 (abfd, contents + int_rel.r_vaddr - sec->vma)
!= 0x0411ffff) /* bgezal $0,. == bal . */
!= 0x0411ffff) /* bgezal $0,. == bal . */
continue;
/* Bother. We need to expand this reloc, and we will need to
@ -2180,7 +2178,7 @@ mips_relax_section (abfd, sec, info, again)
mips_ecoff_swap_reloc_in (abfd, (PTR) (adj_ext_rel + 1), &rello);
BFD_ASSERT (rello.r_type == MIPS_R_RELLO);
addhi = bfd_get_32 (abfd,
contents + adj_int_rel.r_vaddr - sec->vma);
addhi &= 0xffff;
@ -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,
@ -2643,7 +2641,7 @@ const bfd_target ecoff_little_vec =
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
& ecoff_big_vec,
(PTR) &mips_ecoff_backend_data
};
@ -2686,7 +2684,7 @@ const bfd_target ecoff_big_vec =
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
& ecoff_little_vec,
(PTR) &mips_ecoff_backend_data
};
@ -2730,6 +2728,6 @@ const bfd_target ecoff_biglittle_vec =
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
(PTR) &mips_ecoff_backend_data
};

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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "coff/pe.h"
#ifndef COFF_IMAGE_WITH_PE
static boolean sh_align_load_span
static boolean sh_align_load_span
PARAMS ((bfd *, asection *, bfd_byte *,
boolean (*) (bfd *, asection *, PTR, bfd_byte *, bfd_vma),
PTR, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, boolean *));
@ -88,7 +88,7 @@ static boolean in_reloc_p (abfd, howto)
reloc_howto_type * howto;
{
return ! howto->pc_relative && howto->type != R_SH_IMAGEBASE;
}
}
#endif
/* The supported relocations. There are a lot of relocations defined
@ -171,18 +171,18 @@ static reloc_howto_type sh_coff_howtos[] =
EMPTY_HOWTO (15),
#ifdef COFF_WITH_PE
HOWTO (R_SH_IMAGEBASE, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
HOWTO (R_SH_IMAGEBASE, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
sh_reloc, /* special_function */
"rva32", /* name */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
sh_reloc, /* special_function */
"rva32", /* name */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
#else
EMPTY_HOWTO (16), /* R_SH_IMM8 */
@ -391,14 +391,14 @@ static reloc_howto_type sh_coff_howtos[] =
/* Get the value of a symbol, when performing a relocation. */
static long
get_symbol_value (symbol)
get_symbol_value (symbol)
asymbol *symbol;
{
{
bfd_vma relocation;
if (bfd_is_com_section (symbol->section))
relocation = 0;
else
relocation = 0;
else
relocation = (symbol->value +
symbol->section->output_section->vma +
symbol->section->output_offset);
@ -676,7 +676,7 @@ sh_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
align load and store instructions on four byte boundaries if we
can, by swapping them with one of the adjacent instructions. */
static boolean
static boolean
sh_relax_section (abfd, sec, link_info, again)
bfd *abfd;
asection *sec;
@ -2144,7 +2144,7 @@ sh_insn_info (insn)
return op;
}
return NULL;
return NULL;
}
/* See whether an instruction uses or sets a general purpose register */
@ -2251,7 +2251,7 @@ sh_insn_uses_freg (insn, op, freg)
of a double precision value.
So what this all boils down to is that we have to ignore the lowest
bit of the register number. */
if ((f & USESF1) != 0
&& (USESF1_REG (insn) & 0xe) == (freg & 0xe))
return true;
@ -2285,7 +2285,7 @@ sh_insn_sets_freg (insn, op, freg)
of a double precision value.
So what this all boils down to is that we have to ignore the lowest
bit of the register number. */
if ((f & SETSF1) != 0
&& (SETSF1_REG (insn) & 0xe) == (freg & 0xe))
return true;
@ -2485,7 +2485,7 @@ _bfd_sh_align_load_span (abfd, sec, contents, swap, relocs,
if (dsp && i - 2 > start)
{
unsigned pprev_insn = bfd_get_16 (abfd, contents + i - 4);
if ((pprev_insn & 0xfc00) == 0xf800)
prev_op = NULL;
else
@ -2875,7 +2875,7 @@ sh_relocate_section (output_bfd, info, input_bfd, input_section, contents,
sym = NULL;
}
else
{
{
if (symndx < 0
|| (unsigned long) symndx >= obj_raw_syment_count (input_bfd))
{
@ -2912,7 +2912,7 @@ sh_relocate_section (output_bfd, info, input_bfd, input_section, contents,
if (rel->r_type == R_SH_IMAGEBASE)
addend -= pe_data (input_section->output_section->owner)->pe_opthdr.ImageBase;
#endif
val = 0;
if (h == NULL)
@ -3118,7 +3118,7 @@ CREATE_BIG_COFF_TARGET_VEC (shcoff_vec, "coff-sh", BFD_IS_RELAXABLE, 0, '_', NUL
#else
#define TARGET_SYM shlcoff_vec
#endif
#ifndef TARGET_SHL_NAME
#define TARGET_SHL_NAME "coff-shl"
#endif
@ -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,
@ -3260,7 +3270,7 @@ const bfd_target shcoff_small_vec =
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
& shlcoff_small_vec,
(PTR) &bfd_coff_small_swap_table
};
@ -3287,7 +3297,7 @@ const bfd_target shlcoff_small_vec =
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
{_bfd_dummy_target, coff_small_object_p, /* bfd_check_format */
bfd_generic_archive_p, _bfd_dummy_target},
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 */
@ -3304,7 +3314,7 @@ const bfd_target shlcoff_small_vec =
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
& shcoff_small_vec,
(PTR) &bfd_coff_small_swap_table
};
#endif

View File

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

View File

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

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

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

@ -424,7 +424,7 @@ local16_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
/* Code to turn an external r_type into a pointer to an entry in the howto_table.
If passed an r_type we don't recognize the abort rather than silently failing
to generate an output file. */
to generate an output file. */
static void
rtype2howto (cache_ptr, dst)
@ -465,7 +465,7 @@ coff_tic80_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
{
/* 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. */
in the output section. */
*addendp = (sec -> output_section -> vma + sec -> output_offset) - sec -> vma;
}
RTYPE2HOWTO (&genrel, rel);
@ -518,7 +518,7 @@ coff_tic80_relocate_section (output_bfd, info, input_bfd,
sym = NULL;
}
else
{
{
h = obj_coff_sym_hashes (input_bfd)[symndx];
sym = syms + symndx;
}
@ -649,7 +649,7 @@ coff_tic80_relocate_section (output_bfd, info, input_bfd,
contents[addr + 1] |= hold & 0x80;
break;
}
case R_PPBASE:
/* Parameter RAM is from 0x1000000 to 0x1000800. */
contents[addr] &=~ 0x3;

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;
@ -129,11 +120,11 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info)
unsigned int shrink;
struct bfd_link_info *link_info;
{
bfd_vma value;
bfd_vma value;
bfd_vma dot;
bfd_vma gap;
/* The address of the thing to be relocated will have moved back by
/* The address of the thing to be relocated will have moved back by
the size of the shrink - but we don't change reloc->address here,
since we need it to know where the relocation lives in the source
uncooked section */
@ -141,10 +132,9 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info)
/* reloc->address -= shrink; conceptual */
bfd_vma address = reloc->address - shrink;
switch (reloc->howto->type)
{
{
case R_MOV16B2:
case R_JMP2:
shrink+=2;
@ -155,40 +145,40 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info)
value = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
if (value >= 0xff00)
{
{
/* Change the reloc type from 16bit, possible 8 to 8bit
possible 16 */
reloc->howto = reloc->howto + 1;
reloc->howto = reloc->howto + 1;
/* The place to relc moves back by one */
/* This will be two bytes smaller in the long run */
shrink +=2 ;
bfd_perform_slip(abfd, 2, input_section, address);
}
}
break;
/* This is the 24 bit branch which could become an 8 bitter,
/* This is the 24 bit branch which could become an 8 bitter,
the relocation points to the first byte of the insn, not the
actual data */
case R_JMPL1:
value = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
dot = input_section->output_section->vma +
input_section->output_offset + address;
/* See if the address we're looking at within 127 bytes of where
we are, if so then we can use a small branch rather than the
jump we were going to */
gap = value - dot ;
if (-120 < (long)gap && (long)gap < 120 )
{
{
/* Change the reloc type from 24bit, possible 8 to 8bit
possible 32 */
reloc->howto = reloc->howto + 1;
reloc->howto = reloc->howto + 1;
/* This will be two bytes smaller in the long run */
shrink +=2 ;
bfd_perform_slip(abfd, 2, input_section, address);
@ -198,23 +188,22 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info)
case R_JMP1:
value = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
dot = input_section->output_section->vma +
input_section->output_offset + address;
/* See if the address we're looking at within 127 bytes of where
we are, if so then we can use a small branch rather than the
jump we were going to */
gap = value - (dot - shrink);
if (-120 < (long)gap && (long)gap < 120 )
{
{
/* Change the reloc type from 16bit, possible 8 to 8bit
possible 16 */
reloc->howto = reloc->howto + 1;
reloc->howto = reloc->howto + 1;
/* The place to relc moves back by one */
/* This will be two bytes smaller in the long run */
@ -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
@ -336,8 +323,8 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
{
int gap = bfd_coff_reloc16_get_value (reloc, link_info,
input_section);
bfd_vma dot = link_order->offset
+ dst_address
bfd_vma dot = link_order->offset
+ dst_address
+ link_order->u.indirect.section->output_section->vma;
gap -= dot + 1;
@ -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;
@ -358,11 +345,10 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
{
bfd_vma gap = bfd_coff_reloc16_get_value (reloc, link_info,
input_section);
bfd_vma dot = link_order->offset
+ dst_address
bfd_vma dot = link_order->offset
+ 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

@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
static reloc_howto_type howto_table[] =
static reloc_howto_type howto_table[] =
{
EMPTY_HOWTO (0),
EMPTY_HOWTO (1),

View File

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

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

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

View File

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

View File

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

View File

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

@ -33,7 +33,7 @@ const bfd_arch_info_type bfd_a29k_arch =
"a29k",
4,
true, /* the one and only */
bfd_default_compatible,
bfd_default_compatible,
bfd_default_scan ,
0,
};

View File

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

View File

@ -24,31 +24,31 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define ARC(mach, print_name, default_p, next) \
{ \
32, /* 32 bits in a word */ \
32, /* 32 bits in an address */ \
8, /* 8 bits in a byte */ \
32, /* 32 bits in a word */ \
32, /* 32 bits in an address */ \
8, /* 8 bits in a byte */ \
bfd_arch_arc, \
mach, \
"arc", \
print_name, \
4, /* section alignment power */ \
4, /* section alignment power */ \
default_p, \
bfd_default_compatible, \
bfd_default_scan, \
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)
return p->mach;
}
if (strcmp (name, p->printable_name) == 0)
return p->mach;
return -1;
}

View File

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

View File

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

@ -22,50 +22,50 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "sysdep.h"
#include "libbfd.h"
static const bfd_arch_info_type d10v_ts3_info =
{
16, /* 16 bits in a word */
16, /* 16 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_d10v,
bfd_mach_d10v_ts3,
"d10v",
"d10v:ts3",
4, /* section alignment power */
false,
bfd_default_compatible,
bfd_default_scan,
0,
};
static const bfd_arch_info_type d10v_ts2_info =
static const bfd_arch_info_type d10v_ts3_info =
{
16, /* 16 bits in a word */
16, /* 16 bits in an address */
8, /* 8 bits in a byte */
16, /* 16 bits in a word */
16, /* 16 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_d10v,
bfd_mach_d10v_ts2,
"d10v",
"d10v:ts2",
4, /* section alignment power */
false,
bfd_default_compatible,
bfd_default_scan,
&d10v_ts3_info,
bfd_mach_d10v_ts3,
"d10v",
"d10v:ts3",
4, /* section alignment power */
false,
bfd_default_compatible,
bfd_default_scan,
0,
};
const bfd_arch_info_type bfd_d10v_arch =
{
16, /* 16 bits in a word */
16, /* 16 bits in an address */
8, /* 8 bits in a byte */
static const bfd_arch_info_type d10v_ts2_info =
{
16, /* 16 bits in a word */
16, /* 16 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_d10v,
bfd_mach_d10v,
"d10v",
"d10v",
4, /* section alignment power */
true,
bfd_default_compatible,
bfd_default_scan,
&d10v_ts2_info,
bfd_mach_d10v_ts2,
"d10v",
"d10v:ts2",
4, /* section alignment power */
false,
bfd_default_compatible,
bfd_default_scan,
&d10v_ts3_info,
};
const bfd_arch_info_type bfd_d10v_arch =
{
16, /* 16 bits in a word */
16, /* 16 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_d10v,
bfd_mach_d10v,
"d10v",
"d10v",
4, /* section alignment power */
true,
bfd_default_compatible,
bfd_default_scan,
&d10v_ts2_info,
};

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

@ -24,11 +24,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#if 0
/*
/*
Relocations for the Z8K
*/
static bfd_reloc_status_type
static bfd_reloc_status_type
howto16_callback (abfd, reloc_entry, symbol_in, data,
ignore_input_section, ignore_bfd)
bfd *abfd;
@ -40,18 +40,17 @@ 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
static bfd_reloc_status_type
howto8_callback (abfd, reloc_entry, symbol_in, data,
ignore_input_section, ignore_bfd)
bfd *abfd;
@ -63,18 +62,17 @@ 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
static bfd_reloc_status_type
howto8_FFnn_callback (abfd, reloc_entry, symbol_in, data,
ignore_input_section, ignore_bfd)
bfd *abfd;
@ -87,17 +85,17 @@ 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;
}
static bfd_reloc_status_type
static bfd_reloc_status_type
howto8_pcrel_callback (abfd, reloc_entry, symbol_in, data,
ignore_input_section, ignore_bfd)
bfd *abfd;
@ -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;
@ -154,7 +149,7 @@ local_bfd_reloc_type_lookup (arch, code)
int bfd_default_scan_num_mach();
static boolean
static boolean
scan_mach (info, string)
const struct bfd_arch_info *info ATTRIBUTE_UNUSED;
const char *string;
@ -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

@ -32,7 +32,7 @@ static const bfd_arch_info_type bfd_hppa10_arch =
"hppa1.0",
3,
true, /* Unless we use 1.1 specific features */
bfd_default_compatible,
bfd_default_compatible,
bfd_default_scan ,
0,
};
@ -49,7 +49,7 @@ static const bfd_arch_info_type bfd_hppa20_arch =
"hppa2.0",
3,
false, /* Unless we use 1.1 specific features */
bfd_default_compatible,
bfd_default_compatible,
bfd_default_scan ,
&bfd_hppa10_arch,
};
@ -66,7 +66,7 @@ static const bfd_arch_info_type bfd_hppa20w_arch =
"hppa2.0w",
3,
false, /* Unless we use 1.1 specific features */
bfd_default_compatible,
bfd_default_compatible,
bfd_default_scan ,
&bfd_hppa20_arch,
};
@ -82,7 +82,7 @@ const bfd_arch_info_type bfd_hppa_arch =
"hppa1.1",
3,
false, /* 1.1 specific features used */
bfd_default_compatible,
bfd_default_compatible,
bfd_default_scan ,
&bfd_hppa20w_arch,
};

View File

@ -46,7 +46,7 @@ i370_compatible (a, b)
static const bfd_arch_info_type arch_info_struct[] =
{
/* hack alert: old old machines are really 16 and 24 bit arch ... */
/* hack alert: old old machines are really 16 and 24 bit arch ... */
{
32, /* 32 bits in a word */
32, /* 32 bits in an address */

View File

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

View File

@ -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
@ -25,16 +25,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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_default_compatible,
bfd_default_scan ,
0,
32, /* 32 bits in a word */
32, /* 32 bits in an address */
8, /* 8 bits in a byte */
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, /* 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 ++;
}
/* 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;
}
string++;
if (string[0] == '\0')
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 */
@ -102,17 +120,17 @@ compatible (a,b)
{
/* The i960 has distinct subspecies which may not interbreed:
CORE CA
CORE CA
CORE KA KB MC XA
CORE HX JX
Any architecture on the same line is compatible, the one on
the right is the least restrictive.
the right is the least restrictive.
We represent this information in an array, each machine to a side */
#define ERROR 0
#define CORE bfd_mach_i960_core /*1*/
#define KA bfd_mach_i960_ka_sa /*2*/
#define CORE bfd_mach_i960_core /*1*/
#define KA bfd_mach_i960_ka_sa /*2*/
#define KB bfd_mach_i960_kb_sb /*3*/
#define MC bfd_mach_i960_mc /*4*/
#define XA bfd_mach_i960_xa /*5*/
@ -121,7 +139,7 @@ compatible (a,b)
#define HX bfd_mach_i960_hx /*8*/
#define MAX_ARCH ((int)HX)
static CONST unsigned long matrix[MAX_ARCH+1][MAX_ARCH+1] =
static CONST unsigned long matrix[MAX_ARCH+1][MAX_ARCH+1] =
{
{ ERROR, CORE, KA, KB, MC, XA, CA, JX, HX },
{ CORE, CORE, KA, KB, MC, XA, CA, JX, HX },
@ -134,25 +152,22 @@ compatible (a,b)
{ HX, HX, ERROR, ERROR, ERROR, ERROR, ERROR, HX, HX },
};
if (a->arch != b->arch || matrix[a->mach][b->mach] == ERROR)
if (a->arch != b->arch || matrix[a->mach][b->mach] == ERROR)
{
return NULL;
}
else
else
{
return (a->mach == matrix[a->mach][b->mach]) ? 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,}
static const bfd_arch_info_type arch_info_struct[] =
{
static const bfd_arch_info_type arch_info_struct[] =
{
N(bfd_mach_i960_ka_sa,"i960:ka_sa",false, &arch_info_struct[1]),
N(bfd_mach_i960_kb_sb,"i960:kb_sb",false, &arch_info_struct[2]),
N(bfd_mach_i960_mc, "i960:mc", false, &arch_info_struct[3]),

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"

View File

@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define NEXT NULL
static const bfd_arch_info_type arch_info_struct[] =
static const bfd_arch_info_type arch_info_struct[] =
{
N (bfd_mach_m32rx, "m32rx", false, NULL)
};

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

@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
{ 32, 32, 8, bfd_arch_m68k, name, "m68k",print,2,d,bfd_default_compatible,bfd_default_scan, next, }
static const bfd_arch_info_type arch_info_struct[] =
{
{
N(bfd_mach_m68000, "m68k:68000", false, &arch_info_struct[1]),
N(bfd_mach_m68008, "m68k:68008", false, &arch_info_struct[2]),
N(bfd_mach_m68010, "m68k:68010", false, &arch_info_struct[3]),

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 */
@ -36,7 +33,7 @@ const bfd_arch_info_type bfd_m88k_arch =
"m88k:88100",
3,
true, /* the one and only */
bfd_default_compatible,
bfd_default_compatible,
bfd_default_scan ,
0,
};

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,46 +38,54 @@ 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[] =
static const bfd_arch_info_type arch_info_struct[] =
{
N (32, 32, bfd_mach_mips3000, "mips:3000", false, NN(I_mips3000)),
N (32, 32, bfd_mach_mips3900, "mips:3900", false, NN(I_mips3900)),
N (64, 64, bfd_mach_mips4000, "mips:4000", false, NN(I_mips4000)),
N (64, 64, bfd_mach_mips4010, "mips:4010", false, NN(I_mips4010)),
N (64, 64, bfd_mach_mips4100, "mips:4100", false, NN(I_mips4100)),
N (64, 64, bfd_mach_mips4111, "mips:4111", false, NN(I_mips4111)),
N (64, 64, bfd_mach_mips4300, "mips:4300", false, NN(I_mips4300)),
N (64, 64, bfd_mach_mips4400, "mips:4400", false, NN(I_mips4400)),
N (64, 64, bfd_mach_mips4600, "mips:4600", false, NN(I_mips4600)),
N (64, 64, bfd_mach_mips4650, "mips:4650", false, NN(I_mips4650)),
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 (32, 32, bfd_mach_mips3000, "mips:3000", false, NN(I_mips3000)),
N (32, 32, bfd_mach_mips3900, "mips:3900", false, NN(I_mips3900)),
N (64, 64, bfd_mach_mips4000, "mips:4000", false, NN(I_mips4000)),
N (64, 64, bfd_mach_mips4010, "mips:4010", false, NN(I_mips4010)),
N (64, 64, bfd_mach_mips4100, "mips:4100", false, NN(I_mips4100)),
N (64, 64, bfd_mach_mips4111, "mips:4111", false, NN(I_mips4111)),
N (64, 64, bfd_mach_mips4300, "mips:4300", false, NN(I_mips4300)),
N (64, 64, bfd_mach_mips4400, "mips:4400", false, NN(I_mips4400)),
N (64, 64, bfd_mach_mips4600, "mips:4600", false, NN(I_mips4600)),
N (64, 64, bfd_mach_mips4650, "mips:4650", false, NN(I_mips4650)),
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, 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

@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
{ 32, 32, 8, bfd_arch_ns32k, machine, "ns32k",printable,3,d,bfd_default_compatible,bfd_default_scan, next, }
static const bfd_arch_info_type arch_info_struct[] =
{
{
N(32532,"ns32k:32532",true, 0), /* the word ns32k will match this too */
};
@ -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,8 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "sysdep.h"
#include "libbfd.h"
static boolean
static boolean
scan_mach (info, string)
const struct bfd_arch_info *info;
const char *string;
@ -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,8 +47,7 @@ compatible (a,b)
}
#endif
static const bfd_arch_info_type arch_info_struct[] =
static const bfd_arch_info_type arch_info_struct[] =
{
{
32, /* 32 bits in a word */

View File

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

View File

@ -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,8 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "sysdep.h"
#include "libbfd.h"
static boolean
static boolean
scan_mach (info, string)
const struct bfd_arch_info *info;
const char *string;
@ -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,15 +47,15 @@ compatible (a,b)
}
#endif
#define SH_NEXT &arch_info_struct[0]
#define SH2_NEXT &arch_info_struct[1]
#define SH_DSP_NEXT &arch_info_struct[2]
#define SH3_NEXT &arch_info_struct[3]
#define SH_NEXT &arch_info_struct[0]
#define SH2_NEXT &arch_info_struct[1]
#define SH_DSP_NEXT &arch_info_struct[2]
#define SH3_NEXT &arch_info_struct[3]
#define SH3_DSP_NEXT &arch_info_struct[4]
#define SH3E_NEXT &arch_info_struct[5]
#define SH4_NEXT NULL
#define SH3E_NEXT &arch_info_struct[5]
#define SH4_NEXT NULL
static const bfd_arch_info_type arch_info_struct[] =
static const bfd_arch_info_type arch_info_struct[] =
{
{
32, /* 32 bits in a word */

View File

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

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

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

View File

@ -33,7 +33,7 @@ const bfd_arch_info_type bfd_vax_arch =
"vax",
3,
true, /* the one and only */
bfd_default_compatible,
bfd_default_compatible,
bfd_default_scan ,
0,
};

View File

@ -22,10 +22,9 @@ 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
static boolean
scan_mach (info, string)
const struct bfd_arch_info *info ATTRIBUTE_UNUSED;
const char *string;
@ -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

@ -33,7 +33,7 @@ const bfd_arch_info_type bfd_we32k_arch =
"we32k:32000",
3,
true, /* the one and only */
bfd_default_compatible,
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"
#if 0 /* not used currently */
/*
Relocations for the Z8K
@ -50,7 +49,6 @@ howto16_callback (abfd, reloc_entry, symbol_in, data,
return bfd_reloc_ok;
}
static bfd_reloc_status_type
howto8_callback (abfd, reloc_entry, symbol_in, data,
ignore_input_section, ignore_bfd)
@ -73,7 +71,6 @@ howto8_callback (abfd, reloc_entry, symbol_in, data,
return bfd_reloc_ok;
}
static bfd_reloc_status_type
howto8_FFnn_callback (abfd, reloc_entry, symbol_in, data,
ignore_input_section, ignore_bfd)
@ -119,8 +116,6 @@ howto8_pcrel_callback (abfd, reloc_entry, symbol_in, data,
return bfd_reloc_ok;
}
static reloc_howto_type howto_16
= NEWHOWTO (howto16_callback, "abs16", 1, false, false);
static reloc_howto_type howto_8
@ -132,7 +127,6 @@ static reloc_howto_type howto_8_FFnn
static reloc_howto_type howto_8_pcrel
= NEWHOWTO (howto8_pcrel_callback, "pcrel8", 0, false, true);
static reloc_howto_type *
local_bfd_reloc_type_lookup (arch, code)
const struct bfd_arch_info *arch;
@ -172,7 +166,6 @@ scan_mach (info, string)
return false;
}
/* This routine is provided two arch_infos and returns whether
they'd be compatible */
@ -186,7 +179,6 @@ compatible (a, b)
return a;
}
static const bfd_arch_info_type arch_info_struct[] =
{
{32, 32, 8, bfd_arch_z8k, bfd_mach_z8001, "z8k", "z8001", 1, false, compatible, scan_mach, 0,},

View File

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

View File

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

View File

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

View File

@ -148,7 +148,7 @@ Swap the information in an internal exec header structure
@example
const bfd_target *aout_@var{size}_some_aout_object_p
(bfd *abfd,
const bfd_target *(*callback_to_real_object_p)());
const bfd_target *(*callback_to_real_object_p) ());
@end example
@strong{Description}@*
Some a.out variant thinks that the file open in @var{abfd}

View File

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

View File

@ -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
@ -786,7 +810,7 @@ Stuff which should be documented:
#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
BFD_SEND (abfd, _bfd_find_nearest_line, (abfd, sec, syms, off, file, func, line))
/* Do these three do anything useful at all, for any back end? */
/* Do these three do anything useful at all, for any back end? */
#define bfd_debug_info_start(abfd) \
BFD_SEND (abfd, _bfd_debug_info_start, (abfd))

View File

@ -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
@ -31,10 +24,10 @@ typedef asection
Here is the section structure:
/* This structure is used for a comdat section, as in PE. A comdat
section is associated with a particular symbol. When the linker
sees a comdat section, it keeps only one of the sections with a
given name and associated with a given symbol. */
/* This structure is used for a comdat section, as in PE. A comdat
section is associated with a particular symbol. When the linker
sees a comdat section, it keeps only one of the sections with a
given name and associated with a given symbol. */
struct bfd_comdat_info
{
@ -46,340 +39,362 @@ 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
{
/* The name of the section; the name isn't a copy, the pointer is
the same as that passed to bfd_make_section. */
/* The name of the section; the name isn't a copy, the pointer is
the same as that passed to bfd_make_section. */
CONST char *name;
const char *name;
/* Which section is it; 0..nth. */
/* A unique sequence number. */
int index;
int id;
/* The next section in the list belonging to the BFD, or NULL. */
/* Which section is it; 0..nth. */
struct sec *next;
int index;
/* The field flags contains attributes of the section. Some
flags are read in from the object file, and some are
synthesized from other information. */
/* The next section in the list belonging to the BFD, or NULL. */
flagword flags;
struct sec *next;
/* The field flags contains attributes of the section. Some
flags are read in from the object file, and some are
synthesized from other information. */
flagword flags;
#define SEC_NO_FLAGS 0x000
/* Tells the OS to allocate space for this section when loading.
This is clear for a section containing debug information
only. */
/* Tells the OS to allocate space for this section when loading.
This is clear for a section containing debug information only. */
#define SEC_ALLOC 0x001
/* Tells the OS to load the section from the file when loading.
This is clear for a .bss section. */
/* Tells the OS to load the section from the file when loading.
This is clear for a .bss section. */
#define SEC_LOAD 0x002
/* The section contains data still to be relocated, so there is
some relocation information too. */
/* The section contains data still to be relocated, so there is
some relocation information too. */
#define SEC_RELOC 0x004
#if 0 /* Obsolete ? */
#define SEC_BALIGN 0x008
#endif
/* A signal to the OS that the section contains read only
data. */
/* A signal to the OS that the section contains read only data. */
#define SEC_READONLY 0x010
/* The section contains code only. */
/* The section contains code only. */
#define SEC_CODE 0x020
/* The section contains data only. */
/* The section contains data only. */
#define SEC_DATA 0x040
/* The section will reside in ROM. */
/* The section will reside in ROM. */
#define SEC_ROM 0x080
/* The section contains constructor information. This section
type is used by the linker to create lists of constructors and
destructors used by `g++'. When a back end sees a symbol
which should be used in a constructor list, it creates a new
section for the type of name (e.g., `__CTOR_LIST__'), attaches
the symbol to it, and builds a relocation. To build the lists
of constructors, all the linker has to do is catenate all the
sections called `__CTOR_LIST__' and relocate the data
contained within - exactly the operations it would peform on
standard data. */
/* The section contains constructor information. This section
type is used by the linker to create lists of constructors and
destructors used by `g++'. When a back end sees a symbol
which should be used in a constructor list, it creates a new
section for the type of name (e.g., `__CTOR_LIST__'), attaches
the symbol to it, and builds a relocation. To build the lists
of constructors, all the linker has to do is catenate all the
sections called `__CTOR_LIST__' and relocate the data
contained within - exactly the operations it would peform on
standard data. */
#define SEC_CONSTRUCTOR 0x100
/* The section is a constructor, and should be placed at the
end of the text, data, or bss section(?). */
/* The section is a constructor, and should be placed at the
end of the text, data, or bss section(?). */
#define SEC_CONSTRUCTOR_TEXT 0x1100
#define SEC_CONSTRUCTOR_DATA 0x2100
#define SEC_CONSTRUCTOR_BSS 0x3100
/* The section has contents - a data section could be
`SEC_ALLOC' | `SEC_HAS_CONTENTS'; a debug section could be
`SEC_HAS_CONTENTS' */
/* The section has contents - a data section could be
`SEC_ALLOC' | `SEC_HAS_CONTENTS'; a debug section could be
`SEC_HAS_CONTENTS' */
#define SEC_HAS_CONTENTS 0x200
/* An instruction to the linker to not output the section
even if it has information which would normally be written. */
/* An instruction to the linker to not output the section
even if it has information which would normally be written. */
#define SEC_NEVER_LOAD 0x400
/* The section is a COFF shared library section. This flag is
only for the linker. If this type of section appears in
the input file, the linker must copy it to the output file
without changing the vma or size. FIXME: Although this
was originally intended to be general, it really is COFF
specific (and the flag was renamed to indicate this). It
might be cleaner to have some more general mechanism to
allow the back end to control what the linker does with
sections. */
/* The section is a COFF shared library section. This flag is
only for the linker. If this type of section appears in
the input file, the linker must copy it to the output file
without changing the vma or size. FIXME: Although this
was originally intended to be general, it really is COFF
specific (and the flag was renamed to indicate this). It
might be cleaner to have some more general mechanism to
allow the back end to control what the linker does with
sections. */
#define SEC_COFF_SHARED_LIBRARY 0x800
/* The section contains common symbols (symbols may be defined
multiple times, the value of a symbol is the amount of
space it requires, and the largest symbol value is the one
used). Most targets have exactly one of these (which we
translate to bfd_com_section_ptr), but ECOFF has two. */
/* The section has GOT references. This flag is only for the
linker, and is currently only used by the elf32-hppa back end.
It will be set if global offset table references were detected
in this section, which indicate to the linker that the section
contains PIC code, and must be handled specially when doing a
static link. */
#define SEC_HAS_GOT_REF 0x4000
/* The section contains common symbols (symbols may be defined
multiple times, the value of a symbol is the amount of
space it requires, and the largest symbol value is the one
used). Most targets have exactly one of these (which we
translate to bfd_com_section_ptr), but ECOFF has two. */
#define SEC_IS_COMMON 0x8000
/* The section contains only debugging information. For
example, this is set for ELF .debug and .stab sections.
strip tests this flag to see if a section can be
discarded. */
/* The section contains only debugging information. For
example, this is set for ELF .debug and .stab sections.
strip tests this flag to see if a section can be
discarded. */
#define SEC_DEBUGGING 0x10000
/* The contents of this section are held in memory pointed to
by the contents field. This is checked by
bfd_get_section_contents, and the data is retrieved from
memory if appropriate. */
/* The contents of this section are held in memory pointed to
by the contents field. This is checked by bfd_get_section_contents,
and the data is retrieved from memory if appropriate. */
#define SEC_IN_MEMORY 0x20000
/* The contents of this section are to be excluded by the
linker for executable and shared objects unless those
objects are to be further relocated. */
/* The contents of this section are to be excluded by the
linker for executable and shared objects unless those
objects are to be further relocated. */
#define SEC_EXCLUDE 0x40000
/* The contents of this section are to be sorted by the
based on the address specified in the associated symbol
table. */
/* The contents of this section are to be sorted by the
based on the address specified in the associated symbol
table. */
#define SEC_SORT_ENTRIES 0x80000
/* When linking, duplicate sections of the same name should be
discarded, rather than being combined into a single section as
is usually done. This is similar to how common symbols are
handled. See SEC_LINK_DUPLICATES below. */
/* When linking, duplicate sections of the same name should be
discarded, rather than being combined into a single section as
is usually done. This is similar to how common symbols are
handled. See SEC_LINK_DUPLICATES below. */
#define SEC_LINK_ONCE 0x100000
/* If SEC_LINK_ONCE is set, this bitfield describes how the linker
should handle duplicate sections. */
/* If SEC_LINK_ONCE is set, this bitfield describes how the linker
should handle duplicate sections. */
#define SEC_LINK_DUPLICATES 0x600000
/* This value for SEC_LINK_DUPLICATES means that duplicate
sections with the same name should simply be discarded. */
/* This value for SEC_LINK_DUPLICATES means that duplicate
sections with the same name should simply be discarded. */
#define SEC_LINK_DUPLICATES_DISCARD 0x0
/* This value for SEC_LINK_DUPLICATES means that the linker
should warn if there are any duplicate sections, although
it should still only link one copy. */
/* This value for SEC_LINK_DUPLICATES means that the linker
should warn if there are any duplicate sections, although
it should still only link one copy. */
#define SEC_LINK_DUPLICATES_ONE_ONLY 0x200000
/* This value for SEC_LINK_DUPLICATES means that the linker
should warn if any duplicate sections are a different size. */
/* This value for SEC_LINK_DUPLICATES means that the linker
should warn if any duplicate sections are a different size. */
#define SEC_LINK_DUPLICATES_SAME_SIZE 0x400000
/* This value for SEC_LINK_DUPLICATES means that the linker
should warn if any duplicate sections contain different
contents. */
/* This value for SEC_LINK_DUPLICATES means that the linker
should warn if any duplicate sections contain different
contents. */
#define SEC_LINK_DUPLICATES_SAME_CONTENTS 0x600000
/* This section was created by the linker as part of dynamic
relocation or other arcane processing. It is skipped when
going through the first-pass output, trusting that someone
else up the line will take care of it later. */
/* This section was created by the linker as part of dynamic
relocation or other arcane processing. It is skipped when
going through the first-pass output, trusting that someone
else up the line will take care of it later. */
#define SEC_LINKER_CREATED 0x800000
/* This section should not be subject to garbage collection. */
/* This section should not be subject to garbage collection. */
#define SEC_KEEP 0x1000000
/* This section contains "short" data, and should be placed
"near" the GP. */
/* This section contains "short" data, and should be placed
"near" the GP. */
#define SEC_SMALL_DATA 0x2000000
/* This section contains data which may be shared with other
executables or shared objects. */
/* This section contains data which may be shared with other
executables or shared objects. */
#define SEC_SHARED 0x4000000
/* End of section flags. */
/* When a section with this flag is being linked, then if the size of
the input section is less than a page, it should not cross a page
boundary. If the size of the input section is one page or more, it
should be aligned on a page boundary. */
#define SEC_BLOCK 0x8000000
/* Some internal packed boolean fields. */
/* Conditionally link this section; do not link if there are no
references found to any symbol in the section. */
#define SEC_CLINK 0x10000000
/* See the vma field. */
unsigned int user_set_vma : 1;
/* End of section flags. */
/* Whether relocations have been processed. */
unsigned int reloc_done : 1;
/* Some internal packed boolean fields. */
/* A mark flag used by some of the linker backends. */
unsigned int linker_mark : 1;
/* See the vma field. */
unsigned int user_set_vma : 1;
/* A mark flag used by some linker backends for garbage collection. */
unsigned int gc_mark : 1;
/* Whether relocations have been processed. */
unsigned int reloc_done : 1;
/* End of internal packed boolean fields. */
/* A mark flag used by some of the linker backends. */
unsigned int linker_mark : 1;
/* The virtual memory address of the section - where it will be
at run time. The symbols are relocated against this. The
user_set_vma flag is maintained by bfd; if it's not set, the
backend can assign addresses (for example, in `a.out', where
the default address for `.data' is dependent on the specific
target and various flags). */
/* A mark flag used by some linker backends for garbage collection. */
unsigned int gc_mark : 1;
bfd_vma vma;
/* Used by the ELF code to mark sections which have been allocated to segments. */
unsigned int segment_mark : 1;
/* The load address of the section - where it would be in a
rom image; really only used for writing section header
information. */
/* End of internal packed boolean fields. */
bfd_vma lma;
/* The virtual memory address of the section - where it will be
at run time. The symbols are relocated against this. The
user_set_vma flag is maintained by bfd; if it's not set, the
backend can assign addresses (for example, in `a.out', where
the default address for `.data' is dependent on the specific
target and various flags). */
/* The size of the section in octets, as it will be output.
Contains a value even if the section has no contents (e.g., the
size of `.bss'). This will be filled in after relocation. */
bfd_vma vma;
bfd_size_type _cooked_size;
/* The load address of the section - where it would be in a
rom image; really only used for writing section header
information. */
/* The original size on disk of the section, in octets. Normally this
value is the same as the size, but if some relaxing has
been done, then this value will be bigger. */
bfd_vma lma;
bfd_size_type _raw_size;
/* The size of the section in octets, as it will be output.
Contains a value even if the section has no contents (e.g., the
size of `.bss'). This will be filled in after relocation. */
/* If this section is going to be output, then this value is the
offset in *bytes* into the output section of the first byte in the
input section (byte ==> smallest addressable unit on the
target). In most cases, if this was going to start at the
100th octet (8-bit quantity) in the output section, this value
would be 100. However, if the target byte size is 16 bits
(bfd_octets_per_byte is "2"), this value would be 50. */
bfd_size_type _cooked_size;
bfd_vma output_offset;
/* The original size on disk of the section, in octets. Normally this
value is the same as the size, but if some relaxing has
been done, then this value will be bigger. */
/* The output section through which to map on output. */
bfd_size_type _raw_size;
struct sec *output_section;
/* If this section is going to be output, then this value is the
offset in *bytes* into the output section of the first byte in the
input section (byte ==> smallest addressable unit on the
target). In most cases, if this was going to start at the
100th octet (8-bit quantity) in the output section, this value
would be 100. However, if the target byte size is 16 bits
(bfd_octets_per_byte is "2"), this value would be 50. */
/* The alignment requirement of the section, as an exponent of 2 -
e.g., 3 aligns to 2^3 (or 8). */
bfd_vma output_offset;
unsigned int alignment_power;
/* The output section through which to map on output. */
/* If an input section, a pointer to a vector of relocation
records for the data in this section. */
struct sec *output_section;
struct reloc_cache_entry *relocation;
/* The alignment requirement of the section, as an exponent of 2 -
e.g., 3 aligns to 2^3 (or 8). */
/* If an output section, a pointer to a vector of pointers to
relocation records for the data in this section. */
unsigned int alignment_power;
struct reloc_cache_entry **orelocation;
/* If an input section, a pointer to a vector of relocation
records for the data in this section. */
/* The number of relocation records in one of the above */
struct reloc_cache_entry *relocation;
unsigned reloc_count;
/* If an output section, a pointer to a vector of pointers to
relocation records for the data in this section. */
/* Information below is back end specific - and not always used
or updated. */
struct reloc_cache_entry **orelocation;
/* File position of section data */
/* The number of relocation records in one of the above */
file_ptr filepos;
unsigned reloc_count;
/* File position of relocation info */
/* Information below is back end specific - and not always used
or updated. */
file_ptr rel_filepos;
/* File position of section data. */
/* File position of line data */
file_ptr filepos;
file_ptr line_filepos;
/* File position of relocation info. */
/* Pointer to data for applications */
file_ptr rel_filepos;
PTR userdata;
/* File position of line data. */
/* If the SEC_IN_MEMORY flag is set, this points to the actual
contents. */
unsigned char *contents;
file_ptr line_filepos;
/* Attached line number information */
/* Pointer to data for applications. */
alent *lineno;
PTR userdata;
/* Number of line number records */
/* If the SEC_IN_MEMORY flag is set, this points to the actual
contents. */
unsigned char *contents;
unsigned int lineno_count;
/* Attached line number information. */
/* Optional information about a COMDAT entry; NULL if not COMDAT */
alent *lineno;
struct bfd_comdat_info *comdat;
/* Number of line number records. */
/* When a section is being output, this value changes as more
linenumbers are written out */
unsigned int lineno_count;
file_ptr moving_line_filepos;
/* Optional information about a COMDAT entry; NULL if not COMDAT. */
/* What the section number is in the target world */
struct bfd_comdat_info *comdat;
int target_index;
/* Points to the kept section if this section is a link-once section,
and is discarded. */
struct sec *kept_section;
PTR used_by_bfd;
/* When a section is being output, this value changes as more
linenumbers are written out. */
/* If this is a constructor section then here is a list of the
relocations created to relocate items within it. */
file_ptr moving_line_filepos;
struct relent_chain *constructor_chain;
/* What the section number is in the target world. */
/* The BFD which owns the section. */
int target_index;
bfd *owner;
PTR used_by_bfd;
/* A symbol which points at this section only */
struct symbol_cache_entry *symbol;
struct symbol_cache_entry **symbol_ptr_ptr;
/* If this is a constructor section then here is a list of the
relocations created to relocate items within it. */
struct bfd_link_order *link_order_head;
struct bfd_link_order *link_order_tail;
struct relent_chain *constructor_chain;
/* The BFD which owns the section. */
bfd *owner;
/* A symbol which points at this section only */
struct symbol_cache_entry *symbol;
struct symbol_cache_entry **symbol_ptr_ptr;
struct bfd_link_order *link_order_head;
struct bfd_link_order *link_order_tail;
} asection ;
/* These sections are global, and are managed by BFD. The application
and target back end are not permitted to change the values in
these sections. New code should use the section_ptr macros rather
than referring directly to the const sections. The const sections
may eventually vanish. */
/* These sections are global, and are managed by BFD. The application
and target back end are not permitted to change the values in
these sections. New code should use the section_ptr macros rather
than referring directly to the const sections. The const sections
may eventually vanish. */
#define BFD_ABS_SECTION_NAME "*ABS*"
#define BFD_UND_SECTION_NAME "*UND*"
#define BFD_COM_SECTION_NAME "*COM*"
#define BFD_IND_SECTION_NAME "*IND*"
/* the absolute section */
/* the absolute section */
extern const asection bfd_abs_section;
#define bfd_abs_section_ptr ((asection *) &bfd_abs_section)
#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
/* Pointer to the undefined section */
/* Pointer to the undefined section */
extern const asection bfd_und_section;
#define bfd_und_section_ptr ((asection *) &bfd_und_section)
#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
/* Pointer to the common section */
/* Pointer to the common section */
extern const asection bfd_com_section;
#define bfd_com_section_ptr ((asection *) &bfd_com_section)
/* Pointer to the indirect section */
/* Pointer to the indirect section */
extern const asection bfd_ind_section;
#define bfd_ind_section_ptr ((asection *) &bfd_ind_section)
#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr)
@ -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,
@ -93,7 +87,7 @@ them both!
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
@ -155,7 +149,7 @@ zero.
The general target vector. These vectors are initialized using the
BFD_JUMP_TABLE macros.
/* Generic entry points. */
/* Generic entry points. */
#define BFD_JUMP_TABLE_GENERIC(NAME)\
CAT(NAME,_close_and_cleanup),\
CAT(NAME,_bfd_free_cached_info),\
@ -163,20 +157,20 @@ BFD_JUMP_TABLE macros.
CAT(NAME,_get_section_contents),\
CAT(NAME,_get_section_contents_in_window)
/* Called when the BFD is being closed to do any necessary cleanup. */
/* Called when the BFD is being closed to do any necessary cleanup. */
boolean (*_close_and_cleanup) PARAMS ((bfd *));
/* Ask the BFD to free all cached information. */
/* Ask the BFD to free all cached information. */
boolean (*_bfd_free_cached_info) PARAMS ((bfd *));
/* Called when a new section is created. */
/* Called when a new section is created. */
boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr));
/* Read the contents of a section. */
/* Read the contents of a section. */
boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
file_ptr, bfd_size_type));
boolean (*_bfd_get_section_contents_in_window)
PARAMS ((bfd *, sec_ptr, bfd_window *,
file_ptr, bfd_size_type));
/* Entry points to copy private data. */
/* Entry points to copy private data. */
#define BFD_JUMP_TABLE_COPY(NAME)\
CAT(NAME,_bfd_copy_private_bfd_data),\
CAT(NAME,_bfd_merge_private_bfd_data),\
@ -184,27 +178,27 @@ BFD_JUMP_TABLE macros.
CAT(NAME,_bfd_copy_private_symbol_data),\
CAT(NAME,_bfd_set_private_flags),\
CAT(NAME,_bfd_print_private_bfd_data)\
/* Called to copy BFD general private data from one object file
/* Called to copy BFD general private data from one object file
to another. */
boolean (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *));
/* Called to merge BFD general private data from one object file
/* Called to merge BFD general private data from one object file
to a common output file when linking. */
boolean (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *));
/* Called to copy BFD private section data from one object file
/* Called to copy BFD private section data from one object file
to another. */
boolean (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr,
bfd *, sec_ptr));
/* Called to copy BFD private symbol data from one symbol
/* Called to copy BFD private symbol data from one symbol
to another. */
boolean (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *,
bfd *, asymbol *));
/* Called to set private backend flags */
/* Called to set private backend flags */
boolean (*_bfd_set_private_flags) PARAMS ((bfd *, flagword));
/* Called to print private BFD data */
/* Called to print private BFD data */
boolean (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR));
/* Core file entry points. */
/* Core file entry points. */
#define BFD_JUMP_TABLE_CORE(NAME)\
CAT(NAME,_core_file_failing_command),\
CAT(NAME,_core_file_failing_signal),\
@ -213,7 +207,7 @@ BFD_JUMP_TABLE macros.
int (*_core_file_failing_signal) PARAMS ((bfd *));
boolean (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *));
/* Archive entry points. */
/* Archive entry points. */
#define BFD_JUMP_TABLE_ARCHIVE(NAME)\
CAT(NAME,_slurp_armap),\
CAT(NAME,_slurp_extended_name_table),\
@ -242,7 +236,7 @@ BFD_JUMP_TABLE macros.
int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *));
boolean (*_bfd_update_armap_timestamp) PARAMS ((bfd *));
/* Entry points used for symbols. */
/* Entry points used for symbols. */
#define BFD_JUMP_TABLE_SYMBOLS(NAME)\
CAT(NAME,_get_symtab_upper_bound),\
CAT(NAME,_get_symtab),\
@ -275,7 +269,7 @@ BFD_JUMP_TABLE macros.
struct sec *section, struct symbol_cache_entry **symbols,
bfd_vma offset, CONST char **file, CONST char **func,
unsigned int *line));
/* Back-door to allow format-aware applications to create debug symbols
/* Back-door to allow format-aware applications to create debug symbols
while using BFD for everything else. Currently used by the assembler
when creating COFF files. */
asymbol * (*_bfd_make_debug_symbol) PARAMS ((
@ -291,7 +285,7 @@ BFD_JUMP_TABLE macros.
asymbol *(*_minisymbol_to_symbol) PARAMS ((bfd *, boolean, const PTR,
asymbol *));
/* Routines for relocs. */
/* Routines for relocs. */
#define BFD_JUMP_TABLE_RELOCS(NAME)\
CAT(NAME,_get_reloc_upper_bound),\
CAT(NAME,_canonicalize_reloc),\
@ -299,12 +293,12 @@ BFD_JUMP_TABLE macros.
long (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));
long (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,
struct symbol_cache_entry **));
/* See documentation on reloc types. */
/* See documentation on reloc types. */
reloc_howto_type *
(*reloc_type_lookup) PARAMS ((bfd *abfd,
bfd_reloc_code_real_type code));
/* Routines used when writing an object file. */
/* Routines used when writing an object file. */
#define BFD_JUMP_TABLE_WRITE(NAME)\
CAT(NAME,_set_arch_mach),\
CAT(NAME,_set_section_contents)
@ -313,7 +307,7 @@ BFD_JUMP_TABLE macros.
boolean (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
file_ptr, bfd_size_type));
/* Routines used by the linker. */
/* Routines used by the linker. */
#define BFD_JUMP_TABLE_LINK(NAME)\
CAT(NAME,_sizeof_headers),\
CAT(NAME,_bfd_get_relocated_section_contents),\
@ -332,37 +326,37 @@ BFD_JUMP_TABLE macros.
boolean (*_bfd_relax_section) PARAMS ((bfd *, struct sec *,
struct bfd_link_info *, boolean *again));
/* Create a hash table for the linker. Different backends store
/* Create a hash table for the linker. Different backends store
different information in this table. */
struct bfd_link_hash_table *(*_bfd_link_hash_table_create) PARAMS ((bfd *));
/* Add symbols from this object file into the hash table. */
/* Add symbols from this object file into the hash table. */
boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
/* Do a link based on the link_order structures attached to each
/* Do a link based on the link_order structures attached to each
section of the BFD. */
boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *));
/* Should this section be split up into smaller pieces during linking. */
/* Should this section be split up into smaller pieces during linking. */
boolean (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *));
/* Remove sections that are not referenced from the output. */
/* Remove sections that are not referenced from the output. */
boolean (*_bfd_gc_sections) PARAMS ((bfd *, struct bfd_link_info *));
/* Routines to handle dynamic symbols and relocs. */
/* Routines to handle dynamic symbols and relocs. */
#define BFD_JUMP_TABLE_DYNAMIC(NAME)\
CAT(NAME,_get_dynamic_symtab_upper_bound),\
CAT(NAME,_canonicalize_dynamic_symtab),\
CAT(NAME,_get_dynamic_reloc_upper_bound),\
CAT(NAME,_canonicalize_dynamic_reloc)
/* Get the amount of memory required to hold the dynamic symbols. */
/* Get the amount of memory required to hold the dynamic symbols. */
long (*_bfd_get_dynamic_symtab_upper_bound) PARAMS ((bfd *));
/* Read in the dynamic symbols. */
/* Read in the dynamic symbols. */
long (*_bfd_canonicalize_dynamic_symtab)
PARAMS ((bfd *, struct symbol_cache_entry **));
/* Get the amount of memory required to hold the dynamic relocs. */
/* Get the amount of memory required to hold the dynamic relocs. */
long (*_bfd_get_dynamic_reloc_upper_bound) PARAMS ((bfd *));
/* Read in the dynamic relocs. */
/* Read in the dynamic relocs. */
long (*_bfd_canonicalize_dynamic_reloc)
PARAMS ((bfd *, arelent **, struct symbol_cache_entry **));
A pointer to an alternative bfd_target in case the current one is not
@ -370,7 +364,7 @@ satisfactory. This can happen when the target cpu supports both big
and little endian code, and target chosen by the linker has the wrong
endianness. The function open_output() in ld/ldlang.c uses this field
to find an alternative output format that is suitable.
/* Opposite endian version of this target. */
/* Opposite endian version of this target. */
const struct bfd_target * alternative_target;
Data for use by back-end routines, which isn't generic enough to
belong in this structure.
@ -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
@ -463,9 +457,9 @@ architecture, containing, for example, 2 and 3 for Intel i960 KA and
i960 KB, and 68020 and 68030 for Motorola 68020 and 68030.
enum bfd_architecture
{
bfd_arch_unknown, /* File arch not known */
bfd_arch_obscure, /* Arch known, not one of these */
bfd_arch_m68k, /* Motorola 68xxx */
bfd_arch_unknown, /* File arch not known */
bfd_arch_obscure, /* Arch known, not one of these */
bfd_arch_m68k, /* Motorola 68xxx */
#define bfd_mach_m68000 1
#define bfd_mach_m68008 2
#define bfd_mach_m68010 3
@ -474,9 +468,9 @@ i960 KB, and 68020 and 68030 for Motorola 68020 and 68030.
#define bfd_mach_m68040 6
#define bfd_mach_m68060 7
#define bfd_mach_cpu32 8
bfd_arch_vax, /* DEC Vax */
bfd_arch_i960, /* Intel 960 */
/* The order of the following is important.
bfd_arch_vax, /* DEC Vax */
bfd_arch_i960, /* Intel 960 */
/* The order of the following is important.
lower number indicates a machine type that
only accepts a subset of the instructions
available to machines with higher numbers.
@ -493,21 +487,24 @@ i960 KB, and 68020 and 68030 for Motorola 68020 and 68030.
#define bfd_mach_i960_jx 7
#define bfd_mach_i960_hx 8
bfd_arch_a29k, /* AMD 29000 */
bfd_arch_sparc, /* SPARC */
bfd_arch_a29k, /* AMD 29000 */
bfd_arch_sparc, /* SPARC */
#define bfd_mach_sparc 1
/* The difference between v8plus and v9 is that v9 is a true 64 bit env. */
/* The difference between v8plus and v9 is that v9 is a true 64 bit env. */
#define bfd_mach_sparc_sparclet 2
#define bfd_mach_sparc_sparclite 3
#define bfd_mach_sparc_v8plus 4
#define bfd_mach_sparc_v8plusa 5 /* with ultrasparc add'ns */
#define bfd_mach_sparc_v8plusa 5 /* with ultrasparc add'ns */
#define bfd_mach_sparc_sparclite_le 6
#define bfd_mach_sparc_v9 7
#define bfd_mach_sparc_v9a 8 /* with ultrasparc add'ns */
/* Nonzero if MACH has the v9 instruction set. */
#define bfd_mach_sparc_v9a 8 /* with ultrasparc add'ns */
#define bfd_mach_sparc_v8plusb 9 /* with cheetah add'ns */
#define bfd_mach_sparc_v9b 10 /* with cheetah add'ns */
/* Nonzero if MACH has the v9 instruction set. */
#define bfd_mach_sparc_v9_p(mach) \
((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9a)
bfd_arch_mips, /* MIPS Rxxxx */
((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \
&& (mach) != bfd_mach_sparc_sparclite_le)
bfd_arch_mips, /* MIPS Rxxxx */
#define bfd_mach_mips3000 3000
#define bfd_mach_mips3900 3900
#define bfd_mach_mips4000 4000
@ -523,36 +520,66 @@ 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
bfd_arch_i386, /* Intel 386 */
#define bfd_mach_mips32 32
#define bfd_mach_mips32_4k 3204113 /* 32, 04, octal 'K' */
#define bfd_mach_mips5 5
#define bfd_mach_mips64 64
#define bfd_mach_mips_sb1 12310201 /* octal 'SB', 01 */
bfd_arch_i386, /* Intel 386 */
#define bfd_mach_i386_i386 0
#define bfd_mach_i386_i8086 1
#define bfd_mach_i386_i386_intel_syntax 2
bfd_arch_we32k, /* AT&T WE32xxx */
bfd_arch_tahoe, /* CCI/Harris Tahoe */
bfd_arch_i860, /* Intel 860 */
bfd_arch_i370, /* IBM 360/370 Mainframes */
bfd_arch_romp, /* IBM ROMP PC/RT */
bfd_arch_alliant, /* Alliant */
bfd_arch_convex, /* Convex */
bfd_arch_m88k, /* Motorola 88xxx */
bfd_arch_pyramid, /* Pyramid Technology */
bfd_arch_h8300, /* Hitachi H8/300 */
#define bfd_mach_x86_64 3
#define bfd_mach_x86_64_intel_syntax 4
bfd_arch_we32k, /* AT&T WE32xxx */
bfd_arch_tahoe, /* CCI/Harris Tahoe */
bfd_arch_i860, /* Intel 860 */
bfd_arch_i370, /* IBM 360/370 Mainframes */
bfd_arch_romp, /* IBM ROMP PC/RT */
bfd_arch_alliant, /* Alliant */
bfd_arch_convex, /* Convex */
bfd_arch_m88k, /* Motorola 88xxx */
bfd_arch_pyramid, /* Pyramid Technology */
bfd_arch_h8300, /* Hitachi H8/300 */
#define bfd_mach_h8300 1
#define bfd_mach_h8300h 2
#define bfd_mach_h8300s 3
bfd_arch_powerpc, /* PowerPC */
bfd_arch_rs6000, /* IBM RS/6000 */
bfd_arch_hppa, /* HP PA RISC */
bfd_arch_d10v, /* Mitsubishi D10V */
bfd_arch_powerpc, /* PowerPC */
#define bfd_mach_ppc 0
#define bfd_mach_ppc_403 403
#define bfd_mach_ppc_403gc 4030
#define bfd_mach_ppc_505 505
#define bfd_mach_ppc_601 601
#define bfd_mach_ppc_602 602
#define bfd_mach_ppc_603 603
#define bfd_mach_ppc_ec603e 6031
#define bfd_mach_ppc_604 604
#define bfd_mach_ppc_620 620
#define bfd_mach_ppc_630 630
#define bfd_mach_ppc_750 750
#define bfd_mach_ppc_860 860
#define bfd_mach_ppc_a35 35
#define bfd_mach_ppc_rs64ii 642
#define bfd_mach_ppc_rs64iii 643
#define bfd_mach_ppc_7400 7400
bfd_arch_rs6000, /* IBM RS/6000 */
#define bfd_mach_rs6k 0
#define bfd_mach_rs6k_rs1 6001
#define bfd_mach_rs6k_rsc 6003
#define bfd_mach_rs6k_rs2 6002
bfd_arch_hppa, /* HP PA RISC */
bfd_arch_d10v, /* Mitsubishi D10V */
#define bfd_mach_d10v 0
#define bfd_mach_d10v_ts2 2
#define bfd_mach_d10v_ts3 3
bfd_arch_d30v, /* Mitsubishi D30V */
bfd_arch_z8k, /* Zilog Z8000 */
bfd_arch_d30v, /* Mitsubishi D30V */
bfd_arch_m68hc11, /* Motorola 68HC11 */
bfd_arch_m68hc12, /* Motorola 68HC12 */
bfd_arch_z8k, /* Zilog Z8000 */
#define bfd_mach_z8001 1
#define bfd_mach_z8002 2
bfd_arch_h8500, /* Hitachi H8/500 */
bfd_arch_sh, /* Hitachi SH */
bfd_arch_h8500, /* Hitachi H8/500 */
bfd_arch_sh, /* Hitachi SH */
#define bfd_mach_sh 0
#define bfd_mach_sh2 0x20
#define bfd_mach_sh_dsp 0x2d
@ -560,11 +587,11 @@ i960 KB, and 68020 and 68030 for Motorola 68020 and 68030.
#define bfd_mach_sh3_dsp 0x3d
#define bfd_mach_sh3e 0x3e
#define bfd_mach_sh4 0x40
bfd_arch_alpha, /* Dec Alpha */
bfd_arch_alpha, /* Dec Alpha */
#define bfd_mach_alpha_ev4 0x10
#define bfd_mach_alpha_ev5 0x20
#define bfd_mach_alpha_ev6 0x30
bfd_arch_arm, /* Advanced Risc Machines ARM */
bfd_arch_arm, /* Advanced Risc Machines ARM */
#define bfd_mach_arm_2 1
#define bfd_mach_arm_2a 2
#define bfd_mach_arm_3 3
@ -573,32 +600,43 @@ 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
bfd_arch_ns32k, /* National Semiconductors ns32000 */
bfd_arch_w65, /* WDC 65816 */
bfd_arch_tic30, /* Texas Instruments TMS320C30 */
bfd_arch_tic80, /* TI TMS320c80 (MVP) */
bfd_arch_v850, /* NEC V850 */
#define bfd_mach_arm_5TE 9
#define bfd_mach_arm_XScale 10
bfd_arch_ns32k, /* National Semiconductors ns32000 */
bfd_arch_w65, /* WDC 65816 */
bfd_arch_tic30, /* Texas Instruments TMS320C30 */
bfd_arch_tic54x, /* Texas Instruments TMS320C54X */
bfd_arch_tic80, /* TI TMS320c80 (MVP) */
bfd_arch_v850, /* NEC V850 */
#define bfd_mach_v850 0
#define bfd_mach_v850e 'E'
#define bfd_mach_v850ea 'A'
bfd_arch_arc, /* Argonaut RISC Core */
#define bfd_mach_arc_base 0
bfd_arch_m32r, /* Mitsubishi M32R/D */
#define bfd_mach_m32r 0 /* backwards compatibility */
bfd_arch_arc, /* ARC Cores */
#define bfd_mach_arc_5 0
#define bfd_mach_arc_6 1
#define bfd_mach_arc_7 2
#define bfd_mach_arc_8 3
bfd_arch_m32r, /* Mitsubishi M32R/D */
#define bfd_mach_m32r 0 /* backwards compatibility */
#define bfd_mach_m32rx 'x'
bfd_arch_mn10200, /* Matsushita MN10200 */
bfd_arch_mn10300, /* Matsushita MN10300 */
bfd_arch_mn10200, /* Matsushita MN10200 */
bfd_arch_mn10300, /* Matsushita MN10300 */
#define bfd_mach_mn10300 300
#define bfd_mach_am33 330
bfd_arch_fr30,
#define bfd_mach_fr30 0x46523330
bfd_arch_mcore,
bfd_arch_ia64, /* HP/Intel ia64 */
#define bfd_mach_ia64_elf64 0
#define bfd_mach_ia64_elf32 1
bfd_arch_pj,
bfd_arch_avr, /* Atmel AVR microcontrollers */
bfd_arch_avr, /* Atmel AVR microcontrollers */
#define bfd_mach_avr1 1
#define bfd_mach_avr2 2
#define bfd_mach_avr3 3
#define bfd_mach_avr4 4
#define bfd_mach_avr5 5
bfd_arch_cris, /* Axis CRIS */
bfd_arch_last
};
@ -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
@ -997,16 +1037,16 @@ detecting sins such as passing a pointer. To detect calling these with
less than a `bfd_vma', use `gcc -Wconversion' on a host with 64 bit
`bfd_vma''s.
/* Byte swapping macros for user section data. */
/* 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)))
@ -1059,7 +1099,7 @@ records of object files. Believe it or not, some object files keep
their header records in big endian order and their data in little
endian order.
/* Byte swapping macros for file header data. */
/* Byte swapping macros for file header data. */
#define bfd_h_put_8(abfd, val, ptr) \
bfd_put_8 (abfd, 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::

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